In short, I need to recode the table of contents, as I intend to include a short intro or summary as to what the chapter is about and all. Of course, if a package is already constructed for this purpose, that would be great too.

  \item \Nameref{<chapter-number>} \hfill \Pageref{<chapter-number>}
        This chapter is about blah.

However, I don't want to constantly keep labeling every chapter of the book to go back and update this over and over.

Is there any code for \Nameref and \Pageref commands above (which function similar to \nameref and \pageref but reference the chapter number directly)?

  • 2
    I think you want something like tex.stackexchange.com/a/10189/1952 – Ignasi Jun 1 '17 at 13:55
  • 1
    Depends on the class you use (you give no information), I'd simply add the intro directly into the toc from right after the appropriate \chapter cmd in your doc. For example, the memoir class has build in features to do this. If you're using another class, the memoir code can easily be copied. – daleif Jun 1 '17 at 14:38
  • @daleif I was using a book class, but I think something like that could be changed. First time I heard of memoir. – Mad Maniac Jun 1 '17 at 18:07
  • Look up \chaptertocprecis in the manual. It something presis. Memoir should be a drop in replacement for book, already contains the code from a lot of packages – daleif Jun 1 '17 at 18:14

A version with automatic label generation and a helpchapter associated counter. The \label is injected after \refstepcounter{chapter} and is prefixed with helpchapter:

The macro \DisplayEnumTocLine{Foo} uses enumi as counter and retracts the name and page reference as \nameref{helpchapter:\number\value{enumi}} etc. The content of the mandatory argument is displayed as description text.

The starred version of \DisplayEnumTocLine does not generate hyperlinks for the name and page references, the example shows usages of both versions.

(Note: The xassoccnt package is not really necessary here, but it simplifies the automatic stepping of helpchapter here).






    \nameref*{#2\number\value{enumi}} \hfill  \pageref*{#2\number\value{enumi}}% 
    \nameref{#2\number\value{enumi}} \hfill  \pageref{#2\number\value{enumi}}% 






\item \DisplayEnumTocLine{A foo chapter}
\item \DisplayEnumTocLine*{\blindtext} 

\chapter{Foo chapter}

\chapter{Other chapter}


enter image description here


You can add your additional information to the ToC:


    \leftskip 1.5em% same as \l@chapter uses
    \noindent #1\par
  \addvspace{.5\baselineskip}% add additional vertical space  


\chapter{First Chapter}
\addchapterinfo{This is additional text for the chapter entry}

\chapter{Second Chapter}
\section{First Section in Second Chapter}


ToC with additional chapter info and section

If you don't like the section entries in the ToC, use \setcounter{tocdepth}{0}. This will result in:

ToC with additional chapter info but without sections

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.