3

I have a chapter (??) which is intended to be printed on the inside back cover of a booklet I am producing. I want it listed in the table of contents, but with a pointer to 'insider back cover' in the ToC, not a page number. Is this possible? If so, how?

I have been trying code which looks like this:

\addtocontents{toc}{\contentsline{chapter}{\numberline{}{Mission of our organization}{inside back cover}}}

but keep getting compilation errors which read like so:

) [60] (./backmatter/01_mission.tex
! Argument of \contentsline has an extra }.
<inserted text> 
                \par 
l.4 ...our organization}{inside back cover}}}
                                                  
? q

Any guidance is appreciated. Thanks.

3
  • I just tried this: \setcounter{page}{inside back cover} but got this error message on compilation: ` [60] (./backmatter/01_mission.tex ! Missing number, treated as zero. <to be read again> i l.2 \setcounter{page}{inside back cover}`
    – Hugh Esco
    Dec 7 '21 at 5:42
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Dec 7 '21 at 5:45
  • If you are actually printing the last page, just use \def\thepage{} or possibly \def\thepage{Cover} anywhere on the last page. \pagestyle{empty} might help. Dec 7 '21 at 15:53
5

Two things:

  1. You need to \protect content that you don't want expanded, since writing to the .toc will do that.

  2. \contentsline takes four arguments.

enter image description here

\documentclass{book}

\begin{document}

\tableofcontents

\chapter{A chapter}

\addtocontents{toc}{%
  \protect\contentsline{chapter}{\protect\numberline{}Mission of our organisation}{inside back cover}{}}

\end{document}
4
  • Thank you Werner++. That did the trick. Its indented unlike the other entries, and is not linked to its content as are the other entries. But it gives me an entry pointed to the inside back cover! Thanks again!
    – Hugh Esco
    Dec 7 '21 at 6:24
  • So, what does \protect mean? And how do I know when I need to use it?
    – Hugh Esco
    Dec 7 '21 at 6:38
  • @HughEsco: \protect avoids expansion and is often used when dealing with moving arguments (like \captions, which print their contents to the LoF/LoT). See What is the difference between Fragile and Robust commands? When and why do we need \protect?
    – Werner
    Dec 7 '21 at 8:45
  • By pointer are you talking hyperref? Dec 7 '21 at 15:59

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.