Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In my LaTeX document, I want to add some extra lines in the Table of Contents to show the general topic of the next section of chapters. The syntax I'm using right now, outlined in a quick example:

\tableofcontents
\chapter{Chapter A}
some text
\chapter{Chapter B}
some text
\renewcommand{\thepart}{} %Removes the counting in roman numerals before the part name
\addcontentsline{toc}{part}{And now for something completely different} %Adds it to the table of contents without it showing up in the document.
\chapter{Chapter C}
some text
\chapter{Chapter D}
some text

However, I want to remove the page number that appears besides the title of 'And now for something completely different' in the Table of Contents. Is there an (easy, preferably without creating your own packages) way to do so?

share|improve this question

1 Answer 1

up vote 11 down vote accepted

instead of \addcontentsline, use the more general \addtocontents which allows you to be specific about all parts of a contents line:

\addtocontents{toc}{%
  \protect\contentsline{part}{And now for something completely different}{}}

the final empty group {} takes the place of what is usually filled with the page number.

share|improve this answer
    
@karlkoeller -- oops! thanks for fixing. –  barbara beeton Jan 5 at 23:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.