# How to (quick) redefine the space between section number and section title in ToC

Following this post, I could use titletoc (which is want I want to do) and completely redefine the format with

\titlecontents{<section>}[<left>]{<above>}
{<before with label>}{<before without label>}
{<filler and page>}[<after>]


as indicated in the titletoc documentation, and to place a \contentslabel{length} in the field <before with label>. ButIi'm absolutely happy with the style and I just want to modify the space. Is there a way to somehow use \contentslabel{length} without redefining the whole \titlecontents ?

-
An MWE can take you a long way :) –  recluze Jan 19 '12 at 11:30
Include a minimal working example and I will be able to solve your problem. But it depends on the documentclass you use and some other things –  yo' Jan 24 '12 at 10:52

The "\contentslabel" spacing specifications of ToC entries are governed by \@dottedtocline. And, even though titletoc allows for global modification of these, it doesn't allow an easy interface for modifying only certain parts of it. As such, here's a work-around: Modify \@dottedtocline directly.

• \section (level 1): Indent = 0pt; label width = 1.5em
• \subsection (level 2): Indent = 1.5em; label width = 2.3em
• \subsubsection (level 3): Indent = 3.8em; label width = 3.2em
• \paragraph (level 4): Indent = 7.0em; label width = 4.1em
• \subparagraph (level 5): Indent = 10.0em; label width = 5.0em
• \chapter (level 0): Indent = 0pt; label width = 1.5em
• \section (level 1): Indent = 1.5em; label width = 2.3em
• \subsection (level 2): Indent = 3.8em; label width = 3.2em
• \subsubsection (level 3): Indent = 7.0em; label width = 4.1em
• \paragraph (level 4): Indent = 10.0em; label width = 5.0em
• \subparagraph (level 5): Indent = 12.0em; label width = 6.0em

Note how the indent of level X is equivalent to the sum of label widths of levels (X-1), (X-2), ... (...except for levels 4 and 5). This allows horizontal alignment between levels in the ToC. So, if you wish to reduce the space of the contents label at the \section level in article to be only 1em, you can use

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\l@section}{1.5em}{1.0em}{}{}% Patch \section label width
\renewcommand*\l@subsection{\@dottedtocline{2}{1.0em}{2.3em}}% Correct \subsection indent
\renewcommand*\l@subsubsection{\@dottedtocline{3}{3.3em}{3.2em}}% Correct \subsubsection indent
\renewcommand*\l@paragraph{\@dottedtocline{4}{6.5em}{4.1em}}% Correct \paragraph indent
\renewcommand*\l@subparagraph{\@dottedtocline{5}{10.6em}{5em}}% Correct \subparagraph indent
\makeatletter


Again, note that the modification is required across all levels below \section to ensure that the ToC is properly aligned horizontally.

Finally, similar indentations and widths are included in the LoF and LoT, all at the section level (1) by default. For consistency, you might wish to change these as well, using a similar approach as above. The definitions of interest are

\newcommand*\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
\let\l@table\l@figure


in article, book and report.

Ps: The use of etoolbox to patch \l@section is easier that performing a redefinition, since the structure of \l@section differs from that of the lower-level \l@<section> commands.

-

Replace \tableofcontents by:

\begingroup
\let\orignumberline\numberline
\def\numberline#1{\orignumberline{#1}\kern-1ex}
\tableofcontents
\endgroup


You can adjust 1ex in \kern-1ex to any value.

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9367581009864807, "perplexity": 8392.009602561042}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2015-11/segments/1424936465487.60/warc/CC-MAIN-20150226074105-00244-ip-10-28-5-156.ec2.internal.warc.gz"}