Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am preparing for my thesis and I have some problems on the tableofcontents. My text source is the following

  \documentclass[12pt,twoside,openright]{book}   
   ..................
 ...............................

  \include{{./Chapter1/chapter1}}

  \thispagestyle{empty}


 \thispagestyle{empty}    \bibliographystyle{alpha}

  \bibliography{refs.bib}

  \addcontentsline{toc}{chapter}{Bibliography}

 \include{{./Samenvatting/Samenvatting}}

  \addcontentsline{toc}{chapter}{Samenvatting} 

 \thispagestyle{empty}    \include{{./Samenvatting/summary}}

  \addcontentsline{toc}{chapter}{Summary} 

 \thispagestyle{empty}    \include{{./Samenvatting/Sommario}}

  \addcontentsline{toc}{chapter}{Sommario}

  \thispagestyle{empty}    \include{{./ack/ack}} 

 \addcontentsline{toc}{chapter}{Acknowledgements}

  \thispagestyle{empty}    \include{{./CV/CV}} 

 \addcontentsline{toc}{chapter}{Curriculum Vitae}

 \thispagestyle{empty}

However, in the table of contents, there are some problems :

  1. the last item (CV in my tex) does not appear.

  2. The page number of later sections : from Bibliography to the end, are wrong. They match with the number in the total text, but do not match with the number of their pages.

How could I fix this? Many thanks in advance.

share|improve this question
1  
Welcome to TeX.sx! Instead of using the quote markup button, use the code markup button (labeled {}) to highlight code. This indents blocks by four spaces, or encloses inline code in backticks (`). –  Torbjørn T. Apr 5 '13 at 7:58
1  
1. What type of file is your CV? In any case, you might be better off importing it with the pgfpages package. 2. The blank lines between each \include and \addcontentsline may be the source of the problem; try removing any blank space between each pair of those commands. –  Jubobs Apr 5 '13 at 7:59
3  
Additionally to Jubobs comment, your placement of \addcontentsline is after the included files, so the current page number at that point is the final page of the that file. The correct position for the command would be at the point when the title in the included file is printed. We would need to see one of those included files to suggest how to fix that. –  Andrew Swann Apr 5 '13 at 8:07
2  
@user28514 Please edit your question to show us the contents of one of these included files. Otherwise we are just guessing in the dark. –  Andrew Swann Apr 5 '13 at 9:42
1  
Whilst guessing, problem 1 might be that your CV file ends with an \end{document} command so the latex processing stops at that point and does not see your final \addcontentsline. –  Andrew Swann Apr 5 '13 at 10:01

1 Answer 1

the last item (CV in my tex) does not appear.

You should use real chapters in your tex files. Then there is no need to use \addcontentsline.

If that is no option you might define the following function:

\newcommand{\phantomeintrag}[2]{%
    \phantomsection
    \addcontentsline{toc}{#1}{#2}
}

And then simply call (before you include the files!):

\phantomeintrag{chapter}{Curriculum Vitae}

The page number of later sections : from Bibliography to the end, are wrong. They match with the number in the total text, but do not match with the number of their pages.

Not sure if I understand this correctly: Do you want that the page number starts at 1 for each included file? Whatever - you can restart the page numbering using \pagenumbering{arabic}. Furthermore the counter can be set manually to any number at any time using the \setcounter{page}{123} command, where 123 is the new page number you’d like. Note that this can result in duplicate page numbers.

share|improve this answer
    
Thank DL6ER for your help. However, the first problem still remains. For the second problem, I mean that, for example, the page number of Summary is 123, but it's shown 124 in the table of contents. –  user28514 Apr 5 '13 at 10:31
    
Then there is no other choice than to let us have a look in your file(s). –  DL6ER Apr 5 '13 at 10:37
    
It works after I changed those items to, for example, : \cleardoublepage \addcontentsline{toc}{chapter}{Curriculum Vitae} \include{{./CV/CV}} \thispagestyle{empty} –  user28514 Apr 8 '13 at 11:57

Your Answer

 
discard

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.