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

jfbu jfbu at free.fr
Sun Feb 9 15:25:04 CET 2014


----- Alessandro Ceschini <alescesc1986 at yahoo.it> a écrit :
> > 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
> 
> Dear Jean-François
> 
> Thank you so much for your very simple-minded approach! However, the dot 
> following the Roman numbers has disappeared, and I devised this to 
> restore it:
> 
> \def\mynumberline #1{#1.\ }
> 
> What do you think about it? Do you know of a more elegant or proper 
> workaround? Just curious.

Hi Alessandro, this is fine indeed to put a dot in 
the table of contents headings: 
if you *also* want the dot  in the chapter headings from the
document body, then it is more natural to modify the
\renewcommand{\thechapter}:


\renewcommand{\thechapter}{\Roman{chapter}.\ }

(I actually wanted a tilde rather than \ put my webmail interface
somehow swallows it)

if you do that, then you don't need \mynumberline

\addtocontents{toc}{\let\protect\numberline\relax}

will do.

> 
> Greetings
> 
> -- 
> /Alessandro Ceschini/

hope it helps
best regards,
Jean-Francois





More information about the texhax mailing list