TransWikia.com

Use section but hide the content in the file and keep it in the table of contents

TeX - LaTeX Asked by Steewz on November 29, 2020

In my document I insert a pdf page just after a section*{Annex}and I’m able to add it in the tableofcontents with this addcontentsline{toc}{part}{Annex} but I would like to hide it from the document and keep it in the Table of content.
Is that possible?

One Answer

It seems rather obvious, so I may misunderstand, but just omit the section* command, using only addcontentsline{toc}{section}{Annex} (note "section" rather than "part"). Use clearpage to ensure the toc entry points to the Annex page, rather than the page before it.

documentclass{article}
usepackage{pdfpages}
begin{document}
tableofcontents
section{First}
hello first section
clearpage
addcontentsline{toc}{section}{Annex}
includepdf[pages=1]{xyz.pdf}
end{document}

About pdfpages in the table of contents: you may want to use includegraphics instead of includepdf so the page number on the page matches the table of contents, unless the included pdf happens to have the same page number on it.

Answered by Donald Arseneau on November 29, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP