From 63f449cec5129e9c1b8024681cc6b8ca3e3a35de Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 13 Nov 2010 00:24:40 +0000 Subject: new latex package tabu (12nov10) git-svn-id: svn://tug.org/texlive/trunk@20421 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/tabu/tabu.drv | 79 + Master/texmf-dist/source/latex/tabu/tabu.dtx | 3520 ++++++++++++++++++++++++++ Master/texmf-dist/source/latex/tabu/tabu.ins | 87 + 3 files changed, 3686 insertions(+) create mode 100644 Master/texmf-dist/source/latex/tabu/tabu.drv create mode 100644 Master/texmf-dist/source/latex/tabu/tabu.dtx create mode 100644 Master/texmf-dist/source/latex/tabu/tabu.ins (limited to 'Master/texmf-dist/source/latex/tabu') diff --git a/Master/texmf-dist/source/latex/tabu/tabu.drv b/Master/texmf-dist/source/latex/tabu/tabu.drv new file mode 100644 index 00000000000..403bd0672c8 --- /dev/null +++ b/Master/texmf-dist/source/latex/tabu/tabu.drv @@ -0,0 +1,79 @@ +%% +%% This is file `tabu.drv', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tabu.dtx (with options: `driver') +%% +%% This is a generated file. +%% +%% tabu : 2010/10/27 v1.1 - tabu : Flexible LaTeX tabulars +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% +%% This work consists of the main source file tabu.dtx +%% and the derived files +%% tabu.sty, tabu.pdf, tabu.ins +%% +%% tabu : Flexible LaTeX tabulars +%% Copyright (C) 2010 by Florent Chervet +%% +\edef\thisfile{\jobname} +\def\thisinfo{Flexible \LaTeX{} tabulars (\FC)} +\def\thisdate{2010/10/28} +\def\thisversion{1.1} +\def\CTANbaseurl{http://www.ctan.org/tex-archive/macros/latex} +\def\CTANdisplay{CTAN:macros/latex} +\makeatletter\protected\def\CTANhref{\@ifstar\CTANhrefstar\CTANhrefnost}\makeatother +\newcommand*\CTANhrefstar[3][/contrib/]{\href{\CTANbaseurl#1#2}{#3}} +\newcommand*\CTANhrefnost[2][/contrib/]{\href{\CTANbaseurl#1#2}{\nolinkurl{\CTANdisplay#1#2}}} +\let\loadclass\LoadClass +\def\LoadClass#1{\loadclass[abstracton]{scrartcl}\let\scrmaketitle\maketitle\AtEndOfClass{\let\maketitle\scrmaketitle}} +\PassOptionsToPackage{svgnames}{xcolor} +\documentclass[a4paper,oneside]{ltxdoc} +\AtBeginDocument{\DeleteShortVerb{\|}} +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{etoolbox,geometry,graphicx,xcolor,lastpage,lmodern,bbding,hologo,relsize,moresize,manfnt,xspace,numprint} +\usepackage[official]{eurosym} +\usepackage[expansion=all,stretch=20,shrink=60]{microtype} +\usepackage{tocloft,titlesec,hypbmsec,fancyhdr,enumitem,multirow,makecell,tabularx,booktabs,delarray,ragged2e,colortbl,marginnote,shapepar} +\heavyrulewidth=.7pt +\usepackage{holtxdoc,bookmark} +\usepackage{interfaces}[2010/10/31] +\usetikz{basic,chains,positioning} +\usepackage{embedfile} +\RequirePackage{amsopn,amsmath}% \DeclareMathOperator +\RequirePackage[a]{esvect}% for vectors +\DeclareMathOperator*\Div{div} +\DeclareMathOperator*\Rot{\vv{\text{rot}}} +\newrobustcmd*\dpartial[2]{\displaystyle\genfrac{}{}{}{}{\partial#1}{\partial#2}} +\usepackage{expl3,l3keys2e,siunitx} +\usepackage{xfrac} +\csname endofdump\endcsname +\CodelineNumbered +\usepackage{fancyvrb}\fvset{gobble=1,listparameters={\topsep=0pt}} +\usepackage[linegoal,debugshow]{tabu} +\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, + pdfstartview={FitH},%pdfpagemode=UseOutLines, + pdfkeywords={tex, e-tex, latex, package, tabular, array, halign, tabularx, longtable, color, colortbl, alignment}, + } +\embedfile{\thisfile.dtx} +\begin{document} + \DocInput{\thisfile.dtx} +\end{document} + +\endinput +%% +%% End of file `tabu.drv'. diff --git a/Master/texmf-dist/source/latex/tabu/tabu.dtx b/Master/texmf-dist/source/latex/tabu/tabu.dtx new file mode 100644 index 00000000000..cb70b0226da --- /dev/null +++ b/Master/texmf-dist/source/latex/tabu/tabu.dtx @@ -0,0 +1,3520 @@ +% \iffalse meta-comment +% tabu : 2010/10/27 v1.1 - tabu: flexible LaTeX tabulars] +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% +% This work consists of the main source file tabu.dtx +% and the derived files +% tabu.sty, tabu.pdf, tabu.ins +% +% Unpacking: +% (a) If tabu.ins is present: +% etex tabu.ins +% (b) Without tabu.ins: +% etex tabu.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{tabu.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (pdf)latex tabu.dtx +% Copyright (C) 2010 by Florent Chervet +%<*ignore> +\begingroup + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +% +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: 2010/10/27 v1.1 - tabu: Flexible LaTeX tabulars} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\let\MetaPrefix\relax +\preamble + +This is a generated file. + +tabu : 2010/10/27 v1.1 - tabu : Flexible LaTeX tabulars + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt + +This work consists of the main source file tabu.dtx +and the derived files + tabu.sty, tabu.pdf, tabu.ins + +tabu : Flexible LaTeX tabulars +Copyright (C) 2010 by Florent Chervet + +\endpreamble +\let\MetaPrefix\DoubleperCent + +\generate{% + \file{tabu.ins}{\from{tabu.dtx}{install}}% + \file{tabu.sty}{\from{tabu.dtx}{package}}% +} + +\askforoverwritefalse +\generate{% + \file{tabu.drv}{\from{tabu.dtx}{driver}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* tabu.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `tabu.dtx'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +% +%<*ignore> +\fi +% +%<*driver> +\edef\thisfile{\jobname} +\def\thisinfo{Flexible \LaTeX{} tabulars (\FC)} +\def\thisdate{2010/10/28} +\def\thisversion{1.1} +\def\CTANbaseurl{http://www.ctan.org/tex-archive/macros/latex} +\def\CTANdisplay{CTAN:macros/latex} +\makeatletter\protected\def\CTANhref{\@ifstar\CTANhrefstar\CTANhrefnost}\makeatother +\newcommand*\CTANhrefstar[3][/contrib/]{\href{\CTANbaseurl#1#2}{#3}} +\newcommand*\CTANhrefnost[2][/contrib/]{\href{\CTANbaseurl#1#2}{\nolinkurl{\CTANdisplay#1#2}}} +\let\loadclass\LoadClass +\def\LoadClass#1{\loadclass[abstracton]{scrartcl}\let\scrmaketitle\maketitle\AtEndOfClass{\let\maketitle\scrmaketitle}} +\PassOptionsToPackage{svgnames}{xcolor} +\documentclass[a4paper,oneside]{ltxdoc} +\AtBeginDocument{\DeleteShortVerb{\|}} +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{etoolbox,geometry,graphicx,xcolor,lastpage,lmodern,bbding,hologo,relsize,moresize,manfnt,xspace,numprint} +\usepackage[official]{eurosym} +\usepackage[expansion=all,stretch=20,shrink=60]{microtype} +\usepackage{tocloft,titlesec,hypbmsec,fancyhdr,enumitem,multirow,makecell,tabularx,booktabs,delarray,ragged2e,colortbl,marginnote,shapepar} +\heavyrulewidth=.7pt +\usepackage{holtxdoc,bookmark} +\usepackage{interfaces}[2010/10/31] +\usetikz{basic,chains,positioning} +\usepackage{embedfile} +\RequirePackage{amsopn,amsmath}% \DeclareMathOperator +\RequirePackage[a]{esvect}% for vectors +\DeclareMathOperator*\Div{div} +\DeclareMathOperator*\Rot{\vv{\text{rot}}} +\newrobustcmd*\dpartial[2]{\displaystyle\genfrac{}{}{}{}{\partial#1}{\partial#2}} +\usepackage{expl3,l3keys2e,siunitx} +\usepackage{xfrac} +\csname endofdump\endcsname +\CodelineNumbered +%\OnlyDescription +\usepackage{fancyvrb}\fvset{gobble=1,listparameters={\topsep=0pt}} +\usepackage[linegoal,debugshow]{tabu} +\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, + pdfstartview={FitH},%pdfpagemode=UseOutLines, + pdfkeywords={tex, e-tex, latex, package, tabular, array, halign, tabularx, longtable, color, colortbl, alignment}, + } +\embedfile{\thisfile.dtx} +\begin{document} + \DocInput{\thisfile.dtx} +\end{document} +% +% \fi +% +% \CheckSum{3457} +% +% \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 +% Lower-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 +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs,\~,\@ifpackagelater,\z@,\@ne,\@@} +% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo} +% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage} +% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage} +% \DoNotIndex{\filename,\fileversion,\filedate,\let} +% \DoNotIndex{\@listctr,\@nameuse,\csname,\else,\endcsname,\expandafter} +% \DoNotIndex{\gdef,\global,\if,\item,\newcommand,\nobibliography,\newrobustcmd,\renewrobustcmd,\providerobustcmd} +% \DoNotIndex{\par,\providecommand,\relax,\renewcommand,\renewenvironment} +% \DoNotIndex{\stepcounter,\usecounter,\nocite,\fi} +% \DoNotIndex{\@fileswfalse,\@gobble,\@ifstar,\@unexpandable@protect} +% \DoNotIndex{\AtBeginDocument,\AtEndDocument,\begingroup,\endgroup} +% \DoNotIndex{\frenchspacing,\MessageBreak,\newif,\PackageWarningNoLine,\@addtopreamble,\@depth,\@height,\@width,\@firstofone,\@frameb@x,\@lastchclass,\@M,\m,\@nextchar,\@startpbox} +% \DoNotIndex{\protect,\string,\xdef,\ifx,\texttt,\@biblabel,\bibitem,\@tempa,\{,\},\^,\ ,\DeclareOption,\CT@end,\CT@arc@,\count@,\col@sep,\endgraf,\dimexpr,\fbox,\fboxsep,\g@addto@macro} +% \DoNotIndex{\z@,\wd,\vrule,\voidb@x,\verb,\bibitem,\NC@rewrite@,\NC@list,\NC@do,\NC@,\nobreak,\number,\showbox,\tabu@AtEnd,\tabu@getnbc@ls,\tabu@s@nitizetext} +% \DoNotIndex{\FrameCommand,\MakeFramed,\FrameRestore,\hskip,\hfil,\hfill,\hsize,\hspace,\hss,\hbox,\hb@xt@,\endMakeFramed,\escapechar,\tabu@s@veX,\tabu@sett@rget,\tabu@stack} +% \DoNotIndex{\do,\date,\if@tempswa,\@tempdima,\@tempboxa,\@tempswatrue,\@tempswafalse,\ifdefined,\ifhmode,\ifmmode,\cr} +% \DoNotIndex{\box,\author,\advance,\multiply,\Command,\outer,\next,\leavevmode,\kern,\title,\toks@,\trcg@where,\tt} +% \DoNotIndex{\the,\width,\star,\space,\section,\subsection,\textasteriskcentered,\textwidth,\stform} +% \DoNotIndex{\",\:,\@empty,\@for,\@gtempa,\@latex@error,\@namedef,\@nameuse,\@tempa,\@testopt,\@width,\\,\m@ne,\makeatletter,\makeatother} +% \DoNotIndex{\maketitle,\parindent,\x,\kernel@ifnextchar} +% \DoNotIndex{\DefineShortVerb,\DeleteShortVerb,\UndefineShortVerb,\MakeShortVerb,\endinput,\@eha,\@ehd,\@nil,\@nnil,\@ifundefined,\@ifpackagelater,\@ifpackageloaded} +% \DoNotIndex{\p@,\tracingtabu,\@ne,\tw@,\m@ne,\z@skip} +% \makeatletter +% \newrobustcmd\ClearPage{\@ifstar\clearpage{}} +% \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\Underbrace#1_#2{$\underbrace{\vtop to2ex{}\hbox{#1}}_{\footnotesize\hbox{#2}}$} +%\def\FV@DefineCommandChars #1#2#3{% +% \edef\FV@restoreCommandChars{% +% \catcode`#1\the\catcode`#1\relax +% \catcode`#2\the\catcode`#2\relax +% \catcode`#3\the\catcode`#3\relax}% +% \def \FV@CommandChars {\catcode `#1=0\relax \catcode `#2=1\relax \catcode `#3=2\relax }% +% \output\expandafter{\expandafter\FV@restoreCommandChars\the\output}% +%} +% \parindent\z@\parskip.4\baselineskip\topsep\parskip\partopsep\z@\leftmargini=2.5cm +% \widowpenalty=5000\clubpenalty=8000 +% \newrobustcmd*\macrocodecolor{\color{macrocode}}\definecolor{macrocode}{rgb}{0.05,0.02,0.07} +% \def\macro@font{\changefont{fam=lmtt,size-=1pt,color=macrocode,spread=1}\let\AltMacroFont\macro@font} +% \def\MacroFont{\changefont{fam=lmtt,color=macrocode}} +% \g@addto@macro\@list@extra{\parsep\parskip\topsep\z@\itemsep\z@} +% \def\texorpdf#1#2{\texorpdfstring{#1{#2}}{#2}} +% \def\textitbf#1{\textbf{\itshape#1}}\let\textbfit\textitbf +% \DefineVerbatimEnvironment{VerbLines}{Verbatim}{gobble=1,frame=lines,framesep=6pt,fontfamily=\ttdefault,fontseries=m} +% \DefineVerbatimEnvironment{VerbLines*}{Verbatim}{gobble=1,frame=lines,framesep=6pt,fontfamily=\ttdefault,fontseries=m,commandchars=$()} +% \DefineVerbatimEnvironment{Verb}{Verbatim}{gobble=1,fontfamily=\ttdefault,fontseries=m} +% \DefineVerbatimEnvironment{Verb*}{Verbatim}{gobble=1,fontfamily=\ttdefault,fontseries=m,commandchars=$()} +% \def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}} +% \def\ttdefault{lmvtt} +% \renewrobustcmd\#[1]{{\usefont{T1}{pcr}{bx}{n}\char`\##1}} +% \renewrobustcmd*\cs[2][]{\mbox{\ttfamily#1\expandafter\@gobble\string\\#2}} +% \newrobustcmd*\csbf[2][]{\textbf{\cs[{#1}]{#2}}} +% \newrobustcmd\textttbf[1]{\textbf{\texttt{#1}}} +% \newrobustcmd*\blue{\color{blue}}\newcommand*\red{\color{dr}}\newcommand*\green{\color{green}}\newcommand\rred{\color{red}} +% \newrobustcmd*\FC[1][\color{copper}]{{#1\usefont{T1}{fts}xn FC}} +% \colorlet{pkgcolor}{teal} \def\pkgcolor{\color{pkgcolor}} +% \definecolor{copper}{rgb}{0.67,0.33,0.00} \newcommand\copper{\color{copper}} +% \definecolor{dg}{rgb}{0.02,0.29,0.00} \newcommand\dg{\color{dg}} +% \definecolor{db}{rgb}{0,0,0.502} \newcommand\db{\color{db}} +% \definecolor{dr}{rgb}{0.75,0.00,0.00} \let\dr\red +% \definecolor{lk}{rgb}{0.25,0.25,0.25} \newrobustcmd\lk{\color{lk}} +% \definecolor{llk}{rgb}{0.40,0.40,0.40} +% \newrobustcmd\bk{\color{black}}\newcommand\md{\mdseries} +% \newrobustcmd\ie{\emph{ie.}} +% \newcommand\textt[1]{\texorpdf\texttt{#1}} +% \newrobustcmd\texttbf[2][]{\texttt{\bfseries#1#2}} +% \newcommand\cellstrut{}\let\cellstrut\bottopstrut +% \newrobustcmd\etc{{\bk\emph{etc.}}} +% \def\M{\@ifstar{\M@i\@firstofone}{\M@i\meta}} +% \def\M@i#1{\@ifnextchar[^^A] +% {\M@square#1} +% {\@ifnextchar(^^A) +% {\M@paren#1} +% {\M@brace#1}}^^A +% } +% \def\M@square#1[#2]{\M@Bracket[{#1{#2}}]} +% \def\M@paren#1(#2){\M@Bracket({#1{#2}})} +% \def\M@brace#1#2{\M@Bracket\{{#1{#2}}\}} +% \def\M@Bracket#1#2#3{{\ttfamily#1#2#3}} +% \newrobustcmd*\thisyear{\begingroup +% \def\thisyear##1/##2\@nil{\endgroup +% \oldstylenums{##1\ifnum##1=\year\else\,\textendash\,\the\year\fi}% +% }\expandafter\thisyear\thisdate\@nil +% } +% \renewrobustcmd\declcs[2][]{^^A +% \par\addvspace\parskip^^A{.5ex plus 1ex}\noindent +% \goodbreak +% \noindent\larger\changefont{spread=1}^^A +% \hspace{-\leftmargini}^^A +% \def\*{\unskip\,\texttt{*}}^^A +% \begin{tabular}{|l|}^^A +% \hline +% \expandafter\SpecialUsageIndex\csname #2\endcsname +% \raisedhyperdef[8pt]{declcs}{#2}{\cs[{#1}]{#2}}^^A +% }^^A +% \renewcommand\enddeclcs{% +% \crcr \hline +% \end{tabular}% +% \nobreak \par \nobreak +% \noindent +% \ignorespacesafterend +% } +% \def\declmargin{\hspace*{\dimexpr-\leftmargini+\arrayrulewidth+\tabcolsep}} +% \pretocmd\textasteriskcentered{\usefont{OMS}{cmsy}mn}{}{} +% \bookmarksetup{open=true,openlevel=3} +% \pagesetup{% +% head/rule/width=.0pt, +% left/offset=3cm,foot/left/offset+=.5cm,right/offset=1cm, +% head/font=\scriptsize, +% head/color=LightSteelBlue, +% head/left=\moveleft1cm\vbox to\z@{\vss\setbox0=\null\ht0=\z@\wd0=\paperwidth\dp0=\headheight\rlap{\colorbox{GhostWhite}{\box0}}}\vskip-\headheight\thispackage, +% head/right=Flexible \LaTeX{} tabulars, +% foot/font=\lk\scriptsize, +% foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\copyright\,\thisyear\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC}}}}, +% foot/right=\oldstylenums{\arabic{page}} / \oldstylenums{\pageref{LastPage}}% +% } +% \pagesetup[plain]{% +% norules,font=\scriptsize, +% foot/right=\oldstylenums{\arabic{page}} / \oldstylenums{\pageref{LastPage}}, +% left/offset=3cm,foot/left/offset+=.5cm,right/offset=1cm, +% 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} +% \sectionformat\section{ +% mark=\marksthe{section}{#1}, +% left=\dimexpr-\leftmargini+\arrayrulewidth+\tabcolsep\relax, +% top=\medskipamount, +% bottom=\smallskipamount, +% font=\normalfont\Large\bfseries, +% bookmark={bold,color=[rgb]{0.02,0.05,.2}}, +% break=\goodbreak} +% \sectionformat\subsection{% +% top=\medskipamount, +% bottom=.5\smallskipamount, +% bookmark={color=[rgb]{0.02,0.05,.1}}, +% font=\normalfont\Large\bfseries, +% break=\addpenalty{-\@highpenalty}} +% \sectionformat\subsubsection{ +% bookmark={italic=false,color=lk}, +% font=\normalfont\large\bfseries\lk, +% label=, +% top=\medskipamount, +% bottom=.5\smallskipamount, +% break=\addpenalty{-\@medpenalty}} +% \setitemize{itemsep=\parskip,topsep=0pt,labelsep=1em,parsep=0pt} +% \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} +% \pagesetup*{ +% left/offset+=1cm,right/offset-=1cm, +% head/color=Lavender, +% 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 +% ^^A\tocsetup{depth-=1} +% \sectionformat\section{bookmark/color=black}\sectionformat\subsection{bookmark/color=black} +% \bookmarksetup{bold*,openlevel=3} +% \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{}}% +% \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@}{}{} +% \apptocmd\endmacro{\goodbreak\vskip.3\parskip}{}{} +% +% \definecolor{reflink}{rgb}{0.95,0.00,0.05} +% \definecolor{reflink}{rgb}{0.05,0.00,0.95} +% \newrobustcmd\stform{\@ifnextchar*{\@stform[]\textasteriskcentered\@gobble}\@stform} +% \newrobustcmd\@stform[2][\string]{\textttbf{#1#2}\xspace} +% +% \makeatother +% +% +% \deffootnote{1em}{0pt}{\rlap{\textsuperscript{\thefootnotemark}}\kern1em} +% +% \title{\vspace*{-28pt}\mdseries {\HUGE\bfseries\sffamily t\,a\,b\,u\,}} +% \date{} +% \author{\small\thisdate~--~version \thisversion} +% \subtitle{\LARGE Flexible \LaTeX{} tabulars\endgraf {\small\FC}} +% \maketitle +% +% +% +% \makeatletter\begingroup\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 +% +% \deffootnote{1em}{0pt}{\rlap{\thefootnotemark.}\kern1em} +% +% {\let\quotation\relax\vspace*{-1cm}% +% \begin{abstract}\parskip\medskipamount\parindent0pt\lastlinefit0\leftskip1cm\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 extend 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 provide 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. +% +% \xpackage{tabu} requires \eTeX, the standard package \xfile{array.sty} and no other package. +% +% \end{abstract}} +% +% \makeatletter +% \tocsetup{ +% dot=$\scriptscriptstyle\ldotp$, +% dotsep=1mu, +% title/bottom=6pt, +% title=Contents\quad\leaders\vrule height3.1pt depth-3pt\hfill\null, +% bookmark={text=Contents,bold}, +% after=\leavevmode\hrule height3.1pt depth-3pt, +% twocolumns=false, +% section/skip=4pt plus2pt minus2pt, +% section/leaders=\leaders\hbox{$\m@th\mkern1mu\hbox{$\mathbf\ldotp$}\mkern1mu$}\hfill, +% section/dotsep, +% subsection/skip=0pt plus2pt minus 2pt, +% subsubsection/font=\slshape, +% subsubsection/pagenumbers=off, +% subsubsection/skip-=1pt,subsubsection/numwidth-=4pt, +% }\makeatother +% +% {% +% \hypersetup{linkcolor=black} +% \tableofcontents +% } +% +% \clearpage +% \changefont{spread*=1.1} +% +% \bottomtitles=.3\textwidth +% \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} \\ +% \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. +% \textt{tabu} improves \textt{tabular} and \textt{array}: +% \begin{itemize} +% \item footnotes and index words are allowed inside \textt{tabu} +% \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. +% \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*}, +% \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 of line widths, inserting verbatim text... +% \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}, +% \xpackage{makecell}, \xpackage{booktabs}, \xpackage{siunitx}, \xpackage{dcolumn}, \xpackage{warpcol}, +% \etc\ is fine too. +% When you are inside a \textt{tabu} environment, you can use \cs{raggedleft}, \cs{raggedright} +% and \cs{centering} without special care about \cs{arraybackslash} and conversely \string\\\ has its +% ``normal'' meaning inside a list of items that may appear in a \textt X column... +% \end{itemize} +% +% \bigskip +% +% \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 +% ``\textt{tabu to}'' fills in width the specified \meta{dimen}. +% +% \bigskip +% +% \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{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]} \\ +% 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 +% 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} +% \rowfont{\bfseries\ttfamily} Modifier & Meaning & Default \\ +% \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 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*} +% and \textt{tabularx}. As long as \textt{tabu} with \textt X columns has a \emph{default target}, nesting \textt{tabu} +% with \textt X columns is easy. Furthermore, the default global alignment of a nested \textt{tabu} is \textt t +% (for \textt{top}) while the default global alignment of a \textt{tabu} in a paragraph is \textt c (for \textt{centered}). +% ^^AWhen nested inside another \textt{tabu}, \textt{tabu} takes care not to add duplicate margins around its cells... +% \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, +% 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}. +% \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}: +% 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. +% \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}''} +% +% \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 +% are of equal widths and the widths of columns 3 and 4 are only one half. As possible solution: +% +% \begin{Verb*} +% \begin{tabu} to\linewidth{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline +% 1 & 2 & 3 & 4 & 5 & 6 \\\hline +% \end{tabu} +% \end{Verb*} +% +% \medskip +% +% \begin{tabu} to\linewidth{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline +% 1 &2 &3 &4 &5 &6 \\\hline +% \end{tabu} +% +% \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 +% +% \begin{Verb*} +% \begin{tabu} spread 0pt{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline +% 1 & 2 & 3 & 4 & 5 & 6 \\\hline +% \end{tabu} +% \end{Verb*} +% +% {\centering +% \begin{tabu} spread0pt{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline +% 1 & 2 & 3 & 4 & 5 & 6 \\\hline +% \end{tabu}\par} +% +% \bigskip +% +% But now it's definitely too narrow, then give it some more space: +% +% \begin{Verb*} +% \begin{tabu} spread 2in{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline +% 1 & 2 & 3 & 4 & 5 & 6 \\\hline +% \end{tabu} +% \end{Verb*} +% +% {\centering +% \begin{tabu} spread2in{|X[2]|X[2]|X|X|X[2]|X[2]|} \hline +% 1 & 2 & 3 & 4 & 5 & 6 \\\hline +% \end{tabu}\par} +% +% \bigskip +% +% \textt{tabu spread} is useless with long columns: the following tabular was made with this preamble: +% \begin{Verb*} +% \begin{tabu} spread 3cm{@{}X[9]X[4]|X|} +% \end{Verb*} +% +% +% {\footnotesize +% \begin{tabu} spread 3cm{@{}X[9]>{\parskip=5pt}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; +% from film and television to the public library, and now over the Internet. +% He long ago transcended the boundaries of 19th Century London 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 +% 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} +% \end{tabu}} +% +% In the preamble, \textt{@\M*{}} means that you remove the margin. +% +% +% \subsubsection{Nesting \textt{tabu}{\texorpdf\small s} with \textt X columns} +% +% This section should contain some examples but I've no time presently... +% +% \subsection{Lines inside \textt{tabu}} +% +% \subsubsection{First important remarks} +% +% The features provided in this section are quite experimental: they are not generally taken for good typography. +% You can use \xpackage{tabu} with package \xpackage{booktabs} for example, which provides properly designed +% commands for horizontal rules in tabulars. \xpackage{arydshln} is pretty good too, but it modifies a huge +% amount of macros of \xfile{array.sty}, something that \thispackage does not. +% +% Lines in \textt{tabu} printed in this document are mostly made with \xpackage{booktabs}. +% +% +% \subsubsection(Vertical lines){Vertical lines: \textt\textbar\ has an optional parameter} +% +% 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). +% Example: +% +% {\tabcolsep=3pt +% \begin{tabu}to\linewidth{@{}X[3mc]X[3m]X[6m]@{}} \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{ +% \begin{tabu}{||[5pt]|c|c||[5pt]|}^^@ +% Hello & World^^@ +% \end{tabu}} +% \\ \midrule +% \begin{tabu}{||[5pt,red]|c|c||[5pt blue]|} +% Hello & World +% \end{tabu} +% & +% The \textt{tabu} you see on left was made with the code displayed on the right. +% & +% \verbatim{ +% \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...?} +% \end{tabu}} +% +% Note that it is always a good idea to protect the optional argument with braces: \M*[\M*{...}]. +% But it's not necessary because \thispackage takes care the \textt\textbar\ token to be rewritten +% before any other column type (just after \stform* however, for obvious reasons). But if you +% use the optional argument for the vertical line into a user-defined column type +% (declared with \cs{newcolumntype} for example), you can get an error. In this case, +% it is compulsory to protect the optional argument by braces. Finally, it's not very often +% that a user-column type contains a vertical bar... +% +% +% \subsubsection(Horizontal lines){More style for horizontal lines: \cs{tabucline}} +% +% \begin{declcs}{tabucline}\M[style or spec.]\M*{start-end}\\ +% \end{declcs} +% +% \cs{tabucline} is an attempt to give a versatile command to make horizontal lines: +% \begin{itemize} +% \item \cs{tabucline} is pretty good with vertical lines even if the thickness of the line grows up, +% \item \cs{tabucline} takes care of \cs{extrarowheight}, +% \item \cs{tabucline} can make horizontal dashed lines, with a \xpackage{pgf}/\xpackage{TikZ} syntax:\\ +% \cs{tabucline}\M*[\meta{width} on\meta{dash} off\meta{gap}]\M*{\meta{first column}-\meta{last column}} +% \item alternatively, you can give \cs{tabucline} a \cs{hbox} to make a leader with it: The \meta{\ttfamily spec.} must then +% begin with \cs{hbox}, \cs{box} or \cs{copy}, +% \item finally you can give \cs{tabucline} a color \emph{name}, after the line specification. +% \end{itemize} +% +% +% +% Any parameter can be omitted. \tabulinestyle{tabucline=.4pt on2pt off1.5pt} +% +% {\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} +% \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 +% stops at column 2. \\ \tabucline[1pt on 1.5pt off 2pt]{1-4} \margintext{[1pt on 1.5pt off 2pt]} +% \cs{tabucline}\M*[1.5pt]\M*{-} & draws a horizontal solid line of width \textt{1.5pt} between the first +% and the last column. \\ \tabucline[1.5pt]{-} \margintext{[1.5pt]} +% \cs{tabucline}\M*{2-} & draws a horizontal solid line of width \cs{arrayrulewidth} between the second +% 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). +% \\ \tabucline[on 2pt red]{-5} \margintext{[on 2pt red]} +% \end{tabu} +% \end{center}} +% +% \begin{declcs}{tabucline}\stform*\M[style or spec.]\M*{start-end} +% \end{declcs} +% +% For fine tuning, the star form \cs{tabucline}\stform* can be used to keep the vertical lines that might +% cross the horizontal line. As a consequence, the content of special \textt @ of \textt ! columns +% will interrupt the horizontal line either. This might be usefull when \cs{extrarowheight} is high. +% Example: +% +% {\makeatletter +% \begin{tabu}{*3{X[mc]}} +% \extrarowheight=8pt +% \begin{tabu}{|[1pt]X|X|[1pt]} \tabucline- +% Hello & world \\ \tabucline[1pt on 2pt off 2pt,blue]- +% Hello & world \\ \tabucline- +% \end{tabu} +% & +% \extrarowheight=8pt +% \begin{tabu}{|[1pt]X|X|[1pt]} \tabucline*- +% Hello & world \\ \tabucline*[1pt on 2pt off 2pt blue]- ^^A\tabucline*[3pt on 3pt off 3pt]- +% Hello & world \\ \tabucline*- +% \end{tabu} +% & +% \extrarowheight=8pt +% \begin{tabu}{|[1pt]X|X|[1pt]} \firsthline +% Hello & world \\ \hline +% Hello & world \\ \lasthline +% \end{tabu} \\ +% \extrarowheight=0pt +% \cs{tabucline} +% & \cs{tabucline}\stform* +% & \cs{firsthline} and \cs{hline} and \cs{lasthline} \\ +% \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}\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... +% +% \pagebreak +% \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 +% \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*{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} +% +% \begin{tabu}{*{3}{X[cm]}} +% \tabcolsep=2pt +% \begin{tabu}{|l|l|} \tabucline[.4pt on 1pt off 3pt]{-} +% \multicolumn{2}{|c|}{Dashed or dotted} \\ \tabucline[1pt on2pt off1pt]{-} +% And below & is the default \\ \tabucline[on 4pt]- +% \end{tabu} +% & +% \tabcolsep=2pt +% \begin{tabu}{|c|c|} \tabucline[.4pt off 2pt]{-} +% Dash & Gap \\ \tabucline[10pt on2pt off 1pt]{1-1} +% \multicolumn{2}{|c|}{This one was thick} \\ \tabucline[3pt]- +% \end{tabu} +% & +% \tabcolsep=2pt +% \begin{tabu}{|X[cm]|X[cm]|X[2cm]|} \tabucline[.4pt on6pt off 2pt]{-} +% Dash & Gap... & ...or leader \\ \tabucline[\hbox{\small\kern1pt\ScissorRight\vrule width3.4pt depth-5pt height5.4pt\kern1pt\vrule width3.4pt depth-5pt height5.4pt\kern1pt}]- +% \multicolumn{3}{|c|}{Interesting ?} \\ \tabucline- +% \end{tabu} +% \end{tabu} +% +% \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 +% +% \normalsize +% +% +% \subsection{\textt{tabu} in math mode} +% +% { +% \extrarowheight=3pt +% \begin{tabu} to\linewidth{X[1.5]X[r$]} \toprule +% On the left, you can see the famous Maxwell-Lorentz equations for electromagnetic field in vacuum, +% publicated in \oldstylenums{1873}. +% & +% \hfil\begin{tabu}({>{\Gape[8pt]\displaystyle}r>{\displaystyle}l}. +% \Div\vv E &= \frac{\rho}{\epsilon_0} \\ +% \Div\vv B &= 0 \\ +% \Rot\vv E &= - \dpartial{\vv B} t \\ +% \Rot\vv B &= \mu_0 \vv j + \mu_0 \epsilon_0\, \dpartial{\vv E} t +% \end{tabu} +% \\ \bottomrule +% \end{tabu}} +% +% In this example, the big \textt{tabu} is: \cs{begin}\M*{tabu} to\cs{linewidth}\M*{X[1.5]X[r\$]}. +% +% The nested \textt{tabu} (in math mode) uses \xpackage{delarray} shortcut: its preamble is: +% \begin{Verb} +% \begin{tabu}({>{\Gape[8pt]\displaystyle}r>{\displaystyle}l}. +% \end{Verb} +% +% You immediately see the interest for \textt{tabu} to have a default target. +% +% \cs{Gape} is a \xpackage{makecell} macro to adjust the height and depth of the rows. +% +% Horizontal rules are \xpackage{booktabs} \cs{toprule}, \cs{midrule} and \cs{bottomrule}. +% +% \begin{tabu}{@{}*3{X[c]@{}}} \toprule \savetabu{math} +% \rowfont{\bfseries} \textt{array} & \textt{tabu} & \textt{tabu spread 1em} \\ \midrule +% $\begin{array}[t]|{cc}| +% \alpha & \beta \\ +% \gamma & \delta +% \end{array}$ +% & +% $\begin{tabu}|{cc}| +% \alpha & \beta \\ +% \gamma & \delta +% \end{tabu}$ +% & +% $\begin{tabu} spread 1em|{cc}| +% \alpha & \beta \\ +% \gamma & \delta +% \end{tabu}$ +% \\ \bottomrule +% \end{tabu} +% +% +% Here, vertical lines are made with \xpackage{delarray} shortcuts:\hfill +% \verb+$\begin{tabu} spread 1em |{cc}|+ +% +% \begin{tabu}{\usetabu{math}} +% \multicolumn2{@{}l}{Vertical lines inside the tabular preamble gives:} +% & +% $\begin{tabu} spread 1em[c]{|cc|} +% \alpha & \beta \\ +% \gamma & \delta +% \end{tabu}$ +% \end{tabu} +% +% \bigskip +% {\raggedleft\footnotesize\lk This was an example of \cs{savetabu}...\cs{usetabu} to keep the alignment.\par} +% +% +% \subsection{Verbatim inside \textt{tabu} with \textt X columns} +% +% 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 +% width is reached. Such trials require to collect the content of the \textt{tabu} environment. +% Therefore, the category codes of the characters read in the environment are fixed, and \cs{verb} +% commands are not allowed. +% +% \begin{declcs}{verbatim}\M{general text} +% \end{declcs} +% +% To get round this limitation, \textt{tabu} provides the command \cs{verbatim} which allows to put +% some pieces of verbatim text inside a \textt{tabu}: it is based on \eTeX{} \cs{scantokens} primitive +% and is defined only inside the \textt{tabu} environment. \cs{verbatim} has some other limitations +% you must know: +% +% +% \begin{tabu}to\linewidth{>{\ttfamily\centering}p{3cm}p{\dimexpr\linewidth-3cm-4\tabcolsep}} \toprule +% \verb+^^@+ &can be used to get a carriage return inside \cs{verbatim} \\ +% \verb+^+ &consequently \verb+^+ is a normal subscript character \\ +% \verb+{+ \verb+}+ &curly braces must be equilibrated \\ +% \% &The percent character\, \%\, is for commentaries: the content of the +% environment is collected before \cs{verbatim} does its job, therefore commentaries are +% removed... +% \\\bottomrule +% \end{tabu} +% +% If you need more verbatim inside a \textt{tabu} environment: +% \begin{itemize} +% \item you should avoid the use of \textt X columns +% \item or if you really want to use \textt X columns, you must save your verbatim text before the \textt{tabu}, +% for example with the \textt{SaveVerbatim} environment provided by the package \xpackage{fancyvrb}. +% \end{itemize} +% +% +% +% \subsection(Numbers in tabu){Printing numbers inside \textt{tabu} with \xpackage{numprint} and \xpackage{siunitx}} +% +% \subsubsection{Just make it easy !} +% +% \thispackage provides a \emph{facility} to print numbers inside columns. This facility is not +% implemented to replace \xpackage{siunitx} \textt S and \textt s columns or \xpackage{numprint} +% \textt n and \textt N columns or other packages that provide alignment such as \xpackage{warpcol}, +% \xpackage{dcolumn} or \xpackage{rccol}. It just make +% easy to apply a macro you get already on each number in a column of a \textt{tabu}. +% +% \cs{tabudecimal} has been developped mainly because it makes possible to align numbers inside \textt{tabu X} columns. +% +% \begin{declcs}{tabudecimal}\M{user-macro} +% \end{declcs} +% +% \cs{tabudecimal} can be used in the preamble of a \textt{tabu} before a column specification. +% The \meta{user-macro} is a macro with one parameter that have to be defined before. +% +% \medskip +% +% Example with \csbf{numprint}: +% +% +% \begin{Verb*} +% \def\usermacro#1{\numprint[\officialeuro]{\zap@space #1 \@empty}} +% \nprounddigits{2} \npprintnull \npthousandsep{\,} \npunitseparator{~} +% \end{Verb*} +% +% \begin{SaveVerbatim}{tabudecimal} +% \begin{tabu}{*2{>{\tabudecimal\usermacro}r}} +% 12.324 &745.32 \\ +% 21.13 &0 \\ +% 213.3245 &12.342 \\ +% 322143.12 &324.325 \\ +% \end{tabu} +% \end{SaveVerbatim} +% +% \nprounddigits{2} \npprintnull \npthousandsep{\,} \npunitseparator{~} +% \makeatletter \let\npunitcommand\@firstofone +% \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{ +% \rowfont[c]{\bf} January & February \\ ^^@ +% 12.324 & 745.32 \\ ^^@ +% 21.13 & 0 \\ ^^@ +% 213.3245 & 12.342 \\ ^^@ +% 2143.12 & 324.325 \\ ^^@ +% \end{tabu}} +% & +% \begin{tabu}{|[GreenYellow]*2{>{\tabudecimal\usermacro}X[r]|[GreenYellow]}c} \tabucline[1pt GreenYellow]- +% \rowfont[c]\bf January &February & ...\\ \tabucline[1pt on2pt GreenYellow]- +% 12.324 &745.32 & ... \\ +% 21.13 &0 & ... \\ +% 213.3245 &12.342 & ... \\ +% 2143.12 &324.325 & ... \\ \tabucline[1pt GreenYellow]- +% \end{tabu} +% \end{tabu} +% +% \medbreak +% +% Example with \csbf{SI}: +% +% \begin{Verb*} +% \def\usermacro#1{\SI[group-four-digits=true, % thousand separator +% round-mode=places, % round numbers +% round-precision=2, % with 2 decimal digits +% round-integer-to-decimal=true, % add trailing 0 if necessary +% per-mode=symbol]{#1}{\officialeuro\per\kilo\gram}} +% \begin{tabu}spread 0pt{|[GreenYellow]*2{>{\tabudecimal \usermacro}X[r]|[GreenYellow]}} .... +% \end{Verb*} +% +% +% \def\usermacro#1{\SI[group-four-digits=true, +% round-mode=places, +% round-precision=2, +% round-integer-to-decimal=true, +% per-mode=symbol]{#1}{\officialeuro\per\kilo\gram}} +% \begin{tabu}{*2{X}} +% \begin{tabu}spread 0pt{|[GreenYellow]*2{>{\tabudecimal\usermacro}X[r]|[GreenYellow]}c} \tabucline[1pt GreenYellow]- +% \rowfont[c]\bf January &February &... \\\tabucline[1pt on2pt GreenYellow]- +% 12.324 &745.32 &... \\ +% 21.13 &0 &... \\ +% 213.3245 &12.342 &... \\ +% 2143.12 &324.325 &... \\\tabucline[1pt GreenYellow]- +% \end{tabu} +% & +% As you can see, the columns widths are exactly the same, whatever their content. +% \end{tabu} +% +% \subsubsection{You should know how it works...} +% +% Yes you should know how it works to avoid problems. \textt{tabu} has a small scanner +% based on \cs{futurelet} to grab all numbers, blank spaces, commas and dots $+$ and $-$ sign +% and also the letter \textt e and \textt E for exponants. +% The scanner stops as soon as something else than a number, blank space, comma, dot, $+$, $-$, \textt e, \textt E +% is found, and even if it is a macro that contains a number. +% +% This explains why there is \cs{zap@space} in the definition of \cs{usermacro}: because the scanner +% scans blank spaces and because \cs{numprint} does not allow blank spaces in its mandatory argument, +% quite strangely... +% + +% +% +% +% \subsection{\texorpdf\xpackage{delarray} shortcuts} +% +% When you enclose your tabular with math delimiters using \xpackage{delarray} shortcuts, +% \xpackage{tabu} tries to reach its target for the whole: the tabular and the delimiter(s). +% You can see the difference: +% +% {\centering +% \extrarowheight=8pt +% \begin{tabu}to .6\linewidth{X[m]} \toprule +% +% \extrarowheight=0pt +% \begin{tabu}({X}) +% This is \textt{tabu} with \xpackage{delarray} shortcut for parenthesis around +% \end{tabu} +% \\ \tabucline[1pt on2pt blue]- +% +% \extrarowheight=0pt +% \begin{tabularx}{\linewidth}[t]({X}) +% This is \textt{tabularx} with \xpackage{delarray} shortcut for parenthesis around +% \end{tabularx} +% \\ \tabucline[1pt on2pt blue]- +% +% \extrarowheight=0pt +% \begin{tabu}\{{X}\} +% This is \textt{tabu} with \xpackage{delarray} shortcut for curly brackets around +% \end{tabu} +% \\ \tabucline[1pt on2pt blue]- +% +% \extrarowheight=0pt +% \begin{tabularx}{\linewidth}[t]\{{X}\} +% This is \textt{tabularx} with \xpackage{delarray} shortcut for curly brackets around +% \end{tabularx} +% \\ \tabucline- +% +% \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}} +% +% \begin{declcs}{savetabu}\M{user-name} +% \end{declcs} +% +% The command \cs{savetabu} can be used at the end of any line of a \textt{tabu} environment to save the +% target width (or the spread), the columns specifications (tabular preamble) and the widths of +% \textt{tabu X} columns (if there is any). +% This possibility allows to easily make tabulars which share exactly the same shape +% throughout your document. This can also be used as a kind of \textt{tabbing} environment +% which is able to remember the tabs positions. +% +% If the \meta{user-name} has been used before, an info is displayed in the \xext{log} file and the +% previous settings are overwritten. +% +% +% \begin{declcs}{usetabu}\M{user-name} +% \end{declcs} +% +% \cs{usetabu} is the complement of \cs{savetabu}: it can be used 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: +% \begin{itemize} +% \item the preamble, +% \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) +% \item \cs{arrayrulewidth}, \cs{doublerulesep}, \cs{extrarowheight} and \cs{extratabsurround} +% \end{itemize} +% +% Example: +% +% \begin{Verb*} +% \extrarowheight=5pt\tabcolsep=12pt +% \begin{tabu}to .7\linewidth{|XXX|X[c]|} ($db(\savetabu)){mytabu} \tabucline*[on1pt]- +% This & is & tabu & package \\ \tabucline*[on1pt]- +% \end{tabu} +% \begin{tabu}{($db(\usetabu)){mytabu}} \tabucline*[on1pt]- +% \multicolumn3{|c}{This is tabu} & package \\ \tabucline*[on1pt]- +% \end{tabu} +% \end{Verb*} +% +% \begin{center} +% \tabulinestyle{myline=on1pt}\extrarowheight=5pt\tabcolsep=12pt +% \begin{tabu}to .7\linewidth{|XXX|X[c]|} \savetabu{mytabu} \tabucline*[myline]- +% This & is & tabu & package \\ \tabucline*[myline]- +% \end{tabu} +% +% +% \begin{tabu}{\usetabu{mytabu}} \tabucline*[myline]- +% \multicolumn3{|c|}{This is tabu} & package \\ \tabucline*[myline]- +% \end{tabu} +% +% \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. +% +% +% +% +% \section(row font and alignment){Change the font and the alignment in one row: \cs{rowfont}} +% +% \begin{declcs}{rowfont}\M[alignment]\M*{font specification} +% \end{declcs} +% +% Inside a \textt{tabu} environment, you can modify the font for each cell in a row. +% \cs{rowfont} has priority over column font specification, exactly like \cs{rowcolor} (package \xpackage{colortbl}) +% has priority over \cs{columncolor}. +% +% The alignment of each cell in one row can also be changed to: \topsep=0pt +% \begin{center} +% \begin{tabu}{>{\ttfamily}r@{\,$=$\,}lc>{\ttfamily}r} +% l &left &{\qquad\smaller or\, for \xpackage{ragged2e} settings: } &L \\ +% c ¢er & &C \\ +% r &right & &R \\ +% j &justify & &J \\ +% \end{tabu} +% \end{center} +% +% Any other value for the optional \meta{alignment} parameter is silently ignored. If \xpackage{ragged2e} is not loaded, +% \textt L\, \textt R\, \textt C\, and\, \textt J\, are synonymous with the lowercase equivalent. +% +% \section(Differences: tabu, tabular, tabularx){Differences between \textt{tabu}, \textt{tabular} and \textt{tabularx}} +% +% \subsection{Paragraph indentation} +% +% \textt{tabu} takes care of paragraph indentation when it is used with \textt X columns and its default target, +% 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 +% +% \begin{tabu}{|[GreenYellow]X|[GreenYellow]} \tabucline[GreenYellow]- +% This is \textt{tabu} with its default target in an indented paragraph. \\ \tabucline[GreenYellow]- +% \end{tabu} +% +% \noindent\begin{tabu}{|[GreenYellow]X|[GreenYellow]}\tabucline[GreenYellow]- +% This is \textt{tabu} with its default target, preceded by \cs{noindent} \\ \tabucline[GreenYellow]- +% \end{tabu} +% +% +% \begin{tabularx}\linewidth{|X|} \hline +% This is \textt{tabularx} with target: \cs{linewidth} in an indented paragraph. \\ \hline +% \end{tabularx} +% +% \noindent\begin{tabularx}\linewidth{|X|} \hline +% This is \textt{tabularx} with target: \cs{linewidth}, preceded by \cs{noindent} \\ \hline +% \end{tabularx}} +% +% +% \subsection{Custom environments} +% +% Unlike \textt{tabularx}, it is possible to define your own environment using \textt{tabu}: +% +% \begin{Verb} +% \newenvironment{foo} +% {\begin{tabu}{X[1.2]|[1pt gray]X}} +% {\end{tabu}} +% \end{Verb} +% +% \newenvironment{footabu} +% {\begin{tabu}{@{}X[1.2]|[1pt,gray]X@{}}} +% {\end{tabu}} +% +% \begin{footabu} +% \textt{tabu} environment, even when \textt X columns are used, may appear +% in the definition of your custom tabular environment. +% & +% You can also use the commands \cs{savetabu} and \cs{usetabu} for this purpose. +% \end{footabu} +% +% +% +% \subsection{Inversion of tokens} +% \label{subsec:inversion of tokens} +% +% \begin{SaveVerbatim}{tempVerb} +% \begin{tabular}{|>{\bfseries}>{ before }l<{ one }<{ two }|} +% cell content +% \end{tabular} +% \end{SaveVerbatim} +% +% +% When you typeset the following \textt{tabular}: +% \UseVerbatim{tempVerb} +% +% \begin{tabu}to .9\linewidth{XX} \savetabu{tabbing} +% You get the following result: +% & +% \begin{tabular}{|>{\bfseries}>{ before }l<{ one }<{ two }|} +% cell content +% \end{tabular} +% \end{tabu} +% +% +% \smex The word \emph{before} is not bold, and \textitbf{two} comes before \textitbf{one}. +% +% The reason is explained in the documentation of \xfile{array.sty}, and is related +% to the \textt{array} environment in math mode when using \cs{newcolumntype}. +% +% This rather strange inversion of tokens may be justified in math mode (otherwise, errors may occur) +% but not in text mode in our opinion. Inside a \textt{tabu} environment, when not in math mode, +% the tokens are not reversed and you get the intuitively expected result: +% +% \begin{tabu}{\usetabu{tabbing}} +% & +% \begin{tabu}{|>{\bfseries}>{ before }l<{ one }<{ two }|} +% cell content +% \end{tabu} +% \end{tabu} +% +% 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} +% +% 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: +% +% \begin{SaveVerbatim}{siunitx} +% \documentclass{minimal} +% \usepackage{numprint,siunitx,xcolor} +% \usepackage{tabu} +% \begin{document} +% +% \begin{tabular}{*2{S[color=green]}} +% 123,45 +% \end{tabular} +% +% \begin{tabu}{*2{S[color=green]}} +% 123,45 +% \end{tabu} +% +% \end{document} +% \end{SaveVerbatim} +% +% \begin{tabu}{@{}X[m]X[m1.2]@{}} +% \UseVerbatim{siunitx} +% & +% Inside \textt{tabular}: +% \begin{enumerate}[label=\arabic*),topsep=\parskip,itemsep=.5\parskip] +% \item Rewrite \textt S: not found because inside \M*{...} +% \item Rewrite \stform* +% \item Rewrite \textt n column defined by package \xpackage{numprint} \\ +% Then the \textt `n' in \textt{gree\textcolor{red}n} is rewritten \smex problem +% \end{enumerate} +% \vskip1ex +% Inside \textt{tabu}: +% \begin{enumerate}[label=\arabic*),itemsep=.5\parskip,topsep=\parskip,parsep=\parskip] +% \item Rewrite \stform* +% \item Rewrite \textt\textbar\ (there is none here) +% \interitem \textt{\scshape go back} +% \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. +% \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... +% +% 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 +% \begin{Verb*} +% \newcolumntype{C}{X[c]} +% \end{Verb*} +% +% it is not recommanded no nest such constructions like: +% \begin{Verb*} +% \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... +% +% Well, just avoid to nest new column type definitions ! +% +% +% +% \section{The package options} +% +% \subsection(The debugshow option){The \textt{debugshow} package option} +% +% \begin{declcs}{tracingtabu} +% \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. +% +% Typical information in the \xext{log} file: +% +% {\ttfamily \noindent \tabcolsep=2pt +% \begin{tabu}{cr*{3}{>{\centering}X[2]}>{\centering}X>{\centering}X[2]} +% \rowfont[c]{} +% (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) **************** }\\ +% \end{tabu}} +% +% What does it mean? \def\pt#1{$#1$\textt{pt}} +% \begin{enumerate}[label=\arabic*),topsep=0pt,itemsep=\parskip,parsep=0pt] +% \item The first attempt was performed with \textt{X}$=$\pt{386.67296} \\ +% The \textt{tabu} width (\pt{797.34592}) exceeded the target by \pt{410.67296}. \\ +% Thus \textt X has been updated: \pt{410.67296} $/2=$ \pt{205.33649} and then:\\ +% \null\quad\textt X $=$ \pt{386.67296} $-$ \pt{205.33649} $=$ \pt{181.33647} +% \item The second attempt lead to a \textt{tabu} width of \pt{386.67294}: the target is reached. \\ +% The final width of each \textt X column is the product of \textt{tabu X} by its width coefficient. +% \end{enumerate} +% +% \subsection(The linegoal option){The \textt{linegoal} package option} +% \label{subsec:linegoal package option} +% +% With the \textt{linegoal} option, the default target for \textt{tabu} with \textt{X} columns is +% \cs{linegoal} instead of \cs{linewidth}. +% The \xpackage{linegoal} package must be loaded and compilation must be done with \hologo{pdfTeX}, +% otherwise, a warning is displayed and the \textt{linegoal} option has no effect: the default +% target remains \cs{linewidth}. \cs{linegoal} works with \hologo{pdfTeX} in \textt{pdf} mode +% \textbf{and in} \textt{dvi} mode. +% +% If for some reason, you wish to turn down the \textt{linegoal} option in your document, +% you can say (in a group for example): +% \verb+\let\tabudefaulttarget=\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 +% around \textt{tabu}. Delimiters shortcuts work both in math and text mode. +% +% +% \subsection(The light option){The \textt{light} package option} +% \label{sec:light package option} +% +% +% When you enter a \textt{tabu} environment, two macros amongst the smallest possible of \xfile{array.sty} +% are modified: +% these are \cs{prepnext@tok}, which is expanded while \cs{@mkpream} builds the \cs{halign} preamble +% and \cs{save@decl} to avoid inversion of tokens in text mode (see \nameref{subsec:inversion of tokens}). +% +% Modification of \cs{prepnext@tok} is loaded only inside the \textt{tabu} environment, while +% the modification of \cs{save@decl} is loaded only inside the group in which \cs{@mkpream} works: this is +% very very local to \textt{tabu} and cannot interfere with any other tabular ! +% +% \cs{prepnext@tok} could have been loaded inside the \cs{@mkpream} group as well, but then \cs{rowfont} +% would not have worked inside \textt{array} or \textt{tabular} nested into a \textt{tabu}. Thus the choice. +% +% As you see, these modifications do no modify \textt{tabular}, \textt{tabular*}, \textt{tabularx}, \textt{longtable} +% \etc \etc \etc +% +% If for some reason you prefer the original macros of \xfile{array.sty}, then you can load \thispackage with +% the ``\textt{light}'' option. +% 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. +% +% +% \section(Corrections){Corrections of some bugs (available only inside \textt{tabu})} +% +% \subsection(delarray compatibility){Correction for colortbl and arydshln: compatibility with 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}. +% +% Those control sequences are used by the \xpackage{delarray} package to put parenthesis or bracket around the array. +% +% +% \subsection(arydshln @ columns){Correction for 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 wat as far as rules are concerned. +% +% With this correction, the \textbf{known problem number 1} in \xpackage{arydshln} documentation is solved. +% +% +% +% \vskip2cm +% +% +% +% \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} +% +% +% +% \StopEventually{ +% } +% +% \IMPLEMENTATION +% +% \subsection{Identification, requirements and options} +% +% The package namespace is \textttbf{\macrocodecolor tabu@}. +% +% +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\ProvidesPackage{tabu}[2010/10/28 v1.1 - flexible LaTeX tabulars (FC)] +\RequirePackage{array}[2008/09/09] +% \end{macrocode} +% +% Then minimal catcode acertaining for loading \thispackage in good conditions: +% +% \begin{macrocode} +\AtEndOfPackage{\tabu@AtEnd\let\tabu@AtEnd\@undefined} +\let\tabu@AtEnd\@empty +\def\TMP@EnsureCode#1#2{% + \edef\tabu@AtEnd{% + \tabu@AtEnd + \catcode#1 \the\catcode#1\relax + }% + \catcode#1 #2\relax +}% \TMP@EnsureCode +\TMP@EnsureCode{33}{12} % ! +\TMP@EnsureCode{124}{12}% | +\TMP@EnsureCode{0}{12}% ^^@ +\TMP@EnsureCode{36}{3}% $ = math shift +% \end{macrocode} +% +% \begin{macro}{\tracingtabu (debugshow option)} +% +% \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} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{linegoal (package option)} +% \begin{macrocode} +\DeclareOption{linegoal}{% + \AtEndOfPackage{\RequirePackage{linegoal}[2010/10/31]}% + \def\tabudefaulttarget{\linegoal}% \linegoal is \linewidth if not pdfTeX +}% linegoal option +% \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 + } +}% light option +\def\tabu@norowfont{\PackageError{tabu} + {\string\rowfont\space is not available with option `light'}\@ehd} +\def\tabu@nocline{\PackageError{tabu} + {\string\tabucline\space is not available with option `light'}\@ehd} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\ProcessOptions +% \end{macrocode} +% +% At Begin Document, we check if a \textt X column has already been defined (\xpackage{tabularx}) +% and if not, we define a new column type \textt X. +% +% Then a fix for \xpackage{arydshln} and \xpackage{colortbl} comptability with \xpackage{delarray} shortcuts +% available inside \textt{tabu}: requirement for this fix is checked by \cs{tabu@fix@arrayright}. +% +% Finally the switch \cs{iftabu@colortbl} is set. +% +% \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 % + \@ifpackageloaded{colortbl} \tabu@colortbltrue \tabu@colortblfalse +} +% \end{macrocode} +% +% \subsection{Some constants} +% +% \begin{macro}{\tabu@cnt} +% +% Used in in \cs{tabu@arith} (the number of trials) and \cs{tabu@prepnext@tok} (for \cs{rowfont}). +% +% \begin{macro}{\tabu@nbcols} +% +% A counter that save the number of columns of the \textt{tabu}. +% +% \begin{macro}{\tabu@X@cols} +% +% 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 +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\tabu@target} +% +% Stores the \textt{tabu} target (either ``\textt{to}'' or ``\textt{spread}''). +% +% \begin{macro}{\tabu@spreadtarget} +% \begin{macro}{\tabu@naturalX} +% +% Used only when \textt{tabu X} columns are used with ``\textt{tabu spread}''. +% +% \begin{macrocode} +\newdimen\tabu@target +\newdimen\tabu@spreadtarget +\newdimen\tabu@naturalX +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% \begin{macro}{\tabucolX} +% +% The dimen corresponding to the preamble token \textt{X[1]}: the standard width of \textt X columns. +% +% \begin{macro}{\tabu@X@sum} +% +% Stores the sum of all width coefficients for \textt X columns. +% +% \begin{macrocode} +\newdimen\tabucolX +\newdimen\tabu@X@sum +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\iftabu@measuring} +% +% This switch is set to \textt{true} by \cs{tabu@arith} if the trial did not reached the target. +% +% 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...) +% +% \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{macrocode} +\newif\iftabu@measuring +\newif\iftabu@spread +\newif\iftabu@nested +\newif\iftabu@firstcline +% \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. +% +% It is also used by \cs{tabucline} to save the \cs{@arstrutbox} when inserting a horizontal line. +% +% \begin{macrocode} +\newsavebox\tabu@box +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tabu@gobblespace} +% +% A macro which is needed when scanning tokens with \cs{futurelet}. +% +% \begin{macrocode} +\def\tabu@gobblespace#1 {#1} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tabu@NC@rewrite@X} +% +% This is the rewrite macro for \textt{tabu X} columns. +% Such a column has an optional argument: the width coefficient for the \textt{tabu X} column +% whose default value is 1, and may be some alignments parameters. +% The coefficient is used in the expression: \textt{p\M*{\cs{dimexpr}\meta{coef}\cs{tabucolX}}} +% +% \begin{macrocode} +\newcommand\tabu@NC@rewrite@X[1][]{\tabu@rewrite@X{#1}% + \expandafter \NC@find \tabucolX@spec} +% \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}{\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. +% +% \begin{macrocode} +\expandafter\def\csname NC@rewrite@\string\usetabu\endcsname#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}% + \fi +}% \NC@rewrite@\usetabu +\expandafter\def\csname NC@find@\string\usetabu\endcsname#1\usetabu{\NC@{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tabu@rewritefirst (new column type)} +% +% This new column type is not really a column type! It is always added to a \textt{tabu} preamble +% in order to do some setup before any other column is rewritten by \cs{@mkpream}. +% +% Thus, \cs{NC@do}\cs{tabu@rewritefirst} is added \textbf{at the beginning of} \cs{NC@list} +% at the entry of a (not nested) \textt{tabu} environment. +% +% This ``column type'' sets up the new column type \cs{tabu@rewritelast} which is added to +% \textbf{at the end of} \cs{NC@list}, and defines the token \texttt X to be rewritten by +% \cs{tabu@NC@rewrite@X} (in case \xpackage{tabularx} is used with \thispackage, this modification +% 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 + \aftergroup \tabu@firstcline + \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 +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tabu@rewritelast (new column type)} +% +% This new column type is rewritten after \textt X columns, because it is declared by +% when the column \cs{tabu@rewritefirst} is actually rewritten. In the case where \cs{tabu@target} +% is $>0$ (either because of ``\textt{tabu to}'' or ``\textt{tabu spread}'' has been called) +% and if there is no \textt X column, then \textt{@\M*{\cs{extracolsep}\cs{@flushglue}}} is added +% at the beginning of the preamble. +% +% To avoid duplicate margin in the \textt{tabu} we have to test the next token in the preamble. +% If the next token is \textt\textbar\ or \textt !\ then no margin must be added and +% \textt{@\M*{\cs{extracolsep}\cs{@flushglue}}} can be inserted at the beginning of the preamble. +% +% Otherwise, we must insert \textt{!\M*{\cs{extracolsep}\cs{@flushglue}}} in order to keep the margin. +% +% \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{% + \ifx \@halignto\relax \let\tabu@temp \@empty + \else + \let\@halignto \tabu@halignto + \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 + \fi + \expandafter\NC@find \tabu@temp +}% \tabu@rewritelast +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tabu@everycr@tok} +% \begin{macro}{\iftabu@colortbl} +% +% This token is used to store and restore the content of \cs{everycr} when \cs{rowfont} is used. +% +% The switch \cs{iftabu@colortbl} is used by \cs{rowfont} when modifying the alignment, because +% \xpackage{colortbl} changes the glue put inside the \cs{halign} preamble to make standard alignments. +% This switch is set At Begin Document. +% +% \begin{macrocode} +\newtoks\tabu@everycr@tok +\newif\iftabu@colortbl +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \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.) +% +% \begin{macrocode} +\def\tabu@nowrite{% cancels a \write command (tabularx method) + \begingroup + \def\let{\afterassignment\endgroup\toks@}% + \afterassignment\let\count@ +}% \tabu@nowrite +\let\tabu@write\write +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tabu@phantomline} +% +% This macro inserts a phantom line in front of a \textt{tabu}. +% This is necessary when you use \cs{usetabu} with \textt{tabu X} column, +% with a single line containing \cs{multicolumn}... +% +% \begin{macrocode} +\def\tabu@phantomline{\noalign{% + \global\everycr{}% + \global\setbox\tabu@box\box\@arstrutbox + \toks@{}\count@\@ne + \@whilenum\count@<\tabu@nbcols\do{\advance\count@\@ne + \toks@\expandafter{\the\toks@&}}% + \toks@\expandafter{\the\toks@ + \cr\noalign{\global\setbox\@arstrutbox\box\tabu@box}}% + \expandafter}\the\toks@ +}% \tabu@phantomline +% \end{macrocode} +% \end{macro} +% +% \subsection{\cs{tabu} and \cs{endtabu}} +% +% \begin{macro}{\tabu} +% +% \cs{tabu} is the command of the environment. +% +% \begin{macro}{\endtabu} +% +% \cs{endtabu} is \cs{endtabular} or \cs{endarray} in math mode. +% +% \begin{macrocode} +\def\tabu{% + \ifmmode \def\endtabu{\endarray}% + \else \def\endtabu{\endtabular}\fi + \tabu@setup \tabu@settarget +}% \tabu +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\tabu@setup} +% +% This macro sets the \textt{tabu X} column definition at the beginning of the \textt{tabu} environment. +% +% Incidentally, \cs{tabu@X} (number of \textt{tabu X} columns) and \cs{tabu@X@sum} (sum of the width-coefs) are reset to $0$. +% +% The current value of \cs{hfuzz} is stored in \cs{tabu@hfuzz}, with a minimum of $0.1 pt$. +% +% \begin{macrocode} +\def\tabu@setup{% + \let\adl@xarraydashrule \tabu@adl@xarraydashrule % arydshln + \let\adl@act@endpbox \tabu@adl@act@endpbox % arydshln + \let\adl@act@@endpbox \tabu@adl@act@endpbox % arydshln + \let\endarray \tabu@endarray % 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}% + \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 + \let\@footnotetext \tabu@footnotetext + \let\@xfootnotenext\tabu@xfootnotetext + \iftabu@nested\else + \global\tabu@footnotes{}% + \aftergroup\the\aftergroup\tabu@footnotes + \fi + \let\centering \tabu@centering + \let\raggedright \tabu@raggedright + \let\raggedleft \tabu@raggedleft + \let\@trivlist \tabu@trivlist % + \let\tabudecimal \tabu@tabudecimal + \let\verbatim \tabu@sanitizetext + \let\fbox \tabu@fbox + \let\prepnext@tok \tabu@prepnext@tok % + \let\rowfont \tabu@rowfont + \tabu@spreadfalse \tabu@measuringfalse + \edef\tabu@hfuzz{\ifdim\hfuzz<.1\p@ .1\p@\else\the\hfuzz\fi}% + \tabu@rewritefirst +}% \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 +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tabu@settarget} +% \begin{macro}{\tabu@begin} +% +% The macro sets \cs{tabu@target} (a dimen) to the value specified for ``\textt{tabu to}'' or ``\textt{tabu spread}''. +% +% \begin{macrocode} +\def\tabu@settarget{\futurelet\@let@token \tabu@sett@rget} +\def\tabu@sett@rget{\tabu@target\z@ + \ifcase \ifx \bgroup\@let@token 0\else + \ifx [\@let@token 0\else + \ifx \@sptoken\@let@token 1\else + \if t\@let@token 2\else + \if s\@let@token 3\else + \m@ne\fi\fi\fi\fi\fi\relax + \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@begin\tabu@target} +\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 +}% \tabu@begin +\def\tabu@@begin[#1]#2\@nil#3{% + \edef\tabu@align{#1}% + \edef\tabu@saved{% + \ifmmode \col@sep \the\arraycolsep + \else \col@sep \the\tabcolsep \fi\relax + \arrayrulewidth \the\arrayrulewidth\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 +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\tabu@footnotes} +% +% \begin{macrocode} +\newtoks\tabu@footnotes +\long\def\tabu@footnotetext#1{% + \edef\@tempa{\the\tabu@footnotes + \noexpand\footnotetext [\the\csname c@\@mpfn\endcsname]}% + \global\tabu@footnotes\expandafter{\@tempa{#1}}}% +\long\def\tabu@xfootnotetext[#1]#2{% + \global\tabu@footnotes\expandafter{\the\tabu@footnotes + \footnotetext[{#1}]{#2}}} +% \end{macrocode} +% \end{macro} +% +% +% +% \subsection{Flow chart of expansion} ^^A\enlargethispage{\baselineskip} +% +% \subsubsection(case: tabu, tabu to and tabu spread){General case: tabu, tabu to and tabu spread} +% +% { +% \hskip-\evensidemargin +% \begin{tikzpicture}[yscale=.4,xscale=.6,framed, +% start chain, every join/.style={->,thin,black,solid},node distance=.5cm and .5cm, +% every node/.style={black}] +% \node [on chain,draw] (begintabu) at (0,0) {\cs{begin}\M*{tabu}} node [anchor=west] at (begintabu.east) {(\cs{begingroup})} +% node [on chain=going below,join] (tabu) {\cs{tabu}} +% node [on chain=going right,join] (tabudesc) {$\begin{tabu}\{{>{$}l<{$}}. +% defines \cs{@halignto} and sets \cs{tabu@target} \\ +% load \cs{NC@rewrite@X} for \textt{tabu} \textt X columns \\ +% load special setup (\xpackage{arydshln} fixes, \cs{rowfont}, \cs{centering} etc) +% \end{tabu}$} +% node [on chain=going below,join] (tabu@begin) {\cs{tabu@begin}} +% node [on chain] (tabu@begindesc) {$\begin{tabu}\{{>{$}l<{$}}. +% if \cs{tabu@target} $> 0$ then prepare \\ +% \textt{@\M*{\cs{extracolsep}\M*{\cs{@flushglue}}}} +% \end{tabu}$}; +% \chainin (tabu@begin) +% node [on chain=going below] (H) {} +% node [on chain=going below,join=with tabu@begin] (toarray) {\cs{tabular} or \cs{array} if in math mode}; +% \draw [densely dotted,gray,very thick] (begintabu.west |- H) -- (tabu@begindesc.east |- H) coordinate (H); +% \path [fill=AliceBlue] (begintabu.north -| H) rectangle ($(H)+(1,0)$) coordinate (bluebox) +% node [midway,rotate=-90] {\large\thispackage}; +% +% { [start chain=array] +% \node [on chain] at (begintabu |- toarray) [yshift=-2.5cm] (@array) {\cs{@array}}; +% \draw [->] (toarray.west) -| (@array); +% \node [on chain=going right,join,fill=GhostWhite,draw=gray,dashed] (@arraydesc) +% {\begin{tabu}\{{l}. +% creates the \cs{@arstrutbox} \\ +% \cs{begingroup} \\ +% \quad \cs{@mkpream}: parse the preamble to create \cs{@preamble} \\ +% \quad \cs{xdef} \cs{@preamble} macro \\ +% \cs{endgroup}\\ +% \cs{@arrayleft}\\ +% \cs{vtop} or \cs{vbox} or \cs{vcenter} \cs{bgroup} ... \cs{halign}\{ preamble... +% \end{tabu}} +% node [on chain=going below] (H) {}; +% } +% { [start chain=endtabu] +% \node [on chain] (end{tabu}) at (begintabu |- H) {\cs{end}\M*{tabu}} +% node [on chain=going below,join] (endtabu) {\cs{endtabu}} +% node [on chain=going right,join] (endtabular) {\cs{endtabular}} +% node [on chain=going right,join] (endarray) {\cs{endarray}} +% node [on chain=going right,join] (endarraydesc) {\begin{tabu}\{{l}. end of \cs{halign} \\ end of \cs{vtop}, \cs{vbox} or \cs{vcenter}\end{tabu}}; +% \chainin (endtabular) +% node [on chain=going below,node distance=.7cm] (H) {}; +% \node at (H -| endarraydesc.west) [anchor=west] (endtabulardesc) {\begin{tabu}\{{l}. end of math group \\ end of \cs{hbox}\end{tabu}}; +% \draw [->] (endtabular) |- (endtabulardesc) node [near end,above] {\small if in text mode}; +% \draw [->] (endtabu.north east) to [bend left,looseness=.5] node [midway,above] {\small if in math mode} (endarray.north); +% \node at (endtabulardesc.south -| begintabu) [yshift=-.5cm] (endgroup) {\cs{endgroup}} node at (endgroup.east) [anchor=west] {end of envir}; +% \draw [->] (endtabu) -- (endgroup); +% } +% \path [fill=LightGoldenrodYellow] (bluebox) rectangle ($(endtabulardesc.south -| bluebox)-(1,0)$) +% node [midway,rotate=-90] {\large\xpackage{array}}; +% \end{tikzpicture} +% } +% +% \subsubsection(tabu to with X column){\textt{tabu to} with \textt X column} +% +% The important part of the job is made inside the dashed box above: \cs{@mkpream} +% expands the columns definitions, which can be user defined. Hopefully, it does its +% job inside a group, therefore a user-column can set a macro to be expanded +% \cs{aftergroup}. This implementation allows much modifications in the tabular preparation, +% without any change in the macros of \xfile{array.sty}. +% +% When a \textt{tabu X} column is found in the preamble by \cs{@mkpream}, \textt{tabu} changes his strategy: the macro +% \cs{tabu@prep@TRIAL} is set to be expanded \cs{aftergroup} that is, just after the preamble (\cs{@preamble}) has been built. +% This macro does some setup for \textt{tabu} trials to reach the target with variable \textt X column widths and gobbles +% everything until the next \cs{bgroup} which corresponds to the \cs{vtop}, \cs{vbox} or \cs{vcenter} for the whole tabular. +% This part of \cs{@array} is stored into \cs{tabu@Xfinish} to be expanded after the last trial gave satisfaction +% to reach the \textt{tabu} target. Then \cs{tabu@collect} is expanded to find the end of the \textt{tabu} environment, +% temporarily storing the environment content into a token register. +% +% The last part of \cs{@array} until \cs{halign} is expanded inside a \cs{vbox} +% which is stored into the box register \cs{tabu@box} for measuring purpose. \cs{halign} ends by \cs{endarray} +% which stops the \cs{tabu@box} as well, and then \cs{tabu@arith} is expanded to compute the gap between the +% width of \cs{tabu@box} and the target, and \cs{tabucolX} (the dimension that correspond to \textt{X[1]}) +% is updated accordingly. +% +% The trials are ``protected'' by\, \M*{\cs{ifnum}0=`}\cs{fi}\, : they occur in a group that will be closed +% at the very begining of \cs{tabu@Xfinish}, when the final tabular will be printed actually. +% This protection is absolutely necessary to be able to collect +% the environment body in the case of nested \textt{tabu} with \textt X columns. This is related to \TeX{} +% mechanism of expansion inside \cs{halign} (\TeX{} stops reading when it encounters a \& \textt{alignment tab character} +% and goes backward expanding anything that were not expanded before). +% +% +% {\hskip-1cm +% \begin{tikzpicture}[yscale=.4,xscale=.6,framed, +% start chain=going below,node distance=.3cm and .5cm, +% every join/.style={->,thin,black,solid},every node/.style={black}] +% +% \node [on chain] (begingroup) at (0,0) {\cs{begingroup}} +% node [on chain=going right] (@mkpream) {\cs{@mkpream}} +% node [on chain,join] {Finds a \textt X column} +% node [on chain,join] {rewrite \textt X column} +% {[start branch] node [on chain] {\begin{tabu}\{{l}. Parse the optional parameter for \textt X\\ Set \cs{aftergroup}\cs{tabu@prep@TRIAL}\end{tabu}} +% } +% node [on chain,join] {... \cs{@mkpream} ...} +% {[start branch] node [on chain,join] {builds the \cs{halign} preamble}} +% node [on chain,join] {\cs{xdef}\cs{@preamble}} +% node [on chain,join] (endgroup) {\cs{endgroup}} +% node [on chain] (H) {}; +% \node (tabu@prep@TRIAL) at (begingroup |- H) {\cs{tabu@prep@TRIAL}}; +% \draw [->] (endgroup.west) -| (tabu@prep@TRIAL.north) node [midway,left] {\ssmall\begin{tabu}{c} triggered by\\ \cs{aftergroup}\end{tabu}}; +% \chainin (tabu@prep@TRIAL); +% { [start branch] \node [on chain,join] {\cs{tabu@setup@TRIAL}} +% node [on chain,join] {\begin{tabu}\{{l}. +% Neutralisation of \cs{write} \\ +% Protection for: \begin{tabu}{!{\textbullet}l} +% footnotes \\ counters \\ index +% \end{tabu} +% \end{tabu}}; +% } +% \node [on chain] (H) {} +% node [on chain,join=with tabu@prep@TRIAL] (tabu@arrayleft@measure) {\cs{tabu@arrayleft@measure}} +% node [on chain=going right,join] {\begin{tabu}\{{l}. prepares \cs{tabu@Xfinish} \\ Collect the \textt{tabu} body\end{tabu}} +% node [on chain,join] (tabu@TRIAL) {\cs{tabu@TRIAL}} +% {[start branch] node [on chain,join] {\begin{tabu}{l} Expands \cs{halign} into a \cs{vbox} \end{tabu}} +% } +% node [on chain,join] {\cs{tabu@endTRIAL}} +% {[start branch] node [on chain,join] {\cs{endarray}} +% } +% node [on chain,join] (tabu@arith) {\begin{tabu}{c} \cs{tabu@arith}\\ \cs{wd}\M*{tabu}$-$\cs{tabu@target} $<$ \cs{hfuzz} ?\end{tabu}} +% node [on chain=going right,node distance=1cm] (tabu@Xfinish) {\cs{tabu@Xfinish}}; +% \draw (tabu@arith) [->] -- (tabu@Xfinish) node [midway,above,blue] {Yes}; +% \draw [->] (tabu@arith.west) |- (tabu@TRIAL) node (No) [very near start,left] {{\small\begin{tabu}.{r}\} Updates \\ \cs{tabucolX}\end{tabu}} \textcolor{red}{No}}; +% +% \end{tikzpicture}} +% +% +% +% +% +% \subsubsection(tabu spread with X column){\textt{tabu spread} with \textt X column} +% +% In the case of ``\textt{tabu spread}'' with \textt X columns, the process is the same +% as the one described for ``\textt{tabu to}'' with \textt X columns. However, the first +% trial is different because we have first to measure the \emph{natural width} of the +% tabular. +% The process is the following: +% \begin{itemize}[label=\small\textbullet] +% \item \cs{tabu@target} is first set to \cs{linewidth} (or \cs{linegoal} with the \textt{linegoal} package option). +% \item The \textt X column corresponds to a \cs{vbox} with \cs{hsize} fixed to \cs{tabu@target}. +% \item Inside this \cs{vbox} the cell content is written into a \cs{hbox} whose width is limited to \cs{tabu@target}. +% This \cs{hbox} is captured into the box register \cs{tabu@box}. +% \item At the end of the cell, the \cs{badness} of the \cs{hbox} is checked: +% \begin{itemize}[label=\textendash,leftmargin=*] +% \item if the \cs{badness} is $> 1000$ then the text is too long and ``\textt{tabu spread}'' +% is useless: \textt{tabu to \cs{tabu@target}} give the same result. +% \item Otherwise, we get the natural width of the cell content by: \\ +% \cs{setbox} \cs{tabu@box} \cs{hbox} \M*{\cs{unhbox} \cs{tabu@box}} +% \end{itemize} +% \item At the end of the first trial, \cs{tabu@spreadarith} checks if: +% $$ \text{width(tabular)} + \text{spread} < \cs{linewidth} \text{ (or \cs{linegoal})}$$ +% \begin{itemize}[label=\textendash,leftmargin=*] +% \item if not, then \textt{tabu to}\cs{tabu@target} give the same result +% \item Otherwise, the target for \textt{tabu to} will be: +% $$\hskip-\leftmargin +% \text{width(tabular)} + \text{spread} - \sum_i \text{natural widths X}_i +% +\underbrace{\text{Max}_i\left(\dfrac{\text{natural width X}_i}{\text{coef}_i}\right)\times \sum_i\text{coef}_i} +% _{\text{\begin{tabu}{c} minimal natural width that can be obtained \\ with the given coefs\end{tabu}}} +% $$ +% \end{itemize} +% And the next trial will be done as if the user called ``\textt{tabu to}'' with this target. +% \end{itemize} +% +% +% +% +% \subsection{tabu X column definition} +% \label{tabu X column definition} +% +% \begin{macro}{\tabu@rewrite@X} +% +% This macro is expanded by \cs{@mkpream} in case a \textt X column is found. +% +% \cs{tabu@X@sum} (a dimen) store the sum of the width coefficients. For the first \textt{X column} found in the +% preamble, a special setup occurs: +% \begin{itemize}[itemsep=0pt,topsep=0pt,leftmargin=*] +% \item the default target (either \cs{linewidth} or \cs{linegoal} if available) is set +% if it has not been specified by the user. +% \item \cs{@halignto} is \cs{let} to \cs{relax} to avoid its expansion in \cs{xdef}\cs{@preamble} just after \cs{@mkpream}. +% Indeed as long as we have to measure the natural width of the tabular, \cs{@halign} must be empty for trial steps. +% \item The rest of the setup is made \cs{aftergroup} (\ie after \cs{xdef}\cs{@preamble} which occurs inside a group) by \cs{tabu@prep@TRIAL}. +% \end{itemize} +% +% \begin{macrocode} +\def\tabu@rewrite@X#1{\tabu@Xarg{#1}% + \iftabu@spread \tabu@rewrite@Xspread + \else \tabu@rewrite@Xto + \fi +}% \tabu@rewrite@X +% \end{macrocode} +% \begin{macro}{\tabu@rewrite@Xnested} +% +% This macro replaces \cs{tabu@rewrite@X} when \textt{tabu} makes a trial for \textt X columns. +% +% \begin{macro}{\tabu@rewrite@Xrestore} +% +% This macro replaces \cs{tabu@rewrite@X} in the case of \cs{usetabu}. +% +% \begin{macrocode} +\def\tabu@rewrite@Xnested#1{\def\tabucolX@spec{p{\tabucolX}}} +\def\tabu@rewrite@Xrestore#1{\tabu@Xarg{#1}\let\tabucolX@spec\tabu@temp + \iftabu@measuring \else \tabu@measuringtrue \aftergroup\tabu@usetabuX \fi}% +\def\tabu@usetabuX{% + \tabu@everycr\expandafter{\the\tabu@everycr\tabu@phantomline}% +}% \tabu@usetabuX +% \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 \@halignto \relax + \aftergroup \tabu@prep@TRIAL + \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: we 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\@halignto \relax + \aftergroup \tabu@prep@TRIAL + \fi +}% \tabu@rewrite@Xspread +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tabu@Xarg} +% +% 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: +% +% {\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} +% +% \begin{macrocode} +\def\tabu@Xarg#1{% + \ifx\\#1\\% + \tabu@X@sum \p@ + \def\tabucolX@spec{p{\tabucolX}}% + \edef\tabu@temp{p{\the\tabucolX}}% + \else + \tabu@X@sum \z@ + \let\tabucolX@align \@empty + \let\tabucolX@spec \@empty + \let\tabu@Xmath \relax + \tabu@Xparse {}#1\relax\@nnil + \fi +}% \tabu@Xarg +\def\tabu@Xparse#1{\futurelet\@let@token\tabu@Xtest} +\expandafter\def\expandafter\tabu@Xparsespace\space{\tabu@Xparse{}} +\def\tabu@Xtest{% + \ifcase \ifx \@nnil\@let@token \z@ \else + \ifx \relax\@let@token \m@ne\else + \if ,\@let@token \m@ne\else + \if p\@let@token 1\else + \if m\@let@token 2\else + \if b\@let@token 3\else + \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 + \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 + \or \tabu@Xcoef{}% + \else \expandafter\tabu@Xparse + \fi +}% \tabu@Xtest +\def\tabu@Xalign#1{% + \ifx \tabucolX@align\@empty \else \PackageWarning{tabu} + {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} + {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 +}% \tabu@Xcoef +\def\tabu@Xc@ef{% + \advance\tabu@X@sum \@tempa\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 + \begingroup + \ifx \tabu@Xmath\relax + \edef\tabucolX@spec##1{\tabucolX@spec{##1}}% + \else + \edef\tabucolX@spec##1{>{$}\tabucolX@spec{##1}<{$}}% + \fi + \edef\tabu@temp{\dimexpr\strip@pt\tabu@X@sum \tabucolX \relax}% + \toks@\expandafter{\tabucolX@align}% + \edef\x{% + \def\noexpand\tabu@temp{\the\toks@ \tabucolX@spec{\the\tabu@temp}}% + \def\noexpand\tabucolX@spec{\the\toks@ \tabucolX@spec{\tabu@temp}}% + }\expandafter\endgroup\x +}% \tabucolX@do +% \end{macrocode} +% \end{macro} +% +% \subsection(Before trials){Before trials to reach the target} +% +% \subsubsection{Trial setup after \cs{@mkpream}} +% +% \begin{macro}{\tabu@prep@TRIAL} +% +% \cs{@mkpream} does its job inside a semi-simple group. At the end, \cs{@preamble} is expanded with \cs{xdef}, and +% the group is left: this triggers the expansion of \cs{tabu@prep@TRIAL} set \cs{aftergroup} by the first \textt X column +% encountered in the preamble. +% +% We \cs{let} \cs{@halignto} to \cs{@empty}: it's a measurement, and put some protections. A group is opened with +% the famous \M*{\cs{ifnum}0=`}\cs{fi} and control is given to \cs{tabu@arrayleft@measure}. +% +% \begin{macrocode} +\def\tabu@prep@TRIAL{% + \let\tabu@savedpreamble \@preamble + \def\savetabu {\tabu@saveX}% + {\ifnum0=`}\fi + \tabu@setup@TRIAL + \iftabu@spread % first trial only + \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@ + \let\tabu@startpboxORI \@startpbox + \let\@startpbox \tabu@spread@startpbox + \else + \tabucolX = \tabu@target + \fi + \tabu@cnt \z@ % number of trials + \def\tabu@lasttry{\m@ne\p@}% + \tabu@arrayleft@measure +}% \tabu@prep@TRIAL +% \end{macrocode} +% +% \begin{macrocode} +\def\tabu@setup@TRIAL{\tabu@global@X + \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 + \let\tabu@saveX \@gobble + \tabu@TRIAL@hook +}% \tabu@setup@TRIAL +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tabuDisableCommands} +% +% +% +% \begin{macrocode} +\let\tabu@TRIAL@hook\@empty +\newcommand\tabuDisableCommands[1]{\g@addto@macro\tabu@TRIAL@hook{#1}} +% \end{macrocode} +% \end{macro} +% +% \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{macrocode} +\def\tabu@arrayleft@measure#1\bgroup{% + \def\tabu@Xfinish{\ifnum0=`{\fi}\tabu@global@X + \let\@halignto\tabu@halignto \tabu@firstclinetrue #1\bgroup}% + \toks@{\let\@preamble\tabu@savedpreamble}% + \tabu@collect +}% \tabu@arrayleft@measure +% \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}. +% +% \begin{macrocode} +\def\tabu@collect{\catcode`\^^@=13\def\tabu@stack{b}\tabu@collectbody} +\long\def\tabu@collectbody#1\end#2{% + \edef\tabu@stack{\tabu@pushbegins #1\begin\end\expandafter\@gobble\tabu@stack}% + \ifx\tabu@stack\@empty + \toks@\expandafter{\the\toks@#1}\def\tabu@endenvir{\end{#2}}% + \expandafter\tabu@TRIAL + \else + \toks@\expandafter{\the\toks@#1\end{#2}}% + \expandafter\tabu@collectbody + \fi +}% \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\vbox\bgroup \the\toks@ + \tabu@endTRIAL}% constant +\def\tabu@endTRIAL{\endarray$\egroup + \iftabu@spread \tabu@spreadfalse + \let\@startpbox \tabu@startpboxORI + \tabu@spreadarith % + \else \tabu@arith + \fi + \iftabu@measuring \tabu@measuringfalse + \expandafter \tabu@TRIAL % + \else + \toks@\expandafter\expandafter\expandafter{% + \the\expandafter\toks@ \tabu@endenvir}% + \expandafter \tabu@Xfinish \the\toks@ % + \fi +}% \tabu@endTRIAL +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \subsubsection{The arithmetic of \textt X columns} +% +% \begin{macro}{\tabu@arith} +% \begin{macro}{\tabu@spreadarith} +% +% Algorithms. +% +% \begin{macrocode} +\def\tabu@arith{% + \advance\tabu@cnt \@ne + \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 + \ifdim \tabucolX<\z@ + {\let\write\tabu@write\PackageWarning{tabu} + {X Columns too narrow (table too wide)\MessageBreak}}% + \tabucolX=1em% + \else \tabu@measuringtrue + \fi + \fi + \fi +}% \tabu@arith +\def\tabu@spreadarith{% + \tabu@naturalX \tabu@naturalX@max\relax + \tabucolX \tabu@naturalX@min\relax + \tabu@message{\tabu@message@spread}% + \ifdim \dimexpr \wd\tabu@box + \tabu@spreadtarget <\tabu@target + \advance\tabu@spreadtarget \dimexpr\wd\tabu@box-\tabu@naturalX+\tabucolX\relax + \ifdim \tabu@spreadtarget <\tabu@target + \tabu@target = \tabu@spreadtarget + \fi + \tabu@message{\expandafter\tabu@msg@align \the\tabu@target {}{}{}{}{}\@@}% + \tabu@message{\ifdim \tabu@spreadtarget>\tabu@target + (tabu) default target used.\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 + \xdef\tabu@halignto {to\the\tabu@target}% + \tabucolX \tabu@target + \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{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 {}{}{}{}{}\@@ + \expandafter\tabu@msg@align \the\dimexpr(\tabu@target-\wd\tabu@box) + *65536/\tabu@X@sum\relax {}{}{}{}{}\@@} +\def\tabu@message@spread{\tabu@spreadheader + \expandafter\tabu@msg@align \the\tabu@spreadtarget {}{}{}{}{}\@@ + \expandafter\tabu@msg@align \the\wd\tabu@box {}{}{}{}{}\@@ + \expandafter\tabu@msg@align \the\tabucolX {}{}{}{}{}\@@ + \expandafter\tabu@msg@align \expandafter-\the\tabu@naturalX {}{}{}{}{}\@@} +\def\tabu@message@reached{\tabu@header + \expandafter\tabu@msg@align \the\tabucolX { }{ }{ }{ }{}\@@ + ******** Reached Target : hfuzz=\tabu@hfuzz\space ********^^J} +\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<\@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@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)spread}% +}\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@ + \let\vss\relax\let\vfil\vss\let\vfill\vss\let\vskip\@tempskipa + \hbox to\tabu@target\bgroup\aftergroup\tabu@spread@endhbox\hfil + \else + \expandafter\@gobble\tabu@startpboxORI{#1}% \@gobble \bgroup + \fi +}% \tabu@spread@startpbox +\def\tabu@spread@endhbox{% + \ifnum\badness>\@M % + \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{Numbers in \textt{tabu}} +% +% \subsubsection{\cs{tabudecimal}} +% +% \begin{macro}{\tabudecimal} +% \begin{macrocode} +\def\tabu@tabudecimal#1{% + \def\tabu@decimal{#1}\@temptokena{}% + \let\tabu@getdecimal@ \tabu@getdecimal@ignorespaces + \tabu@scandecimal +}% \tabudecimal +\def\tabu@scandecimal{\futurelet \tabu@temp \tabu@getdecimal@} +\def\tabu@skipdecimal#1{#1\tabu@scandecimal} +\def\tabu@getdecimal@ignorespaces{% + \ifcase 0\ifx\tabu@temp\ignorespaces\else + \ifx\tabu@temp\@sptoken1\else + 2\fi\fi\relax + \let\tabu@getdecimal@ \tabu@getdecimal + \expandafter\tabu@skipdecimal + \or \expandafter\tabu@gobblespace\expandafter\tabu@scandecimal + \else \expandafter\tabu@skipdecimal + \fi +}% \tabu@getdecimal@ignorespaces +\def\tabu@get@decimal#1{\@temptokena\expandafter{\the\@temptokena #1}% + \tabu@scandecimal} +\def\do#1{% + \def\tabu@get@decimalspace#1{% + \@temptokena\expandafter{\the\@temptokena #1}\tabu@scandecimal}% +}\do{ } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tabu@getdecimal} +% \begin{macrocode} +\def\tabu@getdecimal{% + \ifcase 0\ifx 0\tabu@temp\else + \ifx 1\tabu@temp\else + \ifx 2\tabu@temp\else + \ifx 3\tabu@temp\else + \ifx 4\tabu@temp\else + \ifx 5\tabu@temp\else + \ifx 6\tabu@temp\else + \ifx 7\tabu@temp\else + \ifx 8\tabu@temp\else + \ifx 9\tabu@temp\else + \ifx .\tabu@temp\else + \ifx ,\tabu@temp\else + \ifx -\tabu@temp\else + \ifx +\tabu@temp\else + \ifx e\tabu@temp\else + \ifx E\tabu@temp\else + \ifx\tabu@cellleft\tabu@temp1\else + \ifx\ignorespaces\tabu@temp1\else + \ifx\@sptoken\tabu@temp2\else + 3\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax + \expandafter\tabu@get@decimal + \or \expandafter\tabu@skipdecimal + \or \expandafter\tabu@get@decimalspace + \else\expandafter\tabu@printdecimal + \fi +}% \tabu@getdecimal +\def\tabu@printdecimal{% + \edef\tabu@temp{\the\@temptokena}% + \ifx\tabu@temp\@empty\else + \ifx\tabu@temp\space\else + \expandafter\tabu@decimal\expandafter{\the\@temptokena}% + \fi\fi +}% \tabu@printdecimal +% \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 (only inside \textt{tabu}) in order to add an optional argument: +% the width of the rule. +% +% \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} +% +% \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\\% + \def\tabu@temp{!{\tabu@vline\arrayrulewidth}}% + \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{!{\color@begingroup\tabu@color + \noexpand\tabu@vline{\the\@tempdima}\color@endgroup}}% +}% \tabuvline@argiii +% \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}} +% +% \begin{macro}{\tabu@firstcline} +% \begin{macrocode} +\def\tabu@firstcline{% + \tabu@firstclinetrue + \let\tabu@everycr\everycr + \def\tabu@restoreeverycr{\let\everycr\tabu@everycr}% + \def\everycr{\afterassignment\tabu@restoreeverycr\@temptokena}% + \tabu@everycr{\noalign{% + \global\tabu@everycr{\noalign{% + \global\tabu@everycr{}\global\tabu@firstclinefalse}}% + \global\let\everycr\tabu@everycr}}% +}% \tabu@firstcline +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tabucline} +% +% \cs{tabucline}\M[style or spec.]\M*{start-end} +% +% \cs{tabucline} appears only at the end of a line: this is the place where we can insert a \cs{noalign} group. +% We built a new line to be inserted inside the \textt{tabu}: this new line which contains the rule or leaders, +% is stored into \cs{toks@} (inside the \cs{noalign} group). When leaving the group \cs{toks@} is expanded. +% +% \begin{macrocode} +\def\tabu@linedash{4pt}% +\def\tabu@dashgap{4pt}% +\def\tabucline{\noalign{\ifnum0=`}\fi\@ifstar + {\@tempswatrue\tabu@cline} + {\@tempswafalse\tabu@cline}}% +\newcommand*\tabu@cline[2][]{% + \tabu@startstop{#2}\tabu@getlinespec{#1}\@multicnt\@ne + \ifnum\tabu@start>\tabu@stop \the\toks@ + \else\ifx\tabu@xleaders\relax\the\toks@ + \else + \toks@{\ifnum0=`{\fi}\noalign{\global\setbox\tabu@box \box\@arstrutbox}}% + \iftabu@firstcline\if\tabu@align t\vskip-\ht\@arstrutbox\fi\fi + \@whilenum\@multicnt<\tabu@start\do{\advance\@multicnt\@ne + \toks@\expandafter{\the\toks@ &}}% + \loop + \toks@\expandafter{\the\toks@ \omit }% + \ifcase 0\if@tempswa\else\ifnum \@multicnt>\tabu@start 1\fi\fi\relax + \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}% + \fi + \ifcase 0\if@tempswa\else\ifnum \@multicnt<\tabu@stop 1\fi\fi % + \expandafter \tabu@add \csname tabu@tok@\the\@multicnt R\endcsname \@nil + \fi + \ifnum\@multicnt<\tabu@stop + \advance\@multicnt\@ne + \if@tempswa \toks@\expandafter{\the\toks@ &}% + \else \toks@\expandafter{\the\toks@ \span}\fi + \repeat + \@whilenum\@multicnt<\tabu@nbcols\do{\advance\@multicnt\@ne + \toks@\expandafter{\the\toks@ &}}% + \toks@\expandafter{\the\toks@ \cr \noalign{% + \global\tabu@firstclinefalse \global\setbox\@arstrutbox \box\tabu@box}}% + \the\toks@ + \fi\fi +}% \tabucline +\def\tabu@add #1\@nil{\toks@\expandafter{\the\toks@ #1\ifmmode$\fi}} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tabu@startstop} +% +% This macro parses the mandatory argument of \cs{tabucline}: start-column and end-column of the \textt{cline}. +% +% \begin{macrocode} +\def\tabu@startstop#1{\tabu@start@stop #1\relax 1-\tabu@nbcols\@nnil} +\def\tabu@start@stop #1-#2\@nnil{% + \countdef\tabu@start100\countdef\tabu@stop101 % + \@defaultunits \tabu@start \number0#1\relax\@nnil + \@defaultunits \tabu@stop \number0#2\relax\@nnil + \ifnum\tabu@start>\tabu@nbcols\tabu@start=\tabu@nbcols\else + \ifnum\tabu@start>\z@\else \tabu@start=\@ne \fi\fi + \ifnum\tabu@stop>\tabu@nbcols \tabu@stop\tabu@nbcols \else + \ifnum\tabu@stop>\z@\else \tabu@stop=\tabu@nbcols \fi\fi +}% \tabu@start@stop +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tabu@getlinespec} +% +% This macro parses the optional argument of \cs{tabucline} and check if it's a line specification +% (then \cs{tabu@getline} is expanded) or a \cs{leaders} specification (then \cs{tabu@leaders} is expanded). +% +% \begin{macrocode} +\def\tabu@getlinespec#1{\let\tabu@xleaders \relax + \@defaultunits \let\@tempa=#1 \relax\@nnil + \ifx\@tempa\relax \let\tabu@xleaders \tabu@defaultleaders\else + \ifx\@tempa\hbox \tabu@defleaders{#1}\else + \ifx\@tempa\box \tabu@defleaders{#1}\else + \ifx\@tempa\copy \tabu@defleaders{#1}\else + \ifcsname tabu@line@style@\string#1\endcsname + \csname tabu@line@style@\string#1\endcsname + \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\tabucline@warn#1{\PackageWarning{tabu} + {Undefined line syle: #1 + \MessageBreak Using default line style instead}% + \let\tabu@xleaders \tabu@defaultleaders +}% \tabucline@warn +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tabu@getline} +% +% This macro parses the optional argument of \cs{tabucline} (or the one of \cs{tabulinestyle}) +% and extract the thickness, the dash an gap specified. Default values assignments are done either. +% +% \begin{macrocode} +\def\tabu@getline#1{\tabu@lineon #1 \@nil on\tabu@linedash \p@ \@nil\@nnil{#1}} +\def\tabu@maybecolor{\ifx\tabu@color\@empty \afterassignment\tabu@colortest + \else \@defaultunits\fi} +\def\tabu@lineon #1on#2\@nil#3\@nnil#4{% + \let\tabu@color \@empty + \@defaultunits \let\@tempa=#1 \relax\@nnil + \ifcase 0\ifx o\@tempa 1\else\ifcat A\noexpand\@tempa 2\fi\fi\relax + \tabu@maybecolor \@tempdima #1\arrayrulewidth \p@\@nnil + \tabu@maybecolor \@tempdimb #2\p@ \@nnil + \tabu@lineoff #1 on#2 off\tabu@dashgap \p@ \@nnil + \or\@tempdima \arrayrulewidth + \tabu@maybecolor \@tempdimb #2\p@ \@nnil + \tabu@lineoff #1 on#2 off\tabu@dashgap \p@ \@nnil + \else + \tabu@maybecolor \@tempdima \arrayrulewidth #1\p@\@nnil + \ifx\tabu@color\@empty \tabucline@warn{#4}\else + \@tempdimb \z@ + \tabu@lineoff off0pt \p@\@nnil \fi + \fi +}% \tabu@lineon +\def\tabu@lineoff #1off#2\@nnil{% + \tabu@maybecolor \@tempdimc #2\p@ \@nnil + \ifdim \@tempdimb=\z@ + \ifdim \@tempdimc>\z@ \@tempdimb \tabu@dashgap\relax\fi\fi + \ifdim \@tempdimc=\z@ + \ifdim \@tempdimb>\z@ \@tempdimc \tabu@linedash\relax\fi\fi + \ifdim \@tempdima<\z@ \else + \ifdim \@tempdimb<\z@ \else + \ifdim \@tempdimc<\z@ \else + \edef \tabu@xleaders{\tabu@color\xleaders + \ifdim\@tempdimc>\z@ + \hbox\bgroup \kern\the\dimexpr\@tempdimc/2\relax\fi + \noexpand\iftabu@firstcline + \vrule depth\the\@tempdima + \ifdim\@tempdimb>\z@ width\the\@tempdimb\fi + \noexpand\else + \vrule height\dimexpr-\extrarowheight+\the\@tempdima + depth\extrarowheight + \ifdim\@tempdimb>\z@ width\the\@tempdimb\fi + \noexpand\fi + \ifdim\@tempdimc>\z@ + \kern\the\dimexpr\@tempdimc/2\egroup\fi + \tabu@leaderfill}% + \fi\fi\fi +}% \tabu@lineoff +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tabu@colortest} +% +% +% +% \begin{macrocode} +\def\tabu@colortest{\futurelet\tabu@temp\tabu@linecolor} +\def\tabu@linecolor{% + \ifcase 0\if ,\noexpand\tabu@temp\else + \ifx\relax\tabu@temp\else + \ifx \@sptoken\tabu@temp1\else + \ifcat A\noexpand\tabu@temp2\else + 3\fi\fi\fi\fi\relax + \def\tabu@next##1{\futurelet\tabu@temp\tabu@linecolor}% + \or\def\tabu@next{\tabu@gobblespace{\futurelet\tabu@temp\tabu@linecolor}}% + \or\let\tabu@next\tabu@getlinecolor + \else\expandafter\remove@to@nnil + \fi \tabu@next +}% \tabu@linecolor +\def\tabu@getlinecolor#1\p@{% + \edef\@tempa{\zap@space #1 \@empty}% + \ifcsname\string\color@\@tempa\endcsname + \edef\tabu@color{\noexpand\noexpand\noexpand\color{\@tempa}}% \set@color + \fi\remove@to@nnil +}% \tabu@getlinecolor +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tabulinestyle} +% +% \cs{tabulinestyle}\M*{style=spec.} +% +% \begin{macrocode} +\def\tabulinestyle#1{\@for\@tempa:=#1\do{\expandafter\tabu@linestyle\@tempa==\@nil}} +\def\tabu@linestyle#1=#2=#3\@nil{% + \begingroup \tabu@getlinespec {#2}\expandafter\gdef + \csname tabu@line@style@\string#1\expandafter\endcsname + \expandafter{\expandafter\def\expandafter\tabu@xleaders + \expandafter{\tabu@xleaders}}% + \endgroup +}% \tabu@linestyle +\expandafter\def \csname tabu@line@style@\endcsname {% + \let\tabu@xleaders \tabu@defaultleaders}% +\def\tabu@defaultleaders{\leaders + \iftabu@firstcline + \vrule depth \arrayrulewidth + \else + \vrule height\dimexpr-\extrarowheight+\arrayrulewidth + depth \extrarowheight + \fi + \tabu@leaderfill} +\let\tabu@leaderfill \hfil +% \end{macrocode} +% \end{macro} +% +% +% \subsection(Verbatim with X columns){Verbatim inside \textt{tabu} with \textt X columns} +% +% \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^^@{\par}\endlinechar\m@ne}% +} +\newcommand\tabu@sanitizetext[1][\ttfamily]{\begingroup + \tabu@verb #1\tabu@s@nitizetext} +\long\def\tabu@s@nitizetext#1{\@makeother\{\@makeother\}% + \everyeof{\noexpand}\scantokens{#1}\endgroup} +% \end{macrocode} +% \end{macro} +% +% +% \subsection{\cs{savetabu}} +% +% \begin{macro}{\savetabu} +% +% 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@}}% + \fi}% +}% \tabu@saveX +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\tabu@savewarn} +% \begin{macro}{\tabu@saveerr} +% +% Info for overwritting when \cs{savetabu} is used. +% +% Error if \cs{usetabu} is called with an unknown argument. +% +% \begin{macrocode} +\def\tabu@savewarn#1#2{\PackageInfo{tabu} + {User-name `#1' already used for \string\savetabu + \MessageBreak #2}}% +\def\tabu@saveerr#1{\PackageError{tabu} + {User-name `#1' is unknown for \string\usetabu + \MessageBreak I cannot restore an unknown preamble!}\@ehd} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% +% \subsection(\cs{rowfont}){\csbf{rowfont}} +% +% \subsubsection(Font and alignment){Setting font and alignment specification} +% +% \begin{macro}{\rowfont} +% +% \cs{rowfont} uses the control sequences \cs{tabu@celllalign}, \cs{tabu@cellleft}, \cs{tabu@cellright}\linebreak +% and \cs{tabu@cellralign} which have been placed on purpose into the user-defined tokens inserted +% in any preamble by the \xpackage{array} package. +% +% \cs{tabu@celllalign} and \cs{tabu@cellralign} are used to modify the alignment. If the optional +% \M[alignment] parameter of \cs{rowfont} is not specified, then those control sequence expand +% to \cs{@empty}. +% +% \cs{tabu@cellleft} contains the font-modification information. +% +% Placement of those control sequences into the user-tokens that are inserted in the preamble +% by the \xpackage{array} package is explained below under the macro \cs{tabu@prepnext@tok}. +% +% \begin{macrocode} +\def\tabu@rowfont{\noalign{\ifnum0=`}\fi\tabu@row@font} +\newcommand*\tabu@row@font[2][]{% + \global\tabu@everycr@tok=\everycr + \global\let\tabu@@cellleft \tabu@cellleft + \global\let\tabu@@cellright \tabu@cellright + \gdef\tabu@cellfont{#2}% + \ifcsname tabu@cell@#1\endcsname % row alignment + \csname tabu@cell@#1\endcsname \fi + \toks@\expandafter {\tabu@cellleft\tabu@cellfont}% inside \noalign group ok + \xdef\tabu@cellleft {\the\toks@}% + \global\everycr\expandafter {\the\everycr\tabu@rowfont@reset}% + \ifnum0=`{\fi}% end of noalign group +}% \rowfont +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\tabu@rowfont@reset} +% +% This macro resets \cs{tabu@celllalign},\, \cs{tabu@cellleft},\, \cs{tabu@cellright},\, \cs{tabu@cellralign}\, and\, +% \cs{everycr} to the value they had before the expansion of \cs{rowfont}. +% +% It expands when a new row is inserted into the tabular or array. +% +% \begin{macrocode} +\def\tabu@rowfont@reset{% + \noalign{% + \global\let\tabu@cellleft \tabu@@cellleft + \global\let\tabu@cellright \tabu@@cellright + \global\let\tabu@cellfont \@empty + \global\let\tabu@celllalign \@empty + \global\let\tabu@cellralign \@empty + \global\everycr=\tabu@everycr@tok + \global\tabu@everycr@tok{}% + }% +}% \tabu@rowfont@reset +% \end{macrocode} +% \end{macro} +% +% \subsubsection(Tokens preparation){Preparing stuff to be able to use \cs{rowfont}} +% +% \begin{macro}{\tabu@prepnext@tok} +% +% \cs{tabu@prepnext@tok} will replace \cs{prepnext@tok} (in \xfile{array.sty}): its purpose is to add +% the control sequences \cs{tabu@celllalign},\, \cs{tabu@cellleft},\, \cs{tabu@cellright}\, and\, \cs{tabu@cellralign}\, +% at the right position in the ``preamble'' for \cs{halign}. Those control sequences are not inserted directly +% into the preamble, but by the means of the user-tokens placed there by the \xpackage{array} package. +% +% The package \xpackage{array} defines a macro \cs{prenext@tok} to initialize each user-token +% inserted at both side of each ``normal'' column. For ``special`' \textttbf @ and \texttbf ! columns, +% there is only one token. +% \begin{center} +% \begin{tikzpicture} +% \node (L) at (1,1) {$\underbrace{\hbox{>\M*{\cs{bfseries}\cs{color}\M*{red}}}}$} +% node [anchor=west] (r) at (L.east) {\raise.5ex\hbox{\larger r}} +% node [anchor=west] (R) at (r.east) {$\underbrace{\hbox{<\M*{\cs{color}\M*{black}\cs ,\cs\$}}}$} +% node [anchor=center] at (L.south) {\cs{toks}<$i$>} +% node [anchor=center] at (R.south) {\cs{toks}<$i+1$>}; +% \end{tikzpicture} +% \end{center} +% +% When a column is inserted in the tabular preamble (\cs{@preamble}), the \TeX{} counter \cs{count@} +% is equal to $i+1$ (\ie the right token) and the counter \cs{@tempcnta} is equal to $i$ (\ie the left token). +% If the column is special (\ie \texttbf @ or \texttbf !) \cs{@tempcnta} is not updated. +% +% Thus, when a new token is ``prepared'' by \cs{prepnext@tok}: +% \begin{description}[leftmargin=1cm] +% \item[either: $\mathbf{i=}$\cs{count@}$\,=$\cs{@tempcnta}]: the token to prepare (\ie \cs{toks}$$) +% is the right one of a ``normal'' column. The switch \cs{iftabu@cellright} is set to \textt{true}. \\ +% The \emph{previous} token (\cs{toks}$=$\cs{toks}\cs{count@}) is necessarily the left one of this ``normal'' column: +% we prepend \cs{tabu@celllalign} and append \cs{tabu@cellleft} to this token (\cs{toks}$$). +% This token is finished and will not change afterwards. +% +% \item[or: $\mathbf{i=}$\cs{count@}$\,=$\cs{@tempcnta}$+1$]: the token to prepare (\cs{toks}$$) is either the left one of a normal column, +% or the single one of a special\, \texttbf @ or \texttbf !\, column.\\ +% If the switch \cs{iftabu@cellright} is true, then the \emph{previous} token \cs{toks}$$ is the right one of the last inserted column +% (which was a ``normal'' column, thus):, \cs{tabu@cellright}\cs{tabu@cellralign}\, is appended to it, and the switch +% \cs{ittabu@cellright} is reset to \texttt{false}. +% May be \cs{prepnext@tok} will be expanded again (by \cs{save@decl}): if it happens, +% then again\, \cs{count@}$\,=$\cs{@tempcnta}$+1$\, (same case) but \cs{iftabu@cellright} is \textt{false} and nothing is changed. +% +% \item[else:] The token to prepare (which is \cs{toks}$=$\cs{toks}\cs{count@}$+1$), cannot be the right one of a ``normal'' column: +% \cs{iftabu@cellright} is set to \textt{false}. \\ +% The fact that\, $\vert$\cs{count@}$-$\cs{@tempcnta}$\vert>1$\, tells us that the previous token \cs{toks}$$ +% is necessarily the single one of a ``special''\, \texttbf @ or \texttbf !\, column. We don't modify this token, as +% long as \emph{special columns are always inserted as is}:\, \cs{rowcolor} has no effect on special +% columns, nor\, \cs{rowfont}. +% \end{description} +% Thereafter, the original initialisation sequence occurs: \cs{advance}\cs{count@}\textt{ by}\cs{@ne} and initialize the token +% to prepare (\cs{toks}\cs{count@}$\,=$\cs{toks}$$) to an empty one. +% +% \begin{macrocode} +\newif\iftabu@cellright +\AtBeginDocument{\let\array@prepnext@tok \prepnext@tok }% original definition +\def\tabu@prepnext@tok{% + \ifnum \count@<\z@ % + \@tempcnta \@M % + \tabu@nbcols\z@ + \gdef\tabu@global@temp{\tabu@nbcols\z@}% + \expandafter\let\csname tabu@tok@1L\endcsname \relax + \tabu@cellrightfalse + \else + \ifcase \numexpr \count@-\@tempcnta \relax % (case 0): prev. token is left + \advance \tabu@nbcols\@ne + \ifnum \tabu@nbcols>\@ne + \expandafter\let\csname tabu@tok@\the\tabu@nbcols L\endcsname \relax + \fi + \expandafter\let\csname tabu@tok@\the\tabu@nbcols R\endcsname \relax + \expandafter\gdef\expandafter\tabu@global@temp\expandafter{% + \tabu@global@temp \advance\tabu@nbcols\@ne}% + \iftabu@cellright % before-previous token is right and is finished + \tabu@cellrightfalse % + \tabu@savetok R\tabu@preptokenright + \fi + \tabu@savetok L\tabu@preptokenleft + \or % (case 1) previous token is right + \tabu@savetok R\tabu@cellrighttrue + \else % special column: do not change the token + \ifnum \tabu@nbcols>\z@ %special column: always on the right of normal one + \else % unless this is the very first column (\tabu@nbcols=0) + \advance\tabu@nbcols\@ne \tabu@savetok L\advance\tabu@nbcols\m@ne + \fi + \iftabu@cellright % before-previous token is right + \tabu@cellrightfalse + \tabu@savetok R\tabu@preptokenright + \fi + \fi % \ifcase + \fi + \array@prepnext@tok +}% \tabu@prepnext@tok +\def\tabu@preptokenright{% + \advance \count@ \m@ne + \toks\count@\expandafter {\the\toks\count@ \tabu@cellright \tabu@cellralign}% + \advance \count@ \@ne +}% \tabu@preptokenright +\def\tabu@preptokenleft{\toks\count@\expandafter {\expandafter\tabu@celllalign + \the\toks\count@ \tabu@cellleft}% +}% \tabu@preptokenleft +\def\tabu@savetok#1{\begingroup + \expandafter\tabu@savet@k\csname tabu@tok@\the\tabu@nbcols #1\endcsname +}% \tabu@savetok +\def\tabu@savet@k#1{% + \@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 +}% \tabu@savetok +% \end{macrocode} +% \end{macro} +% +% \subsubsection(Glue neutralisation){Neutralisation of glues and alignment modification} +% +% \begin{macro}{\tabu@cellleft} +% \begin{macro}{\tabu@celllalign} +% \begin{macro}{\tabu@cellright} +% \begin{macro}{\tabu@cellralign} +% \begin{macro}{\tabu@cellfont} +% First initialisation to \cs{@empty}. +% \begin{macrocode} +\let\tabu@cellleft\@empty +\let\tabu@cellright\@empty +\def\tabu@celllalign{\tabu@cellleft}% row font spec. applies to pre-column material +\let\tabu@cellralign\@empty +\let\tabu@cellfont\@empty +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\tabu@cell@l} +% \begin{macro}{\tabu@cell@c} +% \begin{macro}{\tabu@cell@r} +% \begin{macro}{\tabu@cell@j} +% +% Setup macros to modify the alignment. The skips inserted to make the standard alignment +% specified in the \textt{tabular} preamble are not the same with standard \xpackage{array} tabulars +% and \xpackage{colortbl} tabulars, hence the switch \cs{iftabu@colortbl}. +% +% \begin{macrocode} +\def\tabu@cell@l{% force alignment to left + \gdef\tabu@celllalign{\tabu@removehfil + \raggedright\arraybackslash + \tabu@cellleft}% + \gdef\tabu@cellralign{\tabu@flush1\tabu@ignorehfil}% + \toks@\expandafter{\tabu@cellleft\raggedright\arraybackslash}% local + \xdef\tabu@cellleft{\the\toks@}% +}% \tabu@cell@l +\def\tabu@cell@c{% force alignment to center + \gdef\tabu@celllalign{\tabu@removehfil + \centering\arraybackslash + \tabu@flush{.5}\tabu@cellleft}% + \gdef\tabu@cellralign{\tabu@flush{.5}\tabu@ignorehfil}% + \toks@\expandafter{\tabu@cellleft\centering\arraybackslash}% local + \xdef\tabu@cellleft{\the\toks@}% +}% \tabu@cell@c +\def\tabu@cell@r{% force alignment to right + \gdef\tabu@celllalign{\tabu@removehfil + \raggedleft\arraybackslash + \tabu@flush1\tabu@cellleft}% + \gdef\tabu@cellralign{\tabu@ignorehfil}% + \toks@\expandafter{\tabu@cellleft\raggedleft\arraybackslash}% local + \xdef\tabu@cellleft{\the\toks@}% +}% \tabu@cell@r +\def\tabu@cell@j{% force justification (for p, m, b columns) + \gdef\tabu@celllalign{\tabu@justify\tabu@cellleft}% + \global\let\tabu@cellralign\@empty + \toks@\expandafter{\tabu@cellleft\tabu@justify}% local (noalign grp) + \xdef\tabu@cellleft{\the\toks@}% +}% \tabu@cell@j +\def\tabu@justify{% + \leftskip\z@skip \@rightskip\leftskip \rightskip\@rightskip + \parfillskip\@flushglue +}% \tabu@justify +%% ragged2e settings +\def\tabu@cell@L{% force alignment to left (ragged2e) + \gdef\tabu@celllalign{\tabu@removehfil + \RaggedRight\arraybackslash + \tabu@cellleft}% + \gdef\tabu@cellralign{\tabu@flush1\tabu@ignorehfil}% + \toks@\expandafter{\tabu@cellleft\RaggedRight\arraybackslash}% + \xdef\tabu@cellleft{\the\toks@}% +}% \tabu@cell@L +\def\tabu@cell@C{% force alignment to center (ragged2e) + \gdef\tabu@celllalign{\tabu@removehfil + \Centering\arraybackslash + \tabu@flush{.5}\tabu@cellleft}% + \gdef\tabu@cellralign{\tabu@flush{.5}\tabu@ignorehfil}% + \toks@\expandafter{\tabu@cellleft\Centering\arraybackslash}% + \xdef\tabu@cellleft{\the\toks@}% +}% \tabu@cell@C +\def\tabu@cell@R{% force alignment to right (ragged2e) + \gdef\tabu@celllalign{\tabu@removehfil + \RaggedLeft\arraybackslash + \tabu@flush1\tabu@cellleft}% + \gdef\tabu@cellralign{\tabu@ignorehfil}% + \toks@\expandafter{\tabu@cellleft\RaggedLeft\arraybackslash}% + \xdef\tabu@cellleft{\the\toks@}% +}% \tabu@cell@R +\def\tabu@cell@J{% force justification (ragged2e) + \gdef\tabu@celllallign{\justifying\arraybackslash\tabu@cellleft}% + \global\let\tabu@cellralign\@empty + \toks@\expandafter{\tabu@cellleft\justifying\arraybackslash}% + \xdef\tabu@cellleft{\the\toks@}% +}% \tabu@cell@J +\def\tabu@flush#1{% + \iftabu@colortbl % colortbl uses \hfill rather than \hfil + \hskip \ifnum\currentgrouptype>13 \stretch{#1}% + \else\ifdim#1pt<1pt \tabu@cellskip + \else \stretch{#1} + \fi\fi \relax + \else % array.sty + \ifnum \currentgrouptype>13\relax + \hfil \hskip1sp + \fi + \fi +}% \tabu@flush +\AtBeginDocument{% + \@ifpackageloaded{ragged2e} + {} + {\let\tabu@cell@L \tabu@cell@l + \let\tabu@cell@R \tabu@cell@r + \let\tabu@cell@C \tabu@cell@c + \let\tabu@cell@J \tabu@cell@j + }% +}% AtBeginDocument +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\tabu@removehfil} +% +% \cs{tabu@removehfil} removes (eventually) the infinite stretchable glue inserted +% \emph{before} the cell (in the preamble of \cs{halign}) to make the column alignment. +% +% \begin{macrocode} +\newskip\tabu@cellskip +\let\tabu@hfil\hfil +\let\tabu@hfill\hfill +\let\tabu@hskip\hskip +\def\tabu@removehfil{% + \iftabu@colortbl + \unkern \tabu@cellskip = \lastskip + \ifnum\gluestretchorder\tabu@cellskip = \tw@ \hskip-\tabu@cellskip + \else \tabu@cellskip = \z@skip + \fi + \else + \ifdim\lastskip=1sp\unskip\fi + \ifnum\gluestretchorder\lastskip = \@ne + \hfilneg % \hfilneg for array.sty but not for colortbl... + \fi + \fi +}% \tabu@removehfil +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tabu@ignorehfil} +% +% \cs{tabu@ignorehfil} removes (eventually) the infinite stretchable glue inserted +% \emph{after} the cell (in the preamble of \cs{halign}) to make the column alignment. +% +% \begin{macrocode} +\def\tabu@ignorehfil{% + \aftergroup\tabu@nohfil +}% \tabu@ignorehfil +\def\tabu@nohfil{% \hfil -> do nothing + restore original \hfil + \def\hfil{\let\hfil\tabu@hfil}% local to (alignment template) group +}% \tabu@nohfil +\AtBeginDocument{% + \@ifpackageloaded{colortbl} + {% + \def\tabu@nohfil{% + \def\hfil{\let\hfil\tabu@hfil}% local to (alignment template) group + \def\hfill{\let\hfill\tabu@hfill}% (colortbl uses \hfill) pfff... + \def\hskip##1\relax{\let\hskip\tabu@hskip}}% local + }% @ifpackageloaded colortbl + {}% +}% AtBeginDocument +% \end{macrocode} +% \end{macro} +% +% +% +% \subsection{Utilities} +% +% \subsubsection{tabu \cs{fbox}} +% +% \cs{tabu@fbox} works exactly like \LaTeX{} \cs{fbox} but allows the syntax: \cs{fbox}\cs{bgroup}...\cs{egroup} +% suitable for use inside tabular columns. \cs{fbox} is \cs{let} to \cs{tabu@fbox} at the entry inside a \textt{tabu} +% environment. +% +% \begin{macrocode} +\def\tabu@fbox{% + \leavevmode + \let\color@bgroup\bgroup + \def\color@egroup{\endgraf\egroup}% + \afterassignment\tabu@begin@fbox + \setbox\@tempboxa \hbox +}% \tabu@fbox +\def\tabu@begin@fbox{\color@bgroup\kern\fboxsep\aftergroup\tabu@end@fbox} +\def\tabu@end@fbox{\kern\fboxsep\color@egroup\@frameb@x\relax} +% \end{macrocode} +% +% +% \subsubsection{\cs{centering}, \cs{raggedright}, \cs{raggedleft}} +% +% Inside \textt{tabu} environment, no need to add \cs{arraybackslash} after these commands. +% +% \begin{macrocode} +\expandafter\def\expandafter\tabu@centering\expandafter{% + \centering\arraybackslash} +\expandafter\def\expandafter\tabu@raggedleft\expandafter{% + \raggedleft\arraybackslash} +\expandafter\def\expandafter\tabu@raggedright\expandafter{% + \raggedright\arraybackslash} +\AtBeginDocument{% +\expandafter\def\expandafter\tabu@trivlist\expandafter{% + \expandafter\let\expandafter\\\expandafter\@centercr\@trivlist}% +}% +% \end{macrocode} +% +% +% +% +% \subsection{Corrections} +% +% \subsubsection(delarray compatibility fix){delarray comptability fix for \xpackage{colortbl} and \xpackage{arydshln}} +% +% Both \xpackage{colortbl} and \xpackage{arydshln} forgot the control sequence \cs{@arrayright} +% which must be expanded by \cs{endarray}. Originally defined for \xpackage{delarray}, this control +% sequence is used by \textt{tabu} environments when \textt{tabu X} columns are present in the preamble. +% +% Here is the fix. We test if \cs{endarray} contains \cs{@arrayright} before modifying the control sequence, +% in case \xpackage{colortbl} and/or \xpackage{arydshln} modify their implementation. +% +% \begin{macrocode} +\def\tabu@fix@arrayright{% + \@ifpackageloaded{arydshln} + {% + \@ifpackageloaded{colortbl} + {%% colortbl + arydshln + \def\tabu@endarray{% + \adl@endarray \egroup \adl@arrayrestore \CT@end \egroup % + \@arrayright % + \gdef\@preamble{}% + }}% \endarray + {%% arydshln / no colortbl + \def\tabu@endarray{% + \adl@endarray \egroup \adl@arrayrestore \egroup % + \@arrayright % + \gdef\@preamble{}% + }}% \endarray + }% + {% + \@ifpackageloaded{colortbl} + {%% colortbl / no arydshln + \def\tabu@endarray{% + \crcr \egroup \egroup + \@arrayright % + \gdef\@preamble{}\CT@end + }}% + {\PackageWarning{tabu} + {\string\@arrayright\space is missing from the + \MessageBreak definition of \string\endarray. + \MessageBreak Comptability with delarray.sty is broken.}}% + }% +}% \tabu@fix@arrayright +% \end{macrocode} +% +% \subsubsection{arydshln @ columns} +% +% \begin{macrocode} +\def\tabu@adl@xarraydashrule#1#2#3{% + \ifnum\@lastchclass=\adl@class@start\else + \ifnum\@lastchclass=\@ne\else + \ifnum\@lastchclass=5 \else % @-arg (class 5) and !-arg (class 1) + \adl@leftrulefalse \fi\fi % must be treated the same + \fi + \ifadl@zwvrule\else \ifadl@inactive\else + \@addtopreamble{\vrule\@width\arrayrulewidth + \@height\z@ \@depth\z@}\fi \fi + \ifadl@leftrule + \@addtopreamble{\adl@vlineL{\CT@arc@}{\adl@dashgapcolor}% + {\number#1}#3}% + \else \@addtopreamble{\adl@vlineR{\CT@arc@}{\adl@dashgapcolor}% + {\number#2}#3} + \fi +}% \tabu@adl@xarraydashrule +% \end{macrocode} +% +% \subsubsection{arydshln 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: +% +% \begin{Verb*} +% \unskip \ifhmode \nobreak +% \vrule\@width\z@\@height\z@\@depth\dp\@arstrutbox +% \fi +% \egroup \adl@colhtdp \box\adl@box \hfil +% \end{Verb*} +% +% The \cs{vrule} inserted is exactly what package \xpackage{array} calls: \cs{@finalstrut}\cs{@arstrutbox}. +% +% 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). +% +% +% \begin{macrocode} +\def\tabu@adl@act@endpbox{% + \unskip \ifhmode \nobreak \fi \@finalstrut \@arstrutbox + \egroup + \adl@colhtdp \box\adl@box \hfil +}% \tabu@adl@act@endpbox +% \end{macrocode} +% +% + +% +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \restoregeometry +% \bookmarksetup{bold*} +% +% \begin{History} +% +% +% \begin{Version}{2010/10/28 v1.0} +% \item First version. +% \end{Version} +% +% \end{History} +% +% +% \PrintIndex +% +% \Finale \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/tabu/tabu.ins b/Master/texmf-dist/source/latex/tabu/tabu.ins new file mode 100644 index 00000000000..73047d8b35b --- /dev/null +++ b/Master/texmf-dist/source/latex/tabu/tabu.ins @@ -0,0 +1,87 @@ +%% +%% This is file `tabu.ins', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tabu.dtx (with options: `install') +%% +%% This is a generated file. +%% +%% tabu : 2010/10/27 v1.1 - tabu : Flexible LaTeX tabulars +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% +%% This work consists of the main source file tabu.dtx +%% and the derived files +%% tabu.sty, tabu.pdf, tabu.ins +%% +%% tabu : Flexible LaTeX tabulars +%% Copyright (C) 2010 by Florent Chervet +%% +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: 2010/10/27 v1.1 - tabu: Flexible LaTeX tabulars} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\let\MetaPrefix\relax +\preamble + +This is a generated file. + +tabu : 2010/10/27 v1.1 - tabu : Flexible LaTeX tabulars + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in + http://www.latex-project.org/lppl.txt + +This work consists of the main source file tabu.dtx +and the derived files + tabu.sty, tabu.pdf, tabu.ins + +tabu : Flexible LaTeX tabulars +Copyright (C) 2010 by Florent Chervet + +\endpreamble +\let\MetaPrefix\DoubleperCent + +\generate{% + \file{tabu.ins}{\from{tabu.dtx}{install}}% + \file{tabu.sty}{\from{tabu.dtx}{package}}% +} + +\askforoverwritefalse +\generate{% + \file{tabu.drv}{\from{tabu.dtx}{driver}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* tabu.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `tabu.dtx'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile + +\endinput +%% +%% End of file `tabu.ins'. -- cgit v1.2.3