In my compiled document, which consists of many sub-documents using standalone, I have one sub-document in which the Figure references are undefined - they show up as ??. No MWE I've tried can reproduce this error.

In case anyone wants to have a go at this particular bug, the .log and .aux files are here: https://gist.github.com/keflavich/5421912#file-thesis-log-L2696 (the link is specifically to the line with \newlabel{fig:...} in the thesis.log file).

The problem is that I am including multiple documents in a parent document, and everything goes fine until a certain document is included, after which \newlabel commands are sent to thesis.log instead of thesis.aux, which means that ??s show up instead of figure numbers.

• Did you read the .log file? – Foo Bar Apr 19 '13 at 17:15
• Yes. I get "Reference fig:... undefined", but later there is a \newlabel{fig:...} entry, which I thought SHOULD mean that the figure label is included. – keflavich Apr 19 '13 at 17:31
• Oh... upon closer inspection, only the failing figures show up with \newlabel{fig:} in the log... the rest have that text in the .aux file. What could cause that? – keflavich Apr 19 '13 at 17:38
• When a \newlabel command appears in the .log file rather than the .aux file, it means that the latter has already been closed or is not open when the \label command is scanned. – egreg Apr 19 '13 at 18:07
• Thanks @egreg - any idea what could cause that? – keflavich Apr 19 '13 at 19:31

\include{preface.tex} causes this issue.
\input{preface.tex} does not.