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 failing to add a heading for the appendix to the ToC with the correct page number:

\documentclass{scrbook}
\begin{document}
\tableofcontents
\chapter{test}
\appendix
\addcontentsline{toc}{part}{\appendixname}
\chapter{First Appendix}
\end{document}

enter image description here

I also tried to use the \addappheadtotoc command from the appendix package, but that changes nothing (expect that it writes 'Appendices' instead).

I assume that the appendix package provides the solution, but I could not figure out how to use it.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

\appendix only changes the chapter numbering to Alph; it doesn't add a page break. Solution: Add \cleardoublepage before \appendix. (This is appropriate for a document using the openright class option; for openany, use \clearpage.)

EDIT: Personally, I wouldn't add a "pseudo chapter" to the ToC that doesn't correspond to an existing chapter (there is no chapter called "Appendix" in your example). Consider to add an unnumbered "Appendix" part to the main text and the ToC instead.

\documentclass{scrbook}
\begin{document}
\tableofcontents
\chapter{test}
\cleardoublepage
\appendix
\addcontentsline{toc}{part}{\appendixname}
\chapter{First Appendix}
\end{document}

enter image description here

share|improve this answer
    
Indeed, with the package it would be required to use the environment appendices to achieve the same. –  Matthias Pospiech Dec 8 '11 at 9:41
1  
BTW: You may add \csname phantomsection\endcsname before the \addcontentsline to get correct links if you'll use package hyperref some day. –  Schweinebacke Dec 8 '11 at 10:13
    
since \chapter usually invokes \clear[double]page, putting the \addcontentsline after the \chapter command would avoid having to invoke the manual page break. of course, when hyperref is used, that would position the link below the appendix title. –  barbara beeton Dec 8 '11 at 14:07
    
@barbarabeeton: This would put "Appendix" after "A. First Appendix" in the ToC. –  lockstep Dec 8 '11 at 17:40
    
@lockstep -- okay, thanks. i was misreading that, and assumed rashly that the \addcontentsline was there for the purpose of putting in the entry for the appendix itself. on the other hand, my preference (based at least partly on ams practice) is to omit the page number from a "part" heading in the t-of-c. ymmv. –  barbara beeton Dec 8 '11 at 18:24

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.