summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/grabbox/grabbox.sty
blob: 72da0c9ce260b0cfa4e45d33eef8be8911875cee (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
%%
%% This is file `grabbox.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% grabbox.dtx  (with options: `pkg')
%% 
%% --------------------------------------------------------------
%% grabbox -- utilities to get an argument as a box
%% E-mail: jspratte@yahoo.de
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% --------------------------------------------------------------
%% 
%% Copyright (C) 2018-2019 Jonathan P. Spratte
%% 
%% This  work may be  distributed and/or  modified under  the conditions  of the
%% LaTeX Project Public License (LPPL),  either version 1.3c  of this license or
%% (at your option) any later version.  The latest version of this license is in
%% the file:
%% 
%%   http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status) by
%%   Jonathan P. Spratte.
%% 
%% This work consists of the file  grabbox.dtx
%% and the derived files           grabbox.pdf and
%%                                 grabbox.sty.
%% 
\newcommand*\grabbox@date{2019-05-08}
\newcommand*\grabbox@version{1.4}
\ProvidesPackage{grabbox}
  [%
    \grabbox@date\space v\grabbox@version\space utilities to get an argument as
    a box%
  ]
\@ifdefinable{\if@grabbox@spaces@}{\newif\if@grabbox@spaces@}
\@ifdefinable{\grabbox@def}
  {\long\def\grabbox@def#1#2#{\grabbox@def@a{}#1{#2}}}
\@ifdefinable{\grabbox@ldef}
  {\long\def\grabbox@ldef#1#2#{\grabbox@def@a\long#1{#2}}}
\@ifdefinable{\grabbox@def@a}
  {%
    \protected\long\def\grabbox@def@a#1#2#3#4%
      {\@ifdefinable#2{\protected#1\def#2#3{#4}}}%
  }
\newcommand\grabbox@def@step[4]
  {%
    \grabbox@def#1##1{\def#2{##1}\grabbox@opt#3#4}%
  }
\grabbox@def\grabbox@opt#1#2%
  {%
    \@ifnextchar[
      {\grabbox@opt@get#1#2}
      {\def#1{}#2}%
  }
\grabbox@ldef\grabbox@opt@get#1#2[#3]%
  {%
    \def#1{#3}#2%
  }
\grabbox@def\grabbox@set@color
  {%
    \@ifundefined{set@color}{}
      {\global\let\grabbox@set@color\set@color\grabbox@set@color}%
  }
\AtBeginDocument
  {%
    \@ifundefined{set@color}
      {\gdef\grabbox@set@color{}}
      {\global\let\grabbox@set@color\set@color}%
  }%
\newcommand*\grabbox@unskip@space
  {%
    \ifhmode\unskip\fi
  }
\grabbox@def\grabbox
  {%
    \@ifstar
      {\@grabbox@spaces@true\grabbox@a}
      {\@grabbox@spaces@false\grabbox@a}%
  }
\grabbox@def\grabbox@a
  {%
    \grabbox@opt\grabbox@into@prepre\grabbox@b
  }
\grabbox@def@step\grabbox@b\grabbox@name\grabbox@into@pre\grabbox@c
\grabbox@def@step\grabbox@c\grabbox@type\grabbox@into@post\grabbox@d
\grabbox@ldef\grabbox@d#1%
  {%
    \def\grabbox@final{#1}%
    \afterassignment\grabbox@intermediate
    \setbox\grabbox@name\grabbox@type
  }
\grabbox@def\@grabbox
  {%
    \@ifstar
      {\@grabbox@spaces@true\@grabbox@a}
      {\@grabbox@spaces@false\@grabbox@a}%
  }
\grabbox@ldef\@grabbox@a#1#2#3#4#5%
  {%
    \def\grabbox@into@prepre{#1}%
    \def\grabbox@name       {#2}%
    \def\grabbox@into@pre   {#3}%
    \def\grabbox@type       {#4}%
    \def\grabbox@into@post  {#5}%
    \grabbox@d
  }
\grabbox@def\grabbox@intermediate
  {%
    \grabbox@into@prepre
    \bgroup
    \if@grabbox@spaces@
    \else
      \aftergroup\grabbox@unskip@space
    \fi
    \grabbox@set@color
    \aftergroup\grabbox@after
    \grabbox@into@pre
    \if@grabbox@spaces@
    \else
      \ignorespaces
    \fi
  }
\newcommand*\grabbox@after@aux@b[1]
  {%
    \grabbox@after@aux@a
  }
\grabbox@def\grabbox@after@aux@a
  {%
    \@ifnextchar\reset@color
      {\reset@color\grabbox@after@aux@b}
      {\egroup\grabbox@final}%
  }
\grabbox@def\grabbox@after
  {%
    \grabbox@into@post
    \endgraf
    \grabbox@after@aux@a
  }
%% 
%%
%% End of file `grabbox.sty'.