Browse Source

optional argument now LaTeX like; version and date

tags/1.2
Jonathan Spratte 2 years ago
parent
commit
23544e65f1
2 changed files with 14 additions and 29 deletions
  1. 14
    29
      grabbox.dtx
  2. BIN
      grabbox.pdf

+ 14
- 29
grabbox.dtx View File

@@ -57,7 +57,7 @@ and the derived files           grabbox.pdf and
57 57
 %<*driver>
58 58
 \ProvidesFile{grabbox.dtx}
59 59
   [%
60
-    \csname grabbox@date\endcsname\ 
60
+    \csname grabbox@date\endcsname\space
61 61
     utilities to get an argument as a box%
62 62
   ]
63 63
 \expandafter\def\csname @classoptionslist\endcsname{}
@@ -77,10 +77,13 @@ and the derived files           grabbox.pdf and
77 77
 \end{document}
78 78
 %</driver>
79 79
 %<*pkg>
80
-\newcommand*\grabbox@date{2018-10-18}
81
-\newcommand*\grabbox@version{1.1}
80
+\newcommand*\grabbox@date{2018-11-29}
81
+\newcommand*\grabbox@version{1.2}
82 82
 \ProvidesPackage{grabbox}
83
-  [\grabbox@date\ v\grabbox@version\ utilities to get an argument as a box]
83
+  [%
84
+    \grabbox@date\space v\grabbox@version\space utilities to get an argument as
85
+    a box%
86
+  ]
84 87
 %</pkg>
85 88
 % \fi
86 89
 %
@@ -104,7 +107,9 @@ and the derived files           grabbox.pdf and
104 107
 % exact contents of an argument but only for that contents typeset
105 108
 % representation and its dimensions. In that case I personally dislike the fact
106 109
 % that those arguments couldn't contain verbatim material if coded straight
107
-% forward. Thus the macros distributed hereby came into existence.
110
+% forward for macros. For environments this is quite easy to create thanks to
111
+% \env{lrbox}, for macros this approach unfortunately doesn't work without the
112
+% enduser's cooperation. Thus the macros distributed hereby came into existence.
108 113
 %
109 114
 % This package provides \cs{grabbox} to grab an argument inside of a box. The
110 115
 % used mechanism allows category code changes in that argument as long as it is
@@ -205,13 +210,13 @@ and the derived files           grabbox.pdf and
205 210
 %     \end{tabular}%
206 211
 %     \endgroup
207 212
 %   }%
208
-% \examplecmd{Hi,}{my}{\verb|name|}{Steve!}
213
+% \examplecmd{Hi,}{my}{\verb|\name|}{Steve!}
209 214
 % \end{center}
210 215
 % One can see that \verb|\sffamily is| of \meta{inject post} is not affected by
211 216
 % the |\itshape| in \meta{inject pre}. The used code to generate that table was:
212 217
 %
213 218
 % \begin{verbatim}
214
-% \examplecmd{Hi,}{my}{\verb|name|}{Steve!}
219
+% \examplecmd{Hi,}{my}{\verb|\name|}{Steve!}
215 220
 % \end{verbatim}
216 221
 %
217 222
 % \section{Useful Example?}
@@ -297,35 +302,15 @@ and the derived files           grabbox.pdf and
297 302
 \long\def\grabbox@afterfi#1\fi{\fi#1}
298 303
 \long\def\grabbox@afterelsefiA\else#1\fi#2#3{\fi#2}
299 304
 \long\def\grabbox@afterfiB\fi#1#2{\fi#2}
300
-\long\def\grabbox@check@bracket #1[#2\endgrabbox@check@bracket
301
-  {%
302
-    \if\relax\detokenize{#2}\relax
303
-      \grabbox@afterelsefiA
304
-    \else
305
-      \grabbox@afterfiB
306
-    \fi
307
-  }
308 305
 \grabbox@def\grabbox@opt#1#2%
309 306
   {%
310 307
     \@ifnextchar[
311 308
       {\grabbox@opt@get#1#2}
312 309
       {\def#1{}#2}%
313 310
   }
314
-\long\def\grabbox@opt@get#1#2[#3]%
315
-  {%
316
-    \grabbox@opt@get@a{#3}#1#2%
317
-  }
318
-\protected\long\def\grabbox@opt@get@a#1#2#3%
319
-  {%
320
-    \grabbox@check@bracket #1[\endgrabbox@check@bracket
321
-      {\def#2{#1}#3}
322
-      {\grabbox@opt@get@b#2#3{#1]}}%
323
-  }
324
-\protected\long\def\grabbox@opt@get@b#1#2#3#4]%
311
+\protected\long\def\grabbox@opt@get#1#2[#3]%
325 312
   {%
326
-    \grabbox@check@bracket #4[\endgrabbox@check@bracket
327
-      {\def#1{#3#4}#2}
328
-      {\grabbox@opt@get@b#1#2{#3#4]}}%
313
+    \def#1{#3}#2%
329 314
   }
330 315
 \grabbox@def\grabbox@unpack
331 316
   {%

BIN
grabbox.pdf View File


Loading…
Cancel
Save