diff options
author | Karl Berry <karl@freefriends.org> | 2019-05-08 21:17:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-05-08 21:17:53 +0000 |
commit | dc27dfcd77b6a8654d149e1821c03289d7aa359a (patch) | |
tree | 5836b1c3fea3c94b67dd4cb3c512e7144020aebb | |
parent | 610fc8431cfaf2913a54f01c6d3abd4d9283fc34 (diff) |
grabbox (8may19)
git-svn-id: svn://tug.org/texlive/trunk@51052 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/grabbox/README.md | 10 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/grabbox/grabbox.pdf | bin | 351524 -> 352249 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/grabbox/grabbox.dtx | 50 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/grabbox/grabbox.sty | 36 |
4 files changed, 54 insertions, 42 deletions
diff --git a/Master/texmf-dist/doc/latex/grabbox/README.md b/Master/texmf-dist/doc/latex/grabbox/README.md index aaad6d4708b..13e3c3d157c 100644 --- a/Master/texmf-dist/doc/latex/grabbox/README.md +++ b/Master/texmf-dist/doc/latex/grabbox/README.md @@ -1,6 +1,6 @@ grabbox: utilities to get an argument as a box -Copyright (C) 2018 by Jonathan P. Spratte +Copyright (C) 2018-2019 by Jonathan P. Spratte This package 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 @@ -11,9 +11,9 @@ file The package provides - - `\grabbox<*>{<register>}[<pre>]{<mode>}[<post>]{<next>}`: grab the + - `\grabbox<*>[<prepre>]{<register>}[<pre>]{<mode>}[<post>]{<next>}`: grab the next argument as a box in `<mode>` (`\hbox`, `\vbox` or `\vtop`) and save it in box `<register>`. After the box is saved execute `<next>`. Inside of the - box one can inject `<pre>` before the contents and `<post>` after them. If - the star is not given spaces are stripped from the start and the end of the - box. + box one can inject `<prepre>` and `<pre>` before the contents and `<post>` + after them. If the star is not given spaces are stripped from the start and + the end of the box. diff --git a/Master/texmf-dist/doc/latex/grabbox/grabbox.pdf b/Master/texmf-dist/doc/latex/grabbox/grabbox.pdf Binary files differindex 405b2acd1f0..2334281d4dc 100644 --- a/Master/texmf-dist/doc/latex/grabbox/grabbox.pdf +++ b/Master/texmf-dist/doc/latex/grabbox/grabbox.pdf diff --git a/Master/texmf-dist/source/latex/grabbox/grabbox.dtx b/Master/texmf-dist/source/latex/grabbox/grabbox.dtx index 98e02ed13b1..c8205a36b79 100644 --- a/Master/texmf-dist/source/latex/grabbox/grabbox.dtx +++ b/Master/texmf-dist/source/latex/grabbox/grabbox.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: grabbox.dtx Copyright (C) 2018 Jonathan P. Spratte +% File: grabbox.dtx Copyright (C) 2018-2019 Jonathan P. Spratte % % It 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 @@ -26,7 +26,7 @@ Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt -------------------------------------------------------------- -Copyright (C) 2018 Jonathan P. Spratte +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 @@ -77,8 +77,8 @@ and the derived files grabbox.pdf and \end{document} %</driver> %<*pkg> -\newcommand*\grabbox@date{2018-12-29} -\newcommand*\grabbox@version{1.3} +\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 @@ -177,6 +177,18 @@ and the derived files grabbox.pdf and % bunch of temporary macros), it is of course not expandable and defined % \cs{protected}. % +% \begin{function}{\@grabbox} +% \begin{syntax} +% \cs{@grabbox}\meta{*}\marg{inject pre pre}\ignorespaces^^A +% \marg{box register}\marg{inject pre}\marg{box type}\ignorespaces^^A +% \marg{inject post}\marg{afterwards} +% \end{syntax} +% This is a variant of \cs{grabbox} that should be faster because it doesn't +% parse for optional arguments. Instead every argument is mandatory except for +% the star, just leave the arguments empty if you'd otherwise not use the +% corresponding optional argument in \cs{grabbox}. +% \end{function} +% % \section{Useless Example!} % % First we need to reserve us a box register for this example: @@ -315,8 +327,6 @@ and the derived files grabbox.pdf and {% \grabbox@def#1##1{\def#2{##1}\grabbox@opt#3#4}% } -\long\def\grabbox@afterelsefi#1\else#2\fi{\fi#1} -\long\def\grabbox@afterfi#1\fi{\fi#1} \grabbox@def\grabbox@opt#1#2% {% \@ifnextchar[ @@ -342,19 +352,6 @@ and the derived files grabbox.pdf and {% \ifhmode\unskip\fi } -\grabbox@def\grabbox@unpack - {% - \begingroup - \edef\grabbox@test{\grabbox@type}% - \expandafter\ifx\grabbox@test\hbox - \endgroup - \grabbox@afterelsefi\unhbox - \else - \endgroup - \grabbox@afterfi\unvbox - \fi - \grabbox@name - } \grabbox@def\grabbox {% \@ifstar @@ -373,6 +370,21 @@ and the derived files grabbox.pdf and \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 diff --git a/Master/texmf-dist/tex/latex/grabbox/grabbox.sty b/Master/texmf-dist/tex/latex/grabbox/grabbox.sty index e5ab5339c60..72da0c9ce26 100644 --- a/Master/texmf-dist/tex/latex/grabbox/grabbox.sty +++ b/Master/texmf-dist/tex/latex/grabbox/grabbox.sty @@ -13,7 +13,7 @@ %% See http://www.latex-project.org/lppl.txt %% -------------------------------------------------------------- %% -%% Copyright (C) 2018 Jonathan P. Spratte +%% 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 @@ -29,8 +29,8 @@ %% and the derived files grabbox.pdf and %% grabbox.sty. %% -\newcommand*\grabbox@date{2018-12-29} -\newcommand*\grabbox@version{1.3} +\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 @@ -50,8 +50,6 @@ {% \grabbox@def#1##1{\def#2{##1}\grabbox@opt#3#4}% } -\long\def\grabbox@afterelsefi#1\else#2\fi{\fi#1} -\long\def\grabbox@afterfi#1\fi{\fi#1} \grabbox@def\grabbox@opt#1#2% {% \@ifnextchar[ @@ -77,19 +75,6 @@ {% \ifhmode\unskip\fi } -\grabbox@def\grabbox@unpack - {% - \begingroup - \edef\grabbox@test{\grabbox@type}% - \expandafter\ifx\grabbox@test\hbox - \endgroup - \grabbox@afterelsefi\unhbox - \else - \endgroup - \grabbox@afterfi\unvbox - \fi - \grabbox@name - } \grabbox@def\grabbox {% \@ifstar @@ -108,6 +93,21 @@ \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 |