brucemiller / LaTeXML

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

subfiles.sty redefines only secondary {document} uses #2324

Closed dginev closed 9 months ago

dginev commented 9 months ago

Fixes #2323

Our subfiles.sty binding is a little brave/simple and it only goes so far. To fix the reported issue, I think the key bit was processing the main/outer {document} as usual, while only redefining the environment on secondary uses (in the dependent files).

So I deferred the redefinition, allowing the reported example to work as expected. An even nicer test is to move the algorithm to a standalone file and use a main.tex:

\documentclass{article}

\usepackage{subfiles}
\usepackage[ruled]{algorithm2e}

\begin{document}
\subfile{alg}
\subfile{alg}
\subfile{alg}
\end{document}

which is a little closer to the package intention.