%% %% This is file `collcell.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% collcell.dtx (with options: `package') %% %% Copyright (C) 2011 by Martin Scharrer %% %% 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 collcell.dtx, collcell.ins %% and the derived file collcell.sty. %% %%^^A $Id: collcell.dtx 2188 2011-02-27 14:22:06Z martin $ \ProvidesPackage{collcell} [2011/02/27 v0.5 Collect the content of a tabular cell] \RequirePackage{array} \def\collcell@beforeuser{\ignorespaces} \def\collcell@afteruser{\unskip} \newif\if@collcell@verb \newif\if@collcell@robustcr \@collcell@robustcrtrue \DeclareOption{verb}{\@collcell@verbtrue} \DeclareOption{noverb}{\@collcell@verbfalse} \DeclareOption{robustcr}{\@collcell@robustcrtrue}% \DeclareOption{norobustcr}{\@collcell@robustcrfalse}% \ProcessOptions\relax \if@collcell@verb \RequirePackage{tabularx} \def\collcell@beforeuser{% \let\collcell@savedverb\verb \let\verb\TX@verb \let\TX@vwarn\collcell@vwarn \ignorespaces }% \def\collcell@afteruser{\unskip\let\verb\collcell@savedverb}% \def\collcell@vwarn{% \PackageWarning{collcell}{\noexpand\verb may be unreliable inside a collected cell}% }% \fi \if@collcell@robustcr \RequirePackage{etoolbox} \robustify\@arraycr \fi \let\collect@cell@toks\@temptokena \newcount\collect@cell@count \newenvironment{collectcell}{}{} \def\collectcell#1#2\ignorespaces{% \begingroup \collect@cell@count\z@ \collect@cell@toks{}% \let\collect@cell@spaces\empty \def\collect@cell@end{% \expandafter\endgroup \expandafter\collcell@beforeuser \expandafter\ccell@swap\expandafter{\the\collect@cell@toks}{#1}% \collcell@afteruser }% \collect@cell@look#2% } \def\ccell@swap#1#2{#2{#1}} \def\endcollectcell{\@gobble{endcollectcell}} \def\collect@cell@look{% \futurelet\collect@cell@lettoken\collect@cell@look@ } \@firstofone{\def\collect@cell@eatspace} {\collect@cell@look} \def\collect@cell@look@{% \cc@case \@sptoken{% \edef\collect@cell@spaces{\collect@cell@spaces\space}% \collect@cell@eatspace }% \bgroup{\collect@cell@group}% \default{\collect@cell@arg}% \endcc@case } \def\collect@cell@group#1{% \begingroup \edef\@tempa{\unexpanded{#1}}% \def\@tempb{\bgroup}% \ifx\@tempa\@tempb \endgroup \collect@cell@addarg{#1}% \else \endgroup \collect@cell@addarg{{#1}}% \fi \collect@cell@look } \def\collect@cell@addarg#1{% \expandafter\expandafter\expandafter\collect@cell@toks \expandafter\expandafter\expandafter {\expandafter\the\expandafter\collect@cell@toks\collect@cell@spaces#1}% \let\collect@cell@spaces\empty } \def\collect@cell@addcc#1{% \collect@cell@addarg{#1}% \begingroup \collect@cell@toks{}% \collect@cell@look } \def\collect@cell@checkcsname#1\endcsname{% \begingroup \expandafter\ccell@swap\expandafter {\expandafter,\@currenvir,endtabular,endtabular*,array,tabularx,}% {\in@{,#1,}}% \ifin@ \endgroup \expandafter\@firstoftwo \else \endgroup \expandafter\@secondoftwo \fi {\collect@cell@cr\\\csname#1\endcsname}% {\collect@cell@addarg{\csname#1\endcsname}\collect@cell@look}% } \def\collect@cell@checkend#1{% \begingroup \def\@tempa{#1}% \ifx\@tempa\@currenvir \endgroup \expandafter\@firstoftwo \else \endgroup \expandafter\@secondoftwo \fi {\collect@cell@cr\\\end{#1}}% {\collect@cell@addarg{\end{#1}}\collect@cell@look}% } \def\cc@iftoken#1{% \ifx#1\collect@cell@lettoken \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi } \def\cc@case{% \begingroup \let\default= \collect@cell@lettoken \cc@@case } \def\cc@@case#1{% \ifx#1\collect@cell@lettoken \expandafter\cc@@truecase \else \expandafter\cc@@falsecase \fi } \def\cc@@truecase#1#2\endcc@case{\endgroup#1} \def\cc@@falsecase#1{\cc@@case} \newcommand*\ccunskip{} \protected\def\ccunskip{\unskip} \newcommand*\cci{} \protected\def\cci{} \def\collect@cell@cr{% \iffalse{\fi \let\collcell@realcr\cr \def\cr{% \expandafter \collect@cell@look \collcell@realcr }% \iffalse}\fi } \def\collect@cell@arg#1{% \cc@case \\{\collect@cell@cr#1}% \end{\collect@cell@checkend}% \csname{\collect@cell@checkcsname}% \unskip{% \let\collect@cell@spaces\empty %\collect@cell@addarg{#1}% do not include the \unskip \collect@cell@look% }% \@sharp{% \expandafter\collect@cell@addarg\expandafter{#1}% \collect@cell@look }% \collectcell{% \advance\collect@cell@count by \@ne \collect@cell@addcc% }% \endcollectcell{% \ifnum\collect@cell@count=\z@ \expandafter\collect@cell@end \else \expandafter\endgroup \expandafter\collect@cell@addarg\expandafter {\expandafter{\the\collect@cell@toks}}% \advance\collect@cell@count by \m@ne% \expandafter\collect@cell@look \fi }% \cci{% \collect@cell@look }% \default{% \expandafter\ccell@swap\expandafter {\csname endtabular*\endcsname\endtabular\endarray}{\in@{#1}}% \ifin@ \expandafter\@firstoftwo \else \expandafter\@secondoftwo \fi {\collect@cell@cr\\#1}% {% \collect@cell@addarg{#1}% \collect@cell@look }% }% \endcc@case } \endinput %% %% End of file `collcell.sty'.