4

I would like to repeat a file in a LaTeX document multiple times:

\include{probenahme/sample}
\include{probenahme/sample}
\include{probenahme/sample}
\include{probenahme/sample}
\include{probenahme/sample}

However, if I compile the main document with latexmk -pdf main-document.tex, It will throw the following error:

 level-1 auxiliary file: probenahme/sample.aux
Already encountered file probenahme/sample.aux
---line 26 of file probenahme.aux
 : \@input{probenahme/sample.aux
 :                              }
I'm skipping whatever remains of this command
Already encountered file probenahme/sample.aux
---line 27 of file probenahme.aux
 : \@input{probenahme/sample.aux

...
  • It works fine with a single \include{probenahme/sample}
  • It works if I run pdflatex main-document.tex instead of latexmk -pdf main-document.tex
  • I don't want to use the latexmk -f option because it runs in a continuous integration environment and I want that to catch other errors.

What is the problem and how do I solve it while still using latexmk?

  • if you don't need anything in any of the .aux files, you could try adding \nofiles to the preamble. – barbara beeton Jul 5 '16 at 20:45
  • Is this really useful to include the same file over and over again? Each time the .aux file is written then – user31729 Jul 5 '16 at 20:46
6

You can not need \include functionality here as there is no way to use \includeonly to specify just one of the inclusions as they have the same name. So use \input not \include then you can input the file as often as you like.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.