How can I add a chapter entry to TOC without showing the correspondent page number?
my documentclass is report and I am generating my TOC like this:
\phantomsection
\pdfbookmark{\Contents}{contents}
\tableofcontents
Thank you.
How can I add a chapter entry to TOC without showing the correspondent page number?
my documentclass is report and I am generating my TOC like this:
\phantomsection
\pdfbookmark{\Contents}{contents}
\tableofcontents
Thank you.
You could load the tocloft package and issue the command \cftpagenumbersoff{chapter}. This will suppress the showing of the page numbers of chapter-type entries globally.
To make this change apply to only a single instance of a chapter, you might type
\addtocontents{toc}{\cftpagenumbersoff{chapter}}
\chapter{XYZ}
...
\addtocontents{toc}{\cftpagenumberson{chapter}} % to restore the showing of page numbers
You can add text to the table of contents using the command \addtocontents. Internally, LaTeX uses a couple of commands to create these entries. So for example to add a line, matching the rest of the contents style for chapters write
\addtocontents{toc}{\protect\contentsline{chapter}{\protect\numberline{}Title of this chapter}{}}
note you need to protect commands that should not be expanded.
Here I assuming you do not wish to have the chapter number displayed, as per your question on bibliographies. If you do wish to have a chapter number, it is inserted as the first argument to \numberline (one can conviently use \thechapter for that).
If you use hyperref too, then \contentsline takes an extra argument, so either write
\addtocontents{toc}{\protect\contentsline{chapter}{\protect\numberline{}Title of this chapter}{}{}}
or
\addtocontents{toc}{\protect\contentsline{chapter}{\protect\numberline{\thechapter}Title of this chapter}{}{chapter.\thechapter}}
for unnumbered/numbered versions.
! Argument of \contentsline has an extra }.for me. – Zelphir Kaltstahl Jul 05 '17 at 11:26book. – Andrew Swann Jul 05 '17 at 19:14bookandhyperref. I now use:\cftaddtitleline{toc}{chapter}{<name>}{}instead. Not quite sure what was wrong before. – Zelphir Kaltstahl Jul 05 '17 at 20:19book+hyperrefdefines no such command; I have now added code for this situation. You must be loading some other package. – Andrew Swann Jul 06 '17 at 08:14tocloftthis way.) – Zelphir Kaltstahl Jul 06 '17 at 08:18