4

I tried to find solutions to this particular case, but I wasn't able to. What I want to achieve is to create an appendix in the following class:

\documentclass[a4paper, 12pt, headsepline, smallheadings]{scrreprt}

which is mentioned in the usual TOC only once by the name, that means as 'Appendix'. Moreover, I would like add a separate table of contents as 'List of Appendices' for the subsections of the appendix. This should become the first page of the appendix. The headline should still work as intended, that means show the current appendix/chapter. The names of 'Appendix' and 'List of appendices' should be changable (if possible), because I am not sure yet which names are ideal.

To illustrate this a little better, I want the following entries in the TOC:

TOC

Introduction
Chapter 
etc.
List of appendices

And then at some point of the document:

List of appendices

A 
B 
etc. 

Does anyone know how to do it? Thanks for any helps/hints. Regards

Here is a very small MWE:

\documentclass[a4paper, 12pt, headsepline, smallheadings]{scrreprt}
\begin{document}

\listoffigures    
\listoftables     
\tableofcontents   

\chapter{Start}
Start

\appendix       
\chapter{AAA}
\chapter{vvv}
\chapter{ccc}

\end{document}
2
  • Without having tested ever: perhaps package etoc? See also KOMA-Script’s tocbasic (described in KOMA-Script documentation) and tocstyle (own description in KOMA-Script directory; produces a warning of being in alpha state, but I’ve never got problems).
    – Speravir
    Commented Dec 17, 2013 at 2:08
  • @Speravir I have looked around, but found nothing which does exactly what I wanted to achieve.
    – TomM
    Commented Dec 17, 2013 at 13:59

1 Answer 1

4

Here is a solution.

With these lines we create a new "List of Appendices" (LoA) that can then be recalled through the command \listofappendices. Note that the names are customizable.

\newcommand\appendicesname{Appendices}
\newcommand\listofloaname{List of \appendicesname}
\newcommand*{\listofappendices}{\listoftoc{loa}}

The following line is to add the LoA to the ToC:

\setuptoc{loa}{totoc}

With the following lines, partially borrowed from this answer of Caramdir, we redefine all sectioning commands so to be added to the LoA instead of to the ToC, when issuing the \appendix command:

\makeatletter
\g@addto@macro\appendix{%
\let\oldaddcontentsline\addcontentsline
\newcommand\hackedaddcontentsline[3]{\oldaddcontentsline{loa}{#2}{#3}}
\let\oldpart\part
\renewcommand*\part[1]{%
  \let\addcontentsline\hackedaddcontentsline%
  \oldpart{#1}%
  \let\addcontentsline\oldaddcontentsline%
}
\let\oldchapter\chapter
\renewcommand*\chapter[1]{%
  \let\addcontentsline\hackedaddcontentsline%
  \oldchapter{#1}%
  \let\addcontentsline\oldaddcontentsline%
}
\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%
}
}
\makeatother

Complete working example (remove listof=totoc from scrreprt's options if you don't want LoT and LoF in the ToC):

\documentclass[a4paper, 12pt, headsepline, smallheadings, listof=totoc]{scrreprt}

\newcommand\appendicesname{Appendices}
\newcommand\listofloaname{List of \appendicesname}
\newcommand*{\listofappendices}{\listoftoc{loa}}
\setuptoc{loa}{totoc}

\makeatletter
\g@addto@macro\appendix{%
\let\oldaddcontentsline\addcontentsline
\newcommand\hackedaddcontentsline[3]{\oldaddcontentsline{loa}{#2}{#3}}
\let\oldpart\part
\renewcommand*\part[1]{%
  \let\addcontentsline\hackedaddcontentsline%
  \oldpart{#1}%
  \let\addcontentsline\oldaddcontentsline%
}
\let\oldchapter\chapter
\renewcommand*\chapter[1]{%
  \let\addcontentsline\hackedaddcontentsline%
  \oldchapter{#1}%
  \let\addcontentsline\oldaddcontentsline%
}
\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%
}
}
\makeatother

\begin{document}

\listoffigures
\listoftables
\tableofcontents

\chapter{1st chapter}
\section{1st section}
\chapter{2nd chapter}
\section{2nd section}

\listofappendices

\appendix

\chapter{1st appendix chapter}
\section{1st appendix section}
\chapter{2nd appendix chapter}
\section{2nd appendix section}

\end{document} 

Output (ToC):

enter image description here

Output (LoA):

enter image description here

6
  • Wow that was more complicated than I thought it would be. Thanks A LOT! very useful
    – TomM
    Commented Dec 17, 2013 at 18:08
  • 1
    @TomM You're welcome. Thanks for accepting (it took me almost one hour...) Commented Dec 17, 2013 at 18:10
  • I have a short follow up question. Assuming I'd like to use only chapters in the appendix, but no sections, is it possible to obtain table numbering according to the chapter? In short: A. 1st appendix chapter, then just Table A.1, Table A.2 etc. Then B. 2nd appendix chapter, Table B.1, Table B.2 etc.? (Also appendix tables are still in the original Table of contents atm. Is this intended? My appendix consists 99% of tables)
    – TomM
    Commented Dec 17, 2013 at 21:57
  • 1
    @TomM This is quite a different question. Please ask a new question for this. Commented Dec 18, 2013 at 5:21
  • ok done. Here is the thread, for reference: tex.stackexchange.com/questions/150581/…
    – TomM
    Commented Dec 18, 2013 at 15:48

You must log in to answer this question.

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