how to prevent part of section name from being part of the hyperlink generated automaticaly in TOC?
sometimes I'd like part of the section name text (and subsection and anything that goes to TOC) to show up but without it being part of the link that is generated automatically by pdflatex and by htlatex.
This way I can annotate a section name in TOC, but not have the annotation by part of the href text itself.
A simple example will help. Given this .tex file, where I put the text that I do not want be part of the link inside \small{} just for illustration. (I know this is wrong way to make font small in \section but I do not know any better now).
\documentclass[12pt,titlepage]{article}%
\usepackage{hyperref}
\begin{document}
\tableofcontents
\section{HW1 {\small{this hw was on subject x}}}
jdkfjdkfjdf
\section{HW2 {\small{this hw was on subject y but is also related to subject x}}}
\end{document}
I'd like the TOC generated to look like this below which I drew this to show the part of the name I want to underlinked.
But ofcourse what comes out now is this:
and from pdflatex as
one can see that the whole text inside \section is underlined.
The commands used: htlatex foo.tex and pdflatex foo.tex
question: Is there a trick or option to tell latex/pdflatex not to include part of the section in the hyperref link when making TOC?
sometimes I'd like part of the section name text (and subsection and anything that goes to TOC) to show up but without it being part of the link that is generated automatically by pdflatex and by htlatex.
This way I can annotate a section name in TOC, but not have the annotation by part of the href text itself.
A simple example will help. Given this .tex file, where I put the text that I do not want be part of the link inside \small{} just for illustration. (I know this is wrong way to make font small in \section but I do not know any better now).
\documentclass[12pt,titlepage]{article}%
\usepackage{hyperref}
\begin{document}
\tableofcontents
\section{HW1 {\small{this hw was on subject x}}}
jdkfjdkfjdf
\section{HW2 {\small{this hw was on subject y but is also related to subject x}}}
\end{document}
I'd like the TOC generated to look like this below which I drew this to show the part of the name I want to underlinked.
But ofcourse what comes out now is this:
and from pdflatex as
one can see that the whole text inside \section is underlined.
The commands used: htlatex foo.tex and pdflatex foo.tex
question: Is there a trick or option to tell latex/pdflatex not to include part of the section in the hyperref link when making TOC?
No comments:
Post a Comment