I use the appendix package with its toc option for a book document. If the first of several appendices is inserted by using \include, then the "Appendices" heading in the TOC incorrectly appears after the entries for the first appendix.

This happens no matter whether I use the \appendices command, as shown below, or else the appendices environment. The same thing happens if I don't use the appendix package but instead just the \appendix command and use an \addcontentsline to insert the "Appendices" item in the TOC.

This behavior does not occur if the body of the appendix is inserted directly in the main document.

The behavior does not occur, either, if I use \input instead of \include. However, I really need to use \include.

Here's a minimal failing example. (The 2nd appendix is here just to highlight the effect in TOC. In the main file, I have a 2nd appendix right there, but it makes no difference if I put that in a separate file and use another \include for it.)

 %%%%% main file %%%%

\chapter{First things}
This comes first.



\chapter{Another addendum}
This is some more information.


The file appendixA:

\chapter{The initial stuff}
All about `A'.

\section{A section within the initial appendix}
Yet more.

1 Answer 1


There are two and a half solutions (only the second one is valid if you need to use \include):

  1. Use \input instead of \include (if you don't need the functionality of \include).
  2. Put \appendices into appendixA.tex.
  3. Manually configure the TOC file from

    \contentsline {chapter}{\numberline {1}First things}{1}
    \contentsline {chapter}{\numberline {A}The initial stuff}{3}
    \contentsline {section}{\numberline {A.1}A section within the initial appendix}{3}
    \contentsline {chapter}{Appendices}{3}
    \contentsline {chapter}{\numberline {B}Another addendum}{5}


    \contentsline {chapter}{\numberline {1}First things}{1}
    \contentsline {chapter}{Appendices}{3}
    \contentsline {chapter}{\numberline {A}The initial stuff}{3}
    \contentsline {section}{\numberline {A.1}A section within the initial appendix}{3}
    \contentsline {chapter}{\numberline {B}Another addendum}{5}

The package manual states:

There is an unfortunate interaction between the LaTeX kernel commands \include and \addcontentsline. […]
Things work as expected if the \addcontentsline command is placed within the \included file, or if the imported file is \inputed instead of \included.

On another note: appencides is an environment not a macro, so you better use \appendices … \endappendices or \begin{appendices} … \end{appendices}.

  • Thanks! I missed that warning in the package manual. I'll have to see which is the least painful workaround. I do really want to use \include rather than \input, since I'm also using an \includeonly list of files as I develop the material. And the workarounds necessarily defeat that a bit, since I must treat the (possibly temporarily) first appendix file separately from the others. Indeed, in the case at hand, I expect to all another appendix before what's currently the first one.
    – murray
    Sep 25, 2012 at 14:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .