summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/beamersubframe
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-08-06 23:28:43 +0000
committerKarl Berry <karl@freefriends.org>2011-08-06 23:28:43 +0000
commitf2cad1d5d0963bb818be07155fc4066ac00cb63f (patch)
treee654bd9c5182ac093f6c95f99fef409c23b8b775 /Master/texmf-dist/tex/latex/beamersubframe
parentaa662fce43964f8f2ac483394d3d500a604b491d (diff)
new latex package beamersubframe (1jul11)
git-svn-id: svn://tug.org/texlive/trunk@23433 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/beamersubframe')
-rw-r--r--Master/texmf-dist/tex/latex/beamersubframe/beamersubframe.sty158
1 files changed, 158 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/beamersubframe/beamersubframe.sty b/Master/texmf-dist/tex/latex/beamersubframe/beamersubframe.sty
new file mode 100644
index 00000000000..948fc981719
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/beamersubframe/beamersubframe.sty
@@ -0,0 +1,158 @@
+%%
+%% This program is provided under the terms of the
+%% LaTeX Project Public License distributed from CTAN
+%% archives in directory macros/latex/base/lppl.txt.
+%%
+%% Author: Mike Kaufmann
+%% m.km@gmx.de
+%%
+\def\fileversion{0.1}
+\def\filedate{2011/06/29}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{beamersubframe}[\filedate\space
+ v\fileversion\space reordering beamer frames]
+
+% check for beamer class
+\@ifclassloaded{beamer}{}{%
+ \PackageError{beamersubframe}{%
+ The package works only with the beamer class,\MessageBreak
+ therefore it is not loaded.
+ }{%
+ The package is not loaded, because it needs the\MessageBreak
+ beamer class. Continuing may lead to additional\MessageBreak
+ errors because of undefined commands.
+ }
+ \endinput
+}
+
+\newif\if@bsf@append
+\newif\if@bsf@firstline
+\newtoks\sub@frame@param
+\newwrite\sfr@out
+\newwrite\sfr@sub
+
+\DeclareOption{embed}{\@bsf@appendfalse}
+\DeclareOption{append}{\@bsf@appendtrue}
+
+\ExecuteOptions{embed}
+\ProcessOptions*\relax
+
+\RequirePackage{verbatim}
+
+\def\beamer@subnum{%
+ \the\c@part.\the\c@section.\the\c@subsection.\the\c@subsectionslide
+}
+
+\def\beamersubframepages#1#2#3#4#5#6{%
+ \expandafter\def\csname beamer@substartpage#1.#2.#3.#4\endcsname{#5}%
+ \expandafter\def\csname beamer@subendpage#1.#2.#3.#4\endcsname{#6}%
+}
+
+\def\beamer@writeslidentry@miniframes{%
+ \addtocontents{nav}%
+ {\protect\headcommand{%
+ \protect\slideentry{\the\c@section}{\the\c@subsection}{\the\c@subsectionslide}%
+ {\protect\@nameuse{beamer@substartpage\beamer@subnum}/%
+ \protect\@nameuse{beamer@subendpage\beamer@subnum}}{\lastsubsection}{\the\c@part}}}%
+}
+
+\def\beamer@writeslidentry@navbar{%
+ \expandafter\beamer@ifempty\expandafter{\beamer@framestartpage}{}% does not happen normally
+ {%else
+ \addtocontents{nav}%
+ {\protect\headcommand{%
+ \protect\beamer@framepages{\beamer@framestartpage}{\beamer@frameendpage}}}%
+ \immediate\write\sfr@sub{\string\beamersubframepages%
+ {\the\c@part}{\the\c@section}{\the\c@subsection}%
+ {\the\c@subsectionslide}{\beamer@framestartpage}{\beamer@frameendpage}}%
+ \clearpage\beamer@notesactions%
+ }
+}
+\let\beamer@writeslidentry@orig\beamer@writeslidentry
+
+\newcommand{\beamerrestore}[6]{%
+ \setcounter{part}{#1}%
+ \setcounter{section}{#2}%
+ \setcounter{subsection}{#3}%
+ \setcounter{subsectionslide}{#4}%
+ \def\insertsectionhead{#5}%
+ \def\insertsubsectionhead{#6}%
+}
+
+\if@bsf@append
+ \newenvironment{subframe}{%
+ \immediate\write\sfr@out{\string\beamerrestore{\the\c@part}{\the\c@section}%
+ {\the\c@subsection}{\the\c@subsectionslide}{\insertsectionhead}{\lastsubsection}}
+ \addtocounter{subsectionslide}{1}%
+ \@bsf@firstlinetrue
+ \let\do\@makeother\dospecials\catcode`\^^M\active
+ \def\verbatim@processline{%
+ \if@bsf@firstline
+ \immediate\write\sfr@out{\string\begin{frame}\the\verbatim@line}%
+ \@bsf@firstlinefalse
+ \else
+ \immediate\write\sfr@out{\the\verbatim@line}%
+ \fi
+ }%
+ \verbatim@}{\immediate\write\sfr@out{\string\end{frame}^^J}%
+ \beamer@writeslidentry@miniframes
+ }
+\else
+ % problem here: adding ``environment=subframe'' to the options
+ \def\sub@frame@#1\@@end{\begin{frame}#1}
+ \def\sub@@@frame#1#2#3\@@end{% processing for one optional argument
+ \def\@tempa{#2}\def\@tempb{<}%
+ \ifx\@tempa\@tempb\relax% test for default overlay spec
+ \sub@frame@param={#1[#2#3][environment=subframe]}%
+ \else
+ \sub@frame@param={#1[environment=subframe,#2#3]}%
+ \fi
+ }
+ \def\sub@@frame#1#2[#3]{%
+ \def\@tempa{#2}
+ \ifx\@tempa\@empty% this means: no default overlay spec and no options
+ \sub@frame@param={#1[environment=subframe]}%
+ \else
+ \def\@tempb{#3}
+ \ifx\@tempb\@empty% this means: one optional argument
+ \sub@@@frame{#1}#2\@@end
+ \else% both, default overlay spec and options present
+ \sub@frame@param={#1[#2][environment=subframe,#3]}%
+ \fi
+ \fi
+ \expandafter\sub@frame@\the\sub@frame@param\@@end
+ }
+ \def\sub@frame#1#2{%
+ \@ifnextchar[{\sub@@frame{#1}{#2}}{\sub@@frame{#1}{#2}[]}%
+ }
+ \newenvironment<>{subframe}[1][]{%
+ \sub@frame@param={}%
+ \sub@frame{#2}{#1}}{\end{frame}}
+\fi
+
+\newcommand{\appendsubframes}{%
+ \if@bsf@append
+ \let\beamer@writeslidentry\beamer@writeslidentry@navbar
+ \immediate\closeout\sfr@out
+ \input{\jobname.sfr}
+% \immediate\openout\sfr@out\jobname.sfr
+ \let\beamer@writeslidentry\beamer@writeslidentry@orig
+ \fi
+}
+
+\AtBeginDocument{%
+ \InputIfFileExists{\jobname.sfp}{}{}%
+ \if@bsf@append
+ \immediate\openout\sfr@out\jobname.sfr\relax
+ \immediate\openout\sfr@sub\jobname.sfp\relax
+ \fi
+}
+\AtEndDocument{%
+ \if@bsf@append
+% \immediate\closeout\sfr@out
+ \immediate\closeout\sfr@sub
+ \fi
+}
+
+% simple command for user macros
+\newcommand{\ifappend}[2]{\if@bsf@append #1\else #2\fi}