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

jfbu jfbu at free.fr
Sun Feb 9 15:28:36 CET 2014


----- jfbu <jfbu at free.fr> a écrit :
> 
> ----- 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
> 
> 

I forgot to say that this is all a bit drastic as it will
affect sections too etc... 

...I can't detail now, but the method needs to be made
a bit more sophisticated, it all depends on what you 
want to achieve, and also the document class you use.

best,
Jean-François




More information about the texhax mailing list