OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

virtio message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [PATCH 2/2] virtio: LaTeX: Do not include leading numbers in the TOC link


On Tue, Nov 19, 2013 at 12:06:24PM +0000, Pawel Moll wrote:
> ... making them black on the way.
> 
> Warning! This is a hack and it depends on the hyperref
> package version.
> 
> Signed-off-by: Pawel Moll <pawel.moll@arm.com>
> ---

I applied this, but one minor nit: Appendix
numbers in TOC are now A B C and not Appendix A etc

> I must say this one almost defeated me :-)
> 
> It's very simple to add the page number (on the right) to the link
> (it's just a hyperref option as I mentioned) and I expected to the
> same for the section/chapter numbers (on the left). As it turned
> out it's not something the TOC inventors considered and the level
> when the TOC is being assembled, the leading number is integral
> part of the section name... Thus the "clever" trick (partially
> stolen from people much more clever than me ;-) of patching the
> hyperref package with custom version of the contentsline macro,
> taking advantage of the way macros are defined in TeX to split
> the line into two parts...
> 
> Note that although it depends on the hyperref package version,
> it should have no negative side effects if they don't match.
> The leading number will simply stay a part of the link then.
> Not something I want to loose more time on ;-)
> 
>  virtio-v1.0-csd01.tex | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/virtio-v1.0-csd01.tex b/virtio-v1.0-csd01.tex
> index 96f2b41..b5f8ac4 100644
> --- a/virtio-v1.0-csd01.tex
> +++ b/virtio-v1.0-csd01.tex
> @@ -36,6 +36,7 @@
>  \usepackage{tocloft}
>  \renewcommand{\cftdot}{\normalfont.}
>  \renewcommand{\cftchapdotsep}{4.5}
> +\usepackage{etoolbox}
>  \setmainfont[Mapping=tex-text]{Arial}
>  \setromanfont{Arial}
>  \setmonofont{Courier New}
> @@ -72,5 +73,11 @@
>  \titleformat{\paragraph}[hang]{\color{oasis1}\normalfont\normalsize\bfseries}{\color{oasis1}\theparagraph}{1em}{#1}
>  \titleformat{\subparagraph}[hang]{\color{oasis1}\normalfont\normalsize\bfseries}{\color{oasis1}\thesubparagraph}{1em}{#1}
>  
> +% hyperref toc hack - do not include the chapter/section number in the link
> +\makeatletter
> +\def\process@contentsline#1#2{#1{#2}\hyper@linkstart{link}{\Hy@tocdestname}}
> +\patchcmd{\contentsline}{\hyper@linkstart{link}{\Hy@tocdestname}{#2}}{\process@contentsline#2}{}{}
> +\makeatother
> +
>  % main document
>  \input{main.tex}
> -- 
> 1.8.3.2
> 


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]