diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/overlays')
-rw-r--r-- | Master/texmf-dist/tex/latex/overlays/overlays.sty | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/overlays/overlays.sty b/Master/texmf-dist/tex/latex/overlays/overlays.sty new file mode 100644 index 00000000000..8cf8df8a893 --- /dev/null +++ b/Master/texmf-dist/tex/latex/overlays/overlays.sty @@ -0,0 +1,131 @@ +\ProvidesPackage{overlays}[2016/09/30 v2.0 Incremental slides] + +% Copyright (C) 2016 Andreas Nolda + +% Author: Andreas Nolda <andreas@nolda.org> +% Version: 2.0 + +% This work may be distributed and/or modified under the conditions of the LaTeX +% Project Public License, either version 1.3 of this license or (at your option) +% any later version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt and version 1.3 or later is part of all +% distributions of LaTeX version 2005/12/01 or later. + +% The following code is inspired by Matthias Meister's "present" package. It +% uses an algorithm by Martin Scharrer for testing numbers in numerical ranges +% (http://tex.stackexchange.com/q/19000/). The code for processing overlays with +% verbatim content is taken from the "texpower" package, which in turn took it +% from Till Tantau's "beamer" package. + +\RequirePackage{color} +\RequirePackage{environ} +\RequirePackage{pgffor} + +\definecolor{background}{rgb}{1,1,1} +\definecolor{alert}{rgb}{1,0,0} + +\newcount\curoverl@y +\newcount\maxoverl@y +\newcount\overl@yspeca +\newcount\overl@yspecb +\newcount\saveequ@tion + +\def\@getoverl@yspecb-#1\relax% + {\ifx\relax#1\relax + \overl@yspecb=\maxoverl@y + \else + \overl@yspecb=#1\relax + \fi} + +\def\getoverl@yspecb% + {\@ifnextchar\relax + {\overl@yspecb=\overl@yspeca}% + {\@getoverl@yspecb}} + +\def\ifinoverl@yspec#1#2% + {\global\let\inoverl@yspec\@secondoftwo + \foreach \i in {#2} + {\afterassignment\getoverl@yspecb + \overl@yspeca=0\i\relax + \pgfmathtruncatemacro\result{(#1>=\overl@yspeca) && (#1<=\overl@yspecb)}% + \ifnum\result=1\relax + \breakforeach + \global\let\inoverl@yspec\@firstoftwo + \fi}% + \inoverl@yspec} + +\long\def\overl@y#1#2#3{\ifinoverl@yspec{\curoverl@y}{#1}{#2}{#3}} + +\NewEnviron{overlays}[1]% + {\maxoverl@y=#1% + \curoverl@y=0% + \saveequ@tion=\value{equation}% + \loop + \advance\curoverl@y by 1% + \begingroup + \BODY + \endgroup + \ifnum\curoverl@y<\maxoverl@y% + \vfill + \clearpage + \addtocounter{page}{-1}% + \setcounter{equation}{\saveequ@tion}% + \repeat} + +\newwrite\verb@timfileout + +\def\verb@timreadslide + {\begingroup% + \let\do\@makeother\dospecials% + \count@=127% + \@whilenum\count@<255 \do + {\advance\count@ by 1% + \catcode\count@=11} + \@makeother\^^L + \endlinechar`\^^M \catcode`\^^M=12 \processslidefirstline} + +{\catcode`\^^M=12\endlinechar=-1% + \long\gdef\processslidefirstline#1^^M% + {\def\overl@ystest{#1}% + \ifx\overl@ystest\stopslidefirst% + \let\next=\endfr@gileoverl@ys% + \else + \ifx\overl@ystest\@empty% + \else% + \@temptokena={#1}% + \immediate\write\verb@timfileout{\the\@temptokena}% + \fi% + \let\next=\processslideline% + \fi% + \next} + \long\gdef\processslideline#1^^M% + {\def\overl@ystest{#1}% + \ifx\overl@ystest\stopslide% + \let\next=\endfr@gileoverl@ys% + \else + \immediate\write\verb@timfileout{#1}% + \fi% + \next}} + +{\escapechar=-1\relax% + \xdef\stopslide{\string\\end\string\{fragileoverlays\string\}} + \xdef\stopslidefirst{\noexpand\end\string\{fragileoverlays\string\}}} + +\newenvironment{fragileoverlays}[1] + {\maxoverl@y=#1% + \def\verb@timfilen@me{\jobname.vrb}% + \immediate\openout\verb@timfileout=\verb@timfilen@me% + \verb@timreadslide} + {\immediate\closeout\verb@timfileout% + \begin{overlays}{\maxoverl@y} + \def\verbatim@nolig@list{\do\`\do\<\do\>\do\'} % do not make "," and "-" active + \input{\verb@timfilen@me}% + \end{overlays}} + +\def\endfr@gileoverl@ys{\endgroup\end{fragileoverlays}} + +\newcommand{\only}[2]{\overl@y{#1}{#2}{\relax}} + +\newcommand{\visible}[2]{\overl@y{#1}{#2}{{\color{background}#2\ifvmode\unskip\fi}}} + +\newcommand{\alert}[2]{\overl@y{#1}{{\color{alert}#2\ifvmode\unskip\fi}}{#2}} |