diff options
author | Karl Berry <karl@freefriends.org> | 2011-09-22 23:00:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-09-22 23:00:27 +0000 |
commit | 82f4934ee35dff8809425db64e550528f85c44d3 (patch) | |
tree | 72ab420d2763a90fed990113e3bee1005741293c /Master/texmf-dist/tex | |
parent | b2c969266253a567831b99c3f564264d9e12c1d3 (diff) |
new latex package storebox (22sep11)
git-svn-id: svn://tug.org/texlive/trunk@24068 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/storebox/storebox.sty | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/storebox/storebox.sty b/Master/texmf-dist/tex/latex/storebox/storebox.sty new file mode 100644 index 00000000000..4666417a38b --- /dev/null +++ b/Master/texmf-dist/tex/latex/storebox/storebox.sty @@ -0,0 +1,99 @@ +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de> +%% --------------------------------------------------------------------------- +%% 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. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files storebox.dtx and storebox.ins +%% and the derived filebase storebox.sty. +%% +\ProvidesPackage{storebox}[% + 2011/09/22 + v1.0 + Store and reuse boxes in a file size efficient way] +\DeclareOption{disable}{\let\ifstorebox\iffalse} +\DeclareOption{enable}{\let\ifstorebox\iftrue} +\ProcessOptions* +\edef\@tempa{\@ptionlist{\@currname.\@currext}} +\ifx\@tempa\empty + \RequirePackage{ifpdf} + \expandafter\let\csname ifstorebox\expandafter\endcsname\csname ifpdf\endcsname +\fi +\RequirePackage{collectbox}[2011/08/04] +\newcommand*\storebox{% + \collectboxcheckenv{storebox}% + \ifcollectboxenv + \endgroup + \expandafter\@storebox@env + \else + \expandafter\@storebox + \fi +} +\ifstorebox +\def\@storebox#1{% + \begingroup + \@collectboxto\collectedbox{\pdfxform\collectedbox\endgroup\mathchardef#1=\pdflastxform}% +} +\def\@storebox@env#1{% + \edef\@tempa{% + \setbox\collectedbox\hbox\bgroup% + \def\noexpand\@tempa{\noexpand#1}% + }% + \@tempa + \begingroup + \aftergroup\@storebox@env@end + \@endpefalse + \color@setgroup + \begingroup + \def\@currenvir{storebox\empty}% + \ignorespaces +} +\def\@storebox@env@end{% + \edef\@tempa{% + \egroup + \pdfxform\collectedbox + \endgroup + \mathchardef\expandafter\noexpand\@tempa=\pdflastxform + }% + \@tempa +} +\def\endstorebox{% + \unskip + \endgroup + \color@endgroup +} +\newcommand*\newstorebox[1]{% + \@ifdefinable{#1}{\let#1\relax}% +} +\newcommand*\usestorebox[1]{% + \mbox{\pdfrefxform#1}% +} +\else +\def\@storebox#1{\@collectboxto{#1}{}} +\def\@storebox@env{% + \edef\@currenvir{\@currenvir\noexpand\noexpand\noexpand\empty}% + \lrbox +} +\def\endstorebox{% + \endlrbox + \edef\@currenvir{\@currenvir}% +} +\@ifdefinable\newstorebox{% +\let\newstorebox\newsavebox +} +\@ifdefinable\usestorebox{% +\let\usestorebox\usebox +} +\fi + +\endinput +%% +%% End of file `storebox.sty'. |