| 1 |
\documentclass[a4paper,twoside]{article} |
| 2 |
|
| 3 |
\usepackage[utf8]{inputenc} |
| 4 |
\usepackage{xspace} |
| 5 |
\usepackage{url} |
| 6 |
|
| 7 |
\usepackage[debug]{flipbook} |
| 8 |
|
| 9 |
% Where animations are put in the corners. |
| 10 |
\lhead[top left]{} |
| 11 |
\rhead[]{top right} |
| 12 |
\lfoot[bottom left\\ |
| 13 |
\fbInputF{./Images/Anims/anASCII/an}{tex}{0.3}]{} |
| 14 |
\rfoot[]{bottom right\\ |
| 15 |
\fbInputB{./Images/Anims/anASCII/an}{tex}{0.3} |
| 16 |
} |
| 17 |
|
| 18 |
% One can use a higher footer if it looks nicer. |
| 19 |
%\addtolength{\footskip}{1cm} |
| 20 |
|
| 21 |
|
| 22 |
\def\Flipbook{{\bf Flipbook}\xspace} |
| 23 |
\def\flipbook{{\bf flipbook}\xspace} |
| 24 |
|
| 25 |
\title{The \Flipbook Package\\ |
| 26 |
--- Documentation ---} |
| 27 |
\author{ |
| 28 |
Olivier Buffet\\ |
| 29 |
\url{[email protected]} |
| 30 |
} |
| 31 |
|
| 32 |
\begin{document} |
| 33 |
|
| 34 |
\maketitle |
| 35 |
|
| 36 |
\begin{abstract} |
| 37 |
How to add flip book animations in the corners of your \LaTeX{} |
| 38 |
documents. |
| 39 |
\end{abstract} |
| 40 |
|
| 41 |
\section{About Flip Book Animations} |
| 42 |
|
| 43 |
\subsection{Introduction} |
| 44 |
|
| 45 |
The \LaTeX{} \flipbook package is a small package intended to help you |
| 46 |
add flip book animations in the corners of your documents. A flip book |
| 47 |
(or ``flick book'') is a book in which each page represents one image |
| 48 |
of an animation, so that one obtains a smooth animation by quickly |
| 49 |
flipping the book's pages (usually by releasing the pages held with |
| 50 |
your thumb).\footnote{As anything you can think of is already |
| 51 |
somewhere on the internet, please go on youtube and check out a |
| 52 |
video on how to use a flipbook: \url{http://www.youtube.com/} .} |
| 53 |
|
| 54 |
The present package only serves to put such animations in corners of |
| 55 |
documents (in one of the four ``external'' corners of pages). This |
| 56 |
document for example has two flip book animations: one in the bottom |
| 57 |
right corner of odd pages, and one in the bottom left corner of even |
| 58 |
pages. |
| 59 |
|
| 60 |
Useful links: |
| 61 |
\begin{itemize} |
| 62 |
\item \url{http://www.flipbook.info/} |
| 63 |
\item \url{http://en.wikipedia.org/wiki/Flip_book} |
| 64 |
\end{itemize} |
| 65 |
|
| 66 |
\subsection{Ordering} |
| 67 |
|
| 68 |
An important observation is that, flip book animations from left and |
| 69 |
right corners go in opposite directions. In traditional flip books, |
| 70 |
full page animations are printed on right pages, and the animation |
| 71 |
starts on the first page. IMHO, for corner animations on standard |
| 72 |
A4/letter paper, it seems reasonable for the animations to go: |
| 73 |
\begin{itemize} |
| 74 |
\item from the end of the document to its beginning in (top/bottom) |
| 75 |
right corners, and |
| 76 |
\item from the beginning of the document to its end in (top/bottom) |
| 77 |
left corners. |
| 78 |
\end{itemize} |
| 79 |
The idea is that one uses its thumb to release new images (/pages) on |
| 80 |
top of previous images in the animation. |
| 81 |
|
| 82 |
Whatever your choice of ordering, a consequence of the fact that left |
| 83 |
and right pages are associated with opposite orderings is that each of |
| 84 |
this package's commands comes in two versions: one for left corners |
| 85 |
and one for right corners. The commands defined in this package are of |
| 86 |
the form \verb+\fbCOMMAND*+ where \verb+COMMAND+ is the command name |
| 87 |
and \verb+*+ has to be replaced by \verb+F+ or \verb+B+ to specify if |
| 88 |
you want to use an animation going Forward of Backward. |
| 89 |
|
| 90 |
|
| 91 |
\section{About this Document} |
| 92 |
|
| 93 |
Below are instructions to use the \flipbook package. The \LaTeX{} |
| 94 |
source of two documents serve as examples of how to use {\tt flipbook.sty} |
| 95 |
style file: |
| 96 |
\begin{itemize} |
| 97 |
\item {\tt flipbook-doc.tex}: this documentation, which contains a |
| 98 |
very basic ASCII art animation, and can thus be compiled with both |
| 99 |
\LaTeX{} of pdf\LaTeX{}, |
| 100 |
\item {\tt flipbook-ex.tex}: an example with animations based on PNG or |
| 101 |
PDF images, so that the compilation requires pdf\LaTeX{}. |
| 102 |
\end{itemize} |
| 103 |
|
| 104 |
This package requires the following packages: |
| 105 |
\begin{itemize} |
| 106 |
\item {\tt fancyhdr}, |
| 107 |
\item {\tt graphicx}, |
| 108 |
\item {\tt verbatim}, |
| 109 |
\item {\tt scalefnt}, |
| 110 |
\item {\tt everypage}, |
| 111 |
\item {\tt ifthen}. |
| 112 |
\end{itemize} |
| 113 |
One could easily make a lighter version without some of them (e.g., in |
| 114 |
case of incompatibilities with other packages). |
| 115 |
|
| 116 |
\section{Creating Your Own Flip Book Animations} |
| 117 |
|
| 118 |
\subsection{Initialization} |
| 119 |
|
| 120 |
Whatever the type of animation to use, using this package first |
| 121 |
requires going through the following two steps: |
| 122 |
\begin{enumerate} |
| 123 |
\item In most cases, your document will be printed on both sides |
| 124 |
(thanks to modern printers), requiring to distinguish left and right |
| 125 |
(even and odd) pages. |
| 126 |
|
| 127 |
You should thus make sure to specify the ``twoside'' option when |
| 128 |
specifying your documentclass. For example, the first line in the |
| 129 |
source code for this documentation is: |
| 130 |
\begin{verbatim} |
| 131 |
\documentclass[a4paper,twoside]{article} |
| 132 |
\end{verbatim} |
| 133 |
|
| 134 |
In case your document is to be printed on a single side, you can |
| 135 |
specify the ``oneside'' option for your documentclass instead, as |
| 136 |
in: |
| 137 |
\begin{verbatim} |
| 138 |
\documentclass[a4paper,oneside]{article} |
| 139 |
\end{verbatim} |
| 140 |
Note that, in this case, all pages are considered to be right pages. |
| 141 |
|
| 142 |
\item Then, to make use of the \flipbook package, add the following |
| 143 |
line in the preamble: |
| 144 |
\begin{verbatim} |
| 145 |
\usepackage{flipbook} |
| 146 |
\end{verbatim} |
| 147 |
\end{enumerate} |
| 148 |
|
| 149 |
\subsection{Using Standard Graphics} |
| 150 |
|
| 151 |
Here are the instructions to create your own flip book animations |
| 152 |
using standard graphics (either vector or bitmap images): |
| 153 |
\begin{enumerate} |
| 154 |
\item For each animation, put a {\bf numbered} sequence of |
| 155 |
eps/pdf/png/jpg images in a directory. |
| 156 |
\item Use the {\tt fancyhdr} commands (also in the preamble) to create |
| 157 |
your animations, for example (with two different approaches for |
| 158 |
placement):\footnote{See Section~\ref{sec:other} if you need to use |
| 159 |
other commands.} |
| 160 |
\begin{verbatim} |
| 161 |
\lfoot[~ \\ |
| 162 |
\fbImageF{./Images/Anims/an2/im}{pdf}{scale=0.18}]{} |
| 163 |
\rfoot[]{\thepage |
| 164 |
\setlength\unitlength{1cm} |
| 165 |
\begin{picture}(0,0) |
| 166 |
\put(2.5,-2.5){ |
| 167 |
\fbImageB{./Images/Anims/an3/im}{png}{scale=0.25} |
| 168 |
} |
| 169 |
\end{picture} |
| 170 |
} |
| 171 |
\end{verbatim} |
| 172 |
Please, be careful when placing your images: they should be as close |
| 173 |
to the corner as possible, but your printer should still print them |
| 174 |
properly (most printers leave a white border out). |
| 175 |
\item An important point is the use of the \verb+fbImage*+ command |
| 176 |
(where \verb+*+ is \verb+L+ or \verb+R+ depending whether one is |
| 177 |
working in the left or right corner). Assuming: |
| 178 |
\begin{itemize} |
| 179 |
\item that one set of images is in directory \verb+DIR+ with a name such as |
| 180 |
\verb+PREFIXnn.png+, |
| 181 |
\item and that you want all of them to be scaled by a factor of |
| 182 |
\verb+.2+ (other options of the \verb+includegraphics+ command |
| 183 |
are possible), |
| 184 |
\end{itemize} |
| 185 |
then you have to use the command: |
| 186 |
\\ |
| 187 |
\verb+\fbImage*{./DIR/PREFIX}{png}{scale=0.2}+ |
| 188 |
\end{enumerate} |
| 189 |
|
| 190 |
Note: The \verb+graphicx+ package is used to display pictures using |
| 191 |
the \verb+\includegraphics+ command. |
| 192 |
|
| 193 |
\subsection{Using ASCII Art} |
| 194 |
|
| 195 |
The previous section has shown how to use the \verb+fbImage*+ command |
| 196 |
to display images. Two other commands are provided to display text: |
| 197 |
\begin{itemize} |
| 198 |
\item \verb+fbInput*+: allows including a \verb+tex+ file; in the |
| 199 |
present document it is used in the bottom right corner as follows: |
| 200 |
\begin{verbatim} |
| 201 |
\fbInputB{./Images/Anims/anASCII/an}{tex}{0.3} |
| 202 |
\end{verbatim} |
| 203 |
the three arguments are (i) the directory and prefix of the ``image'' |
| 204 |
files, (ii) the suffix of the ``image'' files, and (iii) the scale; |
| 205 |
\item \verb+fbVerb*+: allows including a raw text file (in verbatim |
| 206 |
mode); in the present document it is used in the bottom left corner |
| 207 |
as follows, showing the source of \LaTeX{} files: |
| 208 |
\begin{verbatim} |
| 209 |
\fbVerbF{./Images/Anims/anASCII/an}{tex}{0.3} |
| 210 |
\end{verbatim} |
| 211 |
\end{itemize} |
| 212 |
|
| 213 |
\subsection{Debugging} |
| 214 |
|
| 215 |
If nothing appears, this may be because your images are placed outside |
| 216 |
the page (tune the coordinates of the \verb+\put+ command). |
| 217 |
|
| 218 |
Another common cause of missing pictures is that your images are not |
| 219 |
found (no error message is displayed because there would typically be |
| 220 |
too many of them). |
| 221 |
|
| 222 |
To facilitate tracking such mistakes, one can call the package with |
| 223 |
the ``debug'' option. It prints a warning message for each ``missing |
| 224 |
file'' (1) in the console, and (2) instead of the missing file (so, if |
| 225 |
no message is displayed, this may be that the coordinates are wrong). |
| 226 |
|
| 227 |
\section{Comments} |
| 228 |
|
| 229 |
\subsection{Other Means of Controlling Headers and Footers} |
| 230 |
\label{sec:other} |
| 231 |
|
| 232 |
With some document classes (e.g., \verb+book.cls+ or |
| 233 |
\verb+thloria.cls+), you may prefer using the \verb+\OddHead+, |
| 234 |
\verb+\EvenHead+, \verb+\OddFoot+, \verb+\EvenFoot+ commands. Here is |
| 235 |
an example validated with \verb+thloria.cls+: |
| 236 |
\begin{verbatim} |
| 237 |
%------------------------------------------------------------------- |
| 238 |
% flipbook |
| 239 |
%------------------------------------------------------------------- |
| 240 |
|
| 241 |
% display flipbook at the bottom right of each normal page |
| 242 |
\EvenHead{{\leftmark}{\thepage\hfil{\slshape\leftmark}}} |
| 243 |
\OddHead{{\leftmark\rightmark}{{\slshape\rightmark}\hfil\thepage}} |
| 244 |
\OddFoot{ |
| 245 |
\hfil |
| 246 |
\setlength\unitlength{1cm} |
| 247 |
\begin{picture}(0,0) |
| 248 |
\put(0.25,-1.75){ |
| 249 |
\fbImageB{../Images/Anims/an2/im}{pdf}{scale=0.25} |
| 250 |
} |
| 251 |
\end{picture} |
| 252 |
} |
| 253 |
\EvenFoot{} |
| 254 |
|
| 255 |
% display also on special pages (chapter titles, etc) |
| 256 |
\pagestyle{Fancy} |
| 257 |
\fancyhf{} |
| 258 |
|
| 259 |
\fancypagestyle{plain}{ |
| 260 |
\fancyhead{} |
| 261 |
\renewcommand{\headrulewidth}{0pt} |
| 262 |
\fancyfoot[RO]{ |
| 263 |
\setlength\unitlength{1cm} |
| 264 |
\begin{picture}(0,0) |
| 265 |
\put(0.25,-1.75){ |
| 266 |
\fbImageB{../Images/Anims/an2/im}{pdf}{scale=0.25} |
| 267 |
} |
| 268 |
\end{picture} |
| 269 |
} |
| 270 |
} |
| 271 |
\end{verbatim} |
| 272 |
|
| 273 |
\subsection{Warning: File Size} |
| 274 |
|
| 275 |
Do not forget that animations include many pictures and that each |
| 276 |
picture uses disk space. Be careful to prefer vector graphics, or |
| 277 |
possibly avoid high-quality bitmap pictures, if you want to keep your |
| 278 |
file size reasonable. |
| 279 |
|
| 280 |
\subsection{Going Further} |
| 281 |
|
| 282 |
This package provides simple commands to create flip books based on |
| 283 |
vector/bitmap images, or ASCII art. |
| 284 |
|
| 285 |
It should be easy to use various packages to generate animations using |
| 286 |
\LaTeX{}, e.g., using pstricks, tikz, or generating files thanks to |
| 287 |
external applications (using shell escape)... |
| 288 |
|
| 289 |
\subsection{TODO} |
| 290 |
|
| 291 |
Ideas for the future: |
| 292 |
\begin{itemize} |
| 293 |
\item Make it possible to define lists of animations (one per usable corner). |
| 294 |
\item Allow references to animations, as for floats |
| 295 |
(figure/table/algorithm/...), or at least to the interval of pages |
| 296 |
corresponding to a given animation. |
| 297 |
\end{itemize} |
| 298 |
|
| 299 |
\subsection{Your Creations} |
| 300 |
|
| 301 |
I'd be happy to know about your \LaTeX{} documents |
| 302 |
(reports/theses/books/...) including flip books. |
| 303 |
|
| 304 |
\subsection{Acknowledgments} |
| 305 |
|
| 306 |
Thanks to Christophe Thiéry, Cláudia Tavares, Arnaud Glad and Stephen |
| 307 |
Willshaw for their help and feedback. |
| 308 |
|
| 309 |
\newpage |
| 310 |
A |
| 311 |
\newpage |
| 312 |
A |
| 313 |
\newpage |
| 314 |
A |
| 315 |
\newpage |
| 316 |
A |
| 317 |
\newpage |
| 318 |
A |
| 319 |
|
| 320 |
\end{document} |
| 321 |
|
| 322 |
|
| 323 |
% Local IspellDict: american |
| 324 |
% (The above line tells ispell to run by default with an american dictionary.) |