Skip to content
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

Infix \vert produces wrong math output #958

Closed
dginev opened this issue Mar 13, 2018 · 2 comments
Closed

Infix \vert produces wrong math output #958

dginev opened this issue Mar 13, 2018 · 2 comments

Comments

@dginev
Copy link
Collaborator

@dginev dginev commented Mar 13, 2018

I have distilled a minimal example from the arxiv-vanity 1603.00788, which (besides some missing package issues, notably glossaries.sty) has some broken equations.

The core problem comes from a redefinition of \mid as:

\documentclass{article}

\usepackage{amsmath}
\DeclareRobustCommand{\mb}[1]{\mathbf{\boldsymbol{#1}}}
\renewcommand{\mid}{~\vert~}
\newcommand{\mbx}{\mb{x}}
\newcommand{\mbtheta}{\mb{\theta}}

\begin{document}

$p (\mbx\mid\mbtheta)$

\end{document}

The problems are two-fold:

  • First, firefox renders the MathML with the vertical bar as prefix, as opposed to the regular probability syntax in the PDF:

    • Firefox: ffmath

    • PDF: pdftest

    • I haven't checked the mathjax rendering, but there comes part 2 of the issue.

  • Second, the tex attribute is very low-level and out of scope for renderers like MathJax, because of commands such as \leavevmode and \nobreak. This may not be latexml's problem to solve, and could indeed be better addressed by solving #432 , which suggests adding a "high-level macro" math annotation attribute. My minimal example produces a slightly different string, but on arxiv-vanity it is:

    p(\mathbf{\boldsymbol{x}}\leavevmode\nobreak\ |\leavevmode\nobreak\ \mathbf{%
    \boldsymbol{\theta}})
@dginev
Copy link
Collaborator Author

@dginev dginev commented Mar 13, 2018

I should also attach the presentation MathML that I made a FF screenshot for:

<mrow>
   <mi>p</mi>
   <mo>⁢</mo>
   <mrow>
      <mo stretchy="false">(</mo>
      <mrow>
         <mo rspace="5.8pt" stretchy="false">|</mo>
         <mo>⁡</mo>
         <mpadded width="+3.3pt">
            <mi>&#x1d431;</mi>
         </mpadded>
         <mi>&#x1d73d;</mi>
      </mrow>
      <mo stretchy="false">)</mo>
   </mrow>
</mrow>
@brucemiller
Copy link
Owner

@brucemiller brucemiller commented Mar 14, 2018

Ah, simple problem; when I tweaked the grammar to recognize various forms of VERTBAR as infix, I forgot to update the grammatical role so postprocessing would treat it as infix. Fixed now! Thanks for the report.

@dginev dginev modified the milestones: LaTeXML-0.8.4, LaTeXML-0.8.3 Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants