8

LaTeX's appendix environment formats sections differently and uses a different enumeration in the table of contents:

\begin{appendix}
 \section{superuser}
 \dots{}
....

Shows up as

      A       superuser            11

in the \tableofcontents.

Unfortunately, I have to use a different style: the appendix is not to show up in the table of contents, but in a separate listing right before the appendix.

I see the following options to solve this:

  • suppress output in tableofcontents and somehow recreate the part on a different page
  • generate a custom listing of specified / the following section
  • manually create a list with the same formatting as the table of contents

I use scrartcl as document class.

5
  • Does the solution in tex.stackexchange.com/questions/8211/list-of-appendices not help?
    – TH.
    Commented Jan 7, 2011 at 9:58
  • 1
    Also, \appendix isn't an environment, but a macro that you put before your first appendix.
    – TH.
    Commented Jan 7, 2011 at 10:00
  • I searched superuser and got pointed here, but forgot to search again. Thanks for the link and the clarification env. vs. macro!
    – None
    Commented Jan 7, 2011 at 11:29
  • So does the link TH gave you answer your question? Then we can close this question as a duplicate. Commented Jan 7, 2011 at 13:37
  • I'm taking my vote to close back, since the linked question only asks about a specific non-standard document class.
    – Caramdir
    Commented Jan 7, 2011 at 17:03

1 Answer 1

4

A somewhat hackish way to get a list of appendices in scrartcl is to add the following at the start of the appendix:

\appendix
% Set the name for the list of appenices
\newcommand\listoftoaname{Appendices}

% force table of contents to load the list of appendices
\let\oldlistoftoc\listoftoc
\renewcommand\listoftoc[1]{\oldlistoftoc{toa}}
\tableofcontents
\let\listoftoc\oldlistoftoc  

% we will now redefine the sectioning commands so that that put entries
% into the list of appendices. The redefinitions are rather simplistic
% and break the starred versions and the optional argument.
% Thus the redefinitions have to be added after the \tableofcontents call.

\let\oldaddcontentsline\addcontentsline
\newcommand\hackedaddcontentsline[3]{\oldaddcontentsline{toa}{#2}{#3}}

\let\oldsection\section
\renewcommand*\section[1]{%
  \let\addcontentsline\hackedaddcontentsline%
  \oldsection{#1}%
  \let\addcontentsline\oldaddcontentsline%
}
\let\oldsubsection\subsection
\renewcommand*\subsection[1]{%
  \let\addcontentsline\hackedaddcontentsline%
  \oldsubsection{#1}%
  \let\addcontentsline\oldaddcontentsline%
}
\let\oldsubsubsection\subsubsection
\renewcommand*\subsubsection[1]{%
  \let\addcontentsline\hackedaddcontentsline%
  \oldsubsubsection{#1}%
  \let\addcontentsline\oldaddcontentsline%
}

For scrreprt and scrbook, you need to add an analogous redefinition for \chapter. As the redefinition of the sectioning commands are rather simplistic, they break the starred versions and the optional argument. Thus before any starred sections (like the bibliography), you should revert the redefinitions with \let\section\oldsection.

1
  • Something similar should also work for the standard document classes, but I didn't want to look up their corresponding definitions.
    – Caramdir
    Commented Jan 7, 2011 at 18:04

You must log in to answer this question.

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