4

Is it possible to navigate to the last slide of the next frame?

There is a command \hyperlinkframestartnext to jump to the first slide on the next page. I need a command like \hyperlinkframeendnext.

The question was discussed in comp.text.tex. Unfortunately, the solution proposed there doesn't work:

\documentclass[12pt]{beamer}
\usepackage[utf8]{inputenc}

\makeatletter
\newcounter{@countingframe}%
\setcounter{@countingframe}{0}%
\def\beamer@framepages#1#2{%
  \ifnum\c@page<#1%
  \else%
    \ifnum\c@page>#2%
    \else%
      \gdef\beamer@startpageofframe{#1}%
      \gdef\beamer@endpageofframe{#2}%
    \fi%
  \fi%
  \stepcounter{@countingframe}%
  \expandafter\xdef\csname frame@\the@countingframe @end\endcsname{Navigation#2}}

% define \hyperlinkframeendnext, which will point to the final slide
% of the next frame (or the current frame if it's the last one in the
% presentation)
\def\hyperlinkframeendnext{%
  \@tempcnta=\c@framenumber%
  \ifnum\@tempcnta<\inserttotalframenumber%
    \advance\@tempcnta by 1%
  \fi%
  \expandafter\hyperlink\csname frame@\the\@tempcnta @end\endcsname}
\makeatother

\setbeamertemplate{navigation symbols}{\scriptsize\hyperlinkframeendprev{ $\vartriangleleft$ }\hyperlinkframestart{ $\vartriangle$ }\hyperlinkframeend{ $\triangledown$ }\hyperlinkframeendnext{ $\vartriangleright$ }}

\begin{document}

\begin{frame}
  1\pause 2\pause 3
\end{frame}

\begin{frame}
  A\pause B\pause C
\end{frame}

\end{document}
  • Hi! It would be a bit easier to solve the problem if you included a minimal example that shows the issue. Anyway, this is an interesting question! – yo' Sep 19 '15 at 19:27
  • I added a not working example, based on the suggestion in comp.text.tex – tom75 Sep 19 '15 at 19:30
  • Just to make sure I understand your problem correctly: when you click on the first slide, you want to jump to the "ABC" slide, while this example jumps to "123"? – samcarter_is_at_topanswers.xyz Sep 20 '15 at 10:09
  • Yes, when I click on the ">"-navigation-button, I want do jump to the "ABC" slide (which is the last slide on the second frame). – tom75 Sep 20 '15 at 13:33
3

You only need to correct one line:

\expandafter\hyperlink{\csname frame@\the\@tempcnta @end\endcsname}}

although I am more comfortable with

\def\hyperlinkframeendnext#1{\bgroup
  \@tempcnta=\c@framenumber%
  \ifnum\@tempcnta<\inserttotalframenumber%
    \advance\@tempcnta by 1%
  \fi%
  \hyperlink{\csname frame@\the\@tempcnta @end\endcsname}{#1}
\egroup}
  • Thank you! It works for a small test presentation but in my main presentation I get the error "TeX capacity exceeded, sorry [main memory size=3000000]. \end{frame}" – tom75 Sep 20 '15 at 17:57
  • That error message generally means an infinite loop, which may or be related. – John Kormylo Sep 20 '15 at 21:36
  • So do you think the code above is wrong? I did some additional tests. I deleted all files like .nav, .aux, etc. and recompiled. Then I get a lot of error messages "undefined control sequence \end{frame}" and "Empty destination name,(hyperref) using `UNDEFINED'". Then I recompiled again without deleting the aux files. That leads to the error message "TeX capacity exceeded". – tom75 Sep 21 '15 at 13:49
  • Without the main presentation I can't really test, but I now think maybe \@tempcnta might be the problem. – John Kormylo Sep 21 '15 at 15:50
  • I understand that! Unfortunately, I'm not allowed to publish or send the presentation. – tom75 Sep 22 '15 at 18:11

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.