1

I am using TU delft thesis template : http://www.tudelft.nl/thema/handleiding-huisstijl/downloads/ Only chapter numbers and appendix appear in toc, but I want the words chapter and appendix along with them. But I do not want them in the titles itself. In the title, I just want numbers for \mainmatter and letters for \appendix This is how it is as of now

  • 1
    Welcome to TeX.SX! Please add a MWE to help us help you. – TeXnician Mar 17 '17 at 17:06
  • 1
    A screen shot does not really reveal which code you're using – user31729 Mar 17 '17 at 17:15
1

I assume that you use the class dissertation.cls from in this zip archive on the web page that you link to, which loads the class book and (among others) the package titletoc. Then you can achieve what you want by adding the following lines to your preamble:

%%% The following lines add Chapter or Appendix in front of the number
\titlecontents{chapter}%
  [0pt]%
  {\vspace{1ex}}%
  {\bfseries\chapappname\ \thecontentslabel\quad}%
  {\bfseries}%
  {\bfseries\hfill\contentspage}
%%% Initially, for the main part of the document, set the label to "Chapter"
\let\chapappname\chaptername

Moreover, after the \appendix command, add the line

%%% Sets the label in the table of contents to "Appendix"
\addtocontents{toc}{\string\let\string\chapappname\string\appendixname}

There is a problem, though: Due to a LaTeX bug you may not use \include to include the code for the appendix. Instead, use \input or write it directly into the main file.

%%% The appendices have to be included with `\input`, not `\include`
%%% due to a bug in LaTeX, otherwise the appendices will also be
%%% labeled "Chapter"
\input{appendix-a/appendix-a}
%%% Wrong: \include{appendix-a/appendix-a}

enter image description here

\documentclass{dissertation}
%%% The following lines add Chapter or Appendix in front of the number
\titlecontents{chapter}%
  [0pt]%
  {\vspace{1ex}}%
  {\bfseries\chapappname\ \thecontentslabel\quad}%
  {\bfseries}%
  {\bfseries\hfill\contentspage}
%%% Initially, for the main part of the document, set the label to "Chapter"
\let\chapappname\chaptername
\begin{document}

%% Specify the title and author of the thesis. This information will be used on
%% the title page (in title/title.tex) and in the metadata of the final PDF.
\title[Optional Subtitle]{Title}
\author{Albert}{Einstein}

%% Use Roman numerals for the page numbers of the title pages and table of
%% contents.
\frontmatter

\include{title/title}

%% The (optional) dedication can be used to thank someone or display a
%% significant quotation.
\dedication{\epigraph{Science is a wonderful thing \\ if one does not have to earn one's living at it.}{Albert Einstein}}

\tableofcontents

\include{summary/summary}
\include{preface/preface}

%% Use Arabic numerals for the page numbers of the chapters.
\mainmatter

%% Turn on thumb indices.
\thumbtrue

\include{chapter-1/chapter-1}
\include{conclusion/conclusion}
\include{epilogue/epilogue}
\include{acks/acks}

%% Use letters for the chapter numbers of the appendices.
\appendix
%%% Sets the label in the table of contents to "Appendix"
\addtocontents{toc}{\string\let\string\chapappname\string\appendixname}

%%% The appendices have to be included with `\input`, not `\include`
%%% due to a bug in LaTeX, otherwise the appendices will also be
%%% labeled "Chapter"
\input{appendix-a/appendix-a}

%% Turn off thumb indices for unnumbered chapters.
\thumbfalse

\include{cv/cv}
\include{publications/publications}

\end{document}

Edit: To make the toc entries for chapters entirely cyan and the ones for (sub)sections entirely black (as requested in the comments), add the following lines to the preamble (replacing the lines shown above).

%%% The following lines add Chapter or Appendix in front of the number
\titlecontents{chapter}%
  [0pt]%
  {\vspace{1ex}}%
  {\color{title}\bfseries\chapappname\ \thecontentslabel\quad}%
  {\bfseries}%
  {\bfseries\hfill\contentspage}
%%% Initially, for the main part of the document, set the label to "Chapter"
\let\chapappname\chaptername
\titlecontents{section}
  [3.8em]%
  {}%
  {\colorlet{title}{black}\contentslabel{2.3em}}%
  {\hspace*{-2.3em}}%
  {\titlerule*[1pc]{.}\contentspage}
\titlecontents{subsection}
  [6.8em]%
  {}%
  {\colorlet{title}{black}\contentslabel{3.0em}}%
  {\hspace*{-3.0em}}%
  {\titlerule*[1pc]{.}\contentspage}

enter image description here

\documentclass{dissertation}
%%% The following lines add Chapter or Appendix in front of the number
\titlecontents{chapter}%
  [0pt]%
  {\vspace{1ex}}%
  {\color{title}\bfseries\chapappname\ \thecontentslabel\quad}%
  {\bfseries}%
  {\bfseries\hfill\contentspage}
%%% Initially, for the main part of the document, set the label to "Chapter"
\let\chapappname\chaptername
\titlecontents{section}
  [3.8em]%
  {}%
  {\colorlet{title}{black}\contentslabel{2.3em}}%
  {\hspace*{-2.3em}}%
  {\titlerule*[1pc]{.}\contentspage}
\titlecontents{subsection}
  [6.8em]%
  {}%
  {\colorlet{title}{black}\contentslabel{3.0em}}%
  {\hspace*{-3.0em}}%
  {\titlerule*[1pc]{.}\contentspage}
\begin{document}

%% Specify the title and author of the thesis. This information will be used on
%% the title page (in title/title.tex) and in the metadata of the final PDF.
\title[Optional Subtitle]{Title}
\author{Albert}{Einstein}

%% Use Roman numerals for the page numbers of the title pages and table of
%% contents.
\frontmatter

\include{title/title}

%% The (optional) dedication can be used to thank someone or display a
%% significant quotation.
\dedication{\epigraph{Science is a wonderful thing \\ if one does not have to earn one's living at it.}{Albert Einstein}}

\tableofcontents

\include{summary/summary}
\include{preface/preface}

%% Use Arabic numerals for the page numbers of the chapters.
\mainmatter

%% Turn on thumb indices.
\thumbtrue

\include{chapter-1/chapter-1}
\include{conclusion/conclusion}
\include{epilogue/epilogue}
\include{acks/acks}

%% Use letters for the chapter numbers of the appendices.
\appendix
%%% Sets the label in the table of contents to "Appendix"
\addtocontents{toc}{\string\let\string\chapappname\string\appendixname}

%%% The appendices have to be included with `\input`, not `\include`
%%% due to a bug in LaTeX, otherwise the appendices will also be
%%% labeled "Chapter"
\input{appendix-a/appendix-a}

%% Turn off thumb indices for unnumbered chapters.
\thumbfalse

\include{cv/cv}
\include{publications/publications}

\end{document}
| improve this answer | |
  • THANK YOU :) Can you please also help me with how to change the color of "Chapter 1" from black to cyan, so same as the color of the Chapter name. – user127929 Mar 21 '17 at 15:16
  • And also section name from cyan to black. – user127929 Mar 21 '17 at 15:16
  • @user127929 I have edited my answer. – gernot Mar 21 '17 at 18:50
  • @user127929: If gernot's answer is what you wanted to achieve consider to accept it! – user31729 Apr 20 '17 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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