I have a directory containing many separate latex documents, either directly or inside subdirectories; and I want to compile all these documents simultaneously. Some of these documents involve multiple
.tex files — a master file that includes some other file(s).
The following questions ask something very similar:
However, the answers given there don’t work in my situation; they essentially tell
pdflatex, or whatever) to attempt to compile all
.tex files within the current directory. That works when each
.tex file is an individual document, but fails when there are multiple-file documents, for two reasons:
.texfiles that are intended just as includes don’t compile individually, so
latexmkchokes on these
- even when compiling the master file of a document,
latexmkmay fail because it tries to locate the requested include files within the current directory, not within the directory where the master file lives.
Does anyone have a good command-line one liner to compile all documents, in this situation?
The closest I’ve come is
ag -lR --null 'documentclass' . | xargs -0 latexmk This runs
latexmk on all files containing
documentclass, which solves the first issue above by picking out the master files (at least to a first approximation); but it doesn’t solve the second issue, of finding the correct include files.
(I am on Mac OS; but I guess answers should be similar for all system with a unix-/linux-like command-line.)