diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/collectbox')
-rw-r--r-- | Master/texmf-dist/source/latex/collectbox/collectbox.dtx | 261 |
1 files changed, 251 insertions, 10 deletions
diff --git a/Master/texmf-dist/source/latex/collectbox/collectbox.dtx b/Master/texmf-dist/source/latex/collectbox/collectbox.dtx index 9d6946a9f7a..ce34f8ef45b 100644 --- a/Master/texmf-dist/source/latex/collectbox/collectbox.dtx +++ b/Master/texmf-dist/source/latex/collectbox/collectbox.dtx @@ -21,9 +21,9 @@ % % \iffalse %<*driver> -\ProvidesFile{collectbox.dtx}[2011/08/11 v0.3a DTX File of collectbox] +\ProvidesFile{collectbox.dtx}[2011/08/23 v0.4 DTX File of collectbox] \documentclass{ydoc} -\usepackage{collectbox}[2011/08/11] +\usepackage{collectbox}[2011/08/23] \EnableCrossrefs \CodelineIndex \RecordChanges @@ -36,7 +36,7 @@ %</driver> % \fi % -% \CheckSum{0} +% \CheckSum{465} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -61,6 +61,9 @@ % \changes{v0.2a}{2011/07/30}{Small bugfix.} % \changes{v0.3}{2011/08/06}{Some internal modifications required by related packages.} % \changes{v0.3a}{2011/08/11}{Fixed issue with collectbox macros in the end-code of a collectbox environment.} +% \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.} +% % % \DoNotIndex{\newcommand,\newenvironment} % @@ -246,7 +249,6 @@ % {\makeatletter % \newcommand{\GFbox}{\collectbox@{\color{green}}{\fbox{\BOXCONTENT}}{}}% % \makeatother -% \tracingall % \GFbox{test $a=4$ \verb|\relax|}% % } % @@ -280,7 +282,7 @@ % \fi % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1999/12/01] -\ProvidesPackage{collectbox}[2011/08/11 v0.3a Collect macro arguments as boxes] +\ProvidesPackage{collectbox}[2011/08/23 v0.4 Collect macro arguments as boxes] % \end{macrocode} % % \begin{macro}{\collectedbox} @@ -364,6 +366,30 @@ \aftergroup\@temptokena \collectbox@bgroup } +\let\collectbox@macro\collectbox@ +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\collectbox@env} +% \begin{macrocode} +\newcommand\collectbox@env[3]{% + \collectbox@mode + \def\collectboxenvend{#3\collectbox@end#2\collectbox@currenvir}% + \setbox\collectedbox\collect@box\bgroup + \collectbox@setgroup + \collectbox@reset + \ignorespaces + #1% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collectbox@currenenvir} +% \begin{macrocode} +\def\collectbox@currenvir{% + \edef\@currenvir{\@currenvir}% +} % \end{macrocode} % \end{macro} % @@ -381,8 +407,7 @@ % \begin{macro}{\collectbox@env@bgroup} % \begin{macrocode} \def\collectbox@env@bgroup{% - \let\collectbox@endcode\relax - \let\collectbox@bgroup\collectbox@macro@bgroup + \collectbox@reset \ignorespaces } % \end{macrocode} @@ -459,8 +484,22 @@ \collectbox@protecteddef\totalheight{\@ovri}% \totalheight\height \advance\totalheight\depth + \ifcollectboxenv + \collectbox@reset + \collectbox@currenvir + \fi +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collectbox@reset} +% \begin{macrocode} +\def\collectbox@reset{% \let\collectbox@endcode\relax \let\collectbox@bgroup\collectbox@macro@bgroup + \let\collectbox@\collectbox@macro + \collectboxenvfalse } % \end{macrocode} % \end{macro} @@ -601,11 +640,11 @@ } \def\@collectboxisenv#1{% \noindent - \begingroup \collectboxenvtrue \edef\@currenvir{\@currenvir\noexpand\empty}% \let\collectbox@bgroup\collectbox@env@bgroup \let\collectbox@endcode\collectbox@env@endcode + \let\collectbox@\collectbox@env \expandafter\ifx\csname end#1\endcsname\relax \expandafter\let\csname end#1\endcsname\collectbox@envend \fi @@ -624,12 +663,214 @@ % % \begin{macro}{\collectbox@envend} % \begin{macrocode} -\def\collectbox@envend{\egroup\endgroup}% +\def\collectbox@envend{\collectboxenvend}% % \end{macrocode} % \end{macro} % % -\endinput +% \begin{macro}{\collectboxenvend} +% \begin{macrocode} +\def\collectboxenvend{% + \egroup + \collectbox@currenvir +}% +% \end{macrocode} +% \end{macro} +% +% \subsection{Tabular collection} +% +% \begin{macro}{\collectboxtabular} +% \begin{macrocode} +\newcommand\collectboxtabular[3][c]{% + \collectbox@tab{tabular}{[#1]{#2}}{}{#3}{}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collectboxtabularstar} +% \begin{macrocode} +\newcommand\collectboxtabularstar[4][c]{% + \collectbox@tab{tabular*}{[#1]{#2}{#3}}{}{#4}{}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collectboxarray} +% \begin{macrocode} +\newcommand\collectboxarray[2]{% + \collectbox@tab{array}{{#1}}{\(}{#2}{\)}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collectbox@checkarray} +% \begin{macrocode} +\def\collectbox@checkarray{% +\@ifpackageloaded{array}{% + \let\collectbox@realarraycr\@arraycr + \def\collectbox@setarraycr{% + \let\@arraycr\collebox@cr + \def\ialign{\let\@arraycr\collectbox@realarraycr \everycr {}\tabskip \z@skip \halign}% + }% +}{% + \let\collectbox@realarraycr\@tabularcr + \def\collectbox@setarraycr{% + \let\@tabularcr\collebox@cr + \def\ialign{\let\noexpand\@tabularcr\noexpand\collectbox@realarraycr \everycr {}\tabskip \z@skip \halign}% + }% +}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\collectbox@checkarray +\AtBeginDocument{\collectbox@checkarray}% +% \end{macrocode} +% +% \begin{macro}{\collectbox@dorealarraycr} +% \begin{macrocode} +\def\collectbox@dorealarraycr{% + \expandafter\collectbox@realarraycr\collectbox@aftercrstuff +} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\let\collectbox@aftercrstuff\empty +% \end{macrocode} +% +% \begin{macro}{\collectbox@tab} +% \begin{macrocode} +\def\collectbox@tab#1#2#3#4#5{% + \begingroup + \collectbox@mode + \def\collectbox@codeafter{#4\endgroup}% + \def\collectbox@endtabenv{\end{#1}#5\collectbox@end}% + \def\collectbox@dotab{#3\begin{#1}#2}% + \setbox\collectedbox\collect@box\bgroup + \collectbox@setgroup + \collectbox@setarraycr + \afterassignment\collectbox@dotab + \let\@let@token=% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collebox@cr} +% \begin{macrocode} +\def\collebox@cr{% + \@ifstar\collebox@@cr\collebox@@cr% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collebox@@cr} +% \begin{macrocode} +\def\collebox@@cr{% + \@ifnextchar[% + \collebox@@cr@opt + {\collebox@@@cr{}}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collebox@@cr@opt} +% \begin{macrocode} +\def\collebox@@cr@opt[#1]{% + \collebox@@@cr{[#1]}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collebox@@@cr} +% \begin{macrocode} +\def\collebox@@@cr#1{% + \def\collectbox@aftercrstuff{#1}% + \expandafter\collebox@@@@cr + \romannumeral-`0% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collebox@@@@cr} +% \begin{macrocode} +\def\collebox@@@@cr{% + \@ifnextchar\egroup{\collectbox@dorealarraycr\collectbox@aftertab}{% + \ifx\@let@token\noalign + \expandafter\collectbox@handlenoalign + \else + \expandafter\collectbox@dorealarraycr + \fi + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collectbox@handlenoalign} +% \begin{macrocode} +\def\collectbox@handlenoalign#1#2{% + \collectbox@dorealarraycr + \noalign{\bgroup\aftergroup\collectbox@afternoalign#2}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collectbox@handlenextnoalign} +% \begin{macrocode} +\def\collectbox@handlenextnoalign#1#2{% + \egroup + \noalign{\bgroup\aftergroup\collectbox@afternoalign#2}% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collectbox@afternoalign} +% \begin{macrocode} +\def\collectbox@afternoalign{% + \expandafter\collectbox@@afternoalign + \romannumeral-`0% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collectbox@@afternoalign} +% \begin{macrocode} +\def\collectbox@@afternoalign{% + \@ifnextchar\egroup{\egroup\collectbox@aftertab}{% + \ifx\@let@token\noalign + \expandafter\collectbox@handlenextnoalign + \else + \expandafter\egroup + \fi + }% +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\collectbox@aftertab} +% \begin{macrocode} +\def\collectbox@aftertab{% + \collectbox@endtabenv + \afterassignment\collectbox@codeafter + \let\@let@token=% +} +% \end{macrocode} +% \end{macro} +% % \iffalse %</collectbox> % \fi |