[Tex/LaTex] List of Appendices

appendicestable of contents

My document guidelines for a multi-chapter thesis requires that any appendices be pulled out of the TOC and dropped into a separate List Of Appendices (LOA). The latex package put together for my University has a method in place for accomplishing this, but it requires the user to manually edit the TOC file and LOA files to populate them with content. I pieced together a more automated way to pull the individual Appendix entries from the TOC (instead of editing thesis.toc and manually deleting the lines):

\newcommand{\nocontentsline}[3]{}
\newcommand{\tocless}[2]{\bgroup\let\addcontentsline=\nocontentsline#1{#2}\egroup}

Followed by (when declaring the first Appendix):

\tocless\chapter{The First Appendix}
\addcontentsline{toc}{chapter}{Appendices}

All other appendices use the \tocless command. This seems to work, the TOC has an entry at the end for "Appendices," and the page number associated with it corresponds to the first page of the first Appendix. Exactly what the Grad School requires for formatting.

Getting a List of Appendices to work out, in a style that matches the rest of the document, that doesn't require manually editing multiple files seems to be beyond my grasp. Any help here would be greatly appreciated.

Best Answer

Rooting through the cls file in the link posted above, I tried to dissect the following block, which looked rather promising:

\newcommand\listofappendices{%
    \@chapteronefalse
    \if@arabic\relax\else\renewcommand{\thepage}{\roman{page}}\fi
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapteruaf*{\listappname
      \@mkboth{\uppercase{\listappname}}%
              {\uppercase{\listappname}}}%
    \@chapteronetrue
    %% get this in contents as a section
    \addcontentsline{toc}{section}{\listappname}
    \@starttoc{loa}%
    \if@restonecol\twocolumn\fi
    \newpage\renewcommand{\thepage}{\arabic{page}}}

Basically, I realized that this command was setting up the List of Appendices for me, all I needed was a way to automatically populate it, instead of manually adding entries to the loa file.

At the head of each Appendix:

\chapter*{This is the first appendix}
\addcontentsline{loa}{appendix}{This is the entry for the first appendix in the List of Appendices}

The \chapter* suppresses a TOC entry for the appendix, while the \addcontentsline adds the entry to the LOA file. To get the style to match, I added the following line to the end of the code block in the cls file:

\newcommand\l@appendix{\@dottedtocline{1}{1.5em}{2.3em}}

Works perfectly now, and I don't have to worry about manually creating the List of Appendices every time I build my document.

Related Question