2

I tried to use the instructions from this link to split my current master thesis into multiple .tex files using the subfiles package.

However, I am unable to compile more than a single file. I have reproduced a minimalist version of the code to highlight the issue.

%test_main.tex:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel} 
\usepackage{expl3}
\usepackage{subfiles}

\begin{document} \subfile{test1} \subfile{test2} \end{document}

%test1.tex \documentclass[test_main.tex]{subfiles} \begin{document} This is the first document. \end{document}

%test2.tex \documentclass[test_main.tex]{subfiles} \begin{document} This is the second document. \end{document}

All three documents (test_main.tex, test1.tex, test2.tex) are located in a single folder. I can compile text_main.tex without receiving a single error message or warning, however the resulting .pdf contains only "This is the first document.".

Does anybody have a clue of what is going on?

Zigzagoon2
  • 21
  • 1
  • What happen if you comment out the line \subfile{test 1} ? And what is the result of compiling test2.tex alone? – Hafid Boukhoulda Mar 04 '21 at 12:03
  • If I comment out \subfile{test1} then I obtain a document with "This is the second document." as expected. Also, I am able to compile test2.tex alone, which yields the same result. Also, if I permute the lines \subfile{test1} and \subfile{test2}, then I also obtain the same result.

    So it only compiles the first subfile and ignore the second. Actually, it ignores everything past the first \subfile{...} command.

    – Zigzagoon2 Mar 04 '21 at 15:00
  • I have no issues when compiling your example in overleaf! Does the code you provide reproduce the problem you are describing?Which latex distribution do you use? – Hafid Boukhoulda Mar 04 '21 at 19:31
  • Yes. I tried this exact code to make sure the problem was persistent (and it is).

    I am not exactly sure of my technical specs (as I set up my LaTeX environment quite a while ago), but I am working with TeXworks and MiKTeX.

    – Zigzagoon2 Mar 05 '21 at 16:44
  • Can you please re-edit your question by adding the content of the file test_main.log located in the same directory. – Hafid Boukhoulda Mar 05 '21 at 21:30

1 Answers1

0

Use \subfile{test1.tex} instead of \subfile{test1}.

Mensch
  • 65,388