-
Notifications
You must be signed in to change notification settings - Fork 71
Added the bra and ket commands for Dirac notation support #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Happypig375
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional tests should also be added to CSharpMath.Rendering.Tests. Test cases are located in TestRenderingMathData.cs, run all tests once to generate a reference picture so that future changes will render correctly.
CSharpMath/Atom/LaTeXParser.cs
Outdated
| return new LargeOperator(operatorname, null); | ||
| case "bra": | ||
| var braContents = BuildInternal(true); | ||
| return new Inner(new Boundary("〈"), braContents ?? new MathList(), new Boundary("|")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When BuildInternal returns null, an parsing error has occured. braContents and kerContents should be checked for null and return null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in the latest commit.
| }) | ||
| ); | ||
| Assert.Equal(@"\ket{i}", LaTeXParser.MathListToLaTeX(list).ToString()); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional tests regarding parsing errors inside \bra and \ket should be added to TestErrors at the bottom of this file. The current implementation doesn't handle these cases correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I replicated some of the parsing error tests for powers and \sqrt.
|
The documentation states that Also, a comment should be left linking to the package provided in the post. |
- Changed \bra and \ket to \Bra and \Ket - Added a comment linking back to the original LaTeX package - Added parse error unit tests for \Bra and \Ket
|
I've made all of the requested changes. Let me know if there's anything else you need. |
|
@jclapis Thank you for your contribution! |
This pull request adds the
\bra{}and\ket{}commands, which are useful shorthand commands for work involving quantum mechanics and Dirac notation.Example of a common use case:

Their implementation is inspired by the popular braket LaTeX package.