Stop reading here if you do not like stupid yet amusing challenges.

Challenge: produces the shortest document yielding

 LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.

No matter how many times it is run through LaTeX.

I presume there is a cheating solution by which you mess up with the reference information as read from the .aux file. It would be nice to see one.

The challenge in producing the shortest "non-cheating" solution might be in clever ways of searching for a needle in an enormously huge haystack: Those rare documents in which setting changing a referenced label, say from 1 to 2 manages, through the delicate layout algorithm, to change the referenced label back, i.e., from '2' to '1'.

EDIT: In view of Document requiring infinitely many compiler passes?, which essentially solves the problem by a different kind of "cheating": forcing in and out text and blocks, using macros, I would rephrase:

  • The shortest LaTeX document that requests forever: "rerun to get cross-references right", but please do so by using text only. It is okay to use text generated by, e.g., \lipsum, but it is not okay to sneak in loops.

If memory serves me right, Lamport said in his book that the probability of such an incident is infinitesimal.

  • 6
    The shorter cheating document is, in full \typeout{LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.}\stop Commented May 31, 2016 at 14:22
  • The duplicate is a cheating solution: it does not produce a "real" document, i.e., with text such as lipsum, but rather some way of achieving the references changing cycle by forcibly insert huge text. Let me edit.
    – Yossi Gil
    Commented May 31, 2016 at 14:32
  • I do not understand your description of the solution posted in the duplicate, it does not depend on any text (other than it needs 5 pages as the cycle is between references to page 4 and 5) You could pad it to 5 pages using lipsum if you prefer. Commented May 31, 2016 at 14:50
  • All solutions use \clearpage, \vspace, or figure in one way or another. Here is an alternative description: : find sequence of text organized in paragraphs, that has this property. If you okay this, I will edit it in.
    – Yossi Gil
    Commented May 31, 2016 at 14:59
  • 1
    as I say, the accepted solution doesn't need \clearpage \vspace or figure, if you want to write 4 pages of paragraph text that would work as well, it's just less minimal. Commented May 31, 2016 at 15:06


Browse other questions tagged .