I am tired of not successfully doing it right !! I am working on my thesis and I am using this template https://github.com/kks32/phd-thesis-template/. However, there are some changes I need to implement and I could not successfully do it myself.
- I need to add the word chapter before the chapter number and chapter name in the table of content (using tocbibind package). This part is similar to this post. I already tried this code before but it added the word chapter before every level-1 heading and I want it to be limited to only the main chapters without the list of figures, acronyms or even the appendices.
below is the MWE:
\documentclass{report}
\usepackage{tocbibind}
\begin{document}
\tableofcontents
\section{test 1}
First document. This is a simple example, with no
extra parameters or packages included.
\end{document}
I then added the following code to the template, it executed and gave what I want yet there is the word chapter before every level-one title in the TOC.
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\settowidth{\@tempdimb}{\normalsize\bfseries \chaptername~}%
\advance\leftskip by \@tempdimb
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@tempdima
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
\chaptername~#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\makeatother
Below is the last version after modification:
\documentclass{report}
\usepackage{tocbibind}
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\settowidth{\@tempdimb}{\normalsize\bfseries \chaptername~}%
\advance\leftskip by \@tempdimb
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@tempdima
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
\chaptername~#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\makeatother
\begin{document}
\tableofcontents
\chapter{Test 1}
First document. This is a simple example, with no extra parameters or packages included.
\end{document}
- In chapters first pages, there are no page numbers and I want the page number to be visible at the top right of the page... I have been trying to figure out where is the exact code that suppresses the page number from being visible at the chapter title page with no success.