summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/beamer/beamerug-interaction.tex
blob: 4469b82c285a4707b64bb4299c809d9b5e53bafd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
% !TeX root = beameruserguide.tex
% Copyright 2003--2007 by Till Tantau
% Copyright 2010 by Vedran Mileti\'c
% Copyright 2013,2015 by Vedran Mileti\'c, Joseph Wright
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Free Documentation License.
%
% See the file doc/licenses/LICENSE for more details.

\section{Structuring a Presentation: The Interactive Global Structure}
\label{section-nonlinear}

\subsection{Adding Hyperlinks and Buttons}

To create anticipated nonlinear jumps in your talk structure, you can add hyperlinks to your presentation. A hyperlink is a text (usually rendered as a button) that, when you click on it, jumps the presentation to some other slide. Creating such a button is a three-step process:
\begin{enumerate}
\item
  You specify a target using the command |\hypertarget| or (easier) the command |\label|. In some cases, see below, this step may be skipped.
\item
  You render the button using |\beamerbutton| or a similar command. This will \emph{render} the button, but clicking it will not yet have any effect.
\item
  You put the button inside a |\hyperlink| command. Now clicking it will jump to the target of the link.
\end{enumerate}

\begin{command}{\hypertarget\sarg{overlay specification}\marg{target name}\marg{text}}
  If the \meta{overlay specification} is present, the \meta{text} is the target for hyper jumps to \meta{target name} only on the specified slide. On all other slides, the text is shown normally. Note that you \emph{must} add an overlay specification to the |\hypertarget| command whenever you use it on frames that have multiple slides (otherwise |pdflatex| rightfully complains that you have defined the same target on different slides).

  \example
\begin{verbatim}
\begin{frame}
  \begin{itemize}
  \item<1-> First item.
  \item<2-> Second item.
  \item<3-> Third item.
  \end{itemize}

  \hyperlink{jumptosecond}{\beamergotobutton{Jump to second slide}}
  \hypertarget<2>{jumptosecond}{}
\end{frame}
\end{verbatim}

  \articlenote
  You must say |\usepackage[hyperref]{beamerarticle}| or |\usepackage{hyperref}| in your preamble to use this command in |article| mode.
\end{command}

The |\label| command creates a hypertarget as a side-effect and the |label=|\meta{name} option of the |\frame| command creates a label named \meta{name}|<|\meta{slide number}|>| for each slide of the frame as a side-effect. Thus the above example could be written more easily as:
\begin{verbatim}
\begin{frame}[label=threeitems]
  \begin{itemize}
  \item<1-> First item.
  \item<2-> Second item.
  \item<3-> Third item.
  \end{itemize}

  \hyperlink{threeitems<2>}{\beamergotobutton{Jump to second slide}}
\end{frame}
\end{verbatim}

The following commands can be used to specify in an abstract way what a button will be used for.

\begin{command}{\beamerbutton\marg{button text}}
  Draws a button with the given \meta{button text}.

  \example
  |\hyperlink{somewhere}{\beamerbutton{Go somewhere}}|

  \articlenote
  This command (and the following) just insert their argument in |article| mode.

  \begin{element}{button}\yes\yes\yes
    When the |\beamerbutton| command is called, this template is used to render the button. Inside the template you can use the command |\insertbuttontext| to insert the argument that was passed to |\beamerbutton|.
    \begin{templateoptions}
      \itemoption{default}{}
      Typesets the button with rounded corners. The fore- and background of the \beamer-color |button| are used and also the \beamer-font |button|. The border of the button gets the foreground of the \beamer-color |button border|.
    \end{templateoptions}
    The following inserts are useful for this element:
    \begin{itemize}
      \iteminsert{\insertbuttontext} inserts the text of the current button. Inside ``Goto-Buttons'' (see below) this text is prefixed by the insert |\insertgotosymbol| and similarly for skip and return buttons.

      \iteminsert{\insertgotosymbol} This text is inserted at the beginning of goto buttons. Redefine this command to change the symbol.
      \example
      |\renewcommand{\insertgotosymbol}{\somearrowcommand}|

      \iteminsert{\insertskipsymbol} This text is inserted at the beginning of skip buttons.

      \iteminsert{\insertreturnsymbol} This text is inserted at the beginning of return buttons.
    \end{itemize}
  \end{element}

  \begin{element}{button border}\no\yes\no
    The foreground of this color is used to render the border of buttons.
  \end{element}
\end{command}

\begin{command}{\beamergotobutton\marg{button text}}
  Draws a button with the given \meta{button text}. Before the text, a small symbol (usually a right-pointing arrow) is inserted that indicates that pressing this button will jump to another ``area'' of the presentation.

  \example
  |\hyperlink{detour}{\beamergotobutton{Go to detour}}|
\end{command}

\begin{command}{\beamerskipbutton\marg{button text}}
  The symbol drawn for this button is usually a double right arrow. Use this button if pressing it will skip over a well-defined part of your talk.

  \example
\begin{verbatim}
\begin{frame}
  \begin{theorem}
    ...
  \end{theorem}

  \begin{overprint}
  \onslide<1>
    \hfill\hyperlinkframestartnext{\beamerskipbutton{Skip proof}}
  \onslide<2>
    \begin{proof}
      ...
    \end{proof}
  \end{overprint}
\end{frame}
\end{verbatim}
\end{command}

\begin{command}{\beamerreturnbutton\marg{button text}}
  The symbol drawn for this button is usually a left-pointing arrow. Use this button if pressing it will return from a detour.

  \example
\begin{verbatim}
\begin{frame}<1>[label=mytheorem]
  \begin{theorem}
    ...
  \end{theorem}

  \begin{overprint}
  \onslide<1>
    \hfill\hyperlink{mytheorem<2>}{\beamergotobutton{Go to proof details}}
  \onslide<2>
    \begin{proof}
      ...
    \end{proof}
    \hfill\hyperlink{mytheorem<1>}{\beamerreturnbutton{Return}}
  \end{overprint}
\end{frame}
\appendix
\againframe<2>{mytheorem}
\end{verbatim}
\end{command}

To make a button ``clickable'' you must place it in a command like |\hyperlink|. The command |\hyperlink| is a standard command of the |hyperref| package. The \beamer\ class defines a whole bunch of other hyperlink commands that you can also use.

\begin{command}{\hyperlink\sarg{overlay specification}\marg{target name}\marg{link text}\sarg{overlay specification}}
  Only one \meta{overlay specification} may be given. The \meta{link text} is typeset in the usual way. If you click anywhere on this text, you will jump to the slide on which the |\hypertarget| command was used with the parameter \meta{target name}. If an \meta{overlay specification} is present, the hyperlink (including the \meta{link text}) is completely suppressed on the non-specified slides.
\end{command}

The following commands have a predefined target; otherwise they behave exactly like |\hyperlink|. In particular, they all also accept an overlay specification and they also accept it at the end, rather than at the beginning.

\begin{command}{\hyperlinkslideprev\sarg{overlay specification}\marg{link text}}
  Clicking the text jumps one slide back.
\end{command}

\begin{command}{\hyperlinkslidenext\sarg{overlay specification}\marg{link text}}
  Clicking the text jumps one slide forward.
\end{command}

\begin{command}{\hyperlinkframestart\sarg{overlay specification}\marg{link text}}
  Clicking the text jumps to the first slide of the current frame.
\end{command}

\begin{command}{\hyperlinkframeend\sarg{overlay specification}\marg{link text}}
  Clicking the text jumps to the last slide of the current frame.
\end{command}

\begin{command}{\hyperlinkframestartnext\sarg{overlay specification}\marg{link text}}
  Clicking the text jumps to the first slide of the next frame.
\end{command}

\begin{command}{\hyperlinkframeendprev\sarg{overlay specification}\marg{link text}}
  Clicking the text jumps to the last slide of the previous frame.
\end{command}

The previous four command exist also with ``|frame|'' replaced by ``|subsection|'' everywhere, and also again with  ``|frame|'' replaced by ``|section|''.

\begin{command}{\hyperlinkpresentationstart\sarg{overlay specification}\marg{link text}}
  Clicking the text jumps to the first slide of the presentation.
\end{command}

\begin{command}{\hyperlinkpresentationend\sarg{overlay specification}\marg{link text}}
  Clicking the text jumps to the last slide of the presentation. This \emph{excludes} the appendix.
\end{command}

\begin{command}{\hyperlinkappendixstart\sarg{overlay specification}\marg{link text}}
  Clicking the text jumps to the first slide of the appendix. If there is no appendix, this will jump to the last slide of the document.
\end{command}

\begin{command}{\hyperlinkappendixend\sarg{overlay specification}\marg{link text}}
  Clicking the text jumps to the last slide of the appendix.
\end{command}

\begin{command}{\hyperlinkdocumentstart\sarg{overlay specification}\marg{link text}}
  Clicking the text jumps to the first slide of the presentation.
\end{command}

\begin{command}{\hyperlinkdocumentend\sarg{overlay specification}\marg{link text}}
  Clicking the text jumps to the last slide of the presentation or, if an appendix is present, to the last slide of the appendix.
\end{command}


\subsection{Repeating a Frame at a Later Point}

Sometimes you may wish some slides of a frame to be shown in your main talk, but wish some ``supplementary'' slides of the frame to be shown only in the appendix. In this case, the |\againframe| command is useful.

\begin{command}{\againframe\sarg{overlay specification}\opt{|[<|\meta{default overlay specification}|>]|}\oarg{options}\marg{name}}
  \beamernote
  Resumes a frame that was previously created using |\frame| with the option |label=|\meta{name}. You must have used this option, just placing a label inside a frame ``by hand'' is not enough. You can use this command to ``continue'' a frame that has been interrupted by another frame. The effect of this command is to call the |\frame| command with the given \meta{overlay specification}, \meta{default overlay specification} (if present), and \meta{options} (if present) and with the original frame's contents.

  \example
\begin{verbatim}
\begin{frame}<1-2>[label=myframe]
  \begin{itemize}
  \item<alert@1> First subject.
  \item<alert@2> Second subject.
  \item<alert@3> Third subject.
  \end{itemize}
\end{frame}

\begin{frame}
  Some stuff explaining more on the second matter.
\end{frame}

\againframe<3>{myframe}
\end{verbatim}

  The effect of the above code is to create four slides. In the first two, the items 1 and~2 are highlighted. The third slide contains the text ``Some stuff explaining more on the second matter.'' The fourth slide is identical to the first two slides, except that the third point is now highlighted.

  \example
\begin{verbatim}
\begin{frame}<1>[label=Cantor]
  \frametitle{Main Theorem}

  \begin{Theorem}
    $\alpha < 2^\alpha$ for all ordinals~$\alpha$.
  \end{Theorem}

  \begin{overprint}
  \onslide<1>
    \hyperlink{Cantor<2>}{\beamergotobutton{Proof details}}

  \onslide<2->
    % this is only shown in the appendix, where this frame is resumed.
    \begin{proof}
      As shown by Cantor, ...
    \end{proof}

    \hfill\hyperlink{Cantor<1>}{\beamerreturnbutton{Return}}
  \end{overprint}
\end{frame}

...
\appendix

\againframe<2>{Cantor}
\end{verbatim}

  In this example, the proof details are deferred to a slide in the appendix. Hyperlinks are setup, so that one can jump to the proof and go back.

  \articlenote
  This command is ignored in |article| mode.

\end{command}


\subsection{Adding Anticipated Zooming}
\label{section-zooming}

Anticipated zooming is necessary when you have a very complicated graphic that you are not willing to simplify since, indeed, all the complex details merit an explanation. In this case, use the command |\framezoom|. It allows you to specify that clicking on a certain area of a frame should zoom out this area. You can then explain the details. Clicking on the zoomed out picture will take you back to the original one.

