summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/tabu/README4
-rw-r--r--Master/texmf-dist/doc/latex/tabu/tabu.pdfbin1371258 -> 1572415 bytes
-rw-r--r--Master/texmf-dist/source/latex/tabu/tabu.drv22
-rw-r--r--Master/texmf-dist/source/latex/tabu/tabu.dtx2124
-rw-r--r--Master/texmf-dist/source/latex/tabu/tabu.ins8
-rw-r--r--Master/texmf-dist/tex/latex/tabu/tabu.sty1154
6 files changed, 2065 insertions, 1247 deletions
diff --git a/Master/texmf-dist/doc/latex/tabu/README b/Master/texmf-dist/doc/latex/tabu/README
index e3a81270baa..04d554ad065 100644
--- a/Master/texmf-dist/doc/latex/tabu/README
+++ b/Master/texmf-dist/doc/latex/tabu/README
@@ -9,6 +9,10 @@ not split accross pages.
tabu is based on array.sty and requires no other package.
tabu does not modify array.sty nor the classes of tokens.
+Starting from version 1.5, longtabu is provided: based on
+longtable, longtabu allows tabulars to stretch out on
+several pages.
+
tabu can be used in place of tabular, tabular* and tabularx
X columns in tabu can be specified with a width coefficient
the alignement (l,r,c,j) the column type (p,m,b) or even $.
diff --git a/Master/texmf-dist/doc/latex/tabu/tabu.pdf b/Master/texmf-dist/doc/latex/tabu/tabu.pdf
index d0185d0ceee..ff38df7b257 100644
--- a/Master/texmf-dist/doc/latex/tabu/tabu.pdf
+++ b/Master/texmf-dist/doc/latex/tabu/tabu.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/tabu/tabu.drv b/Master/texmf-dist/source/latex/tabu/tabu.drv
index 7ba3a4e3baa..6fe19b118d5 100644
--- a/Master/texmf-dist/source/latex/tabu/tabu.drv
+++ b/Master/texmf-dist/source/latex/tabu/tabu.drv
@@ -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,8 @@
%%
\edef\thisfile{\jobname}
\def\thisinfo{Flexible \LaTeX{} tabulars (\FC)}
-\def\thisdate{2010/11/22}
-\def\thisversion{1.4}
+\def\thisdate{2010/12/07}
+\def\thisversion{1.5}
\def\CTANbaseurl{http://www.ctan.org/tex-archive/macros/latex}
\def\CTANdisplay{CTAN:macros/latex}
\makeatletter\protected\def\CTANhref{\@ifstar\CTANhrefstar\CTANhrefnost}\makeatother
@@ -40,14 +40,17 @@
\AtBeginDocument{\DeleteShortVerb{\|}}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
-\usepackage{etoolbox,geometry,graphicx,xcolor,lastpage,lmodern,bbding,hologo,relsize,moresize,manfnt,xspace,numprint}
+\usepackage{etoolbox,geometry,graphicx,xcolor,lastpage,lmodern,bbding,hologo,relsize,moresize,manfnt,pifont,xspace,numprint,amsmath}
\usepackage[official]{eurosym}
\usepackage[expansion=all,stretch=20,shrink=60]{microtype}
-\usepackage{tocloft,titlesec,hypbmsec,fancyhdr,enumitem,multirow,makecell,booktabs,delarray,ragged2e,colortbl,marginnote,shapepar}
+\usepackage{tocloft,titlesec,hypbmsec,fancyhdr,enumitem,multirow,makecell,booktabs,delarray,ragged2e,colortbl,marginnote,shapepar,needspace}
\heavyrulewidth=.7pt
\usepackage{holtxdoc,bookmark}
-\usepackage{tabularx}
-\usepackage{interfaces}[2010/11/26]
+\usepackage{longtable}
+\usepackage{tabularx}\tracingtabularx
+\usepackage{enumitem-zref}
+\usepackage[verbose]{linegoal}[2010/12/07]
+\usepackage{interfaces}[2010/12/07]
\usetikz{basic,chains,positioning}
\usepackage{embedfile}
\RequirePackage{amsopn,amsmath}% \DeclareMathOperator
@@ -60,14 +63,15 @@
\csname endofdump\endcsname
\CodelineNumbered
\usepackage{fancyvrb}\fvset{gobble=1,listparameters={\topsep=0pt}}
-\usepackage[linegoal]{tabu}\tracingtabu\tracingtabularx
+\usepackage[linegoal]{tabu}\tracingtabu=2
+\tabulinestyle{dash=\hbox{$\mkern2mu\scriptscriptstyle\cdotp\mkern2mu$}}
\lastlinefit999
\geometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=4cm,right=1.5cm}
\hypersetup{%
pdftitle={tabu},
pdfsubject={a simple line parser for TeX},
pdfauthor={Florent CHERVET},
- colorlinks,linkcolor=reflink,
+ colorlinks,linkcolor=reflink,urlcolor=CornflowerBlue,
pdfstartview=FitH,pdfpagemode=UseOutLines,
pdfkeywords={tex, e-tex, latex, package, tabular, array, halign, tabularx, longtable, color, colortbl, alignment},
}
diff --git a/Master/texmf-dist/source/latex/tabu/tabu.dtx b/Master/texmf-dist/source/latex/tabu/tabu.dtx
index 804d8a60e75..8bef61f5657 100644
--- a/Master/texmf-dist/source/latex/tabu/tabu.dtx
+++ b/Master/texmf-dist/source/latex/tabu/tabu.dtx
@@ -1,5 +1,5 @@
% \iffalse meta-comment
-% 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
@@ -36,7 +36,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: 2010/11/22 v1.4 - tabu: Flexible LaTeX tabulars}
+\Msg{* Package: 2010/12/07 v1.5 - tabu: Flexible LaTeX tabulars}
\Msg{************************************************************************}
\keepsilent
@@ -47,7 +47,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
@@ -70,7 +70,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\file{tabu.sty}{\from{tabu.dtx}{package}}%
}
-\askforoverwritefalse
+\askforoverwritetrue
\generate{%
\file{tabu.drv}{\from{tabu.dtx}{driver}}%
}
@@ -98,8 +98,8 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%<*driver>
\edef\thisfile{\jobname}
\def\thisinfo{Flexible \LaTeX{} tabulars (\FC)}
-\def\thisdate{2010/11/22}
-\def\thisversion{1.4}
+\def\thisdate{2010/12/07}
+\def\thisversion{1.5}
\def\CTANbaseurl{http://www.ctan.org/tex-archive/macros/latex}
\def\CTANdisplay{CTAN:macros/latex}
\makeatletter\protected\def\CTANhref{\@ifstar\CTANhrefstar\CTANhrefnost}\makeatother
@@ -113,14 +113,17 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\AtBeginDocument{\DeleteShortVerb{\|}}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
-\usepackage{etoolbox,geometry,graphicx,xcolor,lastpage,lmodern,bbding,hologo,relsize,moresize,manfnt,xspace,numprint}
+\usepackage{etoolbox,geometry,graphicx,xcolor,lastpage,lmodern,bbding,hologo,relsize,moresize,manfnt,pifont,xspace,numprint,amsmath}
\usepackage[official]{eurosym}
\usepackage[expansion=all,stretch=20,shrink=60]{microtype}
-\usepackage{tocloft,titlesec,hypbmsec,fancyhdr,enumitem,multirow,makecell,booktabs,delarray,ragged2e,colortbl,marginnote,shapepar}
+\usepackage{tocloft,titlesec,hypbmsec,fancyhdr,enumitem,multirow,makecell,booktabs,delarray,ragged2e,colortbl,marginnote,shapepar,needspace}
\heavyrulewidth=.7pt
\usepackage{holtxdoc,bookmark}
-\usepackage{tabularx}
-\usepackage{interfaces}[2010/11/26]
+\usepackage{longtable}
+\usepackage{tabularx}\tracingtabularx
+\usepackage{enumitem-zref}
+\usepackage[verbose]{linegoal}[2010/12/07]
+\usepackage{interfaces}[2010/12/07]
\usetikz{basic,chains,positioning}
\usepackage{embedfile}
\RequirePackage{amsopn,amsmath}% \DeclareMathOperator
@@ -133,14 +136,15 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\csname endofdump\endcsname
\CodelineNumbered
\usepackage{fancyvrb}\fvset{gobble=1,listparameters={\topsep=0pt}}
-\usepackage[linegoal]{tabu}\tracingtabu\tracingtabularx
+\usepackage[linegoal]{tabu}\tracingtabu=2
+\tabulinestyle{dash=\hbox{$\mkern2mu\scriptscriptstyle\cdotp\mkern2mu$}}
\lastlinefit999
\geometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=4cm,right=1.5cm}
\hypersetup{%
pdftitle={tabu},
pdfsubject={a simple line parser for TeX},
pdfauthor={Florent CHERVET},
- colorlinks,linkcolor=reflink,
+ colorlinks,linkcolor=reflink,urlcolor=CornflowerBlue,
pdfstartview=FitH,pdfpagemode=UseOutLines,
pdfkeywords={tex, e-tex, latex, package, tabular, array, halign, tabularx, longtable, color, colortbl, alignment},
}
@@ -151,7 +155,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%</driver>
% \fi
%
-% \CheckSum{3666}
+% \CheckSum{4463}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -170,7 +174,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% Right brace \} Tilde \~}
%
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs,\~,\@ifpackagelater,\z@,\@ne,\@@}
-% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
+% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo,\TMP@EnsureCode}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\filename,\fileversion,\filedate,\let}
@@ -193,13 +197,11 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \DoNotIndex{\p@,\tracingtabu,\@ne,\tw@,\m@ne,\z@skip}
% \makeatletter
% \newrobustcmd\ClearPage{\@ifstar\clearpage{}}
+% \providecommand\lsstyle{}
% \makeatletter
% \catcode`\§ \active \def§{\@ifnextchar §{\par\nobreak\vskip-2\parskip}{\par\nobreak\vskip-\parskip}}
-% \def\thispackage{\xpackage{{\pkgcolor\thisfile}}\xspace}
-% \def\ThisPackage{\Xpackage{\thisfile}\xspace}
-% \def\Xpackage{\@dblarg\X@package}
-% \def\X@package[#1]#2{\@testopt{\X@@package{#1}{#2}}{}}
-% \def\X@@package#1#2[#3]{\xpackage{#2\footnote{\noindent\xpackage{#2}: \CTANhref{#1}#3}}}
+% \def\thispackage{\xpackage{{\pkgcolor\thisfile}}\Xspace}
+% \def\Xpackage#1{\href{http://www.ctan.org/tex-archive/help/Catalogue/entries/#1.html}{\xpackage{#1}}}
% \def\Underbrace#1_#2{$\underbrace{\vtop to2ex{}\hbox{#1}}_{\footnotesize\hbox{#2}}$}
%\def\FV@DefineCommandChars #1#2#3{%
% \edef\FV@restoreCommandChars{%
@@ -220,6 +222,19 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \DefineVerbatimEnvironment{VerbLines*}{Verbatim}{frame=lines,framesep=6pt,fontfamily=\ttdefault,fontseries=m,commandchars=$()}
% \DefineVerbatimEnvironment{Verb}{Verbatim}{fontfamily=\ttdefault,fontseries=m}
% \DefineVerbatimEnvironment{Verb*}{Verbatim}{fontfamily=\ttdefault,fontseries=m,commandchars=$()}
+% \renewrobustcmd*\mathversion[1]{^^A
+% \expandafter\ifx\csname mv@#1\endcsname\relax
+% \@latex@error{Math version `#1' is not defined}\@eha
+% \else \edef\math@version{#1}\gdef\glb@currsize{}\aftergroup\glb@settings
+% \ifmmode \check@mathfonts \fi
+% \fi
+% }
+% \newrobustcmd*\OR{{\,\upshape\texttbf\textbar\,}}
+% \newrobustcmd*\CheckOK{{\scriptsize\textcolor{ForestGreen}\CheckmarkBold}}
+% \newrobustcmd*\CheckFAIL{{\scriptsize\textcolor{Crimson}\XSolidBrush}}
+% \newcommand\tikzlabel[2][]{\tikz[{remember picture,#1}]\coordinate ({#2});\ignorespaces}
+% \newlist{itempunct}{itemize}{1}
+% \setlist[itempunct]{nolistsep,font=\smaller,leftmargin=1.7em,label=\textbullet}
% \def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}}
% \def\ttdefault{lmvtt}
% \renewrobustcmd\#[1]{{\usefont{T1}{pcr}{bx}{n}\char`\##1}}
@@ -259,25 +274,28 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% }
% \renewrobustcmd\declcs[2][]{^^A
% \par\addvspace\parskip
-% \goodbreak
-% \noindent\larger\changefont{spread=1}^^A
+% \needspace{\bottomtitlespace}%
+% \noindent\changefont{size+=2.5pt,spread=1,fam=\ttdefault}^^A
% \hspace{-\leftmargini}^^A
% \def\*{\unskip\,\texttt{*}}^^A
-% \begin{tabular}{|l|}^^A
+% \begin{tabu}{|l|}^^A
% \hline
% \expandafter\SpecialUsageIndex\csname #2\endcsname
-% \raisedhyperdef[8pt]{declcs}{#2}{\cs[{#1}]{#2}}^^A
+% \raisedhyperdef[14pt]{declcs}{#2}{\cs[{#1}]{#2}}^^A
% }^^A
% \renewcommand\enddeclcs{%
% \crcr \hline
-% \end{tabular}%
+% \end{tabu}%
% \nobreak \par \nobreak
% \noindent
% \ignorespacesafterend
% }
-% \def\declmargin{\hspace*{\dimexpr-\leftmargini+\arrayrulewidth+\tabcolsep}}
+% \newrobustcmd*\csref[2][]{\hyperref{}{declcs}{#2}{\cs[{#1}]{#2}}}
+% \def\declmargin{\hspace*{\declmarginwidth}}
+% \def\declmarginwidth{\dimexpr-\leftmargini+\arrayrulewidth+\tabcolsep}
% \pretocmd\textasteriskcentered{\usefont{OMS}{cmsy}mn}{}{}
-% \bookmarksetup{open=true,openlevel=3}
+% \newrobustcmd*\abs[1]{\left\lvert#1\right\rvert}
+% \bookmarksetup{open=true,openlevel=2}
% \pagesetup{%
% head/rule/width=.0pt,
% left/offset=3cm,foot/left/offset+=.5cm,right/offset=1cm,
@@ -296,9 +314,10 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\copyright\,\thisyear\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC\quad \xemail{florent.chervet at free.fr}}}}},
% }
% \pagestyle{fancy}
+% \bottomtitles=.15\textheight
% \sectionformat\section{
% mark=\marksthe{section}{#1},
-% left=\dimexpr-\leftmargini+\arrayrulewidth+\tabcolsep\relax,
+% left=\declmarginwidth,
% top=\medskipamount,
% bottom=\smallskipamount,
% font=\normalfont\Large\bfseries,
@@ -307,6 +326,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \sectionformat\subsection{%
% top=\medskipamount,
% bottom=.5\smallskipamount,
+% left=.5\declmarginwidth,
% bookmark={color=[rgb]{0.02,0.05,.1}},
% font=\normalfont\Large\bfseries,
% break=\addpenalty{-\@highpenalty}}
@@ -317,76 +337,81 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% top=\medskipamount,
% bottom=.5\smallskipamount,
% break=\addpenalty{-\@medpenalty}}
-% \setitemize{itemsep=\parskip,topsep=0pt,labelsep=1em,parsep=0pt}
+% \setitemize{itemsep=\parskip,topsep=0pt,labelsep=1em,parsep=0pt,beginpenalty=10000}
% \tikzset{every picture/.add style={}{/utils/exec=\changefont{spread=1}}}
% \newrobustcmd*\IMPLEMENTATION{%
-% \newgeometry{top=0.8cm,headheight=.5cm,headsep=.3cm,bottom=1.2cm,footskip=.5cm,left=5cm,right=.50cm}
+% \newgeometry{top=0.8cm,headheight=.5cm,headsep=.3cm,bottom=1.2cm,footskip=.5cm,left=5cm,right=.5cm}
% \pagesetup*{
% left/offset+=1cm,right/offset-=1cm,
% head/left=\moveleft1cm\vbox to\z@{\vss\setbox0=\null\ht0=\z@\wd0=\paperwidth\dp0=\headheight\rlap{\colorbox{GhostWhite}{\box0}}}\vskip-\headheight t\,a\,b\,u\,\ \ i\,m\,p\,l\,e\,m\,e\,n\,t\,a\,t\,i\,o\,n,
% }%
% \clearpage
% \sectionformat\section{bookmark/color=black}\sectionformat\subsection{bookmark/color=black}
-% \bookmarksetup{bold*,openlevel=3}
+% \bookmarksetup{bold*,openlevel=3} \hfuzz=3mm
% \section(Implementation)[\mdseries\scshape\pmb{Implementation}]{Implementation} \label{sec:implementation}}
% \let\plainllap\llap
% \newrobustcmd\macro@llap[1]{\global\let\llap\plainllap\setbox0\hbox{#1}^^A
-% \ifdim\wd0>4cm\hbox to\z@{\hss\hbox to4cm{#1\hss}}^^A
-% \edef\@tempa{\the\everypar\hskip\dimexpr\the\wd0-4cm\relax\global\everypar{}}%
+% \ifdim\wd0>4.4cm\hbox to\z@{\hss\hbox to4.4cm{#1\hss}}^^A
+% \edef\@tempa{\the\everypar\hskip\dimexpr\the\wd0-4.4cm\relax\global\everypar{}}%
% \global\everypar\expandafter{\@tempa}^^A
% \else\hbox to\z@{\hss#1}\fi
% \setbox\z@\box\voidb@x}
-% \pretocmd\macro{\MacrocodeTopsep=\z@skip\MacroTopsep\z@skip\let\llap\macro@llap\parsep=\z@\topsep=\z@\itemsep=\z@\partopsep\z@}{}{}
+% \pretocmd\macro{\needspace{2\baselineskip}\MacrocodeTopsep=\z@skip\MacroTopsep\z@skip\let\llap\macro@llap\parsep=\z@\topsep=\z@\itemsep=\z@\partopsep\z@}{}{}
% \apptocmd\endmacro{\goodbreak\vskip.3\parskip}{}{}
%
-% \definecolor{reflink}{rgb}{0.95,0.00,0.05}
-% \definecolor{reflink}{rgb}{0.05,0.00,0.95}
+% \colorlet{reflink}{DarkSlateBlue}
% \newrobustcmd*\stform{\ifincsname\else\expandafter\@stform\fi}
% \newrobustcmd*\@stform{\@ifnextchar*{\@@stform[]\textasteriskcentered\@gobble}\@@stform}
-% \newrobustcmd*\@@stform[2][\string]{\textttbf{#1#2}\ifnum\catcode`\ =\active\else\expandafter\xspace\fi}
+% \newrobustcmd*\@@stform[2][\string]{\textttbf{#1#2}\Xspace}
+% \newrobustcmd\Xspace{\ifnum\catcode`\ =\active\else\expandafter\xspace\fi}
+%
%
% \makeatother
%
%
% \deffootnote{1em}{0pt}{\rlap{\textsuperscript{\thefootnotemark}}\kern1em}
%
-% \title{\vspace*{-28pt}\mdseries {\HUGE\bfseries\sffamily t\,a\,b\,u\,}}
+% \title{\vspace*{-28pt}\mdseries {\HUGE\bfseries\sffamily t\,a\,b\,u\,}\vspace*{6pt}}
% \date{}
% \author{\small\thisdate~--~version \thisversion}
-% \subtitle{\LARGE Flexible \LaTeX{} tabulars\endgraf {\small\FC}}
+% \subtitle{\begin{tabu}{X[c]} tabu\, and\, longtabu \\[1ex] \LARGE Flexible \LaTeX{} tabulars\\ \small\FC \end{tabu}\vspace*{-12pt}}
% \maketitle
%
-%
-%
-% \makeatletter\begingroup\let\@thefnmark\@empty\let\@makefntext\@firstofone
+% {\makeatletter\let\@thefnmark\@empty\let\@makefntext\@firstofone
% \footnotetext{\noindent\parskip=0pt\scriptsize
-% This documentation is produced with the +DocStrip+ utility. Package \xpackage{tabu} is used with the \textt{linegoal} option.\topsep=0pt
-% \begin{tabbing}
-% \qquad\=\smex\=To get the documentation, \= run (thrice):\quad\= \texttt{pdflatex \thisfile.dtx} \\
-% \qquad\>\>To get the index, \> run:\>\texttt{makeindex -s gind.ist \thisfile.idx} \\
-% \>\smex\>To get the package, \> run:\> \texttt{etex \thisfile.dtx}
-% \end{tabbing}§
-% The \xext{dtx} file is embedded into this pdf file thank to \xpackage{embedfile} by H. Oberdiek.}
-% \endgroup\makeatother
+% This documentation is produced with the \textt{DocStrip} utility, and required \thispackage with its \textt{linegoal} option.\par
+% \begin{tabu}{X[-3]X[-1]X}
+% \smex To get the package, &run: &\texttt{etex \thisfile.dtx} \\
+% \smex To get the documentation &run (thrice): &\textt{pdflatex \thisfile.dtx} \\
+% \leavevmode\hphantom\smex To get the index, &run: &\texttt{makeindex -s gind.ist \thisfile.idx}
+% \end{tabu}§
+% The \xext{dtx} file is embedded into this pdf file thank to \Xpackage{embedfile} by H. Oberdiek.}
+% }
%
% \deffootnote{1em}{0pt}{\rlap{\thefootnotemark.}\kern1em}
%
-% {\let\quotation\relax\vspace*{-1cm}%
-% \begin{abstract}\parskip\medskipamount\parindent0pt\lastlinefit0\leftskip1cm\rightskip\leftskip
+% {\let\quotation\relax\let\endquotation\relax\vspace*{-1cm}%
+% \begin{abstract}\parskip\smallskipamount\parindent0pt\lastlinefit0\leftskip.7cm\rightskip\leftskip
%
% This package defines a single environment \textt{tabu} to make all kinds of tabulars in text or in math mode
% provided that they do not split across pages.
%
-% \textt{tabu} is more flexible that \textt{tabular}, \textt{tabular*}, \textt{tabularx}
-% and \textt{array} and extends the possibilities. All tabulars in this document were made
-% with the \textt{tabu} environment. Last (but not least) \textt{tabu} is more than compatible
-% with any package that provides commands to format tabulars.
-% Indeed, \thispackage{} \textbf{does not modify any of the macros of \xfile{array.sty}.} All
-% functionalities are obtained with only two modifications\footnote{\cs{prepnext@tok} and \cs{save@decl}.
-% See ``\nameref{sec:light package option}''.} which are loaded only inside
-% a \textt{tabu} environment.
+% Starting from version 1.5, the environment \textt{longtabu} is provided to make tabulars that can stretch out
+% on several pages. \textt{longtabu} works like \textt{tabu} and is defined only if the package
+% \Xpackage{longtable} is loaded.
%
-% \xpackage{tabu} requires \eTeX, the standard package \xfile{array.sty} and no other package.
+% \textt{tabu} is more flexible that \textt{tabular}, \textt{tabular*}, \textt{tabularx}
+% and \textt{array} and extends the possibilities. All tabulars in this document were made
+% with the \textt{tabu} environment. Widths computations for \textt{tabu X} columns is
+% \refitem{item:convergence optimisation}[optimised] compared to \Xpackage{tabularx} implementation.
+% Last (but not least) \textt{tabu} is fully compatible with any package that provides commands
+% to format tabulars. Indeed, \textt{tabu} does not modify any of the macros of \xfile{array.sty}.
+%
+% \thispackage requires \eTeX{} and the standard package \xfile{array.sty}. Natural widths of columns
+% are computed by (but not printed by) the code of \Xpackage{varwidth} by D. Arseneau (for the cases of
+% \hyperref[X columns with tabu spread]{\textt X columns in \textt{tabu spread}} and
+% \refitem{tabu X columns,2}[negativ width coefficients]\footnote{The documentation is compiled with
+% \hyperref[enumitem-zref]{\xpackage{enumitem-zref}}}). Finally \textt{longtabu} is based on \textt{longtable}.
%
% \end{abstract}}
%
@@ -415,39 +440,128 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% }
%
% \clearpage
+% \begingroup
+% ^^A\geometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=4cm,right=1.5cm}
+% \newgeometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=1.5cm,right=1cm}
+% \pagesetup*{left/offset-=2.5cm,right/offset-=.5cm}
+%
% \changefont{spread*=1.1}
+% \phantomsection\label{Summary}
+% \addcontentsline{toc}{section}{Summary of the features provided by \textt{tabu}}
+% \def\arraystretch{1.1}\enlargethispage\baselineskip\vspace*{-6mm}
+% \begin{tabu}{>{\ttfamily\bfseries}X[-1]X} \toprule
+% \rowfont{\larger\bfseries\lsstyle}
+% \multicolumn2c{Summary of the features provided by \xpackage{tabu}} \\ \tabucline[dash]-
+% \hyperref[sec.tabu]{tabu} &
+% is like \textt{tabular} in text mode and like \textt{array} in math mode when there is no
+% \textt X column in its preamble
+% \\
+% \hyperref[sec.longtabu]{longtabu} &
+% is like \textt{longtable} with the possibility to use \textt{tabu X} columns and vertical lines
+% with the extended syntax.
+% \\
+% \hyperref[Vertical lines]{\texttbf\textbar[width,color]} &
+% vertical lines have an optional parameter.
+% \\
+% \M*{tabu} to \meta{dimen} &
+% specifies the target width of the whole tabular. This is like \textt{tabular\textasteriskcentered}\,
+% with an automatic stretchability that can be overwritten with \textt{@\M*{\cs{extracolsep}\M*{dimen}}}
+% in front of the preamble.
+% \\
+% \M*{tabu} spread \meta{dimen} &
+% has no equivalent in \LaTeX: the final width is \meta{dimen} wider than the
+% natural width that can be obtained with \textt{spread 0pt}.
+% \\ \tabucline[dash]-
+% \hyperref[tabu X columns]{X[coef,align,type]} \par X[coef,align,type,\$] &
+% \textt X columns widths are adjusted in order for the whole tabular to fit the
+% target width. The target width is a dimension either:
+% \begin{itempunct}[label=\ding{223}]
+% \item directly specified with \textt{\M*{tabu} to\meta{dimen}}
+% \item computed from the natural width: \textt{\M*{tabu} spread\meta{dimen}}
+% \item by default \cs{linewidth} (or \cs{linegoal} with the \textt{linegoal} package option).
+% \end{itempunct}
+% \textt{coef} scales the widths of the \textt X columns, if there are more than one \textt X column. \par
+% \textt{align} is either \textt r, \textt c, \textt l\, or\, \textt j\, and \textt{type}\, can be \textt p (default), \textt m\, or\, \textt b. \par
+% \textt{X[\$]}\, makes a math \textt X column (\ie \textt{>\M*{\$}X<\M*{\$}})
+% \\
+% \refitem{tabu X columns,2}[{X[$-$coef,align,type]}] &
+% \textt X columns widths are first computed with the absolute value: $\mathversion{bold}\abs{\textt{coef}}$.\par
+% Then the width is made narrower down to the natural width of the column if possible.\par
+% In any case, the final width does not exceed the one obtained with \textt{X$\mathversion{bold}\left[\abs{\textt{coef}}\right]$}. \par
+% The final \textt{tabu} can be narrower than its \textt{target} if:
+% \begin{itempunct}
+% \item all \textt{coefs} are negativ,\, and
+% \item no target has been specified (\ie the default target is used).
+% \end{itempunct}
+% In this case, \textt{tabu} behaves as if it was said:\, \textt{\M*{tabu} spread 0pt}.
+% \\ \tabucline[dash]-
+% \csref{savetabu}\M*{user-name} &
+% Saves the \textt{tabu} preamble and its parameters. \par
+% The command must appear at the end of a line: after \string\\\ or \cs{hline}.
+% \\
+% \csref{usetabu}\M*{user-name} &
+% Makes a \textt{tabu} of exactly the same shape as the one saved with \cs{savetabu}.
+% All parameters (\textt{target}, \textt{preamble}, \textt{stretch} \etc) are restored.\par
+% This command is put alone in the preamble in place of the columns specifications.
+% \\
+% \csref{preamble}\M*{user-name} &
+% Makes a \textt{tabu} with the same preamble as the one saved with \cs{savetabu}.\par
+% The \textt{preamble} only is restored, not the \textt{target} nor any other parameter.\par
+% This command is put alone in the preamble in place of the columns specifications.
+% \\ \tabucline[dash]-
+% \csref{tabuphantomline} & inserts a phantom (\ie invisible) line inside the \textt{tabu}\par
+% May be usefull with \cs{multicolumn} in some cases.
+% \\ \tabucline[dash]-
+% \csref{tabucline}\M*[spec]\M*{start-stop} & Draws a line comparable to \cs{hline}. The line \meta{spec} can contain
+% information for making a dash or dotted line (f.ex. \M*[on 3pt off 6pt]) and a color name.\par
+% The line spec can also be defined with \cs{tabulinestyle}
+% \\
+% \csref{tabulinestyle}\M*{name=spec,...} & Defines a line style for use with \cs{tabucline}
+% \\ \bottomrule
+% \end{tabu}
+%
+% \textbf\textbar\, \textt{X}\, \cs{usetabu}\, and\, \cs{preamble} are defined as new column types loaded
+% only inside the \cs{@mkpream} group inside the \textt{tabu} environment.
+%
+%
+% \clearpage
+% \endgroup
%
-% \bottomtitles=.3\textwidth
+% \setitemize{leftmargin=3em}
% \section{The \textt{tabu} environment}
% \label{sec.tabu}
%
+%
% \subsection(tabu, tabu to, tabu spread){\textt{tabu}, \textt{tabu to} and \textt{tabu spread}}
%
% {\let\red\relax
-% \begin{declcs}{begin}\M*{\red tabu}\M[pos]\M{tabular preamble} \\
-% \cs{begin}\M*{{\red tabu}} to \meta{dimen}\M[pos]\M{tabular preamble} \\
-% \cs{begin}\M*{{\red tabu}} spread \meta{dimen}\M[pos]\M{tabular preamble} \\
+% \begin{declcs}{begin}\M*{tabu} \M*[pos] \M*{tabular preamble} \\
+% \cs{begin}\M*{tabu} to \meta{dimen} \M*[pos] \M*{tabular preamble} \\
+% \cs{begin}\M*{tabu} spread \meta{dimen} \M*[pos] \M*{tabular preamble} \\
% \end{declcs}}
%
% The \textt{tabu} environment behaves exactly like \textt{tabular}: the preamble
-% is parsed by the macros in \xfile{array.sty} with no modification in the characters classes.
+% is parsed by the macros in \xfile{array.sty} with no modification.
% \textt{tabu} improves \textt{tabular} and \textt{array}:
% \begin{itemize}
-% \item footnotes and index words are allowed inside \textt{tabu}, unlike \xpackage{tabularx}, footnote links
+% \item \textbf{footnotes} and index words are allowed inside \textt{tabu}, unlike \xpackage{tabularx}, footnote links
% are not broken when compiled with \xpackage{hyperref}. The syntax \cs{footnote}\M[number]\M{text}
-% is allowed (this is not implemented for \xpackage{longtable} yet...)
-% \item \textt X columns are also allowed, with an \emph{optional} parameter for the width-coefficient,
-% the alignment (\textt{l,r,c} or \textt{L,R,C} for \xpackage{ragged2e} settings) and the column
-% type (\textt{p,m,b}). \textt{tabu} has also a \emph{default target width} when used
-% with \textt X columns.
+% is allowed in \textt{tabu} and \textt{longtabu} (this is not implemented for \xpackage{longtable} yet...)
+% \item \textt X columns are implemented with an \emph{optional} parameter for the \textbf{width-coefficient}
+% (which can be \refitem{item:Negativ width coefficients}[negativ]: see next section),
+% the \textbf{alignment} (\textt r, \textt c, \textt l, or \textt j, and \textt R, \textt C, \textt L or \textt J
+% for \xpackage{ragged2e} settings) and
+% the \textbf{column type} (\textt p, \textt m, or \textt b). \\
+% \textt{tabu} has a \refitem{item:default target width}[default target width] when used with \textt X columns,
+% making nesting even easier.
% \item You are used to the \textt{tabular} environment in text mode, and \textt{array} in math mode,
% but \textt{tabu} works in both modes and its name does not change... \textt X columns are also
% possible in math mode; \xpackage{delarray} shortcuts for delimiters are available in both math and text modes.
-% \item a \textt{tabu} environment can contain another tabular of any kind: \textt{tabular}, \textt{tabular\stform*},
+% \item A \textt{tabu} environment can contain another tabular of any kind: \textt{tabular}, \textt{tabular\stform*},
% \textt{tabularx} or \textt{tabu} itself can be placed in any cell of a \textt{tabu}. Conversely,
% \textt{tabu} can be placed in a \textt{tabular}, \textt{tabularx} \etc.
-% \item \textt{tabu} introduces optional parameters to columns specifications, providing facilities
-% for modifying columns or line widths, inserting verbatim text...
+% \item \textt{tabu} provides facilities for \hyperref[Lines inside tabu]{vertical and horizontal lines},
+% and for the insertion of \hyperref[Verbatim inside tabu]{verbatim text} inside \textt X columns.
% \item \textt{tabu} is more than compatible with \xpackage{arydshln} (for dashed and dotted lines)
% and \xpackage{colortbl}: actually some corrections of those packages are loaded as soon as you
% enter a \textt{tabu} environment. Compatibility with \xpackage{delarray}, \xpackage{hhline},
@@ -462,7 +576,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% \declmargin \cs{begin}\M*{tabu} \textt{to}\meta{dimen} is like \textt{tabular\textasteriskcentered} but the inter-columns space is
% given a stretchability of 1fil, in other words \textt{@\M*{\cs{extracolsep}\M*{0pt plus 1fil}}}
-% is inserted by default at the beginning of the tabular preamble, unless you specify another value for \cs{extracolsep}. Therefore
+% is inserted by default at the beginning of the tabular preamble, unless another value for \cs{extracolsep} is specified. Therefore
% ``\textt{tabu to}'' fills in width the specified \meta{dimen}.
%
% \bigskip
@@ -470,27 +584,72 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \declmargin \cs{begin}\M*{tabu} \textt{spread}\meta{dimen} does a tabular whose width is \meta{dimen} wider than its natural width.
% \textt{@\M*{\cs{extracolsep}\M*{0pt plus 1fil}}} is inserted by default if \meta{dimen}$>0$.
%
+% \subsection{\textt{longtabu}, \textt{longtabu to} and \textt{longtabu spread}}
+% \label{sec.longtabu}
+%
+% \begin{declcs}{begin}\M*{longtabu}\,\M*[l\OR c\OR r]\,\M*{tabular preamble} \\
+% \cs{begin}\M*{longtabu} to \meta{dimen}\,\M*[l\OR c\OR r]\,\M*{tabular preamble} \\
+% \cs{begin}\M*{longtabu} spread \meta{dimen}\, \M*[l\OR c\OR r]\,\M*{tabular preamble}
+% \end{declcs}
+%
+% \textt{longtabu} is just like \textt{tabu} but page breaks are allowed between rows of the table.
+% \textt{longtabu} is based on the \Xpackage{longtable} package which must be loaded, and all features
+% of the \textt{longtable} environment works inside \textt{longtabu}: \cs{endhead}, \cs{endfirsthead},
+% \cs{endfoot}, \cs{endlastfoot} and \cs{caption}.
+%
+% \textt{longtabu} enhances the possibilities of \textt{longtable} with the possibility to use \textt{X columns}
+% and line specification for \hyperref[Vertical lines]{vertical rules}. \textt{longtabu} is thus much easier than
+% \Xpackage{ltxtable}.
+%
+% The following commmands provided for \textt{tabu} does not work with \textt{longtabu}:
+%
+% \let\theadfont\bfseries
+% \begin{longtabu}{X[-1]*2{X[-1c]}X} \toprule
+% \rowfont[c]{\bfseries} \textt{tabu} command &\thead{Not \\available} &\thead{Not \\implemented} &Comment \\\tabucline[dash]-
+% \csref{tabucline} & &\AsteriskRoundedEnds &\cs{tabucline} does not care of page breaks presently: use \cs{hline} instead. \\
+% \csref{usetabu} &\CheckFAIL & &but \csref{savetabu} and \csref{preamble} work. \\
+% \hyperref[sec.math mode]{mathematical mode} &\CheckFAIL & &\textt{longtable} is not designed to work in math mode. \\
+% \xpackage{delarray} shortcuts &\CheckFAIL & &a delimiter cannot be spanned over pages... \\
+% \csref{tabuphantomline} &\CheckFAIL & &useless inside \textt{longtabu} \\
+% \\\bottomrule
+% \end{longtabu}
+%
+% However, \textt{tabu X} columns, \csref{rowfont}, \csref{verbatim} and \csref{tabudecimal} work inside \textt{longtabu}.
+%
%
% \subsection{\textt{tabu X} columns}
+% \label{tabu X columns}
%
-% \textt{tabu X} columns can be viewed as an enhancement of \xpackage{tabularx} \textt X columns:
-% \begin{itemize}
-% \item width coefficients can optionally be given to \textt X columns\\
-% ex.\, \textt{X[2.5]X[1]}\, is the same as\, \textt{X[2.5]X}\, and the same as\, \textt{X[5]X[2]} \\
+% \textt{tabu X} columns can be viewed as an enhancement of \xpackage{tabularx} \textt X columns, but do not interact
+% with them, for they are defined only for a short time during the parsing of the preamble:
+% \begin{itemize}[name=tabu X columns]
+% \item \textbf{width coefficients} can optionally be given to \textt X columns\\
+% ex.\, \texttbf{X[2.5]X[1]}\, is the same as\, \texttbf{X[2.5]X}\, and the same as\, \texttbf{X[5]X[2]} \\
% This means that the first \textt X column will be two and a half wider than the second one or
% that the first \textt X column width will be \sfrac{5}{7} of the whole tabular width. \\[.5\baselineskip]
-% \begin{tabu}{|X[c,2.5]|X[c]|} \firsthline \textt{X[2.5]} & \textt X \\ \hline\end{tabu}
-% \pagebreak
-% \item horizontal alignment specification is made easier with\, \textt{X[5,r]X[2,c]}\, for example. Vertical
+% \begin{tabu}to\linewidth{|X[c,2.5]|X[c]|} \firsthline \textt{X[2.5]} & \textt X \\ \hline\end{tabu}
+% \item \textbf{negativ width coefficients} \label{item:Negativ width coefficients} can be given to \textt X columns: \\
+% ex.\, \texttbf{X[-2.5]X[1]}\, or\, \texttbf{X[-2.5]X} \, or\, \texttbf{X[-5]X[2]} \\
+% In this case, the first \textt X column will be \textitbf{at most} two and a half wider than the second one,
+% and if the \emph{natural width} of the first \textt X column is finally less than
+% $2.5 \times \left(\text{the width of the second column}\right)$ then it will be narrowed down to this natural width.
+% \textbf{The following \textt{tabu}{\smaller s} have the same preamble:} \\
+% \hspace*{1em}\cs{begin}\M*{tabu} to\cs{linewidth}\M*{|X\M*[$-$2.5c]|X\M*[c]|}: \\
+% \begin{tabu} to\linewidth{|X[c,-2.5]|X[c]|} \firsthline \textt{X[$-$2.5]} & \textt X \\ \hline\end{tabu} \\
+% \begin{tabu} to\linewidth{|X[c,-2.5]|X[c]|} \firsthline
+% Negativ coefficients make \textt X columns close to standard\par \textt l, \textt c and \textt r columns.
+% & \textt X \\ \hline
+% \end{tabu}
+% \item horizontal alignment specification is made easier with\, \texttbf{X[5,r]X[2,c]}\, for example. Vertical
% alignment can be specified as well with\, \textt{X[5,r,m]X[2,p,c]}\, (commas are not required,
% but \textt{X[2cm]} or \textt{X[4pc]} could be misunderstood -- not by \TeX{}: by you...).\\
-% \begin{tabu}{X[c]X[4c]c}
+% \begin{tabu}to \linewidth{X[-2c]X[c]c}
% \rowfont{\bfseries\ttfamily} Modifier & Meaning & Default \\
-% \textt l, \textt c, \textt r, \textt j & left, centered, right, justified & \textt j \\
+% \textt l, \textt c, \textt r, \textt j, \textt L, \textt C, \textt R, \textt J & left, centered, right, justified & \textt j \\
% \textt p, \textt m, \textt b & \textt X column is converted into \textt p, \textt m or \textt b column & \textt p \\
% \$ & \textt{X[\$]} is a shortcut for:\, \textt{>\M*{\$}X<\M*{\$}} & \\
% \end{tabu}
-% \item \textt{tabu X} columns can be spanned with \cs{multicolum} without any restriction.
+% \item \textt{tabu X} columns can be spanned with \cs{multicolum}.
% \item \textt{tabu X} columns can be used with ``\textt{tabu spread}'' for small tabulars.
% \item \textt{tabu X} columns can contain any type of \textt{tabular}, \textt{tabular*}, \textt{tabularx} or \textt{tabu}
% without special care about the syntax. \textt{tabu} can also be put inside \textt{tabular}, \textt{tabular*}
@@ -501,24 +660,28 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \item The ``algorithm'' (or the arithmetic) to get the target width for \textt{tabu X} columns is the same as the one
% used by \xpackage{tabularx}. \cs{hfuzz} is the ``tolerance'' for the whole tabular width. We use \eTeX{} \cs{dimexpr}
% instead of \TeX{} primitives (with round/truncate bias correction).
-% \item Convergence to the target width is optimized: the \cs{halign} preamble is not re-built at each trial, but only expanded again,
+% \item \label{item:convergence optimisation} Convergence to the target width is optimised:
+% the \cs{halign} preamble is not re-built at each trial, but only expanded again,
% until the target is reached. Though optimized, the process is the same as the one implemented for \textt{tabularx}
-% and in particular the content of the \textt{tabu} environment is collected as soon as a \textt{tabu X} column is found in the preamble.
-% This implies restrictions on catcode modifications and verbatim text inside a \textt{tabu} with \textt X columns.
-% \item If the width of the whole tabular is not specified with ``\textt{tabu to}'' it is considered to be \cs{linewidth}.
+% and in particular the content of the \textt{tabu} environment is collected as soon as a \textt{tabu X} column
+% is found in the preamble. This implies restrictions on catcode modifications and verbatim text inside
+% a \textt{tabu} with \textt X columns.
+% \item \label{item:default target width} If the width of the whole tabular is not specified with ``\textt{tabu to}''
+% it is considered to be \cs{linewidth}.
% \nameref{subsec:linegoal package option} makes the default width equal to \cs{linegoal}. Compilation must then be done
% with \hologo{pdfTeX} either in \textt{pdf} or \textt{dvi} mode, and package \xpackage{linegoal} is loaded.
-% Remember that \cs{linegoal} uses \xpackage{zref-savepos} and \cs{pdfsavepos}:
+% \cs{linegoal} requires \hologo{pdfTeX} for its \cs{pdfsavepos} primitive and the \xpackage{zref-savepos}:
% if the \textt{tabu} is not alone in its paragraph \ie if the target is not
% \cs{linewidth}, then two compilations (or more) are required to get the correct target. \\
-% Default target for nested \textt{tabu} environments is always \cs{linewidth}, which is the column width inside \textt p,
-% \textt m, \textt b and \textt X columns.
+% Default target for nested \textt{tabu} environments is always \cs{linewidth}, which equals to the column width inside
+% \textt p, \textt m, \textt b and \textt X columns.
% \item As long as the \cs{halign} content is expanded more than once, protections against counters incrementation, whatsits (\emph{write})
% index entries, footnotes \etc. are set up: the mechanism of \xpackage{tabularx} is reimplemented and enhanced for \textt{tabu X} columns.
% \cs{tabuDisableCommands} can be used to neutralize the expansion of additional macros during the trials.
% \end{itemize}
%
% \subsubsection(X columns with tabu spread){X columns with ``\textt{tabu spread}''}
+% \label{X columns with tabu spread}
%
% \textt{tabu X} columns can be used with ``\textt{tabu spread}'' to adjust the column widths of tabulars that contain
% only small pieces of text. The question is: how to make a tabular the width of the line, with 6 columns; the columns 1, 2, 5 and 6
@@ -539,7 +702,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \bigskip
%
% But the text in each cell is very short: one single character, and you prefer the table to be tight,
-% but don't know the exact width of the whole:\pagebreak
+% but don't know the exact width of the whole:
%
% \begin{Verb*}
% \begin{tabu} spread 0pt{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline
@@ -575,7 +738,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \end{Verb*}
%
% {\footnotesize
-% \begin{tabu} spread 3cm{@{}X[9]>{\parskip=5pt}X[4]|X|}
+% \begin{tabu} spread 3cm{@{}X[9]X[4]|X|}
% "Like the air we breathe, Sherlock Holmes is everywhere.
% His pipe-smoking, deer stalkered image peers at us from ads in Yellow Pages,
% to signs for neighbourhood crime-watch; from billboards to the classroom;
@@ -584,14 +747,40 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% to become an international best-seller and has been accepted as part
% of British folklore. Holmes is alive to millions."
% &
-% There the text was too long, and \textt{tabu spread} behaves as if you didn't give it a target.\par
+% There the text was too long, and \textt{tabu spread} behaves as if you didn't give it a target.\par\vskip\baselineskip
% The result of this example is the same as if one had written \cs{begin}\M*{tabu}\textt{to}\cs{linewidth}.
% & \cellcolor{GhostWhite}\centering\rotatebox{-90}{\kern-1.4ex\bfseries Sherlock Holmes}
% \\ \tabucline{1-2}
-% \multicolumn{2}{|c|}{And a \cs{multicolumn} cell, just to see} & \omit \\ \tabucline{1-2}
+% \multicolumn{2}{|c|}{The ``official'' web site: \url{http://www.sherlockholmes.com/}} & \omit \\ \tabucline{-2}
% \end{tabu}}
%
-% In the preamble, \textt{@\M*{}} means that you remove the margin.
+% In the preamble, \textt{@\M*{}} means that the margin is removed.
+%
+% \subsubsection{Negativ width coefficients for \textt X columns}
+%
+% \begin{Verb}
+% \begin{tabu}{|[3pt ForestGreen]X[-1m]|X[c m]|[3pt ForestGreen]}
+% \tabucline[3pt ForestGreen]-
+% $\begin{tabu}({X[-1$]X[-1$c]}) % equivalent to spread 0pt
+% \alpha & \beta \\
+% \gamma & \delta + \epsilon + \zeta + \eta + \theta
+% \end{tabu}$
+% &
+% This is a tabu with negativ width coefficients for \textt X columns
+% \\ \tabucline[3pt ForestGreen]-
+% \end{tabu}
+% \end{Verb}
+%
+% \begin{tabu}{|[3pt ForestGreen]X[-1m]|X[c m]|[3pt ForestGreen]} \tabucline[3pt ForestGreen]-
+% $\begin{tabu}({X[-1$]X[-1$c]})
+% \alpha & \beta \\
+% \gamma & \delta + \epsilon + \zeta + \eta + \theta
+% \end{tabu}$
+% &
+% This is a tabu with negativ width coefficients for \textt X columns
+% \\ \tabucline[3pt ForestGreen]-
+% \end{tabu}
+%
%
% \subsubsection{Multicolumn in \textt{tabu}}
%
@@ -637,8 +826,11 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% This section should contain some examples but I've no time presently...
%
+% However, this document has plenty of nested \textt{tabu}{\smaller s}!
+%
%
% \subsection{Lines inside \textt{tabu}}
+% \label{Lines inside tabu}
%
% \subsubsection{First important remarks}
%
@@ -651,24 +843,26 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
%
% \subsubsection(Vertical lines){Vertical lines: \textt\textbar\ has an optional parameter}
+% \label{Vertical lines}
%
% Inside \textt{tabu} environment, the vertical line marker \textt\textbar\ has an \emph{optional} argument
% which is the width of the vertical rule. The default width remains \cs{arrayrulewidth} of course.
% The optional argument for \textt\textbar\ can also contain the name of a color.
% color \emph{names} are only possible, not a color specification by the mean of a color model.
-% The width of the line if specified, must come before the color name (sorry for that, but I was tired
-% to parse parameters... as for \textt X columns, commas are optional).
+% The width of the line if specified, must come before the color name and... as for \textt X columns
+% parameters, commas are optional.
+%
% Example:
%
% {\tabcolsep=3pt
-% \begin{tabu}{@{}X[3mc]X[3m]X[6m]@{}} \toprule
+% \begin{tabu}{@{}X[-1mc]X[m]X[2ml]@{}} \toprule
% \begin{tabu}{||[5pt]|c|c||[5pt]|}
% Hello & World
% \end{tabu}
% &
% The \textt{tabu} you see on left was made with the code displayed on the right.
% &
-% \verbatim{
+% \verbatim{^^A
% \begin{tabu}{||[5pt]|c|c||[5pt]|}^^@
% Hello & World^^@
% \end{tabu}}
@@ -679,12 +873,12 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% &
% The \textt{tabu} you see on left was made with the code displayed on the right.
% &
-% \verbatim{
+% \verbatim{^^A
% \begin{tabu}{||[5pt,red]|c|c||[5pt blue]|}^^@
% Hello & World^^@
% \end{tabu}}
% \\ \bottomrule
-% \multicolumn{3}{r}{\scriptsize\lk The \cs{verbatim} command available inside \textt{tabu} with \textt X columns was used: guess in which cells...?}
+% \multicolumn{3}{r}{\scriptsize\lk This example was printed inside a \textt{tabu} whose preamble is: \textt{X[$-$1m]X[m]X[2m]}.}
% \end{tabu}}
%
% Note that it is always a good idea to protect the optional argument with braces: \M*[\M*{...}].
@@ -718,7 +912,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% {\parskip=0pt\topsep=0pt
% \begin{center}\def\margintext#1{\noalign{\vtop to0pt{\marginnote{\ttfamily\small #1}[-1.8ex]\vss}}}^^A
-% \begin{tabu}{|[1.5pt]|>{\ttfamily}X@{\hskip\tabcolsep}X[1.4]||[1.5pt]} \tabucline[\heavyrulewidth]- \savetabu{tabucline}
+% \begin{tabu}{|[1.5pt]|>{\ttfamily}X[-1]X||[1.5pt]} \tabucline[\heavyrulewidth]- \savetabu{tabucline}
% \cs{tabucline}\M*[1pt on 1.5pt off 2pt]\M*{1-4} & draws a horizontal dashed line of width \textt{1pt}. Dashes are
% \textt{1.5pt} long and gap width is \textt{2pt}. The line is drawn
% between columns 1 and 4. Here there are only 2 columns and the line
@@ -729,7 +923,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% column and the last one.\\ \tabucline{2-} \margintext{default}
% \cs{tabucline}\M*[on 2pt red]\M*{-5} & draws a horizontal dashed line between columns 1 and 5
% of width \cs{arrayrulewidth}. Dashed are
-% \textt{2pt} long and gaps width is \textt{4pt} (the default).
+% \textt{2pt} long and gap width is \textt{4pt} (the default).
% \\ \tabucline[on 2pt red]{-5} \margintext{[on 2pt red]}
% \end{tabu}
% \end{center}}
@@ -768,19 +962,19 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \multicolumn3c{In each table, \cs{extrarowheight} is equal to \textt{8 pt}.} \\
% \end{tabu}}
%
-% \cs{tabuclines} tries to put the line in the middle, so that the text is centered in its cell. \enlargethispage\baselineskip
+% \cs{tabuclines} tries to put the line in the middle, so that the text is centered in its cell.
% \cs{tabuclines}\stform* tries to take care of vertical lines.
% Well this is not perfect: it works pretty well with simple vertical lines, but not really with double
-% lines, triple lines with colors etc... But it can help in simple cases...
+% lines, triple lines with colours etc... But it can help in simple cases...
%
% \begin{declcs}{tabulinestyle}\M{style=spec., style=spec., style=spec. ...}
% \end{declcs}
%
% This command defines a line style to be used in the first optional argument of \cs{tabucline}:
%
-% \begin{tabu}{@{}X[1.6,c]@{}X[c]@{}} \tabucline[\heavyrulewidth]- \tabucline[\hbox{$\scriptstyle\star$}]- \toprule
+% \begin{tabu}{@{}X[-2,c]@{}X[c]@{}} \tabucline[\heavyrulewidth]- \tabucline[\hbox{$\scriptstyle\star$}]- \toprule
% \rowfont[c]{\bfseries} Define the line style & Use the line style \\ \midrule
-% \cs{tabulinestyle}\M*{myline=0.4pt on 1.5pt off 1pt} & \cs{tabucline}\M*[myline]\M*{-} \\ \tabucline[\heavyrulewidth on 1pt off 2pt]-
+% \cs{tabulinestyle}\M*{myline=0.4pt on 1.5pt off 1pt red} & \cs{tabucline}\M*[myline]\M*{-} \\ \tabucline[\heavyrulewidth on 1pt off 2pt red]-
% \cs{tabulinestyle}\M*{myleader=\cs{hbox}\M*{\$\cs{scriptstyle}\cs{star}\$}} & \cs{tabucline}\M*[myleader]\M*{1-3} \\
% \multicolumn{2}{c}{This way it is easy to change dashed lines into solid ones} \\ \bottomrule \tabucline[\hbox{$\scriptstyle\star$}]- \tabucline[\heavyrulewidth]-
% \end{tabu}
@@ -805,7 +999,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \end{tabu}
% \end{tabu}
%
-% \enlargethispage{2\baselineskip}
+% ^^A\enlargethispage{2\baselineskip}
% \small
% \hfil\Shapepar{\nutshape}{Now we stop it because things are becoming too ugly and go to have a look at \textt{tabu} in mathematical mode...}\hfil\null
%
@@ -813,6 +1007,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
%
% \subsection{\textt{tabu} in math mode}
+% \label{sec.math mode}
%
% {
% \extrarowheight=3pt
@@ -880,6 +1075,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
%
% \subsection{Verbatim inside \textt{tabu} with \textt X columns}
+% \label{Verbatim inside tabu}
%
% The process of computing \textt X columns widths implies to make ``trials'': this means that
% the tabular is first printed in internal mode, inside a box which is measured until the target
@@ -957,6 +1153,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \def\usermacro#1{\numprint[\officialeuro]{\zap@space #1 \@empty}}
% \makeatother
%
+%
% \begin{tabu}{XX}
% \multicolumn{2}{l}{\verbatim{\begin{tabu}{|[GreenYellow]*2{>{\tabudecimal\usermacro}X[r]|[GreenYellow]}}}} \\
% \verbatim{
@@ -1031,6 +1228,13 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% {\centering
% \extrarowheight=8pt
+% \AtBeginShipoutNext{\AtBeginShipoutUpperLeft{\tikz[remember picture,overlay]
+% \node at (tabularx overfull) [xshift=-3cm,yshift=-1cm,rotate=45,font=\ttfamily\smaller]
+% {\begin{tabu}{c}
+% with overfull hboxes\\
+% (15.8pt and 16.1pt two wide)\\
+% for \xpackage{tabularx}
+% \end{tabu}};}}
% \begin{tabu}to .6\linewidth{X[m]} \tabucline-
% \extrarowheight=0pt
% \begin{tabu}({X})
@@ -1040,7 +1244,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% \extrarowheight=0pt
% \begin{tabularx}{\linewidth}[t]({X})
-% This is \textt{tabularx} with \xpackage{delarray} shortcut for parenthesis around
+% \tikzlabel{tabularx overfull} This is \textt{tabularx} with \xpackage{delarray} shortcut for parenthesis around
% \end{tabularx}
% \\ \tabucline[1pt on2pt blue]-
%
@@ -1056,13 +1260,11 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \end{tabularx}
% \\ \tabucline-
%
-% \end{tabu}
-% \par}
+% \end{tabu}\par}
%
-% With \textt{overfull hboxes (15.8pt and 16.1pt too wide)} for \textt{tabularx}.
%
%
-% \section(save the tabu preamble){Save the \textt{tabu} preamble and \textt X columns widths: \cs{savetabu}, \cs{usetabu}}
+% \section(Saving and restoring tabu){Saving and restoring a \textt{tabu}: \cs{savetabu}, \cs{usetabu} and \cs{preamble}}
%
% \begin{declcs}{savetabu}\M{user-name}
% \end{declcs}
@@ -1077,65 +1279,97 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% If the \meta{user-name} has been used before, an info is displayed in the \xext{log} file and the
% previous settings are overwritten.
%
+% With the \hyperref[debugshow]{\textt{debugshow} package option} (or \csref{tracingtabu}) the informations
+% saved by \cs{savetabu} are reported in the \xext{log} file.
+%
%
% \begin{declcs}{usetabu}\M{user-name}
% \end{declcs}
%
-% \cs{usetabu} is the complement of \cs{savetabu}: it can be used in the \textt{tabu}
+% \cs{usetabu} is the complement of \cs{savetabu}: it can be put alone in the \textt{tabu}
% preamble instead of the usual columns specifications
% to restore any previous settings saved with \cs{savetabu}.
% The \meta{user-name} must exist otherwise, you get an error.
%
-% \cs{usetabu} locally restores:
+% \cs{usetabu} does not work with \hyperref[sec.longtabu]{\textt{longtabu}}.
+%
+% \needspace{2\baselineskip}
+%
+% \cs{usetabu} locally restores:\nobreak
% \begin{itemize}
-% \item the preamble,
+% \item the preamble\footnote{The complete \cs{halign}-preamble is restored.}.
+% \item the vertical position \M*[c],\, \M*[b]\, or\, \M*[t], unless another position is specified.
% \item the target width of the \textt{tabu} in points: the saved target width does not contain
-% any control sequence: it is fixed and stored in points,
-% \item the width of \textt{tabu X} columns: those widths are not calculated any more, and \textt{X}
-% columns are directly transformed into \textt p, \textt m or \textt b columns.
-% \item \cs{tabcolsep} (or \cs{arraycolsep} in math mode)
+% any control sequence: it is fixed and stored in points.
+% \item the width of \textt{tabu X} columns: those widths are not calculated any more, even in the case
+% of negativ coefficients and \textt{X} columns are directly transformed into
+% \textt p, \textt m or \textt b columns of the same widths as the ones that where calculated
+% at the time of \cs{savetabu}
+% \item \cs{tabcolsep} (or \cs{arraycolsep} in math mode) and \cs{arraystretch}
% \item \cs{arrayrulewidth}, \cs{doublerulesep}, \cs{extrarowheight} and \cs{extratabsurround}
+% \item \cs{minrowclearance}, \cs{arrayrulecolor} and \cs{doublerulesepcolor} (package \xpackage{colortbl})
% \end{itemize}
%
% Example:
%
-% \begin{Verb*}
-% \extrarowheight=5pt\tabcolsep=12pt
+% \begin{Verb*}
+% \extrarowheight=5pt\tabcolsep=12pt\arrayrulecolor{ForestGreen}
% \begin{tabu}to .7\linewidth{|XXX|X[c]|} ($db(\savetabu)){mytabu} \tabucline*[on1pt]-
% This & is & tabu & package \\ \tabucline*[on1pt]-
% \end{tabu}
-% \end{Verb*}
+% \end{Verb*}
%
% \begin{center}
-% \tabulinestyle{myline=on1pt}\extrarowheight=5pt\tabcolsep=12pt
+% \tabulinestyle{myline=on1pt}\extrarowheight=5pt\tabcolsep=12pt\arrayrulecolor{ForestGreen}
% \begin{tabu}to .7\linewidth{|XXX|X[c]|} \savetabu{mytabu} \tabucline*[myline]-
-% This & is & tabu & package \\ \tabucline*[myline]-
+% This & is & tabu & package \\ \tabucline*[myline]-
% \end{tabu}
% \end{center}
%
-% \begin{Verb*}
+%
+% \begin{Verb*}
% \begin{tabu}{($db(\usetabu)){mytabu}} \tabucline*[on1pt]-
% \multicolumn3{|c}{This is tabu} & package \\ \tabucline*[on1pt]-
% \tabuphantomline
% \end{tabu}
-% \end{Verb*}
+% \end{Verb*}
%
-% \begin{center}
+% \begin{center}
% \begin{tabu}{\usetabu{mytabu}} \tabucline*[myline]-
% \multicolumn3{|c|}{This is tabu} & package \\ \tabucline*[myline]-
% \tabuphantomline
% \end{tabu}
-% \end{center}
+% \end{center}
%
% If one day you use \textt{tabu}, you will have the idea to restore a \textt{tabu} while modifying its target,
% or adding new columns... \cs{savetabu} and \cs{usetabu} have not been thought for this purpose, and you may
% have unexpected results. \cs{usetabu} is a help to get several tabulars of exactly the same shape, same target,
-% same preamble.
+% same preamble. The only parameter that can be changed is the optional vertical position parameter
+% for the whole tabular.
%
+% \begin{declcs}{preamble}\M{user-name}
+% \end{declcs}
+%
+% \cs{preamble} can also be used after \csref{savetabu}. This is a variant of \cs{usetabu} that locally restores:
+% \begin{itemize}
+% \item the \textt{tabu} (or \textt{longtabu}) preamble.
+% \item the vertical position \M*[c],\, \M*[b]\, or\, \M*[t] (or \M*[c],\, \M*[l]\, or\, \M*[r] for \textt{longtabu}),
+% unless another position is specified.
+% \item the \textt{tabu} / \textt{longtabu} target width, unless another target is specified.
+% \end{itemize}
+% Any other tabular parameters are not restored.
+%
+% Put \cs{preamble}\M{user-name} alone inside the \textt{tabu} (or \textt{longtabu}) preamble in place of the usual
+% columns specifications.
%
+% \cs{preamble} works exactly as if you defined a \hyperref[Custom environments]{custom environment} for \textt{tabu}.
%
+% \cs{preamble} works with \hyperref[sec.longtabu]{\textt{longtabu}}.
%
-% \section(row font and alignment){Change the font and the alignment in one row: \cs{rowfont}}
+%
+%
+%
+% \section(row font and alignment){Modifying the font and the alignment in one row: \cs{rowfont}}
%
% \begin{declcs}{rowfont}\M[alignment]\M*{font specification}
% \end{declcs}
@@ -1158,20 +1392,20 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \textt L\, \textt R\, \textt C\, and\, \textt J\, are synonymous with the lowercase equivalent.
%
% \begin{Verb*}
-% \begin{tabu}{|X|X|} \tabucline-
+% \begin{tabu}{|X|X[-1]|} \tabucline-
% ($db(\rowfont))[c]\bfseries
% This & Is \\ \tabucline[on 2pt,blue]-
-% \textt{tabu} & package \\ \tabucline-
+% \textt{tabu} & package for \textt{tabu} and \textt{longtabu} \\ \tabucline-
% \end{tabu}
% \end{Verb*}
%
-% \begin{tabu}{|X|X|}\tabucline-
+% \begin{tabu}{|X|X[-1]|}\tabucline-
% \rowfont[c]\bfseries This & Is \\ \tabucline[on 2pt,blue]-
-% \textt{tabu} & package \\ \tabucline-
+% \textt{tabu} & package for \textt{tabu} and \textt{longtabu} \\ \tabucline-
% \end{tabu}
%
%
-% \section(Differences: tabu, tabular, tabularx){Differences between \textt{tabu}, \textt{tabular} and \textt{tabularx}}
+% \section(Differences: tabu, tabular, tabularx, longtable){Differences between \textt{tabu}, \textt{tabular}\, \textt{tabularx} and \textt{longtable}}
%
% \subsection{Paragraph indentation}
%
@@ -1179,7 +1413,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% no matter if it has been loaded or not with the \textt{linegoal} option.
% Example with \LaTeX{} default: \cs{parindent} $=20$pt.
%
-% {\parindent=20pt \makeatletter\let\tabudefaulttarget\linewidth\makeatother
+% {\parindent=20pt \let\tabudefaulttarget \linewidth
%
% \begin{tabu}{|[GreenYellow]X|[GreenYellow]} \tabucline[GreenYellow]-
% This is \textt{tabu} with its default target in an indented paragraph. \\ \tabucline[GreenYellow]-
@@ -1200,6 +1434,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
%
% \subsection{Custom environments}
+% \label{Custom environments}
%
% Unlike \textt{tabularx}, it is possible to define your own environment using \textt{tabu}:
%
@@ -1263,10 +1498,48 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% In math mode however, tokens are in the reverse order in the \textt{tabu} environment
% like they are in the \textt{array} environment.
%
-% \subsection(Improved rewrite process){Improved process for rewritting columns}
+% \subsection(Improved rewrite process){Improved process for rewritting columns \textmd{\emph{(for keen readers)}}}
+%
+% Any tabulars that do not split accross pages are made with the following process:
+%
+% \begin{tikzpicture}[
+% start chain=going below, every join/.style={->,thin,black,solid},node distance=.5cm and 1cm,
+% every node/.style={black,on chain}]
+% \node (initialisation) at (0,0) {\begin{tabu}{c} initialisation \\ \cs{hbox}\end{tabu}}
+% node (@array) [join] {\cs{@array}}
+% {[start branch]
+% node (@arraydesc) [join] {%
+% \begin{tabu}\{{l}.
+% \begin{tabu}[c].{l}\}
+% \cs{begingroup} \\
+% \qquad \cs{@mkpream}\M*{preamble} \\
+% \cs{endgroup} \\
+% \end{tabu} ``\textt{@mkpream}'' group
+% \\[4ex]
+% \cs{halign}\M*{\cs{@preamble} \textellipsis\ tabular content }
+% \end{tabu}}
+% }
+% node (end) [join] {end of \cs{hbox}};
+% \end{tikzpicture}
+%
+% For more details, see the \nameref{Flow chart of expansion}.
+%
+% \cs{@mkpream} works in two times inside a (semi-simple) group:
+%
+% \begin{description}[font=\mdseries\itshape,topsep=0pt,itemsep=0pt]
+% \item [First the rewriting process:] \ \\
+% Each special column in the tabular preamble is transformed into
+% one the columns defined by \xfile{array.sty}.
+% \item [Second the building of the \textup{\cs{halign}} preamble:] \ \\
+% The ``rewritten preamble'' is parsed and transformed in a preamble for the \TeX{} primitive
+% \cs{halign}. The result is stored into the \cs{@preamble} macro.
+% \end{description}
+%
+% Any special columns of \textt{tabu} are defined only inside the ``\textt{@mkpream}'' group.
%
% In the following example, you get an error with \textt{tabular} and no error with \textt{tabu}.
-% With \textt{tabular}, and \xpackage{siunitx} \textt S column, the rewritting process is as follow:
+% With \textt{tabular}, and \xpackage{siunitx} \textt S column, the {\descfont\mdseries\itshape rewritting process}
+% is as follow:\nobreak
%
% \begin{SaveVerbatim}{siunitx}
% \documentclass{minimal}
@@ -1304,16 +1577,20 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \item Rewrite \stform*
% \item Rewrite \textt\textbar\
% \item Rewrite \textt S
-% \item Rewrite \textt n \smex not found because \textt S rewritten before, according to \xpackage{siunitx} definition.
+% \item Rewrite \textt n \smex not found because \textt S was rewritten before, according to \xpackage{siunitx} definition.
% \end{enumerate}
% \end{tabu}
%
% The process of rewritting columns is usually longer inside \textt{tabu} than inside \textt{tabular},
% but conversely \textt{tabu} with \textt X columns is optimised compared to \textt{tabularx},
-% because the preamble is built only once, not rebuilt before each trial as \textt{tabularx} does...
+% because the preamble is built only once, and not rebuilt before each trial as \textt{tabularx} does.
+% Thus \textt{tabu} is much quicker than \textt{tabularx}.
%
% The process of rewritting is very sensitiv to the order in which columns are actually rewritten.
-% Therefore, if it possible to define a new column type using the \textt X token for use with \textt{tabu}:\nobreak
+% This becomes critical when columns are defined with an optional argument like \xpackage{tabu} \textt X
+% and \textttbf\textbar\ columns or \xpackage{siunitx} \textt S column.
+%
+% If it possible to define a new column types using the \textt X token for use with \textt{tabu}:\nobreak
% \begin{Verb*}
% \newcolumntype{C}{X[c]}
% \end{Verb*}
@@ -1323,8 +1600,8 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \newcolumntype{Q}{>{\color{green}}C}
% \end{Verb*}
%
-% In fact, a problem may arise in nested \textt{tabu}{\small s} if such a \textt Q column type
-% is defined before the \textt C column type...
+% In fact, a problem may arise in nested \textt{tabu}{\small s} if such a \textt Q column
+% is defined before the \textt C column...
%
% Well, just avoid to nest new column type definitions !
%
@@ -1333,13 +1610,20 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \section{The package options}
%
% \subsection(The debugshow option){The \textt{debugshow} package option}
+% \label{debugshow}
%
-% \begin{declcs}{tracingtabu}
+% \begin{declcs}{tracingtabu} \\
+% \cs{tracingtabu}\,=\,2
% \end{declcs}
%
-% With the package option \textt{debugshow}, \xpackage{tabu} will report the widths it computes
-% at each attempt to read the target, when \textt X columns are used.
-% The control sequence \cs{tracingtabu} has the same effect as the \textt{debugshow} option.
+% The control sequence \cs{tracingtabu} has the same effect as the \textt{debugshow} option:
+% \begin{itemize}
+% \item \xpackage{tabu} will report the widths it computes at each attempt to read the target,
+% when \textt X columns are used.
+% \item Saved informations on the \textt{tabu} are reported in the \xext{log} file when \cs{savetabu}
+% is used.
+% \end{itemize}
+%
%
% Typical information in the \xext{log} file:
%
@@ -1349,7 +1633,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% (tabu) &Try &tabu X &tabu Width &Target &Coefs &Update \\
% (tabu) &1) &386.67296pt &797.34592pt &386.67296pt &2.0pt &-205.33649pt \\
% (tabu) &2) &181.33647pt &386.67294pt &386.67296pt &2.0pt &0.00002pt \\
-% (tabu) &2) & \multicolumn{5}{l}{\ \ Target Reached (hfuzz=0.1pt) **************** }\\
+% (tabu) &2) & \multicolumn5l{\ \ Target reached (hfuzz=0.1pt) **************** }\\
% \end{tabu}}
%
% What does it mean? \def\pt#1{$#1$\textt{pt}}
@@ -1362,6 +1646,8 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% The final width of each \textt X column is the product of \textt{tabu X} by its width coefficient.
% \end{enumerate}
%
+% \cs{tracingtabu}=2 gives even more information about the measuring of natural widths of columns.
+%
% \subsection(The linegoal option){The \textt{linegoal} package option}
% \label{subsec:linegoal package option}
%
@@ -1376,6 +1662,8 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% you can say (in a group for example):
% \verb+\let\tabudefaulttarget=\linewidth+
%
+% In any case, specifying the target overwrites the default: \cs{begin}\M*{tabu} to\cs{linewidth}
+%
% \subsection(The delarray option){The \textt{delarray} package option}
%
% \textt{delarray} option has the single effect to load \xfile{delarray.sty} for delimiters shortcuts
@@ -1406,41 +1694,52 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% As a consequence: \cs{rowfont} and \cs{tabucline} will not be available, and vertical lines \texttt\textbar\
% will not have an optional argument for their widths and color. However, \textt{tabu X} columns will work normally.
%
+% ^^A\medskip
+% ^^A As the author of \thispackage, I often use the \textt{light} option when implementing \textt{tabu}, for the
+% ^^A\xext{log} file is lighter too...
+%
%
-% \section(Corrections){Corrections of some bugs (available only inside \textt{tabu})}
+% \section(Corrections){Corrections of some bugs \textmd{\emph{(available only inside \textt{\upshape tabu})}}}
%
-% \subsection(delarray compatibility){Correction for colortbl and arydshln: compatibility with delarray}
+% \subsection(delarray compatibility){Correction for \xpackage{colortbl} and \xpackage{arydshln}: compatibility with \xpackage{delarray}}
%
% Both \xpackage{colortbl} and \xpackage{arydshln} forget the control sequence \cs{@arrayright} in their implementation,
-% quite strangely because both of them take care of \cs{@arrayleft}.
+% quite strangely because both of them take care of \cs{@arrayleft}. As a result, \xpackage{delarray} shortcuts for
+% delimiters around a tabular does not work if \xpackage{colortbl} and/or \xpackage{arydshln} are loaded.
%
-% Those control sequences are used by the \xpackage{delarray} package to put parenthesis or bracket around the array.
+% Those control sequences are used by the \xpackage{delarray} package to put variable size delimiters around the array:
%
+% {\centering\tabcolsep=12pt
+% \begin{tabu}{X[-1m]X[-1mc]X[-1m]}
+% \verbatim{\begin{tabu}\{{X}.^^@ ...^^@ \end{tabu}} &
+% is like: &
+% \verbatim{\left\{ \begin{tabu}{X}^^@ ...^^@ \end{tabu} \right.}
+% \end{tabu}\par}
%
-% \subsection(arydshln @ columns){Correction for arydshln: \texttbf @ columns}
+%
+% \subsection(arydshln @ columns){Correction for \xpackage{arydshln}: \texttbf @ columns}
%
% A bug in \cs{adl@xarraydashrule}: \textt{!-arg} columns (class 1) and \textt{@-arg} columns (class 5) should be treated
% the same as far as rules are concerned.
%
-% With this correction, the \textbf{known problem number 1} in \xpackage{arydshln} documentation is solved.
-%
-%
+% With this correction, the ``known problem number 1'' in \xpackage{arydshln} documentation is solved.
%
-% \vskip2cm
%
+% \section{To do for even better \textt{tabus}}
%
+% \nprounddigits{0}
+% \begin{itemize}[leftmargin=*,label=\ding{223}]
+% \item Make double \cs{tabucline} with compatibility with \xpackage{colortbl} \cs{doublerulesepcolor}
+% \item Multiple \cs{tabucline} between different columns: extended specs: \\
+% \cs{tabucline}\M*[line spec]\M*{start-stop,start-stop}\M*[line spec]\M*{start-stop} ...
+% \item Presently, \textt{longtabu} with \textt X columns works only if \cs{LTchunksize} is greater than the number of rows.
+% I compiled a \textt{longtabu} of 56 pages on my PC with \cs{LTchunksize} $ = $ \numprint{2000} without problem.
+% Presently \cs{LTchunksize} is set to \numprint{10000} during trials when \textt{longtabu} contains \textt{X columns}.
+% \item Make \cs{tabucline} work with page breaks (one line on the top of the page, one line on the bottom of the previous).
+% \item An environment ``\textt{calstabu}'' based on the \Xpackage{cals} package but with the syntax of \textt{tabular} if possible...
+% \end{itemize}
%
-% \begin{SaveVerbatim}[commandchars=$(),gobble=1]{myVerb}
-% ($db(\definecolorseries)){serie}{rgb}{last}{Goldenrod}{DarkSeaGreen}
-% ($db(\resetcolorseries))[3]{serie}
-% \begin{($dr$underline(parse lines))}{($dg(\color{serie!!+}``#1''\par))}
-% This is a nice little package
-% and I really don't know
-% What to do with it !
-% May be tomorrow...
-% \end{($dr$underline(parse lines))}
-% \end{SaveVerbatim}
-%
+% \raggedbottom
%
%
% \StopEventually{
@@ -1456,8 +1755,10 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \begin{macrocode}
%<*package>
\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
% \end{macrocode}
%
% Then minimal catcode acertaining for loading \thispackage in good conditions:
@@ -1483,42 +1784,52 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \cs{tracingtabu} is the same as option \textt{debugshow}.
%
% \begin{macrocode}
-\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}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{linegoal (package option)}
+%
% \begin{macrocode}
+\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
+}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{delarray (package option)}
+%
% \begin{macrocode}
\DeclareOption{delarray}{%
\AtEndOfPackage{\RequirePackage{delarray}}%
-}% delarray option
+}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{light (package option)}
+%
% \begin{macrocode}
\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}
@@ -1541,10 +1852,13 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \begin{macrocode}
\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}%
}
% \end{macrocode}
%
@@ -1563,11 +1877,12 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% Used only when \textt{tabu X} columns are used with ``\textt{tabu spread}''.
%
% \begin{macrocode}
-\newcount\tabu@cnt
-\newcount\tabu@nbcols
-\newcount\tabu@X@cols
-\newcount\tabu@start
-\newcount\tabu@stop
+\newcount \tabu@cnt
+\newcount \tabu@nbcols
+\newcount \tabu@X@cols
+\newcount \tabu@start
+\newcount \tabu@stop
+\newcount \tabu@nested
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1584,9 +1899,9 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% Used only when \textt{tabu X} columns are used with ``\textt{tabu spread}''.
%
% \begin{macrocode}
-\newdimen\tabu@target
-\newdimen\tabu@spreadtarget
-\newdimen\tabu@naturalX
+\newdimen \tabu@target
+\newdimen \tabu@spreadtarget
+\newdimen \tabu@naturalX
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1601,12 +1916,19 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% Stores the sum of all width coefficients for \textt X columns.
%
+% \begin{macro}{\tabucolX@error}
+%
+% In case of \textt X columns too narrow.
+%
% \begin{macrocode}
-\newdimen\tabucolX
-\newdimen\tabu@X@sum
+\newdimen \tabucolX
+\newdimen \tabu@X@sum
+\newdimen \tabucolX@error \tabucolX@error=1em
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
+%
%
% \begin{macro}{\iftabu@measuring}
%
@@ -1614,31 +1936,32 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% It is also temporarily set to true when the first \textt X column is encountered in the \textt{tabu} preamble,
% at the time \cs{@mkpream} scans it to built the \cs{halign} preamble. The first \textt X column found
-% actually triggers some special setup to be expanded before \cs{halign} (see the flow chart...)
+% actually triggers some special setup to be expanded before \cs{halign} (see the \hyperref[Flow chart of expansion]{flow chart...})
%
% \begin{macro}{\iftabu@spread}
%
% A switch whether ``\textt{tabu spread}'' is used or not.
%
-% \begin{macro}{\iftabu@nested}
-%
-% A swith set at the entry in \textt{tabu} environment: true if \textt{tabu} is nested inside another \textt{tabu}.
-%
% \begin{macro}{\iftabu@firstcline}
%
% A switch to adapt \cs{tabucline} automatically if it comes first in the \textt{tabu} (similar to \cs{firsthline}).
%
+% \begin{macro}{\iftabu@negcoef}
+%
+% A switch set to true in case of negativ coef (natural width if less than \textt{X[coef]}).
+%
% \begin{macrocode}
-\newif\iftabu@measuring
-\newif\iftabu@spread
-\newif\iftabu@nested
-\newif\iftabu@firstcline
+\newif \iftabu@measuring
+\newif \iftabu@spread
+\newif \iftabu@firstcline
+\newif \iftabu@negcoef
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
+%
% \begin{macro}{\tabu@box}
%
% Stores the whole \textt{tabu} when an attempt to adjust \textt X columns is performed.
@@ -1646,8 +1969,8 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% It is also used by \cs{tabucline} to save the \cs{@arstrutbox} when inserting a horizontal line.
%
% \begin{macrocode}
-\newsavebox\tabu@box
-\chardef\tabu@arstrutbox=\@arstrutbox
+\newsavebox \tabu@box
+\chardef \tabu@arstrutbox=\@arstrutbox
\let\tabu@vcenter \vcenter
% \end{macrocode}
% \end{macro}
@@ -1656,8 +1979,26 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% A macro which is needed when scanning tokens with \cs{futurelet}.
%
+% \begin{macro}{\tabu@gobbleopt}
+%
+% A macro that gobbles an optional argument.
+%
% \begin{macrocode}
\def\tabu@gobblespace#1 {#1}
+\def\tabu@gobbleopt#1{\@ifnextchar [{\tabu@gobble@pt{#1}}{#1}}%]
+\def\tabu@gobble@pt#1[#2]{#1}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\tabu@save@decl}
+%
+% No inversion on tokens in the \text{tabu} preamble, when not in math mode.
+%
+% \begin{macrocode}
+\def\tabu@save@decl{%
+ \toks\count@ = \expandafter{\the\toks\expandafter\count@\@nextchar}%
+}% \tabu@save@decl
% \end{macrocode}
% \end{macro}
%
@@ -1672,37 +2013,55 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \begin{macrocode}
\newcommand\tabu@NC@rewrite@X[1][]{\tabu@rewrite@X{#1}%
\let\@halignto \relax
- \expandafter \NC@find \tabucolX@spec}
+ \expandafter \NC@find \tabucolX@rw}
% \end{macrocode}
% \end{macro}
%
% The next part of the definition (\cs{tabu@rewrite@X}) can be found page \pageref{tabu X column definition}.
%
+% \begin{macro}{\tabu@newcolumntype}
+%
+% A helper macro to create local new column types for \textt{tabu}.
+%
+% \begin{macrocode}
+\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
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{macro}{\usetabu (new column type)}
%
-% \cs{usetabu} is defined as a new column type. \cs{NC@rewrite@\string\usetabu} is expanded
-% where \cs{@mkpream} does its job.
+% \cs{usetabu} is defined as a \textt{tabu} new column type: loaded only inside the \cs{@mkpream}
+% group inside the \textt{tabu} environment.
%
% \begin{macrocode}
-\expandafter\def\csname NC@rewrite@\string\usetabu\endcsname#1{%
+\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}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\preamble (new column type)}
+%
+% \cs{preamble} is defined as a \textt{tabu} new column type: loaded only inside the \cs{@mkpream}
+% group inside the \textt{tabu} environment.
+%
+% \begin{macrocode}
+\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
+}% \NC@rewrite@\preamble
% \end{macrocode}
% \end{macro}
%
@@ -1720,27 +2079,18 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% of the \textt X column occurs only inside the group where \cs{@mkpream} does its job).
%
% \begin{macrocode}
-\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)
- \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
+\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
+\def\tabu@restore@NC@list{\NC@list\expandafter{\tabu@NC@list}}
% \end{macrocode}
% \end{macro}
%
@@ -1758,32 +2108,48 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% Otherwise, we must insert \textt{!\M*{\cs{extracolsep}\cs{@flushglue}}} in order to keep the margin.
%
+% \cs{tabu@rewritelast} column type is loaded by \cs{tabu@rewritefirst} column type, only inside the \cs{@mkpream}
+% group inside the \textt{tabu} environment.
+%
% \begin{macrocode}
-\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{%
+\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
% \end{macrocode}
% \end{macro}
%
@@ -1802,20 +2168,23 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% \begin{macro}{\tabu@nowrite}
%
-% A trick to fobidd \cs{write} when a trial is done on the \cs{halign}.
-% (Copied from D. Carlisle's \xpackage{tabularx} code.)
+% A trick (from the \TeX-book to forbidd \cs{write} when a trial is done on the \cs{halign}.
%
% \begin{macrocode}
-\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}}
% \end{macrocode}
% \end{macro}
%
-% \subsection{\cs{tabu} and \cs{endtabu}}
+% \subsection{\cs{tabu}, \cs{endtabu}, \cs{longtabu} and \cs{endlontabu}}
%
% \begin{macro}{\tabu}
%
@@ -1827,10 +2196,19 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% \begin{macrocode}
\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}
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -1845,54 +2223,43 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% \begin{macrocode}
\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
% \end{macrocode}
% \end{macro}
%
@@ -1911,47 +2278,58 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\tabu@preparesave}
+%
+% This macro temporarily save the \textt{tabu} preamble and the settings
+% for \cs{arrayrulewidth}, \cs{extrarowheight} \etc.
+%
+% Those values are retrieved by \cs{savetabu}, if invoked inside the \textt{tabu}.
+%
+% \begin{macrocode}
+\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
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
%
% \subsection{Footnotes inside \textt{tabu}}
@@ -1970,13 +2348,13 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% The macros in case \xpackage{hyperref} is not used, or used with the option \textt{hyperfootnotes=false}:
%
% \begin{macrocode}
-\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
% \end{macrocode}
% \end{macro}
@@ -1988,14 +2366,14 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% \begin{macrocode}
\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
@@ -2008,39 +2386,39 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
}%
}%
\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}
- {}%
-}%
+ \csname\ifcsname ifHy@hyperfootnotes\endcsname
+ ifHy@hyperfootnotes\else iffalse\fi\endcsname
+ \let\tabu@footnotetext \tabu@Hy@ftntext
+ \let\tabu@xfootnote \tabu@Hy@xfootnote
+ \fi
+}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%
-%
-% \subsection{Flow chart of expansion} ^^A\enlargethispage{\baselineskip}
+% \clearpage
+% \subsection{Flow chart of expansion}
+% \label{Flow chart of expansion}
%
% \subsubsection(case: tabu, tabu to and tabu spread){General case: tabu, tabu to and tabu spread}
%
@@ -2233,11 +2611,34 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \end{itemize}
%
% \begin{macrocode}
-\def\tabu@rewrite@X#1{\tabu@Xarg{#1}%
- \iftabu@spread \tabu@rewrite@Xspread
- \else \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
+ \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
+ \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
+ \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
% \end{macrocode}
%
% \begin{macro}{\tabu@rewrite@Xnested}
@@ -2249,96 +2650,43 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% This macro replaces \cs{tabu@rewrite@X} in the case of \cs{usetabu}.
%
% \begin{macrocode}
-\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@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}}}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
-% \begin{macro}{\tabu@rewrite@Xto}
-%
-% The setup for trial is not the same in case of ``\textt{tabu to}'' and ``\textt{tabu spread}''.
-%
-% The important thing is:\, \cs{aftergroup}\cs{tabu@prep@TRIAL}.
-%
-% \begin{macrocode}
-\def\tabu@rewrite@Xto{%
- \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}%
- \else % first X column found in preamble
- \tabu@measuringtrue
- \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
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\tabu@rewrite@Xspread}
-%
-% This macro is used instead of \cs{tabu@rewrite@Xto} for \textt X columns with ``\textt{tabu spread}''.
-%
-% \begin{macrocode}
-\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 {%
- \tabu@X@cols \@ne
- \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}}%
- \let\tabu@halignto \relax
- \fi
-}% \tabu@rewrite@Xspread
-% \end{macrocode}
-% \end{macro}
-%
-%
% \begin{macro}{\tabu@Xarg}
+% \begin{macro}{\tabu@Xparse}
+% \begin{macro}{\tabucolX@do}
%
% A tedious (and fastidious) macro to parse the optional argument of \textt X columns. The aim is to built
-% \cs{tabucolX@spec} which expands to the column specification:
+% \cs{tabucolX@rw} which expands to the column specification:
%
% {\centering \textt{>\M*{alignment} p \emph{or} m \emph{or} b \M*{\cs{dimexpr} coef \cs{tabucolX}\cs{relax}}}\par}
%
-% After that \xfile{array.sty} make it easy:\, \cs{expandafter}\cs{NC@find}\cs{tabucolX@spec}
+% After that \xfile{array.sty} make it easy:\, \cs{expandafter}\cs{NC@find}\cs{tabucolX@rw}
%
% \begin{macrocode}
\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
@@ -2350,28 +2698,29 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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{%
@@ -2379,42 +2728,51 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
{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
% \end{macrocode}
% \end{macro}
+% \end{macro}
+% \end{macro}
%
-% \subsection(Before trials){Before trials to reach the target}
%
-% \subsubsection{Trial setup after \cs{@mkpream}}
+% \subsection(Before trials){Before trials to reach the target: setup after \cs{@mkpream}}
%
% \begin{macro}{\tabu@prep@TRIAL}
%
@@ -2428,41 +2786,42 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \begin{macrocode}
\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
% \end{macrocode}
+% \end{macro}
%
+% \begin{macro}{\tabu@setup@TRIAL}
% \begin{macrocode}
-\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
+\def\tabu@savecounters{%
+ \def\@elt##1{\global\value{##1}\the\value{##1}\relax}%
+ \edef\tabu@global@X {\cl@@ckpt}\let\@elt \relax
+}% \tabu@savecounters
% \end{macrocode}
% \end{macro}
%
@@ -2471,31 +2830,75 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
%
% \begin{macrocode}
-\let\tabu@TRIAL@hook\@empty
-\newcommand\tabuDisableCommands[1]{\g@addto@macro\tabu@TRIAL@hook{#1}}
+\let\tabu@TRIAL@hook \@empty
+\newcommand\tabuDisableCommands[1]{\g@addto@macro\tabu@TRIAL@hook {#1}}
% \end{macrocode}
% \end{macro}
%
+%
+% \subsection{One trial after another}
+%
% \begin{macro}{\tabu@arrayleft@measure}
%
% Measuring the whole tabular occurs just before \cs{@arrayleft}.
% Hence the name of the macro: \cs{tabu@arrayleft@measure}.
%
+% \begin{macro}{\tabu@TRIAL}
+%
+% \cs{halign} is temporarily expanded inside a \cs{vbox} which is captured in \cs{tabu@box}.
+%
% \begin{macrocode}
\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
% \end{macrocode}
% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\tabu@long@arrayleft@measure}
+%
+% This is the long version for \textt{longtabu}
+% \begin{macrocode}
+\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
+% \end{macrocode}
+% \end{macro}
%
-% \subsubsection(Collecting the tabu body){Collecting the \textt{tabu} body: required for \texttbf X columns}
%
% \begin{macro}{\tabu@collect}
-% \begin{macro}{\tabu@collectbody}
%
% The mechanism is the same as \hologo{AmS}-\cs{collect@body} (also defined in \xfile{environ.sty}).
% The content of the tabular is captured inside \cs{toks@}, expanded by \cs{tabu@TRIAL}.
@@ -2506,129 +2909,169 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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}
% \end{macrocode}
% \end{macro}
-% \end{macro}
-%
-%
-% \subsection{Measuring the \textt{tabu}}
-%
-% \subsubsection{One trial after another}
%
%
-% \begin{macro}{\tabu@TRIAL}
% \begin{macro}{\tabu@endTRIAL}
%
-% \cs{halign} is temporarily expanded inside a \cs{vbox} which is captured in \cs{tabu@box}.
-%
% At the end of the trial, we call \cs{tabu@arith} to compute the widths. \cs{tabu@arith} exits
% leaving \cs{iftabu@measuring} equal to \cs{iftrue}: a further trial is necessary, or equal to
% \cs{iffalse}: the target is reached, \cs{tabu@Xfinish} can print the \textt{tabu} in a last
% expansion of \cs{halign}.
%
% \begin{macrocode}
-\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}}
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
-% \subsubsection{The arithmetic of \textt X columns}
+%
+%
+% \subsection{Algorithms: Measuring the \textt{tabu}}
+%
+% \subsubsection(Algorithm for tabu to){The arithmetic of \textt X columns}
%
% \begin{macro}{\tabu@arith}
-% \begin{macro}{\tabu@spreadarith}
%
-% Algorithms.
+% General algorithms for \textt{tabu to} with \textt X columns.
%
% \begin{macrocode}
\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
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection(Algorithm for tabu spread){The arithmetic of \textt X columns for \textt{tabu spread}}
+%
+% \begin{macro}{\tabu@spreadarith}
+%
+% Algorithm for \textt{tabu spread} with \textt X columns: only the first pass.
+%
+% \begin{macrocode}
\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
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \subsubsection(\xext{log} report){Reporting in the \xext{log} file (\textt{debugshow option})}
%
% \begin{macro}{\tabu@message@arith}
+% \begin{macro}{\tabu@message@spread}
+% \begin{macro}{\tabu@message@negcoef}
% \begin{macrocode}
\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 {}{}{}{}{}\@@
@@ -2636,156 +3079,149 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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{ }
% \end{macrocode}
% \end{macro}
-%
-% \subsubsection(Natural width measure){Measuring the natural width for \textt{tabu spread}}
-%
-% \begin{macro}{\tabu@spread@startpbox}
-% \begin{macro}{\tabu@spread@endhbox}
-%
-% When ``\textt{tabu spread}'' is used with \textt X columns, the first trial must
-% measure the natural width of the columns. Therefore, the \cs{vbox}, \cs{vtop} or \cs{vcenter}
-% corresponding to the \textt X columns definitions are temporarily changed into \cs{hbox}. More
-% precisely, the natural width is measured with \cs{vbox}\M*{\cs{hbox}\M*{...}}.
-%
-% For the furthur trials, the standard scheme for \textt X column is used.
-%
-% \begin{macrocode}
-\def\tabu@spread@startpbox#1{\bgroup
- \in@{\tabucolX}{#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
- \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}%
- \fi
- \fi
- \box\tabu@box
- \egroup % end of \vtop (measure)
-}% \tabu@spread@endhbox
-% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \subsection(Lines inside tabu){Lines inside \textt{tabu}}
%
-% \subsubsection{Vertical lines}
+% \subsubsection(Natural width measure){Measuring the natural width for \textt{tabu spread} and negativ width-coefficients}
%
+% \begin{macro}{\tabu@measure@startpbox}
+% \begin{macro}{\tabu@measure@endpbox}
%
-% \begin{macro}{\tabuvline@rewrite}
+% When ``\textt{tabu spread}'' is used with \textt X columns, the first trial must
+% measure the natural width of the columns. When \textt X columns have negativ coefficient,
+% the natural is computed after the target has been reached, with the absolute coefficients.
%
-% \textt\textbar\ is defined as a new column type (only inside \textt{tabu}) in order to add an optional argument:
-% the width of the rule.
+% Nested trials may occur (\textt{tabu spread} inside a \textt X column with negativ
+% coefficient for example).
%
-% \begin{macrocode}
-\newcommand*\tabuvline@rewrite[1][]{\tabuvline@arg{#1}%
- \expandafter \NC@find \tabu@temp}
-\def\tabu@vline#1{\vrule width#1}
-% \end{macrocode}
-% \end{macro}
+% For the furthur trials, the standard scheme for \textt X column is used: the natural width
+% is measured only once.
%
-% \begin{macro}{\tabuvline@arg}
+% \hologo{pdfTeX} font expansion is disabled inside the \textt{varwidth} environment
+% (we set \cs{pdfadjustspacing} to \textt 0).
%
-% A tedious (and fastidious) macro to parse the optional argument of \textt\textbar\ vertical lines...
-
% \begin{macrocode}
-\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
+\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
-}% \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
+}% \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@}
% \end{macrocode}
% \end{macro}
-%
-%
-% \begin{macro}{\tabu@lines}
-%
-% This macro is used in \cs{tabu@setup} to ``mount'' the character \textt\textbar\ as a column type.
-%
-% \begin{macrocode}
-{
-\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}}
-% \end{macrocode}
% \end{macro}
%
%
-% \subsubsection{Horizontal lines: \cs{tabucline}}
+% \subsection{\cs{everycr} setup and \cs{tabuphantomline}}
%
% \begin{macro}{\tabu@setup@everycr}
+%
+% \cs{ialign} resets \cs{everycr} to an empty token. This macro sets \cs{everycr} for the
+% \textt{tabu} environment.
+%
% \begin{macrocode}
\def\tabu@setup@everycr{%
\tabu@firstclinetrue
@@ -2820,7 +3256,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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@&}}%
@@ -2836,6 +3272,77 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \end{macrocode}
% \end{macro}
%
+%
+%
+% \subsection(Lines inside tabu){Lines inside \textt{tabu}}
+%
+% \subsubsection{Vertical lines}
+%
+%
+% \begin{macro}{\tabuvline@rewrite}
+%
+% \textt\textbar\ is defined as a new column type but only inside the group
+% where \cs{@mkpream} does its job. This way, the modification is very local
+% to \textt{tabu}.
+%
+% \begin{macro}{\tabu@lines}
+%
+% This feature is disabled with the \textt{light} option.
+%
+% \begin{macrocode}
+\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}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\tabuvline@arg}
+%
+% A tedious (and fastidious) macro to parse the optional argument of \textt\textbar\ vertical lines...
+
+% \begin{macrocode}
+\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
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Horizontal lines: \cs{tabucline}}
+%
% \begin{macro}{\tabucline}
%
% \cs{tabucline}\M[style or spec.]\M*{start-end}
@@ -2847,15 +3354,15 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \begin{macrocode}
\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@ &}}%
@@ -2865,11 +3372,11 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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
@@ -2879,13 +3386,14 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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}}
% \end{macrocode}
% \end{macro}
%
@@ -2925,7 +3433,8 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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}%
@@ -2955,13 +3464,16 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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@
@@ -3030,8 +3542,9 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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
@@ -3049,9 +3562,11 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \begin{macro}{\tabu@sanitizetext}
% \begin{macrocode}
{\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\}%
@@ -3064,12 +3579,15 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% \subsubsection{\cs{tabudecimal}}
%
% \begin{macro}{\tabudecimal}
+%
+% \cs{tabu@tabudecimal} is \cs{tabudecimal} inside \textt{tabu}.
+%
% \begin{macrocode}
\def\tabu@tabudecimal#1{%
\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{%
@@ -3088,6 +3606,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\def\tabu@get@decimalspace#1{%
\@temptokena\expandafter{\the\@temptokena #1}\tabu@scandecimal}%
}\do{ }
+\let\tabu@@tabudecimal \tabu@tabudecimal
% \end{macrocode}
% \end{macro}
%
@@ -3138,37 +3657,78 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% When this command is called by the user, the \textt{tabu} preamble and target are globally
% stored into a macro \cs{tabu@saved@\meta{user-name}}.
%
-% \begin{macro}{\tabu@saveX}
-%
-% \cs{tabu@saveX} replaces \cs{savetabu} inside a \textt{tabu} with \textt X columns.
-% The \textt X columns widths have to be stored, that is, the value in points of \cs{tabucolX}.
-%
% \begin{macrocode}
\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
-% \end{macrocode}%
-%
-% \begin{macrocode}
-\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
% \end{macrocode}
% \end{macro}
-% \end{macro}
%
% \begin{macro}{\tabu@savewarn}
% \begin{macro}{\tabu@saveerr}
@@ -3212,15 +3772,17 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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}
% \end{macrocode}
% \end{macro}
%
@@ -3301,7 +3863,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
%
% \begin{macrocode}
\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>
@@ -3319,9 +3881,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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
@@ -3337,7 +3897,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\fi
\fi % \ifcase
\fi
- \array@prepnext@tok
+ \tabu@prepnext@tokORI
}% \tabu@prepnext@tok
\def\tabu@preptokenright{%
\advance \count@ \m@ne
@@ -3351,16 +3911,17 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\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
% \end{macrocode}
% \end{macro}
@@ -3648,7 +4209,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
}% \tabu@adl@xarraydashrule
% \end{macrocode}
%
-% \subsubsection{arydshln and empty \textt p columns}
+% \subsubsection{arydshln, colors without \xpackage{colortbl} and empty \textt p columns}
%
% \xpackage{arydshln} redefines \cs{@endpbox} for \textt p columns. The definition is stored in \cs{adl@act@endpbox}.
% Here it is:
@@ -3665,13 +4226,23 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% However, just like in \xfile{array.sty}, this array-\textt{strut} should be inserted inconditionnally,
% and \cs{ifhmode} applies only to \cs{nobreak} (misplaced \cs{fi} in \xpackage{arydshln} definition).
%
+% Finally, \xpackage{arydshln} is not compatible with colors in columns, such that: \textt{>\M*{\cs{color}\M*{red}}p{3in}},
+% Unless \xpackage{colortbl} is also loaded, the color group is missing.
+%
+% Fixed inside \textt{tabu}.
%
% \begin{macrocode}
\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
% \end{macrocode}
%
%
@@ -3687,10 +4258,50 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% head/left=\moveleft1cm\vbox to0pt{\vss\setbox0=\null\ht0=0pt\wd0=\paperwidth\dp0=\headheight\rlap{\colorbox{GhostWhite}{\box0}}}\vskip-\headheight t\,a\,b\,u\,\ \ i\,n\,d\,e\,x,
% }
%
+% \begin{thebibliography}{9}
+%
+% \bibitem{array}
+% \textit{A new implementation of \LaTeX's \textt{tabular} and \textt{array} environments} by Frank Mittelbach\\
+% 2008/09/09 v2.4c -- Tabular extension package (FMi) \\
+% \href{http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/array.html}{\nolinkurl{CTAN:help/Catalogue/entries/array.html}}
+%
+% \bibitem{varwidth}
+% \textit{The \xpackage{varwidth} package} by Donald Arseneau \\
+% 2009/03/30 ver 0.92 -- Variable-width minipages \\
+% \href{http://www.ctan.org/tex-archive/help/Catalogue/entries/varwidth.html}{\nolinkurl{CTAN:help/Catalogue/entries/varwidth.html}}
+%
+% \bibitem{enumitem-zref}
+% \textit{The \xpackage{enumitem-zref} package} by \FC \\
+% 2010/11/28 ver 1.1 -- Extended references for enumitem pkg \\
+% \href{http://www.ctan.org/tex-archive/help/Catalogue/entries/enumitem-zref.html}{\nolinkurl{CTAN:help/Catalogue/entries/enumitem-zref.html}}
+% \label{enumitem-zref}
+%
+% \end{thebibliography}
+%
+%
+%
% \begin{History}
%
+% \def\Version#1{\HistVersion{#1}\setitemize{name=#1,leftmargin=2em}\itemize}
+%
% \sectionformat\subsection[hang]{font=\large\bfseries\macrocodecolor}
%
+% \begin{Version}{2010/12/07 v1.5}
+% \item Implementation of negativ width coefficients for \textt X columns (cf. \refitem{tabu X columns,2}[\nameref*{tabu X columns} point \ref]).
+% \item Columns natural widths computation (for \textt{tabu spread} with \textt X columns and negativ coefficients)
+% is based on the code of the \xpackage{varwidth} package by Donald Arseneau.
+% \item \textt{longtabu} is now provided, based on the \xpackage{longtable} package by David Carlisle. \\
+% \textt{longtabu} can be used just like \textt{tabu}.
+% \item Vertical lines can be used whatever the catcode of \textbf\textbar\ is.
+% \item \csref{savetabu} reports saved informations in the \xext{log} (\hyperref[debugshow]{\textt{debugshow}} option).
+% \item \cs{savetabu} ... \cs{usetabu} now restores the \cs{halign} preamble rather than the \textt{tabu} preamble! \\
+% \csref{preamble} can be use in the \textt{tabu} preamble to restore a \texttt{tabu} preamble.
+% \item \csref{tabucline} is more robust with ``special'' preambles containing\, \texttbf>\, or\, \texttbf<\, tokens. \\
+% \cs{tabucline} now takes care of \cs{arrayrulecolor} (package \xpackage{colortbl}).
+% \item \Xpackage{enumitem-zref} package has been added to the documentation (see the link \refitem{2010/12/07 v1.5,1}[point 1])
+% \item Optimisation of some parts of the code.
+% \end{Version}
+%
% \begin{Version}{2010/11/22 v1.4}
% \item Compatibility improvement with \xpackage{linegoal} for the syntax: \\
% \cs{begin}\M*{tabu}\textt{ to\cs{linegoal}}\M*{...}
@@ -3720,13 +4331,12 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
% and also when \cs{minrowclearance} $>0$ (package \xpackage{colortbl}).
% \end{Version}
%
-%
% \begin{Version}{2010/10/28 v1.1}
% \item First version.
% \end{Version}
%
% \end{History}
-%
+%
%
% \PrintIndex
%
diff --git a/Master/texmf-dist/source/latex/tabu/tabu.ins b/Master/texmf-dist/source/latex/tabu/tabu.ins
index 889294e144a..ffce078a079 100644
--- a/Master/texmf-dist/source/latex/tabu/tabu.ins
+++ b/Master/texmf-dist/source/latex/tabu/tabu.ins
@@ -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
@@ -26,7 +26,7 @@
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
-\Msg{* Package: 2010/11/22 v1.4 - tabu: Flexible LaTeX tabulars}
+\Msg{* Package: 2010/12/07 v1.5 - tabu: Flexible LaTeX tabulars}
\Msg{************************************************************************}
\keepsilent
@@ -37,7 +37,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
@@ -60,7 +60,7 @@ Copyright (C) 2010 by Florent Chervet <florent.chervet@free.fr>
\file{tabu.sty}{\from{tabu.dtx}{package}}%
}
-\askforoverwritefalse
+\askforoverwritetrue
\generate{%
\file{tabu.drv}{\from{tabu.dtx}{driver}}%
}
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'.