This question is a LaTeX question, although it might actually be resolved by changing the build procedure of the document instead of the document itself.
I have a document that includes a bunch of subfiles, where each has preamble of its own. I use the standalone
package to accomplish this.
Now I have two versions of my main.tex
file, where each only contains the preamble and an \include{...}
list of all the subfiles. The two main
files compile fine, each yielding a layout-wise different version of the document (one optimized for A4 printing, using two-column layout and somesuch, and one that is for ebook displays).
Now I have a Makefile that builds both versions of the document. But since Make builds the two independent documents at the same time, pdfLaTeX is run on the standalone sub-documents separately and in parallel, causing all kinds of awkward errors, since files are written and read at the same time by two different instances of pdfLaTeX.
I can think of several solutions to this problem, but wanted to ask for suggestions:
- Simply don't build the two documents simultaneously. Easiest solution, but somewhat unsatisfactory.
- Don't use
standalone
and remove preamble from subfiles. Since I have ~30 subfiles, this would be non negelegible amount of open-and-delete-work, plus I like the feature of being able to compile the subdocuments separately for developement/debugging. - Use an alternative to
standalone
that doesn't have this problem (is there one?) - Somehow tell
standalone
to use different filenames for the helper files for the two different document versions (my favourite, but I don't know if it's possible)
Any suggestions?
make
to execute sequentially - google found this stackoverflow solution: stackoverflow.com/questions/14838851/…\include
version you can process individual files withpdflatex \includeonly{file1}\input main
make
should compile things in the right order. Another question is how to generate the dependencies automatically from the source files (likemakedepend
)make
should be doing that anyway!