summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-08-13 16:32:07 +0000
committerKarl Berry <karl@freefriends.org>2011-08-13 16:32:07 +0000
commitde948fd0d23b011d22f685fc2b3a16e1113ca2bc (patch)
tree21333720dea7076cfdab237ef9317c6c24ec7abc /Master/texmf-dist/tex
parent28d552cbc39eea3053b60e35ec22d20e16082fed (diff)
collectbox (18jul11)
git-svn-id: svn://tug.org/texlive/trunk@23533 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/collectbox/collectbox.sty56
1 files changed, 37 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/latex/collectbox/collectbox.sty b/Master/texmf-dist/tex/latex/collectbox/collectbox.sty
index 79e58b3fc0c..f9981471f67 100644
--- a/Master/texmf-dist/tex/latex/collectbox/collectbox.sty
+++ b/Master/texmf-dist/tex/latex/collectbox/collectbox.sty
@@ -26,7 +26,7 @@
%% and the derived file collectbox.sty.
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
-\ProvidesPackage{collectbox}[2011/07/30 v0.2a Collect macro arguments as boxes]
+\ProvidesPackage{collectbox}[2011/08/06 v0.3 Collect macro arguments as boxes]
\newsavebox\collectedbox
\newcommand*\collectbox{%
\@ifstar
@@ -46,11 +46,13 @@
\long\def\collectbox@c#1#2[#3]{%
\collectbox@{#1}{#2}{#3}%
}
+\let\collect@box\hbox
+\let\collectbox@mode\leavevmode
\newcommand\collectbox@[3]{%
\begingroup
- \leavevmode
+ \collectbox@mode
\@temptokena{#3\collectbox@end#2\endgroup}%
- \setbox\collectedbox\hbox\bgroup
+ \setbox\collectedbox\collect@box\bgroup
\collectbox@setgroup
#1\bgroup
\aftergroup\the
@@ -78,9 +80,9 @@
\let\collectbox@endcode\relax
\newcommand\@collectbox[1]{%
\begingroup
- \leavevmode
+ \collectbox@mode
\@temptokena{\collectbox@end#1\endgroup}%
- \setbox\collectedbox\hbox\bgroup
+ \setbox\collectedbox\collect@box\bgroup
\collectbox@setgroup\bgroup
\aftergroup\the
\aftergroup\@temptokena
@@ -122,43 +124,59 @@
\collectboxto@{#1}{#2}{#3}{#4}%
}
\newcommand\collectboxto@[4]{%
- \leavevmode
- \setbox#1\hbox\bgroup
+ \collectbox@mode
+ \setbox#1\collect@box\bgroup
\def\collectbox@code{#4\collectbox@endgroup\egroup#3}%
\collectbox@setgroup#2\bgroup
\aftergroup\collectbox@code
\collectbox@bgroup
}
\newcommand\@collectboxto[2]{%
- \leavevmode
- \setbox#1\hbox\bgroup
+ \collectbox@mode
+ \setbox#1\collect@box\bgroup
\def\collectbox@code{\collectbox@endgroup\egroup#2}%
\collectbox@setgroup\bgroup
\aftergroup\collectbox@code
\collectbox@bgroup
}
\newcommand\nocollectbox@[3]{%
- \leavevmode
- \hbox\bgroup
+ \collectbox@mode
+ \collect@box\bgroup
\def\collectbox@code{#3\egroup#2}%
#1\bgroup
\aftergroup\collectbox@code
\collectbox@bgroup
}
+\newcommand\nocollectbox@to[4]{%
+ \collectbox@mode
+ \collect@box to #1\bgroup
+ \def\collectbox@code{#4\egroup#3}%
+ #2\bgroup
+ \aftergroup\collectbox@code
+ \collectbox@bgroup
+}
\newcommand*\collectboxcheckenv[1]{%
\begingroup
\def\@tempa{#1}%
+ \expandafter\endgroup
\ifx\@currenvir\@tempa
- \edef\@currenvir{\@currenvir\noexpand\empty}%
- \let\collectbox@bgroup\collectbox@env@bgroup
- \def\collectbox@endcode{\ifhmode\unskip\fi}%
- \ifcsname end#1\endcsname\else
- \@namedef{end#1}{\egroup\endgroup}%
- \fi
- \else
- \endgroup
+ \@collectboxisenv{#1}%
+ \fi
+}
+\def\@collectboxisenv#1{%
+ \noindent
+ \begingroup
+ \collectboxenvtrue
+ \edef\@currenvir{\@currenvir\noexpand\empty}%
+ \let\collectbox@bgroup\collectbox@env@bgroup
+ \let\collectbox@endcode\collectbox@env@endcode
+ \expandafter\ifx\csname end#1\endcsname\relax
+ \expandafter\let\csname end#1\endcsname\collectbox@envend
\fi
}
+\newif\ifcollectboxenv
+\def\collectbox@env@endcode{\ifhmode\unskip\fi}%
+\def\collectbox@envend{\egroup\endgroup}%
\endinput
%%
%% End of file `collectbox.sty'.