[Tex/LaTex] Creating a separate list of appendices with tocloft

appendicestable of contentstocloft

I'm very sorry but I have to ask for urgent help as I could not make sense of the individual questions I asked previously.

I'm required a separate list of appendices, i.e. the appendix is not to show up in the TOC except for the item Appendix, which can be manually created with

\addcontentsline{toc}{section}{Appendix}

The appendix itself is supposed to be structured like

Appendix A
A.1 Title
A.2 Title
..

Appendix B
B.1 Title
B.2 Title
..

Tocloft provides a means to manually create a list, this example is taken from the documentation:

\newcommand{\listanswername}{List  of  Answers}
\newlistof[chapter]{answer}{ans}{\listanswername}

\newcommand{\answer}[1]{%
 \refstepcounter{answer}
 \par\noindent\textbf{Answer  \theanswer.  #1}
 \addcontentsline{ans}{answer}{\protect\numberline{\theanswer}#1}\par}

creates the command \listofanswer
which items are added to with

\answer{Hard}

This results in

List of Answers
1 Hard ....... pageno

Several problems arise for me:

  • Decimal counter instead of alphabetic
  • no sub environment for the A.n scheme
  • no prefix like "Appendix A.1 Hard …. pageno"

So I need a list such as

List of Appendices

Appendix A    Code listings   ................. 187
Appendix A.1  Stackexchange generator ........  187
Appendix A.2  Stackexchange hack function .... 2179

Appendix B    Misc            ................ 2180
Appendix B.1  Overview Q&A Sites      ........ 2181
Appendix B.2  User psychoanalysis         .... 2378

I assume this may be solved by adding a second command in the manner presented by the tocloft documentation but I'm currently not capable of spending time figuring it out due to my desastrous state of the paper (of course, due tomorrow).

So if someone could provide the sub-command and a way to change enumeration to literals I'd greatly appreciate it.
Sorry again, I'm in a state of mind where only a a bullet-proof for-dummies solution will get me somewhere.

Best Answer

This might be too late for the original poster, but here's what I came up with. Largely adapted from lockstep's answer, but matches the Appendix/Subappendix model, and follows the ToC style requested:

List of Appendices and Subappendices

\documentclass[toc=flat,numbers=noenddot]{scrartcl}
\usepackage{lipsum}
\usepackage{tocloft}

\newcommand{\listappendixname}{List of Appendices}
\newlistof{appendix}{app}{\listappendixname}
\setcounter{appdepth}{2}    
\renewcommand{\theappendix}{\Alph{appendix}}
\renewcommand{\cftappendixpresnum}{Appendix\space}
\setlength{\cftbeforeappendixskip}{\baselineskip}
\setlength{\cftappendixnumwidth}{1in}
\newlistentry[appendix]{subappendix}{app}{1}
\renewcommand{\thesubappendix}{\theappendix.\arabic{subappendix}}
\renewcommand{\cftsubappendixpresnum}{Appendix\space}
\setlength{\cftsubappendixnumwidth}{1in}
\setlength{\cftsubappendixindent}{0em}

\newcommand{\myappendix}[1]{%
  \refstepcounter{appendix}%
  \section*{\theappendix\space #1}%
  \addcontentsline{app}{appendix}{\protect\numberline{\theappendix}#1}%
  \par
}

\newcommand{\subappendix}[1]{%
  \refstepcounter{subappendix}%
  \subsection*{\thesubappendix\space #1}%
  \addcontentsline{app}{subappendix}{\protect\numberline{\thesubappendix}#1}%
}

\begin{document}
\tableofcontents
\section{Foo} \lipsum[1]
\subsection{Bar} \lipsum[2]
\section{Additional Foo} \lipsum[3]
\subsection{Additional Bar} \lipsum[4]

\listofappendix

\myappendix{Baz} \lipsum[5]
\subappendix{Qux} \lipsum[6]
\myappendix{Additional Baz} \lipsum[7]
\subappendix{Additional Qux} \lipsum[8]
\end{document}