Document Classesappendix in tocloft

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
jihad
Posts: 2
Joined: Mon Jul 21, 2008 5:13 am

appendix in tocloft

Post by jihad »

Hi,
I had a problem similar to many of you when wanting to have my table of contents look like the one below (see bottom of page). So I decided to use tocloft since that is what many of you advised. However I am having problem separating having a different format in the TOC for the appendix... That is my appendices are listed like a chapter in the TOC while I would like to play with the chapter format in the TOC while keeping the appendix simple " Appendix A" , "Appendix B".... is there a way to do that ?

Anyone can send me an example of \tocloft that can explain how to manage the TOC well... because I looked at the documentation, and yes I am ashamed to say, did not help much. Especially that I am under a tight deadline and I lost the whole day to format the TOC.


Dedication .................................. ii
Abstract .................................. vi
Chapter 1: Why ? ..........................1
Chapter 2: What is a good book for latex programming ? ...55

Appendix A ....................................
Appendix B ....................................


SO far what I am using is this:

\usepackage[subfigure]{tocloft}
\usepackage{tocloft}

\renewcommand{\cftchapfont}{\bfseries}
\renewcommand{\cftchappagefont}{\bfseries}
\renewcommand{\cftchappresnum}{Chapter }
\renewcommand{\cftchapaftersnum}{:}
\renewcommand{\cftchapnumwidth}{6em}

But this gave me :
Chapter A: Appendix to chapter 2 ... ( Not nice )
furthermore after using \tocloft the TOC and other tables are not anymore on a new page ..

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

jihad
Posts: 2
Joined: Mon Jul 21, 2008 5:13 am

Re: appendix in tocloft

Post by jihad »

Some help please ?

how can I modify the way the appendix appears in the TOC without changing the way the other chapters appear...using tocloft
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

appendix in tocloft

Post by gmedina »

Hi jihad,

In the code below I suggest a possibility. I used the titlesec package to modify \paragraph and make it behave as \chapter. Now the changes made to the way chapters are shown in the ToC using tocloft will not affect the appendices. You can adapt my example according to your needs.

Code: Select all

\documentclass{book}
\usepackage{titlesec}
\usepackage{tocloft}

\renewcommand{\cftchapfont}{\bfseries}
\renewcommand{\cftchappagefont}{\bfseries}
\renewcommand{\cftchappresnum}{\chaptername }
\renewcommand{\cftchapaftersnum}{:}
\renewcommand{\cftchapnumwidth}{6em}

\titleformat{\paragraph}[display]
  {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\paragraph} {0pt}{50pt}{40pt}

\setcounter{secnumdepth}{5}

\begin{document}
\tableofcontents
\clearpage
\listoffigures
\clearpage
\listoftables
\clearpage

\chapter{Test 1}
\chapter{Test 2}
\clearpage
\renewcommand\thechapter{\Alph{chapter}}
\setcounter{chapter}{1}
\paragraph{First Appendix}
\thispagestyle{plain}
\addcontentsline{toc}{chapter}{Appendix A}
\clearpage
\stepcounter{chapter}
\paragraph{Second Appendix}
\thispagestyle{plain}
\addcontentsline{toc}{chapter}{Appendix B}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply