blob: 1562a41bbeb3a6385b852694b3c5dfbae2e41775 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
%% 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 and storebox-pgf.sty.
%%
\ProvidesPackage{storebox}[%
2011/12/21
v1.3a
Store and reuse boxes in a file size efficient way]
\DeclareOption{disable}{\let\ifstorebox\iffalse}
\DeclareOption{enable}{\let\ifstorebox\iftrue}
\DeclareOption{immediate}{\let\storebox@immediate\immediate}
\DeclareOption{delayed}{\let\storebox@immediate\relax}
\ExecuteOptions{delayed}
\ProcessOptions*
\expandafter\ifx\csname ifstorebox\endcsname\relax
\RequirePackage{ifpdf}
\expandafter\let\csname ifstorebox\expandafter\endcsname\csname ifpdf\endcsname
\fi
\RequirePackage{collectbox}[2011/08/04]
\newcommand*\storebox{%
\begingroup
\def\@tempa{storebox}%
\ifx\@currenvir\@tempa
\endgroup
\expandafter\@storebox@env
\else
\endgroup
\expandafter\@storebox
\fi
}
\ifstorebox
\def\@storebox#1{%
\begingroup
\@collectboxto\collectedbox{%
\storebox@immediate\pdfxform resources {\the\pdfpageresources}\collectedbox
\endgroup\mathchardef#1=\pdflastxform
}%
}
\def\@storebox@env#1{%
\edef\@tempa{%
\setbox\collectedbox\hbox\bgroup%
\def\noexpand\the@storebox{\noexpand#1}%
}%
\@tempa
\begingroup
\aftergroup\@storebox@env@end
\@endpefalse
\color@setgroup
\begingroup
\def\@currenvir{storebox\empty}%
\ignorespaces
}
\def\endstorebox{%
\unskip
\endgroup
\color@endgroup
}
\def\@storebox@env@end{%
\edef\@tempa{%
\egroup
\immediate\pdfxform resources {\the\pdfpageresources}\collectedbox
\endgroup
\mathchardef\expandafter\noexpand\the@storebox=\pdflastxform
}%
\@tempa
}
\newcommand*\newstorebox[1]{%
\@ifdefinable{#1}{\let#1\relax}%
}
\newcommand*\usestorebox[1]{%
\mbox{\pdfrefxform#1}%
}
\AtBeginDocument{%
\@ifpackageloaded{pgf}{\RequirePackage{storebox-pgf}{}}%
}
\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'.
|