LaTeXML
LaTeXML copied to clipboard
redefining `\SS` doesn't work as expected
trafficstars
MWE:
\documentclass{article}
\newcommand{\Scal}{\mathcal{S}}
\renewcommand\SS{\mathcal{S}}
\begin{document}
$\Scal$
x
$\SS{\gamma}$
\end{document}
LaTeXML output:
<document xmlns="http://dlmf.nist.gov/LaTeXML">
<resource src="LaTeXML.css" type="text/css"/>
<resource src="ltx-article.css" type="text/css"/>
<para xml:id="p1">
<p><Math mode="inline" tex="\mathcal{S}" text="S" xml:id="p1.m1">
<XMath>
<XMTok font="caligraphic" role="UNKNOWN">S</XMTok>
</XMath>
</Math></p>
</para>
<para xml:id="p2">
<p>x</p>
</para>
<para xml:id="p3">
<p><Math mode="inline" tex="\SS{\gamma}" text="SS * gamma" xml:id="p3.m1">
<XMath>
<XMApp>
<XMTok meaning="times" role="MULOP"></XMTok>
<XMTok role="UNKNOWN">SS</XMTok>
<XMTok font="italic" name="gamma" role="UNKNOWN">γ</XMTok>
</XMApp>
</XMath>
</Math></p>
</para>
</document>
Expected output:
[...]
<p><Math mode="inline" tex="\mathcal{S}{\gamma}" text="SS * gamma" xml:id="p3.m1">
[...]
(Resolve \SS.)
Indeed, it is locked, the log tells you:
Info:ignore:\SS Ignoring redefinition of \SS at test.tex; line 4 col 0
The perl code is: https://github.com/brucemiller/LaTeXML/blob/faa73d9351388d85e2481b77b131084be46b5e5a/lib/LaTeXML/Package/LaTeX.pool.ltxml#L5471-L5472
So this may be a limitation we can upgrade away from only after we switch to fully loading latex.ltx raw...
For the short term you could use a different macro, or provide your own binding that repeats the DefPrimitive while simply removing the "locked" directive.