[Tex/LaTex] How to add hyperlinks to enumerate items

#enumeratebeamerhyperref

I want that each item on an enumerate list has a different hyperlink. Like this:

\documentclass{beamer}
\newcommand{\myitem}[2]{\item[\hyperlink{#2}{#1.\arabic{enumi}}]}

\begin{document}
   \begin{frame}
      \begin{enumerate}
         \myitem{1}{destination1} text 1
         \myitem{1}{destination2} text 2
      \end{enumerate}
   \end{frame}
\end{document}

the result should be:

1.1 text
1.2 text
...

However this does not wok and i get 1.0 for every number. How do I solve this?

Best Answer

I am not sure I understood well your problem but here is what I got:

  1. You want to get hyperlinks from the number of the items pointing to some given destination elsewhere in the presentation (set via \hypertarget{label}{text}).
  2. You want the numbers to be automatically displayed for the items.
  3. (I have added this feature but I don't know if you are interested in it) You want to get the numbers of the items to be X.Y where Y is the Yth item of the current list and X is the Xth list you have in your document.

This led me to this MWE

\documentclass{beamer}

\newcounter{totenum}
\setcounter{totenum}{0}
\let\Oldenumerate\enumerate
\def\enumerate{\refstepcounter{totenum}\Oldenumerate}
\newcommand{\myitem}[1]{\refstepcounter{enumi}\item[\hyperlink{#1}{\arabic{totenum}.\arabic{enumi}}]}

\begin{document}
   \begin{frame}
      \begin{enumerate}
         \myitem{destination1} text 1
         \myitem{destination2} text 2
      \end{enumerate}

      \begin{enumerate}
         \myitem{destination3} text 3
         \myitem{destination4} text 4
      \end{enumerate}
   \end{frame}

   \begin{frame}
      \hypertarget{destination1}{The first item is pointing here.}
    \end{frame}

\end{document}

For this output (only the first frame):

Output

Related Question