TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Well I have encountered this problem so many times that I can't help but ask here.

When I compile my documents for the very first time, I get 145 pages. Then I compile them again without any other action, I get 150 pages. Then I compile them the third time in a row, I get 153 pages. When I compile the documents for the fourth time, I get 155 pages. Then additional compiles won't give any more pages.

Based on my experience, it doesn't necessarily take four times to reach the real total of pages. The fact is that it sometimes takes more than one compile to reach that total. Why?

share|improve this question
Welcome at Tex.sx! Your question is a bit vague. In particular, it leaves as wondering what kind of output has been added in the following runs and how you "compile" them. Nevertheless, such a behavior is actually expected as the table of contents, the index, bibliographies, and glossaries are actually made up by means of repeated compiles. I suppose that you will confirm that related pages have been added. If you want to know why you have 4 instead of 2 or 3 cycles, you may need to add more context information. – Christian Feuersänger Aug 30 '13 at 18:35
@ChristianFeuersänger i thought the actual question was that last word (why). i can explain 3 runs for stability, but 4? – wasteofspace Aug 30 '13 at 18:38
@TerryLi i think we need at least a package list to form a coherent opinion. (note that i have a test file for footmisc that never reaches stability.) – wasteofspace Aug 30 '13 at 18:40
the increase with the second compilation is easy to explain -- the resolution of \refs and the addition of the toc. is a bibliography added between any of those passes? you say not, but on some systems, it happens "under the covers". that would resolve \cites, which sometimes add even more pages than \refs. if the bibliography isn't added until pass 3, it won't get into the toc until pass 4, and if that adds another page to the toc, if the toc started as an even number of (full) pages, the "start chapters on odd page" rule results in another two pages. – barbara beeton Aug 30 '13 at 18:41
Well, I second @wasteofspace: either these comments answer the question or we need context information (i.e. at least the preamble of the document). – Christian Feuersänger Aug 30 '13 at 18:53
up vote 7 down vote accepted

It is possible to construct latex documents that take any number of runs to converge, or in fact which never converge at all.

The most obvious reasons for changing after the first run are references and citations being resolved so changing ?? to 1.2.3 so changing the text length, and the table of contents and list of figures being added after the first run.

However the table of contents added after on the second run is based on page numbers collected in the first run, so after all the references have been resolved, the text has different lengths so page breaks can change and the table of contents can be wrong and require another latex pass. Any change at all in a line break in one pass might just tip a decision to place a float on one page rather than another, so affecting the list of tables and potentially the table of contents.

If your front matter uses (say) a roman numbering and the main matter uses (say) arabic and there are not too many page references, most documents settle down after two or three runs however it is possible to create pathological documents where each time a reference is resolved it affects the page breaking and invalidates all later page references until the next run, usually page references to pages numbered with roman numerals are involved (as in the answer linked above) as the roman numbering scheme has the useful property that the width of the printed number can decrease as the number increases, eg iv to v which combined with long enough numbers that they need to hyphenate can lead to interesting interactions between the page breaker and the \label/\pageref mechanism.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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