From 3e0e4d6412a2140852c0e771ccfe523e093a9913 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 6 Dec 2011 00:01:54 +0000 Subject: new latex package flipbook (5dec11) git-svn-id: svn://tug.org/texlive/trunk@24775 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/flipbook/flipbook.sty | 152 ++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/flipbook/flipbook.sty (limited to 'Master/texmf-dist/tex/latex/flipbook') diff --git a/Master/texmf-dist/tex/latex/flipbook/flipbook.sty b/Master/texmf-dist/tex/latex/flipbook/flipbook.sty new file mode 100644 index 00000000000..7e19621b1ee --- /dev/null +++ b/Master/texmf-dist/tex/latex/flipbook/flipbook.sty @@ -0,0 +1,152 @@ +% flipbook.sty --- style file for flip books +%% Copyright 2011 Olivier Buffet +% +% This material is subject to the LaTeX Project Public License. See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html for the details of that license. +% +% This program consists of the files flipbook.sty and documentation.tex (and some less important files). +% +% Report bugs and comments to: +% buffet-AT-AT-loria-DOT-DOT-fr +% +% $Id: flipbook.sty,v 0.1 2011/12/05 16:26:53 buffet Exp $ +% +% PACKAGES REQUIRED: +% +% - fancyhdr +% - graphicx +% - scalefnt +% - verbatim +% - everypage +% - ifthen + +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{flipbook}[2011/12/05 Standard LaTeX class] + +% The type of headings that allows for customization: +\RequirePackage{fancyhdr} +\RequirePackage{graphicx} +\RequirePackage{scalefnt} +\RequirePackage{verbatim} +\RequirePackage{everypage} +\RequirePackage{ifthen} +\pagestyle{fancyplain} + +\newcommand{\fbDebug}[1]{} +\DeclareOption{debug}{% + \renewcommand{\fbDebug}[1]{{\tiny #1} \@latex@warning{#1}} +} +\ProcessOptions + +\newcounter{fbpage} +\setcounter{fbpage}{0} +\AddEverypageHook{ + \addtocounter{fbpage}{1} +} + +% How to get the total number of pages. Inspired from the files +% lastpage.sty and beamerbasemisc.sty . + +\newcounter{numpages} + +\AtEndDocument{% + \clearpage \setcounter{numpages}{\thefbpage} + \if@filesw + \immediate\write\@auxout{\noexpand\setcounter{numpages}{\the\c@page}} + \fi +}% + +% The important command (but which can probably be improved): +% 3 parameters: +% - prefix of your images +% - suffix (extension) of your images +% - displaying options of your images +\makeatletter +\newcommand\fbImageF[3]{ % flip-book \includegraphics{...} forward + \@tempcnta 0 + \advance\@tempcnta+\thefbpage + \divide\@tempcnta2 + \IfFileExists{#1\number\@tempcnta .#2} + { + \includegraphics[#3]{#1\number\@tempcnta .#2} + }{ + \fbDebug{``#1\number\@tempcnta .#2'' NOT FOUND} + } +} +\newcommand\fbImageB[3]{ % flip-book \includegraphics{...} backward + \@tempcnta\value{numpages} + \advance\@tempcnta-\thefbpage + \divide\@tempcnta2 + \IfFileExists{#1\number\@tempcnta .#2} + { + \includegraphics[#3]{#1\number\@tempcnta .#2} + }{ + \fbDebug{``#1\number\@tempcnta .#2'' NOT FOUND} + } +} +\makeatother + +\makeatletter +\newcommand\fbInputF[3]{ % flip-book \input{...} forward + \@tempcnta 0 + \advance\@tempcnta+\thefbpage + \divide\@tempcnta2 + \IfFileExists{#1\number\@tempcnta .#2} + { + \scalefont{#3} + \input{#1\number\@tempcnta .#2} + }{ + \fbDebug{``#1\number\@tempcnta .#2'' NOT FOUND} + } +} +\newcommand\fbInputB[3]{ % flip-book \input{...} backward + \@tempcnta\value{numpages} + \advance\@tempcnta-\thefbpage + \divide\@tempcnta2 + \IfFileExists{#1\number\@tempcnta .#2} + { + \scalefont{#3} + \input{#1\number\@tempcnta .#2} + }{ + \fbDebug{``#1\number\@tempcnta .#2'' NOT FOUND} + } +} +\makeatother + +\makeatletter +\newcommand\fbVerbF[3]{ % flip-book \verbatiminput{...} forward + \@tempcnta 0 + \advance\@tempcnta+\thefbpage + \divide\@tempcnta2 + \IfFileExists{#1\number\@tempcnta .#2} + { + \scalefont{#3} + \verbatiminput{#1\number\@tempcnta .#2} + }{ + \fbDebug{``#1\number\@tempcnta .#2'' NOT FOUND} + } +} +\newcommand\fbVerbB[3]{ % flip-book \verbatiminput{...} backward + \@tempcnta\value{numpages} + \advance\@tempcnta-\thefbpage + \divide\@tempcnta2 + \IfFileExists{#1\number\@tempcnta .#2} + { + \scalefont{#3} + \verbatiminput{#1\number\@tempcnta .#2} + }{ + \fbDebug{``#1\number\@tempcnta .#2'' NOT FOUND} + } +} +\makeatother + +% Fancyhdr moves the center of pages. +% To compensate this I have found the following piece of code. +% But there must be a better solution. +\makeatletter +\@tempdima=\paperwidth +\advance\@tempdima by -\textwidth +\divide\@tempdima by 2 +\advance\@tempdima by -1in +\oddsidemargin=\@tempdima +\let\evensidemargin=\oddsidemargin +\makeatother -- cgit v1.2.3