Delight readers of your LaTeX document or thesis with a flipbook effect when they rapidly flick through the printed pages or the PDF.
This sample animation next to the page numbers in my bachelor thesis on gravitational waves shows one passing through.
Make sure to check the example.tex
file for a sample implementation of how to use this package.
-
Download the
flipbook.sty
file, drop it into the same directory as your.tex
document and load theflipbook
package in your document preamble:\usepackage{flipbook}
-
Save the frames for your flipbook animation as files named
{prefix}{framenumber}.{extension}
. You can use any file format you like:-
Ideally, save the frames as
.pgf
files so that they are rendered natively in the document. No additional code on your part is necessary. -
Alternatively, save
.tex
files that each load an image or PDF with\includegraphics
, draw atikz
figure or anything else that LaTeX can do. These files you would usually generate with a script, such as in Python. -
If you have a list of files that LaTeX cannot
\input
, such as images, or if you wish to specify a different filename format, then\renewcommand
the\inputflipbookframe
macro in whichever way you need. For instance, for images this code could be\renewcommand{\inputflipbookframe}[3]{\includegraphics{#1#2.#3}}
where
#1
is the common prefix,#2
is the frame number and#3
is the filename extension. -
-
At the same position on every page, for instance in the header or footer as in
example.tex
, place calls to\flipbookframe
or\labeledflipbookframe
to render the animation frame for the page you call it on.-
Use
\flipbookframe
to only render the animation frame, e.g. like so:\flipbookframe{flipbook_frames/frame_}[pgf]
-
Use
\labeledflipbookframe
to render an additional label, such as the page number, next to the frame, e.g. like so:\labeledflipbookframe{flipbook_frames/frame_}[pgf]{c}{\thepage}{2em}%
-
-
\inputflipbookframe
: Renew this macro to load arbitrary file formats or file name conventions.Arguments:
#1
: Path to the frame file including common filename prefix, but excluding frame number#2
: Frame number#3
: Filename extension
-
\flipbookframe
: Render the animation frame for the current page.Arguments:
#1
(optional): The frame number offset from the first page number. A positive integer makes the first document page correspond to a later frame.#2
(optional): Frames per page. A number larger than 1 results in a speedup of the flipbook, where frames are skipped. A number smaller that one slows down the animation by displaying the same frame on multiple pages. Set this argument to 0.5 to keep the standard animation speed when printing a two-sided document.#3
: The path to the flipbook frame files, including the common filename prefix. The default implementation of \inputflipbookframe appends an underscore and the frame number, followed by a dot and argument#4
.#4
(optional): The filename ending. Default istex
.#5
(optional): Use to scale the frames. Default is1
.
-
\labeledflipbookframe
: Render the frame for the current page, and a corresponding label (e.g. the page number).Arguments:
#1
through#5
: Same as for\flipbookframe
.#6
: Label alignment.l
andr
align the label left and right of the flipbook frame, respectively.c
centers the label, and renders the flipbook on its left.#7
: The label text, e.g.\thepage
.#8
: Width of the label box, thereby determining its distance to the flipbook animation.
LaTeX Flipbook was created and is maintained by Nils Leif Fischer.
LaTeX Flipbook is released under the MIT license. See LICENSE.md for details.