My school requires tables of contents formatted like this -- please note the little headings, in red: enter image description here

I have it almost ready, except for a pesky misalignment in the second page of the table of contents. "Chapter" gets thrown to the right.

Chapter thrown to right

As I prepare a minimal working example, it seems that a previous addtocontents line triggers the problem.





\addtocontents{toc}{\hfill Page \par}
%  Is this line above the culprit? if commented, Chapter below aligns!

\chapter{Blah blah1}
\section{Blah in section}
\subsection{More blah for a subsection}
\chapter{Some Blah}
\section{One section}
\section{Good enough}

\addtocontents{toc}{\protect\afterpage{Chapter\hfill Page \par\medskip}}
% This is how I add those 'headings' to the toc.
% Not well aligned!

\section{keep uno}
\section{kep dos}


This minimal code will produce this:

enter image description here

Is there a way to fix that addtocontents line? or a more sensible way to do it?

Please advise. Thank you in advance!

If it helps, these are some lines from the .toc file:

\contentsline {subsection}{OM as city block distance}{28}
\afterpage {Chapter\hfill Page \par \vspace \medskipamount }
\contentsline {subsection}{Euclideanity of OM and Euclidean transformations}{29}
\contentsline {subsubsection}{Raw and transformed OM as Euclidean}{29}
\contentsline {subsubsection}{Low dimensional Euclidean via MDS}{32}
\contentsline {section}{Distribution of sequences and inter-sequence distances}{34}
\contentsline {subsection}{Distribution of true inter-triple and OM distances}{34}

And this is how it looks like:

enter image description here

Aw, I just added a

\addtocontents{toc}{Chapter\hfill Page \par}
\section{Distribution of sequences and inter-sequence distances}

What a dirty thing.

1 Answer 1


You could try this approach which will certainly need some more modifications in case the ToC is more than two pages long. And perhaps there are some drawbacks which I don't see at the moment.

It uses the »atbegshi« package from the »oberdiek« bundle which allows to add the "headline" quite flexible to the next page of the ToC. If necessary, this can also be applied to the LoF an LoT.





enter image description hereenter image description here enter image description hereenter image description here

  • Hi Thorsten, for some reason it complains: (./approval.tex) [2] (./myscsuabstract.tex [3]) [4] (./myscsumain.toc) [5] (./myscsumain.lof ! Missing number, treated as zero. <to be read again> \hbox l.1 ...n }\let \advance \leftskip \@tempdima \hbox {}\penalty \@M \hskip -\l... Dec 9, 2013 at 23:07
  • It must be interacting with some other package. Dec 9, 2013 at 23:41
  • I'm sorry Thorsten, I just don't know enough to track down what the interference is that makes your good code not run in my real case. I just added a dirty solution, a direct write to the toc file at the right place Dec 10, 2013 at 7:22
  • @JuanZuluaga: A remote diagnosis is quite hard. So I suggest that you try to build a minimal example. Use the "build up" method, take my code as starting point and add code from your document step-by-step. Don't take too big steps, just small ones (e.g. one package or command definition after the other). Proceed this way until the problem occurs. Then you have the sample code that you can present here. Furthermore I suggest that you use the \contentsline command like I did to add the ToC entry. Dec 11, 2013 at 16:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .