TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm in a really bad situation with my ToC in the book that I write. Everything is fine until the 9th chapter. There's the "9", some space and then the name of the chapter. But on the 10th (or more) chapter, the "1" of the "10" is under the "9". So the "0" of the "10" is where there should be a space. As a result, there is no space between the number of the chapter and the name of the chapter.

I expected that LaTeX would deal with it as it does with the bibliography entries. It leaves some space empty on the start of one digit numbers so they will be all aligned at the end. (For example, when we have [9] and [10], the 0 is under the 9)

Let me show you my preamble as well

\usepackage[english, greek]{babel}
\usepackage[top=3.2cm, bottom=2.8cm, left=2.9cm, right=2.9cm,headsep=9mm]{geometry}

(Here there are some commands but they've got nothing to do with that)

\begin {document}

share|improve this question
Instead of including all the packages in your preamble, it's better when asking for help to construct the smallest complete document that shows the problem you are having. The one lockstep created in his answer is a good example of what a minimal example for your problem would look like. – Alan Munn May 12 '11 at 22:42

Use the tocloft package. Page 11 of its documentation describes how to set chapter resp. section numbers flushright.





% The following code line is added to make the example truly minimal





share|improve this answer
For some reason it's not working on me. There's an error saying Command \mylen already defined. But there's no other command like that in my preamble. It works when I change the name to \myleng. But the sections don't look so well now – Alex May 12 '11 at 22:04
@Alex: I updated my example. – lockstep May 12 '11 at 22:18
Wow it works very nice now. The only problem is the gap between 9.1 SectionName and the 10.1 SectionName. On the subsection the same. In the case of 9.1 the gap is normal but in the 10.1 is a bit too small but that's alright if you can't fix that. I'm happy as it is now, although I would be happier if you could fix it (pleaseeeeeeeeee...) – Alex May 12 '11 at 22:27
@Alex: I updated again -- please check. Also, I'm afraid that the width of the box containing the section number can only be set once, i.e. the gap must become smaller if the section number becomes wider (10.1.1 instead of 9.1.1). – lockstep May 12 '11 at 22:34
@Alex You could also take a look at the tocloft documentation, now that lockstep has got you started. You can increase the space of the section numbers by adding \setlength{\cftsecnumwidth}{2.5em} to your preamble, and adjust the width as needed. Since the numbers are being set flush left, the space between the longer section numbers and the shorter ones will always be slightly different. You could use the same technique as in lockstep's code to set them flush right, but I don't recommend it. – Alan Munn May 12 '11 at 22:41

Your Answer


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.