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

This is the code I'm currently using the customize the section headers in my table of contents:


And the result looks like this: enter image description here

Question: How can I modify this such that all the section titles will be properly "left-aligned", even the ones starting with section 10? I want the section number to appropriately "move to the left", as required to make this happen. How do I accomplish this?

share|improve this question
up vote 6 down vote accepted

You can use a \parbox and \hfill to push \thecontentslabel to the right; something like:


The width of the \parbox can be set using a length in which you specify the widest label. A complete example in which I set the widest label to the width of 99.99.:








enter image description here

share|improve this answer
This works, expect for one problem: For some reasons, this solution causes the section number (e.g. "1.1") to move down a bit, and it makes "1.1." a bit below "section", compared to the baseline. Why would this be happening? – meh May 11 '12 at 14:00
\parbox[t]{...}{...} – daleif May 11 '12 at 14:13
@daleif thanks, that worked. – meh May 11 '12 at 15:12
@daleif: I incorporated your suggestion to my answer, thanks. – Gonzalo Medina May 11 '12 at 16:42

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.