summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tabu
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-12-08 23:10:27 +0000
committerKarl Berry <karl@freefriends.org>2010-12-08 23:10:27 +0000
commitdc303a1e6f377dc52672a520237e5898ca5d3b37 (patch)
tree192867e7c1d3a64db3fe3f87b39f0319f0ee32ad /Master/texmf-dist/tex/latex/tabu
parent683d8229d4e98772f56ad658500561b7dc97ad62 (diff)
tabu 1.5 (8dec10)
git-svn-id: svn://tug.org/texlive/trunk@20693 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tabu')
-rw-r--r--Master/texmf-dist/tex/latex/tabu/tabu.sty1154
1 files changed, 677 insertions, 477 deletions
diff --git a/Master/texmf-dist/tex/latex/tabu/tabu.sty b/Master/texmf-dist/tex/latex/tabu/tabu.sty
index 4b09df52b1b..8d3aef8aa16 100644
--- a/Master/texmf-dist/tex/latex/tabu/tabu.sty
+++ b/Master/texmf-dist/tex/latex/tabu/tabu.sty
@@ -8,7 +8,7 @@
%%
%% This is a generated file.
%%
-%% tabu : 2010/11/22 v1.4 - tabu : Flexible LaTeX tabulars
+%% tabu : 2010/12/07 v1.5 - tabu : Flexible LaTeX tabulars
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
@@ -25,8 +25,10 @@
%%
\NeedsTeXFormat{LaTeX2e}[2005/12/01]
-\ProvidesPackage{tabu}[2010/11/22 v1.4 - flexible LaTeX tabulars (FC)]
+\ProvidesPackage{tabu}[2010/12/07 v1.5 - flexible LaTeX tabulars (FC)]
\RequirePackage{array}[2008/09/09]
+\RequirePackage{varwidth}[2009/03/30]
+\let\DEBUG\@gobble%\message
\AtEndOfPackage{\tabu@AtEnd\let\tabu@AtEnd\@undefined}
\let\tabu@AtEnd\@empty
\def\TMP@EnsureCode#1#2{%
@@ -40,27 +42,34 @@
\TMP@EnsureCode{124}{12}% |
\TMP@EnsureCode{0}{12}% ^^@
\TMP@EnsureCode{36}{3}% $ = math shift
-\let\tabu@message\@gobble
-\def\tracingtabu{\let\tabu@message\message}
-\let\tabudefaulttarget\linewidth
-\DeclareOption{debugshow}{\tracingtabu}
+\let\tabu@message \@gobble
+\let\tabu@message@save \@gobble
+\let\tabu@debug \@gobble
+\def\tracingtabu{%
+ \let\tabu@message \message
+ \let\tabu@message@save \tabu@tracing@save
+ \@ifnextchar={\tabu@tracing}{}}
+\def\tabu@tracing{\begingroup\afterassignment\tabu@tr@cing\count@}
+\def\tabu@tr@cing{\expandafter\endgroup\ifnum\count@>\@ne
+ \let\tabu@debug\message\else\let\tabu@debug\@gobble\fi}
+\DeclareOption{debugshow}{\AtEndOfPackage\tracingtabu}
+\let\tabudefaulttarget \linewidth
\DeclareOption{linegoal}{%
- \AtEndOfPackage{\RequirePackage{linegoal}[2010/10/31]}%
- \def\tabudefaulttarget{\linegoal}% \linegoal is \linewidth if not pdfTeX
-}% linegoal option
+ \AtEndOfPackage{%
+ \RequirePackage{linegoal}[2010/12/07]%
+ \let\tabudefaulttarget \linegoal% \linegoal is \linewidth if not pdfTeX
+}}
\DeclareOption{delarray}{%
\AtEndOfPackage{\RequirePackage{delarray}}%
-}% delarray option
+}
\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@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
}
-}% light option
+}
\def\tabu@norowfont{\PackageError{tabu}
{\string\rowfont\space is not available with option `light'}\@ehd}
\def\tabu@nocline{\PackageError{tabu}
@@ -68,158 +77,174 @@
\ProcessOptions
\AtBeginDocument{%
\@ifundefined{NC@rewrite@X}{\newcolumntype{X}{}}{}% new column X if not exists
- \expandafter\in@\expandafter\@arrayright\expandafter{\endarray}%
- \ifin@ \let\tabu@endarray\endarray
- \else \tabu@fix@arrayright \fi % <fix for colortbl & arydshln (delarray)>
+ \expandafter\in@ \expandafter\@arrayright\expandafter{\endarray}%
+ \ifin@ \let\tabu@endarray \endarray
+ \else \tabu@fix@arrayright \fi % <fix for colortbl & arydshln (delarray)>
\@ifpackageloaded{colortbl} \tabu@colortbltrue \tabu@colortblfalse
+ \@ifpackageloaded{arydshln}{}
+ {\let\tabu@adl@fix \relax \let\tabu@adl@endTRIAL \@empty}%
+ \@ifpackageloaded{longtable}{}{\let\longtabu \tabu@nolongtabu}%
}
-\newcount\tabu@cnt
-\newcount\tabu@nbcols
-\newcount\tabu@X@cols
-\newcount\tabu@start
-\newcount\tabu@stop
-\newdimen\tabu@target
-\newdimen\tabu@spreadtarget
-\newdimen\tabu@naturalX
-\newdimen\tabucolX
-\newdimen\tabu@X@sum
-\newif\iftabu@measuring
-\newif\iftabu@spread
-\newif\iftabu@nested
-\newif\iftabu@firstcline
-\newsavebox\tabu@box
-\chardef\tabu@arstrutbox=\@arstrutbox
+\newcount \tabu@cnt
+\newcount \tabu@nbcols
+\newcount \tabu@X@cols
+\newcount \tabu@start
+\newcount \tabu@stop
+\newcount \tabu@nested
+\newdimen \tabu@target
+\newdimen \tabu@spreadtarget
+\newdimen \tabu@naturalX
+\newdimen \tabucolX
+\newdimen \tabu@X@sum
+\newdimen \tabucolX@error \tabucolX@error=1em
+\newif \iftabu@measuring
+\newif \iftabu@spread
+\newif \iftabu@firstcline
+\newif \iftabu@negcoef
+\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@save@decl{%
+ \toks\count@ = \expandafter{\the\toks\expandafter\count@\@nextchar}%
+}% \tabu@save@decl
\newcommand\tabu@NC@rewrite@X[1][]{\tabu@rewrite@X{#1}%
\let\@halignto \relax
- \expandafter \NC@find \tabucolX@spec}
-\expandafter\def\csname NC@rewrite@\string\usetabu\endcsname#1{%
+ \expandafter \NC@find \tabucolX@rw}
+\def\tabu@newcolumntype #1{%
+ \expandafter\def\csname NC@find@\string#1\endcsname##1#1{\NC@{##1}}%
+ \expandafter\def\csname NC@rewrite@\string#1\endcsname%
+}% \tabu@newcolumntype
+\tabu@newcolumntype \usetabu #1{%
\ifx\\#1\\\tabu@saveerr{}\else
\@ifundefined{tabu@saved@\string#1}
{\tabu@saveerr{#1}}
{\let\tabu@rewrite@X \tabu@rewrite@Xrestore
- \def\tabu@temp{\xdef\tabu@usetabu{%
- \col@sep \the\col@sep\relax
- \arrayrulewidth \the\arrayrulewidth\relax
- \@tempdima \ht\@arstrutbox \advance\@tempdima -\extrarowheight
- \extrarowheight \the\extrarowheight\relax
- \advance\@tempdima \extrarowheight
- \ht\@arstrutbox \@tempdima
- \extratabsurround \the\extratabsurround\relax
- \doublerulesep \the\doublerulesep\relax}}%
- \aftergroup \tabu@usetabu
- \csname tabu@saved@\string#1\expandafter\endcsname}%
+ \csname tabu@saved@\string#1\expandafter\endcsname\expandafter\z@}%
\fi
}% \NC@rewrite@\usetabu
-\expandafter\def\csname NC@find@\string\usetabu\endcsname#1\usetabu{\NC@{#1}}
-\expandafter\def\csname NC@rewrite@\string\tabu@rewritefirst\endcsname{%
- \ifx\tabu@lines\relax
- \NC@list\expandafter{\expandafter\NC@do \expandafter\usetabu
- \NC@do X\NC@do\tabu@rewritelast}%
- \else
- \NC@list\expandafter{\expandafter\NC@do \expandafter\usetabu
- \expandafter\NC@do \expandafter|\tabu@NC@list
- \NC@do X\NC@do\tabu@rewritelast}%
- \tabu@lines % defines NC@rewrite@| for tabu only (inside @mkpream group)
+\tabu@newcolumntype \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
- \let\save@decl \tabu@save@decl % inversion of tokens in text mode
- \let\NC@rewrite@X \tabu@NC@rewrite@X
- \aftergroup \tabu@global@temp
+}% \NC@rewrite@\preamble
+\tabu@newcolumntype \tabu@rewritefirst{%
+ \tabu@X@cols \z@ \let\NC@rewrite@X \tabu@NC@rewrite@X
+ \let\tabu@dimexpr \relax \aftergroup \tabu@global@temp
+ \aftergroup \tabu@restore@NC@list
+ \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\NC@list \NC@do X\NC@do\tabu@rewritelast}%
+ \ifcat$\d@llarend\else
+ \let\save@decl \tabu@save@decl \fi % no inversion of tokens in text mode
\NC@find \tabu@rewritelast
}% NC@rewrite@\tabu@rewritefirst
-\expandafter\def\csname NC@find@\string\tabu@rewritefirst\endcsname
- #1\tabu@rewritefirst{\NC@{#1}}
-\def\tabu@rewritefirst{%
- \edef\tabu@NC@list{\the\NC@list}%
- \NC@list{\NC@do \tabu@rewritefirst \NC@do *}%
-}% \tabu@rewritefirst
-\expandafter\def\csname NC@rewrite@\string\tabu@rewritelast\endcsname{%
- \global\NC@list\expandafter{\tabu@NC@list}%
- \futurelet \tabu@temp \tabu@rewritelast
-}% \NC@rewrite@\tabu@rewritelast
-\expandafter\def\csname NC@find@\string\tabu@rewritelast\endcsname
- #1\tabu@rewritelast{\NC@{#1}}
-\def\tabu@rewritelast{%
+\def\tabu@restore@NC@list{\NC@list\expandafter{\tabu@NC@list}}
+\tabu@newcolumntype \tabu@rewritelast{%
+ \NC@list\expandafter{\tabu@NC@list}%
+ \let\tabu@next \NC@find
\ifx \@halignto\relax % found a X column
- \let\tabu@temp \@empty
\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
- \ifdim \tabu@target=\z@ \let\tabu@temp \@empty
- \else
- \if |\noexpand\tabu@temp\def\tabu@temp{@{\extracolsep\@flushglue}}\else
- \if !\noexpand\tabu@temp\def\tabu@temp{@{\extracolsep\@flushglue}}\else
- \def\tabu@temp{!{\extracolsep\@flushglue}}\fi\fi
- \fi
- \aftergroup\tabu@setup@everycr
+ \aftergroup \tabu@setup@everycr
+ \ifdim \tabu@target=\z@ \else
+ \let\tabu@next \tabu@rewritelast \fi % <need \extracolsep ?>
\fi
\let\@halignto \tabu@halignto
- \expandafter\NC@find \tabu@temp
+ \tabu@next
+}% \NC@rewrite@\tabu@rewritelast
+\def\tabu@rewritelast{\futurelet\tabu@temp \tabu@rewrite@last}
+\def\tabu@rewrite@last{%
+ \ifx \tabu@temp\@sptoken
+ \expandafter\tabu@gobblespace \expandafter\tabu@rewritelast
+ \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@rewritelast
+\def\tabu@global@Xnested{\global\expandafter\let
+ \csname tabu@global@X\the\tabu@nested\endcsname\tabu@global@X
+ \aftergroup\let \aftergroup\tabu@global@X
+ \expandafter\aftergroup \csname tabu@global@X\the\tabu@nested\endcsname
+}% \tabu@global@Xnested
\newif\iftabu@colortbl
-\def\tabu@nowrite{% cancels a \write command (tabularx method)
- \begingroup
- \def\let{\afterassignment\endgroup\toks@}%
- \afterassignment\let\count@
-}% \tabu@nowrite
+\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\immediate\write{\aftergroup\endgroup
+ \tabu@immediate\tabu@write}\PackageWarning{tabu}}
\def\tabu{%
- \ifmmode \def\endtabu{\endarray}%
- \else \def\endtabu{\endtabular}\fi
+ \ifmmode \def\tabu@{\array}\def\endtabu{\endarray}%
+ \else \def\tabu@{\tabular}\def\endtabu{\endtabular}\fi
\tabu@setup \tabu@settarget
}% \tabu
+\def\longtabu{%
+ \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\tabu@endTRIAL \tabu@long@endTRIAL
+ \tabu@setup \tabu@settarget
+}% \longtabu
+\def\tabu@nolongtabu{\PackageError{tabu}
+ {longtabu requires the longtable package}\@ehd}
\def\tabu@setup{%
- \let\adl@xarraydashrule \tabu@adl@xarraydashrule % <fix> arydshln
- \let\adl@act@endpbox \tabu@adl@act@endpbox % <fix> arydshln
- \let\adl@act@@endpbox \tabu@adl@act@endpbox % <fix> arydshln
- \let\@preamerror \@preamerr % <fix> arydshln
- \let\endarray \tabu@endarray % <fix> colortbl & arydshln (delarray)
+ \tabu@adl@fix \let\endarray \tabu@endarray % <fix> colortbl & arydshln (delarray)
\let\tabu@global@temp \@empty \let\tabu@global@X \@empty
- \ifx\verbatim \tabu@sanitizetext
- \tabu@nestedtrue
- \def\tabu@aligndefault{t}\def\tabudefaulttarget{\linewidth}%
- \else \tabu@nestedfalse
- \def\tabu@aligndefault{c}%
- \global\tabu@footnotes{}%
- \aftergroup\the\aftergroup\tabu@footnotes
- \ifdim\parindent>\z@ \ifx\linewidth\tabudefaulttarget
- \everypar\expandafter{% % correction for indentation
+ \ifx \verbatim\tabu@sanitizetext % <nested tabu>
+ \tabu@setup@saveglobal
+ \advance\tabu@nested \@ne
+ \def\tabu@aligndefault{t}\let\tabudefaulttarget \linewidth
+ \else
+ \def\tabu@aligndefault{c}\edef\tabu@hfuzz {\the\hfuzz}%
+ \global\tabu@footnotes{}\aftergroup\the\aftergroup\tabu@footnotes
+ \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\fi
\fi
- \let\@footnotetext \tabu@footnotetext
- \let\@xfootnotetext\tabu@xfootnotetext
- \let\@xfootnote \tabu@xfootnote
- \let\centering \tabu@centering
- \let\raggedright \tabu@raggedright
- \let\raggedleft \tabu@raggedleft
- \let\@trivlist \tabu@trivlist %<restore \\=\@centercr inside lists>
- \let\tabudecimal \tabu@tabudecimal
- \let\verbatim \tabu@sanitizetext
- \let\fbox \tabu@fbox
- \let\prepnext@tok \tabu@prepnext@tok % <for rowfont and tabucline>
- \let\rowfont \tabu@rowfont
+ \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\@trivlist \tabu@trivlist %<restore \\=\@centercr inside lists>
+ \def\tabudecimal {\tabu@tabudecimal}\let\verbatim \tabu@sanitizetext
+ \let\fbox \tabu@fbox \let\rowfont \tabu@rowfont
+ \let\prepnext@tok \tabu@prepnext@tok %<for \rowfont and \tabucline>
\everycr{}\let\tabu@everycr \everycr
- \tabu@spreadfalse \tabu@measuringfalse
- \edef\tabu@hfuzz{\ifdim\hfuzz<.1\p@ .1\p@\else\the\hfuzz\fi}%
- \tabu@rewritefirst
+ \tabu@spreadfalse \tabu@measuringfalse \tabu@negcoeffalse
+ \edef\tabu@NC@list{\the\NC@list}\NC@list{\NC@do\tabu@rewritefirst \NC@do *}%
}% \tabu@setup
-\def\tabu@save@decl{% no inversion on tokens when not in math mode
- \ifcat$\d@llarend
- \toks\count@\expandafter\expandafter\expandafter{%
- \expandafter\@nextchar \the\toks\count@}%
- \else
- \toks\count@\expandafter\expandafter\expandafter{%
- \expandafter\the\expandafter\toks\expandafter\count@\@nextchar}%
- \fi
-}% \tabu@save@decl
+\def\tabu@setup@saveglobal{%
+ \expandafter\xdef\csname tabu@global@\the\tabu@nested\endcsname{%
+ \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}}%
+ \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
@@ -228,62 +253,62 @@
\if t\@let@token 2\else
\if s\@let@token 3\else
\m@ne\fi\fi\fi\fi\fi\relax
- \expandafter\tabu@begin
- \or \expandafter\tabu@gobblespace\expandafter\tabu@settarget
- \or \expandafter\tabu@to
- \or \expandafter\tabu@spread
- \else\expandafter\tabu@begin
+ \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\@halignto{to}\tabu@gettarget}
\def\tabu@spread spread{\tabu@spreadtrue\def\@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{\ifx\tabu@temp\LNGL@setlinegoal
- \LNGL@setlinegoal
- \expandafter\expandafter\expandafter \tabu@begin
- \expandafter\@gobble
- \else \expandafter\tabu@begin
- \fi
+\def\tabu@gettarget {\afterassignment\tabu@linegoaltarget \tabu@target}
+\def\tabu@linegoaltarget {\futurelet\tabu@temp \tabu@linegoal@target}
+\def\tabu@linegoal@target {%
+ \ifx \tabu@temp\LNGL@setlinegoal
+ \LNGL@setlinegoal \expandafter \@firstoftwo \fi % @gobbles \LNGL@setlinegoal
+ \tabu@begin
}% \tabu@linegoal@target
-\def\tabu@begin#1#{%
- \edef\@halignto{\ifdim\tabu@target>\z@ \@halignto\the\tabu@target\fi}%
+\def\tabu@begin #1#{%
+ \edef\@halignto {\ifdim\tabu@target>\z@ \@halignto\the\tabu@target\fi}%
\let\tabu@halignto \@halignto
- \expandafter\@testopt \expandafter\tabu@@begin \tabu@aligndefault #1\@nil
+ \@testopt \tabu@@begin \tabu@aligndefault #1\@nil
}% \tabu@begin
-\def\tabu@@begin[#1]#2\@nil#3{%
- \edef\tabu@align{#1}%
- \edef\tabu@saved{%
+\def\tabu@@begin [#1]#2\@nil#3{%
+ \tabu@preparesave{#3}% <for \savetabu>
+ \def\tabu@align {#1}%
+ \tabu@ [{\tabu@align}]#2{\tabu@rewritefirst #3}%
+}% \tabu@@begin
+\def\tabu@preparesave #1{%
+ \edef\tabu@savedparam{%
\ifmmode \col@sep \the\arraycolsep
\else \col@sep \the\tabcolsep \fi\relax
- \arrayrulewidth \the\arrayrulewidth\relax
- \extrarowheight \the\extrarowheight\relax
+ \arrayrulewidth \the\arrayrulewidth\relax
+ \doublerulesep \the\doublerulesep\relax
+ \extrarowheight \the\extrarowheight\relax
\extratabsurround \the\extratabsurround\relax
- \doublerulesep \the\doublerulesep\relax}%
- \expandafter\def\expandafter\tabu@saved\expandafter{\tabu@saved
- \tabu@temp \edef\tabu@halignto{to\the\tabu@target}\NC@find #3}%
- \ifmmode \expandafter\array
- \else \expandafter\tabular
- \fi [{#1}]#2{\tabu@rewritefirst #3}%
-}% \tabu@@begin
+ \def\noexpand\arraystretch {\arraystretch}%
+ \iftabu@colortbl \minrowclearance\the\minrowclearance\relax \fi}%
+ \def\tabu@savedpream {\edef\tabu@halignto{to\the\tabu@target}\NC@find #1}%
+}% \tabu@preparesave
\newtoks\tabu@footnotes
-\long\def\tabu@footnotetext#1{%
+\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{\@tempa {#1}}}%
+\long\def\tabu@xfootnotetext [#1]#2{%
\global\tabu@footnotes\expandafter{\the\tabu@footnotes
- \footnotetext[{#1}]{#2}}}
+ \footnotetext [{#1}]{#2}}}
\let\tabu@xfootnote \@xfootnote
\long\def\tabu@Hy@ftntext{\tabu@Hy@ftntxt {\the \c@footnote }}
-\long\def\tabu@Hy@xfootnote[#1]{%
+\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{%
+\long\def\tabu@Hy@ftntxt #1#2{%
\edef\@tempa{%
\the\tabu@footnotes
\begingroup
@@ -296,92 +321,78 @@
}%
}%
\global\tabu@footnotes\expandafter{%
- \@tempa{#2}%
+ \@tempa {#2}%
\endgroup
}%
}% \tabu@Hy@ftntxt
-\long\def\tabu@Hy@footnotetext#1#2{%
+\long\def\tabu@Hy@footnotetext #1#2{%
\H@@footnotetext{%
\ifHy@nesting
- \hyper@@anchor{#1}{#2}%
+ \hyper@@anchor {#1}{#2}%
\else
\Hy@raisedlink{%
- \hyper@@anchor{#1}{\relax}%
+ \hyper@@anchor {#1}{\relax}%
}%
- \def\@currentHref{#1}%
- \let\@currentlabelname\@empty
+ \def\@currentHref {#1}%
+ \let\@currentlabelname \@empty
#2%
\fi
}%
}% \tabu@Hy@footnotetext
\AtBeginDocument{%
- \@ifpackageloaded{hyperref}
- {\ifHy@hyperfootnotes
- \let\tabu@footnotetext \tabu@Hy@ftntext
- \let\tabu@xfootnote \tabu@Hy@xfootnote
- \fi}
- {}%
-}%
-\def\tabu@rewrite@X#1{\tabu@Xarg{#1}%
- \iftabu@spread \tabu@rewrite@Xspread
- \else \tabu@rewrite@Xto
+ \csname\ifcsname ifHy@hyperfootnotes\endcsname
+ ifHy@hyperfootnotes\else iffalse\fi\endcsname
+ \let\tabu@footnotetext \tabu@Hy@ftntext
+ \let\tabu@xfootnote \tabu@Hy@xfootnote
\fi
-}% \tabu@rewrite@X
-\def\tabu@rewrite@Xnested#1{\in@ ${#1}\ifin@
- \def\tabucolX@spec{>{$}p{\tabucolX}<{$}}\else
- \def\tabucolX@spec{p{\tabucolX}}\fi}
-\def\tabu@rewrite@Xrestore#1{\tabu@Xarg{#1}\let\tabucolX@spec\tabu@temp}%
-\def\tabu@rewrite@Xto{%
+}
+\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
- \xdef\tabu@global@X {\tabu@global@X
- \advance\tabu@X@sum \the\tabu@X@sum\relax}%
+ \edef\tabu@global@X {\tabu@global@X
+ \advance\tabu@X@cols \@ne
+ \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
- \fi
- \xdef\tabu@global@X{%
- \tabu@X@sum \the\tabu@X@sum\relax
- \tabu@target \the\tabu@target\relax}%
- \let\tabu@halignto \relax
- \fi
-}% \tabu@rewrite@Xto
-\def\tabu@rewrite@Xspread{% tabu spread with X columns: need to store each coef
- \iftabu@measuring % not the first X column found in preamble
- \advance\tabu@X@cols \@ne
- \expandafter\let\csname tabu@X\the\tabu@X@cols\endcsname \relax
- \xdef\tabu@global@X {\tabu@global@X
- \advance\tabu@X@cols\@ne
- \advance\tabu@X@sum \the\tabu@X@sum\relax
- \def\csname tabu@X\the\tabu@X@cols\endcsname{\strip@pt\tabu@X@sum}}%
- \else % first X column found in preamble
- \tabu@measuringtrue
- \tabu@X@cols \@ne \tabu@spreadtarget=\tabu@target
- \setlength \tabu@target \tabudefaulttarget
- \expandafter\let\csname tabu@X\the\tabu@X@cols\endcsname \relax
- \xdef\tabu@global@X {%
+ \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
\tabu@X@cols \@ne
- \tabu@X@sum \the\tabu@X@sum\relax
+ \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
- \def\csname tabu@X\the\tabu@X@cols\endcsname{\strip@pt\tabu@X@sum}}%
+ \tabu@spreadtarget \the\tabu@spreadtarget\relax}%
\let\tabu@halignto \relax
\fi
-}% \tabu@rewrite@Xspread
+}% \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{%
- \ifx\\#1\\% <shortcut when no option>
- \tabu@X@sum \p@
- \def\tabucolX@spec{p{\tabucolX}}%
- \edef\tabu@temp{p{\the\tabucolX}}% <required for \usetabu>
- \else
- \tabu@X@sum \z@
- \let\tabucolX@align \@empty
- \let\tabucolX@spec \@empty
- \let\tabu@Xmath \relax
- \tabu@Xparse {}#1\relax\@nnil
- \fi
+ \advance\tabu@X@cols \@ne
+ \tabu@wdlet\tabu@X@cols \z@
+ \ifx\\#1\\% <shortcut when no option>
+ \tabu@X@sum \p@
+ \edef\tabucolX@rw {p{\tabu@dimexpr{\the\tabu@X@cols}{\tabucolX}}}%
+ \edef\tabu@temp {p{\the\tabucolX}}% <required for \usetabu>
+ \else
+ \tabu@X@sum \z@
+ \let\tabucolX@align \@empty \let\tabucolX@rw \@empty
+ \let\tabu@Xmath \@empty \let\tabu@temp \@empty
+ \tabu@Xparse {}#1\relax\@nnil
+ \fi
}% \tabu@Xarg
-\def\tabu@Xparse#1{\futurelet\@let@token\tabu@Xtest}
+\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
@@ -393,28 +404,29 @@
\if l\@let@token 4\else
\if c\@let@token 5\else
\if r\@let@token 6\else
- \if .\@let@token 7\else
- \ifx \@sptoken\@let@token 8\else
- \if L\@let@token 9\else
- \if C\@let@token 10\else
- \if R\@let@token 11\else
+ \if L\@let@token 7\else
+ \if C\@let@token 8\else
+ \if R\@let@token 9\else
+ \ifx \@sptoken\@let@token 10\else
+ \if .\@let@token 11\else
+ \if -\@let@token 11\else
\ifcat $\@let@token 12\else
- 13\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax
- \tabucolX@do \expandafter\remove@to@nnil
- \or \tabu@Xcolspec{p}%
- \or \tabu@Xcolspec{m}%
- \or \tabu@Xcolspec{b}%
- \or \tabu@Xalign{>{\raggedright}}%
- \or \tabu@Xalign{>{\centering}}%
- \or \tabu@Xalign{>{\raggedleft}}%
- \or \expandafter\tabu@Xcoef
- \or \expandafter\tabu@Xparsespace
- \or \tabu@Xalign{>{\RaggedRight}}%
- \or \tabu@Xalign{>{\Centering}}%
- \or \tabu@Xalign{>{\RaggedLeft}}%
- \or \let\tabu@Xmath=$\expandafter\tabu@Xparse
+ 13\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax
+ \tabucolX@do \expandafter \remove@to@nnil
+ \or \tabu@Xtype {p}%
+ \or \tabu@Xtype {m}%
+ \or \tabu@Xtype {b}%
+ \or \tabu@Xalign \raggedright
+ \or \tabu@Xalign \centering
+ \or \tabu@Xalign \raggedleft
+ \or \tabu@Xalign \RaggedRight
+ \or \tabu@Xalign \Centering
+ \or \tabu@Xalign \RaggedLeft
+ \or \expandafter \tabu@Xparsespace
+ \or \expandafter \tabu@Xcoef
+ \or \let\tabu@Xmath=$\expandafter \tabu@Xparse
\or \tabu@Xcoef{}%
- \else \expandafter\tabu@Xparse
+ \else\expandafter \tabu@Xparse
\fi
}% \tabu@Xtest
\def\tabu@Xalign#1{%
@@ -422,166 +434,240 @@
{Duplicate horizontal alignment specification}\fi
\def\tabucolX@align{#1}\expandafter\tabu@Xparse
}% \tabu@Xalign
-\def\tabu@Xcolspec#1{%
- \ifx\tabucolX@spec\@empty\else \PackageWarning{tabu}
+\def\tabu@Xtype#1{%
+ \ifx \tabucolX@rw\@empty \else \PackageWarning{tabu}
{Duplicate vertical alignment specification}\fi
- \def\tabucolX@spec{#1}\expandafter\tabu@Xparse
-}% \tabu@Xcolspec
-\def\tabu@Xcoef#1{\def\@tempa{#1}%
- \afterassignment\tabu@Xc@ef \tabu@cnt
+ \def\tabucolX@rw{#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
}% \tabu@Xcoef
\def\tabu@Xc@ef{%
- \advance\tabu@X@sum \@tempa\the\tabu@cnt\p@
+ \advance\tabu@X@sum \tabu@temp\the\tabu@cnt\p@
\tabu@Xparse{}%
}% \tabu@Xc@ef
\def\tabucolX@do{%
- \ifx\tabucolX@spec\@empty \def\tabucolX@spec{p}\fi
- \ifdim \tabu@X@sum=\z@ \tabu@X@sum \p@\fi
+ \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
+ \fi
\begingroup
- \edef\tabucolX@spec##1{\tabucolX@spec{##1}}%
- \edef\tabu@temp{\dimexpr\strip@pt\tabu@X@sum \tabucolX \relax}%
- \toks@\expandafter{\tabucolX@align}%
- \edef\x{%
- \def\noexpand\tabu@temp{%
- \ifx \tabu@Xmath\relax\else >{$}\fi
- \the\toks@ \tabucolX@spec{\the\tabu@temp}%
- \ifx \tabu@Xmath\relax\else <{$}\fi}%
- \def\noexpand\tabucolX@spec{%
- \ifx \tabu@Xmath\relax\else >{$}\fi
- \the\toks@ \tabucolX@spec{\tabu@temp}%
- \ifx \tabu@Xmath\relax\else <{$}\fi}%
- }\expandafter\endgroup\x
+ \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 \tabucolXalign\@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{%
\let\tabu@savedpreamble \@preamble
- \def\savetabu {\tabu@saveX}%
- \begingroup\iffalse{\fi\ifnum0=`}\fi
+ \begingroup \iffalse{\fi \ifnum0=`}\fi
\tabu@setup@TRIAL
- \iftabu@spread % first trial only
+ \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@ \tabu@naturalX \z@ \tabucolX \z@
- \let\tabu@naturalX@max \z@
- \let\tabu@naturalX@min \z@
+ \tabu@X@cols \z@
+ \def\tabu@naturalX@max {\z@}%
+ \def\tabu@naturalX@min {\z@}%
\let\tabu@startpboxORI \@startpbox
- \let\@startpbox \tabu@spread@startpbox
- \else
- \tabucolX = \tabu@target
+ \let\@startpbox \tabu@measure@startpbox
\fi
- \tabu@cnt \z@ % number of trials
- \def\tabu@lasttry{\m@ne\p@}%
+ \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
+\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
- \def\tabudefaulttarget{\linewidth}%
- \def\@elt##1{\global\value{##1}\the\value{##1}\relax}%
- \xdef\tabu@global@X {\cl@@ckpt}\let\@elt \relax
- \hbadness\@M \hfuzz\maxdimen
- \let\hbadness \@tempcnta
- \let\hfuzz \@tempdima
- \let\write \tabu@nowrite
- \let\@footnotetext\@gobble
- \long\def\@xfootnote[##1]##2{}%
- \let\tabu@saveX \@gobble
+ \let\savetabu \@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
\tabu@TRIAL@hook
}% \tabu@setup@TRIAL
-\let\tabu@TRIAL@hook\@empty
-\newcommand\tabuDisableCommands[1]{\g@addto@macro\tabu@TRIAL@hook{#1}}
+\def\tabu@savecounters{%
+ \def\@elt##1{\global\value{##1}\the\value{##1}\relax}%
+ \edef\tabu@global@X {\cl@@ckpt}\let\@elt \relax
+}% \tabu@savecounters
+\let\tabu@TRIAL@hook \@empty
+\newcommand\tabuDisableCommands[1]{\g@addto@macro\tabu@TRIAL@hook {#1}}
\def\tabu@arrayleft@measure#1\bgroup{%
- \def\tabu@Xfinish{\ifnum0=`{\fi\iffalse}\fi\endgroup\tabu@global@X #1\bgroup}%
- \toks@{%
- \tabu@setup@everycr
- \let\@preamble\tabu@savedpreamble}% <required for multicolumn>
- \tabu@collect
+ \def\tabu@Xfinish{%
+ \tabu@global@Xnested \ifnum0=`{}\fi\endgroup
+ \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}% <required for multicolumn>
+ \tabu@collect
}% \tabu@arrayleft@measure
+\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@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 % <only once>
+ \else \tabu@arith
+ \fi
+ \iftabu@measuring \tabu@measuringfalse
+ \expandafter \tabu@TRIAL % <continue trials>
+ \else
+ \expandafter \tabu@Xfinish
+ \the \expandafter\toks@ \tabu@endenvir % <we are then!>
+ \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
+ \expandafter \tabu@TRIAL
\else
\toks@\expandafter{\the\toks@#1\end{#2}}%
- \expandafter\tabu@collectbody
+ \expandafter \tabu@collectbody
\fi
}% \tabu@collectbody
\long\def\tabu@pushbegins#1\begin#2{%
\ifx\end#2\else b\expandafter\tabu@pushbegins\fi}
-\def\tabu@TRIAL{\setbox\tabu@box \hbox\bgroup $\@arrayleft
- \if c\tabu@align\vcenter\else\vbox\fi\bgroup \the\toks@
- \tabu@endTRIAL}% constant
\def\tabu@endTRIAL{%
- \ifdefined\adl@ncol % <arydshln in trials>
- \csname crcr\endcsname
- \noalign{\global\adl@ncol\tabu@nbcols}\fi
+ \tabu@adl@endTRIAL % <arydshln in nested trials>
\endarray$\egroup
- \iftabu@spread \tabu@spreadfalse
- \let\@startpbox \tabu@startpboxORI
- \tabu@spreadarith % <only once>
- \else \tabu@arith
+ \iftabu@spread \tabu@spreadarith % <only once>
+ \else \tabu@arith
\fi
\iftabu@measuring \tabu@measuringfalse
- \expandafter \tabu@TRIAL % <continue trials>
+ \expandafter \tabu@TRIAL % <continue trials>
\else
- \toks@\expandafter\expandafter\expandafter{%
- \the\expandafter\toks@ \tabu@endenvir}%
- \expandafter \tabu@Xfinish \the\toks@ % <we are then!>
+ \expandafter \tabu@Xfinish
+ \the \expandafter\toks@ \tabu@endenvir % <we are then!>
\fi
}% \tabu@endTRIAL
+\def\tabu@adl@endTRIAL{\crcr \noalign{\global\adl@ncol \tabu@nbcols}}
\def\tabu@arith{%
- \advance\tabu@cnt \@ne
-%% \showbox\tabu@box
- \ifdim \tabu@lasttry=\wd\tabu@box
- \tabu@message{\tabu@header Reached minimum width. Backing up}%
- \else
- \edef\tabu@lasttry{\the\wd\tabu@box}%
- \tabu@message{\tabu@message@arith}%
- \ifdim \dimexpr \wd \tabu@box - \tabu@target <\tabu@hfuzz
- \tabu@message{\tabu@message@reached}%
- \xdef\tabu@global@X {\tabu@target\the\tabu@target\relax \tabu@global@X
- \tabucolX \the\tabucolX\relax}%
- \else
- \advance\tabucolX-\dimexpr(\wd\tabu@box-\tabu@target-\tabu@X@sum/65536)
- *65536/\tabu@X@sum\relax
+ \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 \tabu@message{\tabu@message@arith}%
+ \advance\tabucolX-\dimexpr(\wd\tabu@box-\tabu@target-\tabu@X@sum/\p@)
+ *\p@/\tabu@X@sum\relax
\ifdim \tabucolX<\z@
- {\let\write\tabu@write\PackageWarning{tabu}
- {X Columns too narrow (table too wide)\MessageBreak}}%
- \tabucolX=1em%
+ \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}%
+ \else
+ \ifnum \tabu@cnt>\@ne \edef\tabu@lasttry{\the\wd\tabu@box}\fi
+ \ifdim \tabucolX<\@tempdima \tabucolX \@tempdima\fi
+ \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@
}% \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
+ \advance\tabu@spreadtarget
+ \dimexpr\wd\tabu@box-\tabu@naturalX+\tabucolX\relax
\ifdim \tabu@spreadtarget <\tabu@target
- \tabu@target = \tabu@spreadtarget
+ \tabu@target =\tabu@spreadtarget
\fi
- \tabu@message{\expandafter\tabu@msg@align \the\tabu@target {}{}{}{}{}\@@}%
+ \tabu@message{\the\tabu@target}%
\tabu@message{\ifdim \tabu@spreadtarget>\tabu@target
- (tabu) default target used.\fi}%
+ (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@measuringtrue
+ \tabu@spreadfalse \tabu@measuringtrue
}% \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)
- *65536/\tabu@X@sum\relax {}{}{}{}{}\@@}
+ *\p@/\tabu@X@sum\relax {}{}{}{}{}\@@\fi\fi}%
\def\tabu@message@spread{\tabu@spreadheader
\expandafter\tabu@msg@align \the\tabu@spreadtarget {}{}{}{}{}\@@
\expandafter\tabu@msg@align \the\wd\tabu@box {}{}{}{}{}\@@
@@ -589,102 +675,112 @@
\expandafter\tabu@msg@align \expandafter-\the\tabu@naturalX {}{}{}{}{}\@@}
\def\tabu@message@reached{\tabu@header
\expandafter\tabu@msg@align \the\tabucolX { }{ }{ }{ }{}\@@
- ******** Reached Target : hfuzz=\tabu@hfuzz\space ********^^J}
+ \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@^^J\fi}%
+\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
+\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#1\else
- \ifnum##1<100 #1#1\else
+ \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{%
- \ifnum\tabu@cnt=\@ne (tabu)
- Try#1#1#1#1tabu X#1#1#1#1#1#1tabu Width#1#1#1#1#1Target%
- #1#1#1#1#1#1#1#1#1Coefs#1#1#1#1#1#1#1Update^^J\fi
- (tabu) \ifnum\tabu@cnt<10 #1\fi\the\tabu@cnt)#1#1}%
+ \def\tabu@header{(tabu) \ifnum\tabu@cnt<10 #1\fi\the\tabu@cnt) #1}%
+ \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#1#1Spread#1#1#1tabu Width#1#1#1#1#1Min Nat.#1#1#1#1Nat.X%
- #1#1#1#1#1#1#1#1#1New Target^^J%
+ (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\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}%
+ \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}%
}\do{ }
-\def\tabu@spread@startpbox#1{\bgroup
- \in@{\tabucolX}{#1}%
+\def\tabu@measure@startpbox#1{\bgroup
+ \let\@startpbox \tabu@startpboxORI % in case of nesting
+ \in@{\tabu@dimexpr}{#1}%
\ifin@
- \hbox to\tabu@target\bgroup\aftergroup\tabu@spread@endhbox
- \tabu@spread@startpbox@setup \hfil
- \else
- \expandafter\@gobble\tabu@startpboxORI{#1}% \@gobble \bgroup
- \fi
-}% \tabu@spread@startpbox
-\def\tabu@spread@startpbox@setup{%
- \let\tabu@vskipORI\vskip \let\tabu@adl@draw\adl@draw
- \def\adl@draw{\let\vskip\tabu@vskipORI\tabu@adl@draw}%
- \let\vss\relax\let\vfil\vss\let\vfill\vss\let\vskip\@tempskipa
-}% \tabu@spread@startpbox@setup
-\def\tabu@spread@endhbox{%
- \ifnum\badness>\@M %<text does not fit>
- \global\tabu@naturalX \tabu@target
- \else
- \setbox\tabu@box\lastbox
- \setbox\tabu@box\hbox{\unhbox\tabu@box}%
\global\advance\tabu@X@cols \@ne
- \ifcsname tabu@X\the\tabu@X@cols\endcsname
- \global\advance\tabu@naturalX \wd\tabu@box
- \else
+ \ifcsname tabu@X\the\tabu@X@cols\endcsname\else
\global\tabu@X@cols \@ne
- \global\tabu@naturalX \wd\tabu@box
- \fi
- \ifdim \tabu@naturalX@max<\tabu@naturalX
- \xdef\tabu@naturalX@max{\the\tabu@naturalX}%
- \fi
- \ifdim \tabu@naturalX@min<\dimexpr \wd\tabu@box * \tabu@X@sum /
- (65536*\csname tabu@X\the\tabu@X@cols\endcsname)\relax
- \xdef\tabu@naturalX@min{\the\dimexpr \wd\tabu@box * \tabu@X@sum /
- (65536*\csname tabu@X\the\tabu@X@cols\endcsname)\relax}%
+ \global\tabu@naturalX \z@
\fi
\fi
- \box\tabu@box
- \egroup % end of \vtop (measure)
-}% \tabu@spread@endhbox
-\newcommand*\tabuvline@rewrite[1][]{\tabuvline@arg{#1}%
- \expandafter \NC@find \tabu@temp}
-\def\tabu@vline#1{\vrule width#1}
-
-\def\tabuvline@arg#1{%
- \ifx\\#1\\% <shortcut when no option>
- \edef\tabu@temp{!{%
- \iftabu@colortbl\begingroup\noexpand\CT@arc@\fi
- \noexpand\tabu@vline\arrayrulewidth
- \iftabu@colortbl\endgroup\fi}}%
- \else \futurelet \tabu@temp \tabuvline@argi #1\p@\p@\@nnil \tabuvline@argiii
- \fi
-}% \tabuvline@arg
-\def\tabuvline@argi{%
- \let\tabu@color \@empty
- \ifcat A\noexpand\tabu@temp
- \@tempdima\arrayrulewidth
- \expandafter\tabu@getlinecolor
- \else \expandafter\tabuvline@argii
+ \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
+ \begin{varwidth}{\tabu@temp}\narrowragged\arraybackslash
+ \tabu@noadjustspacing \parfillskip\@flushglue
+ \bgroup \aftergroup\tabu@measure@endpbox
+ \else
+ \expandafter\@gobble\@startpbox{#1}% \@gobble \bgroup
\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
-{
-\expandafter\let\csname NC@find@|\endcsname\relax
-\expandafter\let\csname NC@rewrite@|\endcsname\relax
-\xdef\tabu@lines{%
- \let\csname NC@find@|\endcsname \noexpand\tabuvlines@find
- \let\csname NC@rewrite@|\endcsname \noexpand\tabuvline@rewrite
-}% \tabu@vline
-}
-\def\tabuvlines@find#1|{\NC@{#1}}
+}% \tabu@measure@startpbox
+\ifdefined\pdfadjustspacing
+ \def\tabu@noadjustspacing{\pdfadjustspacing\z@}%
+\else
+ \let\tabu@noadjustspacing\relax
+\fi
+\def\tabu@measure@endpbox{%
+ \@finalstrut\@arstrutbox\end{varwidth}\egroup % <got my \tabu@box>
+ \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
\let\tabu@first@cline \z@
@@ -708,7 +804,7 @@
\global\minrowclearance \z@
\fi
\global\let\vcenter \vbox
- \iftabu@nested\vspace*{\dimexpr\extrarowheight-\ht\@arstrutbox}\fi
+ \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@&}}%
@@ -721,17 +817,55 @@
\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}
+
+\def\tabuvline@arg#1{%
+ \ifx\\#1\\% <shortcut when no option>
+ \edef\tabu@temp{!{%
+ \iftabu@colortbl\begingroup\noexpand\CT@arc@\fi
+ \noexpand\tabu@vline\arrayrulewidth
+ \iftabu@colortbl\endgroup\fi}}%
+ \else \futurelet \tabu@temp \tabuvline@argi #1\p@\p@\@nnil \tabuvline@argiii
+ \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}% <default value>
\def\tabu@dashgap{4pt}% <default value>
-\def\tabucline{\noalign{\ifnum0=`}\fi\@ifstar
+\def\tabucline{\noalign{\ifnum0=`}\fi \@ifstar
{\@tempswatrue\tabu@cline}
{\@tempswafalse\tabu@cline}}%
-\newcommand*\tabu@cline[2][]{%
+\newcommand*\tabu@cline[2][]{\toks@{}%
\tabu@startstop{#2}\tabu@getlinespec{#1}\@multicnt\@ne
- \ifnum\tabu@start>\tabu@stop \the\toks@
- \else\ifx\tabu@xleaders\relax\the\toks@
+ \ifnum\tabu@start>\tabu@stop
+ \else\ifx\tabu@xleaders\relax
\else
- \toks@{\ifnum0=`{\fi}\noalign{\global\let\@arstrutbox \voidb@x}}%
+ \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@ &}}%
@@ -741,11 +875,11 @@
\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@ \color@begingroup}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\the
- \expandafter\toks@ \tabu@xleaders \color@endgroup}%
+ \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 %
+ \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
@@ -755,13 +889,14 @@
\repeat
\@whilenum\@multicnt<\tabu@nbcols\do{\advance\@multicnt\@ne
\toks@\expandafter{\the\toks@ &}}%
- \toks@\expandafter{\the\toks@ \cr \noalign{%
- \global\let\@arstrutbox \tabu@arstrutbox}}%
-%% \message{LIGNE AJOUTEE:\the\toks@}%
- \the\toks@
+ \toks@\expandafter{\the\toks@ \cr
+ \noalign{\global\let\@arstrutbox \tabu@arstrutbox}}%
+%% \tabu@debug{LIGNE AJOUTEE:\the\toks@}%
\fi\fi
-}% \tabucline
-\def\tabu@add #1\@nil{\toks@\expandafter{\the\toks@ #1\ifmmode$\fi}}
+ \ifnum0=`{\fi\expandafter}\the\toks@
+}% \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@start@stop #1-#2\@nnil{%
\@defaultunits \tabu@start \number0#1\relax\@nnil
@@ -782,7 +917,8 @@
\else \tabu@getline{#1\p@ on0pt off0pt}\fi\fi\fi\fi\fi
}% \tabu@getlinespec
\def\tabu@defleaders#1{%
- \def\tabu@xleaders{\xleaders\hbox{\lower.5\extrarowheight#1}\tabu@leaderfill}}
+ \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}%
@@ -803,13 +939,16 @@
\tabu@lineoff #1 on#2 off\tabu@dashgap \p@ \@nnil
\else
\tabu@maybecolor \@tempdima \arrayrulewidth #1\p@\@nnil
- \ifx\tabu@color\@empty \tabucline@warn{#4}\else
+ \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@
@@ -862,8 +1001,9 @@
\endgroup
}% \tabu@linestyle
\expandafter\def \csname tabu@line@style@\endcsname {%
- \let\tabu@xleaders \tabu@defaultleaders}%
-\def\tabu@defaultleaders{\leaders
+ \let\tabu@xleaders \tabu@defaultleaders}%
+\def\tabu@defaultleaders{\iftabu@colortbl\CT@arc@\fi
+ \leaders
\iftabu@firstcline
\vrule depth \arrayrulewidth
\else
@@ -873,9 +1013,11 @@
\tabu@leaderfill}
\let\tabu@leaderfill \hfil
{\catcode32=13\relax\catcode`\^^@=13\relax
-\gdef\tabu@verb{\@sanitize\makeatletter\catcode`\^=7\edef\^{\string^}%
-\catcode32=13\let =\ \catcode`\^^@=13\def^^@{\linebreak}\endlinechar\m@ne}%
-}
+\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\}%
@@ -884,7 +1026,7 @@
\def\tabu@decimal{#1}\@temptokena{}%
\let\tabu@getdecimal@ \tabu@getdecimal@ignorespaces
\tabu@scandecimal
-}% \tabudecimal
+}% \tabu@tabudecimal
\def\tabu@scandecimal{\futurelet \tabu@temp \tabu@getdecimal@}
\def\tabu@skipdecimal#1{#1\tabu@scandecimal}
\def\tabu@getdecimal@ignorespaces{%
@@ -903,6 +1045,7 @@
\def\tabu@get@decimalspace#1{%
\@temptokena\expandafter{\the\@temptokena #1}\tabu@scandecimal}%
}\do{ }
+\let\tabu@@tabudecimal \tabu@tabudecimal
\def\tabu@getdecimal{%
\ifcase 0\ifx 0\tabu@temp\else
\ifx 1\tabu@temp\else
@@ -939,23 +1082,73 @@
}% \tabu@printdecimal
\newcommand*\savetabu[1]{\noalign{%
\ifx\\#1\\\tabu@savewarn{}{The tabu will not be saved}\else
- \@ifundefined{tabu@save@\string#1}{}{\tabu@savewarn{#1}{Overwritting}}%
- {\toks@\expandafter{\tabu@saved}%
- \expandafter\xdef\csname tabu@saved@\string#1\endcsname{%
- \tabu@target\the\tabu@target\relax
- \the\toks@}}%
- \fi}%
-}% \savetabu
-\def\tabu@saveX#1{\noalign{%
- \ifx\\#1\\\tabu@savewarn{}{The tabu will not be saved}\else
\@ifundefined{tabu@saved@\string#1}{}{\tabu@savewarn{#1}{Overwritting}}%
- {\toks@\expandafter{\tabu@saved}%
- \expandafter\xdef\csname tabu@saved@\string#1\endcsname{%
- \tabucolX\the\tabucolX\relax
- \tabu@target\the\tabu@target\relax
- \the\toks@}}%
+ {%
+ \toks0\expandafter{\@preamble}%
+ \toks1\expandafter{\tabu@savedparam}%
+ \toks2\expandafter{\tabu@savedpream}%
+ \iftabu@colortbl
+ \toks3\expandafter{\expandafter\gdef\expandafter\CT@arc@
+ \expandafter{\CT@arc@}}%
+ \toks3\expandafter{\the\toks\expandafter3
+ \expandafter\gdef\expandafter\CT@drsc@\expandafter{\CT@drsc@}}%
+ \else \toks3{}%
+ \fi
+ \iftabu@negcoef
+ \edef\tabu@savewd{\tabu@savewd{\number\numexpr1}}%
+ \toks3\expandafter{\the\toks\expandafter3\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{\@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@saveX
+}% \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
+ \advance \@tempdima by\extrarowheight
+ \setbox \@arstrutbox \hbox{\vrule
+ \@height \arraystretch \@tempdima
+ \@depth \arraystretch \dp \strutbox
+ \@width \z@}%
+}% \tabu@make@arstrutbox
\def\tabu@savewarn#1#2{\PackageInfo{tabu}
{User-name `#1' already used for \string\savetabu
\MessageBreak #2}}%
@@ -965,15 +1158,17 @@
\def\tabu@rowfont{\noalign{\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
- \gdef\tabu@cellfont{#2}%
+ \global\let\tabu@@cellleft \tabu@cellleft
+ \global\let\tabu@@cellright \tabu@cellright
+ \gdef\tabu@cellfont{\let\color \tabu@colorleavevmode#2\let\color \tabu@colorORI}%
\ifcsname tabu@cell@#1\endcsname % row alignment
\csname tabu@cell@#1\endcsname \fi
\toks@\expandafter {\tabu@cellleft\tabu@cellfont}% inside \noalign group ok
\xdef\tabu@cellleft {\the\toks@}%
\ifnum0=`{\fi}% end of noalign group
}% \rowfont
+\def\tabu@colorleavevmode{\leavevmode\tabu@colorORI}
+\AtBeginDocument{\let\tabu@colorORI \color}
\def\tabu@rowfont@reset{%
\noalign{%
\global\let\tabu@rowfontreset \@empty
@@ -986,7 +1181,7 @@
}% \tabu@rowfont@reset
\let\tabu@rowfontreset\@empty
\newif\iftabu@cellright
-\AtBeginDocument{\let\array@prepnext@tok \prepnext@tok }% original definition
+\AtBeginDocument{\let\tabu@prepnext@tokORI \prepnext@tok }% original definition
\def\tabu@prepnext@tok{%
\ifnum \count@<\z@ % <first initialisation>
\@tempcnta \@M % <not initialized by array.sty>
@@ -1004,9 +1199,7 @@
\tabu@cellrightfalse % <only once>
\tabu@savetok R\tabu@preptokenright
\fi
- \ifnum \tabu@nbcols=\@ne
- \tabu@savetok L% LEFT token is always empty unless >{...}
- \fi
+ \ifnum \tabu@nbcols=\@ne \tabu@savetok L\fi
\tabu@preptokenleft
\or % (case 1) previous token is right
\tabu@savetok R\tabu@cellrighttrue
@@ -1022,7 +1215,7 @@
\fi
\fi % \ifcase
\fi
- \array@prepnext@tok
+ \tabu@prepnext@tokORI
}% \tabu@prepnext@tok
\def\tabu@preptokenright{%
\advance \count@ \m@ne
@@ -1036,16 +1229,17 @@
\expandafter\tabu@savet@k\csname tabu@tok@\the\tabu@nbcols #1\endcsname
}% \tabu@savetok
\def\tabu@savet@k#1{%
- \@temptokena\toks\count@
- \ifx#1\relax\else \@temptokena\expandafter\expandafter
- \expandafter{\expandafter#1\the\@temptokena}%
- \fi
- \@temptokena\expandafter{\expandafter\def\expandafter#1\expandafter{%
- \the\@temptokena}}%
- \toks@\expandafter\expandafter\expandafter{\expandafter\tabu@global@temp
- \the\@temptokena}%
- \xdef\tabu@global@temp{\the\toks@}%
- \expandafter\endgroup \the\@temptokena
+ \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
\let\tabu@cellleft\@empty
\let\tabu@cellright\@empty
@@ -1239,9 +1433,15 @@
}% \tabu@adl@xarraydashrule
\def\tabu@adl@act@endpbox{%
\unskip \ifhmode \nobreak \fi \@finalstrut \@arstrutbox
- \egroup
+ \egroup \egroup
\adl@colhtdp \box\adl@box \hfil
}% \tabu@adl@act@endpbox
+\def\tabu@adl@fix{%
+ \let\adl@xarraydashrule \tabu@adl@xarraydashrule % <fix> arydshln
+ \let\adl@act@endpbox \tabu@adl@act@endpbox % <fix> arydshln
+ \let\adl@act@@endpbox \tabu@adl@act@endpbox % <fix> arydshln
+ \let\@preamerror \@preamerr % <fix> arydshln
+}% \tabu@adl@fix
\endinput
%%
%% End of file `tabu.sty'.