|
@@ -1,6 +1,6 @@
|
1
|
1
|
% \iffalse meta-comment
|
2
|
2
|
%
|
3
|
|
-% File: grabbox.dtx Copyright (C) 2018 Jonathan P. Spratte
|
|
3
|
+% File: grabbox.dtx Copyright (C) 2018-2019 Jonathan P. Spratte
|
4
|
4
|
%
|
5
|
5
|
% It may be distributed and/or modified under the conditions of the LaTeX
|
6
|
6
|
% Project Public License (LPPL), either version 1.3c of this license or (at your
|
|
@@ -26,7 +26,7 @@ Released under the LaTeX Project Public License v1.3c or later
|
26
|
26
|
See http://www.latex-project.org/lppl.txt
|
27
|
27
|
--------------------------------------------------------------
|
28
|
28
|
|
29
|
|
-Copyright (C) 2018 Jonathan P. Spratte
|
|
29
|
+Copyright (C) 2018-2019 Jonathan P. Spratte
|
30
|
30
|
|
31
|
31
|
This work may be distributed and/or modified under the conditions of the
|
32
|
32
|
LaTeX Project Public License (LPPL), either version 1.3c of this license or
|
|
@@ -77,8 +77,8 @@ and the derived files grabbox.pdf and
|
77
|
77
|
\end{document}
|
78
|
78
|
%</driver>
|
79
|
79
|
%<*pkg>
|
80
|
|
-\newcommand*\grabbox@date{2018-12-29}
|
81
|
|
-\newcommand*\grabbox@version{1.3}
|
|
80
|
+\newcommand*\grabbox@date{2019-05-08}
|
|
81
|
+\newcommand*\grabbox@version{1.4}
|
82
|
82
|
\ProvidesPackage{grabbox}
|
83
|
83
|
[%
|
84
|
84
|
\grabbox@date\space v\grabbox@version\space utilities to get an argument as
|
|
@@ -177,6 +177,18 @@ and the derived files grabbox.pdf and
|
177
|
177
|
% bunch of temporary macros), it is of course not expandable and defined
|
178
|
178
|
% \cs{protected}.
|
179
|
179
|
%
|
|
180
|
+% \begin{function}{\@grabbox}
|
|
181
|
+% \begin{syntax}
|
|
182
|
+% \cs{@grabbox}\meta{*}\marg{inject pre pre}\ignorespaces^^A
|
|
183
|
+% \marg{box register}\marg{inject pre}\marg{box type}\ignorespaces^^A
|
|
184
|
+% \marg{inject post}\marg{afterwards}
|
|
185
|
+% \end{syntax}
|
|
186
|
+% This is a variant of \cs{grabbox} that should be faster because it doesn't
|
|
187
|
+% parse for optional arguments. Instead every argument is mandatory except for
|
|
188
|
+% the star, just leave the arguments empty if you'd otherwise not use the
|
|
189
|
+% corresponding optional argument in \cs{grabbox}.
|
|
190
|
+% \end{function}
|
|
191
|
+%
|
180
|
192
|
% \section{Useless Example!}
|
181
|
193
|
%
|
182
|
194
|
% First we need to reserve us a box register for this example:
|
|
@@ -315,8 +327,6 @@ and the derived files grabbox.pdf and
|
315
|
327
|
{%
|
316
|
328
|
\grabbox@def#1##1{\def#2{##1}\grabbox@opt#3#4}%
|
317
|
329
|
}
|
318
|
|
-\long\def\grabbox@afterelsefi#1\else#2\fi{\fi#1}
|
319
|
|
-\long\def\grabbox@afterfi#1\fi{\fi#1}
|
320
|
330
|
\grabbox@def\grabbox@opt#1#2%
|
321
|
331
|
{%
|
322
|
332
|
\@ifnextchar[
|
|
@@ -342,19 +352,6 @@ and the derived files grabbox.pdf and
|
342
|
352
|
{%
|
343
|
353
|
\ifhmode\unskip\fi
|
344
|
354
|
}
|
345
|
|
-\grabbox@def\grabbox@unpack
|
346
|
|
- {%
|
347
|
|
- \begingroup
|
348
|
|
- \edef\grabbox@test{\grabbox@type}%
|
349
|
|
- \expandafter\ifx\grabbox@test\hbox
|
350
|
|
- \endgroup
|
351
|
|
- \grabbox@afterelsefi\unhbox
|
352
|
|
- \else
|
353
|
|
- \endgroup
|
354
|
|
- \grabbox@afterfi\unvbox
|
355
|
|
- \fi
|
356
|
|
- \grabbox@name
|
357
|
|
- }
|
358
|
355
|
\grabbox@def\grabbox
|
359
|
356
|
{%
|
360
|
357
|
\@ifstar
|
|
@@ -373,6 +370,21 @@ and the derived files grabbox.pdf and
|
373
|
370
|
\afterassignment\grabbox@intermediate
|
374
|
371
|
\setbox\grabbox@name\grabbox@type
|
375
|
372
|
}
|
|
373
|
+\grabbox@def\@grabbox
|
|
374
|
+ {%
|
|
375
|
+ \@ifstar
|
|
376
|
+ {\@grabbox@spaces@true\@grabbox@a}
|
|
377
|
+ {\@grabbox@spaces@false\@grabbox@a}%
|
|
378
|
+ }
|
|
379
|
+\grabbox@ldef\@grabbox@a#1#2#3#4#5%
|
|
380
|
+ {%
|
|
381
|
+ \def\grabbox@into@prepre{#1}%
|
|
382
|
+ \def\grabbox@name {#2}%
|
|
383
|
+ \def\grabbox@into@pre {#3}%
|
|
384
|
+ \def\grabbox@type {#4}%
|
|
385
|
+ \def\grabbox@into@post {#5}%
|
|
386
|
+ \grabbox@d
|
|
387
|
+ }
|
376
|
388
|
\grabbox@def\grabbox@intermediate
|
377
|
389
|
{%
|
378
|
390
|
\grabbox@into@prepre
|