[Tex/LaTex] PDF inclusion error when using \input or \include


I have set up a LaTeX file for a book-type document with the following preamble:


Now, when I make a document were everything is included after the preamble, that includes a figure with TMP – tags, all works out fine, the tags are replaced with compound numbers.


        \caption{\ortho-selective chemistry.}

If, however I copy all the content of the document into an additional file like this:


I get the following error:

pdfTeX error: pdflatex (file ./main-pics.pdf): PDF inclusion:
required page does not exist <1>

Can anyone explain this? The .log file is not really conclusive. The problem does not change when I use \include instead of \input I really don't want to put everything into one file.

edit: I forgot, I am using MacTeX 2015.

Best Answer

I was came across a similar problem to yours, until I started using the package subfile. There is some good documentation here: https://en.wikibooks.org/wiki/LaTeX/Modular_Documents#Subfiles

I found subfile particularly useful since I was working on a multi chapter book, so I needed to have multiple tex files for the different chapters which compile using a main.tex (mother file). The chap1.tex (child file) could then be compiled on its own, and automatically integrated in the main when compiling main.tex.

...just my cents worth....