1

I would like to know how to alter the title of the contents page of the document given by the following code, so that the word 'Contents' appears above the horizontal rule ('titlerule' in the code) at the top of the page, rather than below it. That is, I would like 'Contents' to be in the place of the chapter number, rather than in the place of the chapter title. Does anyone have a nice way of doing this?

\documentclass[12pt]{report}
\usepackage{titlesec} 
\usepackage{amssymb}
\usepackage[english]{babel}
\usepackage{titletoc}
\titleformat{\chapter}[display]
{\Large}
{\filright\Large\thechapter}
{0ex}
{\titlerule[1pt]\filright}

\addto\captionsenglish{
\renewcommand{\contentsname}%
{Contents}%
}
\begin{document}

\tableofcontents

\chapter{Test chapter}
\section{Test section}
\end{document}
1

A solution using the numberless key of titlesec:

 \documentclass[12pt]{report}
\usepackage{titlesec}
\usepackage{amssymb}
\usepackage[english]{babel}
\usepackage{titletoc}
\titleformat{\chapter}[display]
{\Large}
{\filright\Large\thechapter}
{0ex}
{\titlerule[1pt]\filright}

\titleformat{name=\chapter, numberless}[block]
{\Large\filright}
{}
{0ex}
{\rlap{\rule[-1ex]{\linewidth}{0.4pt}}}%[\raisebox{1cm}{}]
\addto\captionsenglish{
\renewcommand{\contentsname}%
{Contents}%
}
\begin{document}

\tableofcontents

\chapter{Test chapter}
\section{Test section}

\end{document} 

enter image description here

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.