Fix math spacing around parentheses #334
Merged
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.
Version 0.0.7 adds arbitrary Unicode character support in math expressions and now it is legal to write literal parentheses characters (
(
and)
) in math expressions.However, math-class for parentheses are not properly set now, and math expressions containing these characters cause incorrect spacing.
I know the use of
math-paren
is recommended way to write parentheses and when we usemath-paren
, spacing around parentheses is correct.But, parentheses are used very often in math expressions, so the use of literal
(
and)
is more handy.Although We can use
set-math-char
primitive in our document file to set math-class for these characters to avoid the spacing problem, for often used symbols setting math-class in SATySFi itself seems reasonable.For example, math-class of binary operators like
+
and relational operators like=
are set insrc/frontend/primitives.cppo.ml
.How about supporting literal parentheses characters officially by setting math-class correctly?
This PR sets math-class for parentheses symbols as follows.
(
(U+0028) to have math-classMathOpen
)
(U+0029) to have math-classMathClose
Here is a demo for spacing around parentheses.