Consider for example the code


It allows me to obtain in my table of contents records with paragraph (section) sign before the number of subsection. But I want also to have a point after the number of subsection without modification of \thesubsection command.

Looking at second and third arguments for \@dottedtocline I think that first argument for \l@subsection is actually something that behaves like encapsulated pair of number of subsection and of title of subsection (because we can control the distance between these two elements of argument #1 by third argument of \@dottedtocline).

My question is what actually the first argument to \l@subsection is and if it is possible to get from this argument the number of subsection and its title as separated values?


2 Answers 2


In the LaTeX kernel, \@dottedtocline is implemented with the following syntax:

  • <level> is an integer number that controls if the entry is typeset; if <level> is greater than \c@tocdepth (the internal form of the tocdepth counter), then no line will be produced.

  • <indent> is the total indentation from the left margin.

  • <numwidth> is the width of box for number if the <title> has a \numberline command.

  • <title> is the actual contents of entry.

  • <page> is the page number.

The second argument for \l@subsection corresponds to the page; the first argument, to the number (if any) and the text.

To get the desires result, one easy possibility would be to use the tocloft package which offers appropriate hooks:




\section{Test Section}
\subsection{Test Subsection}


enter image description here

  • Thank you for the answer, then I think that I can use \patchcmd to make a point after \numberline{...}. But is it possible to obtain somehow such number within \numberline parameter from <title>? In other words, can I split <title> into number (under assumption that it always starts with \numberline) and the other text?
    – Appliqué
    Apr 23, 2013 at 13:52
  • @Nimza I would suggest you to use the tocloft package to make the change. Apr 23, 2013 at 13:54
  • @Nimza I added such an example to my answer. Apr 23, 2013 at 14:07
  • Great thanks for this answer! I like this tocloft! Do you know if tocloft is compatible with titlesec? I.e can I define my own titleclass (instead of section, subsection, e.t.c.) with titlesec and customise its toc entries with tocloft?
    – Appliqué
    Apr 23, 2013 at 14:42
  • 1
    @Nimza yes, it can be done; you define your new sectional units using titlesec and then you can use \newlistentry (from titletoc) to make titletoc aware of the new sectional units; this wll allow you to use the whole family of \cft... commands for the new units. The only precaution is not to duplicate the definition of counters (each call to \newlistentry creates an associated counter). Apr 23, 2013 at 15:30

To get the result you are asking for you can redefine \numberline locally in a group around the subsection line. You will also need to increase the space for the label. Doing it this way, you can also move the \S command into the \numberline command:

Sample output




\section{Test section}

\subsection{Test subsection}

\section{Another section}

\subsection{Another subsection}

This works since in the .toc we have

\contentsline {subsection}{\numberline {1.1}Test subsection}{1}

and \l@subsection will be applied to the second and third arguments, i.e.

#1 = \numberline {1.1}Test subsection
#2 = 1

the latter being the page number. You can see these arguments directly by adding \tracingmacros=1 to your document and examining the .log file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .