-
Notifications
You must be signed in to change notification settings - Fork 106
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
\mid incorrectly parsed as fence #2503
Comments
Vertbars are actually the least simple operators :> Too much ambiguity. Valid problem of course. |
PS: pleased to report that after assigning role |
To state the issue a bit more precisely (then I'll shut up!), the grammar should make more use of |
Sometimes that's a chained divides RELOP, sometimes they are fences for an inner product with bra-ket notation And then we also have the much simpler (but rarer) multiplication of two factors with an intermediate absolute value term: It's tricky. |
Your last example is not I would say it's not good that the grammar can change the class (meaning rel,ord,bin) of a character because that will definitely produce different visual output than LaTeX. |
Try a quick Google search with There may be some middle ground, who knows :> |
I did, and was I proven wrong... Ok, ok, I checked what MathJax does here. It is both better and worse. The MathML will report So by using the wrong spacing, LaTeXML is actually helping me notice that the parsing is not doing what I want. I am not so sure what my question is anymore. Let me rephrase. Say I am uploading a paper on arXiv. How could I go about forcing |
Alas, that is not something we want authors to be thinking about in the "standard LaTeX ecosystem". One day a sophisticated math grammar (or other AI tool) may be able to understand the intention. The arXiv requirement at present is roughly approximate to "a PDF that reads well upon review by the author." I would probably go about this by first creating a wrapper in latexml.sty following DefConstructor('\lxRel{}', "<ltx:XMWrap role='RELOP'>#1</ltx:XMWrap>",
requireMath => 1, reversion => '#1', alias => ''); Then wait for that \usepackage{latexml}
\def\myrelbar{\lxRel{\mid}} It may be helpful to expose all/most of the grammar categories as macros, and maybe also dust off the DLMF "semantic macros", but that is also all in @brucemiller's court. Some of these (latexml.sty in particular) would even be nice to have in CTAN. |
The simple
renders as
because
\mid
gets parsed as a fence, and is given inner spacing 0, even though it is a binary relation (and LaTeX spaces it as such). More worringly, MathJax will spell this out as 'absolute value'.I think LaTeXML should treat
\mid
(and\mvert
) more likeRELOP
thanVERTBAR
. This may require some changes to the grammar e.g. around the ruleMIDDLE
to catch uses like\{ x \in A \mid P(x) \}
.The text was updated successfully, but these errors were encountered: