summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/fancytooltips/examples/fancy-preview/fancy-preview-demo.tex
blob: 74489e6c98649e041373b4f5ad1081d4f188e342 (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
%\documentclass{article}
\documentclass[envcountsect,t,10pt]{beamer}

%\usetheme{Ilmenau}
%\usetheme{Marburg}
\usetheme{PaloAlto}

\setbeamertemplate{theorems}[numbered]
\usepackage{amsthm,amsmath,graphicx,color}

\usepackage{tikz}
\PassOptionsToPackage{naturalnames}{hyperref}

\usepackage[inactive]{fancytooltips}

\newtheorem{remark}{Remark}
\def\dx{{\mathrm d}x}
\definecolor{darkgreen}{rgb}{0,0.6,0}

\begin{document}

\FancyHook

\title{Fantytooltips demo}
\author{Robert Ma\v{r}\'ik}

\maketitle
\section{Introduction}

\begin{frame}{Content}
  \tableofcontents
\end{frame}
\begin{frame}
  \frametitle{What can you find in this file?}
  \begin{itemize}
  \item Demo (math fiction) which shows how the cooperation between
    preview and fancytooltips package can be used to insert popup
    previews for equations, theorems and definitions into a
    presentation -- see for example Figure \ref{pic:sine} (move the
    mouse to the blue mark).
  \item Explanation how we achieved this behaviour.
  \item Simple howto.
  \end{itemize}
\end{frame}

\section{Math text example}

\begin{frame}{Demo: Definitions}
  \begin{definition}[Excellent number]
    Let $n$ be positive integer. The number $n$ is said to be
    \textit{excellent}, if the last digit of the number $\alpha$
    defined by the relation
    \begin{equation}
      \label{eq:excel}
      \alpha = n^2 +\int_0^{2\pi}\sin x\dx
    \end{equation}
    equals $1$.\label{def:excellent-number}
  \end{definition}

  (Note that from \eqref{eq:excel} it follows that $\alpha$ is
  integer, see \ref{eq:sin}.)

\begin{definition}[Happy number]
  Let $n$ be positive integer. The number $n$ is said to be
  \textit{happy}, if the last digit of the number $n$ equals $1$.
  \label{def:happy-number}
\end{definition}
\end{frame}

\begin{frame}{Demo: Example and comments}
\begin{example}
  The number $1$ is both happy and excellent. The number $129$ is
  excellent but not happy. This follows immediately from the
  Definitions \ref{def:excellent-number} and \ref{def:happy-number}.
\end{example}
\begin{alertblock}{Fancytooltips comment}
  Put the mouse pointer to the graphical symbol following definitions
  numbers. You will see the definitions again. We can also refer to
  equation, like this: \eqref{eq:excel} (note that you see the whole
  enclosing definition, not only the equation). Note that the same
  reference has been used on previous slide and the tooltip has not
  been attached, since the reference to \eqref{eq:excel} on the
  previous page is at the same page as its target.
\end{alertblock}
\end{frame}


\begin{frame}{Demo: A picture}
  \begin{figure}
    \centering
\begin{tikzpicture}[domain=0:6.28]
    \draw[->] (0,0) -- (7,0) node[right] {$x$};
    \draw[->] (0,-1.2) -- (0,1.2) node[above] {$f(x)$};
    \shadedraw[color=black,top color=blue,bottom color=red] 
       plot[id=sin] function{sin(x)};
\end{tikzpicture}
    \caption{Sine curve}
    \label{pic:sine}
  \end{figure}

  On one of the previous slides (in Definition \ref{def:excellent-number}) 
  we defined \textit{excellent} number in terms of the number $\alpha$
  defined by relation \eqref{eq:excel}. Below we introduce a simple
  characterization in Theorem \ref{theorem}.
\end{frame}

\begin{frame}{Demo: Newton--Leibniz theorem}
  
  \begin{theorem}
    Let $f(x)$ be integrable in the sense of Riemann on $[a,b]$. Let
    $F(x)$ be a function continuous on $[a,b]$ which is an
    antiderivative of the function $f$ on the interval $(a,b)$. Then
    \begin{equation*}
      \int_a^bf(x)\dx=[F(x)]_a^b=F(b)-F(a)
    \end{equation*}
    holds.\label{th:NL}
  \end{theorem}
\end{frame}

\begin{frame}{Demo: Integral term equals zero}
  \begin{remark}
    It is easy to see that
    \begin{equation}
      \label{eq:sin}
      \int_0^{2\pi}\sin x\dx=0.
    \end{equation}
    Really, direct computation based on Newton-Leibniz Theorem
    \ref{th:NL} shows
    \begin{align*}
      \int_0^{2\pi}\sin x\dx&=[\cos x]_0^{2\pi}\\
      &=\cos(2\pi)-\cos 0\\
      &=0.
    \end{align*}
    (see also Figure \ref{pic:sine})
  \end{remark}
\end{frame}

\begin{frame}
  \frametitle{Demo:  Main result}
  \begin{theorem}[Characterization of excellent numbers]
    The positive integer $n$ is
    \tooltip{excellent}{def:excellent-number} if and only if the last
    digit of the number $n$ is either $1$ or $9$.
    \label{theorem}
  \end{theorem}

\begin{alertblock}{Fancytooltips comment}
  Since we used {\color{red}\texttt{\textbackslash
      label\{def:excellent-number\}}} in the Definition
  \ref{def:excellent-number}, we can insert a tooltip to the word
  excellent by using command{\color{red} \texttt{\textbackslash
      tooltip\{excellent\}\{def:excellent-number\}}}. In this case the
  tooltip is activated by hovering the text, not the soap. This is the
  default behavior of fancytooltips.
\end{alertblock}

\end{frame}

\begin{frame}
  \frametitle{Demo:  Corollary}
  \begin{theorem}[Relationship between happy and excellent numbers]
    Each \tooltip*{happy}{def:happy-number} number is
    \tooltip{excellent}{def:excellent-number}.
  \end{theorem}

\begin{alertblock}{Fancytooltips comment}
  The ``happy'' tooltip is created by
  \texttt{\color{red}\textbackslash
    tooltip*\{happy\}\{def:happy-number\}}. The starred version causes
  that the active button is not attached to the text, but is attached
  to the mark. The ``excellent'' tooltip is created by
  \texttt{\color{red}\textbackslash
    tooltip\{excellent\}\{def:excellent-number\}} and hence, the blue soap is
  inactive and the text active.
\end{alertblock}
\end{frame}

\section{How it works}
\begin{frame}
  \frametitle{How it works}
  \begin{itemize}
  \item We compile the presentation in an ordinary way to get correct
    labels and references.
  \item We compile the presentation with preview package and extract
    displayed equations, theorems, definitions and floats (tables and
    figures).
  \item We create a new document which contains those parts extracted
    in the previous step, which have a label inside.
  \item We compile the presentation again with redefined \texttt{ref}
    macro. This macro inserts the popup using fancytooltips package.
  \end{itemize}
\end{frame}

 \section{Short howto}
 \begin{frame}
   \frametitle{How to create a presentation with pdf\LaTeX}
   Creating tooltips is easy. Simply follow these steps.
   \begin{itemize}
   \item Create presentation with your favorit presentation package,
     such as
     \href{http://www.ctan.org/tex-archive/help/Catalogue/entries/acrotex-web.html}{\color{blue}web},
     \href{http://www.ctan.org/tex-archive/macros/latex/contrib/pdfscreen/}{\color{blue}pdfscreen}
     or
     \href{http://www.ctan.org/tex-archive/help/Catalogue/entries/beamer.html}{\color{blue}beamer}.
   \item Insert
     \begin{quote}\upshape\color{red}
       \texttt{\textbackslash usepackage[inactive]\{fancytooltips\}}
     \end{quote}
     before \texttt{\textbackslash begin\{document\}} and
     \begin{quote}\upshape\color{red}
       \texttt{\textbackslash FancyHook}
     \end{quote}
     after \texttt{\textbackslash begin\{document\}}.
   \item Use the script \texttt{fancy-preview} to compile the
     presentation again, i.e. if your file is filename.tex run
     \begin{quote}\upshape\color{darkgreen}
       \texttt{bash fancy-preview filename}
     \end{quote}
     either in Linux terminal or inside
     \href{http://www.mingw.org/wiki/MSYS}{\color{blue}MSYS} on
     Windows.
   \item You may want to customize the script \texttt{fancy-preview}
     (colors, options for fancytooltips, etc.)
   \end{itemize}
 \end{frame}

 \begin{frame}
   \frametitle{How to create a presentation with dvips}
   \begin{itemize}
   \item This work-flow should still work with dvips, but has been not 
     tested, since it
     requires Acrobat Professional which is not available on author's
     platform (\texttt{Linux}). Moreover, the compilation cannot be
     done automatically, due to the post-processing in Acrobat. You
     are encouraged to try it by yourselves. Report success of problems 
     to the authors email, please.
   \item Basically follow the instructions for pdf\LaTeX{} users.
   \item You have to customize the script \texttt{fancy-preview}
     \begin{itemize}
     \item Replace \texttt{pdflatex} by \texttt{latex}
     \item Add commands which convert \texttt{minimal.ps} into
       \texttt{minimal.pdf}
     \item Extract the number of pages of the file
       \texttt{minimal.pdf} and pass it as an argument to the
       fancytooltips package. (You may use \texttt{pdftk} or
       \texttt{pdflatex} for this task.)
     \end{itemize}
     \item Remember that you have post-process the resulting
       \texttt{ps} file as described in manual for fancytooltips
       package.
   \end{itemize}
 \end{frame}
 

\begin{frame}
  \frametitle{That's all. }
  Any problem? Send a \textit{minimal example} to the author of the
  package.
\end{frame}

\end{document}