9

I'm writing a PhD thesis, and my university requires that I list the appendices in a "List of Appendices" (LOA) that is separate from the main table of contents (TOC). I've successfully created a LOA using the tocloft package. The problem is that the appendices are still also listed in the TOC.

One unsatisfactory workaround is to use the asterisk'ed forms of \chapter and \section in the appendices. Among other reasons, I don't like this because it removes the appendix letter from the appendices' title pages.

How can I keep the appendix numbers in the LOA, but remove them from the TOC?

I am using the appendices, tocloft and quotchap packages.

Below is a minimal compilable example.

\documentclass[12pt,draft,letterpaper]{report}
\usepackage{quotchap}
\usepackage[titles]{tocloft}
\usepackage{appendix}

\newlistof{appendixchapter}{apx}{List of Appendices}

\newcommand{\appendixchapter}[1]{%
  % These three lines are needed to list the appendix letter in the List Of
  % Appendices even when using \chapter*
  \refstepcounter{appendixchapter}%
  \refstepcounter{chapter}%
  \providecommand{\DOTIS}[1]{\DOCH \DOTI{#1}}

  % '*' removes the appendix from the table of contents.
  \chapter*{#1}

  % Lists the appendix in the List of Appendices.
  \addcontentsline{apx}{appendixchapter}{Appendix \protect\numberline{\theappendixchapter}#1}\par%
  \vspace {-1.47cm}}

\renewcommand{\theappendixchapter}{\Alph{appendixchapter}}

\begin{document}

\tableofcontents
\listofappendixchapter\addcontentsline{toc}{section}{List of Appendices}

\chapter{My first chapter}
This is Chapter 1's body.

\appendixchapter{My first appendix}
This is Appendix A's body.

\appendixchapter{My second appendix}
This is Appendix B's body.

\end{document}
4
  • 1
    Please add to your question a minimal, schematic version of your code showing the relavant code: documnet class used, relevant packages, and the way you are building your appendices and the new LoA. Dec 14, 2011 at 4:10
  • Have you tried the workaround described in the first code snippet in the question tex.stackexchange.com/q/8211/575 ?
    – Ryan Reich
    Dec 14, 2011 at 4:18
  • @GonzaloMedina done. Dec 14, 2011 at 5:23
  • @SuperElectric: my answer adapts perfectly to your situation. Dec 14, 2011 at 6:09

1 Answer 1

11

There's really no need to define a new command for the chapter in the appendices section; just before the appendices you can redefine the \@chapter command (defined in report.cls), to include the appendices in the new list instead of including them in the ToC; here's an example of such a redefinition; note that the second mandatory argument of \newlistof must be used in the redefinition of \chapter (see the lines marked with %NEW):

\documentclass[12pt,draft,letterpaper]{report}
\usepackage{quotchap}
\usepackage[titles]{tocloft}
\usepackage{appendix}

\newlistof{appendixchapter}{apx}{List of Appendices}

\begin{document}

\tableofcontents
\listofappendixchapter
\addcontentsline{toc}{section}{List of Appendices}

\chapter{My first chapter}
This is Chapter 1's body.

\appendix

\makeatletter
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{apx}{chapter}%NEW
                                   {\protect\numberline{\thechapter}#1}%
                    \else
                      \addcontentsline{apx}{chapter}{#1}%NEW
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
\makeatother

\chapter{My first appendix}
This is Appendix A's body.

\chapter{My second appendix}
This is Appendix B's body.

\end{document}

An excerpt from the resulting document showing the ToC and the LoA:

enter image description here

enter image description here

As requested, here's the code necessary to use a new command \appendixchapter (similar to \chapter) for the appendices; the new definition needs two new commands \appendixchapter and \@appendixchapter; only the first one will be used in the document body:

\documentclass[12pt,draft,letterpaper]{report}
\usepackage{quotchap}
\usepackage[titles]{tocloft}
\usepackage{appendix}

\makeatletter
\newcommand\appendixchapter{\if@openright\cleardoublepage\else\clearpage\fi
                    \thispagestyle{plain}%
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@appendixchapter\@schapter}
\def\@appendixchapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                         \refstepcounter{chapter}%
                         \typeout{\@chapapp\space\thechapter.}%
                         \addcontentsline{apx}{chapter}%NEW
                                   {\protect\numberline{\thechapter}#1}%
                    \else
                      \addcontentsline{apx}{chapter}{#1}%NEW
                    \fi
                    \chaptermark{#1}%
                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}
\makeatother

\newlistof{appendixchapter}{apx}{List of Appendices}

\begin{document}

\tableofcontents
\listofappendixchapter
\addcontentsline{toc}{section}{List of Appendices}

\chapter{My first chapter}
This is Chapter 1's body.

\appendix


\appendixchapter{My first appendix}
This is Appendix A's body.

\appendixchapter{My second appendix}
This is Appendix B's body.

\end{document}
3
  • @SuperElectric: I've updated my answer. Dec 14, 2011 at 6:15
  • Thanks! Now I'm getting greedy: is it possible to fix the problem by defining a special command (e.g. \appendixchapter), rather than redefining the existing \chapter? This would allow one to put the definition of \appendixchapter in a separate source file from the main thesis body. If you or someone posts such a solution, I'd upvote & choose that. Dec 14, 2011 at 21:33
  • @SuperElectric: the necessary definitions are now in my updated answer; if you are going to put these definitions in a .sty file, there's no need to use the commands \makeatletter, \makeatother; if they will be part of a .tex file, then \makeatletter, \makeatother will be necessary. Dec 14, 2011 at 22:33

You must log in to answer this question.

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