I'm referring to chapters and sections in a description list. I want the link to include the chapter or section part as well.

I found two options to achieve this: use \protect or use \texorpdfstring. Both appear to work and do the same thing.

Are there differences between these two, and should I prefer one over the other?



Both options work:

  \item [Section~\ref{sec:label}] foo 1

  % This fails, need braces for protected contents:
  %\item [\protect\hyperref[sec:label]{Section~\ref*{sec:label}}{}] foo 2

  \item [\protect{\hyperref[sec:label]{Section~\ref*{sec:label}}{}}] foo 2

  \item [\texorpdfstring{\hyperref[sec:label]{Section~\ref*{sec:label}}{}}{}] foo 3

\section{First Section is Here}

enter image description here

1 Answer 1


You need neither one, because the cause of the problem is the optional argument inside an optional argument:


Now, the optional argument of \item is formally closed, but the closing bracket belongs rather to \hyperref and therefore \hyperref will fail, because of the incomplete syntax.

Fix: Just add a pair of braces:

\item[{\hyperref[sec:label]{Section~\ref*{sec:label}}}] foo 2

Then, the TeX macro argument parser does not disrupt the argument group and the optional argument for \item becomes the full \hyperref[sec:label]{...}. The outmost argument braces are automatically removed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .