0

I want to include a list of appendices after my ToC, which I to some extent have managed, with this code:

\usepackage[titles]{tocloft}
\usepackage{tocloft}

\newcommand{\listappendicesname}{Appendices}
\newlistof{appendices}{apc}{\listappendicesname}
\newcommand{\appendices}[1]{\addcontentsline{apc}{appendices}{#1}}
\parindent0mm

and by using the command

\listofappendices

after my ToC and

\appendices{*name of appendix*}

under the specific appendix section I want to include.

The problem is, that in my text, the appendices is numbered A.1, A.2 etc, but in my tocloft list, they only appear as "name of appendix".

Is there any way I can add the section numbering to my list?

1

As long as \addcontentsline{...}{...}{#1} is used there will be no numbering. The usual way is to use \addcontentsline{...}{...}{\theappendices~#1}, i.e. printing the appendix number before the title.

I hope, that the appendix package is not used as well, otherwise this would cause a conflict with the appendices environment.

The way \appendices (in the OP) was defined is incomplete, it does neither print the title in the text nor does it make any use of the appendices counter by incrementing. Since it is very likely that there might be references to the relevant appendix section I've decided to use \refstepcounter{appendices}.

The \section*{#1 \theappendices} is just for convenience and can be replaced by other typesetting 'eye-candy' at will.

Also use \parindent=0em rather than \parindent=0mm

\documentclass{book}

\usepackage[titles]{tocloft}
\usepackage{tocloft}

\newcommand{\listappendicesname}{Appendices}
\newlistof{appendices}{apc}{\listappendicesname}
\newcommand{\appendices}[1]{%
  \refstepcounter{appendices}%
  \section*{#1 \theappendices}%
  \addcontentsline{apc}{appendices}{\theappendices~ #1}%
}

\usepackage{blindtext}

\parindent=0em

\begin{document}
\tableofcontents
\listofappendices

\blinddocument
\appendices{Foo One}
\appendices{Foo Two}
\end{document}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.