# pdflatex hangs during compiling (every 2nd run) [closed]

Newly, it frequently happens that pdflatex hangs during compile.

The system:

• TeXLive 2010
(yes, I know that 2011 is out already)
• MacOS X 10.6.8.
• Texstudio as editor

Currently, I'm compiling in the command line by

pdflatex -synctex=1  filename.tex

Often, but not always (!) it then happens that pdflatex stops e. g. at the following line, the cpu usage of the process pdftex increases dramatically and it does not proceed compiling until I stop it with Ctrl-C, x and Return.

LaTeX Warning: Reference `nameofreference' on page 49 undefined on input line 1179.

If I compile again, mostly it works and the pdf is created completely... (And as I tried it some minutes ago, the 3rd try again stopped at the same line..., the 4th try worked, the 5th stopped. It seems to happen alternately - every second pdflatex run hangs at this line...)

• How is that possible
• and what can I do to avoid this incomplete processing?
-

## closed as off topic by Joseph Wright♦Jan 7 '12 at 21:34

Questions on TeX - LaTeX Stack Exchange are expected to relate to TeX, LaTeX or related typesetting systems within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here. If this question can be reworded to fit the rules in the help center, please edit the question.

I suspect an error that triggers infinite recursion. It's impossible to say more without an example. –  egreg Nov 5 '11 at 17:18
Make a copy of the file, and then start stripping the copy apart, compiling regularly. This should lead you to get a MWE that demonstrates the problem, which could be content related, or perhaps a package conflict. It might even help you solve the problem :) –  cmhughes Nov 5 '11 at 17:29
Do you use packages afterpage and longtable maybe a longtable at \afterpage or simply a longtable near \afterpage? If so, that is a known issue. –  Schweinebacke Nov 5 '11 at 17:33
@Martin: flafter does not work like afterpage and I cannot find any issue about using longtable together with flafter. But flafter modifies \@addtocurcol and thats a piece of the LaTeX output routine. longtable modifies output too, so maybe, maybe, maybe collision of both may be a similar problem like collision of afterpage and longtable. Perhaps a \FloatBarrier (package placeins) before each longtable may help. –  Schweinebacke Nov 5 '11 at 17:53
The fact that it works every other time makes me think that something in the aux file is the causing the problem. When it doesn't work, it probably writes a blank aux file so next time it does work, but then the aux file has the problematic line so next time it doesn't work. Could you post your aux file? (If it's not too long) –  Loop Space Nov 5 '11 at 18:52