[texhax] \addcontentsline -- line added to TOC appears in wrong place. Why?

Niall Mansfield texhax at uit.co.uk
Wed May 7 17:59:45 CEST 2008

- Using book.cls.
- Redefined \appendix, to add an "Appendixes" heading line to
   the TOC, as follows:

   \addcontentsline{toc}{chapter}{Appendixes}	%% this is the new line
   \gdef\thechapter{\@Alph\c at chapter}}

When we run this on a .tex file of the form:

	\chapter{Last chap}

we get the "Appendixes" line in the wrong place.
The .toc file shows this:

\contentsline {chapter}{\numberline {A}APX-1}{53}
\contentsline {chapter}{Appendixes}{53}
\contentsline {chapter}{\numberline {B}APX-2}{57}

What's happening?

More information about the texhax mailing list