diff options
author | Karl Berry <karl@freefriends.org> | 2011-01-19 00:46:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-01-19 00:46:27 +0000 |
commit | c79fbe30044b8ebdfbca7d2b53744a8e38839900 (patch) | |
tree | 2138d639860159b83a586a2cc5a92c65474b95ba /Master/texmf-dist/tex/latex/tabu | |
parent | 1c296282898b92c5bfb391b443223e04241f5ef1 (diff) |
tabu 2.0 (17jan11)
git-svn-id: svn://tug.org/texlive/trunk@21114 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tabu')
-rw-r--r-- | Master/texmf-dist/tex/latex/tabu/tabu.sty | 390 |
1 files changed, 285 insertions, 105 deletions
diff --git a/Master/texmf-dist/tex/latex/tabu/tabu.sty b/Master/texmf-dist/tex/latex/tabu/tabu.sty index fe2b5876561..dbeb1e7a15c 100644 --- a/Master/texmf-dist/tex/latex/tabu/tabu.sty +++ b/Master/texmf-dist/tex/latex/tabu/tabu.sty @@ -8,7 +8,22 @@ %% %% This is a generated file. %% -%% tabu : 2011/01/15 v1.9 - tabu : Flexible LaTeX tabulars +%% tabu : 2011/01/25 v2.0 - tabu : Flexible LaTeX tabulars +%% +%% ******************************************************* +%% \begin{tabu} to <dimen>{ preamble } +%% \begin{tabu} spread <dimen>{ preamble } +%% +%% Default target: \linewidth or \linegoal: +%% +%% \tabulinesep=2pt +%% +%% \begin{tabu} { |[3pt red] X[4c] X[1c] X[-2ml] |[3pt blue] } +%% \tabucline[3pt on 2pt, cyan]- +%% one & two & three +%% \\ \tabucline[3pt yellow]- +%% \end{tabu} +%% ******************************************************* %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -21,11 +36,10 @@ %% tabu.sty, tabu.pdf, tabu.ins %% %% tabu : Flexible LaTeX tabulars -%% Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr> +%% lppl copyright 2010-2011 by FC <florent.chervet@free.fr> %% - \NeedsTeXFormat{LaTeX2e}[2005/12/01] -\ProvidesPackage{tabu}[2011/01/15 v1.9 - flexible LaTeX tabulars (FC)] +\ProvidesPackage{tabu}[2011/01/25 v2.0 - flexible LaTeX tabulars (FC)] \RequirePackage{array}[2008/09/09] \RequirePackage{varwidth}[2009/03/30] \AtEndOfPackage{\tabu@AtEnd\let\tabu@AtEnd\@undefined} @@ -41,21 +55,29 @@ \TMP@EnsureCode{124}{12}% | \TMP@EnsureCode{0}{12}% ^^@ \TMP@EnsureCode{36}{3}% $ = math shift -\let\tabu@message \@gobble -\let\tabu@message@save \@gobble -\let\tabu@debug \@gobble -\let\tabu@timerstart \relax -\def\tracingtabu{% - \let\tabu@message \message - \let\tabu@message@save \tabu@tracing@save - \ifdefined \pdfelapsedtime - \def\tabu@timerstart{\edef\tabu@starttime{\the\pdfelapsedtime}}% - \let\tabu@elapsedtime \tabu@message@etime\fi - \@ifnextchar={\tabu@tracing}{}} -\def\tabu@tracing{\begingroup\afterassignment\tabu@tr@cing\count@} -\def\tabu@tr@cing{\expandafter\endgroup\ifnum\count@>\@ne - \let\tabu@debug\message\else\let\tabu@debug\@gobble\fi} -\DeclareOption{debugshow}{\AtEndOfPackage{\tracingtabu\relax}} +\def\tracingtabu{\begingroup\@ifnextchar=% + {\afterassignment\tabu@tracing\count@} + {\afterassignment\tabu@tracing\count@1\relax}} +\def\tabu@tracing{\expandafter\endgroup + \expandafter\tabu@tr@cing\number\count@\@nil +}% \tabu@tracing +\def\tabu@tr@cing #1\@nil{% + \ifnum#1>\z@ + \let\tabu@message \message \let\tabu@message@save \tabu@tracing@save + \ifdefined \pdfelapsedtime + \def\tabu@timerstart {\edef\tabu@starttime{\the\pdfelapsedtime}}% + \let\tabu@elapsedtime \tabu@message@etime \fi + \ifnum#1>\@ne \let\tabu@debug \message + \else \let\tabu@debug \@gobble \fi + \else + \let\tabu@message \@gobble + \let\tabu@message@save \@gobble + \let\tabu@debug \@gobble + \let\tabu@timerstart \relax + \fi +}% \tabu@tr@cing +\tracingtabu=\z@ +\DeclareOption{debugshow}{\AtEndOfPackage{\tracingtabu=2\relax}} \let\tabudefaulttarget \linewidth \DeclareOption{linegoal}{% \AtEndOfPackage{% @@ -70,7 +92,7 @@ \let\tabu@prepnext@tok \prepnext@tok \let\tabu@save@decl \save@decl \let\tabu@rowfont \tabu@norowfont \let\tabucline \tabu@nocline \let\tabu@firstcline \relax \let\tabu@lines \relax - \let\tabu@setup@everycr\relax + \let\tabu@setup@everycr\relax \let\tabu@multicolumn \multicolumn } } \def\tabu@norowfont{\PackageError{tabu} @@ -86,7 +108,15 @@ \@ifpackageloaded{arydshln}{} {\let\tabu@adl@fix \relax \let\tabu@adl@endTRIAL \@empty}% \@ifpackageloaded{longtable}{}{\let\longtabu \tabu@nolongtabu}% + \@ifpackageloaded{cellspace} \tabu@warn@cellspace \relax } +\def\tabu@warn@cellspace{% + \PackageWarning{tabu}{% + Package cellspace has some limitations \MessageBreak + And redefines some macros of array.sty.\MessageBreak + Please use \string\tabulinesep\space to control\MessageBreak + vertical spacing of lines inside tabu environnement}% +}% \tabu@warn@cellspace \newcount \tabu@cnt \newcount \tabu@nbcols \newcount \tabu@X@cols @@ -99,6 +129,10 @@ \newdimen \tabucolX \newdimen \tabu@X@sum \newdimen \tabucolX@error \tabucolX@error=1em +\newdimen \abovetabulinesep +\newdimen \belowtabulinesep +\newdimen \extrarowdepth +\newdimen \tabustrutrule \tabustrutrule \z@ \newif \iftabu@measuring \newif \iftabu@spread \newif \iftabu@firstcline @@ -171,9 +205,20 @@ \NC@find \tabu@rewritemiddle }% NC@rewrite@\tabu@rewritefirst \def\tabu@savepreamble{% - \gdef\tabu@global@temp{}% \NC@list\expandafter{\tabu@NC@list}% \let\tabu@savedpreamble \@preamble + \ifdim \tabustrutrule>\z@ + \setbox\@arstrutbox\hbox{\vrule + \@height \ht\@arstrutbox + \@width \tabustrutrule + \@depth \dp\@arstrutbox}% + \fi + \ifdim \extrarowdepth>\z@ + \setbox\@arstrutbox\hbox{\vrule + \@height \ht\@arstrutbox + \@width \tabustrutrule + \@depth \dimexpr\dp\@arstrutbox+\arraystretch\extrarowdepth}% + \fi }% \tabu@savepreamble \tabu@newcolumntype \tabu@rewritemiddle{% \NC@list\expandafter{\tabu@NC@list \NC@do\tabu@endrewrite \NC@do\tabu@rewritelast}% @@ -229,6 +274,23 @@ \global\let#1\tabu@global@X \aftergroup\let \aftergroup\tabu@global@X \aftergroup#1% }% \tabu@global@Xnested +\tabu@newcolumntype \tabu@rewrite@multicolumn{% + \aftergroup\endgroup % after \@mkpream group (restores \multispan) + \tabu@lines + \ifcat$\d@llarend\else + \let\save@decl \tabu@save@decl \fi % no inversion of tokens in text mode + \NC@find +}% \tabu@rewrite@multicolumn +\def\tabu@multicolumn{% + \expandafter\ifx\csname\@currenvir\endcsname\tabu + \expandafter\tabu@multic@lumn + \else \expandafter\tabu@multicolumnORI + \fi +}% \tabu@multicolumn +\def\tabu@multic@lumn#1#2{\multispan{#1}\begingroup + \NC@list{\NC@do \tabu@rewrite@multicolumn}\let\multispan \@gobble + \tabu@multicolumnORI{#1}{\tabu@rewrite@multicolumn #2}% +}% \tabu@multic@lumn \newif\iftabu@colortbl \def\tabu@nowrite#1#{{\afterassignment}\toks@} \let\tabu@write\write @@ -262,6 +324,8 @@ \advance\tabu@nested \@ne \def\tabu@aligndefault{t}\let\tabudefaulttarget \linewidth \else \tabu@timerstart + \let\tabu@multicolumnORI \multicolumn + \let\multicolumn \tabu@multicolumn \def\tabu@aligndefault{c}\edef\tabu@hfuzz {\the\hfuzz}% \global\tabu@footnotes{}\aftergroup\the\aftergroup\tabu@footnotes \ifdim\parindent>\z@ \ifx\linewidth\tabudefaulttarget @@ -273,6 +337,11 @@ }% \fi\fi \fi + \ifcase 0\ifdim\abovetabulinesep>\z@ 1\else\ifdim\belowtabulinesep>\z@ 1\fi\fi + \let\tabu@celllalign \@empty \let\tabu@cellralign \@empty + \else \def\tabu@celllalign{\tabu@verticalmeasure}% + \def\tabu@cellralign{\tabu@verticalspacing}% + \fi \let\@footnotetext \tabu@footnotetext \let\@xfootnotetext \tabu@xfootnotetext \let\@xfootnote \tabu@xfootnote \let\centering \tabu@centering \let\raggedright \tabu@raggedright \let\raggedleft \tabu@raggedleft @@ -328,8 +397,8 @@ }% \tabu@@begin \def\tabu@preparesave #1{% \iftabu@colortbl \@temptokena{}% - \tabu@prepare@save\CT@arc@ - \tabu@prepare@save\CT@drsc@ + \tabu@prepare@save \CT@arc@ + \tabu@prepare@save \CT@drsc@ \fi \edef\tabu@savedparam{% \ifmmode \col@sep \the\arraycolsep @@ -337,6 +406,7 @@ \arrayrulewidth \the\arrayrulewidth\relax \doublerulesep \the\doublerulesep\relax \extrarowheight \the\extrarowheight\relax + \extrarowdepth \the\extrarowdepth\relax \extratabsurround \the\extratabsurround\relax \def\noexpand\arraystretch {\arraystretch}% \iftabu@colortbl \minrowclearance\the\minrowclearance\relax @@ -459,24 +529,28 @@ \if l\@let@token 4\else \if c\@let@token 5\else \if r\@let@token 6\else - \if L\@let@token 7\else - \if C\@let@token 8\else - \if R\@let@token 9\else - \ifx \@sptoken\@let@token 10\else - \if .\@let@token 11\else - \if -\@let@token 11\else - \ifcat $\@let@token 12\else - 13\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax + \if j\@let@token 7\else + \if L\@let@token 8\else + \if C\@let@token 9\else + \if R\@let@token 10\else + \if J\@let@token 11\else + \ifx \@sptoken\@let@token 12\else + \if .\@let@token 13\else + \if -\@let@token 13\else + \ifcat $\@let@token 14\else + 15\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax \tabucolX@do \expandafter \remove@to@nnil \or \tabu@Xtype {p}% \or \tabu@Xtype {m}% \or \tabu@Xtype {b}% - \or \tabu@Xalign \raggedright - \or \tabu@Xalign \centering - \or \tabu@Xalign \raggedleft - \or \tabu@Xalign \RaggedRight - \or \tabu@Xalign \Centering - \or \tabu@Xalign \RaggedLeft + \or \tabu@Xalign \raggedright\relax + \or \tabu@Xalign \centering\relax + \or \tabu@Xalign \raggedleft\relax + \or \tabu@Xalign \tabu@justify\relax + \or \tabu@Xalign \RaggedRight\raggedright + \or \tabu@Xalign \Centering\centering + \or \tabu@Xalign \RaggedLeft\raggedleft + \or \tabu@Xalign \justifying\tabu@justify \or \expandafter \tabu@Xparsespace \or \expandafter \tabu@Xcoef \or \let\tabu@Xmath=$\expandafter \tabu@Xparse @@ -484,10 +558,12 @@ \else\expandafter \tabu@Xparse \fi }% \tabu@Xtest -\def\tabu@Xalign#1{% +\def\tabu@Xalign#1#2{% \ifx \tabucolX@align\@empty \else \PackageWarning{tabu} {Duplicate horizontal alignment specification}\fi - \def\tabucolX@align{#1}\expandafter\tabu@Xparse + \ifdefined#1\def\tabucolX@align{#1}\else + \def\tabucolX@align{#2}\fi + \expandafter\tabu@Xparse }% \tabu@Xalign \def\tabu@Xtype#1{% \ifx \tabucolX@rw\@empty \else \PackageWarning{tabu} @@ -553,6 +629,8 @@ \let\write \tabu@nowrite \let\GenericError \tabu@GenericError \long\def\@xfootnote[##1]##2{}\let\@footnotetext \@gobble \ifx\@arrayright\relax \let\@arrayright \@empty\fi + \let\tabu@verticalmeasure \@empty + \let\tabu@verticalspacing \@empty \tabu@TRIAL@hook }% \tabu@setup@TRIAL \def\tabu@savecounters{% @@ -564,6 +642,9 @@ \def\tabu@arrayleftmeasure#1\bgroup{% \def\tabu@Xfinish{% \tabu@global@Xnested \ifnum0=`{}\fi\endgroup + \ifdim \abovetabulinesep>\z@ \setbox\@arstrutbox\box\voidb@x + \else\ifdim\belowtabulinesep>\z@ \setbox\@arstrutbox\box\voidb@x + \fi\fi \tabu@global@X #1\bgroup}% \def\tabu@TRIAL {\setbox\tabu@box \hbox\bgroup $#1\bgroup \the\toks@ \tabu@endTRIAL}% @@ -767,6 +848,7 @@ \def\arrayrulewidth ####1\relax{(tabu) arrayrulewidth #1 = ####1^^J}% \def\doublerulesep ####1\relax {(tabu) doublerulesep #1 #1= ####1^^J}% \def\extrarowheight ####1\relax{(tabu) extrarowheight #1 = ####1^^J}% + \def\extrarowdepth ####1\relax {(tabu) extrarowdepth #1 #1= ####1^^J}% \def\extratabsurround ####1\relax{(tabu) extratabsurround = ####1^^J}% \def\minrowclearance ####1\relax {(tabu) minrowclearance#1 = ####1^^J}% \def\arraystretch ####1{(tabu) arraystretch #1 #1 = ####1^^J}% @@ -807,13 +889,16 @@ }\x \setbox\tabu@box=\hbox\bgroup \let\tabu@rewrite@X \tabu@@rewrite@X + \tabu@nocellspace \begin{varwidth}{\tabu@temp}\narrowragged\arraybackslash \tabu@noadjustspacing \parfillskip\@flushglue \bgroup \aftergroup\tabu@measure@endpbox + \ifdefined \cellspacetoplimit \bgroup\color@begingroup\fi \else \expandafter\@gobble\@startpbox{#1}% \@gobble \bgroup \fi }% \tabu@measure@startpbox +\def\tabu@nocellspace{\def\bcolumn##1\@nil{}\let\ecolumn\@empty} \ifdefined\pdfadjustspacing \def\tabu@noadjustspacing{\pdfadjustspacing\z@}% \else @@ -899,7 +984,14 @@ \iftabu@colortbl\begingroup\noexpand\CT@arc@\fi \noexpand\tabu@vline\arrayrulewidth \iftabu@colortbl\endgroup\fi}}% - \else \futurelet \tabu@temp \tabuvline@argi #1\p@\p@\@nnil \tabuvline@argiii + \else + \ifcsname tabu@line@style@\detokenize {#1}\endcsname + \def\tabu@temp##1\relax##2\relax{##1}% + \expandafter\tabu@temp\romannumeral-`\q + \csname tabu@line@style@\detokenize {#1}\endcsname + \tabuvline@argiii + \else \futurelet \tabu@temp \tabuvline@argi #1\p@\p@\@nnil \tabuvline@argiii + \fi \fi }% \tabuvline@arg \def\tabuvline@argi{% @@ -971,7 +1063,7 @@ \ifnum\tabu@stop>\tabu@nbcols \tabu@stop \tabu@nbcols \else \ifnum\tabu@stop<\@ne \tabu@stop \tabu@nbcols\fi\fi }% \tabu@start@stop -\def\tabu@getlinespec#1{\let\tabu@xleaders \relax +\def\tabu@getlinespec#1{\let\tabu@xleaders \relax \let\tabu@color \@empty \@defaultunits \let\@tempa=#1 \relax\@nnil \ifx\@tempa\relax \let\tabu@xleaders \tabu@defaultleaders\else \ifx\@tempa\hbox \tabu@defleaders{#1}\else @@ -993,7 +1085,6 @@ \def\tabu@maybecolor{\ifx\tabu@color\@empty \afterassignment\tabu@colortest \else \@defaultunits\fi} \def\tabu@lineon #1on#2\@nil#3\@nnil#4{% - \let\tabu@color \@empty \@defaultunits \let\@tempa=#1 \relax\@nnil \ifcase 0\ifx o\@tempa 1\else\ifcat A\noexpand\@tempa 2\fi\fi\relax \tabu@maybecolor \@tempdima #1\arrayrulewidth \p@\@nnil @@ -1059,10 +1150,13 @@ \def\tabulinestyle#1{\@for\@tempa:=#1\do {\expandafter\tabu@linestyle\@tempa==\@nil}} \def\tabu@linestyle#1=#2=#3\@nil{% - \begingroup \tabu@getlinespec {#2}\expandafter\gdef - \csname tabu@line@style@\detokenize{#1}\expandafter\endcsname - \expandafter{\expandafter\def\expandafter\tabu@xleaders - \expandafter{\tabu@xleaders}}% + \begingroup \tabu@getlinespec {#2}% + \toks@\expandafter{\tabu@xleaders}% + \@temptokena\expandafter{\tabu@color}% + \expandafter\xdef\csname tabu@line@style@\detokenize{#1}\endcsname + {\@tempdima\the\@tempdima + \def\noexpand\tabu@color{\the\@temptokena}\relax + \def\noexpand\tabu@xleaders{\the\toks@}\relax}% \endgroup }% \tabu@linestyle \expandafter\def \csname tabu@line@style@\endcsname {% @@ -1145,6 +1239,84 @@ \expandafter\tabu@decimal\expandafter{\the\@temptokena}% \fi\fi }% \tabu@printdecimal +\def\extrarowsep{\edef\tabu@C@rowsep{\the\numexpr\tabu@C@rowsep+1}% + \aftergroup\tabu@Growsep + \afterassignment\tabu@setrowsep \extrarowheight +}% \extrarowsep +\def\tabu@setrowsep{% + \extrarowdepth\extrarowheight + \tabu@Gsave \tabu@G@rowsep \tabu@C@rowsep \extrarowheight \extrarowdepth +}% \tabu@setrowsep +\def\tabu@Growsep{\ifx \tabu@G@rowsep\@empty \else \tabu@Rrowsep\fi} +\def\tabu@Rrowsep{\tabu@Grestore \tabu@G@rowsep \tabu@C@rowsep} +\let\tabu@C@rowsep \z@ +\let\tabu@G@rowsep \@empty +\def\tabulinesep{\edef\tabu@C@linesep{\the\numexpr\tabu@C@linesep+1}% + \aftergroup\tabu@Glinesep + \afterassignment\tabu@setlinesep \abovetabulinesep +}% \tabulinesep +\def\tabu@setlinesep{% + \belowtabulinesep\abovetabulinesep + \tabu@Gsave \tabu@G@linesep \tabu@C@linesep \abovetabulinesep \belowtabulinesep +}% \tabu@setlinesep +\def\tabu@Glinesep{\ifx \tabu@G@linesep\@empty \else \tabu@Rlinesep\fi} +\def\tabu@Rlinesep{\tabu@Grestore \tabu@G@linesep \tabu@C@linesep} +\let\tabu@C@linesep \z@ +\let\tabu@G@linesep \@empty +\def\tabu@Gsave #1#2#3#4{\xdef#1{#1% + \toks#2{\toks\the\currentgrouplevel{\global#3\the#3\global#4\the#4}}}% +}% \tabu@Gsave +\def\tabu@Grestore#1#2{\begingroup + \toks#2{}#1\toks\currentgrouplevel\expandafter{\expandafter}\the\toks#2\relax + \ifcat$\the\toks\currentgrouplevel$\else + \global\let#1\@empty \global\let#2\z@ + \fi + \expandafter\endgroup + \the\toks\currentgrouplevel +}% \tabu@Grestore +\def\tabu@verticalmeasure{% + \ifnum \currentgrouptype>12 + \begingroup\lrbox\tabu@box \d@llarbegin + \let\tabu@verticalspacing \tabu@verticalsp@lcr + \else + \setbox\tabu@box + \ifnum \currentgrouptype=5\vtop\else\vbox\fi \bgroup + \everypar{}\let\@finalstrut \@gobble + \let\tabu@verticalspacing \tabu@verticalsp@pmb + \fi +}% \tabu@verticalmeasure +\def\tabu@verticalsp@lcr{% adjust \ht \tabu@box and \dp \tabu@box + \d@llarend\endlrbox\endgroup + \@tempdima \dimexpr \ht\@arstrutbox -\ht\tabu@box \relax + \@tempdimb \dimexpr \dp\@arstrutbox -\dp\tabu@box \relax + \ifdim \@tempdima<\abovetabulinesep + \ht\tabu@box=\dimexpr \ht\tabu@box+\abovetabulinesep\relax \fi + \ifdim \@tempdimb<\belowtabulinesep + \dp\tabu@box=\dimexpr \dp\tabu@box+\belowtabulinesep \relax \fi + \leavevmode \box\tabu@box +}% \tabu@verticalsp@lcr +\def\tabu@verticalsp@pmb{% inserts struts as needed + \par \expandafter\egroup + \expandafter\@tempdimc \the\prevdepth + \@tempdima \dimexpr \ht\@arstrutbox -\ht\tabu@box \relax + \@tempdimb \dimexpr \dp\@arstrutbox -\@tempdimc \relax + \ifdim \@tempdima<\abovetabulinesep + \llap {\vrule + \@height \dimexpr\ht\tabu@box+\abovetabulinesep\relax + \@depth -\ht\tabu@box + \@width \tabustrutrule + }\nointerlineskip \vskip-\ht\tabu@box + \fi + \unvbox\tabu@box + \ifdim \@tempdimb<\belowtabulinesep + \llap{\vrule + \@depth \dimexpr \belowtabulinesep \relax + \@height \z@ + \@width \tabustrutrule + }\nointerlineskip%\vskip-\@tempdimc + \let\@finalstrut \@gobble + \fi +}% \tabu@verticalsp@pmb \newcommand*\savetabu[1]{\noalign{% \ifx\\#1\\\tabu@savewarn{}{The tabu will not be saved}\else \@ifundefined{tabu@saved@\string#1}{}{\tabu@savewarn{#1}{Overwritting}}% @@ -1202,11 +1374,13 @@ }% \tabu@savewd \def\tabu@make@arstrutbox{% \@tempdima \ht \strutbox + \@tempdimb \dp \strutbox \advance \@tempdima by\extrarowheight + \advance \@tempdimb by\extrarowdepth \setbox \@arstrutbox \hbox{\vrule \@height \arraystretch \@tempdima - \@depth \arraystretch \dp \strutbox - \@width \z@}% + \@depth \arraystretch \@tempdimb + \@width \z@}% }% \tabu@make@arstrutbox \def\tabu@savewarn#1#2{\PackageInfo{tabu} {User-name `#1' already used for \string\savetabu @@ -1219,9 +1393,11 @@ \global\let\tabu@rowfontreset \tabu@rowfont@reset \global\let\tabu@@cellleft \tabu@cellleft \global\let\tabu@@cellright \tabu@cellright + \global\let\tabu@@celllalign \tabu@celllalign + \global\let\tabu@@cellralign \tabu@cellralign \gdef\tabu@cellfont{\let\color \tabu@colorleavevmode#2\let\color \tabu@colorORI}% - \ifcsname tabu@cell@#1\endcsname % row alignment - \csname tabu@cell@#1\endcsname \fi + \ifcsname tabu@cell@#1\endcsname % row alignment + \csname tabu@cell@#1\endcsname \fi \toks@\expandafter {\tabu@cellleft\tabu@cellfont}% inside \noalign group ok \xdef\tabu@cellleft {\the\toks@}% \ifnum0=`{\fi}% end of noalign group @@ -1234,18 +1410,20 @@ \global\let\tabu@cellleft \tabu@@cellleft \global\let\tabu@cellright \tabu@@cellright \global\let\tabu@cellfont \@empty - \global\let\tabu@celllalign \@empty - \global\let\tabu@cellralign \@empty + \global\let\tabu@celllalign \tabu@@celllalign + \global\let\tabu@cellralign \tabu@@cellralign }% }% \tabu@rowfont@reset -\let\tabu@rowfontreset\@empty +\let\tabu@rowfontreset \@empty \newif\iftabu@cellright \AtBeginDocument{\let\tabu@prepnext@tokORI \prepnext@tok }% original definition \def\tabu@prepnext@tok{% \ifnum \count@<\z@ % <first initialisation> \@tempcnta \@M % <not initialized by array.sty> \tabu@nbcols\z@ - \xdef\tabu@global@temp{\tabu@global@temp \tabu@nbcols\z@}% + \let\tabu@fornoopORI \@fornoop + \expandafter\gdef\expandafter\tabu@global@temp\expandafter{% + \tabu@global@temp\gdef\tabu@global@temp{}\tabu@nbcols\z@}% \expandafter\let\csname tabu@tok@1L\endcsname \relax \tabu@cellrightfalse \else @@ -1262,6 +1440,7 @@ \tabu@preptokenleft \or % (case 1) previous token is right \tabu@savetok R\tabu@cellrighttrue + \let\@fornoop \tabu@lastnoop \else % special column: do not change the token \ifnum \tabu@nbcols>\z@ %special column: always on the right of normal one \tabu@savetok R% @@ -1276,13 +1455,15 @@ \fi \tabu@prepnext@tokORI }% \tabu@prepnext@tok +\long\def\tabu@lastnoop#1\@@#2#3{\in@\@nextchar{#2}% + \ifin@ \let\@fornoop \tabu@fornoopORI \expandafter\prepnext@tok \fi} \def\tabu@preptokenright{% \advance \count@ \m@ne \toks\count@\expandafter {\the\toks\count@ \tabu@cellright \tabu@cellralign}% \advance \count@ \@ne }% \tabu@preptokenright -\def\tabu@preptokenleft{\toks\count@\expandafter {\expandafter\tabu@celllalign - \the\toks\count@ \tabu@cellleft}% +\def\tabu@preptokenleft{\toks\count@\expandafter{\expandafter\tabu@celllalign + \the\toks\count@ \tabu@cellleft}% }% \tabu@preptokenleft \def\tabu@savetok#1{\begingroup \expandafter\tabu@savet@k\csname tabu@tok@\the\tabu@nbcols #1\endcsname @@ -1300,40 +1481,42 @@ \xdef\tabu@global@temp {\the\@temptokena \the\toks@}% \expandafter\endgroup \the\toks@ }% \tabu@savetok -\let\tabu@cellleft\@empty -\let\tabu@cellright\@empty -\def\tabu@celllalign{\tabu@cellleft}% row font spec. applies to pre-column material -\let\tabu@cellralign\@empty -\let\tabu@cellfont\@empty -\def\tabu@cell@l{% force alignment to left - \gdef\tabu@celllalign{\tabu@removehfil - \raggedright\arraybackslash - \tabu@cellleft}% - \gdef\tabu@cellralign{\tabu@flush1\tabu@ignorehfil}% - \toks@\expandafter{\tabu@cellleft\raggedright\arraybackslash}% local +\let\tabu@cellleft \@empty +\let\tabu@cellright \@empty +\def\tabu@celllalign {\tabu@cellleft}% row font spec. applies to pre-column material +\let\tabu@cellralign \@empty +\let\tabu@cellfont \@empty +\def\tabu@cell@align #1#2#3{% + \toks@\expandafter{\tabu@celllalign #1}% + \xdef\tabu@celllalign{\the\toks@}% + \toks@\expandafter{\tabu@cellralign #2}% + \xdef\tabu@cellralign{\the\toks@}% + \toks@\expandafter{\tabu@cellleft #3}% \xdef\tabu@cellleft{\the\toks@}% +}% \tabu@cell@align +\def\tabu@cell@l{% force alignment to left + \tabu@cell@align + {\tabu@removehfil \raggedright \tabu@cellleft}% left + {\tabu@flush1\tabu@ignorehfil}% right + \raggedright }% \tabu@cell@l \def\tabu@cell@c{% force alignment to center - \gdef\tabu@celllalign{\tabu@removehfil - \centering\arraybackslash - \tabu@flush{.5}\tabu@cellleft}% - \gdef\tabu@cellralign{\tabu@flush{.5}\tabu@ignorehfil}% - \toks@\expandafter{\tabu@cellleft\centering\arraybackslash}% local - \xdef\tabu@cellleft{\the\toks@}% + \tabu@cell@align + {\tabu@removehfil \centering \tabu@flush{.5}\tabu@cellleft} + {\tabu@flush{.5}\tabu@ignorehfil} + \centering }% \tabu@cell@c \def\tabu@cell@r{% force alignment to right - \gdef\tabu@celllalign{\tabu@removehfil - \raggedleft\arraybackslash - \tabu@flush1\tabu@cellleft}% - \gdef\tabu@cellralign{\tabu@ignorehfil}% - \toks@\expandafter{\tabu@cellleft\raggedleft\arraybackslash}% local - \xdef\tabu@cellleft{\the\toks@}% + \tabu@cell@align + {\tabu@removehfil \raggedleft \tabu@flush1\tabu@cellleft} + \tabu@ignorehfil + \raggedleft }% \tabu@cell@r \def\tabu@cell@j{% force justification (for p, m, b columns) - \gdef\tabu@celllalign{\tabu@justify\tabu@cellleft}% - \global\let\tabu@cellralign\@empty - \toks@\expandafter{\tabu@cellleft\tabu@justify}% local (noalign grp) - \xdef\tabu@cellleft{\the\toks@}% + \tabu@cell@align + {\tabu@justify\tabu@cellleft} + {} + \tabu@justify }% \tabu@cell@j \def\tabu@justify{% \leftskip\z@skip \@rightskip\leftskip \rightskip\@rightskip @@ -1341,34 +1524,31 @@ }% \tabu@justify %% ragged2e settings \def\tabu@cell@L{% force alignment to left (ragged2e) - \gdef\tabu@celllalign{\tabu@removehfil - \RaggedRight\arraybackslash - \tabu@cellleft}% - \gdef\tabu@cellralign{\tabu@flush1\tabu@ignorehfil}% - \toks@\expandafter{\tabu@cellleft\RaggedRight\arraybackslash}% - \xdef\tabu@cellleft{\the\toks@}% + \tabu@cell@align + {\tabu@removehfil \RaggedRight \arraybackslash + \tabu@cellleft} + {\tabu@flush1\tabu@ignorehfil} + {\RaggedRight \arraybackslash}% }% \tabu@cell@L \def\tabu@cell@C{% force alignment to center (ragged2e) - \gdef\tabu@celllalign{\tabu@removehfil - \Centering\arraybackslash - \tabu@flush{.5}\tabu@cellleft}% - \gdef\tabu@cellralign{\tabu@flush{.5}\tabu@ignorehfil}% - \toks@\expandafter{\tabu@cellleft\Centering\arraybackslash}% - \xdef\tabu@cellleft{\the\toks@}% + \tabu@cell@align + {\tabu@removehfil \Centering \arraybackslash + \tabu@flush{.5}\tabu@cellleft} + {\tabu@flush{.5}\tabu@ignorehfil} + {\Centering \arraybackslash}% }% \tabu@cell@C \def\tabu@cell@R{% force alignment to right (ragged2e) - \gdef\tabu@celllalign{\tabu@removehfil - \RaggedLeft\arraybackslash - \tabu@flush1\tabu@cellleft}% - \gdef\tabu@cellralign{\tabu@ignorehfil}% - \toks@\expandafter{\tabu@cellleft\RaggedLeft\arraybackslash}% - \xdef\tabu@cellleft{\the\toks@}% + \tabu@cell@align + {\tabu@removehfil \RaggedLeft \arraybackslash + \tabu@flush1\tabu@cellleft} + {\tabu@ignorehfil} + {\RaggedLeft \arraybackslash}% }% \tabu@cell@R \def\tabu@cell@J{% force justification (ragged2e) - \gdef\tabu@celllallign{\justifying\arraybackslash\tabu@cellleft}% - \global\let\tabu@cellralign\@empty - \toks@\expandafter{\tabu@cellleft\justifying\arraybackslash}% - \xdef\tabu@cellleft{\the\toks@}% + \tabu@cell@align + {\justifying \arraybackslash \tabu@cellleft} + {} + {\justifying \arraybackslash}% }% \tabu@cell@J \def\tabu@flush#1{% \iftabu@colortbl % colortbl uses \hfill rather than \hfil |