From 87c9798fd0683af80bab34cff8a68fc61579c159 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 13 Feb 2011 23:31:01 +0000 Subject: tabu 2.3 (13feb11) git-svn-id: svn://tug.org/texlive/trunk@21389 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/tabu/tabu.sty | 3722 +++++++++++++++++------------ 1 file changed, 2242 insertions(+), 1480 deletions(-) (limited to 'Master/texmf-dist/tex/latex/tabu') diff --git a/Master/texmf-dist/tex/latex/tabu/tabu.sty b/Master/texmf-dist/tex/latex/tabu/tabu.sty index 1c278d8312f..bd642627081 100644 --- a/Master/texmf-dist/tex/latex/tabu/tabu.sty +++ b/Master/texmf-dist/tex/latex/tabu/tabu.sty @@ -7,23 +7,47 @@ %% tabu.dtx (with options: `package') %% %% This is a generated file. +%% Copyright (FC) 2010-2011 - lppl %% -%% tabu : 2011/01/19 v2.1 - tabu : Flexible LaTeX tabulars +%% tabu : 2011/02/13 v2.3 - tabu : Flexible LaTeX tabulars %% -%% ******************************************************* -%% \begin{tabu} to { preamble } -%% \begin{tabu} spread { preamble } +%% ********************************************************************************************** +%% \begin{tabu} { preamble } => default target: \linewidth or \linegoal +%% \begin{tabu} to { preamble } => target specified +%% \begin{tabu} spread { preamble } => target relative to the ``natural width'' %% -%% Default target: \linewidth or \linegoal: +%% tabu works in text and in math modes. %% -%% \tabulinesep=2pt +%% X columns: automatic width ajustment + horizontal and vertical alignment +%% \begin{tabu} { X[4c] X[1c] X[-2ml] } %% -%% \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} -%% ******************************************************* +%% Horizontal lines and / or leaders: +%% \hline\hline => double horizontal line +%% \firsthline\hline => for nested tabulars +%% \lasthline\hline => for nested tabulars +%% \tabucline[line spec]{column-column} => ``funny'' lines (dash/leader) +%% Automatic lines / leaders : +%% \everyrow{\hline\hline} +%% +%% Vertical lines and / or leaders: +%% \begin{tabu} { |[3pt red] X[4c] X[1c] X[-2ml] |[3pt blue] } +%% \begin{tabu} { |[3pt red] X[4c] X[1c] X[-2ml] |[3pt on 2pt off 4pt blue] } +%% +%% Fixed vertical spacing adjustment: +%% \extrarowheight= \extrarowdepth= +%% or: \extrarowsep= => may be prefixed by \global +%% +%% Dynamic vertical spacing adjustment: +%% \abovetabulinesep= \belowtabulinesep= +%% or: \tabulinesep= => may be prefixed by \global +%% +%% delarray.sty shortcuts: in math and text modes +%% \begin{tabu} .... \({ preamble }\) +%% +%% Algorithms reports: +%% \tracingtabu=1 \tracingtabu=2 +%% +%% ********************************************************************************************** %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -39,500 +63,914 @@ %% lppl copyright 2010-2011 by FC %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] -\ProvidesPackage{tabu}[2011/01/19 v2.1 - flexible LaTeX tabulars (FC)] +\ProvidesPackage{tabu}[2011/02/13 v2.3 - flexible LaTeX tabulars (FC)] \RequirePackage{array}[2008/09/09] \RequirePackage{varwidth}[2009/03/30] -\AtEndOfPackage{\tabu@AtEnd\let\tabu@AtEnd\@undefined} +\AtEndOfPackage{\tabu@AtEnd \let\tabu@AtEnd \@undefined} \let\tabu@AtEnd\@empty -\def\TMP@EnsureCode#1#2{% - \edef\tabu@AtEnd{% - \tabu@AtEnd - \catcode#1 \the\catcode#1\relax - }% - \catcode#1 #2\relax +\def\TMP@EnsureCode#1={% + \edef\tabu@AtEnd{\tabu@AtEnd + \catcode#1 \the\catcode#1}% + \catcode#1=% }% \TMP@EnsureCode -\TMP@EnsureCode{33}{12} % ! -\TMP@EnsureCode{124}{12}% | -\TMP@EnsureCode{0}{12}% ^^@ -\TMP@EnsureCode{36}{3}% $ = math shift -\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{% - \RequirePackage{linegoal}[2010/12/07]% - \let\tabudefaulttarget \linegoal% \linegoal is \linewidth if not pdfTeX -}} -\DeclareOption{delarray}{% - \AtEndOfPackage{\RequirePackage{delarray}}% -} -\DeclareOption{light}{% - \AtEndOfPackage{% - \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@multicolumn \multicolumn - } -} -\def\tabu@norowfont{\PackageError{tabu} - {\string\rowfont\space is not available with option `light'}\@ehd} -\def\tabu@nocline{\PackageError{tabu} - {\string\tabucline\space is not available with option `light'}\@ehd} -\ProcessOptions -\AtBeginDocument{% - \expandafter\in@ \expandafter\@arrayright\expandafter{\endarray}% - \ifin@ \let\tabu@endarray \endarray - \else \tabu@fix@arrayright \fi % - \@ifpackageloaded{colortbl} \tabu@colortbltrue \tabu@colortblfalse - \@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 +\TMP@EnsureCode 33 = 12 % ! +\TMP@EnsureCode 58 = 12 % : (for siunitx) +\TMP@EnsureCode124 = 12 % | +\TMP@EnsureCode 36 = 3 % $ = math shift +\TMP@EnsureCode 38 = 4 % & = tab alignmment character +\TMP@EnsureCode 32 = 10 % space +\TMP@EnsureCode 94 = 7 % ^ +\TMP@EnsureCode 95 = 8 % _ +%% Constants -------------------------------------------------------- +\newcount \c@taburow \def\thetaburow {\number\c@taburow} \newcount \tabu@nbcols -\newcount \tabu@X@cols +\newcount \tabu@cnt +\newcount \tabu@Xcol +\let\tabu@start \@tempcnta +\let\tabu@stop \@tempcntb +\newcount \tabu@alloc \tabu@alloc=\m@ne \newcount \tabu@nested -\newcount \tabu@start -\newcount \tabu@stop +\def\tabu@alloc@{\global\advance\tabu@alloc \@ne \tabu@nested\tabu@alloc} \newdimen \tabu@target \newdimen \tabu@spreadtarget \newdimen \tabu@naturalX \newdimen \tabucolX -\newdimen \tabu@X@sum -\newdimen \tabucolX@error \tabucolX@error=1em +\let\tabu@DELTA \@tempdimc +\let\tabu@thick \@tempdima +\let\tabu@on \@tempdimb +\let\tabu@off \@tempdimc +\newdimen \tabu@Xsum +\newdimen \extrarowdepth \newdimen \abovetabulinesep \newdimen \belowtabulinesep -\newdimen \extrarowdepth \newdimen \tabustrutrule \tabustrutrule \z@ +\newtoks \tabu@thebody +\newtoks \tabu@footnotes +\newsavebox \tabu@box +\newsavebox \tabu@arstrutbox +\newsavebox \tabu@hleads +\newsavebox \tabu@vleads +\newif \iftabu@colortbl +\newif \iftabu@siunitx \newif \iftabu@measuring \newif \iftabu@spread \newif \iftabu@negcoef -\newif \iftabu@firstcline \newif \iftabu@everyrow -\def\tabu@everyrowtrue{\global\let\iftabu@everyrow \iftrue} +\def\tabu@everyrowtrue {\global\let\iftabu@everyrow \iftrue} \def\tabu@everyrowfalse{\global\let\iftabu@everyrow \iffalse} -\newsavebox \tabu@box -\chardef \tabu@arstrutbox=\@arstrutbox -\let\tabu@vcenter \vcenter -\def\tabu@gobblespace#1 {#1} -\def\tabu@gobbleopt#1{\@ifnextchar [{\tabu@gobble@pt{#1}}{#1}}%] -\def\tabu@gobble@pt#1[#2]{#1} -\def\tabu@ifenvir {% - \csname @\expandafter\ifx\csname\@currenvir\endcsname\tabu - first\else\expandafter\ifx\csname\@currenvir\endcsname\longtabu - first\else second\fi\fi oftwo\endcsname +\newif \iftabu@long +\newif \iftabuscantokens +\def\tabu@rescan {\tabu@verbatim \scantokens } +%% Utilities (for internal usage) ----------------------------------- +\def\tabu@gobblespace #1 {#1} +\def\tabu@gobbletoken #1#2{#1} +\def\tabu@gobbleX{\futurelet\@let@token \tabu@gobblex} +\def\tabu@gobblex{\if ^^J\noexpand\@let@token \expandafter\@gobble + \else\ifx \@sptoken\@let@token + \expandafter\tabu@gobblespace\expandafter\tabu@gobbleX + \fi\fi +}% \tabu@gobblex +\def\tabu@X{^^J} +{\obeyspaces +\global\let\tabu@spxiii= % saves an active space (for \ifx) +\gdef\tabu@@spxiii{ }} +\def\tabu@ifenvir {% only for \multicolumn + \expandafter\tabu@if@nvir\csname\@currenvir\endcsname }% \tabu@ifenvir -\def\tabu@save@decl{% - \toks\count@ =\expandafter{\the\toks\expandafter\count@ \@nextchar}% -}% \tabu@save@decl -\def\tabu@newcolumntype #1{% - \expandafter\tabu@new@columntype - \csname NC@find@\string#1\expandafter\endcsname - \csname NC@rewrite@\string#1\endcsname - {#1}% -}% \tabu@newcolumntype -\def\tabu@new@columntype #1#2#3{% - \def#1##1#3{\NC@{##1}}% - \let#2\relax \newcommand*#2% -}% \tabu@new@columntype -\def\tabu@privatecolumntype #1{% - \expandafter\tabu@private@columntype - \csname NC@find@\string#1\expandafter\endcsname - \csname NC@rewrite@\string#1\expandafter\endcsname - \csname tabu@NC@find@\string#1\expandafter\endcsname - \csname tabu@NC@rewrite@\string#1\endcsname - {#1}% -}% \tabu@privatecolumntype -\def\tabu@private@columntype#1#2#3#4{% - \g@addto@macro\tabu@privatecolumns{\let#1#3\let#2#4}% - \tabu@new@columntype#3#4% -}% \tabu@private@columntype -\let\tabu@privatecolumns \@empty -\tabu@privatecolumntype X[1][]{\tabu@rewrite@X{#1}% - \let\@halignto \relax - \expandafter \NC@find \tabucolX@rw} -\tabu@privatecolumntype \usetabu [1]{% - \ifx\\#1\\\tabu@saveerr{}\else - \@ifundefined{tabu@saved@\string#1} - {\tabu@saveerr{#1}} - {\let\tabu@rewrite@X \tabu@rewrite@Xrestore - \csname tabu@saved@\string#1\expandafter\endcsname\expandafter\z@}% - \fi -}% \NC@rewrite@\usetabu -\tabu@privatecolumntype \preamble [1]{% - \ifx\\#1\\\tabu@saveerr{}\else - \@ifundefined{tabu@saved@\string#1} - {\tabu@saveerr{#1}} - {\csname tabu@saved@\string#1\expandafter\endcsname\expandafter\@ne}% - \fi -}% \NC@rewrite@\preamble -\tabu@newcolumntype \tabu@rewritefirst{% - \tabu@X@cols \z@ - \let\tabu@dimexpr \relax - \let\tabu@savepreamble \relax - \let\NC@rewrite@X \tabu@NC@rewrite@X - \gdef\tabu@global@temp {\tabu@savepreamble}% - \aftergroup \tabu@global@temp - \let\tabu@islast \relax - \tabu@privatecolumns - \NC@list{\NC@do\usetabu \NC@do\preamble \NC@do *}% - \tabu@lines % defines NC@rewrite@| for tabu only (inside @mkpream group) - \NC@list\expandafter{\the\expandafter\NC@list \expandafter\NC@do \expandafter X% - \tabu@NC@list \NC@do X\NC@do\tabu@rewritemiddle}% - \ifcat$\d@llarend\else - \let\save@decl \tabu@save@decl \fi % no inversion of tokens in text mode - \NC@find \tabu@rewritemiddle -}% NC@rewrite@\tabu@rewritefirst -\def\tabu@savepreamble{% - \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}% - \tabu@checklast -}% \NC@rewrite@\tabu@rewritemiddle -\def\tabu@checklast#1\relax{% - \def\tabu@temp{#1}% - \ifx \tabu@temp\tabu@islast - \expandafter\tabu@lastrewrite - \else \let\tabu@islast \tabu@temp - \expandafter\NC@find \expandafter\tabu@rewritelast - \fi - #1\relax -}% \tabu@checklast -\tabu@newcolumntype \tabu@rewritelast{\NC@find \tabu@endrewrite} -\tabu@newcolumntype \tabu@endrewrite{\tabu@checklast} -\def\tabu@lastrewrite{% - \let\tabu@next \NC@find - \ifx \@halignto\relax % found a X column - \edef\tabu@global@X{\tabu@global@X \tabu@X@cols\the\tabu@X@cols\relax}% - \ifx \tabu@halignto\relax % X column measure - \tabu@global@Xnested - \iftabu@negcoef \aftergroup\tabu@negcoeftrue \fi - \aftergroup \tabu@prep@TRIAL - \else \aftergroup \tabu@setup@everycr - \fi - \else - \aftergroup \tabu@setup@everycr - \ifdim \tabu@target=\z@ \else - \let\tabu@next \tabu@extracolsep \fi % - \fi - \let\@halignto \tabu@halignto - \tabu@next -}% \tabu@lastrewrite -\def\tabu@extracolsep{\futurelet\tabu@temp \tabu@extracol@sep} -\def\tabu@extracol@sep{% - \ifx \tabu@temp\@sptoken - \expandafter\tabu@gobblespace \expandafter\tabu@extracol@sep - \else - {\endlinechar\m@ne\scantokens{\let\x |}% - \expandafter}\ifx \x\tabu@temp - \def\tabu@next {\NC@find @{\extracolsep\@flushglue}}\else - {\endlinechar\m@ne\scantokens{\let\x !}% - \expandafter}\ifx \x\tabu@temp - \def\tabu@next {\NC@find @{\extracolsep\@flushglue}}\else - \def\tabu@next {\NC@find !{\extracolsep\@flushglue}}\fi\fi - \expandafter\tabu@next - \fi -}% \tabu@extracol@sep -\def\tabu@global@Xnested{\expandafter\tabu@global@X@nested - \csname tabu@global@X\the\tabu@nested\endcsname} -\def\tabu@global@X@nested#1{% - \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 \NC@list\expandafter{\the\expandafter\NC@list \tabu@NC@list}% - \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{\tabu@ifenvir \tabu@multic@lumn \tabu@multicolumnORI} -\def\tabu@multic@lumn#1#2{\multispan{#1}\begingroup - \NC@list{\NC@do \tabu@rewrite@multicolumn}% - \expandafter\@gobbletwo % gobbles \multispan{#1} - \tabu@multicolumnORI{#1}{\tabu@rewrite@multicolumn #2}% -}% \tabu@multic@lumn -\newif\iftabu@colortbl -\def\tabu@nowrite#1#{{\afterassignment}\toks@} +\def\tabu@if@nvir #1{\csname @\ifx\tabu#1first\else + \ifx\longtabu#1first\else + second\fi\fi oftwo\endcsname +}% \tabu@ifenvir +\def\tabu@modulo #1#2{\numexpr\ifnum\numexpr#1=\z@ 0\else #1-(#1-(#2-1)/2)/(#2)*(#2)\fi} +{\catcode`\&=3 +\gdef\tabu@strtrim #1{% #1 = control sequence to trim + \ifodd 1\ifx #1\@empty \else \ifx #1\space \else 0\fi \fi + \let\tabu@c@l@r \@empty \let#1\@empty + \else \expandafter \tabu@trimspaces #1\@nnil + \fi +}% \tabu@strtrim +\gdef\tabu@trimspaces #1\@nnil{\let\tabu@c@l@r=#2\tabu@firstspace .#1& }% +\gdef\tabu@firstspace #1#2#3 &{\tabu@lastspace #2#3&} +\gdef\tabu@lastspace #1{\def #3{#1}% + \ifx #3\tabu@c@l@r \def\tabu@c@l@r{\protect\color{#1}}\expandafter\remove@to@nnil \fi + \tabu@trimspaces #1\@nnil} +}% \catcode +\def\tabu@sanitizearg #1#2{{% + \csname \ifcsname if@safe@actives\endcsname % + @safe@activestrue\else + relax\fi \endcsname + \edef#2{#1}\tabu@strtrim#2\@onelevel@sanitize#2% + \expandafter}\expandafter\def\expandafter#2\expandafter{#2}% +}% \tabu@sanitizearg +\def\tabu@textbar #1{\begingroup \endlinechar\m@ne \scantokens{\def\:{|}}% + \expandafter\endgroup \expandafter#1\:% !!! semi simple group !!! +}% \tabu@textbar +\def\tabu@everyrow@bgroup{\iftabu@everyrow \begingroup \else \noalign{\ifnum0=`}\fi \fi} +\def\tabu@everyrow@egroup{% + \iftabu@everyrow \expandafter \endgroup \the\toks@ + \else \ifnum0=`{\fi}% + \fi +}% \tabu@everyrow@egroup +\def\tabu@arstrut {\global\setbox\@arstrutbox \hbox{\vrule + height \arraystretch \dimexpr\ht\strutbox+\extrarowheight + depth \arraystretch \dimexpr\dp\strutbox+\extrarowdepth + width \z@}% +}% \tabu@arstrut +\def\tabu@rearstrut {% + \@tempdima \arraystretch\dimexpr\ht\strutbox+\extrarowheight \relax + \@tempdimb \arraystretch\dimexpr\dp\strutbox+\extrarowdepth \relax + \ifodd 1\ifdim \ht\@arstrutbox=\@tempdima + \ifdim \dp\@arstrutbox=\@tempdimb 0 \fi\fi + \tabu@mkarstrut + \fi +}% \tabu@rearstrut +\def\tabu@@DBG #1{\ifdim\tabustrutrule>\z@ \color{#1}\fi} +\def\tabu@DBG@arstrut {\global\setbox\@arstrutbox + \hbox to\z@{\hbox to\z@{\hss + {\tabu@DBG{cyan}\vrule + height \arraystretch \dimexpr\ht\strutbox+\extrarowheight + depth \z@ + width \tabustrutrule}\kern-\tabustrutrule + {\tabu@DBG{pink}\vrule + height \z@ + depth \arraystretch \dimexpr\dp\strutbox+\extrarowdepth + width \tabustrutrule}}}% +}% \tabu@DBG@arstrut +\def\tabu@save@decl{\toks\count@ \expandafter{\the\toks\expandafter\count@ + \@nextchar}}% +\def\tabu@savedecl{\ifcat$\d@llarend\else + \let\save@decl \tabu@save@decl \fi % no inversion of tokens in text mode +}% \tabu@savedecl +\newcommand*\tabuDisableCommands {\g@addto@macro\tabu@trialh@@k } +\let\tabu@trialh@@k \@empty +\def\tabu@nowrite #1#{{\afterassignment}\toks@} \let\tabu@write\write \let\tabu@immediate\immediate -\protected\def\tabu@GenericError{\begingroup - \def\immediate\write{\aftergroup\endgroup - \tabu@immediate\tabu@write}\tabu@GenericErrorORI}% -\let\tabu@GenericErrorORI \GenericError -\protected\def\tabu@warn{\begingroup +\def\tabu@WRITE{\begingroup \def\immediate\write{\aftergroup\endgroup - \tabu@immediate\tabu@write}\PackageWarning{tabu}} -\def\tabu{% - \ifmmode \def\tabu@{\array}\def\endtabu{\endarray}% - \else \def\tabu@{\tabular}\def\endtabu{\endtabular}\fi - \let\tabu@arrayleft@measure \tabu@arrayleftmeasure - \tabu@setup \tabu@settarget -}% \tabu -\def\longtabu{% + \tabu@immediate\tabu@write}% +}% \tabu@WRITE +\expandafter\def\expandafter\tabu@GenericError\expandafter{% + \expandafter\tabu@WRITE\GenericError} +\def\tabu@warn{\tabu@WRITE\PackageWarning{tabu}} +\def\tabu@noxfootnote [#1]{\@gobble} +\def\tabu@nocolor #1#{\@gobble} +\newcommand*\tabu@norowcolor[2][]{} +\def\tabu@maybesiunitx #1{\def\tabu@temp{#1}% + \futurelet\@let@token \tabu@m@ybesiunitx} +\def\tabu@m@ybesiunitx #1{\def\tabu@m@ybesiunitx {% + \ifx #1\@let@token \let\tabu@cellleft \@empty \let\tabu@cellright \@empty \fi + \tabu@temp}% \tabu@m@ybesiunitx +}\expandafter\tabu@m@ybesiunitx \csname siunitx_table_collect_begin:Nn\endcsname +\def\tabu@celllalign@def #1{\def\tabu@celllalign{\tabu@maybesiunitx{#1}}}% +%% Fixed vertical spacing adjustment: \extrarowsep ------------------ +\newcommand*\extrarowsep{\edef\tabu@C@extra{\the\numexpr\tabu@C@extra+1}% + \iftabu@everyrow \aftergroup\tabu@Gextra + \else \aftergroup\tabu@n@Gextra + \fi + \@ifnextchar={\tabu@gobbletoken\tabu@extra} \tabu@extra +}% \extrarowsep +\def\tabu@extra {\@ifnextchar_% + {\tabu@gobbletoken{\tabu@setextra\extrarowheight \extrarowdepth}} + {\ifx ^\@let@token \def\tabu@temp{% + \tabu@gobbletoken{\tabu@setextra\extrarowdepth \extrarowheight}}% + \else \let\tabu@temp \@empty + \afterassignment \tabu@setextrasep \extrarowdepth + \fi \tabu@temp}% +}% \tabu@extra +\def\tabu@setextra #1#2{\def\tabu@temp{\tabu@extr@#1#2}\afterassignment\tabu@temp#2} +\def\tabu@extr@ #1#2{\@ifnextchar^% + {\tabu@gobbletoken{\tabu@setextra\extrarowdepth \extrarowheight}} + {\ifx _\@let@token \def\tabu@temp{% + \tabu@gobbletoken{\tabu@setextra\extrarowheight \extrarowdepth}}% + \else \let\tabu@temp \@empty + \tabu@Gsave \tabu@G@extra \tabu@C@extra \extrarowheight \extrarowdepth + \fi \tabu@temp}% +}% \tabu@extr@ +\def\tabu@setextrasep {\extrarowheight=\extrarowdepth + \tabu@Gsave \tabu@G@extra \tabu@C@extra \extrarowheight \extrarowdepth +}% \tabu@setextrasep +\def\tabu@Gextra{\ifx \tabu@G@extra\@empty \else {\tabu@Rextra}\fi} +\def\tabu@n@Gextra{\ifx \tabu@G@extra\@empty \else \noalign{\tabu@Rextra}\fi} +\def\tabu@Rextra{\tabu@Grestore \tabu@G@extra \tabu@C@extra} +\let\tabu@C@extra \z@ +\let\tabu@G@extra \@empty +%% Dynamic vertical spacing adjustment: \tabulinesep ---------------- +\newcommand*\tabulinesep{\edef\tabu@C@linesep{\the\numexpr\tabu@C@linesep+1}% + \iftabu@everyrow \aftergroup\tabu@Glinesep + \else \aftergroup\tabu@n@Glinesep + \fi + \@ifnextchar={\tabu@gobbletoken\tabu@linesep} \tabu@linesep +}% \tabulinesep +\def\tabu@linesep {\@ifnextchar_% + {\tabu@gobbletoken{\tabu@setsep\abovetabulinesep \belowtabulinesep}} + {\ifx ^\@let@token \def\tabu@temp{% + \tabu@gobbletoken{\tabu@setsep\belowtabulinesep \abovetabulinesep}}% + \else \let\tabu@temp \@empty + \afterassignment \tabu@setlinesep \abovetabulinesep + \fi \tabu@temp}% +}% \tabu@linesep +\def\tabu@setsep #1#2{\def\tabu@temp{\tabu@sets@p#1#2}\afterassignment\tabu@temp#2} +\def\tabu@sets@p #1#2{\@ifnextchar^% + {\tabu@gobbletoken{\tabu@setsep\belowtabulinesep \abovetabulinesep}} + {\ifx _\@let@token \def\tabu@temp{% + \tabu@gobbletoken{\tabu@setsep\abovetabulinesep \belowtabulinesep}}% + \else \let\tabu@temp \@empty + \tabu@Gsave \tabu@G@linesep \tabu@C@linesep \abovetabulinesep \belowtabulinesep + \fi \tabu@temp}% +}% \tabu@sets@p +\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@n@Glinesep{\ifx \tabu@G@linesep\@empty \else \noalign{\tabu@Rlinesep}\fi} +\def\tabu@Rlinesep{\tabu@Grestore \tabu@G@linesep \tabu@C@linesep} +\let\tabu@C@linesep \z@ +\let\tabu@G@linesep \@empty +%% \global\extrarowsep and \global\tabulinesep ------------------- +\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{%\ifdim \baselineskip=\z@\noalign\fi + \toks#2{}#1\toks\currentgrouplevel\expandafter{\expandafter}\the\toks#2\relax + \ifcat$\the\toks\currentgrouplevel$\else + \global\let#1\@empty \global\let#2\z@ + \the\toks\currentgrouplevel + \fi +}% \tabu@Grestore +%% Setting code for every row --------------------------------------- +\newcommand*\everyrow{\tabu@everyrow@bgroup + \tabu@start \z@ \tabu@stop \z@ \tabu@evrstartstop +}% \everyrow +\def\tabu@evrstartstop {\@ifnextchar^% + {\afterassignment \tabu@evrstartstop \tabu@stop=}% + {\ifx ^\@let@token + \afterassignment\tabu@evrstartstop \tabu@start=% + \else \afterassignment\tabu@everyr@w \toks@ + \fi}% +}% \tabu@evrstartstop +\def\tabu@everyr@w {% + \xdef\tabu@everyrow{% + \noexpand\tabu@everyrowfalse + \let\noalign \relax + \noexpand\tabu@rowfontreset + \iftabu@colortbl \noexpand\tabu@rc@ \fi % \taburowcolors + \let\noexpand\tabu@docline \noexpand\tabu@docline@evr + \the\toks@ + \noexpand\tabu@evrh@@k + \noexpand\tabu@rearstrut + \global\advance\c@taburow \@ne}% + \iftabu@everyrow \toks@\expandafter + {\expandafter\def\expandafter\tabu@evr@L\expandafter{\the\toks@}}% + \else \xdef\tabu@evr@G{\the\toks@}% + \fi + \tabu@everyrow@egroup +}% \tabu@everyr@w +\def\tabu@evr {\def\tabu@evrh@@k} % for internal use only +\tabu@evr{} +%% line style and leaders ------------------------------------------- +\newcommand*\newtabulinestyle [1]{% + {\@for \@tempa :=#1\do{\expandafter\tabu@newlinestyle \@tempa==\@nil}}% +}% \newtabulinestyle +\def\tabu@newlinestyle #1=#2=#3\@nil{\tabu@getline {#2}% + \tabu@sanitizearg {#1}\@tempa + \ifodd 1\ifx \@tempa\@empty \ifdefined\tabu@linestyle@ 0 \fi\fi + \global\expandafter\let + \csname tabu@linestyle@\@tempa \endcsname =\tabu@thestyle \fi +}% \tabu@newlinestyle +\newcommand*\tabulinestyle [1]{\tabu@everyrow@bgroup \tabu@getline{#1}% + \iftabu@everyrow + \toks@\expandafter{\expandafter \def \expandafter + \tabu@ls@L\expandafter{\tabu@thestyle}}% + \gdef\tabu@ls@{\tabu@ls@L}% + \else + \global\let\tabu@ls@G \tabu@thestyle + \gdef\tabu@ls@{\tabu@ls@G}% + \fi + \tabu@everyrow@egroup +}% \tabulinestyle +\newcommand*\taburulecolor{\tabu@everyrow@bgroup \tabu@textbar \tabu@rulecolor} +\def\tabu@rulecolor #1{\toks@{}% + \def\tabu@temp #1##1#1{\tabu@ruledrsc{##1}}\@ifnextchar #1% + \tabu@temp + \tabu@rulearc +}% \tabu@rulecolor +\def\tabu@ruledrsc #1{\edef\tabu@temp{#1}\tabu@strtrim\tabu@temp + \ifx \tabu@temp\@empty \def\tabu@temp{\tabu@rule@drsc@ {}{}}% + \else \edef\tabu@temp{\noexpand\tabu@rule@drsc@ {}{\tabu@temp}}% + \fi + \tabu@temp +}% \tabu@ruledrsc@ +\def\tabu@ruledrsc@ #1#{\tabu@rule@drsc@ {#1}} +\def\tabu@rule@drsc@ #1#2{% + \iftabu@everyrow + \ifx \\#1#2\\\toks@{\let\CT@drsc@ \relax}% + \else \toks@{\def\CT@drsc@{\color #1{#2}}}% + \fi + \else + \ifx \\#1#2\\\global\let\CT@drsc@ \relax + \else \gdef\CT@drsc@{\color #1{#2}}% + \fi + \fi + \tabu@rulearc +}% \tabu@rule@drsc@ +\def\tabu@rulearc #1#{\tabu@rule@arc@ {#1}} +\def\tabu@rule@arc@ #1#2{% + \iftabu@everyrow + \ifx \\#1#2\\\toks@\expandafter{\the\toks@ \def\CT@arc@{}}% + \else \toks@\expandafter{\the\toks@ \def\CT@arc@{\color #1{#2}}}% + \fi + \toks@\expandafter{\the\toks@ + \let\tabu@arc@L \CT@arc@ + \let\tabu@drsc@L \CT@drsc@}% + \else + \ifx \\#1#2\\\gdef\CT@arc@{}% + \else \gdef\CT@arc@{\color #1{#2}}% + \fi + \global\let\tabu@arc@G \CT@arc@ + \global\let\tabu@drsc@G \CT@drsc@ + \fi + \tabu@everyrow@egroup +}% \tabu@rule@arc@ +\def\taburowcolors {\tabu@everyrow@bgroup \@testopt \tabu@rowcolors 1} +\def\tabu@rowcolors [#1]#2#{\tabu@rowc@lors{#1}{#2}} +\def\tabu@rowc@lors #1#2#3{% + \toks@{}\@defaultunits \count@ =\number0#2\relax \@nnil + \@defaultunits \tabu@start =\number0#1\relax \@nnil + \ifnum \count@<\tw@ \count@=\tw@ \fi + \advance\tabu@start \m@ne + \ifnum \tabu@start<\z@ \tabu@start \z@ \fi + \tabu@rowcolorseries #3\in@..\in@ \@nnil +}% \tabu@rowcolors +\def\tabu@rowcolorseries #1..#2\in@ #3\@nnil {% + \ifx \in@#1\relax + \iftabu@everyrow \toks@{\def\tabu@rc@{}\let\tabu@rc@L \tabu@rc@}% + \else \gdef\tabu@rc@{}\global\let\tabu@rc@G \tabu@rc@ + \fi + \else + \ifx \\#2\\\tabu@rowcolorserieserror \fi + \tabu@sanitizearg{#1}\tabu@temp + \tabu@sanitizearg{#2}\@tempa + \advance\count@ \m@ne + \iftabu@everyrow + \def\tabu@rc@ ##1##2##3##4{\def\tabu@rc@{% + \ifnum ##2=\c@taburow + \definecolorseries{tabu@rcseries@\the\tabu@nested}{rgb}{last}{##3}{##4}\fi + \ifnum \c@taburow<##2 \else + \ifnum \tabu@modulo {\c@taburow-##2}{##1+1}=\z@ + \resetcolorseries[{##1}]{tabu@rcseries@\the\tabu@nested}\fi + \xglobal\colorlet{tabu@rc@\the\tabu@nested}{tabu@rcseries@\the\tabu@nested!!+}% + \rowcolor{tabu@rc@\the\tabu@nested}\fi}% + }\edef\x{\noexpand\tabu@rc@ {\the\count@} + {\the\tabu@start} + {\tabu@temp} + {\@tempa}% + }\x + \toks@\expandafter{\expandafter\def\expandafter\tabu@rc@\expandafter{\tabu@rc@}}% + \toks@\expandafter{\the\toks@ \let\tabu@rc@L \tabu@rc@}% + \else % inside \noalign + \definecolorseries{tabu@rcseries@\the\tabu@nested}{rgb}{last}{\tabu@temp}{\@tempa}% + \expandafter\resetcolorseries\expandafter[\the\count@]{tabu@rcseries@\the\tabu@nested}% + \xglobal\colorlet{tabu@rc@\the\tabu@nested}{tabu@rcseries@\the\tabu@nested!!+}% + \let\noalign \relax \rowcolor{tabu@rc@\the\tabu@nested}% + \def\tabu@rc@ ##1##2{\gdef\tabu@rc@{% + \ifnum \tabu@modulo {\c@taburow-##2}{##1+1}=\@ne + \resetcolorseries[{##1}]{tabu@rcseries@\the\tabu@nested}\fi + \xglobal\colorlet{tabu@rc@\the\tabu@nested}{tabu@rcseries@\the\tabu@nested!!+}% + \rowcolor{tabu@rc@\the\tabu@nested}}% + }\edef\x{\noexpand\tabu@rc@{\the\count@}{\the\c@taburow}}\x + \global\let\tabu@rc@G \tabu@rc@ + \fi + \fi + \tabu@everyrow@egroup +}% \tabu@rowcolorseries +\tabuDisableCommands {\let\tabu@rc@ \@empty } +\def\tabu@rowcolorserieserror {\PackageError{tabu} + {Invalid syntax for \string\taburowcolors + \MessageBreak Please look at the documentation!}\@ehd +}% \tabu@rowcolorserieserror +\newcommand*\tabureset {% + \tabulinesep=\z@ \extrarowsep=\z@ \extratabsurround=\z@ + \tabulinestyle{}\everyrow{}\taburulecolor||{}\taburowcolors{}% +}% \tabureset +%% Parsing the line styles ------------------------------------------ +\def\tabu@getline #1{\begingroup + \csname \ifcsname if@safe@actives\endcsname % + @safe@activestrue\else + relax\fi \endcsname + \edef\tabu@temp{#1}\tabu@sanitizearg{#1}\@tempa + \let\tabu@thestyle \relax + \ifcsname tabu@linestyle@\@tempa \endcsname + \edef\tabu@thestyle{\endgroup + \def\tabu@thestyle{\expandafter\noexpand + \csname tabu@linestyle@\@tempa\endcsname}% + }\tabu@thestyle + \else \expandafter\tabu@definestyle \tabu@temp \@nil + \fi +}% \tabu@getline +\def\tabu@definestyle #1#2\@nil {\endlinechar \m@ne \makeatletter + \tabu@thick \maxdimen \tabu@on \maxdimen \tabu@off \maxdimen + \let\tabu@c@lon \@undefined \let\tabu@c@loff \@undefined + \ifodd 1\ifcat .#1\else\ifcat\relax #1\else 0\fi\fi % catcode 12 or non expandable cs + \def\tabu@temp{\tabu@getparam{thick}}% + \else \def\tabu@temp{\tabu@getparam{thick}\maxdimen}% + \fi + {% + \let\tabu@ \relax + \def\:{\obeyspaces \tabu@oXIII \tabu@commaXIII \edef\:}% (space active \: happy ;-)) + \scantokens{\:{\tabu@temp #1#2 \tabu@\tabu@}}% + \expandafter}\expandafter + \def\expandafter\:\expandafter{\:}% line spec rewritten now ;-) + \def\;{\def\:}% + \scantokens\expandafter{\expandafter\;\expandafter{\:}}% space is now inactive (catcode 10) + \let\tabu@ \tabu@getcolor \:% all arguments are ready now ;-) + \ifdefined\tabu@c@lon \else \let\tabu@c@lon\@empty \fi + \ifx \tabu@c@lon\@empty \def\tabu@c@lon{\CT@arc@}\fi + \ifdefined\tabu@c@loff \else \let\tabu@c@loff \@empty \fi + \ifdim \tabu@on=\maxdimen \ifdim \tabu@off<\maxdimen + \tabu@on \tabulineon \fi\fi + \ifdim \tabu@off=\maxdimen \ifdim \tabu@on<\maxdimen + \tabu@off \tabulineoff \fi\fi + \ifodd 1\ifdim \tabu@off=\maxdimen \ifdim \tabu@on=\maxdimen 0 \fi\fi + \in@true % + \else \in@false % + \fi + \ifdim\tabu@thick=\maxdimen \def\tabu@thick{\arrayrulewidth}% + \else \edef\tabu@thick{\the\tabu@thick}% + \fi + \edef \tabu@thestyle ##1##2{\endgroup + \def\tabu@thestyle{% + \ifin@ \noexpand\tabu@leadersstyle {\tabu@thick} + {\the\tabu@on}{##1} + {\the\tabu@off}{##2}% + \else \noexpand\tabu@rulesstyle + {##1\vrule width \tabu@thick}% + {##1\leaders \hrule height \tabu@thick \hfil}% + \fi}% + }\expandafter \expandafter + \expandafter \tabu@thestyle \expandafter + \expandafter \expandafter + {\expandafter\tabu@c@lon\expandafter}\expandafter{\tabu@c@loff}% +}% \tabu@definestyle +{\catcode`\O=\active \lccode`\O=`\o \catcode`\,=\active + \lowercase{\gdef\tabu@oXIII {\catcode`\o=\active \let O=\tabu@oxiii}} + \gdef\tabu@commaXIII {\catcode`\,=\active \let ,=\space} +}% \catcode +\def\tabu@oxiii #1{% + \ifcase \ifx n#1\z@ \else + \ifx f#1\@ne\else + \tw@ \fi\fi + \expandafter\tabu@onxiii + \or \expandafter\tabu@ofxiii + \else o% + \fi#1}% +\def\tabu@onxiii #1#2{% + \ifcase \ifx !#2\tw@ \else + \ifcat.\noexpand#2\z@ \else + \ifx \tabu@spxiii#2\@ne\else + \tw@ \fi\fi\fi + \tabu@getparam{on}#2\expandafter\@gobble + \or \expandafter\tabu@onxiii % (space is active) + \else o\expandafter\@firstofone + \fi{#1#2}}% +\def\tabu@ofxiii #1#2{% + \ifx #2f\expandafter\tabu@offxiii + \else o\expandafter\@firstofone + \fi{#1#2}} +\def\tabu@offxiii #1#2{% + \ifcase \ifx !#2\tw@ \else + \ifcat.\noexpand#2\z@ \else + \ifx\tabu@spxiii#2\@ne \else + \tw@ \fi\fi\fi + \tabu@getparam{off}#2\expandafter\@gobble + \or \expandafter\tabu@offxiii % (space is active) + \else o\expandafter\@firstofone + \fi{#1#2}} +\def\tabu@getparam #1{\tabu@ \csname tabu@#1\endcsname=} +\def\tabu@getcolor #1{% \tabu@ <- \tabu@getcolor after \edef + \ifx \tabu@#1\else % no more spec + \let\tabu@theparam=#1\afterassignment \tabu@getc@l@r #1\fi +}% \tabu@getcolor +\def\tabu@getc@l@r #1\tabu@ {% + \def\tabu@temp{#1}\tabu@strtrim \tabu@temp + \ifx \tabu@temp\@empty + \else%\ifcsname \string\color@\tabu@temp \endcsname % if the color exists + \ifx \tabu@theparam \tabu@off \let\tabu@c@loff \tabu@c@l@r + \else \let\tabu@c@lon \tabu@c@l@r + \fi + %\else \tabu@warncolour{\tabu@temp}% + \fi%\fi + \tabu@ % next spec +}% \tabu@getc@l@r +\def\tabu@warncolour #1{\PackageWarning{tabu} + {Color #1 is not defined. Default color used}% +}% \tabu@warncolour +\def\tabu@leadersstyle #1#2#3#4#5{\def\tabu@leaders{{#1}{#2}{#3}{#4}{#5}}% + \ifx \tabu@leaders\tabu@leaders@G \else + \tabu@LEADERS{#1}{#2}{#3}{#4}{#5}\fi +}% \tabu@leadersstyle +\def\tabu@rulesstyle #1#2{\let\tabu@leaders \@undefined + \gdef\tabu@thevrule{#1}\gdef\tabu@thehrule{#2}% +}% \tabu@rulesstyle +%% The leaders boxes ------------------------------------------------ +\def\tabu@LEADERS #1#2#3#4#5{%% width, dash, dash color, gap, gap color + {\let\color \tabu@color % => during trials -> \color = \tabu@nocolor + {% % but the leaders boxes should have colors ! + \def\@therule{\vrule}\def\@thick{height}\def\@length{width}% + \def\@box{\hbox}\def\@unbox{\unhbox}\def\@elt{\wd}% + \def\@skip{\hskip}\def\@ss{\hss}\def\tabu@leads{\tabu@hleads}% + \tabu@l@@d@rs {#1}{#2}{#3}{#4}{#5}% + \global\let\tabu@thehleaders \tabu@theleaders + }% + {% + \def\@therule{\hrule}\def\@thick{width}\def\@length{height}% + \def\@box{\vbox}\def\@unbox{\unvbox}\def\@elt{\ht}% + \def\@skip{\vskip}\def\@ss{\vss}\def\tabu@leads{\tabu@vleads}% + \tabu@l@@d@rs {#1}{#2}{#3}{#4}{#5}% + \global\let\tabu@thevleaders \tabu@theleaders + }% + \gdef\tabu@leaders@G{{#1}{#2}{#3}{#4}{#5}}% + }% +}% \tabu@LEADERS +\def\tabu@therule #1#2{\@therule \@thick#1\@length\dimexpr#2/2 \@depth\z@} +\def\tabu@l@@d@rs #1#2#3#4#5{%% width, dash, dash color, gap, gap color + \global\setbox \tabu@leads=\@box{% + {#3\tabu@therule{#1}{#2}}% + \ifx\\#5\\\@skip#4\else{#5\tabu@therule{#1}{#4*2}}\fi + {#3\tabu@therule{#1}{#2}}}% + \global\setbox\tabu@leads=\@box to\@elt\tabu@leads{\@ss + {#3\tabu@therule{#1}{#2}}\@unbox\tabu@leads}% + \edef\tabu@theleaders ##1{\def\noexpand\tabu@theleaders {% + {##1\tabu@therule{#1}{#2}}% + \xleaders \copy\tabu@leads \@ss + \tabu@therule{0pt}{-#2}{##1\tabu@therule{#1}{#2}}}% + }\tabu@theleaders{#3}% +}% \tabu@l@@d@rs +%% \tabu \endtabu \tabu* \longtabu \endlongtabu \longtabu* ---------- +\newcommand*\tabu {\tabu@longfalse + \ifmmode \def\tabu@ {\array}\def\endtabu {\endarray}% + \else \def\tabu@ {\tabu@tabular}\def\endtabu {\endtabular}\fi + \expandafter\let\csname tabu*\endcsname \tabu + \expandafter\let\csname endtabu*\endcsname\endtabu + \tabu@spreadfalse \tabu@negcoeffalse \tabu@settarget +}% {tabu} +\let\tabu@tabular \tabular % +\expandafter\def\csname tabu*\endcsname{\tabuscantokenstrue \tabu} +\newcommand*\longtabu {\tabu@longtrue \ifmmode\PackageError{tabu}{longtabu not allowed in math mode}\fi \def\tabu@{\longtable}\def\endlongtabu{\endlongtable}% - \let\tabu@arrayleft@measure \tabu@long@arrayleft@measure - \let\LT@startpbox \tabu@LT@startpbox % \everypar{ array strut } instead of { array strut } - \tabu@setup \tabu@settarget -}% \longtabu + \LTchunksize=\@M + \expandafter\let\csname longtabu*\endcsname\longtabu % Humm... + \expandafter\let\csname tabu*\endcsname\tabu + \let\LT@startpbox \tabu@LT@startpbox % \everypar{ array struts } + \tabu@spreadfalse \tabu@negcoeffalse \tabu@settarget +}% {longtabu} +\expandafter\def\csname longtabu*\endcsname{\tabuscantokenstrue \longtabu} \def\tabu@nolongtabu{\PackageError{tabu} {longtabu requires the longtable package}\@ehd} -\def\tabu@setup{% - \tabu@adl@fix \let\endarray \tabu@endarray % colortbl & arydshln (delarray) - \let\tabu@global@X \@empty - \ifx \verbatim\tabu@sanitizetext % - \advance\tabu@nested \@ne - \def\tabu@aligndefault{t}\let\tabudefaulttarget \linewidth - \else - \tabu@timerstart \global\tabu@footnotes{}\tabu@nested \z@ - \let\tabu@multicolumnORI \multicolumn \let\multicolumn \tabu@multicolumn - \def\tabu@aligndefault{c}\edef\tabu@hfuzz {\the\hfuzz}% - \ifdim\parindent>\z@ \ifx\linewidth\tabudefaulttarget - \everypar\expandafter{% % correction for indentation - \the\everypar\everypar\expandafter{\the\everypar}% - \setbox\z@=\lastbox - \ifdim\wd\z@>\z@ \advance\linewidth -\wd\z@\fi - \box\z@ - }% - \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 - \tabu@setup@saveglobal - \let\@footnotetext \tabu@footnotetext \let\@xfootnotetext \tabu@xfootnotetext - \let\@xfootnote \tabu@xfootnote \let\centering \tabu@centering - \let\raggedright \tabu@raggedright \let\raggedleft \tabu@raggedleft - \tabu@trivlist % - \def\tabudecimal {\tabu@tabudecimal}\let\verbatim \tabu@sanitizetext - \let\fbox \tabu@fbox \let\color@b@x \tabu@color@b@x - \let\rowfont \tabu@rowfont - \let\prepnext@tok \tabu@prepnext@tok % - \everycr{}\let\tabu@everycr \everycr - \tabu@spreadfalse \tabu@measuringfalse \tabu@negcoeffalse - \edef\tabu@NC@list{\the\NC@list}\NC@list{\NC@do \tabu@rewritefirst}% -}% \tabu@setup -\def\tabu@setup@saveglobal{{% - \toks@\expandafter{\tabu@everyrow@hook}% - \expandafter\xdef\csname tabu@global@\the\tabu@nested\endcsname{% - \gdef\noexpand\tabu@everyrow@hook {\the\toks@}% - \noexpand\tabu@everyrowtrue - \ifcase \tabu@nested - \noexpand\the \tabu@footnotes - \else - \global\tabu@X@cols \the\tabu@X@cols\relax - \global\tabu@naturalX \the\tabu@naturalX\relax - \gdef\noexpand\tabu@naturalX@min {\tabu@naturalX@min}% - \gdef\noexpand\tabu@naturalX@max {\tabu@naturalX@max}% - \fi}}% - \expandafter\aftergroup\csname tabu@global@\the\tabu@nested\endcsname -}% \tabu@setup@saveglobal -\def\tabu@settarget{\futurelet\@let@token \tabu@sett@rget} -\def\tabu@sett@rget{\tabu@target\z@ - \ifcase \ifx \bgroup\@let@token 0\else - \ifx [\@let@token 0\else - \ifx \@sptoken\@let@token 1\else - \if t\@let@token 2\else - \if s\@let@token 3\else - \m@ne\fi\fi\fi\fi\fi\relax +%% Read the target and then : \tabular or \@array ------------------ +\def\tabu@settarget {\futurelet\@let@token \tabu@sett@rget } +\def\tabu@sett@rget {\tabu@target \z@ + \ifcase \ifx \bgroup\@let@token \z@ \else + \ifx \@sptoken\@let@token \@ne \else + \if t\@let@token \tw@ \else + \if s\@let@token \thr@@\else + \z@\fi\fi\fi\fi \expandafter\tabu@begin \or \expandafter\tabu@gobblespace\expandafter\tabu@settarget \or \expandafter\tabu@to \or \expandafter\tabu@spread - \else \expandafter\tabu@begin \fi }% \tabu@sett@rget \def\tabu@to to{\def\tabu@halignto{to}\tabu@gettarget} \def\tabu@spread spread{\tabu@spreadtrue\def\tabu@halignto{spread}\tabu@gettarget} -\def\tabu@gettarget {\afterassignment\tabu@linegoaltarget \tabu@target} -\def\tabu@linegoaltarget {\futurelet\tabu@temp \tabu@linegoal@target} -\def\tabu@linegoal@target {% +\def\tabu@gettarget {\afterassignment\tabu@linegoaltarget \tabu@target } +\def\tabu@linegoaltarget {\futurelet\tabu@temp \tabu@linegoalt@rget } +\def\tabu@linegoalt@rget {% \ifx \tabu@temp\LNGL@setlinegoal \LNGL@setlinegoal \expandafter \@firstoftwo \fi % @gobbles \LNGL@setlinegoal \tabu@begin -}% \tabu@linegoal@target +}% \tabu@linegoalt@rget \def\tabu@begin #1#{% - \edef\tabu@halignto{\ifdim\tabu@target>\z@ \tabu@halignto\the\tabu@target\fi}% - \@testopt \tabu@@begin \tabu@aligndefault #1\@nil + \iftabu@measuring \expandafter\tabu@nestedmeasure \fi + \ifdim \tabu@target=\z@ \let\tabu@halignto \@empty + \else \edef\tabu@halignto{\tabu@halignto\the\tabu@target}% + \fi + \@testopt \tabu@tabu@ \tabu@aligndefault #1\@nil }% \tabu@begin -\def\tabu@@begin [#1]#2\@nil#3{% - \tabu@preparesave{#3}% - \def\tabu@align {#1}% - \tabu@ [\tabu@align]#2{\tabu@rewritefirst #3}% -}% \tabu@@begin -\def\tabu@preparesave #1{% - \iftabu@colortbl \@temptokena{}% - \tabu@prepare@save \CT@arc@ - \tabu@prepare@save \CT@drsc@ - \fi - \edef\tabu@savedparam{% - \ifmmode \col@sep \the\arraycolsep - \else \col@sep \the\tabcolsep \fi\relax - \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 - \the\@temptokena - \fi}% - \def\tabu@savedpream {\edef\tabu@halignto{to\the\tabu@target}\NC@find #1}% -}% \tabu@preparesave -\def\tabu@prepare@save #1{% - \ifx\relax#1\else - \@temptokena\expandafter{\the\expandafter\@temptokena - \expandafter\def\expandafter#1\expandafter{#1}}\fi -}% \tabu@prepare@save -\newtoks\tabu@footnotes -\long\def\tabu@footnotetext #1{% - \edef\@tempa{\the\tabu@footnotes - \noexpand\footnotetext [\the\csname c@\@mpfn\endcsname]}% - \global\tabu@footnotes\expandafter{\@tempa {#1}}}% -\long\def\tabu@xfootnotetext [#1]#2{% - \global\tabu@footnotes\expandafter{\the\tabu@footnotes - \footnotetext [{#1}]{#2}}} -\let\tabu@xfootnote \@xfootnote -\long\def\tabu@Hy@ftntext{\tabu@Hy@ftntxt {\the \c@footnote }} -\long\def\tabu@Hy@xfootnote [#1]{% - \begingroup - \value\@mpfn #1\relax - \protected@xdef \@thefnmark {\thempfn}% - \endgroup - \@footnotemark \tabu@Hy@ftntxt {#1}% -}% \tabu@Hy@xfootnote -\long\def\tabu@Hy@ftntxt #1#2{% - \edef\@tempa{% - \the\tabu@footnotes - \begingroup - \value\@mpfn #1\relax - \noexpand\protected@xdef - \noexpand\@thefnmark{\noexpand\thempfn}% - \expandafter\noexpand\expandafter\tabu@Hy@footnotetext - \expandafter{% - \Hy@footnote@currentHref - }% - }% - \global\tabu@footnotes\expandafter{% - \@tempa {#2}% - \endgroup - }% -}% \tabu@Hy@ftntxt -\long\def\tabu@Hy@footnotetext #1#2{% - \H@@footnotetext{% - \ifHy@nesting - \hyper@@anchor {#1}{#2}% - \else - \Hy@raisedlink{% - \hyper@@anchor {#1}{\relax}% - }% - \def\@currentHref {#1}% - \let\@currentlabelname \@empty - #2% - \fi - }% -}% \tabu@Hy@footnotetext -\AtBeginDocument{% - \csname\ifcsname ifHy@hyperfootnotes\endcsname - ifHy@hyperfootnotes\else iffalse\fi\endcsname - \let\tabu@footnotetext \tabu@Hy@ftntext - \let\tabu@xfootnote \tabu@Hy@xfootnote - \fi -} -\def\tabu@rewrite@X #1{\tabu@Xarg {#1}% - \expandafter\let\csname tabu@X\the\tabu@X@cols\endcsname \relax - \iftabu@measuring % not the first X column found in preamble - \edef\tabu@global@X {\tabu@global@X - \def\csname tabu@X\the\tabu@X@cols\endcsname {\strip@pt\tabu@X@sum}% - \advance\tabu@X@sum \the\tabu@X@sum\relax}% - \else % first X column found in preamble - \tabu@measuringtrue - \iftabu@spread \tabu@spreadtarget\tabu@target \tabu@target\z@ - \else \tabu@spreadtarget \z@ \fi - \ifdim\tabu@target=\z@ - \setlength\tabu@target \tabudefaulttarget - \tabu@message{(tabu) Default target: - \ifx\tabudefaulttarget\linewidth\string\linewidth - \else\ifx\tabudefaulttarget\linegoal\string\linegoal - \fi\fi=\the\tabu@target \on@line, page \the\c@page}\fi - \tabu@message{\tabu@titles}% - \edef\tabu@global@X {\tabu@global@X - \def\csname tabu@X1\endcsname{\strip@pt\tabu@X@sum}% - \tabu@X@sum \the\tabu@X@sum\relax - \tabu@target \the\tabu@target\relax - \tabu@spreadtarget \the\tabu@spreadtarget\relax}% - \let\tabu@halignto \relax - \fi -}% \tabu@rewrite@X -\let\tabu@@rewrite@X \tabu@rewrite@X -\def\tabu@rewrite@Xnested #1{\in@ ${#1}\ifin@ - \def\tabucolX@rw {>{$}p{\tabucolX}<{$}}\else - \def\tabucolX@rw {p{\tabucolX}}\fi} -\def\tabu@rewrite@Xrestore #1{\tabu@gobbleopt{\def\tabucolX@rw{l}}} -\def\tabu@Xarg#1{% - \advance\tabu@X@cols \@ne - \tabu@wdlet\tabu@X@cols \z@ - \ifx\\#1\\% - \tabu@X@sum \p@ - \edef\tabucolX@rw {p{\tabu@dimexpr{\the\tabu@X@cols}{\tabucolX}}}% - \edef\tabu@temp {p{\the\tabucolX}}% - \else - \tabu@X@sum \z@ - \let\tabucolX@align \@empty \let\tabucolX@rw \@empty - \let\tabu@Xmath \@empty \let\tabu@temp \@empty - \tabu@Xparse {}#1,\@nnil - \fi +\long\def\tabu@tabu@ [#1]#2\@nil #3{\tabu@setup + \def\tabu@align {#1}\def\tabu@savedpream{\NC@find #3}% + \tabu@ [\tabu@align ]#2{#3\tabu@rewritefirst }% +}% \tabu@tabu@ +\def\tabu@nestedmeasure {% + \ifodd 1\iftabu@spread \else \ifdim\tabu@target=\z@ \else 0 \fi\fi\relax + \tabu@spreadtrue + \else \begingroup \iffalse{\fi \ifnum0=`}\fi + \toks@{}\def\tabu@stack{b}% + \expandafter\tabu@collectbody\expandafter\tabu@quickrule + \expandafter\endgroup + \fi +}% \tabu@nestedmeasure +\def\tabu@quickrule {\indent\vrule height\z@ depth\z@ width\tabu@target} +%% \tabu@setup \tabu@init \tabu@indent +\def\tabu@setup{\tabu@alloc@ + \ifcase \tabu@nested + \ifmmode \else \ifdim\tabu@target=\z@ \let\tabu@afterendpar \par \fi\fi + \def\tabu@aligndefault{c}\tabu@init \tabu@indent + \else % + \def\tabu@aligndefault{t}\let\tabudefaulttarget \linewidth + \fi + \let\tabu@thetarget \tabudefaulttarget \let\tabu@restored \@undefined + \edef\tabu@NC@list{\the\NC@list}\NC@list{\NC@do \tabu@rewritefirst}% + \everycr{}\let\@startpbox \tabu@startpbox % for nested tabu inside longtabu... + \let\@endpbox \tabu@endpbox % idem " " " " " " + \let\@tabarray \tabu@tabarray % idem " " " " " " + \tabu@setcleanup \tabu@setreset +}% \tabu@setup +\def\tabu@init{\tabu@starttimer \tabu@measuringfalse + \edef\tabu@hfuzz {\the\dimexpr\hfuzz+1sp}\global\tabu@footnotes{}% + \let\firsthline \tabu@firsthline \let\lasthline \tabu@lasthline + \let\firstline \tabu@firstline \let\lastline \tabu@lastline + \let\hline \tabu@hline \let\@xhline \tabu@xhline + \let\color \tabu@color \let\@arstrutbox \tabu@arstrutbox + \tabu@trivlist % + \let\@footnotetext \tabu@footnotetext \let\@xfootnotetext \tabu@xfootnotetext + \let\@xfootnote \tabu@xfootnote \let\centering \tabu@centering + \let\raggedright \tabu@raggedright \let\raggedleft \tabu@raggedleft + \let\tabudecimal \tabu@tabudecimal \let\Centering \tabu@Centering + \let\RaggedRight \tabu@RaggedRight \let\RaggedLeft \tabu@RaggedLeft + \let\justifying \tabu@justifying \let\rowfont \tabu@rowfont + \let\fbox \tabu@fbox \let\color@b@x \tabu@color@b@x + \let\tabu@@everycr \everycr \let\tabu@@everypar \everypar + \let\tabu@prepnext@tokORI \prepnext@tok\let\prepnext@tok \tabu@prepnext@tok + \let\tabu@multicolumnORI\multicolumn \let\multicolumn \tabu@multicolumn + \let\tabu@startpbox \@startpbox % for nested tabu inside longtabu pfff !!! + \let\tabu@endpbox \@endpbox % idem " " " " " " " + \let\tabu@tabarray \@tabarray % idem " " " " " " " + \tabu@adl@fix \let\endarray \tabu@endarray % colortbl & arydshln (delarray) + \iftabu@colortbl\CT@everycr\expandafter{\expandafter\iftabu@everyrow \the\CT@everycr \fi}\fi +}% \tabu@init +\def\tabu@indent{% correction for indentation + \ifdim \parindent>\z@\ifx \linewidth\tabudefaulttarget + \everypar\expandafter{% + \the\everypar\everypar\expandafter{\the\everypar}% + \setbox\z@=\lastbox + \ifdim\wd\z@>\z@ \edef\tabu@thetarget + {\the\dimexpr -\wd\z@+\tabudefaulttarget}\fi + \box\z@}% + \fi\fi +}% \tabu@indent +\ifdefined\pdfelapsedtime + \def\tabu@pdftimer {\xdef\tabu@starttime{\the\pdfelapsedtime}}% +\else \let\tabu@pdftimer \relax \let\tabu@message@etime \relax +\fi +\def\tabu@setcleanup {% saves last global assignments + \ifodd 1\ifmmode \else \iftabu@long \else 0\fi\fi\relax + \def\tabu@aftergroupcleanup{% + \def\tabu@aftergroupcleanup{\aftergroup\tabu@cleanup}}% + \else + \def\tabu@aftergroupcleanup{% + \aftergroup\aftergroup\aftergroup\tabu@cleanup + \let\tabu@aftergroupcleanup \relax}% + \fi + \let\tabu@arc@Gsave \tabu@arc@G + \let\tabu@arc@G \tabu@arc@L % + \let\tabu@drsc@Gsave \tabu@drsc@G + \let\tabu@drsc@G \tabu@drsc@L % + \let\tabu@ls@Gsave \tabu@ls@G + \let\tabu@ls@G \tabu@ls@L % + \let\tabu@rc@Gsave \tabu@rc@G + \let\tabu@rc@G \tabu@rc@L % + \let\tabu@evr@Gsave \tabu@evr@G + \let\tabu@evr@G \tabu@evr@L % + \let\tabu@celllalign@save \tabu@celllalign + \let\tabu@cellralign@save \tabu@cellralign + \let\tabu@cellleft@save \tabu@cellleft + \let\tabu@cellright@save \tabu@cellright + \let\tabu@@celllalign@save \tabu@@celllalign + \let\tabu@@cellralign@save \tabu@@cellralign + \let\tabu@@cellleft@save \tabu@@cellleft + \let\tabu@@cellright@save \tabu@@cellright + \let\tabu@rowfontreset@save \tabu@rowfontreset + \let\tabu@@rowfontreset@save\tabu@@rowfontreset + \let\tabu@rowfontreset \@empty + \edef\tabu@alloc@save {\the\tabu@alloc}% restore at \tabu@reset + \edef\c@taburow@save {\the\c@taburow}% + \edef\tabu@naturalX@save {\the\tabu@naturalX}% + \let\tabu@naturalXmin@save \tabu@naturalXmin + \let\tabu@naturalXmax@save \tabu@naturalXmax + \let\tabu@mkarstrut@save \tabu@mkarstrut + \edef\tabu@clarstrut{% + \extrarowheight \the\dimexpr \ht\@arstrutbox-\ht\strutbox \relax + \extrarowdepth \the\dimexpr \dp\@arstrutbox-\dp\strutbox \relax + \let\noexpand\@arraystretch \@ne \noexpand\tabu@rearstrut}% +}% \tabu@setcleanup +\def\tabu@cleanup {\begingroup + \globaldefs\@ne \tabu@everyrowtrue + \let\tabu@arc@G \tabu@arc@Gsave + \let\CT@arc@ \tabu@arc@G + \let\tabu@drsc@G \tabu@drsc@Gsave + \let\CT@drsc@ \tabu@drsc@G + \let\tabu@ls@G \tabu@ls@Gsave + \let\tabu@ls@ \tabu@ls@G + \let\tabu@rc@G \tabu@rc@Gsave + \let\tabu@rc@ \tabu@rc@G + \let\CT@do@color \relax + \let\tabu@evr@G \tabu@evr@Gsave + \let\tabu@celllalign \tabu@celllalign@save + \let\tabu@cellralign \tabu@cellralign@save + \let\tabu@cellleft \tabu@cellleft@save + \let\tabu@cellright \tabu@cellright@save + \let\tabu@@celllalign \tabu@@celllalign@save + \let\tabu@@cellralign \tabu@@cellralign@save + \let\tabu@@cellleft \tabu@@cellleft@save + \let\tabu@@cellright \tabu@@cellright@save + \let\tabu@rowfontreset \tabu@rowfontreset@save + \let\tabu@@rowfontreset \tabu@@rowfontreset@save + \tabu@naturalX =\tabu@naturalX@save + \let\tabu@naturalXmax \tabu@naturalXmax@save + \let\tabu@naturalXmin \tabu@naturalXmin@save + \let\tabu@mkarstrut \tabu@mkarstrut@save + \c@taburow =\c@taburow@save + \ifcase \tabu@nested \tabu@alloc \m@ne\fi + \endgroup % + \ifcase \tabu@nested + \the\tabu@footnotes \global\tabu@footnotes{}% + \tabu@afterendpar \tabu@elapsedtime + \fi + \tabu@clarstrut + \everyrow\expandafter {\tabu@evr@G}% +}% \tabu@cleanup +\let\tabu@afterendpar \relax +\def\tabu@setreset {% + \edef\tabu@savedparams {% \relax for \tabu@message@save + \ifmmode \col@sep \the\arraycolsep + \else \col@sep \the\tabcolsep \fi \relax + \arrayrulewidth \the\arrayrulewidth \relax + \doublerulesep \the\doublerulesep \relax + \extratabsurround \the\extratabsurround \relax + \extrarowheight \the\extrarowheight \relax + \extrarowdepth \the\extrarowdepth \relax + \def\noexpand\arraystretch{\arraystretch}% + \ifdefined\minrowclearance \minrowclearance\the\minrowclearance\relax\fi}% + \begingroup + \@temptokena\expandafter{\tabu@savedparams}% => only for \savetabu / \usetabu + \ifx \tabu@arc@L\relax \else \tabu@setsave \tabu@arc@L \fi + \ifx \tabu@drsc@L\relax \else \tabu@setsave \tabu@drsc@L \fi + \tabu@setsave \tabu@ls@L \tabu@setsave \tabu@evr@L + \expandafter \endgroup \expandafter + \def\expandafter\tabu@saved@ \expandafter{\the\@temptokena + \let\tabu@arc@G \tabu@arc@L + \let\tabu@drsc@G \tabu@drsc@L + \let\tabu@ls@G \tabu@ls@L + \let\tabu@rc@G \tabu@rc@L + \let\tabu@evr@G \tabu@evr@L}% + \def\tabu@reset{\tabu@savedparams + \tabu@everyrowtrue \c@taburow \z@ + \let\CT@arc@ \tabu@arc@L + \let\CT@drsc@ \tabu@drsc@L + \let\tabu@ls@ \tabu@ls@L + \let\tabu@rc@ \tabu@rc@L + \global\tabu@alloc \tabu@alloc@save + \everyrow\expandafter{\tabu@evr@L}}% +}% \tabu@reset +\def\tabu@setsave #1{\expandafter\tabu@sets@ve #1\@nil{#1}} +\long\def\tabu@sets@ve #1\@nil #2{\@temptokena\expandafter{\the\@temptokena \def#2{#1}}} +%% The Rewritting Process ------------------------------------------- +\def\tabu@newcolumntype #1{% + \expandafter\tabu@new@columntype + \csname NC@find@\string#1\expandafter\endcsname + \csname NC@rewrite@\string#1\endcsname + {#1}% +}% \tabu@newcolumntype +\def\tabu@new@columntype #1#2#3{% + \def#1##1#3{\NC@{##1}}% + \let#2\relax \newcommand*#2% +}% \tabu@new@columntype +\def\tabu@privatecolumntype #1{% + \expandafter\tabu@private@columntype + \csname NC@find@\string#1\expandafter\endcsname + \csname NC@rewrite@\string#1\expandafter\endcsname + \csname tabu@NC@find@\string#1\expandafter\endcsname + \csname tabu@NC@rewrite@\string#1\endcsname + {#1}% +}% \tabu@privatecolumntype +\def\tabu@private@columntype#1#2#3#4{% + \g@addto@macro\tabu@privatecolumns{\let#1#3\let#2#4}% + \tabu@new@columntype#3#4% +}% \tabu@private@columntype +\let\tabu@privatecolumns \@empty +\newcommand*\tabucolumn [1]{\expandafter \def \expandafter + \tabu@highprioritycolumns\expandafter{\tabu@highprioritycolumns + \NC@do #1}}% +\let\tabu@highprioritycolumns \@empty +%% The | ``column'' : rewritting process -------------------------- +\tabu@privatecolumntype |{\tabu@rewritevline} +\newcommand*\tabu@rewritevline[1][]{\tabu@vlinearg{#1}% + \expandafter \NC@find \tabu@rewritten} +\def\tabu@lines #1{% + \ifx|#1\else \tabu@privatecolumntype #1{\tabu@rewritevline}\fi + \NC@list\expandafter{\the\NC@list \NC@do #1}% +}% \tabu@lines@ +\def\tabu@vlinearg #1{% + \ifx\\#1\\\def\tabu@thestyle {\tabu@ls@}% + \else\tabu@getline {#1}% + \fi + \def\tabu@rewritten ##1{\def\tabu@rewritten{!{##1\tabu@thevline}}% + }\expandafter\tabu@rewritten\expandafter{\tabu@thestyle}% + \expandafter \tabu@keepls \tabu@thestyle \@nil +}% \tabu@vlinearg +\def\tabu@keepls #1\@nil{% + \ifcat $\@cdr #1\@nil $% + \ifx \relax#1\else + \ifx \tabu@ls@#1\else + \let#1\relax + \xdef\tabu@mkpreambuffer{\tabu@mkpreambuffer + \tabu@savels\noexpand#1}\fi\fi\fi +}% \tabu@keepls +\def\tabu@thevline {\begingroup + \ifdefined\tabu@leaders + \setbox\@tempboxa=\vtop to\dimexpr + \ht\@arstrutbox+\dp\@arstrutbox{{\tabu@thevleaders}}% + \ht\@tempboxa=\ht\@arstrutbox \dp\@tempboxa=\dp\@arstrutbox + \box\@tempboxa + \else + \tabu@thevrule + \fi \endgroup +}% \tabu@thevline +\def\tabu@savels #1{% + \expandafter\let\csname\string#1\endcsname #1% + \expandafter\def\expandafter\tabu@reset\expandafter{\tabu@reset + \tabu@resetls#1}}% +\def\tabu@resetls #1{\expandafter\let\expandafter#1\csname\string#1\endcsname}% +%% \multicolumn inside tabu environment ----------------------------- +\tabu@newcolumntype \tabu@rewritemulticolumn{% + \aftergroup \tabu@endrewritemulticolumn % after \@mkpream group + \NC@list{\NC@do *}\tabu@textbar \tabu@lines + \tabu@savedecl + \tabu@privatecolumns + \NC@list\expandafter{\the\expandafter\NC@list \tabu@NC@list}% + \let\tabu@savels \relax + \NC@find +}% \tabu@rewritemulticolumn +\def\tabu@endrewritemulticolumn{\gdef\tabu@mkpreambuffer{}\endgroup} +\def\tabu@multicolumn{\tabu@ifenvir \tabu@multic@lumn \tabu@multicolumnORI} +\long\def\tabu@multic@lumn #1#2#3{\multispan{#1}\begingroup + \tabu@everyrowtrue + \NC@list{\NC@do \tabu@rewritemulticolumn}% + \expandafter\@gobbletwo % gobbles \multispan{#1} + \tabu@multicolumnORI{#1}{\tabu@rewritemulticolumn #2}% + {\iftabuscantokens \tabu@rescan \else \expandafter\@firstofone \fi + {#3}}% +}% \tabu@multic@lumn +%% The X column(s): rewritting process ----------------------------- +\tabu@privatecolumntype X[1][]{\begingroup \tabu@siunitx{\endgroup \tabu@rewriteX {#1}}} +\def\tabu@nosiunitx #1{#1{}{}\expandafter \NC@find \tabu@rewritten } +\def\tabu@siunitx #1{\@ifnextchar \bgroup + {\tabu@rewriteX@Ss{#1}} + {\tabu@nosiunitx{#1}}} +\def\tabu@rewriteX@Ss #1#2{\@temptokena{}% + \@defaultunits \let\tabu@temp =#2\relax\@nnil + \ifodd 1\ifx S\tabu@temp \else \ifx s\tabu@temp \else 0 \fi\fi + \def\NC@find{\def\NC@find >####1####2<####3\relax{#1 {####1}{####3}% + }\expandafter\NC@find \the\@temptokena \relax + }\expandafter\NC@rewrite@S \@gobble #2\relax + \else \tabu@siunitxerror + \fi + \expandafter \NC@find \tabu@rewritten +}% \tabu@rewriteX@Ss +\def\tabu@siunitxerror {\PackageError{tabu}{Not a S nor s column ! + \MessageBreak X column can only embed siunitx S or s columns}\@ehd +}% \tabu@siunitxerror +\def\tabu@rewriteX #1#2#3{\tabu@Xarg {#1}{#2}{#3}% + \iftabu@measuring + \else \tabu@measuringtrue % first X column found in the preamble + \let\@halignto \relax \let\tabu@halignto \relax + \iftabu@spread \tabu@spreadtarget \tabu@target \tabu@target \z@ + \else \tabu@spreadtarget \z@ \fi + \ifdim \tabu@target=\z@ + \setlength\tabu@target \tabu@thetarget + \tabu@message{\tabu@message@defaulttarget}% + \else \tabu@message{\tabu@message@target}\fi + \fi +}% \tabu@rewriteX +\def\tabu@rewriteXrestore #1#2#3{\let\@halignto \relax + \def\tabu@rewritten{l}} +\def\tabu@Xarg #1#2#3{% + \advance\tabu@Xcol \@ne \let\tabu@Xlcr \@empty + \let\tabu@Xdisp \@empty \let\tabu@Xmath \@empty + \ifx\\#1\\% + \def\tabu@rewritten{p}\tabucolX \p@ % + \else + \let\tabu@rewritten \@empty \let\tabu@temp \@empty \tabucolX \z@ + \tabu@Xparse {}#1\relax + \fi + \tabu@Xrewritten{#2}{#3}% }% \tabu@Xarg \def\tabu@Xparse #1{\futurelet\@let@token \tabu@Xtest} \expandafter\def\expandafter\tabu@Xparsespace\space{\tabu@Xparse{}} \def\tabu@Xtest{% - \ifcase \ifx \@nnil\@let@token \z@ \else + \ifcase \ifx \relax\@let@token \z@ \else \if ,\@let@token \m@ne\else \if p\@let@token 1\else \if m\@let@token 2\else @@ -550,7 +988,6 @@ \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}% @@ -564,662 +1001,920 @@ \or \tabu@Xalign \justifying\tabu@justify \or \expandafter \tabu@Xparsespace \or \expandafter \tabu@Xcoef - \or \let\tabu@Xmath=$\expandafter \tabu@Xparse + \or \expandafter \tabu@Xm@th \or \tabu@Xcoef{}% \else\expandafter \tabu@Xparse \fi }% \tabu@Xtest -\def\tabu@Xalign#1#2{% - \ifx \tabucolX@align\@empty \else \PackageWarning{tabu} - {Duplicate horizontal alignment specification}\fi - \ifdefined#1\def\tabucolX@align{#1}\else - \def\tabucolX@align{#2}\fi - \expandafter\tabu@Xparse +\def\tabu@Xalign #1#2{% + \ifx \tabu@Xlcr\@empty \else \PackageWarning{tabu} + {Duplicate horizontal alignment specification}\fi + \ifdefined#1\def\tabu@Xlcr{#1}\let#1\relax + \else \def\tabu@Xlcr{#2}\let#2\relax\fi + \expandafter\tabu@Xparse }% \tabu@Xalign -\def\tabu@Xtype#1{% - \ifx \tabucolX@rw\@empty \else \PackageWarning{tabu} - {Duplicate vertical alignment specification}\fi - \def\tabucolX@rw{#1}\expandafter\tabu@Xparse +\def\tabu@Xtype #1{% + \ifx \tabu@rewritten\@empty \else \PackageWarning{tabu} + {Duplicate vertical alignment specification}\fi + \def\tabu@rewritten{#1}\expandafter\tabu@Xparse }% \tabu@Xtype \def\tabu@Xcoef#1{\edef\tabu@temp{\tabu@temp#1}% - \afterassignment\tabu@Xc@ef \tabu@cnt\number\if-#10\fi + \afterassignment\tabu@Xc@ef \tabu@cnt\number\if-#10\fi }% \tabu@Xcoef -\def\tabu@Xc@ef{% - \advance\tabu@X@sum \tabu@temp\the\tabu@cnt\p@ - \tabu@Xparse{}% +\def\tabu@Xc@ef{\advance\tabucolX \tabu@temp\the\tabu@cnt\p@ + \tabu@Xparse{}% }% \tabu@Xc@ef -\def\tabucolX@do{% - \ifx\tabucolX@rw\@empty \def\tabucolX@rw{p}\fi - \ifdim\tabu@X@sum<\z@ \tabu@negcoeftrue - \tabu@X@sum \m@ne\tabu@X@sum - \tabu@wdlet \tabu@X@cols \p@ - \else \ifdim \tabu@X@sum=\z@ \tabu@X@sum \p@ \fi +\def\tabu@Xm@th #1{\futurelet \@let@token \tabu@Xd@sp} +\def\tabu@Xd@sp{\let\tabu@Xmath=$% + \ifx $\@let@token \def\tabu@Xdisp{\displaystyle}% + \expandafter\tabu@Xparse + \else \expandafter\tabu@Xparse\expandafter{\expandafter}% + \fi +}% \tabu@Xd@sp +\def\tabu@Xrewritten {% + \ifx \tabu@rewritten\@empty \def\tabu@rewritten{p}\fi + \ifdim \tabucolX<\z@ \tabu@negcoeftrue + \else\ifdim \tabucolX=\z@ \tabucolX \p@ + \fi\fi + \edef\tabu@temp{{\the\tabu@Xcol}{\tabu@strippt\tabucolX}}% + \edef\tabu@Xcoefs{\tabu@Xcoefs \tabu@ \tabu@temp}% + \edef\tabu@rewritten ##1##2{\def\noexpand\tabu@rewritten{% + >{\tabu@Xlcr \ifx$\tabu@Xmath$\tabu@Xdisp\fi ##1}% + \tabu@rewritten {\tabu@hsize \tabu@temp}% + <{##2\ifx$\tabu@Xmath$\fi}}% + }\tabu@rewritten +}% \tabu@Xrewritten +\def\tabu@hsize #1#2{% + \ifdim #2\p@<\z@ + \ifdim \tabucolX=\maxdimen \tabu@wd{#1}\else + \ifdim \tabu@wd{#1}<-#2\tabucolX \tabu@wd{#1}\else -#2\tabucolX\fi + \fi + \else #2\tabucolX \fi - \begingroup - \toks@\expandafter {\tabucolX@align}% - \edef\tabu@temp {\strip@pt\tabu@X@sum \tabucolX}% - \edef\tabucolX@rw##1{% - \ifx$\tabu@Xmath>{\noexpand\the\toks@ $}\else - \ifx \tabucolX@align\@empty \else - >{\noexpand\the\toks@}\fi\fi - \tabucolX@rw{##1}% - \ifx$\tabu@Xmath<{$}\fi}% - \edef\x{\endgroup - \def\noexpand\tabu@temp {\tabucolX@rw{\the\dimexpr\tabu@temp}}% - \def\noexpand\tabucolX@rw{% - \tabucolX@rw{\tabu@dimexpr{\the\tabu@X@cols}{\tabu@temp}}}% - }\x -}% \tabucolX@do -\def\tabu@dimexpr#1#2{% - \ifdim \tabu@wd{#1}>\p@ - \ifdim \tabu@wd{#1}<#2 \tabu@wd{#1}\else#2\fi\else #2\fi -}% \tabu@dimexpr -\def\tabu@prep@TRIAL{% - \begingroup \iffalse{\fi \ifnum0=`}\fi - \tabu@setup@TRIAL - \tabucolX \tabu@target - \ifcase 0\iftabu@negcoef \else\iftabu@spread \else 1\fi\fi - \advance\tabu@X@cols \@ne - \expandafter\let\csname tabu@X\the\tabu@X@cols\endcsname \@undefined - \tabu@X@cols \z@ - \def\tabu@naturalX@max {\z@}% - \def\tabu@naturalX@min {\z@}% - \let\tabu@startpboxORI \@startpbox - \let\@startpbox \tabu@measure@startpbox - \fi - \def\tabu@lasttry{\m@ne\p@}\tabu@cnt \z@ % number of trials - \tabu@arrayleft@measure -}% \tabu@prep@TRIAL -\def\tabu@setup@TRIAL{\tabu@global@X \let\tabu@global@X \@empty - \let\@halignto \@empty \tabu@naturalX \z@ - \tabu@savecounters \let\tabu@savecounters \relax - \hbadness \@M \let\hbadness \@tempcnta - \hfuzz \maxdimen \let\hfuzz \@tempdima - \let\tabu@rewrite@X \tabu@rewrite@Xnested - \let\savetabu \@gobble \let\everyrow \@gobble - \let\tabudefaulttarget \linewidth - \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 +}% \tabu@hsize +%% \usetabu and \preamble: rewritting process --------------------- +\tabu@privatecolumntype \usetabu [1]{% + \ifx\\#1\\\tabu@saveerr{}\else + \@ifundefined{tabu@saved@\string#1} + {\tabu@saveerr{#1}} + {\let\tabu@rewriteX \tabu@rewriteXrestore + \csname tabu@saved@\string#1\expandafter\endcsname\expandafter\@ne}% + \fi +}% \NC@rewrite@\usetabu +\tabu@privatecolumntype \preamble [1]{% + \ifx\\#1\\\tabu@saveerr{}\else + \@ifundefined{tabu@saved@\string#1} + {\tabu@saveerr{#1}} + {\csname tabu@saved@\string#1\expandafter\endcsname\expandafter\z@}% + \fi +}% \NC@rewrite@\preamble +%% Controlling the rewritting process ------------------------------- +\tabu@newcolumntype \tabu@rewritefirst{% + \iftabu@long \aftergroup \tabu@longpream % + \else \aftergroup \tabu@pream + \fi + \let\tabu@ \relax \let\tabu@hsize \relax + \let\tabu@Xcoefs \@empty \let\tabu@savels \relax + \tabu@Xcol \z@ \tabu@cnt \tw@ + \gdef\tabu@mkpreambuffer{\tabu@{}}\tabu@measuringfalse + \global\setbox\@arstrutbox \box\@arstrutbox + \NC@list{\NC@do *}\tabu@textbar \tabu@lines + \NC@list\expandafter{\the\NC@list \NC@do X}% + \iftabu@siunitx % + \NC@list\expandafter{\the\NC@list \NC@do S\NC@do s}\fi + \NC@list\expandafter{\the\expandafter\NC@list \tabu@highprioritycolumns}% + \expandafter\def\expandafter\tabu@NC@list\expandafter{% + \the\expandafter\NC@list \tabu@NC@list}% % * | X S + \NC@list\expandafter{\expandafter \NC@do \expandafter\usetabu + \expandafter \NC@do \expandafter\preamble + \the\NC@list \NC@do \tabu@rewritemiddle + \NC@do \tabu@rewritelast}% + \tabu@savedecl + \tabu@privatecolumns + \edef\tabu@prev{\the\@temptokena}\NC@find \tabu@rewritemiddle +}% NC@rewrite@\tabu@rewritefirst +\tabu@newcolumntype \tabu@rewritemiddle{% + \edef\tabu@temp{\the\@temptokena}\NC@find \tabu@rewritelast +}% \NC@rewrite@\tabu@rewritemiddle +\tabu@newcolumntype \tabu@rewritelast{% + \ifx \tabu@temp\tabu@prev \advance\tabu@cnt \m@ne + \NC@list\expandafter{\tabu@NC@list \NC@do \tabu@rewritemiddle + \NC@do \tabu@rewritelast}% + \else \let\tabu@prev\tabu@temp + \fi + \ifcase \tabu@cnt \expandafter\tabu@endrewrite + \else \expandafter\NC@find \expandafter\tabu@rewritemiddle + \fi +}% \NC@ewrite@\tabu@rewritelast +%% Choosing the strategy -------------------------------------------- +\def\tabu@endrewrite {% + \let\tabu@temp \NC@find + \ifx \@arrayright\relax \let\@arrayright \@empty \fi + \count@=% + \ifx \@finalstrut\@gobble \z@ % outer in mode 0 print + \iftabu@measuring + \xdef\tabu@mkpreambuffer{\tabu@mkpreambuffer + \tabu@target \csname tabu@\the\tabu@nested.T\endcsname + \tabucolX \csname tabu@\the\tabu@nested.X\endcsname + \edef\@halignto {\ifx\@arrayright\@empty to\tabu@target\fi}}% + \fi + \else\iftabu@measuring 4 % X columns + \xdef\tabu@mkpreambuffer{\tabu@{\tabu@mkpreambuffer + \tabu@target \the\tabu@target + \tabu@spreadtarget \the\tabu@spreadtarget}% + \def\noexpand\tabu@Xcoefs{\tabu@Xcoefs}% + \edef\tabu@halignto{\ifx \@arrayright\@empty to\tabu@target\fi}}% + \let\tabu@Xcoefs \relax + \else\ifcase\tabu@nested \thr@@ % outer, no X + \global\let\tabu@afterendpar \relax + \else \@ne % inner, no X, outer in mode 1 or 2 + \fi + \ifdefined\tabu@usetabu + \else \ifdim\tabu@target=\z@ + \else \let\tabu@temp \tabu@extracolsep + \fi\fi + \fi + \fi + \xdef\tabu@mkpreambuffer{\count@ \the\count@ \tabu@mkpreambuffer}% + \tabu@temp +}% \tabu@endrewrite +\def\tabu@extracolsep{\@defaultunits \expandafter\let + \expandafter\tabu@temp \expandafter=\the\@temptokena \relax\@nnil + \ifx \tabu@temp\@sptoken + \expandafter\tabu@gobblespace \expandafter\tabu@extracolsep + \else + \edef\tabu@temp{\noexpand\NC@find + \if |\noexpand\tabu@temp @% + \else\if !\noexpand\tabu@temp @% + \else !% + \fi\fi + {\noexpand\extracolsep\noexpand\@flushglue}}% + \fi + \tabu@temp +}% \tabu@extrac@lsep +%% Implementing the strategy ---------------------------------------- +\long\def\tabu@pream #1\@preamble {% + \let\tabu@ \tabu@@ \tabu@mkpreambuffer \tabu@aftergroupcleanup + \NC@list\expandafter {\tabu@NC@list}% in case of nesting... + \ifdefined\tabu@usetabu \tabu@usetabu \tabu@target \z@ \fi + \let\tabu@savedpreamble \@preamble + \global\let\tabu@elapsedtime \relax + \tabu@thebody ={#1\tabu@aftergroupcleanup}% + \tabu@thebody =\expandafter{\the\expandafter\tabu@thebody + \@preamble}% + \edef\tabuthepreamble {\the\tabu@thebody}% ( no @ allowed for \scantokens ) + \tabu@select +}% \tabu@pream +\long\def\tabu@longpream #1\LT@bchunk #2\LT@bchunk{% + \let\tabu@ \tabu@@ \tabu@mkpreambuffer \tabu@aftergroupcleanup + \NC@list\expandafter {\tabu@NC@list}% in case of nesting... + \let\tabu@savedpreamble \@preamble + \global\let\tabu@elapsedtime \relax + \tabu@thebody ={#1\LT@bchunk #2\tabu@aftergroupcleanup \LT@bchunk}% + \edef\tabuthepreamble {\the\tabu@thebody}% ( no @ allowed for \scantokens ) + \tabu@select +}% \tabu@longpream +\def\tabu@select {% + \ifnum\tabu@nested>\z@ \tabuscantokensfalse \fi + \ifnum \count@=\@ne \iftabu@measuring \count@=\tw@ \fi\fi + \ifcase \count@ + \global\let\tabu@elapsedtime \relax + \tabu@seteverycr + \expandafter \tabuthepreamble % vertical adjustment (inheritated from outer) + \or % exit in vertical measure + struts per cell because no X and outer in mode 3 + \tabu@evr{\tabu@verticalinit}\tabu@celllalign@def{\tabu@verticalmeasure}% + \def\tabu@cellralign{\tabu@verticalspacing}% + \tabu@seteverycr + \expandafter \tabuthepreamble + \or % exit without measure because no X and outer in mode 4 + \tabu@evr{}\tabu@celllalign@def{}\let\tabu@cellralign \@empty + \tabu@seteverycr + \expandafter \tabuthepreamble + \else % needs trials + \tabu@evr{}\tabu@celllalign@def{}\let\tabu@cellralign \@empty + \tabu@savecounters + \expandafter \tabu@setstrategy + \fi +}% \tabu@select +\def\tabu@@ {\gdef\tabu@mkpreambuffer} +%% Protections to set up before trials ------------------------------ +\def\tabu@setstrategy {\begingroup % + \tabu@trialh@@k \tabu@cnt \z@ % number of trials + \hbadness \@M \let\hbadness \@tempcnta + \hfuzz \maxdimen \let\hfuzz \@tempdima + \let\write \tabu@nowrite\let\GenericError \tabu@GenericError + \let\savetabu \@gobble \let\tabudefaulttarget \linewidth + \let\@footnotetext \@gobble \let\@xfootnote \tabu@xfootnote + \let\color \tabu@nocolor\let\rowcolor \tabu@norowcolor + \let\tabu@aftergroupcleanup \relax % only after the last trial + \tabu@mkpreambuffer + \ifnum \count@>\thr@@ \let\@halignto \@empty \tabucolX@init + \def\tabu@lasttry{\m@ne\p@}\fi + \begingroup \iffalse{\fi \ifnum0=`}\fi + \toks@{}\def\tabu@stack{b}\iftabuscantokens \endlinechar=10 \obeyspaces \fi % + \tabu@collectbody \tabu@strategy % +}% \tabu@setstrategy \def\tabu@savecounters{% - \def\@elt##1{\global\value{##1}\the\value{##1}\relax}% - \edef\tabu@global@X {\cl@@ckpt}\let\@elt \relax + \def\@elt ##1{\csname c@##1\endcsname\the\csname c@##1\endcsname}% + \edef\tabu@clckpt {\begingroup \globaldefs=\@ne \cl@@ckpt \endgroup}\let\@elt \relax }% \tabu@savecounters -\let\tabu@TRIAL@hook \@empty -\newcommand\tabuDisableCommands[1]{\g@addto@macro\tabu@TRIAL@hook {#1}} -\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}% - \toks@{\tabu@setup@everycr - \let\@preamble \tabu@savedpreamble}% - \tabu@collect -}% \tabu@arrayleftmeasure -\long\def\tabu@long@arrayleft@measure #1\LT@bchunk #2\LT@bchunk{% - \def\tabu@Xfinish{% - \tabu@global@Xnested \ifnum0=`{}\fi\endgroup - \tabu@setup@everycr \let\@preamble \tabu@savedpreamble - \tabu@global@X #1\LT@bchunk #2\LT@bchunk}% - \def\tabu@TRIAL{% - \setbox\tabu@box \hbox\bgroup - \tabu@setup@everycr \let\@preamble \tabu@savedpreamble - \tabu@global@X \LTchunksize\@M - #1\LT@bchunk #2\LT@bchunk \the\toks@ \tabu@long@endTRIAL}% - \toks@{}%\let\LT@output\relax - \tabu@collect -}% \tabu@long@arrayleft@measure -\def\tabu@long@endTRIAL{% - \LT@echunk - \global\setbox\@ne \hbox{\unhbox\@ne}\kern\wd\@ne - \LT@get@widths - \egroup % got \tabu@box - \iftabu@spread \tabu@spreadarith % - \else \tabu@arith - \fi - \iftabu@measuring \tabu@measuringfalse - \expandafter \tabu@TRIAL % - \else - \expandafter \tabu@Xfinish - \the \expandafter\toks@ \tabu@endenvir % - \fi -}% \tabu@long@endTRIAL -\def\tabu@collect{\catcode`\^^@=13\def\tabu@stack{b}\tabu@collectbody} -\long\def\tabu@collectbody#1\end#2{% - \edef\tabu@stack{\tabu@pushbegins #1\begin\end\expandafter\@gobble\tabu@stack}% - \ifx \tabu@stack\@empty - \toks@\expandafter{\the\toks@#1}\def\tabu@endenvir{\end{#2}}% - \expandafter \tabu@TRIAL - \else - \toks@\expandafter{\the\toks@#1\end{#2}}% - \expandafter \tabu@collectbody - \fi +\def\tabucolX@init {% \tabucolX <= \tabu@target / (sum coefs > 0) + \dimen@ \z@ \tabu@Xsum \z@ \tabucolX \z@ \let\tabu@ \tabu@Xinit \tabu@Xcoefs + \ifdim \dimen@>\z@ + \@tempdima \dimexpr \tabu@target *\p@/\dimen@ + \tabu@hfuzz\relax + \ifdim \tabucolX<\@tempdima \tabucolX \@tempdima \fi + \fi +}% \tabucolX@init +\def\tabu@Xinit #1#2{\tabu@Xcol #1 \advance \tabu@Xsum + \ifdim #2\p@>\z@ #2\p@ \advance\dimen@ #2\p@ + \else -#2\p@ \tabu@negcoeftrue + \@tempdima \dimexpr \tabu@target*\p@/\dimexpr-#2\p@\relax \relax + \ifdim \tabucolX<\@tempdima \tabucolX \@tempdima \fi + \tabu@wddef{#1}{0pt}% + \fi +}% \tabu@Xinit +%% Collecting the environment body ---------------------------------- +\long\def\tabu@collectbody #1#2\end #3{% + \edef\tabu@stack{\tabu@pushbegins #2\begin\end\expandafter\@gobble\tabu@stack}% + \ifx \tabu@stack\@empty + \toks@\expandafter{\expandafter\tabu@thebody\expandafter{\the\toks@ #2}% + \iftabuscantokens \def\tabu@endenvir{\let\endarray \@empty + \end{#3}\tabu@gobbleX}% + \else \def\tabu@endenvir{\end{#3}}\fi}% + \let\tabu@collectbody \tabu@endofcollect + \else\def\tabu@temp{#3}% + \ifx \tabu@temp\@empty \toks@\expandafter{\the\toks@ #2\end }% + \else \ifx\tabu@temp\tabu@@spxiii \toks@\expandafter{\the\toks@ #2\end #3}% + \else \ifx\tabu@temp\tabu@X \toks@\expandafter{\the\toks@ #2\end #3}% + \else \toks@\expandafter{\the\toks@ #2\end{#3}}% + \fi\fi\fi + \fi + \tabu@collectbody{#1}% }% \tabu@collectbody -\long\def\tabu@pushbegins#1\begin#2{% - \ifx\end#2\else b\expandafter\tabu@pushbegins\fi} -\def\tabu@endTRIAL{% - \tabu@adl@endTRIAL % - \endarray$\egroup - \iftabu@spread \tabu@spreadarith % - \else \tabu@arith - \fi - \iftabu@measuring \tabu@measuringfalse - \expandafter \tabu@TRIAL % - \else - \expandafter \tabu@Xfinish - \the \expandafter\toks@ \tabu@endenvir % - \fi -}% \tabu@endTRIAL -\def\tabu@adl@endTRIAL{\crcr \noalign{\global\adl@ncol \tabu@nbcols}} -\def\tabu@arith{% - \advance\tabu@cnt \@ne \tabu@message{\tabu@message@arith}% - \ifx \@startpbox\tabu@measure@startpbox - \let\@startpbox \tabu@startpboxORI \fi - \dimen@ \tabu@X@sum - \iftabu@negcoef \tabu@arith@negcoef \fi - \ifcase 0\ifdim \dimexpr\wd\tabu@box-\tabu@hfuzz-1sp<\tabu@target - \else \ifdim \tabu@lasttry=\wd\tabu@box 1\else - 2\fi\fi\relax - \ifdim \tabu@X@sum=\dimen@ \tabu@message{\tabu@message@reached}% - \else\ifdim\tabu@X@sum=\z@ \tabu@message{\tabu@message@reached}% - \else\ifnum \tabu@cnt>\@ne \tabu@message{\tabu@message@reached}% - \else \tabu@measuringtrue - \tabucolX = \dimexpr\tabucolX*\p@/\tabu@X@sum\relax - \fi\fi\fi - \or \tabu@message{\tabu@header Reached minimum width. Backing up}% - \tabu@warn{tabu width = \the\wd\tabu@box\space> - \the\tabu@target\space+ \tabu@hfuzz}% - \or - \ifdim \tabu@X@sum=\z@ \tabu@measuringtrue \tabucolX=\@tempdima - \else - \advance\tabucolX-\dimexpr(\wd\tabu@box-\tabu@target-.5\tabu@X@sum/\p@) - *\p@/\tabu@X@sum\relax - \ifdim \tabucolX<\z@ - \tabu@warn{X Columns too narrow (table too wide)}% - \tabucolX=\tabucolX@error - \else \tabu@measuringtrue - \ifdim \tabu@X@sum=\dimen@ - \edef\tabu@lasttry{\the\wd\tabu@box}% +\long\def\tabu@pushbegins#1\begin#2{\ifx\end#2\else b\expandafter\tabu@pushbegins\fi}% +\def\tabu@endofcollect #1{\ifnum0=`{}\fi + \expandafter\endgroup \the\toks@ #1% +}% \tabu@endofcollect +%% The trials: switching between strategies ------------------------- +\def\tabu@strategy {\relax % stops \count@ assignment ! + \ifcase\count@ % case 0 = print with vertical adjustment (outer is finished) + \expandafter \tabu@endoftrials + \or % case 1 = exit in vertical measure (outer in mode 3) + \expandafter\xdef\csname tabu@\the\tabu@nested.T\endcsname{\the\tabu@target}% + \expandafter\xdef\csname tabu@\the\tabu@nested.X\endcsname{\the\tabucolX}% + \expandafter \tabu@endoftrials + \or % case 2 = exit with a rule replacing the table (outer in mode 4) + \expandafter \tabu@quickend + \or % case 3 = outer is in mode 3 because of no X + \begingroup + \tabu@evr{\tabu@verticalinit}\tabu@celllalign@def{\tabu@verticalmeasure}% + \def\tabu@cellralign{\tabu@verticalspacing}% + \expandafter \tabu@measuring + \else % case 4 = horizontal measure + \begingroup + \global\let\tabu@elapsedtime \tabu@message@etime + \long\def\multicolumn##1##2##3{\multispan{##1}}% + \let\tabu@startpboxORI \@startpbox + \iftabu@spread + \def\tabu@naturalXmax {\z@}% + \let\tabu@naturalXmin \tabu@naturalXmax + \tabu@evr{\global\tabu@naturalX \z@}% + \let\@startpbox \tabu@startpboxmeasure + \else\iftabu@negcoef + \let\@startpbox \tabu@startpboxmeasure + \else \let\@startpbox \tabu@startpboxquick + \fi\fi + \expandafter \tabu@measuring + \fi +}% \tabu@strategy +\def\tabu@measuring{\expandafter \tabu@trial \expandafter + \count@ \the\count@ \tabu@endtrial +}% \tabu@measuring +\def\tabu@trial{\iftabu@long \tabu@longtrial \else \tabu@shorttrial \fi} +\def\tabu@shorttrial {\setbox\tabu@box \hbox\bgroup \tabu@seteverycr + \ifx \tabu@savecounters\relax \else + \let\tabu@savecounters \relax \tabu@clckpt \fi + $\iftabuscantokens \tabu@rescan \else \expandafter\@secondoftwo \fi + \expandafter{\expandafter \tabuthepreamble + \the\tabu@thebody + \csname tabu@adl@endtrial\endcsname + \endarray}$\egroup % got \tabu@box +}% \tabu@shorttrial +\def\tabu@longtrial {\setbox\tabu@box \hbox\bgroup \tabu@seteverycr + \ifx \tabu@savecounters\relax \else + \let\tabu@savecounters \relax \tabu@clckpt \fi + \iftabuscantokens \tabu@rescan \else \expandafter\@secondoftwo \fi + \expandafter{\expandafter \tabuthepreamble + \the\tabu@thebody + \LT@echunk + \global\setbox\@ne \hbox{\unhbox\@ne}\kern\wd\@ne + \LT@get@widths}\egroup % got \tabu@box +}% \tabu@longtrial +\def\tabu@adl@endtrial{% + \crcr \noalign{\global\adl@ncol \tabu@nbcols}}% anything global is crap, junky and fails ! +\def\tabu@seteverycr {\tabu@reset + \everycr \expandafter{\the\everycr \tabu@everycr}% + \let\everycr \tabu@noeverycr % +}% \tabu@seteverycr +\def\tabu@noeverycr{{\aftergroup\tabu@restoreeverycr \afterassignment}\toks@} +\def\tabu@restoreeverycr {\let\everycr \tabu@@everycr} +\def\tabu@everycr {\iftabu@everyrow \noalign{\tabu@everyrow}\fi} +\def\tabu@endoftrials {% + \iftabuscantokens \expandafter\@firstoftwo + \else \expandafter\@secondoftwo + \fi + {\expandafter \tabu@closetrialsgroup \expandafter + \tabu@rescan \expandafter{% + \expandafter\tabuthepreamble + \the\tabu@thebody + \endarray}} + {\expandafter\tabu@closetrialsgroup \expandafter + \tabuthepreamble + \the\tabu@thebody}% + \tabu@endenvir % Finish ! +}% \tabu@endoftrials +\def\tabu@closetrialsgroup {% + \toks@\expandafter{\tabu@endenvir}% + \edef\tabu@bufferX{\endgroup + \tabucolX \the\tabucolX + \tabu@target \the\tabu@target + \tabu@cnt \the\tabu@cnt + \def\noexpand\tabu@endenvir{\the\toks@}% + %Quid de \@halignto = \tabu@halignto ?? + }% \tabu@bufferX + \tabu@bufferX + \ifcase\tabu@nested % print out (outer in mode 0) + \global\tabu@cnt \tabu@cnt + \tabu@evr{\tabu@verticaldynamicadjustment}% + \tabu@celllalign@def{\everypar{}}\let\tabu@cellralign \@empty + \let\@finalstrut \@gobble + \else % vertical measure of nested tabu + \tabu@evr{\tabu@verticalinit}% + \tabu@celllalign@def{\tabu@verticalmeasure}% + \def\tabu@cellralign{\tabu@verticalspacing}% + \fi + \tabu@clckpt \let\@halignto \tabu@halignto + \let\@halignto \@empty + \tabu@seteverycr + \ifdim \tabustrutrule>\z@ \ifnum\tabu@nested=\z@ + \setbox\@arstrutbox \box\voidb@x % force \@arstrutbox to be rebuilt (visible struts) + \fi\fi +}% \tabu@closetrialsgroup +\def\tabu@quickend {\expandafter \endgroup \expandafter + \tabu@target \the\tabu@target \tabu@quickrule + \let\endarray \relax \tabu@endenvir +}% \tabu@quickend +\def\tabu@endtrial {\relax % stops \count@ assignment ! + \ifcase \count@ \tabu@err % case 0 = impossible here + \or \tabu@err % case 1 = impossible here + \or \tabu@err % case 2 = impossible here + \or % case 3 = outer goes into mode 0 + \def\tabu@bufferX{\endgroup}\count@ \z@ + \else % case 4 = outer goes into mode 3 + \iftabu@spread \tabu@spreadarith % inner into mode 1 (outer in mode 3) + \else \tabu@arith % or 2 (outer in mode 4) + \fi + \count@=% + \ifcase\tabu@nested \thr@@ % outer goes into mode 3 + \else\iftabu@measuring \tw@ % outer is in mode 4 + \else \@ne % outer is in mode 3 + \fi\fi + \edef\tabu@bufferX{\endgroup + \tabucolX \the\tabucolX + \tabu@target \the\tabu@target}% + \fi + \expandafter \tabu@bufferX \expandafter + \count@ \the\count@ \tabu@strategy +}% \tabu@endtrial +\def\tabu@err{\errmessage{(tabu) Internal impossible error! (\count@=\the\count@)}} +%% The algorithms: compute the widths / stop or go on --------------- +\def\tabu@arithnegcoef {% + \@tempdima \z@ \dimen@ \z@ \let\tabu@ \tabu@arith@negcoef \tabu@Xcoefs +}% \tabu@arithnegcoef +\def\tabu@arith@negcoef #1#2{% + \ifdim #2\p@>\z@ \advance\dimen@ #2\p@ % saturated by definition + \advance\@tempdima #2\tabucolX + \else + \ifdim -#2\tabucolX <\tabu@wd{#1}% c_i X < natural width <= \tabu@target-> saturated + \advance\dimen@ -#2\p@ + \advance\@tempdima -#2\tabucolX + \else + \advance\@tempdima \tabu@wd{#1}% natural width <= c_i X => neutralised + \ifdim \tabu@wd{#1}<\tabu@target \else % neutralised + \advance\dimen@ -#2\p@ % saturated (natural width = tabu@target) + \fi + \fi + \fi +}% \tabu@arith@negcoef +\def\tabu@givespace #1#2{% here \tabu@DELTA < \z@ + \ifdim \@tempdima=\z@ + \tabu@wddef{#1}{\the\dimexpr -\tabu@DELTA*\p@/\tabu@Xsum}% + \else + \tabu@wddef{#1}{\the\dimexpr \tabu@hsize{#1}{#2} + *(\p@ -\tabu@DELTA*\p@/\@tempdima)/\p@\relax}% + \fi +}% \tabu@givespace +\def\tabu@arith {\advance\tabu@cnt \@ne + \ifnum \tabu@cnt=\@ne \tabu@message{\tabu@titles}\fi + \tabu@arithnegcoef + \@tempdimb \dimexpr \wd\tabu@box -\@tempdima \relax % + \tabu@DELTA = \dimexpr \wd\tabu@box - \tabu@target \relax + \tabu@message{\tabu@message@arith}% + \ifdim \tabu@DELTA <\tabu@hfuzz + \ifdim \tabu@DELTA<\z@ % wd (tabu)<\tabu@target ? + \let\tabu@ \tabu@givespace \tabu@Xcoefs + \advance\@tempdima \@tempdimb \advance\@tempdima -\tabu@DELTA % for message + \else % already converged: nothing to do but nearly impossible... + \fi + \tabucolX \maxdimen + \tabu@measuringfalse + \else % need for narrower X columns + \tabucolX =\dimexpr (\@tempdima -\tabu@DELTA) *\p@/\tabu@Xsum \relax + \tabu@measuringtrue + \@whilesw \iftabu@measuring\fi {% + \advance\tabu@cnt \@ne + \tabu@arithnegcoef + \tabu@DELTA =\dimexpr \@tempdima+\@tempdimb -\tabu@target \relax % always < 0 here + \tabu@message{\tabu@header + \tabu@msgalign \tabucolX { }{ }{ }{ }{ }\@@ + \tabu@msgalign \@tempdima+\@tempdimb { }{ }{ }{ }{ }\@@ + \tabu@msgalign \tabu@target { }{ }{ }{ }{ }\@@ + \tabu@msgalign@PT \dimen@ { }{}{}{}{}{}{}\@@ + \ifdim -\tabu@DELTA<\tabu@hfuzz \tabu@spaces target ok\else + \tabu@msgalign \dimexpr -\tabu@DELTA *\p@/\dimen@ {}{}{}{}{}\@@ + \fi}% + \ifdim -\tabu@DELTA<\tabu@hfuzz + \advance\@tempdima \@tempdimb % for message + \tabu@measuringfalse \else - \ifnum \tabu@cnt>\@ne \edef\tabu@lasttry{\the\wd\tabu@box}\fi - \ifdim \tabucolX<\@tempdima \tabucolX \@tempdima\fi + \advance\tabucolX \dimexpr -\tabu@DELTA *\p@/\dimen@ \relax \fi - \fi - \fi - \fi %(ifcase) - \iftabu@measuring - \else \edef\tabu@global@X{\tabu@global@X - \tabucolX \the\tabucolX\relax - \tabu@target \the\tabu@target\relax % < for \savetabu > - \ifnum \tabu@nested=\z@ - \ifx \@arrayright\@empty - \ifdim \tabu@X@sum>\z@ - \def\noexpand\@halignto{to\the\tabu@target}\fi\fi\fi}% - \fi - \tabu@X@sum \dimen@ + }% + \fi + \tabu@message{\tabu@message@reached}% + \edef\tabu@bufferX{\endgroup \tabu@cnt \the\tabu@cnt + \tabucolX \the\tabucolX + \tabu@target \the\tabu@target}% }% \tabu@arith -\def\tabu@arith@negcoef{% - \tabu@X@cols \@ne \count@ \tabu@X@cols - \@whilesw \ifcsname tabu@X\the\tabu@X@cols\endcsname\fi{% - \ifdim \tabu@wd\tabu@X@cols>\p@ - \expandafter\let\expandafter\tabu@temp - \csname tabu@X\the\tabu@X@cols\endcsname - \ifdim \tabu@wd\tabu@X@cols <\tabu@temp\tabucolX - \advance\tabu@X@sum -\tabu@temp\p@ - \tabu@message{\tabu@message@negcoef{\the\tabu@X@cols}}% - \ifdim \tabu@wd\tabu@X@cols >\tabu@wd\count@ \count@ \tabu@X@cols \fi - \fi\fi - \advance\tabu@X@cols \@ne - }% - \@tempdima=\dimexpr\tabu@wd\count@ * \p@/ - \dimexpr\csname tabu@X\the\count@\endcsname\p@\relax\relax -}% \tabu@arith@negcoef -\def\tabu@spreadarith{% - \tabu@naturalX \tabu@naturalX@max\relax - \tabucolX \tabu@naturalX@min\relax - \tabu@message{\tabu@message@spread}% - \ifdim \dimexpr \wd\tabu@box + \tabu@spreadtarget <\tabu@target - \advance\tabu@spreadtarget - \dimexpr\wd\tabu@box-\tabu@naturalX+\tabucolX\relax - \ifdim \tabu@spreadtarget <\tabu@target - \tabu@target =\tabu@spreadtarget - \fi - \tabu@message{\the\tabu@target}% - \tabu@message{\ifdim \tabu@spreadtarget>\tabu@target - (tabu) spread reduced to fit default target.\fi}% - \else - \tabu@message{\expandafter\tabu@msg@align \the\tabu@target { }{}{}{}{}\@@} - \tabu@message{(tabu)\ifdim\wd\tabu@box<\tabu@target spread too large\else - tabu spread is useless here\fi, - default target used.}% - \fi - \let\@startpbox \tabu@startpboxORI - \xdef\tabu@halignto {to\the\tabu@target}% - \tabucolX \tabu@target - \tabu@spreadfalse \tabu@measuringtrue +\def\tabu@spreadarith {% + \dimen@ \z@ \@tempdima \tabu@naturalXmax \let\tabu@ \tabu@spread@arith \tabu@Xcoefs + \edef\tabu@naturalXmin {\the\dimexpr\tabu@naturalXmin*\dimen@/\p@}% + \@tempdimc =\dimexpr \wd\tabu@box -\tabu@naturalXmax+\tabu@naturalXmin \relax + \iftabu@measuring + \tabu@target =\dimexpr \@tempdimc+\tabu@spreadtarget \relax + \edef\tabu@bufferX{\endgroup \tabucolX \the\tabucolX \tabu@target\the\tabu@target}% + \else + \tabu@message{\tabu@message@spreadarith}% + \ifdim \dimexpr \@tempdimc+\tabu@spreadtarget >\tabu@target + \tabu@message{(tabu) spread + \ifdim \@tempdimc>\tabu@target useless here: default target used% + \else too large: reduced to fit default target\fi.}% + \else + \tabu@target =\dimexpr \@tempdimc+\tabu@spreadtarget \relax + \tabu@message{(tabu) spread: New target set to \the\tabu@target^^J}% + \fi + \begingroup \let\tabu@wddef \@gobbletwo + \@tempdimb \@tempdima + \tabucolX@init + \tabu@arithnegcoef + \wd\tabu@box =\dimexpr \wd\tabu@box +\@tempdima-\@tempdimb \relax + \expandafter\endgroup \expandafter\tabucolX \the\tabucolX + \tabu@arith + \fi }% \tabu@spreadarith -\def\tabu@message@arith{\tabu@header - \expandafter\tabu@msg@align \the\tabucolX { }{ }{ }{ }{}\@@ - \expandafter\tabu@msg@align \the\wd\tabu@box { }{ }{ }{ }{}\@@ - \expandafter\tabu@msg@align \the\tabu@target { }{ }{ }{ }{}\@@ - \expandafter\tabu@msg@align \the\tabu@X@sum {}{}{}{}{}\@@ - \ifx\@startpbox\tabu@measure@startpbox\tabu@spaces (coefs<0)\else - \ifdim\tabu@X@sum>\z@ - \expandafter\tabu@msg@align \the\dimexpr(\tabu@target-\wd\tabu@box) - *\p@/\tabu@X@sum\relax {}{}{}{}{}\@@\fi\fi^^J}% -\def\tabu@message@spread{\tabu@spreadheader - \expandafter\tabu@msg@align \the\tabu@spreadtarget {}{}{}{}{}\@@ - \expandafter\tabu@msg@align \the\wd\tabu@box {}{}{}{}{}\@@ - \expandafter\tabu@msg@align \the\tabucolX {}{}{}{}{}\@@ - \expandafter\tabu@msg@align \expandafter-\the\tabu@naturalX {}{}{}{}{}\@@} +\def\tabu@spread@arith #1#2{% + \ifdim #2\p@>\z@ \advance\dimen@ #2\p@ + \else \advance\@tempdima \tabu@wd{#1}\relax + \fi +}% \tabu@spread@arith +%% Reporting in the .log file --------------------------------------- +\def\tabu@message@defaulttarget{% + \ifnum\tabu@nested=\z@^^J(tabu) Default target: + \ifx\tabudefaulttarget\linewidth \string\linewidth + \ifdim \tabu@thetarget=\linewidth \else + -\the\dimexpr\linewidth-\tabu@thetarget\fi = + \else\ifx\tabudefaulttarget\linegoal\string\linegoal= + \fi\fi + \else (tabu) Default target (nested): \fi + \the\tabu@target \on@line + \ifnum\tabu@nested=\z@ , page \the\c@page\fi} +\def\tabu@message@target {^^J(tabu) Target specified: + \the\tabu@target \on@line, page \the\c@page} +\def\tabu@message@arith {\tabu@header + \tabu@msgalign \tabucolX { }{ }{ }{ }{ }\@@ + \tabu@msgalign \wd\tabu@box { }{ }{ }{ }{ }\@@ + \tabu@msgalign \tabu@target { }{ }{ }{ }{ }\@@ + \tabu@msgalign@PT \dimen@ { }{}{}{}{}{}{}\@@ + \ifdim \tabu@DELTA<\tabu@hfuzz giving space\else + \tabu@msgalign \dimexpr (\@tempdima-\tabu@DELTA) *\p@/\tabu@Xsum -\tabucolX {}{}{}{}{}\@@ + \fi +}% \tabu@message@arith +\def\tabu@message@spreadarith {\tabu@spreadheader + \tabu@msgalign \tabu@spreadtarget { }{ }{ }{ }{}\@@ + \tabu@msgalign \wd\tabu@box { }{ }{ }{ }{}\@@ + \tabu@msgalign -\tabu@naturalXmax { }{}{}{}{}\@@ + \tabu@msgalign \tabu@naturalXmin { }{ }{ }{ }{}\@@ + \tabu@msgalign \ifdim \dimexpr\@tempdimc>\tabu@target \tabu@target + \else \@tempdimc+\tabu@spreadtarget \fi + {}{}{}{}{}\@@} +\def\tabu@message@negcoef #1#2{ + \tabu@spaces\tabu@spaces\space * #1. X[\rem@pt#2]: + \space width = \tabu@wd {#1} + \expandafter\string\csname tabu@\the\tabu@nested.W\number#1\endcsname + \ifdim -\tabu@pt#2\tabucolX<\tabu@target + < \number-\rem@pt#2 X + = \the\dimexpr -\tabu@pt#2\tabucolX \relax + \else + <= \the\tabu@target\space < \number-\rem@pt#2 X\fi} \def\tabu@message@reached{\tabu@header - \expandafter\tabu@msg@align \the\tabucolX { }{ }{ }{ }{}\@@ - \expandafter\tabu@msg@align \the\wd\tabu@box {}{}{}{}{}\@@ - <\expandafter\tabu@msg@align \the\tabu@target { }{ }{ }{ }{}\@@ - + \tabu@hfuzz\space= hfuzz *****^^J% - (tabu)\tabu@spaces******* Reached Target: - hfuzz = \tabu@hfuzz\on@line\space *******^^J% - \ifnum\tabu@nested=\z@ \tabu@elapsedtime ^^J\fi}% -\def\tabu@message@etime{(tabu)\tabu@spaces - Time elapsed for trials: - \the\numexpr(\pdfelapsedtime-\tabu@starttime-32767)/65536\relax sec - \the\numexpr\numexpr(\pdfelapsedtime-\tabu@starttime) - -\numexpr(\pdfelapsedtime-\tabu@starttime-32767)/65536\relax*65536\relax - *1000/65536\relax ms}% -\def\tabu@message@negcoef #1{\tabu@spaces\tabu@spaces - * #1. X[-\csname tabu@X#1\endcsname]: natural width - = \tabu@wd{#1} - < \csname tabu@X#1\endcsname X - = \the\dimexpr\csname tabu@X#1\endcsname\tabucolX -}% \tabu@message@negcoef + ******* Reached Target: + hfuzz = \tabu@hfuzz\on@line\space *******} +\def\tabu@message@etime{\edef\tabu@stoptime{\the\pdfelapsedtime}% + \tabu@message{(tabu)\tabu@spaces Time elapsed during measure: + \the\numexpr(\tabu@stoptime-\tabu@starttime-32767)/65536\relax sec + \the\numexpr\numexpr(\tabu@stoptime-\tabu@starttime) + -\numexpr(\tabu@stoptime-\tabu@starttime-32767)/65536\relax*65536\relax + *1000/65536\relax ms \tabu@spaces(\the\tabu@cnt\space + cycle\ifnum\tabu@cnt>\@ne s\fi)^^J^^J}} +\def\tabu@message@verticalsp {% + \ifdim \@tempdima>\tabu@ht + \ifdim \@tempdimb>\tabu@dp + \expandafter\expandafter\expandafter\string\tabu@ht = + \tabu@msgalign \@tempdima { }{ }{ }{ }{ }\@@ + \expandafter\expandafter\expandafter\string\tabu@dp = + \tabu@msgalign \@tempdimb { }{ }{ }{ }{ }\@@^^J% + \else + \expandafter\expandafter\expandafter\string\tabu@ht = + \tabu@msgalign \@tempdima { }{ }{ }{ }{ }\@@^^J% + \fi + \else\ifdim \@tempdimb>\tabu@dp + \tabu@spaces\tabu@spaces\tabu@spaces + \expandafter\expandafter\expandafter\string\tabu@dp = + \tabu@msgalign \@tempdimb { }{ }{ }{ }{ }\@@^^J\fi + \fi +}% \tabu@message@verticalsp \edef\tabu@spaces{\@spaces} -\def\do#1{% - \def\tabu@msg@align##1.##2##3##4##5##6##7##8##9\@@{% - \ifnum##1<10 #1 #1\else - \ifnum##1<100 #1 \else - \ifnum##1<\@m #1\fi\fi\fi - ##1.##2##3##4##5##6##7##8#1}% - \def\tabu@header{(tabu) \ifnum\tabu@cnt<10 #1\fi\the\tabu@cnt) #1}% - \def\tabu@titles{\ifnum \tabu@nested=\z@ +\def\tabu@strippt{\expandafter\tabu@pt\the} +{\@makeother\P \@makeother\T\lowercase{\gdef\tabu@pt #1PT{#1}}} +\def\tabu@msgalign{\expandafter\tabu@msg@align\the\dimexpr} +\def\tabu@msgalign@PT{\expandafter\tabu@msg@align\romannumeral-`\0\tabu@strippt} +\def\do #1{% + \def\tabu@msg@align##1.##2##3##4##5##6##7##8##9\@@{% + \ifnum##1<10 #1 #1\else + \ifnum##1<100 #1 \else + \ifnum##1<\@m #1\fi\fi\fi + ##1.##2##3##4##5##6##7##8#1}% + \def\tabu@header{(tabu) \ifnum\tabu@cnt<10 #1\fi\the\tabu@cnt) }% + \def\tabu@titles{\ifnum \tabu@nested=\z@ (tabu) Try#1 #1 tabu X #1 #1 #1tabu Width #1 #1 Target - #1 #1 #1 #1 Coefs #1 #1 #1 Update^^J\fi}% - \def\tabu@spreadheader{% - (tabu) Try#1 #1 Spread #1 #1 tabu Width #1 #1 Nat. Min. #1 #1 #1 Nat.X - #1 #1 #1 New Target^^J% - (tabu)spread}% - \def\tabu@tracing@save##1{\begingroup - \def\col@sep ####1\relax {(tabu) column sep #1 #1 #1 = ####1^^J}% - \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}% - \iftabu@colortbl - \def\CT@arc@####1{(tabu) arrayrulecolor #1 = ####1^^J}% - \def\CT@drsc@####1{(tabu) doublerulesepcolor=####1^^J}% - \let\color \relax - \fi - \def\NC@find ####1\@nil{(tabu) tabu preamble#1 #1 = \detokenize{####1}^^J}% - \def\tabu@wddef####1####2{(tabu) Natural width ####1 = ####2^^J}% - \let\edef \@gobbletwo \let\def \@empty - \tabu@message{% - (tabu) \string\savetabu{##1}: \on@line^^J% - \ifx \savetabu\tabusaveX - (tabu) X columns width #1 = \the\tabucolX^^J\fi - (tabu) target #1 #1 #1 #1 #1 = \the\tabu@target^^J% - \tabu@savedparam - \tabu@savedpream \@nil - \iftabu@negcoef \tabu@savewd\fi}% - \endgroup}% + #1 #1 #1 Coefs #1 #1 #1 Update^^J\fi}% + \def\tabu@spreadheader{% + (tabu) Try#1 #1 Spread #1 #1 tabu Width #1 #1 #1 Nat. X #1 #1 #1 #1Nat. Min. + #1 New Target^^J% + (tabu) sprd} + \def\tabu@message@save {\begingroup + \def\x ####1{\tabu@msg@align ####1{ }{ }{ }{ }{}\@@} + \def\z ####1{\expandafter\x\expandafter{\romannumeral-`\0\tabu@strippt + \dimexpr####1\p@{ }{ }}}% + \let\color \relax \def\tabu@rulesstyle ####1####2{\detokenize{####1}}% + \let\CT@arc@ \relax \let\@preamble \@gobble + \let\tabu@savedpream \@firstofone + \let\tabu@savedparams \@firstofone + \def\tabu@target ####1\relax {(tabu) target #1 #1 #1 #1 #1 = \x{####1}^^J}% + \def\tabucolX ####1\relax {(tabu) X columns width#1 = \x{####1}^^J}% + \def\tabu@nbcols ####1\relax {(tabu) Number of columns: \z{####1}^^J}% + \def\tabu@aligndefault ####1{(tabu) Default alignment: #1 #1 ####1^^J}% + \def\col@sep ####1\relax {(tabu) column sep #1 #1 #1 = \x{####1}^^J}% + \def\arrayrulewidth ####1\relax{(tabu) arrayrulewidth #1 = \x{####1}}% + \def\doublerulesep ####1\relax { doublerulesep = \x{####1}^^J}% + \def\extratabsurround####1\relax{(tabu) extratabsurround = \x{####1}^^J}% + \def\extrarowheight ####1\relax{(tabu) extrarowheight #1 = \x{####1}}% + \def\extrarowdepth ####1\relax {extrarowdepth = \x{####1}^^J}% + \def\arraystretch ####1{(tabu) arraystretch #1 #1 = \z{####1}^^J}% + \def\minrowclearance####1\relax{(tabu) minrowclearance #1 = \x{####1}^^J}% + \def\tabu@arc@L ####1{(tabu) taburulecolor #1 #1 = ####1^^J}% + \def\tabu@drsc@L ####1{(tabu) tabudoublerulecolor= ####1^^J}% + \def\tabu@evr@L ####1{(tabu) everyrow #1 #1 #1 #1 = \detokenize{####1}^^J}% + \def\tabu@ls@L ####1{(tabu) line style = \detokenize{####1}^^J}% + \def\NC@find ####1\@nil{(tabu) tabu preamble#1 #1 = \detokenize{####1}^^J}% + \def\tabu@wddef####1####2{(tabu) Natural width ####1 = \x{####2}^^J}% + \let\edef \@gobbletwo \let\def \@empty \let\let \@gobbletwo + \tabu@message{% + (tabu) \string\savetabu{\tabu@temp}: \on@line^^J% + \tabu@usetabu \@nil^^J}% + \endgroup} }\do{ } -\def\tabu@measure@startpbox#1{\bgroup - \let\@startpbox \tabu@startpboxORI % in case of nesting - \in@{\tabu@dimexpr}{#1}% - \ifin@ - \global\advance\tabu@X@cols \@ne - \ifcsname tabu@X\the\tabu@X@cols\endcsname\else - \global\tabu@X@cols \@ne - \global\tabu@naturalX \z@ - \fi - \fi - \iftabu@spread\else - \ifin@ {\let\tabu@dimexpr \@firstoftwo\expandafter}% - \ifdim \tabu@wd{#1}<\p@ \in@false\fi\fi\fi - \ifin@ - \begingroup \let\tabu@dimexpr \@secondoftwo - \edef\x{\endgroup \def\noexpand\tabu@temp{\the\dimexpr#1}% - }\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 - \let\tabu@noadjustspacing\relax -\fi -\def\tabu@measure@endpbox{% - \@finalstrut\@arstrutbox\end{varwidth}\egroup % - \global\advance\tabu@naturalX \wd\tabu@box - \ifdim \tabu@naturalX@max<\tabu@naturalX - \xdef\tabu@naturalX@max{\the\tabu@naturalX}\fi - \@tempdima=\dimexpr \wd\tabu@box * \tabu@X@sum / - \dimexpr\csname tabu@X\the\tabu@X@cols\endcsname\p@\relax\relax - \ifdim \tabu@naturalX@min<\@tempdima - \xdef\tabu@naturalX@min{\the\@tempdima}\fi - \ifdim \tabu@wd\tabu@X@cols>\z@ - \ifdim \tabu@wd\tabu@X@cols<\wd\tabu@box - \tabu@wddef\tabu@X@cols {\the\wd\tabu@box}% - \tabu@debug{\tabu@spaces\tabu@spaces - * \the\tabu@X@cols. X[-\csname tabu@X\the\tabu@X@cols\endcsname]: - target=\the\dimexpr\tabu@temp\relax\space - \expandafter\expandafter\expandafter\string\tabu@wd\tabu@X@cols - =\tabu@wd\tabu@X@cols}% - \fi\fi - \box\tabu@box \egroup % end of \vtop (measure) -}% \tabu@measure@endpbox -\def\tabu@wd#1{\csname tabu@W\the\tabu@nested @\number#1\endcsname} -\def\tabu@wddef#1{\expandafter\xdef - \csname tabu@W\the\tabu@nested @\number#1\endcsname} -\def\tabu@wdlet#1{\global\expandafter\let - \csname tabu@W\the\tabu@nested @\number#1\endcsname} -\def\tabu@naturalX@min{\z@} -\def\tabu@naturalX@max{\z@} -\def\tabu@setup@everycr{% - \tabu@firstclinetrue \tabu@everyrowtrue - \let\tabu@first@cline \z@ - \def\tabu@restoreeverycr {\let\everycr \tabu@everycr}% - \def\everycr{\afterassignment\tabu@restoreeverycr \@temptokena}% - \tabu@everycr\expandafter{\the\tabu@everycr \tabu@everyrow}% -}% \tabu@setup@everycr -\def\tabu@everyrow{% - \noalign{% - \ifcase\tabu@first@cline - \global\let\tabu@first@cline \tw@ - \or\global\let\tabu@first@cline \tw@ - \or\global\tabu@firstclinefalse - \global\let\tabu@first@cline \m@ne - \fi}% - \tabu@rowfontreset - \iftabu@everyrow - \noalign{\tabu@everyrowfalse}\expandafter\tabu@everyrow@hook - \fi -}% \tabu@everyrow -\let\tabu@everyrow@hook \@empty -\def\tabuphantomline{\crcr\noalign{% - \global\let\@arstrutbox \voidb@x - \iftabu@colortbl - \xdef\tabu@minrowclearance{\the\minrowclearance}% - \global\minrowclearance \z@ - \fi - \global\let\vcenter \vbox - \ifnum \tabu@nested>\z@ \vspace*{\dimexpr\extrarowheight-\ht\@arstrutbox}\fi - \toks@{}\count@\@ne - \@whilenum\count@<\tabu@nbcols\do{\advance\count@\@ne - \toks@\expandafter{\the\toks@&}}% - \toks@\expandafter{\the\toks@ - \cr\noalign{% - \global\let\@arstrutbox \tabu@arstrutbox - \global\let\vcenter \tabu@vcenter - \iftabu@colortbl - \global\minrowclearance \tabu@minrowclearance\relax\fi - \global\let\tabu@first@cline \@ne}}% - \expandafter}\the\toks@ -}% \tabuphantomline -\def\tabu@lines{{\endlinechar\m@ne \scantokens{\def\x{|}}% - \expandafter}\expandafter\tabu@lines@ \x -}% \tabu@lines -\def\tabu@lines@#1{% - \tabu@newcolumntype #1{\tabuvline@rewrite}% - \NC@list\expandafter{\the\NC@list \NC@do #1}% -}% \tabu@lines@ -\newcommand*\tabuvline@rewrite[1][]{\tabuvline@arg{#1}% - \expandafter \NC@find \tabu@temp} -\def\tabu@vline#1{\vrule width#1} +%% Measuring the natural width (varwidth) - store the results ------- +\def\tabu@startpboxmeasure #1{\bgroup % entering \vtop + \edef\tabu@temp{\expandafter\@secondoftwo \ifx\tabu@hsize #1\else\relax\fi}% + \ifodd 1\ifx \tabu@temp\@empty 0 \else % starts with \tabu@hsize ? + \iftabu@spread \else % if spread -> measure + \ifdim \tabu@temp\p@>\z@ 0 \fi\fi\fi% if coef>0 -> do not measure + \let\@startpbox \tabu@startpboxORI % restore immediately (nesting) + \tabu@measuringtrue % for the quick option... + \tabu@Xcol =\expandafter\@firstoftwo\ifx\tabu@hsize #1\fi + \ifdim \tabu@temp\p@>\z@ \ifdim \tabu@temp\tabucolX<\tabu@target + \tabu@target=\tabu@temp\tabucolX \fi\fi + \setbox\tabu@box \hbox \bgroup + \begin{varwidth}\tabu@target + \let\FV@ListProcessLine \tabu@FV@ListProcessLine % \hbox to natural width... + \narrowragged \arraybackslash \parfillskip \@flushglue + \ifdefined\pdfadjustspacing \pdfadjustspacing\z@ \fi + \bgroup \aftergroup\tabu@endpboxmeasure + \ifdefined \cellspacetoplimit \tabu@cellspacepatch \fi + \else \expandafter\@gobble + \tabu@startpboxquick{#1}% \@gobble \bgroup + \fi +}% \tabu@startpboxmeasure +\def\tabu@cellspacepatch{\def\bcolumn##1\@nil{}\let\ecolumn\@empty + \bgroup\color@begingroup} +\def\tabu@endpboxmeasure {% + \@finalstrut \@arstrutbox + \end{varwidth}\egroup % + \ifdim \tabu@temp\p@ <\z@ % neg coef + \ifdim \tabu@wd\tabu@Xcol <\wd\tabu@box + \tabu@wddef\tabu@Xcol {\the\wd\tabu@box}% + \tabu@debug{\tabu@message@endpboxmeasure}% + \fi + \else % spread coef>0 + \global\advance \tabu@naturalX \wd\tabu@box + \@tempdima =\dimexpr \wd\tabu@box *\p@/\dimexpr \tabu@temp\p@\relax \relax + \ifdim \tabu@naturalXmax <\tabu@naturalX + \xdef\tabu@naturalXmax {\the\tabu@naturalX}\fi + \ifdim \tabu@naturalXmin <\@tempdima + \xdef\tabu@naturalXmin {\the\@tempdima}\fi + \fi + \box\tabu@box \egroup % end of \vtop (measure) restore \tabu@target +}% \tabu@endpboxmeasure +\def\tabu@wddef #1{\expandafter\xdef + \csname tabu@\the\tabu@nested.W\number#1\endcsname} +\def\tabu@wd #1{\csname tabu@\the\tabu@nested.W\number#1\endcsname} +\def\tabu@message@endpboxmeasure{\tabu@spaces\tabu@spaces<-> % <-> save natural wd + \the\tabu@Xcol. X[\tabu@temp]: + target = \the\tabucolX \space + \expandafter\expandafter\expandafter\string\tabu@wd\tabu@Xcol + =\tabu@wd\tabu@Xcol +}% \tabu@message@endpboxmeasure +\def\tabu@startpboxquick {\bgroup + \let\@startpbox \tabu@startpboxORI % restore immediately + \let\tabu \tabu@quick % \begin is expanded before... + \expandafter\@gobble \@startpbox % gobbles \bgroup +}% \tabu@startpboxquick +\def\tabu@quick {\begingroup \iffalse{\fi \ifnum0=`}\fi + \toks@{}\def\tabu@stack{b}\tabu@collectbody + \endgroup +}% \tabu@quick +%% Measuring the heights and depths - store the results ------------- +\def\tabu@verticalmeasure{\everypar{}% + \ifnum \currentgrouptype>12 % 14=semi-simple, 15=math shift group + \setbox\tabu@box =\hbox\bgroup + \let\tabu@verticalspacing \tabu@verticalsp@lcr + \d@llarbegin % after \hbox ... + \else + \edef\tabu@temp{\ifnum\currentgrouptype=5\vtop + \else\ifnum\currentgrouptype=12\vcenter + \else\vbox\fi\fi}% + \setbox\tabu@box \hbox\bgroup$\tabu@temp \bgroup + \let\tabu@verticalspacing \tabu@verticalsp@pmb + \fi +}% \tabu@verticalmeasure +\def\tabu@verticalsp@lcr{% + \d@llarend \egroup % + \@tempdima \dimexpr \ht\tabu@box+\abovetabulinesep + \@tempdimb \dimexpr \dp\tabu@box+\belowtabulinesep \relax + \ifdim\tabustrutrule>\z@ \tabu@debug{\tabu@message@verticalsp}\fi + \ifdim \tabu@ht<\@tempdima \tabu@htdef{\the\@tempdima}\fi + \ifdim \tabu@dp<\@tempdimb \tabu@dpdef{\the\@tempdimb}\fi + \noindent\vrule height\@tempdima depth\@tempdimb +}% \tabu@verticalsp@lcr +\def\tabu@verticalsp@pmb{% inserts struts as needed + \par \expandafter\egroup + \expandafter$\expandafter + \egroup \expandafter + \@tempdimc \the\prevdepth + \@tempdima \dimexpr \ht\tabu@box+\abovetabulinesep + \@tempdimb \dimexpr \dp\tabu@box+\belowtabulinesep \relax + \ifdim\tabustrutrule>\z@ \tabu@debug{\tabu@message@verticalsp}\fi + \ifdim \tabu@ht<\@tempdima \tabu@htdef{\the\@tempdima}\fi + \ifdim \tabu@dp<\@tempdimb \tabu@dpdef{\the\@tempdimb}\fi + \let\@finalstrut \@gobble + \hrule height\@tempdima depth\@tempdimb width\hsize +%% \box\tabu@box +}% \tabu@verticalsp@pmb -\def\tabuvline@arg#1{% - \ifx\\#1\\% - \edef\tabu@temp{!{% - \iftabu@colortbl\begingroup\noexpand\CT@arc@\fi - \noexpand\tabu@vline\arrayrulewidth - \iftabu@colortbl\endgroup\fi}}% - \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{% - \let\tabu@color \@empty - \ifcat A\noexpand\tabu@temp - \@tempdima\arrayrulewidth - \expandafter\tabu@getlinecolor - \else \expandafter\tabuvline@argii - \fi -}% \tabuvline@argi -\def\tabuvline@argii#1\@nnil{% - \tabu@maybecolor \@tempdima #1 \@nnil -}% \tabuvline@argii -\def\tabuvline@argiii{% - \edef\tabu@temp{!{\begingroup - \ifx\tabu@color\@empty - \iftabu@colortbl \noexpand\CT@arc@ \fi - \else \tabu@color\fi - \noexpand\tabu@vline{\the\@tempdima}\endgroup}}% -}% \tabuvline@argiii -\def\tabu@linedash{4pt}% -\def\tabu@dashgap{4pt}% -\def\tabucline{\crcr\noalign{\ifnum0=`}\fi \@ifstar - {\@tempswatrue \tabu@cline} - {\@tempswafalse \tabu@cline}}% -\newcommand*\tabu@cline[2][]{\toks@{}% - \tabu@startstop{#2}\tabu@getlinespec{#1}\@multicnt\@ne - \ifnum\tabu@start>\tabu@stop - \else\ifx\tabu@xleaders\relax - \else - \toks@{\noalign{\global\let\@arstrutbox \voidb@x}}% -%% \iftabu@firstcline\if\tabu@align t\vskip-\ht\@arstrutbox\fi\fi - \@whilenum\@multicnt<\tabu@start\do{\advance\@multicnt\@ne - \toks@\expandafter{\the\toks@ &}}% - \loop - \toks@\expandafter{\the\toks@ \omit }% - \ifnum \@multicnt=\@ne - \expandafter \tabu@add \csname tabu@tok@\the\@multicnt L\endcsname \@nil - \fi - \ifcase 0\if@tempswa\else\ifnum \@multicnt<\tabu@stop 1\fi\fi\relax - \toks@\expandafter{\the\toks@ \begingroup}% - \toks@\expandafter{\the\expandafter\toks@ - \tabu@xleaders \endgroup}% - \fi - \ifcase 0\if@tempswa\else\ifnum \@multicnt<\tabu@stop 1\fi\fi\relax - \expandafter \tabu@add \csname tabu@tok@\the\@multicnt R\endcsname \@nil - \fi - \ifnum\@multicnt<\tabu@stop - \advance\@multicnt\@ne - \if@tempswa \toks@\expandafter{\the\toks@ &}% - \else \toks@\expandafter{\the\toks@ \span}\fi - \repeat - \@whilenum\@multicnt<\tabu@nbcols\do{\advance\@multicnt\@ne - \toks@\expandafter{\the\toks@ &}}% - \toks@\expandafter{\the\toks@ \cr - \noalign{\global\let\@arstrutbox \tabu@arstrutbox}}% -%% \tabu@debug{LIGNE AJOUTEE:\the\toks@}% - \fi\fi - \ifnum0=`{\fi\expandafter}\the\toks@ +\def\tabu@verticalinit{% + \ifnum \c@taburow=\z@ \tabu@rearstrut \fi % after \tabu@reset ! + \advance\c@taburow \@ne + \tabu@htdef{\the\ht\@arstrutbox}\tabu@dpdef{\the\dp\@arstrutbox}% + \advance\c@taburow \m@ne +}% \tabu@verticalinit +\def\tabu@htdef {\expandafter\xdef \csname tabu@\the\tabu@nested.H\the\c@taburow\endcsname} +\def\tabu@ht {\csname tabu@\the\tabu@nested.H\the\c@taburow\endcsname} +\def\tabu@dpdef {\expandafter\xdef \csname tabu@\the\tabu@nested.D\the\c@taburow\endcsname} +\def\tabu@dp {\csname tabu@\the\tabu@nested.D\the\c@taburow\endcsname} +\def\tabu@verticaldynamicadjustment {% + \advance\c@taburow \@ne + \extrarowheight \dimexpr\tabu@ht - \ht\strutbox + \extrarowdepth \dimexpr\tabu@dp - \dp\strutbox + \let\arraystretch \@empty + \advance\c@taburow \m@ne +}% \tabu@verticaldynamicadjustment +\def\tabuphantomline{\crcr \noalign{% + {\globaldefs \@ne + \setbox\@arstrutbox \box\voidb@x + \let\tabu@@celllalign \tabu@celllalign + \let\tabu@@cellralign \tabu@cellralign + \let\tabu@@cellleft \tabu@cellleft + \let\tabu@@cellright \tabu@cellright + \let\tabu@@thevline \tabu@thevline + \let\tabu@celllalign \@empty + \let\tabu@cellralign \@empty + \let\tabu@cellright \@empty + \let\tabu@cellleft \@empty + \let\tabu@thevline \relax}% + \edef\tabu@temp{\tabu@multispan \tabu@nbcols{\noindent &}}% + \toks@\expandafter{\tabu@temp \noindent\tabu@everyrowfalse \cr + \noalign{\tabu@rearstrut + {\globaldefs\@ne + \let\tabu@celllalign \tabu@@celllalign + \let\tabu@cellralign \tabu@@cellralign + \let\tabu@cellleft \tabu@@cellleft + \let\tabu@cellright \tabu@@cellright + \let\tabu@thevline \tabu@@thevline}}}% + \expandafter}\the\toks@ +}% \tabuphantomline +%% \firsthline and \lasthline corrections --------------------------- +\def\tabu@firstline {\tabu@hlineAZ \tabu@firsthlinecorrection {}} +\def\tabu@firsthline{\tabu@hlineAZ \tabu@firsthlinecorrection \hline} +\def\tabu@lastline {\tabu@hlineAZ \tabu@lasthlinecorrection {}} +\def\tabu@lasthline {\tabu@hlineAZ \tabu@lasthlinecorrection \hline} +\def\tabu@hline {% replaces \hline if no colortbl (see \AtBeginDocument) + \noalign{\ifnum0=`}\fi + {\CT@arc@\hrule height\arrayrulewidth}% + \futurelet \tabu@temp \tabu@xhline +}% \tabu@hline +\def\tabu@xhline{% + \ifx \tabu@temp \hline + {\ifx \CT@drsc@\relax \vskip + \else\ifx \CT@drsc@\@empty \vskip + \else \CT@drsc@\hrule height + \fi\fi + \doublerulesep}% + \fi + \ifnum0=`{\fi}% +}% \tabu@xhline +\def\tabu@hlineAZ #1#2{\noalign{\ifnum0=`}\fi \dimen@ \z@ \count@ \z@ + \toks@{}\def\tabu@hlinecorrection{#1}\def\tabu@temp{#2}% + \tabu@hlineAZsurround +}% \tabu@hlineAZ +\newcommand*\tabu@hlineAZsurround[1][\extratabsurround]{% + \extratabsurround #1\let\tabucline \tabucline@scan + \let\hline \tabu@hlinescan \let\firsthline \hline + \let\cline \tabu@clinescan \let\lasthline \hline + \expandafter \futurelet \expandafter \tabu@temp + \expandafter \tabu@nexthlineAZ \tabu@temp +}% \tabu@hlineAZsurround +\def\tabu@hlinescan {\tabu@thick \arrayrulewidth \tabu@xhlineAZ \hline} +\def\tabu@clinescan #1{\tabu@thick \arrayrulewidth \tabu@xhlineAZ {\cline{#1}}} +\def\tabucline@scan{\@testopt \tabucline@sc@n {}} +\def\tabucline@sc@n #1[#2]{\tabu@xhlineAZ {\tabucline[{#1}]{#2}}} +\def\tabu@nexthlineAZ{% + \ifx \tabu@temp\hline \else + \ifx \tabu@temp\cline \else + \ifx \tabu@temp\tabucline \else + \tabu@hlinecorrection + \fi\fi\fi +}% \tabu@nexthlineAZ +\def\tabu@xhlineAZ #1{% + \toks@\expandafter{\the\toks@ #1}% + \@tempdimc \tabu@thick % The last line width + \ifcase\count@ \@tempdimb \tabu@thick % The first line width + \else \advance\dimen@ \dimexpr \tabu@thick+\doublerulesep \relax + \fi + \advance\count@ \@ne \futurelet \tabu@temp \tabu@nexthlineAZ +}% \tabu@xhlineAZ +\def\tabu@firsthlinecorrection{% \count@ = number of \hline -1 + \@tempdima \dimexpr \ht\@arstrutbox+\dimen@ + \edef\firsthline{% + \omit \hbox to\z@{\hss{\noexpand\tabu@DBG{yellow}\vrule + height \the\dimexpr\@tempdima+\extratabsurround + depth \dp\@arstrutbox + width \tabustrutrule}\hss}\cr + \noalign{\vskip -\the\dimexpr \@tempdima+\@tempdimb + +\dp\@arstrutbox \relax}% + \the\toks@ + }\ifnum0=`{\fi + \expandafter}\firsthline % we are then ! +}% \tabu@firsthlinecorrection +\def\tabu@lasthlinecorrection{% + \@tempdima \dimexpr \dp\@arstrutbox+\dimen@+\@tempdimb+\@tempdimc + \edef\lasthline{% + \the\toks@ + \noalign{\vskip -\the\dimexpr\dimen@+\@tempdimb+\dp\@arstrutbox}% + \omit \hbox to\z@{\hss{\noexpand\tabu@DBG{yellow}\vrule + depth \the\dimexpr \dp\@arstrutbox+\@tempdimb+\dimen@ + +\extratabsurround-\@tempdimc + height \z@ + width \tabustrutrule}\hss}\cr + }\ifnum0=`{\fi + \expandafter}\lasthline % we are then ! +}% \tabu@lasthlinecorrection +%% Horizontal lines : \tabucline ------------------------------------ +\let\tabu@start \@tempcnta +\let\tabu@stop \@tempcntb +\newcommand*\tabucline{\noalign{\ifnum0=`}\fi \tabu@cline} +\newcommand*\tabu@cline[2][]{\tabu@startstop{#2}% + \ifnum \tabu@stop<\z@ \toks@{}% + \else \tabu@clinearg{#1}\tabu@thestyle + \edef\tabucline{\toks@{% + \ifnum \tabu@start>\z@ \omit + \tabu@multispan\tabu@start {\span\omit}&\fi + \omit \tabu@multispan\tabu@stop {\span\omit}% + \tabu@thehline\cr + }}\tabucline + \tabu@tracinglines{(tabu:tabucline) Style: #1^^J\the\toks@^^J^^J}% + \fi + \futurelet \tabu@temp \tabu@xcline }% \tabu@cline -\def\tabu@add #1\@nil{\toks@\expandafter{\the\toks@ - \begingroup #1\endgroup\ifmmode$\fi}} -\def\tabu@startstop#1{\tabu@start@stop #1\relax 1-\tabu@nbcols\@nnil} +\def\tabu@clinearg #1{% + \ifx\\#1\\\let\tabu@thestyle \tabu@ls@ + \else \@defaultunits \expandafter\let\expandafter\@tempa + \romannumeral-`\0#1\relax \@nnil + \ifx \hbox\@tempa \tabu@clinebox{#1}% + \else\ifx \box\@tempa \tabu@clinebox{#1}% + \else\ifx \vbox\@tempa \tabu@clinebox{#1}% + \else\ifx \vtop\@tempa \tabu@clinebox{#1}% + \else\ifx \copy\@tempa \tabu@clinebox{#1}% + \else\ifx \leaders\@tempa \tabu@clineleads{#1}% + \else\ifx \cleaders\@tempa \tabu@clineleads{#1}% + \else\ifx \xleaders\@tempa \tabu@clineleads{#1}% + \else\tabu@getline {#1}% + \fi\fi\fi\fi\fi\fi\fi\fi + \fi +}% \tabu@clinearg +\def\tabu@clinebox #1{\tabu@clineleads{\xleaders#1\hss}} +\def\tabu@clineleads #1{% + \let\tabu@thestyle \relax \let\tabu@leaders \@undefined + \gdef\tabu@thehrule{#1}} +\def\tabu@thehline{\begingroup + \ifdefined\tabu@leaders + \noexpand\tabu@thehleaders + \else \noexpand\tabu@thehrule + \fi \endgroup +}% \tabu@thehline +\def\tabu@xcline{% + \ifx \tabu@temp\tabucline + \toks@\expandafter{\the\toks@ \noalign + {\ifx\CT@drsc@\relax \vskip + \else \CT@drsc@\hrule height + \fi + \doublerulesep}}% + \fi + \tabu@docline +}% \tabu@xcline +\def\tabu@docline {\ifnum0=`{\fi \expandafter}\the\toks@} +\def\tabu@docline@evr {\xdef\tabu@doclineafter{\the\toks@}% + \ifnum0=`{\fi}\aftergroup\tabu@doclineafter} +\def\tabu@multispan #1#2{% + \ifnum\numexpr#1>\@ne #2\expandafter\tabu@multispan + \else \expandafter\@gobbletwo + \fi {#1-1}{#2}% +}% \tabu@multispan +\def\tabu@startstop #1{\tabu@start@stop #1\relax 1-\tabu@nbcols \@nnil} \def\tabu@start@stop #1-#2\@nnil{% - \@defaultunits \tabu@start \number0#1\relax\@nnil - \@defaultunits \tabu@stop \number0#2\relax\@nnil - \ifnum\tabu@start>\tabu@nbcols\tabu@start \tabu@nbcols\else - \ifnum\tabu@start<\@ne \tabu@start \@ne \fi\fi - \ifnum\tabu@stop>\tabu@nbcols \tabu@stop \tabu@nbcols \else - \ifnum\tabu@stop<\@ne \tabu@stop \tabu@nbcols\fi\fi + \@defaultunits \tabu@start\number 0#1\relax \@nnil + \@defaultunits \tabu@stop \number 0#2\relax \@nnil + \tabu@stop \ifnum \tabu@start>\tabu@nbcols \m@ne + \else\ifnum \tabu@stop=\z@ \tabu@nbcols + \else\ifnum \tabu@stop>\tabu@nbcols \tabu@nbcols + \else \tabu@stop + \fi\fi\fi + \advance\tabu@start \m@ne + \ifnum \tabu@start>\z@ \advance\tabu@stop -\tabu@start \fi }% \tabu@start@stop -\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 - \ifx\@tempa\box \tabu@defleaders{#1}\else - \ifx\@tempa\copy \tabu@defleaders{#1}\else - \ifcsname tabu@line@style@\detokenize{#1}\endcsname - \csname tabu@line@style@\detokenize{#1}\endcsname - \else \tabu@getline{#1\p@ on0pt off0pt}\fi\fi\fi\fi\fi -}% \tabu@getlinespec -\def\tabu@defleaders#1{% - \def\tabu@xleaders{\iftabu@colortbl\CT@arc@\fi - \xleaders\hbox{\lower.5\extrarowheight#1}\tabu@leaderfill}} -\def\tabucline@warn#1{\PackageWarning{tabu} - {Undefined line syle: #1 - \MessageBreak Using default line style instead}% - \let\tabu@xleaders \tabu@defaultleaders -}% \tabucline@warn -\def\tabu@getline#1{\tabu@lineon #1 \@nil on\tabu@linedash \p@ \@nil\@nnil{#1}} -\def\tabu@maybecolor{\ifx\tabu@color\@empty \afterassignment\tabu@colortest - \else \@defaultunits\fi} -\def\tabu@lineon #1on#2\@nil#3\@nnil#4{% - \@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 - \tabu@maybecolor \@tempdimb #2\p@ \@nnil - \tabu@lineoff #1 on#2 off\tabu@dashgap \p@ \@nnil - \or\@tempdima \arrayrulewidth - \tabu@maybecolor \@tempdimb #2\p@ \@nnil - \tabu@lineoff #1 on#2 off\tabu@dashgap \p@ \@nnil - \else - \tabu@maybecolor \@tempdima \arrayrulewidth #1\p@\@nnil - \ifx\tabu@color\@empty \tabucline@warn\@tempa\else - \@tempdimb \z@ - \tabu@lineoff off0pt \p@\@nnil \fi - \fi -}% \tabu@lineon -\def\tabu@lineoff #1off#2\@nnil{% - \tabu@maybecolor \@tempdimc #2\p@ \@nnil - \iftabu@colortbl \ifx \tabu@color\@empty - \def\tabu@color{\noexpand\CT@arc@}% - \fi\fi - \ifdim \@tempdimb=\z@ - \ifdim \@tempdimc>\z@ \@tempdimb \tabu@dashgap\relax\fi\fi - \ifdim \@tempdimc=\z@ - \ifdim \@tempdimb>\z@ \@tempdimc \tabu@linedash\relax\fi\fi - \ifdim \@tempdima<\z@ \else - \ifdim \@tempdimb<\z@ \else - \ifdim \@tempdimc<\z@ \else - \edef \tabu@xleaders{\tabu@color\xleaders - \ifdim\@tempdimc>\z@ - \hbox\bgroup \kern\the\dimexpr\@tempdimc/2\relax\fi - \noexpand\iftabu@firstcline - \vrule depth\dimexpr\the\@tempdima - \ifdim\@tempdimb>\z@ width\the\@tempdimb\fi - \noexpand\else - \vrule height\dimexpr-\extrarowheight+\the\@tempdima - depth\dimexpr\extrarowheight - \ifdim\@tempdimb>\z@ width\the\@tempdimb\fi - \noexpand\fi - \ifdim\@tempdimc>\z@ - \kern\the\dimexpr\@tempdimc/2\egroup\fi - \tabu@leaderfill}% - \fi\fi\fi -}% \tabu@lineoff -\def\tabu@colortest{\futurelet\tabu@temp\tabu@linecolor} -\def\tabu@linecolor{% - \ifcase 0\if ,\noexpand\tabu@temp\else - \ifx\relax\tabu@temp\else - \ifx \@sptoken\tabu@temp1\else - \ifcat A\noexpand\tabu@temp2\else - 3\fi\fi\fi\fi\relax - \def\tabu@next##1{\futurelet\tabu@temp\tabu@linecolor}% - \or\def\tabu@next{\tabu@gobblespace{\futurelet\tabu@temp\tabu@linecolor}}% - \or\let\tabu@next \tabu@getlinecolor - \else\expandafter\remove@to@nnil - \fi \tabu@next -}% \tabu@linecolor -\def\tabu@getlinecolor#1\p@{% - \edef\@tempa{\zap@space #1 \@empty}% - \ifcsname\string\color@\@tempa\endcsname - \edef\tabu@color{\noexpand\noexpand\noexpand\color{\@tempa}}% \set@color - \fi\remove@to@nnil -}% \tabu@getlinecolor -\def\tabulinestyle#1{\@for\@tempa:=#1\do - {\expandafter\tabu@linestyle\@tempa==\@nil}} -\def\tabu@linestyle#1=#2=#3\@nil{% - \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 {% - \let\tabu@xleaders \tabu@defaultleaders}% -\def\tabu@defaultleaders{\iftabu@colortbl\CT@arc@\fi - \leaders - \iftabu@firstcline - \vrule depth \arrayrulewidth - \else - \vrule height\dimexpr-\extrarowheight+\arrayrulewidth - depth \extrarowheight - \fi - \tabu@leaderfill} -\let\tabu@leaderfill \hfil -{\catcode32=13\relax\catcode`\^^@=13\relax -\gdef\tabu@verb{\@sanitize\catcode`\^=7\edef\^{\string^}\tabu@makeatletter -\catcode32=13\let =\ \catcode`\^^@=13\def^^@{\hskip\parfillskip\null\linebreak}% -\endlinechar\m@ne}} -{\catcode64=13\edef @{\string @}\expandafter\xdef - \csname tabu@makeatletter\endcsname{\catcode64=13\def\noexpand @{\unskip @}}} -\newcommand\tabu@sanitizetext[1][\ttfamily]{\begingroup - \tabu@verb #1\tabu@s@nitizetext} -\long\def\tabu@s@nitizetext#1{\@makeother\{\@makeother\}% - \everyeof{\noexpand}\scantokens{#1}\endgroup} -\def\tabu@tabudecimal#1{% - \def\tabu@decimal{#1}\@temptokena{}% - \let\tabu@getdecimal@ \tabu@getdecimal@ignorespaces - \tabu@scandecimal +%% Numbers: siunitx S columns (and \tabudecimal) ------------------- +\def\tabu@tabudecimal #1{% + \def\tabu@decimal{#1}\@temptokena{}% + \let\tabu@getdecimal@ \tabu@getdecimal@ignorespaces + \tabu@scandecimal }% \tabu@tabudecimal \def\tabu@scandecimal{\futurelet \tabu@temp \tabu@getdecimal@} \def\tabu@skipdecimal#1{#1\tabu@scandecimal} \def\tabu@getdecimal@ignorespaces{% - \ifcase 0\ifx\tabu@temp\ignorespaces\else - \ifx\tabu@temp\@sptoken1\else - 2\fi\fi\relax - \let\tabu@getdecimal@ \tabu@getdecimal - \expandafter\tabu@skipdecimal - \or \expandafter\tabu@gobblespace\expandafter\tabu@scandecimal - \else \expandafter\tabu@skipdecimal - \fi + \ifcase 0\ifx\tabu@temp\ignorespaces\else + \ifx\tabu@temp\@sptoken1\else + 2\fi\fi\relax + \let\tabu@getdecimal@ \tabu@getdecimal + \expandafter\tabu@skipdecimal + \or \expandafter\tabu@gobblespace\expandafter\tabu@scandecimal + \else \expandafter\tabu@skipdecimal + \fi }% \tabu@getdecimal@ignorespaces \def\tabu@get@decimal#1{\@temptokena\expandafter{\the\@temptokena #1}% \tabu@scandecimal} \def\do#1{% - \def\tabu@get@decimalspace#1{% - \@temptokena\expandafter{\the\@temptokena #1}\tabu@scandecimal}% + \def\tabu@get@decimalspace#1{% + \@temptokena\expandafter{\the\@temptokena #1}\tabu@scandecimal}% }\do{ } \let\tabu@@tabudecimal \tabu@tabudecimal \def\tabu@getdecimal{% @@ -1250,282 +1945,211 @@ \fi }% \tabu@getdecimal \def\tabu@printdecimal{% - \edef\tabu@temp{\the\@temptokena}% - \ifx\tabu@temp\@empty\else - \ifx\tabu@temp\space\else - \expandafter\tabu@decimal\expandafter{\the\@temptokena}% - \fi\fi + \edef\tabu@temp{\the\@temptokena}% + \ifx\tabu@temp\@empty\else + \ifx\tabu@temp\space\else + \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 +%% Verbatim inside X columns ---------------------------------------- +\def\tabu@verbatim{% + \let\verb \tabu@verb + \let\FV@DefineCheckEnd \tabu@FV@DefineCheckEnd +}% \tabu@verbatim +\let\tabu@ltx@verb \verb +\def\tabu@verb{\@ifstar {\tabu@ltx@verb*} \tabu@ltx@verb} +\def\tabu@fancyvrb {% + \def\tabu@FV@DefineCheckEnd ##1{% + \def\tabu@FV@DefineCheckEnd{% + ##1% + \let\FV@CheckEnd \tabu@FV@CheckEnd + \let\FV@@CheckEnd \tabu@FV@@CheckEnd + \let\FV@@@CheckEnd \tabu@FV@@@CheckEnd + \edef\FV@EndScanning{% + \def\noexpand\next{\noexpand\end{\FV@EnvironName}}% + \global\let\noexpand\FV@EnvironName\relax + \noexpand\next}% + \xdef\FV@EnvironName{\detokenize\expandafter{\FV@EnvironName}}}% + }\expandafter\tabu@FV@DefineCheckEnd\expandafter{\FV@DefineCheckEnd} +}% \tabu@fancyvrb +\def\tabu@FV@CheckEnd #1{\expandafter\FV@@CheckEnd \detokenize{#1\end{}}\@nil} +\edef\tabu@FV@@@CheckEnd {\detokenize{\end{}}} +\begingroup +\catcode`\[1 \catcode`\]2 +\@makeother\{ \@makeother\} + \edef\x[\endgroup + \def\noexpand\tabu@FV@@CheckEnd ##1\detokenize[\end{]##2\detokenize[}]##3% + ]\x \@nil{\def\@tempa{#2}\def\@tempb{#3}} +\def\tabu@FV@ListProcessLine #1{% + \hbox {%to \hsize{% + \kern\leftmargin + \hbox {%to \linewidth{% + \FV@LeftListNumber + \FV@LeftListFrame + \FancyVerbFormatLine{#1}\hss +%% DG/SR modification begin - Jan. 28, 1998 (for numbers=right add-on) +%% \FV@RightListFrame}% + \FV@RightListFrame + \FV@RightListNumber}% +%% DG/SR modification end + \hss}} +%% \savetabu -------------------------------------------------------- \newcommand*\savetabu[1]{\noalign{% - \ifx\\#1\\\tabu@savewarn{}{The tabu will not be saved}\else - \@ifundefined{tabu@saved@\string#1}{}{\tabu@savewarn{#1}{Overwritting}}% - {% - \toks0\expandafter{\tabu@savedpreamble}% - \toks1\expandafter{\tabu@savedparam}% - \toks2\expandafter{\tabu@savedpream}% - \toks3{}% - \iftabu@negcoef - \edef\tabu@savewd{\tabu@savewd{\number\numexpr1}}% - \toks3\expandafter{\tabu@savewd}\fi - \expandafter\xdef\csname tabu@saved@\string#1\endcsname##1{% - \noexpand\ifcase##1\relax - \noexpand\ifdim\tabu@target>\z@ - \noexpand\tabu@warn@usetabu - \noexpand\fi - \tabu@target \the\tabu@target\relax - \tabucolX \the\tabucolX\relax - \the\toks1% - \gdef\noexpand\tabu@usetabu{% - \the\toks1% - \def\noexpand\@halignto{\tabu@halignto}% - \tabucolX \the\tabucolX\relax - \def\noexpand\@preamble{\the\toks0}% - \noexpand\tabu@make@arstrutbox - \the\toks3 - \noexpand\ifx \noexpand\tabu@align\noexpand\tabu@aligndefault@text - \def\noexpand\tabu@align{\tabu@align}% - \noexpand\fi}% - \aftergroup\noexpand\tabu@usetabu - \noexpand\else - \noexpand\ifdim\tabu@target=\z@ - \tabu@target \the\tabu@target\relax - \noexpand\fi - \gdef\noexpand\tabu@preamble{% - \noexpand\ifx \noexpand\tabu@align\noexpand\tabu@aligndefault@text - \def\noexpand\tabu@align{\tabu@align}% - \noexpand\fi}% - \aftergroup\noexpand\tabu@preamble - \noexpand\fi - \the\toks2}% - \tabu@message@save{#1}}% - \fi}% + \tabu@sanitizearg{#1}\tabu@temp + \ifx \tabu@temp\@empty \tabu@savewarn{}{The tabu will not be saved}\else + \@ifundefined{tabu@saved@\tabu@temp}{}{\tabu@savewarn{#1}{Overwritting}}% + \ifdefined\tabu@restored \expandafter\let + \csname tabu@saved@\tabu@temp \endcsname \tabu@restored + \else {\tabu@save}% + \fi + \fi}% }% \savetabu -\def\tabu@aligndefault@text{\tabu@aligndefault}% -\def\tabu@warn@usetabu{\PackageWarning{tabu} - {Specifying a target with \string\usetabu\space is useless - \MessageBreak The target cannot be changed!}} -\def\tabu@savewd#1{% - \ifnum#1>\tabu@nbcols \expandafter \@gobble - \else \ifdim\tabu@wd{#1}>\z@ - \noexpand\tabu@wddef{#1}{\tabu@wd{#1}}\fi - \expandafter\tabu@savewd % loop - \fi{#1+1}% -}% \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 \@tempdimb - \@width \z@}% -}% \tabu@make@arstrutbox +\def\tabu@save {% + \toks0\expandafter{\tabu@saved@}% + \iftabu@negcoef + \let\tabu@wddef \relax \let\tabu@ \tabu@savewd \edef\tabu@savewd{\tabu@Xcoefs}% + \toks0\expandafter{\the\toks\expandafter0\tabu@savewd}\fi + \toks1\expandafter{\tabu@savedpream}% + \toks2\expandafter{\tabu@savedpreamble}% + \let\@preamble \relax + \let\tabu@savedpream \relax \let\tabu@savedparams \relax + \edef\tabu@preamble{% + \def\noexpand\tabu@aligndefault{\tabu@align}% + \def\tabu@savedparams {\noexpand\the\toks0}% + \def\tabu@savedpream {\noexpand\the\toks1}}% + \edef\tabu@usetabu{% + \def\@preamble {\noexpand\the\toks2}% + \tabu@target \the\tabu@target \relax + \tabucolX \the\tabucolX \relax + \tabu@nbcols \the\tabu@nbcols \relax + \def\noexpand\tabu@aligndefault{\tabu@align}% + \def\tabu@savedparams {\noexpand\the\toks0}% + \def\tabu@savedpream {\noexpand\the\toks1}}% + \let\tabu@aligndefault \relax \let\@sharp \relax + \edef\@tempa{\noexpand\tabu@s@ved + {\tabu@usetabu} + {\tabu@preamble} + {\the\toks1}}\@tempa + \tabu@message@save +}% \tabu@save +\long\def\tabu@s@ved #1#2#3{% + \def\tabu@usetabu{#1}% + \expandafter\gdef\csname tabu@saved@\tabu@temp\endcsname ##1{% + \ifodd ##1% \usetabu + \tabu@measuringfalse \tabu@spreadfalse % Just in case... + \gdef\tabu@usetabu {% + \ifdim \tabu@target>\z@ \tabu@warn@usetabu \fi + \global\let\tabu@usetabu \@undefined + \def\@halignto {to\tabu@target}% + #1% + \ifx \tabu@align\tabu@aligndefault@text + \ifnum \tabu@nested=\z@ + \let\tabu@align \tabu@aligndefault \fi\fi}% + \else % \preamble + \gdef\tabu@preamble {% + \global\let\tabu@preamble \@undefined + #2% + \ifx \tabu@align\tabu@aligndefault@text + \ifnum \tabu@nested=\z@ + \let\tabu@align \tabu@aligndefault \fi\fi}% + \fi + #3}% +}% \tabu@s@ved +\def\tabu@aligndefault@text {\tabu@aligndefault}% +\def\tabu@warn@usetabu {\PackageWarning{tabu} + {Specifying a target with \string\usetabu\space is useless + \MessageBreak The target cannot be changed!}} +\def\tabu@savewd #1#2{\ifdim #2\p@<\z@ \tabu@wddef{#1}{\tabu@wd{#1}}\fi} \def\tabu@savewarn#1#2{\PackageInfo{tabu} - {User-name `#1' already used for \string\savetabu - \MessageBreak #2}}% + {User-name `#1' already used for \string\savetabu + \MessageBreak #2}}% \def\tabu@saveerr#1{\PackageError{tabu} - {User-name `#1' is unknown for \string\usetabu - \MessageBreak I cannot restore an unknown preamble!}\@ehd} -\def\tabu@rowfont{\noalign{\ifnum0=`}\fi\tabu@row@font} + {User-name `#1' is unknown for \string\usetabu + \MessageBreak I cannot restore an unknown preamble!}\@ehd} +%% \rowfont --------------------------------------------------------- +\newskip \tabu@cellskip +\def\tabu@rowfont{\ifdim \baselineskip=\z@\noalign\fi + {\ifnum0=`}\fi \tabu@row@font} \newcommand*\tabu@row@font[2][]{% - \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{#2}% - \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 + \ifnum7=\currentgrouptype + \global\let\tabu@@cellleft \tabu@cellleft + \global\let\tabu@@cellright \tabu@cellright + \global\let\tabu@@celllalign \tabu@celllalign + \global\let\tabu@@cellralign \tabu@cellralign + \global\let\tabu@@rowfontreset\tabu@rowfontreset + \fi + \global\let\tabu@rowfontreset \tabu@rowfont@reset + \expandafter\gdef\expandafter\tabu@cellleft\expandafter{\tabu@cellleft #2}% + \ifcsname tabu@cell@#1\endcsname % row alignment + \csname tabu@cell@#1\endcsname \fi + \ifnum0=`{\fi}% end of group / noalign group }% \rowfont -\def\tabu@ifcolorleavevmode#1{\let\color \tabu@leavevmodecolor #1\let\color\tabu@color}% -\AtBeginDocument{% - \ifdefined\color - \let\tabu@color \color - {\toks@\expandafter\expandafter\expandafter{\csname color \endcsname} - \xdef\tabu@leavevmodecolor{\leavevmode\the\toks@}} - \else \let\tabu@ifcolorleavevmode \@firstofone - \fi -}% +\def\tabu@ifcolorleavevmode #1{\let\color \tabu@leavevmodecolor #1\let\color\tabu@color}% \def\tabu@rowfont@reset{% - \noalign{% - \global\let\tabu@rowfontreset \@empty - \global\let\tabu@cellleft \tabu@@cellleft - \global\let\tabu@cellright \tabu@@cellright - \global\let\tabu@cellfont \@empty - \global\let\tabu@celllalign \tabu@@celllalign - \global\let\tabu@cellralign \tabu@@cellralign - }% -}% \tabu@rowfont@reset -\let\tabu@rowfontreset \@empty -\def\everyrow #1{% - \ifdim\baselineskip=\z@\noalign\fi - {\gdef\tabu@everyrow@hook{#1}}% -}% \everyrow -\newif\iftabu@cellright -\AtBeginDocument{\let\tabu@prepnext@tokORI \prepnext@tok }% original definition + \global\let\tabu@rowfontreset \tabu@@rowfontreset + \global\let\tabu@cellleft \tabu@@cellleft + \global\let\tabu@cellright \tabu@@cellright + \global\let\tabu@cellfont \@empty + \global\let\tabu@celllalign \tabu@@celllalign + \global\let\tabu@cellralign \tabu@@cellralign +}% \tabu@@rowfontreset +\let\tabu@rowfontreset \@empty % overwritten \AtBeginDocument if colortbl +%% \tabu@prepnext@tok ----------------------------------------------- +\newif \iftabu@cellright \def\tabu@prepnext@tok{% - \ifnum \count@<\z@ % - \@tempcnta \@M % - \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 - \ifcase \numexpr \count@-\@tempcnta \relax % (case 0): prev. token is left - \advance \tabu@nbcols\@ne - \expandafter\let\csname tabu@tok@\the\tabu@nbcols R\endcsname \relax - \expandafter\gdef\expandafter\tabu@global@temp\expandafter{% - \tabu@global@temp \advance\tabu@nbcols\@ne}% - \iftabu@cellright % before-previous token is right and is finished - \tabu@cellrightfalse % - \tabu@savetok R\tabu@preptokenright - \fi - \ifnum \tabu@nbcols=\@ne \tabu@savetok L\fi - \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% - \else % unless this is the very first column (\tabu@nbcols=0) - \advance\tabu@nbcols\@ne \tabu@savetok L\advance\tabu@nbcols\m@ne - \fi - \iftabu@cellright % before-previous token is right + \ifnum \count@<\z@ % + \@tempcnta \@M % + \tabu@nbcols\z@ + \let\tabu@fornoopORI \@fornoop \tabu@cellrightfalse - \tabu@preptokenright - \fi - \fi % \ifcase - \fi - \tabu@prepnext@tokORI + \else + \ifcase \numexpr \count@-\@tempcnta \relax % (case 0): prev. token is left + \advance \tabu@nbcols \@ne + \iftabu@cellright % before-previous token is right and is finished + \tabu@cellrightfalse % + \tabu@righttok + \fi + \tabu@lefttok + \or % (case 1) previous token is right + \tabu@cellrighttrue \let\@fornoop \tabu@lastnoop + \else % special column: do not change the token + \iftabu@cellright % before-previous token is right + \tabu@cellrightfalse + \tabu@righttok + \fi + \fi % \ifcase + \fi + \tabu@prepnext@tokORI }% \tabu@prepnext@tok -\long\def\tabu@lastnoop#1\@@#2#3{\in@\@nextchar{#2}% - \ifin@ - \let\@fornoop \tabu@fornoopORI - \toks0\expandafter{\expandafter\tabu@everyrowtrue \the\toks0}% - \expandafter\prepnext@tok - \fi +\long\def\tabu@lastnoop#1\@@#2#3{\tabu@lastn@@p #2\@nextchar \in@\in@@} +\def\tabu@lastn@@p #1\@nextchar #2#3\in@@{% + \ifx \in@#2\else + \let\@fornoop \tabu@fornoopORI + \xdef\tabu@mkpreambuffer{\tabu@nbcols\the\tabu@nbcols \tabu@mkpreambuffer}% + \toks0\expandafter{\expandafter\tabu@everyrowtrue \the\toks0}% + \expandafter\prepnext@tok + \fi }% \tabu@lastnoop -\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}% after because of $ -}% \tabu@preptokenleft -\def\tabu@savetok#1{\begingroup - \expandafter\tabu@savet@k\csname tabu@tok@\the\tabu@nbcols #1\endcsname -}% \tabu@savetok -\def\tabu@savet@k#1{% - \ifnum \@chclass=\@ne \toks@\toks\count@ - \else\ifnum\@chclass=5 \toks@\toks\count@ - \else \toks@{}\fi\fi - \unless\ifx#1\relax - \toks@\expandafter\expandafter\expandafter{% - \expandafter#1\the\toks@}\fi - \toks@\expandafter{\expandafter\def\expandafter#1\expandafter{% - \the\toks@}}% - \@temptokena\expandafter{\tabu@global@temp}% - \xdef\tabu@global@temp {\the\@temptokena \the\toks@}% - \expandafter\endgroup \the\toks@ -}% \tabu@savetok +\def\tabu@righttok{% + \advance \count@ \m@ne + \toks\count@\expandafter {\the\toks\count@ \tabu@cellright \tabu@cellralign}% + \advance \count@ \@ne +}% \tabu@righttok +\def\tabu@lefttok{\toks\count@\expandafter{\expandafter\tabu@celllalign + \the\toks\count@ \tabu@cellleft}% after because of $ +}% \tabu@lefttok +%% Neutralisation of glues ------------------------------------------ \let\tabu@cellleft \@empty \let\tabu@cellright \@empty -\def\tabu@celllalign {\tabu@cellleft}% row font spec. applies to pre-column material +\tabu@celllalign@def{\tabu@cellleft}% \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@}% + \let\tabu@maybesiunitx \toks@ \tabu@celllalign + \global \expandafter \tabu@celllalign@def \expandafter {\the\toks@ #1}% + \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 @@ -1558,147 +2182,170 @@ %% ragged2e settings \def\tabu@cell@L{% force alignment to left (ragged2e) \tabu@cell@align - {\tabu@removehfil \RaggedRight \arraybackslash - \tabu@cellleft} - {\tabu@flush1\tabu@ignorehfil} - {\RaggedRight \arraybackslash}% + {\tabu@removehfil \RaggedRight \tabu@cellleft} + {\tabu@flush 1\tabu@ignorehfil} + \RaggedRight }% \tabu@cell@L \def\tabu@cell@C{% force alignment to center (ragged2e) \tabu@cell@align - {\tabu@removehfil \Centering \arraybackslash - \tabu@flush{.5}\tabu@cellleft} + {\tabu@removehfil \Centering \tabu@flush{.5}\tabu@cellleft} {\tabu@flush{.5}\tabu@ignorehfil} - {\Centering \arraybackslash}% + \Centering }% \tabu@cell@C \def\tabu@cell@R{% force alignment to right (ragged2e) \tabu@cell@align - {\tabu@removehfil \RaggedLeft \arraybackslash - \tabu@flush1\tabu@cellleft} - {\tabu@ignorehfil} - {\RaggedLeft \arraybackslash}% + {\tabu@removehfil \RaggedLeft \tabu@flush 1\tabu@cellleft} + \tabu@ignorehfil + \RaggedLeft }% \tabu@cell@R \def\tabu@cell@J{% force justification (ragged2e) \tabu@cell@align - {\justifying \arraybackslash \tabu@cellleft} + {\justifying \tabu@cellleft} {} - {\justifying \arraybackslash}% + \justifying }% \tabu@cell@J \def\tabu@flush#1{% - \iftabu@colortbl % colortbl uses \hfill rather than \hfil - \hskip \ifnum\currentgrouptype>13 \stretch{#1}% - \else\ifdim#1pt<1pt \tabu@cellskip - \else \stretch{#1} - \fi\fi \relax - \else % array.sty - \ifnum \currentgrouptype>13\relax - \hfil \hskip1sp - \fi - \fi + \iftabu@colortbl % colortbl uses \hfill rather than \hfil + \hskip \ifnum13<\currentgrouptype \stretch{#1}% + \else \ifdim#1pt<\p@ \tabu@cellskip + \else \stretch{#1} + \fi\fi \relax + \else % array.sty + \ifnum 13<\currentgrouptype + \hfil \hskip1sp \relax \fi + \fi }% \tabu@flush -\AtBeginDocument{% - \@ifpackageloaded{ragged2e} - {} - {\let\tabu@cell@L \tabu@cell@l - \let\tabu@cell@R \tabu@cell@r - \let\tabu@cell@C \tabu@cell@c - \let\tabu@cell@J \tabu@cell@j - }% -}% AtBeginDocument -\newskip\tabu@cellskip -\let\tabu@hfil\hfil -\let\tabu@hfill\hfill -\let\tabu@hskip\hskip +\let\tabu@hfil \hfil +\let\tabu@hfill \hfill +\let\tabu@hskip \hskip \def\tabu@removehfil{% - \iftabu@colortbl - \unkern \tabu@cellskip = \lastskip - \ifnum\gluestretchorder\tabu@cellskip = \tw@ \hskip-\tabu@cellskip - \else \tabu@cellskip = \z@skip - \fi - \else - \ifdim\lastskip=1sp\unskip\fi - \ifnum\gluestretchorder\lastskip = \@ne - \hfilneg % \hfilneg for array.sty but not for colortbl... - \fi - \fi + \iftabu@colortbl + \unkern \tabu@cellskip =\lastskip + \ifnum\gluestretchorder\tabu@cellskip =\tw@ \hskip-\tabu@cellskip + \else \tabu@cellskip \z@skip + \fi + \else + \ifdim\lastskip=1sp\unskip\fi + \ifnum\gluestretchorder\lastskip =\@ne + \hfilneg % \hfilneg for array.sty but not for colortbl... + \fi + \fi }% \tabu@removehfil -\def\tabu@ignorehfil{% - \aftergroup\tabu@nohfil -}% \tabu@ignorehfil +\def\tabu@ignorehfil{\aftergroup \tabu@nohfil} \def\tabu@nohfil{% \hfil -> do nothing + restore original \hfil - \def\hfil{\let\hfil\tabu@hfil}% local to (alignment template) group + \def\hfil{\let\hfil \tabu@hfil}% local to (alignment template) group }% \tabu@nohfil -\AtBeginDocument{% - \@ifpackageloaded{colortbl} - {% - \def\tabu@nohfil{% - \def\hfil{\let\hfil\tabu@hfil}% local to (alignment template) group - \def\hfill{\let\hfill\tabu@hfill}% (colortbl uses \hfill) pfff... - \def\hskip##1\relax{\let\hskip\tabu@hskip}}% local - }% @ifpackageloaded colortbl - {}% -}% AtBeginDocument -\def\tabu@fbox{% - \leavevmode - \let\color@bgroup\bgroup - \def\color@egroup{\endgraf\egroup}% - \afterassignment\tabu@begin@fbox - \setbox\@tempboxa \hbox -}% \tabu@fbox -\def\tabu@begin@fbox{\color@bgroup\kern\fboxsep\aftergroup\tabu@end@fbox} -\def\tabu@end@fbox{\kern\fboxsep \color@egroup \@frameb@x\relax} -\def\tabu@color@b@x#1#2{\leavevmode - \def\tabu@do@color@b@x{#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}\box\z@}}% - \afterassignment\tabu@begin@color@b@x - \setbox\z@ \hbox -}% \tabu@color@b@x -\def\tabu@begin@color@b@x{% - \bgroup \kern\fboxsep \set@color - \aftergroup\tabu@end@color@b@x -}% \tabu@begin@color@b@x -\def\tabu@end@color@b@x{\kern\fboxsep \egroup - \dimen@\ht\z@\advance\dimen@\fboxsep\ht\z@\dimen@ - \dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@ - \tabu@do@color@b@x -}% \tabu@end@color@b@x -\def\tabu@temp#1#2#3{{\toks@\expandafter{#2#3}\xdef#1{\the\toks@}}} +\def\tabu@colortblalignments {% if colortbl + \def\tabu@nohfil{% + \def\hfil {\let\hfil \tabu@hfil}% local to (alignment template) group + \def\hfill {\let\hfill \tabu@hfill}% (colortbl uses \hfill) pfff... + \def\hskip ####1\relax{\let\hskip \tabu@hskip}}% local +}% \tabu@colortblalignments +%% Taking care of footnotes and hyperfootnotes ---------------------- +\long\def\tabu@footnotetext #1{% + \edef\@tempa{\the\tabu@footnotes + \noexpand\footnotetext [\the\csname c@\@mpfn\endcsname]}% + \global\tabu@footnotes\expandafter{\@tempa {#1}}}% +\long\def\tabu@xfootnotetext [#1]#2{% + \global\tabu@footnotes\expandafter{\the\tabu@footnotes + \footnotetext [{#1}]{#2}}} +\let\tabu@xfootnote \@xfootnote +\long\def\tabu@Hy@ftntext{\tabu@Hy@ftntxt {\the \c@footnote }} +\long\def\tabu@Hy@xfootnote [#1]{% + \begingroup + \value\@mpfn #1\relax + \protected@xdef \@thefnmark {\thempfn}% + \endgroup + \@footnotemark \tabu@Hy@ftntxt {#1}% +}% \tabu@Hy@xfootnote +\long\def\tabu@Hy@ftntxt #1#2{% + \edef\@tempa{% + \the\tabu@footnotes + \begingroup + \value\@mpfn #1\relax + \noexpand\protected@xdef\noexpand\@thefnmark {\noexpand\thempfn}% + \expandafter \noexpand \expandafter + \tabu@Hy@footnotetext \expandafter{\Hy@footnote@currentHref}% + }% + \global\tabu@footnotes\expandafter{\@tempa {#2}% + \endgroup}% +}% \tabu@Hy@ftntxt +\long\def\tabu@Hy@footnotetext #1#2{% + \H@@footnotetext{% + \ifHy@nesting + \hyper@@anchor {#1}{#2}% + \else + \Hy@raisedlink{% + \hyper@@anchor {#1}{\relax}% + }% + \def\@currentHref {#1}% + \let\@currentlabelname \@empty + #2% + \fi + }% +}% \tabu@Hy@footnotetext +%% No need for \arraybackslash ! ------------------------------------ +\def\tabu@latextwoe {% +\def\tabu@temp##1##2##3{{\toks@\expandafter{##2##3}\xdef##1{\the\toks@}}} \tabu@temp \tabu@centering \centering \arraybackslash \tabu@temp \tabu@raggedleft \raggedleft \arraybackslash \tabu@temp \tabu@raggedright \raggedright \arraybackslash +}% \tabu@latextwoe +\def\tabu@raggedtwoe {% +\def\tabu@temp ##1##2##3{{\toks@\expandafter{##2##3}\xdef##1{\the\toks@}}} +\tabu@temp \tabu@Centering \Centering \arraybackslash +\tabu@temp \tabu@RaggedLeft \RaggedLeft \arraybackslash +\tabu@temp \tabu@RaggedRight \RaggedRight \arraybackslash +\tabu@temp \tabu@justifying \justifying \arraybackslash +}% \tabu@raggedtwoe \def\tabu@normalcrbackslash{\let\\\@normalcr} \def\tabu@trivlist{\expandafter\def\expandafter\@trivlist\expandafter{% - \expandafter\tabu@normalcrbackslash \@trivlist}}% -\def\tabu@fix@arrayright{% - \@ifpackageloaded{arydshln} - {% - \@ifpackageloaded{colortbl} - {%% colortbl + arydshln - \def\tabu@endarray{% - \adl@endarray \egroup \adl@arrayrestore \CT@end \egroup % - \@arrayright % - \gdef\@preamble{}% - }}% \endarray - {%% arydshln / no colortbl - \def\tabu@endarray{% - \adl@endarray \egroup \adl@arrayrestore \egroup % - \@arrayright % - \gdef\@preamble{}% - }}% \endarray - }% - {% - \@ifpackageloaded{colortbl} - {%% colortbl / no arydshln - \def\tabu@endarray{% - \crcr \egroup \egroup - \@arrayright % - \gdef\@preamble{}\CT@end - }}% - {\PackageWarning{tabu} - {\string\@arrayright\space is missing from the - \MessageBreak definition of \string\endarray. - \MessageBreak Comptability with delarray.sty is broken.}}% - }% + \expandafter\tabu@normalcrbackslash \@trivlist}} +%% Utilities: \fbox \fcolorbox and \tabudecimal ------------------- +\def\tabu@fbox {\leavevmode\afterassignment\tabu@beginfbox \setbox\@tempboxa\hbox} +\def\tabu@beginfbox {\bgroup \kern\fboxsep + \bgroup\aftergroup\tabu@endfbox} +\def\tabu@endfbox {\kern\fboxsep\egroup\egroup + \@frameb@x\relax} +\def\tabu@color@b@x #1#2{\leavevmode \bgroup + \def\tabu@docolor@b@x{#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}\box\z@}}% + \afterassignment\tabu@begincolor@b@x \setbox\z@ \hbox +}% \tabu@color@b@x +\def\tabu@begincolor@b@x {\kern\fboxsep \bgroup + \aftergroup\tabu@endcolor@b@x \set@color} +\def\tabu@endcolor@b@x {\kern\fboxsep \egroup + \dimen@\ht\z@ \advance\dimen@ \fboxsep \ht\z@ \dimen@ + \dimen@\dp\z@ \advance\dimen@ \fboxsep \dp\z@ \dimen@ + \tabu@docolor@b@x \egroup +}% \tabu@endcolor@b@x +%% Corrections (arydshln, delarray, colortbl) ----------------------- +\def\tabu@fix@arrayright {%% \@arrayright is missing from \endarray + \iftabu@colortbl + \ifdefined\adl@array % + \def\tabu@endarray{% + \adl@endarray \egroup \adl@arrayrestore \CT@end \egroup % + \@arrayright % + \gdef\@preamble{}}% + \else % + \def\tabu@endarray{% + \crcr \egroup \egroup % + \@arrayright % + \gdef\@preamble{}\CT@end}% + \fi + \else + \ifdefined\adl@array % + \def\tabu@endarray{% + \adl@endarray \egroup \adl@arrayrestore \egroup % + \@arrayright % + \gdef\@preamble{}}% + \else % + \PackageWarning{tabu} + {\string\@arrayright\space is missing from the + \MessageBreak definition of \string\endarray. + \MessageBreak Comptability with delarray.sty is broken.}% + \fi\fi }% \tabu@fix@arrayright -\def\tabu@adl@xarraydashrule#1#2#3{% +\def\tabu@adl@xarraydashrule #1#2#3{% \ifnum\@lastchclass=\adl@class@start\else \ifnum\@lastchclass=\@ne\else \ifnum\@lastchclass=5 \else % @-arg (class 5) and !-arg (class 1) @@ -1714,26 +2361,141 @@ {\number#2}#3} \fi }% \tabu@adl@xarraydashrule -\def\tabu@adl@act@endpbox{% - \unskip \ifhmode \nobreak \fi \@finalstrut \@arstrutbox - \egroup \egroup - \adl@colhtdp \box\adl@box \hfil +\def\tabu@adl@act@endpbox {% + \unskip \ifhmode \nobreak \fi \@finalstrut \@arstrutbox + \egroup \egroup + \adl@colhtdp \box\adl@box \hfil }% \tabu@adl@act@endpbox -\def\tabu@adl@fix{% - \let\adl@xarraydashrule \tabu@adl@xarraydashrule % arydshln - \let\adl@act@endpbox \tabu@adl@act@endpbox % arydshln - \let\adl@act@@endpbox \tabu@adl@act@endpbox % arydshln - \let\@preamerror \@preamerr % arydshln +\def\tabu@adl@fix {% + \let\adl@xarraydashrule \tabu@adl@xarraydashrule % arydshln + \let\adl@act@endpbox \tabu@adl@act@endpbox % arydshln + \let\adl@act@@endpbox \tabu@adl@act@endpbox % arydshln + \let\@preamerror \@preamerr % arydshln }% \tabu@adl@fix +%% Correction for longtable' \@startbox definition ------------------ +%% => \everypar is ``missing'' : TeX should be in vertical mode \def\tabu@LT@startpbox #1{% - \bgroup - \let\@footnotetext\LT@p@ftntext - \setlength\hsize{#1}% - \@arrayparboxrestore - \everypar{% - \vrule \@height \ht\@arstrutbox \@width \z@ - \everypar{}}% + \bgroup + \let\@footnotetext\LT@p@ftntext + \setlength\hsize{#1}% + \@arrayparboxrestore + \everypar{% + \vrule \@height \ht\@arstrutbox \@width \z@ + \everypar{}}% }% \tabu@LT@startpbox +%% \tracingtabu and the package options ------------------ +\DeclareOption{delarray}{\AtEndOfPackage{\RequirePackage{delarray}}} +\DeclareOption{linegoal}{% + \AtEndOfPackage{% + \RequirePackage{linegoal}[2010/12/07]% + \let\tabudefaulttarget \linegoal% \linegoal is \linewidth if not pdfTeX +}} +\DeclareOption{scantokens}{\tabuscantokenstrue} +\DeclareOption{debugshow}{\AtEndOfPackage{\tracingtabu=\tw@}} +\def\tracingtabu {\begingroup\@ifnextchar=% + {\afterassignment\tabu@tracing\count@} + {\afterassignment\tabu@tracing\count@1\relax}} +\def\tabu@tracing{\expandafter\endgroup + \expandafter\tabu@tr@cing \the\count@ \relax +}% \tabu@tracing +\def\tabu@tr@cing #1\relax {% + \ifnum#1>\thr@@ \let\tabu@tracinglines\message + \else \let\tabu@tracinglines\@gobble + \fi + \ifnum#1>\tw@ \let\tabu@DBG \tabu@@DBG + \def\tabu@mkarstrut {\tabu@DBG@arstrut}% + \tabustrutrule 1.5\p@ + \else \let\tabu@DBG \@gobble + \def\tabu@mkarstrut {\tabu@arstrut}% + \tabustrutrule \z@ + \fi + \ifnum#1>\@ne \let\tabu@debug \message + \else \let\tabu@debug \@gobble + \fi + \ifnum#1>\z@ + \let\tabu@message \message + \let\tabu@tracing@save \tabu@message@save + \let\tabu@starttimer \tabu@pdftimer + \else + \let\tabu@message \@gobble + \let\tabu@tracing@save \@gobble + \let\tabu@starttimer \relax + \fi +}% \tabu@tr@cing +%% Setup \AtBeginDocument +\AtBeginDocument{\tabu@AtBeginDocument} +\def\tabu@AtBeginDocument{\let\tabu@AtBeginDocument \@undefined + \ifdefined\arrayrulecolor \tabu@colortbltrue % + \tabu@colortblalignments % different glues are used + \else \tabu@colortblfalse \fi + \ifdefined\CT@arc@ \else \let\CT@arc@ \relax \fi + \ifdefined\CT@drsc@\else \let\CT@drsc@ \relax \fi + \let\tabu@arc@L \CT@arc@ \let\tabu@drsc@L \CT@drsc@ + \ifodd 1\ifcsname siunitx_table_collect_begin:Nn\endcsname % + \expandafter\ifx + \csname siunitx_table_collect_begin:Nn\endcsname\relax 0\fi\fi\relax + \tabu@siunitxtrue + \else \let\tabu@maybesiunitx \@firstofone % + \let\tabu@siunitx \tabu@nosiunitx + \tabu@siunitxfalse + \fi + \ifdefined\adl@array % + \else \let\tabu@adl@fix \relax + \let\tabu@adl@endtrial \@empty \fi + \ifdefined\longtable % + \else \let\longtabu \tabu@nolongtabu \fi + \ifdefined\cellspacetoplimit \tabu@warn@cellspace\fi + \csname\ifcsname ifHy@hyperfootnotes\endcsname % + ifHy@hyperfootnotes\else iffalse\fi\endcsname + \let\tabu@footnotetext \tabu@Hy@ftntext + \let\tabu@xfootnote \tabu@Hy@xfootnote \fi + \ifdefined\FV@DefineCheckEnd% + \tabu@fancyvrb \fi + \ifdefined\color % + \let\tabu@color \color + \def\tabu@leavevmodecolor ##1{% + \def\tabu@leavevmodecolor {\leavevmode ##1}% + }\expandafter\tabu@leavevmodecolor\expandafter{\color}% + \else + \let\tabu@color \tabu@nocolor + \let\tabu@leavevmodecolor \@firstofone \fi + \tabu@latextwoe + \ifdefined\@raggedtwoe@everyselectfont % + \tabu@raggedtwoe + \else + \let\tabu@cell@L \tabu@cell@l + \let\tabu@cell@R \tabu@cell@r + \let\tabu@cell@C \tabu@cell@c + \let\tabu@cell@J \tabu@cell@j \fi + \expandafter\in@ \expandafter\@arrayright \expandafter{\endarray}% + \ifin@ \let\tabu@endarray \endarray + \else \tabu@fix@arrayright \fi% + \everyrow{}% +}% \tabu@AtBeginDocument +\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 +%% tabu Package initialisation +\tabuscantokensfalse +\let\tabu@arc@G \relax \let\tabu@drsc@G \relax +\let\tabu@evr@G \@empty +\let\tabu@rc@G \@empty +\def\tabu@ls@G {\tabu@linestyle@}% +\def\tabu@naturalXmin {\z@} +\def\tabu@naturalXmax {\z@} +\let\tabu@rowfontreset \@empty +\def\tabulineon {4pt}\let\tabulineoff \tabulineon +\tabu@everyrowtrue +\tracingtabu=\z@ +\newtabulinestyle {=\maxdimen}% creates the 'factory' settings \tabu@linestyle@ +\tabulinestyle{} +\taburowcolors{} +\let\tabudefaulttarget \linewidth +\ProcessOptions* % \ProcessOptions* is quicker ! \endinput %% %% End of file `tabu.sty'. -- cgit v1.2.3