Page LayoutSpacing in a table of contents with many sections

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
mgmillani
Posts: 16
Joined: Fri Dec 20, 2013 7:26 pm

Spacing in a table of contents with many sections

Post by mgmillani »

Indeed, it is better just to add:

Code: Select all

\renewcommand*{\tocstyle@l@define}[2]{}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
to my .cls file than to change the tocstyle.sty. Since this command is the one causing the overwrites, changing it to nothing has the same effect as not calling it.

Thanks for the tip!

EDIT:
@Johannes_B
I didn't see your post before. Your method makes more sense. Unfortunately, I still need to redefine \tocstyle@dottedtocline}, as the dotted line must go until the page number, and I need the page number width for that.
Additionally, how would I customize \l@figure and \l@table with that? They appear to share the same features as the first depth of the TOC.
Last edited by mgmillani on Tue Dec 23, 2014 8:33 pm, edited 1 time in total.

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

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Spacing in a table of contents with many sections

Post by Johannes_B »

Please don't do that. Package tocstyle needs to redefine the commands in order to provide hooks that you as the user can use. This like getting a mechanic to do some fixes but not allowing him to use a hammer.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
mgmillani
Posts: 16
Joined: Fri Dec 20, 2013 7:26 pm

Spacing in a table of contents with many sections

Post by mgmillani »

mgmillani wrote: Additionally, how would I customize \l@figure and \l@table with that? They appear to share the same features as the first depth of the TOC.
Answering my own question: it is possible to use \settocfeature[toc][1]{entryhook}{\bfseries} instead of \settocstylefeature[1]{entryhook}{\bfseries} to change only the TOC. Using lot changes the list of tables and lof, the list of figures.
mgmillani wrote: Unfortunately, I still need to redefine \tocstyle@dottedtocline}, as the dotted line must go until the page number, and I need the page number width for that.
\settocstylefeature{pagenumberbox} is what I want for that.

I just defined the command:

Code: Select all

\newlength{\dottedspace}
\newcommand{\pnbox}[1]{\settowidth{\dottedspace}{\bfseries#1}\hb@xt@\dottedspace{#1}}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
and used it in:

Code: Select all

\settocstylefeature{pagenumberbox}{\pnbox}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
The code is much cleaner now:

Code: Select all

Code, edit and compile here:
\documentclass{report}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[tocindentauto,tocfullflat]{tocstyle}
\settocfeature[toc][0]{entryhook}{\bfseries}
\settocfeature[toc][1]{entryhook}{\bfseries}
\settocstylefeature{pagenumberbox}{\pnbox}
\settocfeature[lof][1]{entryhook}{\figurename~}
\makeatletter
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{3}
\newlength{\dottedspace}
\newcommand{\pnbox}[1]{\settowidth{\dottedspace}{\bfseries#1}\hb@xt@\dottedspace{#1}}
\renewcommand{\@dotsep}{0}
\makeatother
\begin{document}
\listoffigures
\tableofcontents
\chapter{C}
\section{S}
\subsection{SS}
\chapter{C}
\chapter{C}
\chapter{C}
\chapter{C}
\chapter{C}
\chapter{C}
\chapter{C}
\chapter{C}
\chapter{C}
\chapter{C}
\chapter{C}
\section{S}
\section{S}
\section{S}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Thanks for pointing this out!
Post Reply