I want to colorize (highlight) certain headings both in the document as well as in the table of contents. The following works fine for me, but the respective entries in the hyperref TOC (links shown in the side bar of the PDF viewer) start with the word blue now.
\documentclass{article}
\usepackage[
colorlinks,
pdfpagelabels,
bookmarksnumbered, linkcolor = black,
plainpages = false, hypertexnames = false, citecolor = black,
urlcolor = blue,
breaklinks]{hyperref}
\usepackage{color}
\newcommand{\SBlue}[1]{%
\begingroup\color{blue}{\textbf{#1}}\endgroup%
}
\begin{document}
\tableofcontents
\vspace{10em}
\section{Heading 1}
foo
\section{\SBlue{Heading 2}}
bar
\section{Heading 3}
foobar
\end{document}
Here's what appears in the sidebar:
Heading 1
blueHeading 2
Heading 3
Is there a way of modifying the hyperref link texts? Or a completely different approach?
--Vic
\sectiontemplate like in this answer: https://tex.stackexchange.com/questions/36609/formatting-section-titles – Timothy Truckle Dec 18 '17 at 07:51