TransWikia.com

Table of contents without page numbering for everything below section

TeX - LaTeX Asked by scientist man on June 29, 2021

My question:
How to make it so section and part page numbers stay on the table of contents, whereas subsections, etc. have no page numbering?

One Answer

Assuming you're employing a document class that is compatible with the tocloft package, the following solution may be of interest to you. (Just copy the lines from usepackage[titles]{tocloft} to renewcommandcftdot{} to the preamble of your LaTeX document.

enter image description here

documentclass{article}
setcounter{secnumdepth}{5}
setcounter{tocdepth}{5}

usepackage[titles]{tocloft}
makeatletter
renewcommandcftsubsecpagefont{@gobble}
renewcommandcftsubsubsecpagefont{@gobble}
renewcommandcftparapagefont{@gobble}
renewcommandcftsubparapagefont{@gobble}
makeatother
renewcommandcftdot{} % no dot leaders either
    
begin{document}
tableofcontents
part{AA}
section{BB}
subsection{CC}
subsubsection{DD}
paragraph{EE}
subparagraph{FF}
end{document}

Correct answer by Mico on June 29, 2021

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