diff options
author | Karl Berry <karl@freefriends.org> | 2011-07-24 23:42:11 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-07-24 23:42:11 +0000 |
commit | 773228a1a9ed5615d5719c4407f50ba5d3ee952f (patch) | |
tree | 1645aa75f3cf0253565bead0d28a712dae8de714 /Master/texmf-dist/tex/latex/collectbox | |
parent | 50df8d67f3b81cc8b2fc0650757e6b44cec633ff (diff) |
new latex package collectbox (19jul11)
git-svn-id: svn://tug.org/texlive/trunk@23212 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/collectbox')
-rw-r--r-- | Master/texmf-dist/tex/latex/collectbox/collectbox.sty | 157 |
1 files changed, 157 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/collectbox/collectbox.sty b/Master/texmf-dist/tex/latex/collectbox/collectbox.sty new file mode 100644 index 00000000000..7e9c8f860c2 --- /dev/null +++ b/Master/texmf-dist/tex/latex/collectbox/collectbox.sty @@ -0,0 +1,157 @@ +%% +%% This is file `collectbox.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% collectbox.dtx (with options: `package') +%% +%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer-online.de> +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008/05/04 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files collectbox.dtx, collectbox.ins +%% and the derived file collectbox.sty. +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{collectbox}[2011/07/23 v0.2 Collect macro arguments as boxes] +\newsavebox\collectedbox +\newcommand*\collectbox{% + \@ifstar + {\collectbox@a{{\BOXCONTENT}}}% + {\collectbox@a{}}% +} +\long\def\collectbox@a#1{% + \@ifnextchar[% + {\collectbox@b{#1}}% + {\collectbox@b{#1}[]}% +} +\long\def\collectbox@b#1[#2]#3{% + \@ifnextchar[% + {\collectbox@c{#2}{#3#1}}% + {\collectbox@c{#2}{#3#1}[]}% +} +\long\def\collectbox@c#1#2[#3]{% + \collectbox@{#1}{#2}{#3}% +} +\newcommand\collectbox@[3]{% + \begingroup + \leavevmode + \@temptokena{#3\collectbox@end#2\endgroup}% + \setbox\collectedbox\hbox\bgroup + \collectbox@setgroup + #1\bgroup + \aftergroup\the + \aftergroup\@temptokena + \collectbox@bgroup +} +\def\collectbox@macro@bgroup{% + \@ifnextchar\bgroup + {\let\@let@token=}% + {\collectbox@arg}% +} +\def\collectbox@env@bgroup{% + \let\collectbox@endcode\relax + \let\collectbox@bgroup\collectbox@macro@bgroup + \ignorespaces +} +\let\collectbox@bgroup\collectbox@macro@bgroup +\def\collectbox@setgroup{% + \color@setgroup +} +\def\collectbox@endgroup{% + \collectbox@endcode + \color@endgroup +} +\let\collectbox@endcode\relax +\newcommand\@collectbox[1]{% + \begingroup + \leavevmode + \@temptokena{\collectbox@end#1\endgroup}% + \setbox\collectedbox\hbox\bgroup + \collectbox@setgroup\bgroup + \aftergroup\the + \aftergroup\@temptokena + \collectbox@bgroup +} +\def\collectbox@arg#1{% + \collectbox@begin#1\egroup +} +\def\collectbox@end{% + \collectbox@endgroup + \egroup + \def\BOXCONTENT{\usebox\collectedbox}% + \def\width{\wd\collectedbox}% + \def\height{\ht\collectedbox}% + \def\depth{\dp\collectedbox}% + \let\totalheight\@ovri + \totalheight\height + \advance\totalheight\depth +} +\let\collectbox@code\empty +\newcommand\collectboxto[1]{% + \@ifnextchar[% + {\collectboxto@a{#1}}% + {\collectboxto@a{#1}[]}% +} +\long\def\collectboxto@a#1[#2]#3{% + \@ifnextchar[% + {\collectboxto@b{#1}{#2}{#3}}% + {\collectboxto@b{#1}{#2}{#3}[]}% +} +\long\def\collectboxto@b#1#2#3[#4]{% + \collectboxto@{#1}{#2}{#3}{#4}% +} +\newcommand\collectboxto@[4]{% + \leavevmode + \setbox#1\hbox\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 + \def\collectbox@code{\collectbox@endgroup\egroup#2}% + \collectbox@setgroup\bgroup + \aftergroup\collectbox@code + \collectbox@bgroup +} +\newcommand\nocollectbox@[3]{% + \leavevmode + \hbox\bgroup + \def\collectbox@code{#3\egroup#2}% + #1\bgroup + \aftergroup\collectbox@code + \collectbox@bgroup +} +\newcommand*\collectboxcheckenv[1]{% + \begingroup + \def\@tempa{#1}% + \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 + \fi +} +\endinput +%% +%% End of file `collectbox.sty'. |