0

I use the following for creating my own list of appendices (which comes as the e.g. table of figures after the toc):

\newcommand{\listappendicesname}{Anhangverzeichnis}
\newlistof[section]{appendices}{apc}{\listappendicesname}
\newcommand{\appendices}[1]{\addcontentsline{apc}{appendices}{#1}}

The list appears as it should but the list isnt numberized. The following code creates at least the first number, but gives multiple errors and no names in the list ...

\newcommand{\listappendicesname}{Anhangverzeichnis}
\newlistof[section]{appendices}{apc}{\listappendicesname}
\newcommand{\appendices}[1]{\refstepcounter{appendices}{\addcontentsline{apc}{appendices}{#1}}

Document class is article. Any suggestions?

  • 1
    Welcome to TeX.SE. It would be helpful if you composed a fully compilable minimal working example (MWE) including \documentclass and the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. – user36296 Jan 16 at 9:13
1

The following code creates at least the first number, but gives multiple errors and no names in the list ...

Firstly, "multiple errors" arise from the fact that braces are not paired in

\newcommand{\appendices}[1]{\refstepcounter{appendices}{\addcontentsline{apc}{appendices}{#1}}

Deleting the left brace right before \addcontentsline solves this problem, and then no errors will be given.

Secondly, "no names in the list" is because you did not include the name (here is #1) in the definition of \appendices. This one and all the other minor problems are all solved in the following full example, adapted from the doc of package tocloft.

\documentclass{article}
\usepackage{tocloft}

\newcommand{\listappendicesname}{Anhangverzeichnis}
\newlistof[section]{appendices}{apc}{\listappendicesname}
\newcommand{\appendices}[1]{%
  \refstepcounter{appendices}%
  \par\noindent\textbf{Appendix \theappendices. #1}%
  \addcontentsline{apc}{appendices}{\theappendices\hspace{1em}#1}}

\begin{document}
\tableofcontents
\listofappendices

\section{title}
\appendices{abc} xxx xxx
\appendices{def} xxx xxx
\end{document}

enter image description here

  • Actually, the sec. 2.4 of doc of package tocloft, as well as this blog article both give a nice introduction on how to define new toc-like list. – Johannes Z Jan 16 at 9:40
  • Thanks! As I see in the picture of the Anhangverzeichnis, there is still no numbering before 'abc' and 'def' in form of "1" and "2" like the table of figures includes... – Kirschbrot Jan 16 at 11:15
  • @Kirschbrot The content of items of toc-like list is the third argument of command \addcontentsline. I have updated the answer to add numbering. – Johannes Z Jan 17 at 2:42

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.