[Tex/LaTex] Added chapter with \addcontentsline does not appear on ToC

chapterstable of contents

I add four chapters with \addcontentsline after \bibliography, however, there are only three chapters appearing in the Table of Contents. Could you please tell me what I should do?

Sorry for my unspecification. I use \documentclass{book}, and I typed that :

\bibliography{refs.bib}

\addcontentsline{toc}{chapter}{Bibliography}

%%%%%%%%%%%

\include{Appendix 1}

\addcontentsline{toc}{chapter}{Appendix 1}

\thispagestyle{empty}

%%%%%%%%%%%%

\include{Appendix 2}

\addcontentsline{toc}{chapter}{Appendix 2}

\thispagestyle{empty}

%%%%%%%%%%%%

\include{Appendix 3}

\addcontentsline{toc}{chapter}{Appendix 3}

\thispagestyle{empty}

%%%%%%%%%%%%

\include{Appendix 4}

\addcontentsline{toc}{chapter}{Appendix 4}

\thispagestyle{empty}

But then it appears only 3 first appendices.

Best Answer

\addcontentsline is written to the toc when the page is "shipped out". If the command is on an empty page which is not written to the pdf or dvi it gets lost - it wouldn't have much sense anyway as without page there is no sensible page number.

\documentclass{article}
\begin{document}
\tableofcontents

blub 
\addcontentsline{toc}{section}{section 1}
\newpage
%empty page 
\addcontentsline{toc}{section}{section 2} %lost
\end{document}
Related Question