5

How do I get a ":" to show up after Appendix in my ToC.

Right now I have

APPENDIX A. Classification experiments

but I want:

APPENDIX A: Classification experiments

In the preamble I am using:

\usepackage[title,titletoc]{appendix}
\renewcommand{\appendixname}{APPENDIX} 

At the appendix I am using:

\renewcommand{\thechapter}{\Alph{chapter}}
\titleformat{\chapter}[display]{\normalfont \centering}{APPENDIX \thechapter}{11 pt}{}

\begin{appendices}

\chapter{Details of Classification Experiments}

\end{appendices}

Everything else with the appendices is formatted the way I want.

Here's a MWE:

\documentclass[11pt, letterpaper]{thesis}

\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}

\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{section}}

\usepackage[title,titletoc]{appendix}
\renewcommand{\appendixname}{APPENDIX}

\usepackage{etoolbox}

\usepackage{tocloft}
\makeatletter
\renewcommand{\numberline}[1]{%
   \@cftbsnum #1\@cftasnum~\@cftasnumb%
}
\makeatother
\addtocontents{toc}{\hfill\ {Page} \par}

\usepackage{titlesec}
\assignpagestyle{\chapter}{fancy}
\titleformat{\chapter}[display]{\normalfont \centering}{CHAPTER \chaptertitlename\ \thechapter}{11 pt}{}
\titleformat{\section}[display]{\normalfont \centering}{}{11 pt}{}


\begin{document}

\addcontentsline{toc}{part}{CONTENTS}

\renewcommand{\tocloftpagestyle}[1]{\def\@cftpagestyle{\thispagestyle{#1}}}
\tocloftpagestyle{empty}
\renewcommand*\contentsname{\centerline{CONTENTS}}
\renewcommand{\cfttoctitlefont}{\normalfont}

\tableofcontents
\newpage

\part*{CHAPTERS}
\addcontentsline{toc}{part}{CHAPTERS}

\chapter{Introduction}
\thispagestyle{fancy}

\renewcommand{\thechapter}{\Alph{chapter}}
\titleformat{\chapter}[display]{\normalfont \centering}{APPENDIX \thechapter}{11 pt}{}

\begin{appendices}

\chapter{Details of Classification Experiments}
\thispagestyle{fancy}

\end{appendices}

\end{document}
2
  • That will depend on which class and package you use. Please provide us with a complete, minimal working example (MWE).
    – Sveinung
    Aug 3, 2012 at 17:06
  • I am using the thesis package
    – COM
    Aug 3, 2012 at 17:28

1 Answer 1

3

thesis.cls redefines \@chapter which inserts a period . after the chapter number by default. regexpatch can be used to replace all of these instances with

\makeatletter
% Replace all "\thechapter ." with "\thechapter" - there's 4 of them in \@chapter
\xpatchcmd*{\@chapter}{\thechapter .}{\thechapter}{}{}\thechapter
\makeatother

after including \usepackage{regexpatch} in the document preamble. Additionally, calling

\addtocontents{toc}{\protect\renewcommand\protect\cftchapaftersnum{:}}

before your first appendix \chapter. This redefines what's printed after the sectional number for chapters. Inserting this into the toc requires \protection. Here's your complete MWE:

enter image description here

\documentclass[11pt, letterpaper]{thesis}% http://ctan.org/pkg/thesis
\usepackage{regexpatch}% http://ctan.org/pkg/regexpatch
\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}

\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{section}}

\usepackage[title,titletoc]{appendix}% http://ctan.org/pkg/appendix
\renewcommand{\appendixname}{APPENDIX}

\usepackage{tocloft}% http://ctan.org/pkg/tocloft
\makeatletter
\renewcommand{\numberline}[1]{%
   \@cftbsnum #1\@cftasnum~\@cftasnumb%
}
\makeatother
\addtocontents{toc}{\hfill\ {Page} \par}

\usepackage{titlesec}% http://ctan.org/pkg/titlesec
\assignpagestyle{\chapter}{fancy}
\titleformat{\chapter}[display]{\normalfont \centering}{CHAPTER \chaptertitlename\ \thechapter}{11 pt}{}
\titleformat{\section}[display]{\normalfont \centering}{}{11 pt}{}    

\begin{document}

\addcontentsline{toc}{part}{CONTENTS}

\renewcommand{\tocloftpagestyle}[1]{\def\@cftpagestyle{\thispagestyle{#1}}}
\tocloftpagestyle{empty}
\renewcommand*\contentsname{\centerline{CONTENTS}}
\renewcommand{\cfttoctitlefont}{\normalfont}

\tableofcontents
\newpage

\part*{CHAPTERS}
\addcontentsline{toc}{part}{CHAPTERS}

\chapter{Introduction}
\thispagestyle{fancy}
\renewcommand{\thechapter}{\Alph{chapter}}
\titleformat{\chapter}[display]{\normalfont \centering}{APPENDIX \thechapter}{11 pt}{}

\makeatletter
\xpatchcmd*{\@chapter}{\thechapter .}{\thechapter}{}{}%{\typeout{success}}{\typeout{failure}}
\makeatother
\addtocontents{toc}{\protect\renewcommand\protect\cftchapaftersnum{:}}

\begin{appendices}

\chapter{Details of Classification Experiments}
\thispagestyle{fancy}

\end{appendices}

\end{document}
0

You must log in to answer this question.

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