1

I would like to customize the layout of my toc. I want the first page of the toc to look like the other pages (i.e., the header "Contents" shoud be removed, the headline should be like the one on the second page and the toc should start at the top of the page). How can this be done?

MWE:

\documentclass[twoside]{book}
\usepackage{fancyhdr}
\begin{document}
\pagestyle{fancy}
    \fancyhead{}
    \setlength{\headheight}{15pt}
    \def\chaptermark#1{\markboth{\footnotesize\thechapter.\ \textsc{#1}}{}}
    \fancyhead[CO,CE]{\leftmark}
\tableofcontents
\chapter{Chapter}
\chapter{Chapter}
\end{document}
1

I suggest you use the tocloft package.

\documentclass[twoside]{book}
%% set parameters of "fancy" page style
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhead{}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0pt}
\setlength{\headheight}{15pt}

%% tocloft package for easy customization of ToC
\usepackage{tocloft}
\renewcommand\contentsname{}
\tocloftpagestyle{fancy}
\setlength\cftbeforetoctitleskip{0pt}
\setlength\cftaftertoctitleskip{0pt}

\begin{document}
\frontmatter % optional
%% page header for ToC: set up via '\chead'
\chead{\footnotesize\textsc{Contents}}
\tableofcontents

\mainmatter % or: \cleardoublepage
%% page headers for rest of document: use \chaptermark and \fancyhead
\def\chaptermark#1{\markboth{\footnotesize\thechapter.\ \textsc{#1}}{}}
\fancyhead[CO,CE]{\leftmark}

\chapter{The First Chapter}
\chapter{The Second Chapter}
\end{document}
  • I had to adjust the values for \cftbeforetoctitleskip and \cftaftertoctitleskip but know it works, thank you – Martin Dec 29 '16 at 10:34
  • @Martin - Just out of curiosity (and for the potential benefit of future readers of this posting): Which values did you select for these two parameters? – Mico Dec 29 '16 at 10:40
  • I choose -30ptfor both. Then the toc starts approximately at the same height as on the subsequent pages – Martin Dec 29 '16 at 10:57

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.