0

I'm using xsavebox package for saving and using named boxes (I want the boxes to have names like X.1.3) and I want to make links to these boxes but they are not compatible with any kind of referencing. Any ideas?

\usepackage{xsavebox}
\usepackage{navigator}

\anchor{K.1.1}
\begin{xlrbox}{X.1.3}
    \anchor{X.1.3}
    \jumplink{K.1.1}{K.1.1}
\end{xlrbox}
...
\xusebox{X.1.3}

Using it gives an error:

pdfTeX error (ext4): link annotations cannot be inside an XForm.
1
  • as the error says: links can't be inside an xform. So no it won't work. May 10 at 20:13

1 Answer 1

0

I've got this answer from Alexander Grahn, so I'm sharing it here. Alexander's Gitlab

\documentclass{article}
\usepackage{hyperref}

\newcommand\namedsbox[2]{%
  \ifcsname#1\endcsname\else%
    \expandafter\newsavebox\csname#1\endcsname%
  \fi%
  \expandafter\sbox\csname#1\endcsname{#2}%
}
\newcommand\usenamedbox[1]{\expandafter\usebox\csname#1\endcsname}

\begin{document}
  \namedsbox{my named box}{\hyperlink{target}{Click!}}%
  \hypertarget{target}{Target.}
  \usenamedbox{my named box}
\end{document}
0

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.