Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Now and again, when I've written some new 'code' (plain text, equations, special commands etc.) in my LaTeX editor and I compile the file, I get an error. Normally when I get an error, I check the code that has subsequently been highlighted by the editor. However, in the case of these 'unexplained errors', no code highlighted (and as with all 'red' errors, the code doesn't compile). So, I compile again and... it works. Normally I just carry on writing but this time I thought I'd try to find out if anyone else has experienced this and if anyone know why it happens.

Edit 1 Here's a screenshot of the error that was obtained following Kurt's advice enter image description here

share|improve this question

closed as too localized by lockstep, zeroth, Claudio Fiandrino, ienissei, Marco Daniel Feb 17 '13 at 15:31

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
What errors do you get? –  Martin Schröder Feb 16 '13 at 23:04
3  
It is possible to get errors that go away upon subsequent re-run. Every time you run LaTeX temporary files are generated which are read upon a subsequent run. If the prior run did not complete for some reason it is possible that the temporary files are corrupt so you get an error next time you run it. But during this run, those temporary files are rewritten so that a subsequent run will run without errors. –  Peter Grill Feb 16 '13 at 23:23
1  
@User17670 next time take a screenshot or save the .log file so that you can help us to help you. watch the Joy of tex errors.you can notice latex bug status here –  texenthusiast Feb 16 '13 at 23:24
1  
@User17670: A suggestion: Change your username to something more telling than "user17670". –  Martin Schröder Feb 16 '13 at 23:25
2  
You are compiling first (no aux files). Package natbib has no informations how to build your bibliography because first you have to build the aux file which includes the cited books etc. So the error message "Package natbib error: Bibliography not compatible with author-year citation ..." tells you to procede. In other cases (after compilimg and building the bibliography with bibtex/biber) it would indicate that there is a problem with your bibliography ... So check after each run pdflatex, bibtex, pdflatex, pdflatex the resulting errors. –  Kurt Feb 17 '13 at 0:54
show 14 more comments

1 Answer

up vote 4 down vote accepted

It could happen that errors (or their descriptions) sometimes have no relation to where or what the error points to. Probably in its simplest form, although not really errors, is LaTeX's \label-\ref system. You document is perfect, yet the references show up as ?? when you compile. "Suddenly", when you compile again, the references appear as expected. Similarly for a Table of Contents; it always seems to be one step behind, or causes errors "out of nowhere."

If this seems to be the case, always start fresh by deleting an auxiliary files (.aux, .toc, ... see File extensions of LaTeX-related files and/or Egad! What are all those files?) and compile again, at least twice (sometimes more) since references and other things may take a couple of runs to settle.

Typical errors related to compilation usually stem from content left in the .aux from the previous run. Common packages that cause this is hyperref and tikz/pgf, since they write actual command definitions in there (of course, attempts by the package authors are made to avoid this). That is, upon a removal of these packages, the first re-compile still processes an .aux containing definitions that are completely unsupported, and might cause problems in your document.

Knuth describes TeX as an "eating machine" (chapter 7 How TeX Read What You Type, p 38):

It is important to understand the idea of token lists, if you want to gain a thorough understanding of TeX, and it is convenient to learn the concept by thinking of TeX as if it were a living organism. The individual lines of input in your files are seen only by TeX's "eyes" and "mouth"; but after that text has been gobbled up, it is sent to TeX's "stomach" in the form of a token list, and the digestive processes that do the actual typesetting are based entirely on tokens. As far as the stomach is concerned, the input flows in as a stream of tokens, somewhat as if your TeX manuscript had been typed all on one extremely long line.

To put it bluntly, it may be that TeX has already gobbled some of your content and only developed the stomach problems at a completely different/later stage.

For some TUMS*, see

* A possible remedy for TeX's Unknown stoMach problemS

share|improve this answer
    
Interesting.... –  User 17670 Feb 17 '13 at 16:26
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.