LaTeXML
LaTeXML copied to clipboard
Support for the .sty files already included in the directory
When using latexml to convert arXiv paper to HTML, it is common to face problems that something is undefined due to the miss of sty files. However, the author includes all the sty files just in the same directory.
Are there any method to preload sty files which are already included in the input directory? IMHO, latexml can be more flexible in this way and does not have to adapt to many sty files by hand.
@sherlcok314159 tthis is already available in LaTeXML as an experimental switch through latexml.sty.ltxml. It is used in both ar5iv and today's native arXiv HTML.
The feature can be activated with passing an option through the --preload command-line option. The used variant is essentially:
latexmlc --preload=[localrawstyles]latexml.sty ...
There are several variations:
- default:
norawstylesandnorawclasses.- That means
.styor.clsfiles are not loaded unless explicitly requeted by a.ltxmlbinding.
- That means
localrawstyles- allow detecting and loading raw.styfiles found in the local searchpaths available to LaTeXML (either via the source directory, or the--pathadditions).localrawclasses- same aslocalrawstyles, but targeting.clsfiles.rawstyles- same aslocalrawstylesbut allows global search via kpsewhich, so also permits using a texlive installationrawclasses- same aslocalrawclassesbut allows global search via kpsewhich, so also permits using a texlive installation
It is often the case in recent arXiv conversions with LaTeXML that some of the (many) subtle differences in implementation between LaTeXML and the native latex.ltx machinery leads to fragility in the internal expansion mechanics. Which can cascade into undefined macros, or at aworst even infinite loops. To that end there is an active project targeting loading the native latex.ltx in its entirety, and we are cataloging all cases where today's latexml hits issues to also improve the binding code. You are always welcome to report those in the arXiv/html_feedback or ar5iv repositories.
Source link: https://github.com/brucemiller/LaTeXML/blob/40e9fa89efbf4006ddf06ecb57da4588aa661b4e/lib/LaTeXML/Package/latexml.sty.ltxml#L60-L66
Edit: I see we've added these in 2020. I recall we followed the same reasoning that led you to opening this issues.
Thanks so much for the detailed explanation. Maybe you can add an external docker run argument for supporting local sty files if you have time. @bfirsh
I think the latest ar5ivist Dockerfile should already allow for modding these options, as it uses a base image. And a user ought to be able to override via calling with a different --preload from outside, as later option values can override earlier ones (at least in this specific case).
Code here:
https://github.com/dginev/ar5ivist/blob/main/ar5ivist/Dockerfile#L19
Thanks for your quick reply. But I am using engrafo. It will be much more convenient if engrafo also accepts preload argument or automatically scans the folder to add the external sty files. Can you help to do this?
@sherlcok314159 sorry, I am not a maintainer of engrafo. There is a natural continuation between the projects as you can read at the present day page of https://www.arxiv-vanity.com/
I suspect eventually arXiv may maintain their own official latexml Dockerfile. We have an open issue about doing this on the latexml side ( #1178 ), which is still pending some resolution.
For the moment I plan on maintaining ar5ivist, as long as ar5iv keeps getting actively updated. So we should probably close this issue if there is nothing else to do on the latexml side of affairs.