I posted the question here: http://www.latex-community.org/forum/viewtopic.php?f=47&t=11499&sid=ff51ce4bc05d87957773d360d33ffa91 but nobody answered, so I'm posting my question here ;]
I am using miktex 2.9.
Compiling with pdflatex.
I want to increase the numwidth in TOC of part entry in article class to make titles of parts aligned to one line.
The minimal example:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{tocloft}
\setlength{\cftpartnumwidth}{4em}
\cftsetindents{part}{0em}{4em}
\begin{document}
\tableofcontents
\part{Part1}
\part{Part2}
\part{Part3}
\part{Part4}
\part{Part5}
\part{Part6}
\end{document}
Neither seems to work:
\setlength{\cftpartnumwidth}{4em}
\cftsetindents{part}{0em}{4em}
I can easily modify numwidth of sections subsections etc. Changes are reflected in TOC.
While reading tocloft documentation it is stated:
There is no explicit numwidth for a
part; instead a gap of 1em is put
between the number and the title text.
However while reading tocloft.sty I see no difference between definitions of \renewcommand*{\l@part}[2]
and \renewcommand*{\l@section}[2]
.
All modifications to tocloft.sty concerning partnumwidth fail to deliver.
Any ideas? I will be grateful for help!
Best Answer
The only thing that comes to mind is a kludge, bound to have unwanted effects, whereby you redefine the Part number display command
\thepart
to force it to a fixed width. (Of course this will also affect the actual Part titles and cross-references to them, etc.) For left-aligning:\renewcommand{\thepart}{\hbox to 4em{\Roman{part}}}
For right:
\renewcommand{\thepart}{\hbox to 4em{\hfil\Roman{part}}}
I'm surprised you're using part divisions in an article, however... Are you sure you don't want to use sections instead? This would give you more flexibility.