From 86431735f0e1623beae96cd8a9f0fcd809fe08bf Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 6 Sep 2011 23:40:37 +0000 Subject: collectbox (6sep11) git-svn-id: svn://tug.org/texlive/trunk@23848 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/doc/latex/collectbox/collectbox.pdf | Bin 174737 -> 174724 bytes .../source/latex/collectbox/collectbox.dtx | 261 ++++++++++++++++++++- .../texmf-dist/tex/latex/collectbox/collectbox.sty | 127 +++++++++- Master/tlpkg/libexec/ctan2tds | 1 + 4 files changed, 374 insertions(+), 15 deletions(-) diff --git a/Master/texmf-dist/doc/latex/collectbox/collectbox.pdf b/Master/texmf-dist/doc/latex/collectbox/collectbox.pdf index 16df2b1f655..6a3529daf88 100644 Binary files a/Master/texmf-dist/doc/latex/collectbox/collectbox.pdf and b/Master/texmf-dist/doc/latex/collectbox/collectbox.pdf differ 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 @@ % % \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 % % \fi diff --git a/Master/texmf-dist/tex/latex/collectbox/collectbox.sty b/Master/texmf-dist/tex/latex/collectbox/collectbox.sty index 373b59e25ab..d41ae01318f 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/08/11 v0.3a Collect macro arguments as boxes] +\ProvidesPackage{collectbox}[2011/08/23 v0.4 Collect macro arguments as boxes] \newsavebox\collectedbox \newcommand*\collectbox{% \@ifstar @@ -59,14 +59,26 @@ \aftergroup\@temptokena \collectbox@bgroup } +\let\collectbox@macro\collectbox@ +\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% +} +\def\collectbox@currenvir{% + \edef\@currenvir{\@currenvir}% +} \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 + \collectbox@reset \ignorespaces } \let\collectbox@bgroup\collectbox@macro@bgroup @@ -101,8 +113,16 @@ \collectbox@protecteddef\totalheight{\@ovri}% \totalheight\height \advance\totalheight\depth + \ifcollectboxenv + \collectbox@reset + \collectbox@currenvir + \fi +} +\def\collectbox@reset{% \let\collectbox@endcode\relax \let\collectbox@bgroup\collectbox@macro@bgroup + \let\collectbox@\collectbox@macro + \collectboxenvfalse } \begingroup \expandafter\ifx\csname protected\endcsname\relax @@ -167,18 +187,115 @@ } \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 } \newif\ifcollectboxenv \def\collectbox@env@endcode{\ifhmode\unskip\fi}% -\def\collectbox@envend{\egroup\endgroup}% +\def\collectbox@envend{\collectboxenvend}% +\def\collectboxenvend{% + \egroup + \collectbox@currenvir +}% +\newcommand\collectboxtabular[3][c]{% + \collectbox@tab{tabular}{[#1]{#2}}{}{#3}{}% +} +\newcommand\collectboxtabularstar[4][c]{% + \collectbox@tab{tabular*}{[#1]{#2}{#3}}{}{#4}{}% +} +\newcommand\collectboxarray[2]{% + \collectbox@tab{array}{{#1}}{\(}{#2}{\)}% +} +\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}% + }% +}% +} +\collectbox@checkarray +\AtBeginDocument{\collectbox@checkarray}% +\def\collectbox@dorealarraycr{% + \expandafter\collectbox@realarraycr\collectbox@aftercrstuff +} +\let\collectbox@aftercrstuff\empty +\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=% +} +\def\collebox@cr{% + \@ifstar\collebox@@cr\collebox@@cr% +} +\def\collebox@@cr{% + \@ifnextchar[% + \collebox@@cr@opt + {\collebox@@@cr{}}% +} +\def\collebox@@cr@opt[#1]{% + \collebox@@@cr{[#1]}% +} +\def\collebox@@@cr#1{% + \def\collectbox@aftercrstuff{#1}% + \expandafter\collebox@@@@cr + \romannumeral-`0% +} +\def\collebox@@@@cr{% + \@ifnextchar\egroup{\collectbox@dorealarraycr\collectbox@aftertab}{% + \ifx\@let@token\noalign + \expandafter\collectbox@handlenoalign + \else + \expandafter\collectbox@dorealarraycr + \fi + }% +} +\def\collectbox@handlenoalign#1#2{% + \collectbox@dorealarraycr + \noalign{\bgroup\aftergroup\collectbox@afternoalign#2}% +} +\def\collectbox@handlenextnoalign#1#2{% + \egroup + \noalign{\bgroup\aftergroup\collectbox@afternoalign#2}% +} +\def\collectbox@afternoalign{% + \expandafter\collectbox@@afternoalign + \romannumeral-`0% +} +\def\collectbox@@afternoalign{% + \@ifnextchar\egroup{\egroup\collectbox@aftertab}{% + \ifx\@let@token\noalign + \expandafter\collectbox@handlenextnoalign + \else + \expandafter\egroup + \fi + }% +} +\def\collectbox@aftertab{% + \collectbox@endtabenv + \afterassignment\collectbox@codeafter + \let\@let@token=% +} \endinput %% %% End of file `collectbox.sty'. diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 0a0f3c54073..afe09099d39 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -1972,6 +1972,7 @@ $standardxmt='\.xmt'; 'authorindex' => 'authorindex$', 'bibexport' => 'bibexport\.sh$', 'bundledoc' => '(arlatex|bundledoc)$', + 'ctanupload' => '\.pl$', 'de-macro' => 'de-macro', 'dviasm' => '\.py$', 'ebong' => '\.py$', -- cgit v1.2.3