1

I am struggling with a problem with ToC page numbering visible in a document. I've tried several possible solution, including \phantomsection, \clearcoublepage, and other similar. Nothing helps. What I see is the ToC page numbers are lagging behind real page numbers and increasingly (1 page in first 40 pages of the document, over 10 pages in 360+ pages of the document). I'm helpless. Below I post the working code from my file. It is messy, but it used to work with a similar document a few year ago. I most probably have messed up something -_-

What I tried:

  1. Compiling multiple times (3 times in each run). Does not help.
  2. Removing all figures and tables from the text. Does not help.
  3. Removing all packages that are not necessary. Does not help.
  4. Trying all the hints from the responses below. Did not help.

Problem solved. Required 4 compilations for an unknown reason.


\documentclass{book}
\usepackage{polski}
\usepackage[cp1250]{inputenc}
\usepackage[dvipsnames,usenames]{color}     
\usepackage{amssymb}
\usepackage{amsmath}   
\usepackage[round,comma,sort]{natbib}
\usepackage{pdflscape}
\usepackage{rotating}
\usepackage{afterpage}
\usepackage{multirow}
\usepackage{tablefootnote}
\usepackage{threeparttable}
\usepackage{array}
\usepackage{flafter} 

\begin{document}   
\frontmatter    
\title{
  \Large{\textbf{Comprehensive Title}\\
  \vspace{20mm}}
}   
\author{Probably myself}
\date{Sometimes around today}
\maketitle
\frontmatter
\tableofcontents    
\input{skroty.tex}    
\mainmatter
\input{wstep.tex} 
\begin{appendices}
  \input{dodatek_A.tex}
\end{appendices}
\cleardoublepage
\addcontentsline{toc}{chapter}{\listfigurename} 
\listoffigures   
\cleardoublepage
\addcontentsline{toc}{chapter}{\listtablename}  
\listoftables      
\cleardoublepage
\addcontentsline{toc}{chapter}{\bibname}
\bibliography{aaa}
\bibliographystyle{plainnat}    
\end{document}

closed as off-topic by Mensch, Raaja, dexteritas, schtandard, Stefan Pinnow Aug 5 at 9:31

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I didn't know. Thanks for editing :) – pjantos Feb 12 at 17:33
  • I have conversed the input file into book.cls. It should compile (at least it does for me). Doesn't look nice, but works. The problem with page numbering remains. I've checked after 50, 100 and 150 pages. ToC lags behind and the number of pages it stays behind increases. (edit) To answer your second question - I have compiled the document three times in each run. Does not affect the page numbering, alas. – pjantos Feb 12 at 18:06
  • 1
    t clear the page, then add the contentsline command, then insert the list of tables (or whatever). – Johannes_B Feb 12 at 19:02
  • 2
    \usepackage{tocbibind} should solve your problems instead of manually adding those entries with \addcontentsline etc.... – user31729 Feb 12 at 19:26
  • Hi, I have tried both changing the order of the commands and using tocbibind. The former has brought no changes, the latter, whilst more elegant, has not changed a thing, either. I tried to remove all packages that are not used or not really needed. Unfortunately the problem remains. Turning the code into something more workable, e.g. using package ipsum brought no convincing result. I get an impression that the TeX does not count the "space used" properly, thus, making the page counter lag behind. Not sure if it happens due to the figures inserted? – pjantos Feb 13 at 10:50