Page Layoutmemoir | ToC with Chapter Numbers in Margin

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Bram
Posts: 20
Joined: Sat Jul 14, 2012 12:54 pm

memoir | ToC with Chapter Numbers in Margin

Post by Bram »

In the table of contents, I have made the chapter numbers right aligned (see the code below). This ensures that there is always the same amount of white between the chapter number and the chapter title. However, I would like to have the chapter numbers in the margin, such that the 'C' of 'Contents' aligns with the 'T' of 'This is a chapter'.

Any help would be very much appreciated!

Code: Select all

\documentclass{memoir}

% this sets the chapter number right aligned
\newlength{\tocspaceafterchapnum}
\setlength{\tocspaceafterchapnum}{0.5em}% extra space at end of number
\renewcommand*{\cftchapterpresnum}{\hfill}% note the double `l'
\renewcommand*{\cftchapteraftersnum}{\hspace*{\tocspaceafterchapnum}}
\addtolength{\cftchapternumwidth}{\tocspaceafterchapnum}

\begin{document}

\tableofcontents*

\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}
\chapter{This is a chapter}

\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

Post Reply