I'm trying to use hyperref
on a very large number of section headings for pieces of artwork in a document, but I have to use a workaround to get the title of the artwork into a bookmark of the section:
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTWORK{gizapyramid,
title = {Pyramids at Gizeh},
year = {ca.\@ 2500 BCE}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\usepackage[hidelinks]{hyperref}
\begin{document}
\section{\texorpdfstring%
{\citetitle{gizapyramid} (\citedate{gizapyramid})}%
{Pyramids at Gizeh}}
\end{document}
Doing that properly displays "Pyramids at Gizeh" in the bookmark; however, since I occasionally find myself tweaking the title of various artworks to more accurately match common names, I would like to do something like this:
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTWORK{gizapyramid,
title = {Pyramids at Gizeh},
year = {ca.\@ 2500 BCE}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\usepackage[hidelinks]{hyperref}
\begin{document}
\section{\texorpdfstring%
{\citetitle{gizapyramid} (\citedate{gizapyramid})}%
{\citetitle{gizapyramid}}}
\end{document}
The problem with that is it throws the warning:
Package hyperref Warning: Token not allowed in a PDF string
(PDFDocEncoding): (hyperref) removing `\citetitle' on input line 20.
Then, it displays the tag "gizapyramid" in the bookmark instead of "Pyramids at Gizeh" as desired.
How can I make \citetitle
work in a hyperref
section bookmark like I want without ruining its normal behavior elsewhere in the document?
Best Answer
You can profit of my
usebib
package: