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 am very new to LaTeX and still more in a trial and error phase than on a real understanding level.

My goal is to have all appendices - which are chapters and I would like to keep it that way - to appear in the TOC as sections, under a 'chapter' appendices.

Here is what I tried, using the tocloft package

\newpage\phantomsection
\addcontentsline{toc}{chapter}{Appendices}
\appendix

\setlength{\cftchapindent}{\cftsecindent}
\renewcommand{\cftchapfont}{\cftsecfont}
\renewcommand{\cftchapleader}{\cftsecleader}

\chapter{chapter title}

So my idea was to just tell LaTeX to write chapters to the TOC as though they were sections. My code has no effect whatsoever. Any ideas/solutions are very much appreciated

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You had the right idea, but you need to add your changes to the TOC itself rather than in the main document (and because of this you need to \protect some of the commands.) Note that this solution won't look very nice if your appendices have sections.

\documentclass{report}
\usepackage{tocloft}
\begin{document}
\tableofcontents
\chapter{A chapter}
\section{A section}
\newpage\phantomsection
\addcontentsline{toc}{chapter}{Appendices}
\appendix
\addtocontents{toc}{
\setlength{\cftbeforechapskip}{\cftbeforesecskip}
\setlength{\cftchapindent}{\cftsecindent}
\protect\renewcommand{\cftchapfont}{\cftsecfont}
\protect\renewcommand{\protect\cftchapdotsep}{\cftsecdotsep}
}
\chapter{An Appendix}
\end{document}

partial output of code

share|improve this answer
1  
Thanks a lot. That did the trick. I don't fully grasp yet what is happening at some points in the code, and where what is set. \setlength{\cftbeforechapskip}{\cftbeforesecskip} might be useful in this context, too. I forgot to put it in my question... –  D.Roepo Aug 8 '11 at 15:58
    
I added that to the example. If your appendices don't themselves have sections it definitely leads to a pleasing layout for the TOC compared to the alternative. –  Alan Munn Aug 8 '11 at 16:30
    
What is the best way to have chapters also appear as sections in the bookmarks? I am using the bookmark package and experimented with \bookmarksetup{level=section} or \pdfbookmark[2]{... but the appendices would remain at the same bookmarklevel as Appendices –  D.Roepo Jul 13 '13 at 16:00
    
@D.Roepo Sorry, but I don't have an answer to your question. It looks like a good candidate for a new question. –  Alan Munn Jul 13 '13 at 17:36

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.