1

I am writing a book using the book class. In the table of contents, I want

PART 1 Whatever Chapter 1 whatever ... and then to switch, in the appendices to

APPENDICES Appendix A Whatever ...

I cannot seem to get LaTeX to recognize the \renewcommand to change from Part to blank and Chapter to Appendix. I can't seem to get rid of the PART" before APPENDICES without getting rid of it on all the other sections, or to change Chapter" to "Appendix"

I would also like to delete the page numbers on pages 1, 9 and 15. I have tried placing \thispagestyle{empty} in various places in the document, but to no avail.

Here is my code:

\documentclass[11pt]{book}
\usepackage[toc,page]{appendix}
\usepackage{tocloft}
\begin{document}
\renewcommand{\cftpartfont}{\bfseries}
\renewcommand{\cftpartpagefont}{\bfseries}
\renewcommand{\cftpartpresnum}{PART~}
\renewcommand{\cftpartaftersnum}{:}
\renewcommand{\cftpartnumwidth}{6em}

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



\frontmatter
\thispagestyle{empty}
\setcounter{tocdepth}{1}
\tableofcontents

\mainmatter
\renewcommand\partname{PART}
\part{Theory of Junk}
\input{Ch1}
\input{Ch2}
\input{Ch3}

\part{Theory of Garbage}
\input{Ch4}
\input{Ch5}


\renewcommand\partname{}
\renewcommand\thepart{\null}
\renewcommand{\cftpartpresnum}{}

\part{APPENDICES}
\appendix
\renewcommand{\cftchappresnum}{Appendix~}
\input{A1}
\input{A2}


\backmatter
\end{document}

1 Answer 1

0

You have to write the changes into the TOC using \addtocontents:

\addtocontents{toc}{%
  \protect\renewcommand{\protect\cftpartpresnum}{}%
  \protect\renewcommand{\protect\cftchappresnum}{Appendix~}%
  \protect\renewcommand{\protect\cftchapnumwidth}{7em}%
}%

Example without package appendix:

\documentclass[11pt]{book}
\usepackage{blindtext}% only for dummy text
%\usepackage[toc,page]{appendix}% not used in the example
\usepackage{tocloft}

\renewcommand{\cftpartfont}{\bfseries}
\renewcommand{\cftpartpagefont}{\bfseries}
\renewcommand{\cftpartpresnum}{PART~}
\renewcommand{\cftpartaftersnum}{:}
\renewcommand{\cftpartnumwidth}{6em}

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

\renewcommand{\partname}{PART}

\newcommand{\originalappendix}{}
\let\originalappendix\appendix
\renewcommand{\appendix}{%
  \originalappendix
  \addtocontents{toc}{%
    \protect\renewcommand{\protect\cftpartpresnum}{}%
    \protect\renewcommand{\protect\cftchappresnum}{Appendix~}%
    \protect\renewcommand{\protect\cftchapnumwidth}{7em}%
  }%
  \cleardoublepage
  \addcontentsline{toc}{part}{APPENDICES}%
  \part*{APPENDICES}%
}

\begin{document}
\frontmatter
\thispagestyle{empty}
\setcounter{tocdepth}{1}
\tableofcontents

\mainmatter
\part{Theory of Junk}
\blinddocument
\blinddocument
\blinddocument
\part{Theory of Garbage}
\blinddocument
\blinddocument

\appendix
\blinddocument
\blinddocument

%\backmatter
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .