-
-
Notifications
You must be signed in to change notification settings - Fork 68
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
Minus for subtraction and minus for negative numbers not differentiated in default HTML math output #234
Comments
I agree on all these points. Transferring this to texmath, which actually does the conversion. |
One issue should perhaps be addressed in the tex reader:
Ideally this would not be parsed as a symbol in category Bin (binary operator). But this would require a bit more sophistication than we currently have in the parser. For the other issue we have
which is fine, but something is going on in the pandoc writer, which adds the spacing around the binary operator in one context but not the other:
|
Previously spaces around binary operators were omitted when they occurred inside parens or brackets. See #234.
Pushed a change that fixes the second issue. Not yet the first. |
Looks like we already have code in the TeX reader to change some Bins to Ops. This code is too simple; we need to look at the atom before the symbol as well as the one after it. |
Texbook says:
|
If you use a LaTeX-based output, LaTeX is smart enough to distinguish between minus signs (usually hyphens in the input in math mode) used for subtraction (a binary operation) and minus signs used for negatives (a monadic operation), and spaces them differently. E.g.,
$5-3$
will give "5 − 3" (spaces), whereas just$-3$
will give "−3" (no space).But with pandoc's default method for handling math in HTML based output (and presumably other non-LaTeX formats), you always get a space before and after a minus sign if not inside parentheses, which is pretty bad looking for something as simple as
$-3$
.I realize it may be a stretch to expect it to differentiate between them, but it would certainly lead to better output.
A related aside, I gather it was an intentional decision not to put spaces around binary and relational operators when inside parentheses. But it's an awful decision, and the results look both bad and inconsistent. I can't believe anyone would prefer "∀x(Fx→Gx)" to "∀x(Fx → Gx)", or "2 + (2+3)" to "2 + (2 + 3)". I would very very very much appreciate an option to always have spaces for binary and relational operators, or perhaps an option to wrap them in a span with a css class so the spacing can be tweaked via css.
(Pandoc 3.1.11.1 on ArchLinux x86_64)
The text was updated successfully, but these errors were encountered: