Open orbita2d opened 5 months ago
Thank you for the report. The macro definition of \sfrac
in xfrac.sty.ltxml
is currently internally expanding to a variant of \nicefrac
, which causes the error in the raw latex
call - which tries to typeset \nicefrac
without nicefrac.sty
loaded.
I'm curious what the best fix is here. The current implementation is expediently reusing some internal macros from the nicefrac binding, which leads to the reversion of \sfrac
ending up incorrect (as in - missing dependencies).
Edit: And maybe it's also worth stating that this kind of fragility could be expected in any binding which has made the decision to require packages in the .ltxml
file that are not required in the original .sty
/.cls
file. So there is a more general problem to solve beyond the (very nice!) minimal working example.
Workaround:
%\usepackage{xfrac}
\usepackage{nicefrac}
\newcommand{\sfrac}{\nicefrac}
I don't know the architecture to suggest anything, but it's not obvious to me why the pipeline for latex->xml would need to be the same as the one for rendering to svg.
The main benefit of using --mathsvg in my view is to be able to do math rendering with all the bells and whistles which latex allows (which MathML/latexml/whatever will not support). So the svg rendering process should be as transparent as possible.
@orbita2d
The main benefit of using --mathsvg in my view is to be able to do math rendering with all the bells and whistles which latex allows (which MathML/latexml/whatever will not support).
Well, maybe. But you also have the option to convert to MathML and then use MathJax to render that as SVG as a final step in the browser.
LaTeXML's primary math output format today is MathML, and most of our testing and development work is aimed there. I think the other formats are there for a good reason, but your expectation shouldn't be that they are/will always be better than MathML.
Sure, I'm happy to accept that my preferences are not shared.
latexml 0.8.8
Example
latexml --dest=test.xml test.tex latexmlpost --dest=test.html --mathsvg test.xml
What I expect to happen: Document is built, including an svg showing the fraction 1/2
What happens instead:
SVG conversion fails
This happens as sfrac is converted to nicefrac by latexml, which is not understood by ltxmlimg