summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/collectbox/collectbox.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-05-21 23:57:28 +0000
committerKarl Berry <karl@freefriends.org>2012-05-21 23:57:28 +0000
commiteec1bcc6efce237f93a0615bee7089ba973beedc (patch)
tree123014d5eb055403791c76550cb071306d62dabd /Master/texmf-dist/source/latex/collectbox/collectbox.dtx
parentfe0f3a9dd1cb2415d2d961e1e6f46b410b6f722e (diff)
collectbox (21may12)
git-svn-id: svn://tug.org/texlive/trunk@26557 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/collectbox/collectbox.dtx')
-rw-r--r--Master/texmf-dist/source/latex/collectbox/collectbox.dtx53
1 files changed, 46 insertions, 7 deletions
diff --git a/Master/texmf-dist/source/latex/collectbox/collectbox.dtx b/Master/texmf-dist/source/latex/collectbox/collectbox.dtx
index 1b239ba08d0..5981b9dd005 100644
--- a/Master/texmf-dist/source/latex/collectbox/collectbox.dtx
+++ b/Master/texmf-dist/source/latex/collectbox/collectbox.dtx
@@ -24,10 +24,10 @@
%<*driver>
\ProvidesFile{collectbox.dtx}[%
%<=*DATE>
- 2012/05/13
+ 2012/05/17
%<=/DATE>
%<=*VERSION>
- v0.4a
+ v0.4b
%<=/VERSION>
DTX File of collectbox]
\documentclass{ydoc}
@@ -73,6 +73,7 @@
% \changes{v0.4}{2011/08/23}{In environment-mode the begin and end are now placed directly around the content to allow tabular-like environments.
% Added support for tabular-like environments in macro-mode.}
% \changes{v0.4a}{2012/05/13}{Made use of \cs{noindent} by the environment version optional.}
+% \changes{v0.4b}{2012/05/17}{Added \cs{@Collectbox} macro.}
%
%
% \DoNotIndex{\newcommand,\newenvironment}
@@ -107,6 +108,7 @@
%
% \DescribeMacro\collectbox@{<code at begin>}{<code>}{<code at end>}{<box content>}
% \DescribeMacro\@collectbox{<code>}{<box content>}
+% \DescribeMacro\@Collectbox{<code>}{<content>}
% \DescribeMacro\@collectboxto{<box register>}{<token>}{<box content>}
% \DescribeMacro\nocollectbox@{<code at begin>}{<code>}{<code at end>}
% \endgroup
@@ -263,6 +265,13 @@
% This macro is a short version of \Macro\collectbox and only accepts one argument \MacroArgs<code> besides the later \meta{box content}.
% It is intended for quick version for macros which do not need to insert code at begin or after the box content.
%
+% \DescribeMacro\@Collectbox{<code>}{<content>}
+% This macro is similar to \Macro\@collectbox but reads the content as macro argument and
+% not as a box. This is more efficient but does not allow for special content like verbatim text.
+% This macro is indented for applications when an already boxed but now modified content needs
+% to be boxed again, like it is done by \pkg{adjustbox}.
+%
+%
% \DescribeMacro\collectboxto@{<code at begin>}{<code>}{<code at end>}{<box content>}
% This macro is the internal form of \Macro\collectboxto with the optional arguments replaced by mandatory ones.
% The \Macro\collectboxto macro itself uses it after checking for and reading the optional arguments.
@@ -470,6 +479,27 @@
% \end{macro}
%
%
+% \begin{macro}{\@Collectbox}
+% Specialised version of \Macro\@collectbox which
+% reads the content as macro argument.
+% This form should (only) be used if reading the content
+% as box is not required, i.e.\ if the content
+% was already boxed before and is now boxed again,
+% as it is done by e.g.\ \pkg{adjustbox}.
+% \begin{macrocode}
+\newcommand\@Collectbox[2]{%
+ \begingroup
+ \collectbox@mode
+ \sbox\collectedbox{#2}%
+ \collectbox@setdims
+ #1%
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
% \begin{macro}{\collectbox@arg}
% Supports |\collectbox{<code>}\somemacro| in addition to
% |\collectbox{<code>}{\somemacro}|. The first following token is read and the inner brace group is closed
@@ -490,6 +520,19 @@
\def\collectbox@end{%
\collectbox@endgroup
\egroup
+ \collectbox@setdims
+ \ifcollectboxenv
+ \collectbox@reset
+ \collectbox@currenvir
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\collectbox@setdims}
+% \begin{macrocode}
+\def\collectbox@setdims{%
\collectbox@protecteddef\BOXCONTENT{\usebox\collectedbox}%
\collectbox@protecteddef\width{\wd\collectedbox}%
\collectbox@protecteddef\height{\ht\collectedbox}%
@@ -497,11 +540,7 @@
\collectbox@protecteddef\totalheight{\@ovri}%
\totalheight\height
\advance\totalheight\depth
- \ifcollectboxenv
- \collectbox@reset
- \collectbox@currenvir
- \fi
-}
+}%
% \end{macrocode}
% \end{macro}
%