[Tex/LaTex] hyperlink with beamer using lyx

beamerlinkslyx

I am using LyX to build a beamer presentation that has hyperlinks. I create the hyperlink in the following manner:

\hyperlink{test}{\beamerbutton{mybutton}}

Then, there is a frame after the \appendix command in my file which (from LyX source has):

\lyxframe{Test Slide\label{test}}
hello lyx!    
\lyxframeend{}

However, the link seems to go to the slide after this one. What is going on here? However, using the \hypertarget command works fine:

\lyxframe{Test Slide}
\hypertarget{test}{}
hello lyx!    
\lyxframeend{}

Best Answer

To get proper hyperlinks you need to use \label{test} after \lyxframe{blurgh}.

Like this

\lyxframe{Test Slide}\label{test}
  hello lyx
\lyxframeend{}

If LaTeX encounters a \label, it sets a link to where the last counter-modification appeared. If you use \label within the command modifying the counter alls sorts of things may happen, but probably not what you expect.