I have a document which unfortunately has a section 10.13 and a subsection 10.13.1 and I'm sure there will be many other such examples.

Unfortunately, this makes for an extremely ugly table of contents, where the section and subsection numbers are too wide and collide with the section and subsection headings:

enter image description here

So, to fix it, I used the tocloft package (I was using it anyway) and went for:


This solves the problem with the the numbers that are too wide:

enter image description here

But it creates a problem with numbers that aren't this wide. Look at how silly chapter 2 now looks, the gap between the numbers and the headings is just too big and what's worse is that it's inconsistent with later gaps:

enter image description here

Is there no way to set a nice even space of, say, 0.5em between the number and the heading?



\setmainfont[ItalicFont={CharisSIL-I.ttf}, BoldFont={CharisSIL-B.ttf}, BoldItalicFont={CharisSIL-BI.ttf}]{CharisSIL-R.ttf}



\title{Notes on the Hindi Language}








\chapter{The Sounds of Hindi and the Devanagari Script}
\subsection{Other Character}


\section{Word Order and Possessives}
\section{Some Constructions with \textit{Kō}}
\section{\textit{Kō} with Oblique Arguments and Direct Objects}
\subsection{\textit{Kō} with Oblique Arguments}
\subsection{\textit{Kō} with Direct Objects}


1 Answer 1


You can put the commands to change the TOC format into the file that creates the TOC. That way, you can change the format part way through.

Move the \renewcommand*\cft… commands from the top of your file to here:




Note, the image below was run with the default fonts, because I don't have your font installed:

enter image description here

  • Nice approach! +1 It's a bit hacky, I'll definitely have to be careful when moving chapters around, and the width left for the numbers is still chosen by eye, but it's definitely a great solution to the immediate problem and if there's no better way then it definitely does the job
    – Au101
    Commented Aug 18, 2018 at 18:31
  • You could parcel up the \addtocontents commands into a macro in your document preamble, if you want to keep your main document "cleaner," of course. The problem with trying to redefine the TOC format on the fly would be that you want to look ahead - for example you don't know how much space section "10.1" needs till you can see whether there is a section "10.10" or not.
    – alephzero
    Commented Aug 18, 2018 at 18:36
  • Indeed yes, what might be nice is if a package let you have a ToC where there was a fixed space between the number and the heading, so the headings wouldn't all be aligned with each other, but would be a fixed distance from the number. Or, if that does turn out to be less pretty, if there were at least a way to make sure that the distance between 11 and Heading was the same as the distance between 1 and Heading and so on for 12 and 2 and so on, without me picking a number that looks about right :P
    – Au101
    Commented Aug 18, 2018 at 18:39
  • \show\enspace will show you the width of one digit in your font in your log file. (For the computer modern fonts that was 0.5em, but for other fonts it might be different). When you know that, you can get the numbers "exactly right" rather than "guessing".
    – alephzero
    Commented Aug 18, 2018 at 18:51
  • I tried \show\enspace and it gave me > \enspace=macro: ->\kern .5em . l.72 \show\enspace ? but I'm not precisely sure how to use this to get the numbers exactly right, would it be possible to be more specific? =)
    – Au101
    Commented Aug 18, 2018 at 20:02

You must log in to answer this question.

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