-
Notifications
You must be signed in to change notification settings - Fork 255
Fraction data model + parser #202
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e14d91d
[item 1] Add MTFractionStyle and MTFractionAlignment public enums
kostub 2d8c8a9
[item 2] Add styleOverride/isContinuedFraction/numeratorAlignment to …
kostub 1ed1704
[item 3] Serialize MTFraction.styleOverride as \displaystyle/\textsty…
kostub 32b2ff2
[item 4] Add +fractionMacroCommands dispatch table
kostub 5a08a8a
[item 5] Add -readOptionalAlignment: helper for \cfrac
kostub 3e55409
[item 6] Route \frac and \binom through fractionMacroCommands dispatch
kostub a8131ce
[item 7] Parser tests for \dfrac, \tfrac, \dbinom, \tbinom
kostub 265988b
[item 8] Parser tests for \cfrac and optional alignment
kostub f79d7c0
[item 9] Nested \dfrac parsing regression test
kostub 52ee23e
[review] Document lossy round-trip and tighten new fraction tests
kostub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The current implementation of
appendLaTeXToString:forMTFractionhas several issues:\displaystyle{...}is not equivalent to setting the fraction's style. In TeX, if a fraction is in Display style, its operands are typeset in Text style (Rule 15). Forcing operands to\displaystyleresults in incorrect sizing and placement of sub-elements (like limits on sums) within the fraction.isContinuedFractionflag andnumeratorAlignment(used by\cfrac) are completely lost during serialization. This breaks the "round-trip" goal mentioned in the PR description.\displaystyle{...}is a non-standard grouping (it's a switch, not a command taking an argument), although some parsers accept it. Canonical LaTeX would be{\displaystyle ...}.\dfrac,\tfrac,\cfrac,\dbinom, and\tbinom, the serializer should use these macros when the properties match. This ensures a faithful round-trip of the data model.I suggest refactoring this method to use the specific macros based on the atom's properties.