1

Tex presents no errors.

Output

Calling Sub2.tex.
Sub2.tex entered.
Calling Sub1.tex.
Sub1.tex entered.
Sub1.tex completed.

Directory structure

./main.tex
./Sub2.tex
./Sub1.tex

main.tex

\documentclass{article}
\usepackage{expl3}
\usepackage{subfiles}
\begin{document}
Calling Sub2.tex.

\subfile{./Sub2.tex}

Sub2.tex exited into main.tex.

Calling Sub2.tex.

\subfile{./Sub1.tex}

main.tex completed. \end{document}

Sub1.tex

\documentclass[./main.tex]{subfiles}
\begin{document}
Sub1.tex entered.

Sub1.tex completed. \end{document}

Sub2.tex

\documentclass[./main.tex]{subfiles}
\begin{document}
Sub2.tex entered.

Calling Sub1.tex.

\subfile{./Sub1.tex}

Sub2.tex completed. \end{document}

gernot
  • 49,614
DevJoe
  • 11
  • Your directory structure implies to me, that the main file as well as both sub files are located in the same folder, but \documentclass[./main.tex]{subfiles} let's me assume that you let it search in a folder one ore more levels up in your directory structure (where there is no such file). Does deleting the ./ in \documentclass[./main.tex]{subfiles} solve your problem? Otherwise, if both subfiles are one level under your main file, try ../ instead of ./ (please note the two dots). – Lukas Jan 11 '22 at 07:22
  • you say you get no errors but it is hard to test your files as you get multiple unrelated errors ! LaTeX Error: There's no line here to end. please provide an error free test file, and show the log you get, so we can compare and debug. – David Carlisle Jan 11 '22 at 07:57
  • Open main.log and check the version of LaTeX and subfiles. My guess is that your TeX distribution is outdated and you are using a LaTeX format predating Oktober 2020. Maybe it is also the other way around, but it is almost surely a version mismatch / outdated version problem. My log file says LaTeX2e <2021-06-01> patch level 1 and subfiles 2020/11/14 v2.2. So the solution is to upgrade your TeX distribution. How this has to be done depends on your distribution (MiKTeX, TeXlive, ...) – gernot Jan 11 '22 at 20:44
  • 1
    @Lukas ./main.tex (a single dot) denotes main.tex in the current directory. ../main.tex (two dots) denotes main.tex one level up from the current directory. – Ulrich Diez Jan 11 '22 at 22:22

0 Answers0