2

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.

  • 1
    Welcome to TeX.sx! So stated the problem is not very clear. What class are you using? Can you give an example of what you're trying to do? – egreg Jan 9 '13 at 23:47
  • 2
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – henrique Jan 9 '13 at 23:48
  • A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – doncherry Jan 11 '13 at 0:00
10

\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}
  • I start to understand how you think your answers out while shopping! +1 :) – yo' Jan 10 '13 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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