Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using a reduced version of the navigation symbols bar that only includes \insertslidenavigationsymbol. My presentation only shows the frame numbers (instead of slide numbers) because I use many overlays and the number of slides grows too large. The problem is that if someone in the public ask me to go to a specific frame number (since this is the number they will see), then the navigation button doesn't take me to frame I want to go.

Is there a way to customize the \insertslidenavigationsymbol option so that it takes me to a frame number instead of a slide number?

In the following example you will see that if you go to slide 3 using the navigation symbol, it will take you to page 3 in frame 2 (this is the expected behavior, I guess). However, I want it to go to frame 3 instead. Any ideas? I tried with \insertframenavigationsymbol but that one only let me go to previous/next frame, not to a specific frame number.

\documentclass[compress]{beamer}

\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{navigation symbols}{\insertslidenavigationsymbol}

{
\defbeamertemplate{footline}{frame number and last}{%
  \usebeamercolor[fg]{page number in head/foot}%
  \usebeamerfont{page number in head/foot}%
   \hfill\insertframenumber\,/\,\inserttotalframenumber\kern1em\vskip2pt%
}

\setbeamertemplate{footline}[frame number and last]{}

\begin{document}
  \begin{frame}{This is frame 1}
    \onslide<1-2>{Some text\\}
    \onslide<2>{\invisible<1>{
    Some more text}}
  \end{frame}
   \begin{frame}{This is frame 2}
    This is frame 2
   \end{frame}
 \begin{frame}{This is frame 3}
    This is frame 3
 \end{frame}

\end{document}
share|improve this question
add comment

2 Answers 2

The following solution uses JavaScript to jump to the specified frame. First the starting page numbers of each frame are remembered (in macro \FrPg@List). At the end of the document these data are written as JavaScript object FrameList. Also a function GoToFrame is defined that first asks the user for the frame that he wants to visit. After some validation of the answer the page number is calculated and the frame is viewed by a destination name that beamer sets for each page (Navigation + page number). If the user uses a frame number less than the first frame, then the very first page is selected. If the frame number is too large, then the starting page of the last frame is used.

\documentclass[compress]{beamer}

\usepackage{atbegshi}
\usepackage{ltxcmds}
\usepackage{atveryend}

\makeatletter
\def\FrPg@List{}
\def\FrPg@Max{-2147483647}
\AtBeginShipout{%
  \ifnum\FrPg@Max<\value{framenumber}%
    \xdef\FrPg@Max{\the\value{framenumber}}%
  \fi
  \ltx@IfUndefined{FrPg@\number\value{framenumber}}{%
    \expandafter
    \xdef\csname FrPg@\number\value{framenumber}\endcsname{%
      \number\value{page}%
    }%
    \ifx\FrPg@List\ltx@empty
      \xdef\FrPg@List{%
        \number\value{framenumber}:\number\value{page}%
      }%
    \else
      \xdef\FrPg@List{%
        \FrPg@List
        ,\number\value{framenumber}:\number\value{page}%
      }%
    \fi
  }{}%
}
\def\FrPg@Script{FrameNavigation}
\AtVeryEndDocument{%
  \immediate\pdfobj{(%
    var FrameList={\FrPg@List};%
    var FrameMax=\FrPg@Max;%
    function GoToFrame(){%
      var frame=app.response({%
        % cQuestion:"Which frame?",%
        cTitle:"Go To  Frame",%
        cLabel:"Frame:"%
      });%
      if(frame==null)return;%
      var result=frame.match(/%
        ^%
        \ltx@backslashchar\ltx@backslashchar d+%
        $%
      /);%
      if(result==null){%
        app.alert("Invalid number!");%
        return;%
      }%
      var page=FrameList[frame];
      if(page==null&&frame>FrameMax)%
        page=FrameList[FrameMax];%
      if(page==null){%
        if(frame<1){%
          app.execMenuItem("FirstPage");%
          return;%
        }%
        app.alert("Frame `"+frame+"' not found!");%
        return;%
      }%
      this.gotoNamedDest("Navigation"+page);%
    }%
  )}%
  \immediate\pdfobj{%
    <<%
      /S/JS%
      /JS \the\pdflastobj\space 0 R%
    >>%
  }%
  \immediate\pdfobj{%
    <<%
      /Names[(\FrPg@Script)\the\pdflastobj\space0 R]%
    >>%
  }%
  \pdfnames{%
    /JavaScript \the\pdflastobj\space0 R%
  }%
}
\begin{Form}[]
\end{Form}
\def\insertslidenavigationsymbol{%
  \begin{pgfpicture}{0pt}{-1.5pt}{20pt}{5.5pt}
    \pgfuseobject{beamerslidenavstrong}%
    \usebeamercolor[fg]{navigation symbols dimmed}
    \pgfuseobject{beamerslidenavlight}%
  \end{pgfpicture}\kern-20pt%
  \hyperlinkslideprev{\beamer@linkspace{6pt}}%
  % \Acrobatmenu{GoToPage}{\beamer@linkspace{8pt}}%
  \PushButton[
    borderwidth=0,
    bordercolor=white,
    onclick=GoToFrame();
  ]{\beamer@linkspace{8pt}}%
  \hyperlinkslidenext{\beamer@linkspace{6pt}}%
}

\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{navigation symbols}{%
  \insertslidenavigationsymbol
}

\defbeamertemplate{footline}{frame number and last}{%
  \usebeamercolor[fg]{page number in head/foot}%
  \usebeamerfont{page number in head/foot}%
   \hfill\insertframenumber\,/\,\inserttotalframenumber\kern1em\vskip2pt%
}

\setbeamertemplate{footline}[frame number and last]{}

\begin{document}
\makeatletter
  \begin{frame}{This is frame 1}
    \onslide<1-2>{Some text\\}  
    \onslide<2>{\invisible<1>{  
    Some more text}}
  \end{frame}
   \begin{frame}{This is frame 2}
    This is frame 2
   \end{frame}
 \begin{frame}{This is frame 3}
    This is frame 3
 \end{frame}

\end{document}
share|improve this answer
    
Hi Heiko. I haven't been able yet to test your answer. It keeps giving me errors for the atveryend package. I downloaded it and put it in the Miktex installation but still haven't been able to make it work. –  Sandra C. Jul 30 '12 at 16:08
    
I tried you answer but it doesn't seem to work. I get the following error: ! Undefined control sequence. <argument> ... {framenumber}}\fi \ltx@IfUndefined {FrPg@\number \value {fram... l.119 \end{frame} Any ideas of what is going on? –  Sandra C. Aug 1 '12 at 3:45
add comment

You can insert \insertframenavigationsymbol instead of \insertslidenavigationsymbol in your navigation symbols template:

\documentclass[compress]{beamer}

\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{navigation symbols}{\insertframenavigationsymbol}

{
\defbeamertemplate{footline}{frame number and last}{%
  \usebeamercolor[fg]{page number in head/foot}%
  \usebeamerfont{page number in head/foot}%
   \hfill\insertframenumber\,/\,\inserttotalframenumber\kern1em\vskip2pt%
}

\setbeamertemplate{footline}[frame number and last]{}

\begin{document}
  \begin{frame}{This is frame 1}
    \onslide<1-2>{Some text\\}
    \onslide<2>{\invisible<1>{
    Some more text}}
  \end{frame}
   \begin{frame}{This is frame 2}
    This is frame 2
   \end{frame}
 \begin{frame}{This is frame 3}
    This is frame 3
 \end{frame}

\end{document}

If you want to keep the same (Acrobat) pop-up menu provided by slide navigation symbols, you can use the following code:

\documentclass[compress]{beamer}
\usepackage{tikz}

\useoutertheme[subsection=false]{miniframes}
\makeatletter
\def\insertmycustomframenavigationsymbol{%
  \begin{pgfpicture}{0pt}{-1.5pt}{20pt}{5.5pt}
    \pgfuseobject{beamerframenavstrong}%
    \usebeamercolor[fg]{navigation symbols dimmed}
    \pgfuseobject{beamerframenavlight}%
  \end{pgfpicture}\kern-20pt%
  %\hyperlinkframestartprev{\beamer@linkspace{6pt}}%
  \hyperlinkframeendprev{\beamer@linkspace{6pt}}%
  \Acrobatmenu{GoToPage}{\beamer@linkspace{8pt}}%
  \hyperlinkframestartnext{\beamer@linkspace{6pt}}%
}
\makeatother

\setbeamertemplate{navigation symbols}{\insertmycustomframenavigationsymbol}
{
\defbeamertemplate{footline}{frame number and last}{%
  \usebeamercolor[fg]{page number in head/foot}%
  \usebeamerfont{page number in head/foot}%
   \hfill\insertframenumber\,/\,\inserttotalframenumber\kern1em\vskip2pt%
}

\setbeamertemplate{footline}[frame number and last]{}

\begin{document}
  \begin{frame}{This is frame 1}
    \onslide<1-2>{Some text\\}
    \onslide<2>{\invisible<1>{
    Some more text}}
  \end{frame}
   \begin{frame}{This is frame 2}
    This is frame 2
   \end{frame}
 \begin{frame}{This is frame 3}
    This is frame 3
 \end{frame}
 \foreach \x in {4,...,10}{
   \begin{frame}{This is frame \x}
     This is frame \x
   \end{frame}
 }
\end{document}

Note: the correct back link should be \hyperlinkframestartprev but this macro is not defined by beamer...

share|improve this answer
    
I tried that initially as mentioned in the question. However, that only let me move to previous or next frame, but not to a specific frame number (I can't enter the frame number to which I want to go) –  Sandra C. Jul 27 '12 at 21:32
    
@SandraC. What kind of interface do you want? A list of numbers? A pop-up menu? A text field with a goto button? –  Paul Gaborit Jul 27 '12 at 21:36
    
It will be the last one. Exactly as the text field that appears when \insertslidenavigationsymbol is activated –  Sandra C. Jul 27 '12 at 21:41
    
Thanks @PolGab. It indeed activates the pop up menu exactly how I want it. The problem is that it keeps going to the page number instead of the frame number :-/ –  Sandra C. Jul 27 '12 at 22:38
    
@SandraC. I don't understand your problem... Here, with Adobe Reader 9 (Linux version) and with TeXLive 2012, the popup said "Go To Page -- Page: xx of 3 (4)". If xx is 3, Adobe Reader jumps to "page 3 (4 of 4)" and this page is frame 3. –  Paul Gaborit Jul 27 '12 at 23:03
show 6 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.