# Add Appendix with correct page to ToC

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
\chapter{First Appendix}
\end{document}


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.

-

\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

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
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
@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