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.

Background

The following screenshot shows "the left part of section title" and "the left part of subsection number" have different vertical alignment lines.

For 12pt option passed to \documentclass, I can make they have the same vertical alignment lines by using \setlength{\cftsecnumwidth}{26pt}.

For other font sizes, I need a manual trial and error adjustment.

alt text

Question

Is it possible to get an exact & automatic adjustment value to be passed to \setlength{\cftsecnumwidth}{} instead of using the magic number obtained by trial and error?

share|improve this question
    
Use 'em' instead of 'pt'. It roughly the width of an 'M' in the current font, which will automatically change as the font does. Also, 'ex' is available, which is roughly the height of an 'x' in the current font. –  user21324 Oct 24 '12 at 15:16

1 Answer 1

up vote 2 down vote accepted

From the \cftsecnumwidh command, I infer you are using the tocloft package. As shown in my minimal example, tocloft produces correct alignments ("Variant A"). One may also use the (alpha) package tocstyle (part of KOMA-Script) for automatic calculation of number widths ("Variant B"). If none of this works for you, please provide a minimal example.

\documentclass[12pt]{book}

% Variant A
\usepackage{tocloft}

% Variant B
% \usepackage{tocstyle}
% \usetocstyle{standard}

\usepackage{blindtext}

\begin{document}

\tableofcontents

\blinddocument

\end{document}

P.S.: Page 4 of the tocloft documentation lists the standard values for ToC indent and numwidth of the various heading levels.

share|improve this answer
    
thank you. I like type A. :-) –  xport Jan 21 '11 at 10:05

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.