# How does LaTeX tell me that it wants to be run a second time?

Sometimes, when I use the longtable package I get a message in the output:

Package longtable Warning: Table widths have changed. Rerun LaTeX.

I read that it can be as often as three times that XeLaTeX must be run until the message disappears. So currently my deploy script re-runs XeLaTeX until the output no longer contains the string Rerun LaTeX.

So, is this the official way (used by all packages) to detect that a re-run is necessary or is there another way like a specific return value? I can already rule out the existence of the .aux file as an indicator, because that file is never deleted.

• The output requesting a rerun could be package-specific. For example, the default LaTeX output for an undefined reference is: "Label(s) may have changed. Rerun to get cross-references right." etarmune is another package with a slightly different yet unique "rerun message". See How can I force LyX to rebuild intermediate files for clean PDF display? AFAIK there is no specific return value. – Werner Aug 25 '13 at 4:45
• @Werner That's probably the answer, or at least most of it. Ideas such as 'logreq` are about to provide a more regularised approach but are not widely used, hence the fact that tools such as latexmk use hashing, etc. of .aux files to work. – Joseph Wright Aug 25 '13 at 6:55
• As Joseph said: rerun LaTeX until .aux file stops changing (but, just in case, add some limit, i.e., 5 or 10 reruns). It has worked for me so far. – Vedran Šego Aug 25 '13 at 9:46
• So we have "Rerun LaTeX" (longtable) and "Rerun to get them right" (etaremune), the changing of the .aux file (requires at least two runs, doesn't it?) and logreq's approach. Someone should compile that in an answer. – AndreKR Aug 25 '13 at 14:26
• – cmhughes Aug 25 '13 at 16:07