0

I have a line drawn under my chapter headings using \titlerule[2pt]. I want to achieve this same design underneath my 'Contents', 'List of Figures' and 'List of Tables' headings. Can anyone advise me how to do this?

enter image description here

I want that line also under the big 'Contents' heading. And the 'List of Figures' and 'List of Tables' headings on the other pages. enter image description here

Here is my MWE:

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{hyperref}
\usepackage{microtype}
\usepackage{newtxtext} 
\usepackage[a4paper, top=30mm,bottom=30mm,inner=25mm,outer=25mm]{geometry}
\usepackage{titlesec}  
\usepackage{sectsty} 
\usepackage{fancyhdr}
\usepackage{setspace}
\setstretch{1.36}

\usepackage{tocbibind}

\usepackage{tocloft} 
\renewcommand{\cfttoctitlefont} 
              {\usefont{T1}{qhv}{b}{n}\selectfont\huge}
 \renewcommand{\cftchapfont} 
              {\usefont{T1}{qhv}{b}{n}\selectfont}
 \renewcommand{\cftloftitlefont} 
             {\usefont{T1}{qhv}{b}{n}\selectfont\huge} 
\renewcommand{\cftlottitlefont} 
             {\usefont{T1}{qhv}{b}{n}\selectfont\huge} 

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\fontfamily{qhv}\selectfont}{\chaptertitlename\ \thechapter}{15pt}{\Huge}[\vspace{0.8ex}{\titlerule[2pt]}]

\allsectionsfont{\fontfamily{qhv}\selectfont}

\makeatletter % Removes the word 'Chapter'
\renewcommand{\@chapapp}{}
\makeatother

\begin{document}

\pagenumbering{roman}

\tableofcontents
\cleardoublepage

\listoffigures
\cleardoublepage

\listoftables
\cleardoublepage

\pagenumbering{arabic}

\chapter{Introduction}
\section{Example section}
\subsection{Example subsection}

\end{document}
1

Use option titles for package tocloft:

enter image description here

Code:

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{newtxtext} 
\usepackage[a4paper, top=30mm,bottom=30mm,inner=25mm,outer=25mm]{geometry}
\usepackage{titlesec}
\usepackage{sectsty} 
\usepackage{fancyhdr}
\usepackage{setspace}
\setstretch{1.36}
\usepackage{tocbibind}
\usepackage[titles]{tocloft}
\usepackage{hyperref}% load after the other packages

\renewcommand{\cftchapfont}
              {\usefont{T1}{qhv}{b}{n}\selectfont}

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries\fontfamily{qhv}\selectfont}{\chaptertitlename\ \thechapter}{15pt}{\Huge}[\vspace{0.8ex}{\titlerule[2pt]}]

\allsectionsfont{\fontfamily{qhv}\selectfont}

\makeatletter % Removes the word 'Chapter'
\renewcommand{\@chapapp}{}
\makeatother

\begin{document}
\pagenumbering{roman}
\tableofcontents
\listoffigures
\listoftables

\cleardoublepage
\pagenumbering{arabic}

\chapter{Introduction}
\section{Example section}
\subsection{Example subsection}
\end{document}

Note that the redefinitions of \cfttoctitlefont, \cftloftitlefont and \cftlottitlefont. Additionally there is no need for the \cleardoublepage commands before LoF and LoT.

1

Add this to your preamble:

\renewcommand{\cftaftertoctitle}{\vspace{0.8ex}\endgraf\rule{\linewidth}{2pt}}
\renewcommand{\cftafterloftitle}{\vspace{0.8ex}\endgraf\rule{\linewidth}{2pt}}
\renewcommand{\cftafterlottitle}{\vspace{0.8ex}\endgraf\rule{\linewidth}{2pt}}
  • Hmm... That didn't do anything? – Milo Jun 5 '18 at 13:30
  • 1
    @Milo: It's an interaction between tocloft and titlesec. But tocloft has the tools for what you want:. Please see the three lines I suggest. Other possibility: ake all the formatting with titlesec and its companion titletoc. – Bernard Jun 5 '18 at 14:40

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.