\begin{command}{\framezoom\ssarg{button overlay specification}\ssarg{zoomed overlay specification}\oarg{options}\\|(|\meta{upper left x}|,|\meta{upper left y}|)(|\meta{zoom area width}|,|\meta{zoom area depth}|)|}
  This command should be given somewhere at the beginning of a frame. When given, two different things will happen, depending on whether the \meta{button overlay specification} applies to the current slide of the frame or whether the \meta{zoomed overlay specification} applies. These overlay specifications should not overlap.

  If the \meta{button overlay specification} applies, a clickable area is created inside the frame. The size of this area is given by \meta{zoom area width} and \meta{zoom area depth}, which are two normal \TeX\ dimensions (like |1cm| or |20pt|). The upper left corner of this area is given by \meta{upper left x} and \meta{upper left y}, which are also \TeX\ dimensions. They are measures \emph{relative to the place where the first normal text of a frame would go}. Thus, the location |(0pt,0pt)| is at the beginning of the normal text (which excludes the headline and also the frame title).

  By default, the button is clickable, but it will not be indicated in any special way. You can draw a border around the button by using the following \meta{option}:
  \begin{itemize}
  \item
    \declare{|border|}\opt{|=|\meta{width in pixels}} will draw a border around the specified button area. The default width is 1 pixel. The color of this  button is the |linkbordercolor| of |hyperref|. \beamer\ sets this color to a 50\% gray by default.\newline    
    To change this, you can use the command |\hypersetup{linkbordercolor={|\meta{red}| |\meta{green}| |\meta{blue}|}}|, where \meta{red}, \meta{green}, and \meta{blue} are values between 0 and 1.
  \end{itemize}

  When you press the button created in this way, the viewer application will hyperjump to the first of the frames specified by the \meta{zoomed overlay specification}. For the slides to which this overlay specification applies, the following happens:

  The exact same area as the one specified before is ``zoomed out'' to fill the whole normal text area of the frame. Everything else, including the sidebars, the headlines and footlines, and even the frame title retain their normal size. The zooming is performed in such a way that the whole specified area is completely shown. The aspect ratio is kept correct and the zoomed area will possibly show more than just the specified area if the aspect ratio of this area and the aspect ratio of the available text area do not agree.

  Behind the whole text area (which contains the zoomed area) a big invisible ``Back'' button is put. Thus clicking anywhere on the text area will jump back to the original (unzoomed) picture.

  You can specify several zoom areas for a single frame. In this case, you should specify different \meta{zoomed overlay specification}, but you can specify the same \meta{button overlay specification}. You cannot nest zoomings in the sense that you cannot have a zoom button on a slide that is in some \meta{zoomed overlay specification}. However, you can have overlapping and even nested \meta{button overlay specification}. When clicking on an area that belongs to several buttons, the one given last will ``win'' (it should hence be the smallest one).

  If you do not wish to have the frame title shown on a zoomed slide, you can add an overlay specification to the |\frametitle| command that simply suppresses the title for the slide. Also, by using the |plain| option, you can have the zoomed slide fill the whole page.

  \example
  A simple case
\begin{verbatim}
\begin{frame}
  \frametitle{A Complicated Picture}

  \framezoom<1><2>(0cm,0cm)(2cm,1.5cm)
  \framezoom<1><3>(1cm,3cm)(2cm,1.5cm)
  \framezoom<1><4>(3cm,2cm)(3cm,2cm)

  \pgfimage[height=8cm]{complicatedimagefilename}
\end{frame}
\end{verbatim}

  \example
  A more complicate case in which the zoomed parts completely fill the frames.
\begin{verbatim}
\begin{frame}<1>[label=zooms]
  \frametitle<1>{A Complicated Picture}

  \framezoom<1><2>[border](0cm,0cm)(2cm,1.5cm)
  \framezoom<1><3>[border](1cm,3cm)(2cm,1.5cm)
  \framezoom<1><4>[border](3cm,2cm)(3cm,2cm)

  \pgfimage[height=8cm]{complicatedimagefilename}
\end{frame}
\againframe<2->[plain]{zooms}
\end{verbatim}
\end{command}