brucemiller / LaTeXML

LaTeXML: a TeX and LaTeX to XML/HTML/ePub/MathML translator.
http://dlmf.nist.gov/LaTeXML/
Other
961 stars 101 forks source link

Tikz cd #2325

Closed brucemiller closed 9 months ago

brucemiller commented 9 months ago

This PR provides a binding for tikz-cd, after fixing some infrastructure.

The critical bug was that ALIGN_STATE which tracks {} during scanning to enable or disable certain alignment tokens (&,\cr,...) was being done too late (in Stomach rather than Gullet). It's easy to miss some corner cases, so some sandbox testing is warranted.

This is a WiP since the resulting svg are displayed too low; there would seem to be one too many adjustments involving pgf@pixminy (?) , although other tikz pictures seem mostly correct.

dginev commented 9 months ago

I was just discussing with arXiv three of our existing successful Tikz conversions, and did a quick test with this PR - linking to the significantly older ar5iv editions:

So, focusing on the one pgfplots case that regressed: it indeed works with the latexml master branch. Isolating a minimal regressing example:

\documentclass{article}
\begin{filecontents}{coord.txt}
  nc    I_M_opt I_J I
  1.000000  0.000000    0.000000    0.001190
  2.000000  0.004133    0.003861    0.002870
  3.000000  0.005510    0.007181    0.004562
\end{filecontents}

\usepackage{pgfplotstable}

\begin{document}

\begin{tikzpicture}
\begin{loglogaxis}[legend style={cells={align=left}}]
\pgfplotstableread{coord.txt}\mytable
\addplot[solid] table[x=nc,y=I] {\mytable};
\addlegendentry{legend}
\end{loglogaxis}
\end{tikzpicture}

\end{document}

Edit: can confirm this was fixed by 5298bf8 !