gsalzer / subfiles

class and package for multi-file projects in LaTeX
LaTeX Project Public License v1.3c
25 stars 1 forks source link

Only first subfile shown #22

Closed BertrandSim closed 3 years ago

BertrandSim commented 3 years ago

Hi there, this is similar to issue #20, but more general. In my case, I am compiling with latexmk. As with the linked issue, only the first subfile is produced.

Investigating further, it seems that the line \end{document} of the first subfile is also read. Thus, the document 'ends' at the first subfile, and the second subfile, which comes after, is not seen.

Commenting out the line \end{document} in the first subfile temporarily resolves the problem.

Here are the relevant files:

% main.tex
\documentclass{report}

\usepackage{expl3}
\usepackage{subfiles}

\begin{document}
\tableofcontents
\subfile{chapter1.tex}
\subfile{chapter2.tex}
\end{document}
%chapter1.tex
\documentclass[main.tex]{subfiles}

\begin{document}

\chapter{Intro}
\label{ch:intro}
Here comes some text

\end{document} % <--- try and comment out this line
%chapter2.tex
\documentclass[main.tex]{subfiles}

\begin{document}

\chapter{Foo}
\label{ch:foo}
And here comes some more text

\end{document}

(MikTeX 2.9, vimtex, latexmk, subfiles v2.2, import v6.2)

gsalzer commented 3 years ago

I think this is the same issue as in your other post. In my updated environment, latexmk works fine. Are there any log files of latexmk? If yes, please check for errors. The missing \ExplSyntaxOn should appear there as well.

BertrandSim commented 3 years ago

Indeed it is the same issue as my other post. Updating my environment resolved it. Thanks for your help!