Page LayoutPage numbering in ToC , LoT, LoF and References

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
User avatar
Stefan Kottwitz
Site Admin
Posts: 10330
Joined: Mon Mar 10, 2008 9:44 pm

Page numbering in ToC , LoT, LoF and References

Post by Stefan Kottwitz »

I see you use titlesec. You could further use the companion titletoc, to format TOC entries.

Though, here's a quick redefinition without a package:

Code: Select all

\makeatletter
\renewcommand*\l@section[2]{%
  \ifnum \c@tocdepth >\z@
    \addpenalty\@secpenalty
    \addvspace{1.0em \@plus\p@}%
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode %\bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
    \endgroup
  \fi}
\makeatother
This is exact the original definition of the article class, just the \bfseries is commented out, so section entries won't be bold.

Stefan
LaTeX.org admin

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

maranatha
Posts: 13
Joined: Tue May 03, 2011 9:08 pm

Re: Page numbering in ToC , LoT, LoF and References

Post by maranatha »

Thank you Stefan
That was great solution.
Post Reply