[texhax] Re : Merging Chapter Number and Title with tocloft

jfbu jfbu at free.fr
Sun Feb 9 10:41:46 CET 2014


----- Alessandro Ceschini <alescesc1986 at yahoo.it> a écrit :
> Hello
> 
> I used tocloft in order to increase the space between chapter numbers 
> and chapter titles because I had to cope with Roman numbers in ToC, but 
> this workaround doesn't really satisfy me. Indeed, a space of 3em 
> necessary for five-digit numbers like XVIII is excessive for one or 
> two-digit numbers like I or II and consequently the overall look is very 
> crappy.
> 
> What I'd like to do is merging number and title, in other words I need 
> to do away with the fixed numwidth and to treat numbers as if they were 
> parts of the chapter titles. Someone knows how to do that?
> 
> Regards
> -- 
> /Alessandro Ceschini/


A simple minded approach:
\documentclass{book}
%\usepackage{hyperref}
\def\mynumberline #1{#1 }
\renewcommand\thechapter{\Roman{chapter}}

\begin{document}
\addtocontents{toc}{\let\protect\numberline\protect\mynumberline}
\tableofcontents

\chapter{One}

\chapter{Two}

\setcounter{chapter}{14}
\chapter{Fifteen}

\setcounter{chapter}{17}
\chapter{Eightteen}
\end{document}


Regards
Jean-Francois



More information about the texhax mailing list