0

enter image description here

What command can I write in main.tex as shorthand for "include all .tex files from a given folder". So I don't have to write a lot of \include{} commands for each file like

\include{sections/introduction.tex}
\include{sections/section2.tex}
// And so on...

EDIT: MY SOLUTION

\begin{document}

\foreach \folder in {sections, images} {%
\foreach \i in {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ..., 19} {% \edef\FileName{\folder/\i}% The % here are necessary to eliminate any \IfFileExists{\FileName}{% spurious spaces that may get inserted \input{\FileName}% at these points } } }

\end{document}

Reference: https://tex.stackexchange.com/a/38576/151373

  • https://tex.stackexchange.com/questions/38571/including-all-files-within-a-directory – Ingmar Dec 18 '20 at 12:37
  • You either need to enable -shell-escape and use a shell command to get a list of the files or you need to list them manually. TeX cannot “find files”, it can only look them up by name. – Phelype Oleinik Dec 18 '20 at 12:45

0 Answers0