Apologies that I can't post a properly minimal working example. However, I've trimmed it down to a two page document, with only a section title, a TikZ figure (actually, four subfigures) and a chemical diagram, processed from .eps by Chemcheme/auto-pst-pdf. And, regrettably, a lengthy preamble, copied in entirety from my Thesis. Removal of the TikZ figures, or any one of a number of seemingly unrelated lines seems to resolve the bug, but not in any clear, transparent way that I can reproduce in my full document. Other solutions, like wrapping \usepackage{tikz} in \ifpdf
...\fi
works here, but also does not work in my full document.
Compiling my example (with shell escape enabled and auto-pst-pdf set to [runs=2]
) with things tweaked so as to eliminate the bug, we get a beautiful, correct, two page document:
Compiling (same compile settings settings) but with the bug occuring, Figure 2 (the chemical structure, processed from eps) becomes replaced with a copy of the entire document's first page:
The processing generates a document which should contain PDFs of any eps input: here, for the LaTeX file "NewMWE.tex" and final PDF output "NewMWE.pdf", this document of processed eps figures is called NewMWE-pics.pdf.
In example one, production of NewMWE-pics.pdf this happens without problems. In the second example, however, NewMWE-pics.pdf instead contains a (cropped) copy of the first page. so the error is presumably happening during/before generation of that file.
Running a diff on the logs of the two files, the only differences are:
Bug free:
<NewMWE-pics.pdf, id=50, page=1, 365.365pt x 142.5325pt>
...
(pdftex.def) Requested size: 365.3641pt x 142.53214pt.
...
...
Package atenddvi Info: Last page = 2.
[2 <./NewMWE-pics.pdf>]
With bug:
<NewMWE-pics.pdf, id=50, page=1, 362.35374pt x 695.59875pt>
...
(pdftex.def) Requested size: 362.35286pt x 695.59706pt.
...
LaTeX Warning: Float too large for page by 73.31949pt on input line 281.
...
Package pst-pdf Warning: `NewMWE-pics.pdf' contains 2 pages
(pst-pdf) but 1 pages are requested:
(pst-pdf) File `NewMWE-pics.pdf' is no more valid!
(pst-pdf) Recreate it .
...
[2]
Package atenddvi Info: Last page = 3.
[3 <./NewMWE-pics.pdf>]