Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I just implemented Mike Renfro's solution from here, but the content in the list of appendices also gets listed in the toc, which should not be the case. How would one ensure this is avoided? Below is the code I've used. The report class has been used because I want to have chapters in the document.

\documentclass[12pt]{report}
\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}

\renewcommand{\appendix}[1]{%
  \refstepcounter{appendix}%
  \chapter{\theappendix\space #1}%
  \addcontentsline{app}{appendix}{\protect\numberline{\theappendix}#1}%
  \par
}

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

\usepackage{fmtcount,etoolbox}
\makeatletter
\patchcmd{\@makechapterhead}{\thechapter}{\Numberstring{chapter}}{}{}
\patchcmd{\chaptermark}{\thechapter}{\NUMBERstring{chapter}}{}{}
\makeatother
\newcommand{\thetocchap}{\NUMBERstring{chapter}}

\begin{document}
\tableofcontents
\listofappendix

\chapter{Foo} \lipsum[1]
\section{Bar} \lipsum[2]%sub
\chapter{Additional Foo} \lipsum[3]
\section{Additional Bar} \lipsum[4]%sub

\begin{appendices}

\appendix{Baz} \lipsum[5]
\subappendix{Qux} \lipsum[6]
\appendix{Additional Baz} \lipsum[7]
\subappendix{Additional Qux} \lipsum[8]
\end{appendices}
\end{document}
share|improve this question
2  
Now I can officially Welcome you to TeX.SE. I would recommend that instead of linking to your non-answer that you link instead to the other question and delete your non-answer at Creating a separate list of appendices with tocloft. Also the @ syntax does not work in questions/answers, only in comments. –  Peter Grill Nov 12 '12 at 7:03

1 Answer 1

Add \addtocontents{toc}{\protect\setcounter{tocdepth}{-2}} in the document body immediately before \begin{appendices}. (And don't forget to load the appendix package.)

\documentclass[12pt]{report}
\usepackage{lipsum}
\usepackage{tocloft}
\usepackage{appendix}
\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}

\renewcommand{\appendix}[1]{%
  \refstepcounter{appendix}%
  \chapter{\theappendix\space #1}%
  \addcontentsline{app}{appendix}{\protect\numberline{\theappendix}#1}%
  \par
}

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

\usepackage{fmtcount,etoolbox}
\makeatletter
\patchcmd{\@makechapterhead}{\thechapter}{\Numberstring{chapter}}{}{}
\patchcmd{\chaptermark}{\thechapter}{\NUMBERstring{chapter}}{}{}
\makeatother
\newcommand{\thetocchap}{\NUMBERstring{chapter}}

\begin{document}
\tableofcontents
\listofappendix

\chapter{Foo} \lipsum[1]
\section{Bar} \lipsum[2]%sub
\chapter{Additional Foo} \lipsum[3]
\section{Additional Bar} \lipsum[4]%sub

\addtocontents{toc}{\protect\setcounter{tocdepth}{-2}}

\begin{appendices}

\appendix{Baz} \lipsum[5]
\subappendix{Qux} \lipsum[6]
\appendix{Additional Baz} \lipsum[7]
\subappendix{Additional Qux} \lipsum[8]
\end{appendices}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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