# 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.

# 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?

-
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

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.

-
thank you. I like type A. :-) – xport Jan 21 '11 at 10:05