3

I'm trying to get hyperlinks working for tcolorboxes. But when I click on the link in the pdf documents, I'm getting an error on console Failed to lookup label error. I tried both phantom and label with tcolorbox. None of them worked. The minimum working code is here.

\documentclass[12pt]{book}
\usepackage{tcolorbox}
\usepackage{hyperref}
\usepackage{lipsum}

\begin{document}

\begin{tcolorbox}[title=Lipsum, phantom={\phantomsection{\label{lipsum}}}]
\lipsum[1]
\end{tcolorbox}

\clearpage
\newpage

Lipsum is \hyperlink{lipsum}{here}
\end{document}
  • With TeXLive 2013 the MWE you provided works. – Claudio Fiandrino Aug 22 '13 at 6:40
  • I was using TeXLive 2013 and it was not working for me :( \hypertarget worked for me though :) – Surya Aug 22 '13 at 9:06
3

Use \phantomsection\hypertarget{lipsum}, since a \label does not have a direct relationship with \hyperlink. The latter expects a \hypertarget.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.