In this thread, @diabonas taught me how to automate the process of passing an overlay number to \hypertarget in an itemize environment.
The construction was \hypertarget<.>{label4}{\beamerbutton{something}}
This works great, but only within an itemize or enumerate environment. When I try it outside of any environment, the <.> construction doesn't quite work. In the example below, when I click on the button in the second frame, it jumps back to the third line
instead of the fourth, and the button is not displayed. Could somebody advise how to fix this please?
\documentclass{beamer}
\begin{document}
\begin{frame}[<+->]
First \\
\pause
Second \\
\pause
Third \\
\pause
Fourth \hypertarget<.>{label4}{\beamerbutton{I'm on the fourth line}} \\
\pause
Fifth \\
\pause
Sixth \\
\end{frame}
\begin{frame}
\hyperlink{label4}{\beamerbutton{I jump to the fourth line of previous frame}}
\end{frame}
\end{document}
\beamer@minimum, as it works both inside and outside enumerate/itemize environments despite the different behaviour of thebeamerpausescounter as analysed by Mike in his nice answer. It might have a few gotchas if you use complicated nested constructs involving\onlyand\pause(although I haven't encountered such cases in my experiments), but that's probably asking for trouble anyway ;) – diabonas Sep 22 '17 at 13:17