1

I would like a toc in which the word "CHAPTER" and its number appears just above the name of the chapter just like this

enter image description here

and here is my output

enter image description here

Any idea how I could get that?

Here is my Latex code:

\documentclass{report}
\usepackage[titles]{tocloft}
\usepackage{titlesec}
\renewcommand{\contentsname}{Table of contents}
\renewcommand{\cftchapfont}{\normalfont}
\renewcommand{\cftchappagefont}{\normalfont}
\renewcommand{\cftdotsep}{1}
\renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}

\addtocontents{toc}{~\hfill  Page\par}
\titleformat{name=\chapter, numberless}[block]{\bfseries\large\filleft}{}{0em}{\MakeUppercase}[{\titlerule[1pt]}]
\titleformat{name=\chapter}[display]{\bfseries\huge\filleft}{\chaptername~\thechapter}{3ex}{\MakeUppercase}[{\titlerule[1pt]}]

\begin{document}

\tableofcontents

\chapter{FIRST CHAPTER}
\chapter{SECOND CHAPTER}
\chapter{THIRD CHAPTER}

\end{document}
3

Using \cftchappresnum and \cftchapaftersnumb:

\documentclass{report}
\usepackage[titles]{tocloft}
\usepackage{titlesec}
\renewcommand{\contentsname}{Table of contents}
\renewcommand{\cftchappresnum}{CHAPTER }
\renewcommand{\cftchapnumwidth}{0pt}
\renewcommand{\cftchapaftersnumb}{\\}
\renewcommand{\cftchapfont}{\normalfont}
\renewcommand{\cftchappagefont}{\normalfont}
\renewcommand{\cftdotsep}{1}
\renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}

\addtocontents{toc}{~\hfill  Page\par}
\titleformat{name=\chapter, numberless}[block]{\bfseries\large\filleft}{}{0em}{\MakeUppercase}[{\titlerule[1pt]}]
\titleformat{name=\chapter}[display]{\bfseries\huge\filleft}{\chaptername~\thechapter}{3ex}{\MakeUppercase}[{\titlerule[1pt]}]

\begin{document}

\tableofcontents

\chapter{FIRST CHAPTER}
\chapter{SECOND CHAPTER}
\chapter{THIRD CHAPTER}

\end{document}

enter image description here

Edit: Regarding your additional questions

For additional space use \renewcommand{\cftchapaftersnumb}{\\[5pt]}. Change the 5pt to your liking.

For the appendix use \addtocontents{toc}{\protect\renewcommand\protect\cftchappresnum{APPENDIX }} right before the first chapter in your appendix. Alternatively, if you use \appendix to start your appendix you could as well use the following in your preamble:

\edef\appendix%
  {%
    \unexpanded\expandafter
      {%
        \appendix
        \addtocontents{toc}
          {\protect\renewcommand\protect\cftchappresnum{APPENDIX }}%
      }%
  }
  • thank you very much, it works. There are 2 more thing I would like ask. The first is that I would like to add some vertical space between the word "CHAPTER " and its name. The second is that I would like to use "APPENDIX" above each appendix chapter. The code below write "CHAPTER A". How can i get to write "APPENDIX A" instead of "CHAPTER A" – Günal Jun 6 '18 at 11:08

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.