Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 ?

share|improve this question
3  
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 –  tohecz Jan 24 '12 at 10:52

2 Answers 2

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.

For article:

  • \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

For book and report:

  • \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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.