% \iffalse meta-comment % tabu : 2010/12/28 v1.8 - 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/12/28 v1.8 - tabu: Flexible LaTeX tabulars} \Msg{************************************************************************} \keepsilent \askforoverwritefalse \let\MetaPrefix\relax \preamble This is a generated file. tabu : 2010/12/28 v1.8 - 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/12/28} \def\thisversion{1.8} \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} \PassOptionsToPackage{hyperfootnotes}{hyperref} \documentclass[a4paper,oneside]{ltxdoc} \AtBeginDocument{\DeleteShortVerb{\|}} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{etoolbox,geometry,graphicx,xcolor,lastpage,lmodern,bbding,hologo,relsize,moresize,manfnt,pifont,xspace,numprint,amsmath} \usepackage[official]{eurosym} \usepackage[expansion=all,stretch=20,shrink=60]{microtype} \usepackage{tocloft,titlesec,hypbmsec,fancyhdr,enumitem,multirow,makecell,booktabs,delarray,ragged2e,colortbl,marginnote,shapepar,needspace} \heavyrulewidth=.7pt \usepackage{holtxdoc,bookmark} \usepackage{longtable} \usepackage{tabularx}\tracingtabularx \usepackage{enumitem-zref} \usepackage[verbose]{linegoal}[2010/12/07] \usepackage{interfaces}[2010/12/07] \usetikz{basic,chains,positioning} \usepackage{embedfile} \RequirePackage{amsopn,amsmath}% \DeclareMathOperator \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]{tabu}\tracingtabu=2 \tabulinestyle{dash=\hbox{$\mkern2mu\scriptscriptstyle\cdotp\mkern2mu$}} \lastlinefit999 \geometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=4cm,right=1.5cm} \hypersetup{% pdftitle={tabu}, pdfsubject={a simple line parser for TeX}, pdfauthor={Florent CHERVET}, colorlinks,linkcolor=reflink,urlcolor=CornflowerBlue, 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{4626} % % \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,\TMP@EnsureCode} % \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{}} % \providecommand\lsstyle{} % \makeatletter % \catcode`\§ \active \def§{\@ifnextchar §{\par\nobreak\vskip-2\parskip}{\par\nobreak\vskip-\parskip}} % \def\thispackage{\xpackage{{\pkgcolor\thisfile}}\Xspace} % \def\Xpackage#1{\href{http://www.ctan.org/tex-archive/help/Catalogue/entries/#1.html}{\xpackage{#1}}} % \def\Underbrace#1_#2{$\underbrace{\vtop to2ex{}\hbox{#1}}_{\footnotesize\hbox{#2}}$} %\def\FV@DefineCommandChars #1#2#3{% % \edef\FV@restoreCommandChars{% % \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}} % \def\texorpdf#1#2{\texorpdfstring{#1{#2}}{#2}} % \def\textitbf#1{\textbf{\itshape#1}}\let\textbfit\textitbf % \DefineVerbatimEnvironment{VerbLines}{Verbatim}{frame=lines,framesep=6pt,fontfamily=\ttdefault,fontseries=m} % \DefineVerbatimEnvironment{VerbLines*}{Verbatim}{frame=lines,framesep=6pt,fontfamily=\ttdefault,fontseries=m,commandchars=$()} % \DefineVerbatimEnvironment{Verb}{Verbatim}{fontfamily=\ttdefault,fontseries=m} % \DefineVerbatimEnvironment{Verb*}{Verbatim}{fontfamily=\ttdefault,fontseries=m,commandchars=$()} % \renewrobustcmd*\mathversion[1]{^^A % \expandafter\ifx\csname mv@#1\endcsname\relax % \@latex@error{Math version `#1' is not defined}\@eha % \else \edef\math@version{#1}\gdef\glb@currsize{}\aftergroup\glb@settings % \ifmmode \check@mathfonts \fi % \fi % } % \newrobustcmd*\OR{{\,\upshape\texttbf\textbar\,}} % \newrobustcmd*\CheckOK{{\scriptsize\textcolor{ForestGreen}\CheckmarkBold}} % \newrobustcmd*\CheckFAIL{{\scriptsize\textcolor{Crimson}\XSolidBrush}} % \newcommand\tikzlabel[2][]{\tikz[{remember picture,#1}]\coordinate ({#2});\ignorespaces} % \newlist{itempunct}{itemize}{1} % \setlist[itempunct]{nolistsep,font=\smaller,leftmargin=1.7em,label=\textbullet} % \def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}} % \def\ttdefault{lmvtt} % \renewrobustcmd\#[1]{{\usefont{T1}{pcr}{bx}{n}\char`\##1}} % \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 % \if@nobreak \par\nobreak % \else \par\addvspace\parskip % \needspace{\bottomtitlespace}\fi % \noindent\changefont{size+=2.5pt,spread=1,fam=\ttdefault}^^A % \hspace{-\leftmargini}^^A % \def\*{\unskip\,\texttt{*}}^^A % \begin{tabu}{|l|}^^A % \hline % \expandafter\SpecialUsageIndex\csname #2\endcsname % \raisedhyperdef[14pt]{declcs}{#2}{\cs[{#1}]{#2}}^^A % }^^A % \renewcommand\enddeclcs{% % \crcr \hline % \end{tabu}% % \nobreak \par \nobreak % \noindent % \ignorespacesafterend % } % \newrobustcmd*\csref[2][]{\hyperref{}{declcs}{#2}{\cs[{#1}]{#2}}} % \def\declmargin{\hspace*{\declmarginwidth}} % \def\declmarginwidth{\dimexpr-\leftmargini+\arrayrulewidth+\tabcolsep} % \pretocmd\textasteriskcentered{\usefont{OMS}{cmsy}mn}{}{} % \newrobustcmd*\abs[1]{\left\lvert#1\right\rvert} % \bookmarksetup{open=true,openlevel=2} % \pagesetup{% % head/rule/width=.0pt, % left/offset=3cm,foot/left/offset+=.5cm,right/offset=1cm, % 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} % \bottomtitles=.15\textheight % \sectionformat\section{ % mark=\marksthe{section}{#1}, % left=\declmarginwidth, % 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, % left=.5\declmarginwidth, % 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,beginpenalty=10000} % \tikzset{every picture/.add style={}{/utils/exec=\changefont{spread=1}}} % \newrobustcmd*\IMPLEMENTATION{% % \newgeometry{top=0.8cm,headheight=.5cm,headsep=.3cm,bottom=1.2cm,footskip=.5cm,left=5cm,right=.5cm} % \pagesetup*{ % left/offset+=1cm,right/offset-=1cm, % head/left=\moveleft1cm\vbox to\z@{\vss\setbox0=\null\ht0=\z@\wd0=\paperwidth\dp0=\headheight\rlap{\colorbox{GhostWhite}{\box0}}}\vskip-\headheight t\,a\,b\,u\,\ \ i\,m\,p\,l\,e\,m\,e\,n\,t\,a\,t\,i\,o\,n, % }% % \clearpage % \sectionformat\section{bookmark/color=black}\sectionformat\subsection{bookmark/color=black} % \bookmarksetup{bold*,openlevel=3} \hfuzz=3mm % \section(Implementation)[\mdseries\scshape\pmb{Implementation}]{Implementation} \label{sec:implementation}} % \let\plainllap\llap % \newrobustcmd\macro@llap[1]{\global\let\llap\plainllap\setbox0\hbox{#1}^^A % \ifdim\wd0>4.4cm\hbox to\z@{\hss\hbox to4.4cm{#1\hss}}^^A % \edef\@tempa{\the\everypar\hskip\dimexpr\the\wd0-4.4cm\relax\global\everypar{}}% % \global\everypar\expandafter{\@tempa}^^A % \else\hbox to\z@{\hss#1}\fi % \setbox\z@\box\voidb@x} % \pretocmd\macro{\needspace{2\baselineskip}\MacrocodeTopsep=\z@skip\MacroTopsep\z@skip\let\llap\macro@llap\parsep=\z@\topsep=\z@\itemsep=\z@\partopsep\z@}{}{} % \apptocmd\endmacro{\goodbreak\vskip.3\parskip}{}{} % % \colorlet{reflink}{DarkSlateBlue} % \newrobustcmd*\stform{\ifincsname\else\expandafter\@stform\fi} % \newrobustcmd*\@stform{\@ifnextchar*{\@@stform[]\textasteriskcentered\@gobble}\@@stform} % \newrobustcmd*\@@stform[2][\string]{\textttbf{#1#2}\Xspace} % \newrobustcmd\Xspace{\ifnum\catcode`\ =\active\else\expandafter\xspace\fi} % % \makeatother % % \deffootnote{1em}{0pt}{\rlap{\textsuperscript{\thefootnotemark}}\kern1em} % % \title{\vspace*{-28pt}\href{http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/tabu.html}{\HUGE\bfseries\sffamily t\,a\,b\,u}\vspace*{6pt}} % \date{} % \author{\small\thisdate~--~\hyperref[\thisversion]{version \thisversion}} % \subtitle{\begin{tabu}{X[c]} tabu\, and\, longtabu \\[1ex] \LARGE Flexible \LaTeX{} tabulars\\ \small\FC \end{tabu}\vspace*{-12pt}} % \maketitle % % {\makeatletter\let\@thefnmark\@empty\let\@makefntext\@firstofone % \footnotetext{\noindent\parskip=0pt\scriptsize % This documentation is produced with the \textt{DocStrip} utility, and required \thispackage with its \textt{linegoal} option.\par % \begin{tabu}{X[-3]X[-1]X} % \smex To get the package, &run: &\texttt{etex \thisfile.dtx} \\ % \smex To get the documentation &run (thrice): &\textt{pdflatex \thisfile.dtx} \\ % \leavevmode\hphantom\smex To get the index, &run: &\texttt{makeindex -s gind.ist \thisfile.idx} % \end{tabu}§ % The \xext{dtx} file is embedded into this pdf file thank to \Xpackage{embedfile} by H. Oberdiek.} % } % % \deffootnote{1em}{0pt}{\rlap{\thefootnotemark.}\kern1em} % % {\let\quotation\relax\let\endquotation\relax\vspace*{-1cm}% % \begin{abstract}\parskip\smallskipamount\parindent0pt\lastlinefit0\leftskip.7cm\rightskip\leftskip % % This package defines a single environment \textt{tabu} to make all kinds of tabulars in text or in math mode % provided that they do not split across pages. % % Starting from version 1.5, the environment \textt{longtabu} is provided to make tabulars that can stretch out % on several pages. \textt{longtabu} works like \textt{tabu} and is defined only if the package % \Xpackage{longtable} is loaded. % % \textt{tabu} is more flexible that \textt{tabular}, \textt{tabular*}, \textt{tabularx} % and \textt{array} and extends the possibilities. All tabulars in this document were made % with the \textt{tabu} environment. Widths computations for \textt{tabu X} columns is % \refitem{item:convergence optimisation}[optimised] compared to \Xpackage{tabularx} implementation. % Last (but not least) \textt{tabu} is fully compatible with any package that provides commands % to format tabulars. Indeed, \textt{tabu} does not modify any of the macros of \xfile{array.sty}. % % \thispackage requires \eTeX{} and the standard package \xfile{array.sty}. Natural widths of columns % are computed by (but not printed by) the code of \Xpackage{varwidth} by D. Arseneau (for the cases of % \hyperref[X columns with tabu spread]{\textt X columns in \textt{tabu spread}} and % \refitem{tabu X columns,2}[negativ width coefficients]\footnote{The documentation is compiled with % \hyperref[enumitem-zref]{\xpackage{enumitem-zref}}}). Finally \textt{longtabu} is based on \textt{longtable}. % % \end{abstract}} % % \makeatletter \enlargethispage\baselineskip % \tocsetup{ % dot=$\scriptscriptstyle\ldotp$, % dotsep=1mu, % title/top=8pt plus2pt minus4pt, % 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 % \begingroup % ^^A\geometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=4cm,right=1.5cm} % \newgeometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=1.5cm,right=1cm} % \pagesetup*{left/offset-=2.5cm,right/offset-=.5cm} % % \changefont{spread*=1.1} % \phantomsection\label{Summary} % \addcontentsline{toc}{section}{Summary of the features provided by \textt{tabu}} % \def\arraystretch{1.1}\enlargethispage\baselineskip\vspace*{-6mm} % \begin{tabu}{>{\ttfamily\bfseries}X[-1]X} \toprule % \rowfont{\larger\bfseries\lsstyle} % \multicolumn2c{Summary of the features provided by \xpackage{tabu}} \\ \tabucline[dash]- % \hyperref[sec.tabu]{tabu} & % is like \textt{tabular} in text mode and like \textt{array} in math mode when there is no % \textt X column in its preamble % \\ % \hyperref[sec.longtabu]{longtabu} & % is like \textt{longtable} with the possibility to use \textt{tabu X} columns and vertical lines % with the extended syntax. % \\ % \hyperref[Vertical lines]{\texttbf\textbar[width,color]} & % vertical lines have an optional parameter. % \\ % \M*{tabu} to \meta{dimen} & % specifies the target width of the whole tabular. This is like \textt{tabular\textasteriskcentered}\, % with an automatic stretchability that can be overwritten with \textt{@\M*{\cs{extracolsep}\M*{dimen}}} % in front of the preamble. % \\ % \M*{tabu} spread \meta{dimen} & % has no equivalent in \LaTeX: the final width is \meta{dimen} wider than the % natural width that can be obtained with \textt{spread 0pt}. % \\ \tabucline[dash]- % \hyperref[tabu X columns]{X[coef,align,type]} \par X[coef,align,type,\$] & % \textt X columns widths are adjusted in order for the whole tabular to fit the % target width. The target width is a dimension either: % \begin{itempunct}[label=\ding{223}] % \item directly specified with \textt{\M*{tabu} to\meta{dimen}} % \item computed from the natural width: \textt{\M*{tabu} spread\meta{dimen}} % \item by default \cs{linewidth} (or \cs{linegoal} with the \textt{linegoal} package option). % \end{itempunct} % \textt{coef} scales the widths of the \textt X columns, if there are more than one \textt X column. \par % \textt{align} is either \textt r, \textt c, \textt l\, or\, \textt j\, and \textt{type}\, can be \textt p (default), \textt m\, or\, \textt b. \par % \textt{X[\$]}\, makes a math \textt X column (\ie \textt{>\M*{\$}X<\M*{\$}}) % \\ % \refitem{tabu X columns,2}[{X[$-$coef,align,type]}] & % \textt X columns widths are first computed with the absolute value: $\mathversion{bold}\abs{\textt{coef}}$.\par % Then the width is made narrower down to the natural width of the column if possible.\par % In any case, the final width does not exceed the one obtained with \textt{X$\mathversion{bold}\left[\abs{\textt{coef}}\right]$}. \par % The final \textt{tabu} can be narrower than its \textt{target} if: % \begin{itempunct} % \item all \textt{coefs} are negativ,\, and % \item no target has been specified (\ie the default target is used). % \end{itempunct} % In this case, \textt{tabu} behaves as if it was said:\, \textt{\M*{tabu} spread 0pt}. % \\ \tabucline[dash]- % \csref{savetabu}\M*{user-name} & % Saves the \textt{tabu} preamble and its parameters. \par % The command must appear at the end of a line: after \string\\\ or \cs{hline}. % \\ % \csref{usetabu}\M*{user-name} & % Makes a \textt{tabu} of exactly the same shape as the one saved with \cs{savetabu}. % All parameters (\textt{target}, \textt{preamble}, \textt{stretch} \etc) are restored.\par % This command is put alone in the preamble in place of the columns specifications. % \\ % \csref{preamble}\M*{user-name} & % Makes a \textt{tabu} with the same preamble as the one saved with \cs{savetabu}.\par % The \textt{preamble} only is restored, not the \textt{target} nor any other parameter.\par % This command is put alone in the preamble in place of the columns specifications. % \\ \tabucline[dash]- % \csref{tabuphantomline} & inserts a phantom (\ie invisible) line inside the \textt{tabu}\par % May be usefull with \cs{multicolumn} in some cases. % \\ \tabucline[dash]- % \csref{tabucline}\M*[spec]\M*{start-stop} & Draws a line comparable to \cs{hline}. The line \meta{spec} can contain % information for making a dash or dotted line (f.ex. \M*[on 3pt off 6pt]) and a color name.\par % The line spec can also be defined with \cs{tabulinestyle} % \\ % \csref{tabulinestyle}\M*{name=spec,...} & Defines a line style for use with \cs{tabucline} % \\ \tabucline[dash]- % \begin{tabu}{@{}X[-1]} \csref{tracingtabu} \\ \cs{tracingtabu}=2\end{tabu} & % Reports informations in the \xext{log} file about the steps of the algorithm for \textt{tabu X} columns, % and the informations saved by \cs{savetabu}. % \\ \bottomrule % \end{tabu} % % \textbf\textbar\, \textt{X}\, \cs{usetabu}\, and\, \cs{preamble} are defined as new column types loaded % only inside the \cs{@mkpream} group inside the \textt{tabu} environment. % % % \clearpage % \endgroup % % \setitemize{leftmargin=3em} % \section{The \textt{tabu} environment} % \label{sec.tabu} % % % \subsection(tabu, tabu to, tabu spread){\textt{tabu}, \textt{tabu to} and \textt{tabu spread}} % % {\let\red\relax % \begin{declcs}{begin}\M*{tabu} \M*[pos] \M*{tabular preamble} \\ % \cs{begin}\M*{tabu} to \meta{dimen} \M*[pos] \M*{tabular preamble} \\ % \cs{begin}\M*{tabu} spread \meta{dimen} \M*[pos] \M*{tabular preamble} \\ % \end{declcs}} % % The \textt{tabu} environment behaves exactly like \textt{tabular}: the preamble % is parsed by the macros in \xfile{array.sty} with no modification. % \textt{tabu} improves \textt{tabular} and \textt{array}: % \begin{itemize} % \item \textbf{footnotes} and index words are allowed inside \textt{tabu}, unlike \xpackage{tabularx}, footnote links % are not broken when compiled with \xpackage{hyperref}. The syntax \cs{footnote}\M[number]\M{text} % is allowed in \textt{tabu} and \textt{longtabu} (this is not implemented for \xpackage{longtable} yet...) % \item \textt X columns are implemented with an \emph{optional} parameter for the \textbf{width-coefficient} % (which can be \refitem{item:Negativ width coefficients}[negativ]: see next section), % the \textbf{alignment} (\textt r, \textt c, \textt l, or \textt j, and \textt R, \textt C, \textt L or \textt J % for \xpackage{ragged2e} settings) and % the \textbf{column type} (\textt p, \textt m, or \textt b). \\ % \textt{tabu} has a \refitem{item:default target width}[default target width] when used with \textt X columns, % making nesting even easier. % \item You are used to the \textt{tabular} environment in text mode, and \textt{array} in math mode, % but \textt{tabu} works in both modes and its name does not change... \textt X columns are also % possible in math mode; \xpackage{delarray} shortcuts for delimiters are available in both math and text modes. % \item A \textt{tabu} environment can contain another tabular of any kind: \textt{tabular}, \textt{tabular\stform*}, % \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} provides facilities for \hyperref[Lines inside tabu]{vertical and horizontal lines}, % and for the insertion of \hyperref[Verbatim inside tabu]{verbatim text} inside \textt X columns. % \item \textt{tabu} is more than compatible with \xpackage{arydshln} (for dashed and dotted lines) % and \xpackage{colortbl}: actually some corrections of those packages are loaded as soon as you % enter a \textt{tabu} environment. Compatibility with \xpackage{delarray}, \xpackage{hhline}, % \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 another value for \cs{extracolsep} is specified. 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{longtabu}, \textt{longtabu to} and \textt{longtabu spread}} % \label{sec.longtabu} % % \begin{declcs}{begin}\M*{longtabu}\,\M*[l\OR c\OR r]\,\M*{tabular preamble} \\ % \cs{begin}\M*{longtabu} to \meta{dimen}\,\M*[l\OR c\OR r]\,\M*{tabular preamble} \\ % \cs{begin}\M*{longtabu} spread \meta{dimen}\, \M*[l\OR c\OR r]\,\M*{tabular preamble} % \end{declcs} % % \textt{longtabu} is just like \textt{tabu} but page breaks are allowed between rows of the table. % \textt{longtabu} is based on the \Xpackage{longtable} package which must be loaded, and all features % of the \textt{longtable} environment works inside \textt{longtabu}: \cs{endhead}, \cs{endfirsthead}, % \cs{endfoot}, \cs{endlastfoot} and \cs{caption}. % % \textt{longtabu} enhances the possibilities of \textt{longtable} with the possibility to use \textt{X columns} % and line specification for \hyperref[Vertical lines]{vertical rules}. \textt{longtabu} is thus much easier than % \Xpackage{ltxtable}. % \goodbreak % % The following commands provided for \textt{tabu} does not work with \textt{longtabu}:\par\nobreak % \let\theadfont\bfseries % \begin{tabu}{X[-1]*2{X[-1c]}X} \toprule % \rowfont[c]{\bfseries} \textt{tabu} command &\thead{Not \\available} &\thead{Not \\implemented} &Comment \\\tabucline[dash]- % \csref{tabucline} & &\AsteriskRoundedEnds &\cs{tabucline} does not care of page breaks presently: use \cs{hline} instead. \\ % \csref{usetabu} &\CheckFAIL & &but \csref{savetabu} and \csref{preamble} work. \\ % \hyperref[sec.math mode]{mathematical mode} &\CheckFAIL & &\textt{longtable} is not designed to work in math mode. \\ % \xpackage{delarray} shortcuts &\CheckFAIL & &a delimiter cannot be spanned over pages... \\ % \csref{tabuphantomline} &\CheckFAIL & &useless inside \textt{longtabu} % \\\bottomrule % \end{tabu} % % However, \textt{tabu X} columns, \csref{rowfont}, \csref{verbatim} and \csref{tabudecimal} work inside \textt{longtabu}. % % % \subsection{\textt{tabu X} columns} % \label{tabu X columns} % % \textt{tabu X} columns can be viewed as an enhancement of \xpackage{tabularx} \textt X columns, but do not interact % with them, for they are defined only for a short time during the parsing of the preamble: % \begin{itemize}[name=tabu X columns] % \item \textbf{width coefficients} can optionally be given to \textt X columns\\ % ex.\, \texttbf{X[2.5]X[1]}\, is the same as\, \texttbf{X[2.5]X}\, and the same as\, \texttbf{X[5]X[2]} \\ % This means that the first \textt X column will be two and a half wider than the second one or % that the first \textt X column width will be \sfrac{5}{7} of the whole tabular width. \\[.5\baselineskip] % \begin{tabu}to\linewidth{|X[c,2.5]|X[c]|} \firsthline \textt{X[2.5]} & \textt X \\ \hline\end{tabu} % \item \textbf{negativ width coefficients} \label{item:Negativ width coefficients} can be given to \textt X columns: \\ % ex.\, \texttbf{X[-2.5]X[1]}\, or\, \texttbf{X[-2.5]X} \, or\, \texttbf{X[-5]X[2]} \\ % In this case, the first \textt X column will be \textitbf{at most} two and a half wider than the second one, % and if the \emph{natural width} of the first \textt X column is finally less than % $2.5 \times \left(\text{the width of the second column}\right)$ then it will be narrowed down to this natural width. % \textbf{The following \textt{tabu}{\smaller s} have the same preamble:} \\ % \hspace*{1em}\cs{begin}\M*{tabu} to\cs{linewidth}\M*{|X\M*[$-$2.5c]|X\M*[c]|}: \\ % \begin{tabu} to\linewidth{|X[c,-2.5]|X[c]|} \tabucline- % \textt{X[$-$2.5]} & \textt X \\ \tabucline- % \end{tabu} \\ % \begin{tabu} to\linewidth{|X[c,-2.5]|X[c]|} \tabucline- % Negativ coefficients make \textt X columns close to standard\par \textt l, \textt c and \textt r columns. % & \textt X \\ \tabucline- % \end{tabu} % \item horizontal alignment specification is made easier with\, \texttbf{X[5,r]X[2,c]}\, for example. Vertical % alignment can be specified as well with\, \textt{X[5,r,m]X[2,p,c]}\, (commas are not required, % but \textt{X[2cm]} or \textt{X[4pc]} could be misunderstood -- not by \TeX{}: by you...).\\ % \begin{tabu}to \linewidth{X[-2c]X[c]c} % \rowfont{\bfseries\ttfamily} Modifier & Meaning & Default \\ % \textt l, \textt c, \textt r, \textt j, \textt L, \textt C, \textt R, \textt J & left, centered, right, justified & \textt j \\ % \textt p, \textt m, \textt b & \textt X column is converted into \textt p, \textt m or \textt b column & \textt p \\ % \$ & \textt{X[\$]} is a shortcut for:\, \textt{>\M*{\$}X<\M*{\$}} & \\ % \end{tabu} % \item \textt{tabu X} columns can be spanned with \cs{multicolum}. % \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 \label{item:convergence optimisation} Convergence to the target width is optimised: % the \cs{halign} preamble is not re-built at each trial, but only expanded again, % until the target is reached. Though optimized, the process is the same as the one implemented for \textt{tabularx} % and in particular the content of the \textt{tabu} environment is collected as soon as a \textt{tabu X} column % is found in the preamble. This implies restrictions on catcode modifications and verbatim text inside % a \textt{tabu} with \textt X columns. % \item \label{item:default target width} If the width of the whole tabular is not specified with ``\textt{tabu to}'' % it is considered to be \cs{linewidth}. % \nameref{subsec:linegoal package option} makes the default width equal to \cs{linegoal}. Compilation must then be done % with \hologo{pdfTeX} either in \textt{pdf} or \textt{dvi} mode, and package \xpackage{linegoal} is loaded. % \cs{linegoal} requires \hologo{pdfTeX} for its \cs{pdfsavepos} primitive and the \xpackage{zref-savepos}: % if the \textt{tabu} is not alone in its paragraph \ie if the target is not % \cs{linewidth}, then two compilations (or more) are required to get the correct target. \\ % Default target for nested \textt{tabu} environments is always \cs{linewidth}, which equals to the column width inside % \textt p, \textt m, \textt b and \textt X columns. % \item As long as the \cs{halign} content is expanded more than once, protections against counters incrementation, whatsits (\emph{write}) % index entries, footnotes \etc. are set up: the mechanism of \xpackage{tabularx} is reimplemented and enhanced for \textt{tabu X} columns. % \cs{tabuDisableCommands} can be used to neutralize the expansion of additional macros during the trials. % \end{itemize} % % \subsubsection(X columns with tabu spread){X columns with ``\textt{tabu spread}''} % \label{X columns with tabu spread} % % \textt{tabu X} columns can be used with ``\textt{tabu spread}'' to adjust the column widths of tabulars that contain % only small pieces of text. The question is: how to make a tabular the width of the line, with 6 columns; the columns 1, 2, 5 and 6 % 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: % % \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]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\footnote{Capital of the U.K. (too see a linked footnote)} % 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\vskip\baselineskip % The result of this example is the same as if one had written \cs{begin}\M*{tabu}\textt{to}\cs{linewidth}. % & \cellcolor{GhostWhite}\centering\rotatebox{-90}{\kern-1.4ex\bfseries Sherlock Holmes} % \\ \tabucline{1-2} % \multicolumn{2}{|c|}{The ``official'' web site: \url{http://www.sherlockholmes.com/}} & \omit \\ \tabucline{-2} % \end{tabu}} % % In the preamble, \textt{@\M*{}} means that the margin is removed. % % \subsubsection{Negativ width coefficients for \textt X columns} % % \begin{Verb} % \begin{tabu}{|[3pt ForestGreen]X[-1m]|X[c m]|[3pt ForestGreen]} % \tabucline[3pt ForestGreen]- % $\begin{tabu}({X[-1$]X[-1$c]}) % equivalent to spread 0pt % \alpha & \beta \\ % \gamma & \delta + \epsilon + \zeta + \eta + \theta % \end{tabu}$ % & % This is a tabu with negativ width coefficients for \textt X columns % \\ \tabucline[3pt ForestGreen]- % \end{tabu} % \end{Verb} % % \begin{tabu}{|[3pt ForestGreen]X[-1m]|X[c m]|[3pt ForestGreen]} \tabucline[3pt ForestGreen]- % $\begin{tabu}({X[-1$]X[-1$c]}) % \alpha & \beta \\ % \gamma & \delta + \epsilon + \zeta + \eta + \theta % \end{tabu}$ % & % This is a tabu with negativ width coefficients for \textt X columns % \\ \tabucline[3pt ForestGreen]- % \end{tabu} % % % \subsubsection{Multicolumn in \textt{tabu}} % % \begin{declcs}{tabuphantomline} % \end{declcs} % % The process of \cs{multicolumn} implies the \TeX{} primitive \cs{omit} which discard the tabular preamble % for the spanned columns. Discarding the preamble means discarding the information about the widths of the % columns. This explains why the following example does not work properly: % % \begin{Verb*} % \begin{tabu}{|X|X|X[2]|} \tabucline- % \multicolumn2{|c|}{Hello} & World \\ \tabucline- % \end{tabu} % \end{Verb*} % % \begin{tabu}{|X|X|X[2]|} \tabucline- % \multicolumn2{|c|}{Hello} & World \\ \tabucline- % \end{tabu} % % The correct result can be obtained by the mean of a phantom line, that will remain invisible % unless your preamble contains special \texttbf @ or \texttbf ! columns that prints some text: % % \begin{Verb*} % \begin{tabu}{|X|X|X[2]|} \tabucline- % \multicolumn2{|c|}{Hello} & World \\ \tabucline- % \tabuphantomline % \end{tabu} % \end{Verb*} % % \begin{tabu}{|X|X|X[2]|} \tabucline- % \multicolumn2{|c|}{Hello} & World \\ \tabucline- % \tabuphantomline % \end{tabu} % % Remember you may need \cs{tabuphantomline} in conjunction with \cs{savetabu} and \cs{usetabu} with \cs{multicolumn}. % Even if it is possible to add a \cs{tabuphantomline} in any line of the \textt{tabu}, it is a good practice % to append it \emph{at the end} of the \textt{tabu}, for it may introduce indesirable side effects on vertical alignment % otherwise, when \textt{tabu} is nested inside another tabular. % % % \subsubsection{Nesting \textt{tabu}{\texorpdf\small s} with \textt X columns} % % This section should contain some examples but I've no time presently... % % However, this document has plenty of nested \textt{tabu}{\smaller s}! % % % \subsection{Lines inside \textt{tabu}} % \label{Lines inside tabu} % % \subsubsection{First important remarks} % % 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} % \label{Vertical lines} % % Inside \textt{tabu} environment, the vertical line marker \textt\textbar\ has an \emph{optional} argument % which is the width of the vertical rule. The default width remains \cs{arrayrulewidth} of course. % The optional argument for \textt\textbar\ can also contain the name of a color. % color \emph{names} are only possible, not a color specification by the mean of a color model. % The width of the line if specified, must come before the color name and... as for \textt X columns % parameters, commas are optional. % % Example: % % {\tabcolsep=3pt % \begin{tabu}{@{}X[-1mc]X[m]X[2ml]@{}} \toprule % \begin{tabu}{||[5pt]|c|c||[5pt]|} % Hello & World % \end{tabu} % & % The \textt{tabu} you see on left was made with the code displayed on the right. % & % \verbatim{^^A % \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{^^A % \begin{tabu}{||[5pt,red]|c|c||[5pt blue]|}^^@ % Hello & World^^@ % \end{tabu}} % \\ \bottomrule % \multicolumn{3}{r}{\scriptsize\lk This example was printed inside a \textt{tabu} whose preamble is: \textt{X[$-$1m]X[m]X[2m]}.} % \end{tabu}} % % Note that it is always a good idea to protect the optional argument with braces: \M*[\M*{...}]. % 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[-1]X||[1.5pt]} \tabucline[\heavyrulewidth]- \savetabu{tabucline} % \cs{tabucline}\M*[1pt on 1.5pt off 2pt]\M*{1-4} & draws a horizontal dashed line of width \textt{1pt}. Dashes are % \textt{1.5pt} long and gap width is \textt{2pt}. The line is drawn % between columns 1 and 4. Here there are only 2 columns and the line % 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-} & \spaceskip=\fontdimen2\font plus1em\relax 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 gap 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}[c]{|[1pt]X|X|[1pt]} \tabucline- % Hello & world \\ \tabucline[1pt on 2pt off 2pt,blue]- % Hello & world \\ \tabucline- % \end{tabu} % & % \extrarowheight=8pt % \begin{tabu}[c]{|[1pt]X|X|[1pt]} \tabucline*- % Hello & world \\ \tabucline*[1pt on 2pt off 2pt blue]- % Hello & world \\ \tabucline*- % \end{tabu} % & % \extrarowheight=8pt % \begin{tabu}[c]{|[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. % \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 colours etc... But it can help in simple cases... % % \begin{declcs}{tabulinestyle}\M{style=spec., style=spec., style=spec. ...} % \end{declcs} % % This command defines a line style to be used in the first optional argument of \cs{tabucline}: % % \begin{tabu}{@{}X[-2,c]@{}X[c]@{}} \tabucline[\heavyrulewidth]- \tabucline[\hbox{$\scriptstyle\star$}]- \toprule % \rowfont[c]{\bfseries} Define the line style & Use the line style \\ \midrule % \cs{tabulinestyle}\M*{myline=0.4pt on 1.5pt off 1pt red} & \cs{tabucline}\M*[myline]\M*{-} \\ \tabucline[\heavyrulewidth on 1pt off 2pt red]- % \cs{tabulinestyle}\M*{myleader=\cs{hbox}\M*{\$\cs{scriptstyle}\cs{star}\$}} & \cs{tabucline}\M*[myleader]\M*{1-3} \\ % \multicolumn{2}{c}{This way it is easy to change dashed lines into solid ones} \\ \bottomrule \tabucline[\hbox{$\scriptstyle\star$}]- \tabucline[\heavyrulewidth]- % \end{tabu} % % \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} % % ^^A\enlargethispage{2\baselineskip} % \small % \hfil\Shapepar{\nutshape}{Now we stop it because things are becoming too ugly and go to have a look at \textt{tabu} in mathematical mode...}\hfil\null % % \normalsize % % % \subsection{\textt{tabu} in math mode} % \label{sec.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}$ % \tabuphantomline % \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} % \label{Verbatim inside tabu} % % The process of computing \textt X columns widths implies to make ``trials'': this means that % the tabular is first printed in internal mode, inside a box which is measured until the target % 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 has 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 % \AtBeginShipoutNext{\AtBeginShipoutUpperLeft{\tikz[remember picture,overlay] % \node at (tabularx overfull) [xshift=-3cm,yshift=-1cm,rotate=45,font=\ttfamily\smaller] % {\begin{tabu}{c} % with overfull hboxes\\ % (15.8pt and 16.1pt two wide)\\ % for \xpackage{tabularx} % \end{tabu}};}} % \begin{tabu}to .6\linewidth{X[m]} \tabucline- % \extrarowheight=0pt % \begin{tabu}({X}) % This is \textt{tabu} with \xpackage{delarray} shortcut for parenthesis around % \end{tabu} % \\ \tabucline[1pt on2pt blue]- % % \extrarowheight=0pt % \begin{tabularx}{\linewidth}[t]({X}) % \tikzlabel{tabularx overfull} 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} % % % % \section(Saving and restoring tabu){Saving and restoring a \textt{tabu}: \cs{savetabu}, \cs{usetabu} and \cs{preamble}} % % \begin{declcs}{savetabu}\M{user-name} % \end{declcs} % % 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. % % With the \hyperref[debugshow]{\textt{debugshow} package option} (or \csref{tracingtabu}) the informations % saved by \cs{savetabu} are reported in the \xext{log} file. % % % \begin{declcs}{usetabu}\M{user-name} % \end{declcs} % % \cs{usetabu} is the complement of \cs{savetabu}: it can be put alone in the \textt{tabu} % preamble instead of the usual columns specifications % to restore any previous settings saved with \cs{savetabu}. % The \meta{user-name} must exist otherwise, you get an error. % \cs{usetabu} is a help to \textbf{make several tabulars of exactly the same shape, same target, % same preamble.} The only parameter that can be changed is the optional vertical position parameter % for the whole tabular. % % \cs{usetabu} does not work with \hyperref[sec.longtabu]{\textt{longtabu}}. % % \needspace{2\baselineskip} % % \cs{usetabu} locally restores:\nobreak % \begin{itemize} % \item the preamble\footnote{The complete \cs{halign}-preamble is restored.}. % \item the vertical position \M*[c],\, \M*[b]\, or\, \M*[t], unless another position is specified. % \item the target width of the \textt{tabu} in points: the saved target width does not contain % any control sequence: it is fixed and stored in points. % \item the width of \textt{tabu X} columns: those widths are not calculated any more, even in the case % of negativ coefficients and \textt{X} columns are directly transformed into % \textt p, \textt m or \textt b columns of the same widths as the ones that where calculated % at the time of \cs{savetabu} % \item \cs{tabcolsep} (or \cs{arraycolsep} in math mode) and \cs{arraystretch} % \item \cs{arrayrulewidth}, \cs{doublerulesep}, \cs{extrarowheight} and \cs{extratabsurround} % \item \cs{minrowclearance}, \cs{arrayrulecolor} and \cs{doublerulesepcolor} (package \xpackage{colortbl}) % \end{itemize} % % Example: % % \begin{Verb*} % \extrarowheight=5pt\tabcolsep=12pt\arrayrulecolor{ForestGreen} % \begin{tabu}to .7\linewidth{|XXX|X[c]|} ($db(\savetabu)){mytabu} \tabucline*[on1pt]- % This & is & tabu & package \\ \tabucline*[on1pt]- % \end{tabu} % \arrayrulecolor{black} % \end{Verb*} % % \begin{center} % \tabulinestyle{myline=on1pt}\extrarowheight=5pt\tabcolsep=12pt\arrayrulecolor{ForestGreen} % \begin{tabu}to .7\linewidth{|XXX|X[c]|} \savetabu{mytabu} \tabucline*[myline]- % This & is & tabu & package \\ \tabucline*[myline]- % \end{tabu} % \arrayrulecolor{black} % \end{center} % % \begin{Verb*} % \begin{tabu}{($db(\usetabu)){mytabu}} \tabucline*[on1pt]- % \multicolumn3{|c}{This is tabu} & package \\ \tabucline*[on1pt]- % \tabuphantomline % \end{tabu} % \end{Verb*} % % \begin{center} % \begin{tabu}{\usetabu{mytabu}} \tabucline*[myline]- % \multicolumn3{|c|}{This is tabu} & package \\ \tabucline*[myline]- % \tabuphantomline % \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. % % \begin{declcs}{preamble}\M{user-name} % \end{declcs} % % \cs{preamble} can also be used after \csref{savetabu}. This is a variant of \cs{usetabu} that locally restores: % \begin{itemize} % \item the \textt{tabu} (or \textt{longtabu}) preamble. % \item the vertical position \M*[c],\, \M*[b]\, or\, \M*[t] (or \M*[c],\, \M*[l]\, or\, \M*[r] for \textt{longtabu}), % unless another position is specified. % \item the \textt{tabu} / \textt{longtabu} target width, unless another target is specified. % \end{itemize} % Any other tabular parameter is not restored. % % Put \cs{preamble}\M{user-name} alone inside the \textt{tabu} (or \textt{longtabu}) preamble in place of the usual % columns specifications. % % \cs{preamble} works exactly as if you defined a \hyperref[Custom environments]{custom environment} for \textt{tabu}. % % \cs{preamble} works with \hyperref[sec.longtabu]{\textt{longtabu}}. % % Example (continued...): % % \begin{Verb*} % \begin{tabu} to\linewidth{($db(\preamble)){mytabu}} \tabucline[1pt off1pt]- % This &is &tabu &package \\\tabucline[1pt off1pt]- % \end{tabu} % \end{Verb*} % % \begin{tabu} to\linewidth{\preamble{mytabu}} \tabucline[1pt off1pt]- % This &is &\textt{tabu} &package \\\tabucline[1pt off1pt]- % \end{tabu} % % \cs{arrayrulecolor}, \cs{tabcolsep} \etc. are not restored from \cs{savetabu}. % % % \section(row font and alignment){Modifying the font and the alignment in one row: \cs{rowfont}} % % \begin{declcs}{rowfont}\M[alignment]\M*{font specification} % \end{declcs} % % 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. % % \begin{Verb*} % \begin{tabu}{|X|X[-1]|} \tabucline- % ($db(\rowfont))[c]\bfseries % This &Is \\\tabucline[on 2pt,blue]- % \xpackage{tabu} &package \\\tabucline[off 2pt blue]- % ($db(\rowfont))[r]\itshape % for &\textt{tabu} and \textt{longtabu} \\\tabucline- % \end{tabu} % \end{Verb*} % % \begin{tabu}{|X|X[-1]|}\tabucline- % \rowfont[c]\bfseries % This &Is \\\tabucline[on 2pt,blue]- % \xpackage{tabu} &package \\\tabucline[off 2pt blue]- % \rowfont[r]\itshape % for &\textt{tabu} and \textt{longtabu} \\\tabucline- % \end{tabu} % % % \section(Differences: tabu, tabular, tabularx, longtable){Differences between \textt{tabu},\, \textt{tabular},\, \textt{tabularx} and \textt{longtable}} % % \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 \let\tabudefaulttarget \linewidth % % \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} % \label{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 \textmd{\emph{(for keen readers)}}} % % Any tabular that does not split accross pages is made with the following process: % % \begin{tikzpicture}[ % start chain=going below, every join/.style={->,thin,black,solid},node distance=.5cm and 1cm, % every node/.style={black,on chain}] % \node (initialisation) at (0,0) {\begin{tabu}{c} initialisation \\ \cs{hbox}\end{tabu}} % node (@array) [join] {\cs{@array}} % {[start branch] % node (@arraydesc) [join] {% % \begin{tabu}\{{l}. % \begin{tabu}[c].{l}\} % \cs{begingroup} \\ % \qquad \cs{@mkpream}\M*{preamble} \\ % \cs{endgroup} \\ % \end{tabu} ``\textt{@mkpream}'' group % \\[4ex] % \cs{halign}\M*{\cs{@preamble} \textellipsis\ tabular content } % \end{tabu}} % } % node (end) [join] {end of \cs{hbox}}; % \end{tikzpicture} % % For more details, see the \nameref{Flow chart of expansion}. % \pagebreak % % \cs{@mkpream} works in two times inside a (semi-simple) group: % % \begin{description}[font=\mdseries\itshape,topsep=0pt,itemsep=0pt] % \item [First the rewriting process:] \ \\ % Each special column in the tabular preamble is transformed into % one the columns defined by \xfile{array.sty}. % \item [Second the building of the \textup{\cs{halign}} preamble:] \ \\ % The ``rewritten preamble'' is parsed and transformed in a preamble for the \TeX{} primitive % \cs{halign}. The result is stored into the \cs{@preamble} macro. % \end{description} % % Any special columns of \textt{tabu} are defined only inside the ``\textt{@mkpream}'' group. % % In the following example, you get an error with \textt{tabular} and no error with \textt{tabu}. % With \textt{tabular}, and \xpackage{siunitx} \textt S column, the {\descfont\mdseries\itshape rewritting process} % is as follow:\nobreak % % \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,leftmargin=3em] % \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,leftmargin=3em] % \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 was rewritten before, according to \xpackage{siunitx} definition. % \end{enumerate} % \end{tabu} % % The process of rewritting columns is usually longer inside \textt{tabu} than inside \textt{tabular}, % but conversely \textt{tabu} with \textt X columns is optimised compared to \textt{tabularx}, % because the preamble is built only once, and not rebuilt before each trial as \textt{tabularx} does. % Thus \textt{tabu} is much quicker than \textt{tabularx}. % % The process of rewritting is very sensitiv to the order in which columns are actually rewritten. % This becomes critical when columns are defined with an optional argument like \xpackage{tabu} \textt X % and \textttbf\textbar\ columns or \xpackage{siunitx} \textt S column. % % If it possible to define a new column types using the \textt X token for use with \textt{tabu}:\nobreak % \begin{Verb*} % \newcolumntype{C}{X[c]} % \end{Verb*} % % 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 % is defined before the \textt C column... % % Well, just avoid to nest new column types definitions ! % % % \clearpage % \section{The package options} % % \subsection(The debugshow option){The \textt{debugshow} package option} % \label{debugshow} % % \begin{declcs}{tracingtabu} \\ % \cs{tracingtabu}\,=\,2 % \end{declcs} % % The control sequence \cs{tracingtabu} has the same effect as the \textt{debugshow} option: % \begin{itemize} % \item \xpackage{tabu} will report the widths it computes at each attempt to read the target, % when \textt X columns are used. % \item Saved informations on the \textt{tabu} are reported in the \xext{log} file when \cs{savetabu} % is used. % \end{itemize} % % % Typical information in the \xext{log} file: % % {\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) & \multicolumn5l{\ \ 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} % % \cs{tracingtabu}=2 gives even more information about the measuring of natural widths of columns. % % \subsection(The linegoal option){The \textt{linegoal} package option} % \label{subsec:linegoal package option} % % 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+ % % In any case, specifying the target overwrites the default: \cs{begin}\M*{tabu} to\cs{linewidth} % % \subsection(The delarray option){The \textt{delarray} package option} % % \textt{delarray} option has the single effect to load \xfile{delarray.sty} for delimiters shortcuts % 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. % % ^^A\medskip % ^^A As the author of \thispackage, I often use the \textt{light} option when implementing \textt{tabu}, for the % ^^A\xext{log} file is lighter too... % % % \section(Corrections){Corrections of some bugs \textmd{\emph{(available only inside \textt{\upshape tabu})}}} % % \subsection(delarray compatibility){Correction for \xpackage{colortbl} and \xpackage{arydshln}: compatibility with \xpackage{delarray}} % % Both \xpackage{colortbl} and \xpackage{arydshln} forget the control sequence \cs{@arrayright} in their implementation, % quite strangely because both of them take care of \cs{@arrayleft}. As a result, \xpackage{delarray} shortcuts for % delimiters around a tabular does not work if \xpackage{colortbl} and/or \xpackage{arydshln} are loaded. % % Those control sequences are used by the \xpackage{delarray} package to put variable size delimiters around the array: % % {\centering\tabcolsep=12pt % \begin{tabu}{X[-1m]X[-1mc]X[-1m]} % \verbatim{\begin{tabu}\{{X}.^^@ ...^^@ \end{tabu}} & % is like: & % \verbatim{\left\{ \begin{tabu}{X}^^@ ...^^@ \end{tabu} \right.} % \end{tabu}\par} % % % \subsection(arydshln @ columns){Correction for \xpackage{arydshln}: \texttbf @ columns} % % A bug in \cs{adl@xarraydashrule}: \textt{!-arg} columns (class 1) and \textt{@-arg} columns (class 5) should be treated % the same as far as rules are concerned. % % With this correction, the ``known problem number 1'' in \xpackage{arydshln} documentation is solved. % % % \section{To do for even better \textt{tabus}} % % In decreasing order of priority: % % \nprounddigits{0} % \begin{itemize}[leftmargin=*,label=\ding{223}] % \item Implement \cs{tabulineskiplimit} in a manner close to \xpackage{tabls} \cs{tabulinesep} % or \xpackage{cellspace} \textt S columns-modifier. % \item Make double \cs{tabucline} compatible with \xpackage{colortbl} \cs{doublerulesepcolor} % \item Multiple \cs{tabucline} between different columns: extended specs: \\ % \cs{tabucline}\M[line spec]\M*{start-stop, start-stop}\M[line spec]\M*{start-stop} ... % \item Presently, \textt{longtabu} with \textt X columns works only if \cs{LTchunksize} is greater than the number of rows. % I compiled a \textt{longtabu} of 56 pages on my PC with \cs{LTchunksize} $ = $ \numprint{2000} without problem. % Presently \cs{LTchunksize} is set to \numprint{10000} during trials when \textt{longtabu} contains \textt{X columns}. % \item Make \cs{tabucline} work with page breaks (one line on the top of the page, one line on the bottom of the previous). % \item An environment ``\textt{calstabu}'' based on the \Xpackage{cals} package but with the syntax of \textt{tabular} if possible... % \end{itemize} % % \raggedbottom % % % \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/12/28 v1.8 - flexible LaTeX tabulars (FC)] \RequirePackage{array}[2008/09/09] \RequirePackage{varwidth}[2009/03/30] % \end{macrocode} % % 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 \let\tabu@message@save \@gobble \let\tabu@debug \@gobble \let\tabu@timerstart \relax \def\tracingtabu{% \let\tabu@message \message \let\tabu@message@save \tabu@tracing@save \ifdefined \pdfelapsedtime \def\tabu@timerstart{\edef\tabu@starttime{\the\pdfelapsedtime}}% \let\tabu@elapsedtime \tabu@message@etime\fi \@ifnextchar={\tabu@tracing}{}} \def\tabu@tracing{\begingroup\afterassignment\tabu@tr@cing\count@} \def\tabu@tr@cing{\expandafter\endgroup\ifnum\count@>\@ne \let\tabu@debug\message\else\let\tabu@debug\@gobble\fi} \DeclareOption{debugshow}{\AtEndOfPackage{\tracingtabu\relax}} % \end{macrocode} % \end{macro} % % \begin{macro}{linegoal (package option)} % % \begin{macrocode} \let\tabudefaulttarget \linewidth \DeclareOption{linegoal}{% \AtEndOfPackage{% \RequirePackage{linegoal}[2010/12/07]% \let\tabudefaulttarget \linegoal% \linegoal is \linewidth if not pdfTeX }} % \end{macrocode} % \end{macro} % % \begin{macro}{delarray (package option)} % % \begin{macrocode} \DeclareOption{delarray}{% \AtEndOfPackage{\RequirePackage{delarray}}% } % \end{macrocode} % \end{macro} % % \begin{macro}{light (package option)} % % \begin{macrocode} \DeclareOption{light}{% \AtEndOfPackage{% \let\tabu@prepnext@tok \prepnext@tok \let\tabu@save@decl \save@decl \let\tabu@rowfont \tabu@norowfont \let\tabucline \tabu@nocline \let\tabu@firstcline \relax \let\tabu@lines \relax \let\tabu@setup@everycr\relax } } \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,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}. % % Then the switch \cs{iftabu@colortbl} is set. % % Finally, \cs{longtabu} is defined only if the \xpackage{longtable} package is detected. % % \begin{macrocode} \AtBeginDocument{% \expandafter\in@ \expandafter\@arrayright\expandafter{\endarray}% \ifin@ \let\tabu@endarray \endarray \else \tabu@fix@arrayright \fi % \@ifpackageloaded{colortbl} \tabu@colortbltrue \tabu@colortblfalse \@ifpackageloaded{arydshln}{} {\let\tabu@adl@fix \relax \let\tabu@adl@endTRIAL \@empty}% \@ifpackageloaded{longtable}{}{\let\longtabu \tabu@nolongtabu}% } % \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{macro}{\tabu@nested} % % A counter that stores the deepness of nested \textt{tabu}'s. % % \begin{macro}{\tabu@start} % \begin{macro}{\tabu@stop} % % Counters used for \csref{tabucline} to get the starting and ending columns. % % \begin{macrocode} \newcount \tabu@cnt \newcount \tabu@nbcols \newcount \tabu@X@cols \newcount \tabu@nested \newcount \tabu@start \newcount \tabu@stop % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \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}'', % or with negativ coefficients. % % \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{macro}{\tabucolX@error} % % In case of \textt X columns too narrow. % % \begin{macrocode} \newdimen \tabucolX \newdimen \tabu@X@sum \newdimen \tabucolX@error \tabucolX@error=1em % \end{macrocode} % \end{macro} % \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 \hyperref[Flow chart of expansion]{flow chart...}) % % \begin{macro}{\iftabu@spread} % % A switch whether ``\textt{tabu spread}'' is used or not. % % \begin{macro}{\iftabu@firstcline} % % A switch to adapt \cs{tabucline} automatically if it comes first in the \textt{tabu} (similar to \cs{firsthline}). % % \begin{macro}{\iftabu@negcoef} % % A switch set to true in case of negativ coef (natural width if less than \textt{X[coef]}). % % \begin{macrocode} \newif \iftabu@measuring \newif \iftabu@spread \newif \iftabu@firstcline \newif \iftabu@negcoef % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\tabu@box} % % Stores the whole \textt{tabu} when an attempt to adjust \textt X columns is performed. % % It is also used by \cs{tabucline} to save the \cs{@arstrutbox} when inserting a horizontal line. % % \begin{macrocode} \newsavebox \tabu@box \chardef \tabu@arstrutbox=\@arstrutbox \let\tabu@vcenter \vcenter % \end{macrocode} % \end{macro} % % \begin{macro}{\tabu@gobblespace} % % A macro which is needed when scanning tokens with \cs{futurelet}. % % \begin{macro}{\tabu@gobbleopt} % % A macro that gobbles an optional argument. % % \begin{macrocode} \def\tabu@gobblespace#1 {#1} \def\tabu@gobbleopt#1{\@ifnextchar [{\tabu@gobble@pt{#1}}{#1}}%] \def\tabu@gobble@pt#1[#2]{#1} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\tabu@save@decl} % % No inversion on tokens in the \text{tabu} preamble, when not in math mode. % % \begin{macrocode} \def\tabu@save@decl{% \toks\count@ =\expandafter{\the\toks\expandafter\count@ \@nextchar}% }% \tabu@save@decl % \end{macrocode} % \end{macro} % % % \begin{macro}{\tabu@newcolumntype} % % A helper macro to create new column types for \textt{tabu}. % % The column types are not appended to \cs{NC@list} in order to keep them local to \textt{tabu}. % % \begin{macro}{\tabu@privatecolumntype} % % Columns types defined with \cs{tabu@privatecolumntype} are "mounted" only inside the \cs{@mkpream} group % of \textt{tabu}. % % \begin{macrocode} \def\tabu@newcolumntype #1{% \expandafter\tabu@new@columntype \csname NC@find@\string#1\expandafter\endcsname \csname NC@rewrite@\string#1\endcsname {#1}% }% \tabu@newcolumntype \def\tabu@new@columntype #1#2#3{% \def#1##1#3{\NC@{##1}}% \let#2\relax \newcommand*#2% }% \tabu@new@columntype \def\tabu@privatecolumntype #1{% \expandafter\tabu@private@columntype \csname NC@find@\string#1\expandafter\endcsname \csname NC@rewrite@\string#1\expandafter\endcsname \csname tabu@NC@find@\string#1\expandafter\endcsname \csname tabu@NC@rewrite@\string#1\endcsname {#1}% }% \tabu@privatecolumntype \def\tabu@private@columntype#1#2#3#4{% \g@addto@macro\tabu@privatecolumns{\let#1#3\let#2#4}% \tabu@new@columntype#3#4% }% \tabu@private@columntype \let\tabu@privatecolumns \@empty % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{X (private column type)} % % 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} \tabu@privatecolumntype X[1][]{\tabu@rewrite@X{#1}% \let\@halignto \relax \expandafter \NC@find \tabucolX@rw} % \end{macrocode} % \end{macro} % % The next part of the definition (\cs{tabu@rewrite@X}) can be found page \pageref{tabu X column definition}. % % \begin{macro}{\usetabu (private column type)} % % \cs{usetabu} is defined as a \textt{tabu} new column type: loaded only inside the \cs{@mkpream} % group inside the \textt{tabu} environment. % % \begin{macrocode} \tabu@privatecolumntype \usetabu [1]{% \ifx\\#1\\\tabu@saveerr{}\else \@ifundefined{tabu@saved@\string#1} {\tabu@saveerr{#1}} {\let\tabu@rewrite@X \tabu@rewrite@Xrestore \csname tabu@saved@\string#1\expandafter\endcsname\expandafter\z@}% \fi }% \NC@rewrite@\usetabu % \end{macrocode} % \end{macro} % % \begin{macro}{\preamble (private column type)} % % \cs{preamble} is defined as a \textt{tabu} new column type: loaded only inside the \cs{@mkpream} % group inside the \textt{tabu} environment. % % \begin{macrocode} \tabu@privatecolumntype \preamble [1]{% \ifx\\#1\\\tabu@saveerr{}\else \@ifundefined{tabu@saved@\string#1} {\tabu@saveerr{#1}} {\csname tabu@saved@\string#1\expandafter\endcsname\expandafter\@ne}% \fi }% \NC@rewrite@\preamble % \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} \tabu@newcolumntype \tabu@rewritefirst{% \tabu@X@cols \z@ \let\tabu@dimexpr \relax \let\tabu@savepreamble \relax \let\NC@rewrite@X \tabu@NC@rewrite@X \gdef\tabu@global@temp {\tabu@savepreamble}% \aftergroup \tabu@global@temp \let\tabu@islast \relax \tabu@privatecolumns \NC@list{\NC@do\usetabu \NC@do\preamble \NC@do *}% \tabu@lines % defines NC@rewrite@| for tabu only (inside @mkpream group) \NC@list\expandafter{\the\expandafter\NC@list \expandafter\NC@do \expandafter X% \tabu@NC@list \NC@do X\NC@do\tabu@rewritemiddle}% \ifcat$\d@llarend\else \let\save@decl \tabu@save@decl \fi % no inversion of tokens in text mode \NC@find \tabu@rewritemiddle }% NC@rewrite@\tabu@rewritefirst \def\tabu@savepreamble{% \gdef\tabu@global@temp{}% \NC@list\expandafter{\tabu@NC@list}% \let\tabu@savedpreamble \@preamble }% \tabu@savepreamble % \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. % % \cs{tabu@rewritelast} column type is loaded by \cs{tabu@rewritefirst} column type, only inside the \cs{@mkpream} % group inside the \textt{tabu} environment. % % \begin{macrocode} \tabu@newcolumntype \tabu@rewritemiddle{% \NC@list\expandafter{\tabu@NC@list \NC@do\tabu@endrewrite \NC@do\tabu@rewritelast}% \tabu@checklast }% \NC@rewrite@\tabu@rewritemiddle \def\tabu@checklast#1\relax{% \def\tabu@temp{#1}% \ifx \tabu@temp\tabu@islast \expandafter\tabu@lastrewrite \else \let\tabu@islast \tabu@temp \expandafter\NC@find \expandafter\tabu@rewritelast \fi #1\relax }% \tabu@checklast \tabu@newcolumntype \tabu@rewritelast{\NC@find \tabu@endrewrite} \tabu@newcolumntype \tabu@endrewrite{\tabu@checklast} \def\tabu@lastrewrite{% \let\tabu@next \NC@find \ifx \@halignto\relax % found a X column \edef\tabu@global@X{\tabu@global@X \tabu@X@cols\the\tabu@X@cols\relax}% \ifx \tabu@halignto\relax % X column measure \tabu@global@Xnested \iftabu@negcoef \aftergroup\tabu@negcoeftrue \fi \aftergroup \tabu@prep@TRIAL \else \aftergroup \tabu@setup@everycr \fi \else \aftergroup \tabu@setup@everycr \ifdim \tabu@target=\z@ \else \let\tabu@next \tabu@extracolsep \fi % \fi \let\@halignto \tabu@halignto \tabu@next }% \tabu@lastrewrite \def\tabu@extracolsep{\futurelet\tabu@temp \tabu@extracol@sep} \def\tabu@extracol@sep{% \ifx \tabu@temp\@sptoken \expandafter\tabu@gobblespace \expandafter\tabu@extracol@sep \else {\endlinechar\m@ne\scantokens{\let\x |}% \expandafter}\ifx \x\tabu@temp \def\tabu@next {\NC@find @{\extracolsep\@flushglue}}\else {\endlinechar\m@ne\scantokens{\let\x !}% \expandafter}\ifx \x\tabu@temp \def\tabu@next {\NC@find @{\extracolsep\@flushglue}}\else \def\tabu@next {\NC@find !{\extracolsep\@flushglue}}\fi\fi \expandafter\tabu@next \fi }% \tabu@extracol@sep \def\tabu@global@Xnested{\expandafter\tabu@global@X@nested \csname tabu@global@X\the\tabu@nested\endcsname} \def\tabu@global@X@nested#1{% \global\let#1\tabu@global@X \aftergroup\let \aftergroup\tabu@global@X \aftergroup#1% }% \tabu@global@Xnested % \end{macrocode} % \end{macro} % % % \begin{macro}{\iftabu@colortbl} % % 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} \newif\iftabu@colortbl % \end{macrocode} % \end{macro} % % % \begin{macro}{\tabu@nowrite} % % A trick (from the \TeX-book) to forbidd \cs{write} when a trial is done on the \cs{halign}. % % \begin{macrocode} \def\tabu@nowrite#1#{{\afterassignment}\toks@} \let\tabu@write\write \let\tabu@immediate\immediate \protected\def\tabu@GenericError{\begingroup \def\immediate\write{\aftergroup\endgroup \tabu@immediate\tabu@write}\tabu@GenericErrorORI}% \let\tabu@GenericErrorORI \GenericError \protected\def\tabu@warn{\begingroup \def\immediate\write{\aftergroup\endgroup \tabu@immediate\tabu@write}\PackageWarning{tabu}} % \end{macrocode} % \end{macro} % % \subsection{\cs{tabu}, \cs{endtabu}, \cs{longtabu} and \cs{endlontabu}} % % \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\tabu@{\array}\def\endtabu{\endarray}% \else \def\tabu@{\tabular}\def\endtabu{\endtabular}\fi \tabu@setup \tabu@settarget }% \tabu \def\longtabu{% \ifmmode\PackageError{tabu}{longtabu not allowed in math mode}\fi \def\tabu@{\longtable}\def\endlongtabu{\endlongtable}% \let\tabu@arrayleft@measure \tabu@long@arrayleft@measure \let\tabu@endTRIAL \tabu@long@endTRIAL \tabu@setup \tabu@settarget }% \longtabu \def\tabu@nolongtabu{\PackageError{tabu} {longtabu requires the longtable package}\@ehd} % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\tabu@setup} % % This macro sets the \textt{tabu X} column definition at the beginning of the \textt{tabu} environment. % % \begin{macrocode} \def\tabu@setup{% \tabu@adl@fix \let\endarray \tabu@endarray % colortbl & arydshln (delarray) \let\tabu@global@X \@empty \ifx \verbatim\tabu@sanitizetext % \tabu@setup@saveglobal \advance\tabu@nested \@ne \def\tabu@aligndefault{t}\let\tabudefaulttarget \linewidth \else \tabu@timerstart \def\tabu@aligndefault{c}\edef\tabu@hfuzz {\the\hfuzz}% \global\tabu@footnotes{}\aftergroup\the\aftergroup\tabu@footnotes \ifdim\parindent>\z@ \ifx\linewidth\tabudefaulttarget \everypar\expandafter{% % correction for indentation \the\everypar\everypar\expandafter{\the\everypar}% \setbox\z@=\lastbox \ifdim\wd\z@>\z@ \advance\linewidth -\wd\z@\fi \box\z@ }% \fi\fi \fi \let\@footnotetext \tabu@footnotetext \let\@xfootnotetext \tabu@xfootnotetext \let\@xfootnote \tabu@xfootnote \let\centering \tabu@centering \let\raggedright \tabu@raggedright \let\raggedleft \tabu@raggedleft \tabu@trivlist % \def\tabudecimal {\tabu@tabudecimal}\let\verbatim \tabu@sanitizetext \let\fbox \tabu@fbox \let\color@b@x \tabu@color@b@x \let\rowfont \tabu@rowfont \let\prepnext@tok \tabu@prepnext@tok % \everycr{}\let\tabu@everycr \everycr \tabu@spreadfalse \tabu@measuringfalse \tabu@negcoeffalse \edef\tabu@NC@list{\the\NC@list}\NC@list{\NC@do \tabu@rewritefirst}% }% \tabu@setup \def\tabu@setup@saveglobal{% \expandafter\xdef\csname tabu@global@\the\tabu@nested\endcsname{% \global\tabu@X@cols \the\tabu@X@cols\relax \global\tabu@naturalX \the\tabu@naturalX\relax \gdef\noexpand\tabu@naturalX@min {\tabu@naturalX@min}% \gdef\noexpand\tabu@naturalX@max {\tabu@naturalX@max}}% \expandafter\aftergroup\csname tabu@global@\the\tabu@nested\endcsname }% \tabu@setup@saveglobal % \end{macrocode} % \end{macro} % % % \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\tabu@halignto{to}\tabu@gettarget} \def\tabu@spread spread{\tabu@spreadtrue\def\tabu@halignto{spread}\tabu@gettarget} \def\tabu@gettarget {\afterassignment\tabu@linegoaltarget \tabu@target} \def\tabu@linegoaltarget {\futurelet\tabu@temp \tabu@linegoal@target} \def\tabu@linegoal@target {% \ifx \tabu@temp\LNGL@setlinegoal \LNGL@setlinegoal \expandafter \@firstoftwo \fi % @gobbles \LNGL@setlinegoal \tabu@begin }% \tabu@linegoal@target \def\tabu@begin #1#{% \edef\tabu@halignto{\ifdim\tabu@target>\z@ \tabu@halignto\the\tabu@target\fi}% \@testopt \tabu@@begin \tabu@aligndefault #1\@nil }% \tabu@begin \def\tabu@@begin [#1]#2\@nil#3{% \tabu@preparesave{#3}% \def\tabu@align {#1}% \tabu@ [\tabu@align]#2{\tabu@rewritefirst #3}% }% \tabu@@begin % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\tabu@preparesave} % % This macro temporarily saves the \textt{tabu} preamble and the settings % for \cs{arrayrulewidth}, \cs{extrarowheight} \etc. % % Those values are retrieved by \cs{savetabu}, if invoked inside the \textt{tabu}. % % \begin{macrocode} \def\tabu@preparesave #1{% \iftabu@colortbl \@temptokena{}% \tabu@prepare@save\CT@arc@ \tabu@prepare@save\CT@drsc@ \fi \edef\tabu@savedparam{% \ifmmode \col@sep \the\arraycolsep \else \col@sep \the\tabcolsep \fi\relax \arrayrulewidth \the\arrayrulewidth\relax \doublerulesep \the\doublerulesep\relax \extrarowheight \the\extrarowheight\relax \extratabsurround \the\extratabsurround\relax \def\noexpand\arraystretch {\arraystretch}% \iftabu@colortbl \minrowclearance\the\minrowclearance\relax \the\@temptokena \fi}% \def\tabu@savedpream {\edef\tabu@halignto{to\the\tabu@target}\NC@find #1}% }% \tabu@preparesave \def\tabu@prepare@save #1{% \ifx\relax#1\else \@temptokena\expandafter{\the\expandafter\@temptokena \expandafter\def\expandafter#1\expandafter{#1}}\fi }% \tabu@prepare@save % \end{macrocode} % \end{macro} % % % \subsection{Footnotes inside \textt{tabu}} % % \begin{macro}{\tabu@footnotes} % % The (global) token that stores the footnotes inside \textt{tabu}: % % \begin{macrocode} \newtoks\tabu@footnotes % \end{macrocode} % \end{macro} % % \begin{macro}{\tabu@footenotetext} % % The macros in case \xpackage{hyperref} is not used, or used with the option \textt{hyperfootnotes=false}: % % \begin{macrocode} \long\def\tabu@footnotetext #1{% \edef\@tempa{\the\tabu@footnotes \noexpand\footnotetext [\the\csname c@\@mpfn\endcsname]}% \global\tabu@footnotes\expandafter{\@tempa {#1}}}% \long\def\tabu@xfootnotetext [#1]#2{% \global\tabu@footnotes\expandafter{\the\tabu@footnotes \footnotetext [{#1}]{#2}}} \let\tabu@xfootnote \@xfootnote % \end{macrocode} % \end{macro} % % \begin{macro}{\tabu@Hy@ftntext} % \begin{macro}{\tabu@Hy@xfootnote} % % The macros in case \xpackage{hyperref} is loaded with the option \textt{hyperfootnotes=true}: % % \begin{macrocode} \long\def\tabu@Hy@ftntext{\tabu@Hy@ftntxt {\the \c@footnote }} \long\def\tabu@Hy@xfootnote [#1]{% \begingroup \value\@mpfn #1\relax \protected@xdef \@thefnmark {\thempfn}% \endgroup \@footnotemark \tabu@Hy@ftntxt {#1}% }% \tabu@Hy@xfootnote \long\def\tabu@Hy@ftntxt #1#2{% \edef\@tempa{% \the\tabu@footnotes \begingroup \value\@mpfn #1\relax \noexpand\protected@xdef \noexpand\@thefnmark{\noexpand\thempfn}% \expandafter\noexpand\expandafter\tabu@Hy@footnotetext \expandafter{% \Hy@footnote@currentHref }% }% \global\tabu@footnotes\expandafter{% \@tempa {#2}% \endgroup }% }% \tabu@Hy@ftntxt \long\def\tabu@Hy@footnotetext #1#2{% \H@@footnotetext{% \ifHy@nesting \hyper@@anchor {#1}{#2}% \else \Hy@raisedlink{% \hyper@@anchor {#1}{\relax}% }% \def\@currentHref {#1}% \let\@currentlabelname \@empty #2% \fi }% }% \tabu@Hy@footnotetext \AtBeginDocument{% \csname\ifcsname ifHy@hyperfootnotes\endcsname ifHy@hyperfootnotes\else iffalse\fi\endcsname \let\tabu@footnotetext \tabu@Hy@ftntext \let\tabu@xfootnote \tabu@Hy@xfootnote \fi } % \end{macrocode} % \end{macro} % \end{macro} % % % \clearpage % \subsection{Flow chart of expansion} % \label{Flow chart of expansion} % % \subsubsection(case: tabu, tabu to and tabu spread){General case: tabu, tabu to and tabu spread} % % { % \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}% \expandafter\let\csname tabu@X\the\tabu@X@cols\endcsname \relax \iftabu@measuring % not the first X column found in preamble \edef\tabu@global@X {\tabu@global@X \def\csname tabu@X\the\tabu@X@cols\endcsname {\strip@pt\tabu@X@sum}% \advance\tabu@X@sum \the\tabu@X@sum\relax}% \else % first X column found in preamble \tabu@measuringtrue \iftabu@spread \tabu@spreadtarget\tabu@target \tabu@target\z@ \else \tabu@spreadtarget \z@ \fi \ifdim\tabu@target=\z@ \setlength\tabu@target \tabudefaulttarget \tabu@message{(tabu) Default target: \ifx\tabudefaulttarget\linewidth\string\linewidth \else\ifx\tabudefaulttarget\linegoal\string\linegoal \fi\fi=\the\tabu@target \on@line, page \the\c@page}\fi \tabu@message{\tabu@titles}% \edef\tabu@global@X {\tabu@global@X \def\csname tabu@X1\endcsname{\strip@pt\tabu@X@sum}% \tabu@X@sum \the\tabu@X@sum\relax \tabu@target \the\tabu@target\relax \tabu@spreadtarget \the\tabu@spreadtarget\relax}% \let\tabu@halignto \relax \fi }% \tabu@rewrite@X \let\tabu@@rewrite@X \tabu@rewrite@X % \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{\in@ ${#1}\ifin@ \def\tabucolX@rw {>{$}p{\tabucolX}<{$}}\else \def\tabucolX@rw {p{\tabucolX}}\fi} \def\tabu@rewrite@Xrestore #1{\tabu@gobbleopt{\def\tabucolX@rw{l}}} % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \begin{macro}{\tabu@Xarg} % \begin{macro}{\tabu@Xparse} % \begin{macro}{\tabucolX@do} % % A tedious (and fastidious) macro to parse the optional argument of \textt X columns. The aim is to built % \cs{tabucolX@rw} which expands to the column specification: % % {\centering \textt{>\M*{alignment} p \emph{or} m \emph{or} b \M*{\cs{dimexpr} coef \cs{tabucolX}\cs{relax}}}\par} % % After that \xfile{array.sty} make it easy:\, \cs{expandafter}\cs{NC@find}\cs{tabucolX@rw} % % \begin{macrocode} \def\tabu@Xarg#1{% \advance\tabu@X@cols \@ne \tabu@wdlet\tabu@X@cols \z@ \ifx\\#1\\% \tabu@X@sum \p@ \edef\tabucolX@rw {p{\tabu@dimexpr{\the\tabu@X@cols}{\tabucolX}}}% \edef\tabu@temp {p{\the\tabucolX}}% \else \tabu@X@sum \z@ \let\tabucolX@align \@empty \let\tabucolX@rw \@empty \let\tabu@Xmath \@empty \let\tabu@temp \@empty \tabu@Xparse {}#1,\@nnil \fi }% \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 \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 L\@let@token 7\else \if C\@let@token 8\else \if R\@let@token 9\else \ifx \@sptoken\@let@token 10\else \if .\@let@token 11\else \if -\@let@token 11\else \ifcat $\@let@token 12\else 13\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax \tabucolX@do \expandafter \remove@to@nnil \or \tabu@Xtype {p}% \or \tabu@Xtype {m}% \or \tabu@Xtype {b}% \or \tabu@Xalign \raggedright \or \tabu@Xalign \centering \or \tabu@Xalign \raggedleft \or \tabu@Xalign \RaggedRight \or \tabu@Xalign \Centering \or \tabu@Xalign \RaggedLeft \or \expandafter \tabu@Xparsespace \or \expandafter \tabu@Xcoef \or \let\tabu@Xmath=$\expandafter \tabu@Xparse \or \tabu@Xcoef{}% \else\expandafter \tabu@Xparse \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@Xtype#1{% \ifx \tabucolX@rw\@empty \else \PackageWarning{tabu} {Duplicate vertical alignment specification}\fi \def\tabucolX@rw{#1}\expandafter\tabu@Xparse }% \tabu@Xtype \def\tabu@Xcoef#1{\edef\tabu@temp{\tabu@temp#1}% \afterassignment\tabu@Xc@ef \tabu@cnt\number\if-#10\fi }% \tabu@Xcoef \def\tabu@Xc@ef{% \advance\tabu@X@sum \tabu@temp\the\tabu@cnt\p@ \tabu@Xparse{}% }% \tabu@Xc@ef \def\tabucolX@do{% \ifx\tabucolX@rw\@empty \def\tabucolX@rw{p}\fi \ifdim\tabu@X@sum<\z@ \tabu@negcoeftrue \tabu@X@sum \m@ne\tabu@X@sum \tabu@wdlet \tabu@X@cols \p@ \else \ifdim \tabu@X@sum=\z@ \tabu@X@sum \p@ \fi \fi \begingroup \toks@\expandafter {\tabucolX@align}% \edef\tabu@temp {\strip@pt\tabu@X@sum \tabucolX}% \edef\tabucolX@rw##1{% \ifx$\tabu@Xmath>{\noexpand\the\toks@ $}\else \ifx \tabucolX@align\@empty \else >{\noexpand\the\toks@}\fi\fi \tabucolX@rw{##1}% \ifx$\tabu@Xmath<{$}\fi}% \edef\x{\endgroup \def\noexpand\tabu@temp {\tabucolX@rw{\the\dimexpr\tabu@temp}}% \def\noexpand\tabucolX@rw{% \tabucolX@rw{\tabu@dimexpr{\the\tabu@X@cols}{\tabu@temp}}}% }\x }% \tabucolX@do \def\tabu@dimexpr#1#2{% \ifdim \tabu@wd{#1}>\p@ \ifdim \tabu@wd{#1}<#2 \tabu@wd{#1}\else#2\fi\else #2\fi }% \tabu@dimexpr % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \subsection(Before trials){Before trials to reach the target: 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{% \begingroup \iffalse{\fi \ifnum0=`}\fi \tabu@setup@TRIAL \tabucolX \tabu@target \ifcase 0\iftabu@negcoef \else\iftabu@spread \else 1\fi\fi \advance\tabu@X@cols \@ne \expandafter\let\csname tabu@X\the\tabu@X@cols\endcsname \@undefined \tabu@X@cols \z@ \def\tabu@naturalX@max {\z@}% \def\tabu@naturalX@min {\z@}% \let\tabu@startpboxORI \@startpbox \let\@startpbox \tabu@measure@startpbox \fi \def\tabu@lasttry{\m@ne\p@}\tabu@cnt \z@ % number of trials \tabu@arrayleft@measure }% \tabu@prep@TRIAL % \end{macrocode} % \end{macro} % % \begin{macro}{\tabu@setup@TRIAL} % \begin{macrocode} \def\tabu@setup@TRIAL{\tabu@global@X \let\tabu@global@X \@empty \let\@halignto \@empty \tabu@naturalX \z@ \tabu@savecounters \let\tabu@savecounters \relax \hbadness \@M \let\hbadness \@tempcnta \hfuzz \maxdimen \let\hfuzz \@tempdima \let\tabu@rewrite@X \tabu@rewrite@Xnested \let\savetabu \@gobble \let\tabudefaulttarget \linewidth \let\write \tabu@nowrite \let\GenericError \tabu@GenericError \long\def\@xfootnote[##1]##2{}\let\@footnotetext \@gobble \ifx\@arrayright\relax \let\@arrayright \@empty\fi \tabu@TRIAL@hook }% \tabu@setup@TRIAL \def\tabu@savecounters{% \def\@elt##1{\global\value{##1}\the\value{##1}\relax}% \edef\tabu@global@X {\cl@@ckpt}\let\@elt \relax }% \tabu@savecounters % \end{macrocode} % \end{macro} % % \begin{macro}{\tabuDisableCommands} % % % % \begin{macrocode} \let\tabu@TRIAL@hook \@empty \newcommand\tabuDisableCommands[1]{\g@addto@macro\tabu@TRIAL@hook {#1}} % \end{macrocode} % \end{macro} % % % \subsection{One trial after another} % % \begin{macro}{\tabu@arrayleft@measure} % % Measuring the whole tabular occurs just before \cs{@arrayleft}. % Hence the name of the macro: \cs{tabu@arrayleft@measure}. % % \begin{macro}{\tabu@TRIAL} % % \cs{halign} is temporarily expanded inside a \cs{vbox} which is captured in \cs{tabu@box}. % % \begin{macrocode} \def\tabu@arrayleft@measure#1\bgroup{% \def\tabu@Xfinish{% \tabu@global@Xnested \ifnum0=`{}\fi\endgroup \tabu@global@X #1\bgroup}% \def\tabu@TRIAL {\setbox\tabu@box \hbox\bgroup $#1\bgroup \the\toks@ \tabu@endTRIAL}% \toks@{\tabu@setup@everycr \let\@preamble \tabu@savedpreamble}% \tabu@collect }% \tabu@arrayleft@measure % \end{macrocode} % \end{macro} % \end{macro} % % \begin{macro}{\tabu@long@arrayleft@measure} % % This is the long version for \textt{longtabu} % \begin{macrocode} \long\def\tabu@long@arrayleft@measure #1\LT@bchunk #2\LT@bchunk{% \def\tabu@Xfinish{% \tabu@global@Xnested \ifnum0=`{}\fi\endgroup \tabu@setup@everycr \let\@preamble \tabu@savedpreamble \tabu@global@X #1\LT@bchunk #2\LT@bchunk}% \def\tabu@TRIAL{% \setbox\tabu@box \hbox\bgroup \tabu@setup@everycr \let\@preamble \tabu@savedpreamble \tabu@global@X \LTchunksize\@M #1\LT@bchunk #2\LT@bchunk \the\toks@ \tabu@endTRIAL}% \toks@{}%\let\LT@output\relax \tabu@collect }% \tabu@long@arrayleft@measure \def\tabu@long@endTRIAL{% \LT@echunk \global\setbox\@ne \hbox{\unhbox\@ne}\kern\wd\@ne \LT@get@widths \egroup % got \tabu@box \iftabu@spread \tabu@spreadarith % \else \tabu@arith \fi \iftabu@measuring \tabu@measuringfalse \expandafter \tabu@TRIAL % \else \expandafter \tabu@Xfinish \the \expandafter\toks@ \tabu@endenvir % \fi }% \tabu@long@endTRIAL % \end{macrocode} % \end{macro} % % % \begin{macro}{\tabu@collect} % % 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} % % % \begin{macro}{\tabu@endTRIAL} % % 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@endTRIAL{% \tabu@adl@endTRIAL % \endarray$\egroup \iftabu@spread \tabu@spreadarith % \else \tabu@arith \fi \iftabu@measuring \tabu@measuringfalse \expandafter \tabu@TRIAL % \else \expandafter \tabu@Xfinish \the \expandafter\toks@ \tabu@endenvir % \fi }% \tabu@endTRIAL \def\tabu@adl@endTRIAL{\crcr \noalign{\global\adl@ncol \tabu@nbcols}} % \end{macrocode} % \end{macro} % % % % \subsection{Algorithms: Measuring the \textt{tabu}} % % \subsubsection(Algorithm for tabu to){The arithmetic of \textt X columns} % % \begin{macro}{\tabu@arith} % % General algorithms for \textt{tabu to} with \textt X columns. % % \begin{macrocode} \def\tabu@arith{% \advance\tabu@cnt \@ne \tabu@message{\tabu@message@arith}% \ifx \@startpbox\tabu@measure@startpbox \let\@startpbox \tabu@startpboxORI \fi \dimen@ \tabu@X@sum \iftabu@negcoef \tabu@arith@negcoef \fi \ifcase 0\ifdim \dimexpr\wd\tabu@box-\tabu@hfuzz-1sp<\tabu@target \else \ifdim \tabu@lasttry=\wd\tabu@box 1\else 2\fi\fi\relax \ifdim \tabu@X@sum=\dimen@ \tabu@message{\tabu@message@reached}% \else\ifdim\tabu@X@sum=\z@ \tabu@message{\tabu@message@reached}% \else\ifnum \tabu@cnt>\@ne \tabu@message{\tabu@message@reached}% \else \tabu@measuringtrue \tabucolX = \dimexpr\tabucolX*\p@/\tabu@X@sum\relax \fi\fi\fi \or \tabu@message{\tabu@header Reached minimum width. Backing up}% \tabu@warn{tabu width = \the\wd\tabu@box\space> \the\tabu@target\space+ \tabu@hfuzz}% \or \ifdim \tabu@X@sum=\z@ \tabu@measuringtrue \tabucolX=\@tempdima \else \advance\tabucolX-\dimexpr(\wd\tabu@box-\tabu@target-.5\tabu@X@sum/\p@) *\p@/\tabu@X@sum\relax \ifdim \tabucolX<\z@ \tabu@warn{X Columns too narrow (table too wide)}% \tabucolX=\tabucolX@error \else \tabu@measuringtrue \ifdim \tabu@X@sum=\dimen@ \edef\tabu@lasttry{\the\wd\tabu@box}% \else \ifnum \tabu@cnt>\@ne \edef\tabu@lasttry{\the\wd\tabu@box}\fi \ifdim \tabucolX<\@tempdima \tabucolX \@tempdima\fi \fi \fi \fi \fi %(ifcase) \iftabu@measuring \else \edef\tabu@global@X{\tabu@global@X \tabucolX \the\tabucolX\relax \tabu@target \the\tabu@target\relax % < for \savetabu > \ifnum \tabu@nested=\z@ \ifx \@arrayright\@empty \ifdim \tabu@X@sum>\z@ \def\noexpand\@halignto{to\the\tabu@target}\fi\fi\fi}% \fi \tabu@X@sum \dimen@ }% \tabu@arith \def\tabu@arith@negcoef{% \tabu@X@cols \@ne \count@ \tabu@X@cols \@whilesw \ifcsname tabu@X\the\tabu@X@cols\endcsname\fi{% \ifdim \tabu@wd\tabu@X@cols>\p@ \expandafter\let\expandafter\tabu@temp \csname tabu@X\the\tabu@X@cols\endcsname \ifdim \tabu@wd\tabu@X@cols <\tabu@temp\tabucolX \advance\tabu@X@sum -\tabu@temp\p@ \tabu@message{\tabu@message@negcoef{\the\tabu@X@cols}}% \ifdim \tabu@wd\tabu@X@cols >\tabu@wd\count@ \count@ \tabu@X@cols \fi \fi\fi \advance\tabu@X@cols \@ne }% \@tempdima=\dimexpr\tabu@wd\count@ * \p@/ \dimexpr\csname tabu@X\the\count@\endcsname\p@\relax\relax }% \tabu@arith@negcoef % \end{macrocode} % \end{macro} % % \subsubsection(Algorithm for tabu spread){The arithmetic of \textt X columns for \textt{tabu spread}} % % \begin{macro}{\tabu@spreadarith} % % Algorithm for \textt{tabu spread} with \textt X columns: only the first pass. % % \begin{macrocode} \def\tabu@spreadarith{% \tabu@naturalX \tabu@naturalX@max\relax \tabucolX \tabu@naturalX@min\relax \tabu@message{\tabu@message@spread}% \ifdim \dimexpr \wd\tabu@box + \tabu@spreadtarget <\tabu@target \advance\tabu@spreadtarget \dimexpr\wd\tabu@box-\tabu@naturalX+\tabucolX\relax \ifdim \tabu@spreadtarget <\tabu@target \tabu@target =\tabu@spreadtarget \fi \tabu@message{\the\tabu@target}% \tabu@message{\ifdim \tabu@spreadtarget>\tabu@target (tabu) spread reduced to fit default target.\fi}% \else \tabu@message{\expandafter\tabu@msg@align \the\tabu@target { }{}{}{}{}\@@} \tabu@message{(tabu)\ifdim\wd\tabu@box<\tabu@target spread too large\else tabu spread is useless here\fi, default target used.}% \fi \let\@startpbox \tabu@startpboxORI \xdef\tabu@halignto {to\the\tabu@target}% \tabucolX \tabu@target \tabu@spreadfalse \tabu@measuringtrue }% \tabu@spreadarith % \end{macrocode} % \end{macro} % % \subsubsection(\xext{log} report){Reporting in the \xext{log} file (\textt{debugshow option})} % % \begin{macro}{\tabu@message@arith} % \begin{macro}{\tabu@message@spread} % \begin{macro}{\tabu@message@negcoef} % \begin{macrocode} \def\tabu@message@arith{\tabu@header \expandafter\tabu@msg@align \the\tabucolX { }{ }{ }{ }{}\@@ \expandafter\tabu@msg@align \the\wd\tabu@box { }{ }{ }{ }{}\@@ \expandafter\tabu@msg@align \the\tabu@target { }{ }{ }{ }{}\@@ \expandafter\tabu@msg@align \the\tabu@X@sum {}{}{}{}{}\@@ \ifx\@startpbox\tabu@measure@startpbox\tabu@spaces (coefs<0)\else \ifdim\tabu@X@sum>\z@ \expandafter\tabu@msg@align \the\dimexpr(\tabu@target-\wd\tabu@box) *\p@/\tabu@X@sum\relax {}{}{}{}{}\@@\fi\fi^^J}% \def\tabu@message@spread{\tabu@spreadheader \expandafter\tabu@msg@align \the\tabu@spreadtarget {}{}{}{}{}\@@ \expandafter\tabu@msg@align \the\wd\tabu@box {}{}{}{}{}\@@ \expandafter\tabu@msg@align \the\tabucolX {}{}{}{}{}\@@ \expandafter\tabu@msg@align \expandafter-\the\tabu@naturalX {}{}{}{}{}\@@} \def\tabu@message@reached{\tabu@header \expandafter\tabu@msg@align \the\tabucolX { }{ }{ }{ }{}\@@ \expandafter\tabu@msg@align \the\wd\tabu@box {}{}{}{}{}\@@ <\expandafter\tabu@msg@align \the\tabu@target { }{ }{ }{ }{}\@@ + \tabu@hfuzz\space= hfuzz *****^^J% (tabu)\tabu@spaces******* Reached Target: hfuzz = \tabu@hfuzz\on@line\space *******^^J% \ifnum\tabu@nested=\z@ \tabu@elapsedtime ^^J\fi}% \def\tabu@message@etime{(tabu)\tabu@spaces Time elapsed for trials: \the\numexpr(\pdfelapsedtime-\tabu@starttime-32767)/65536\relax sec \the\numexpr\numexpr(\pdfelapsedtime-\tabu@starttime) -\numexpr(\pdfelapsedtime-\tabu@starttime-32767)/65536\relax*65536\relax *1000/65536\relax ms}% \def\tabu@message@negcoef #1{\tabu@spaces\tabu@spaces * #1. X[-\csname tabu@X#1\endcsname]: natural width = \tabu@wd{#1} < \csname tabu@X#1\endcsname X = \the\dimexpr\csname tabu@X#1\endcsname\tabucolX }% \tabu@message@negcoef \edef\tabu@spaces{\@spaces} \def\do#1{% \def\tabu@msg@align##1.##2##3##4##5##6##7##8##9\@@{% \ifnum##1<10 #1 #1\else \ifnum##1<100 #1 \else \ifnum##1<\@m #1\fi\fi\fi ##1.##2##3##4##5##6##7##8#1}% \def\tabu@header{(tabu) \ifnum\tabu@cnt<10 #1\fi\the\tabu@cnt) #1}% \def\tabu@titles{\ifnum \tabu@nested=\z@ (tabu) Try#1 #1 tabu X #1 #1 #1tabu Width #1 #1 Target #1 #1 #1 #1 Coefs #1 #1 #1 Update^^J\fi}% \def\tabu@spreadheader{% (tabu) Try#1 #1 Spread #1 #1 tabu Width #1 #1 Nat. Min. #1 #1 #1 Nat.X #1 #1 #1 New Target^^J% (tabu)spread}% \def\tabu@tracing@save##1{\begingroup \def\col@sep ####1\relax {(tabu) column sep #1 #1 #1 = ####1^^J}% \def\arrayrulewidth ####1\relax{(tabu) arrayrulewidth #1 = ####1^^J}% \def\doublerulesep ####1\relax {(tabu) doublerulesep #1 #1= ####1^^J}% \def\extrarowheight ####1\relax{(tabu) extrarowheight #1 = ####1^^J}% \def\extratabsurround ####1\relax{(tabu) extratabsurround = ####1^^J}% \def\minrowclearance ####1\relax {(tabu) minrowclearance#1 = ####1^^J}% \def\arraystretch ####1{(tabu) arraystretch #1 #1 = ####1^^J}% \iftabu@colortbl \def\CT@arc@####1{(tabu) arrayrulecolor #1 = ####1^^J}% \def\CT@drsc@####1{(tabu) doublerulesepcolor=####1^^J}% \let\color \relax \fi \def\NC@find ####1\@nil{(tabu) tabu preamble#1 #1 = \detokenize{####1}^^J}% \def\tabu@wddef####1####2{(tabu) Natural width ####1 = ####2^^J}% \let\edef \@gobbletwo \let\def \@empty \tabu@message{% (tabu) \string\savetabu{##1}: \on@line^^J% \ifx \savetabu\tabusaveX (tabu) X columns width #1 = \the\tabucolX^^J\fi (tabu) target #1 #1 #1 #1 #1 = \the\tabu@target^^J% \tabu@savedparam \tabu@savedpream \@nil \iftabu@negcoef \tabu@savewd\fi}% \endgroup}% }\do{ } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % % % \subsubsection(Natural width measure){Measuring the natural width for \textt{tabu spread} and negativ width-coefficients} % % \begin{macro}{\tabu@measure@startpbox} % \begin{macro}{\tabu@measure@endpbox} % % When ``\textt{tabu spread}'' is used with \textt X columns, the first trial must % measure the natural width of the columns. When \textt X columns have negativ coefficient, % the natural is computed after the target has been reached, with the absolute coefficients. % % Nested trials may occur (\textt{tabu spread} inside a \textt X column with negativ % coefficient for example). % % For the furthur trials, the standard scheme for \textt X column is used: the natural width % is measured only once. % % \hologo{pdfTeX} font expansion is disabled inside the \textt{varwidth} environment % (we set \cs{pdfadjustspacing} to \textt 0). % % \begin{macrocode} \def\tabu@measure@startpbox#1{\bgroup \let\@startpbox \tabu@startpboxORI % in case of nesting \in@{\tabu@dimexpr}{#1}% \ifin@ \global\advance\tabu@X@cols \@ne \ifcsname tabu@X\the\tabu@X@cols\endcsname\else \global\tabu@X@cols \@ne \global\tabu@naturalX \z@ \fi \fi \iftabu@spread\else \ifin@ {\let\tabu@dimexpr \@firstoftwo\expandafter}% \ifdim \tabu@wd{#1}<\p@ \in@false\fi\fi\fi \ifin@ \begingroup \let\tabu@dimexpr \@secondoftwo \edef\x{\endgroup \def\noexpand\tabu@temp{\the\dimexpr#1}% }\x \setbox\tabu@box=\hbox\bgroup \let\tabu@rewrite@X \tabu@@rewrite@X \begin{varwidth}{\tabu@temp}\narrowragged\arraybackslash \tabu@noadjustspacing \parfillskip\@flushglue \bgroup \aftergroup\tabu@measure@endpbox \else \expandafter\@gobble\@startpbox{#1}% \@gobble \bgroup \fi }% \tabu@measure@startpbox \ifdefined\pdfadjustspacing \def\tabu@noadjustspacing{\pdfadjustspacing\z@}% \else \let\tabu@noadjustspacing\relax \fi \def\tabu@measure@endpbox{% \@finalstrut\@arstrutbox\end{varwidth}\egroup % \global\advance\tabu@naturalX \wd\tabu@box \ifdim \tabu@naturalX@max<\tabu@naturalX \xdef\tabu@naturalX@max{\the\tabu@naturalX}\fi \@tempdima=\dimexpr \wd\tabu@box * \tabu@X@sum / \dimexpr\csname tabu@X\the\tabu@X@cols\endcsname\p@\relax\relax \ifdim \tabu@naturalX@min<\@tempdima \xdef\tabu@naturalX@min{\the\@tempdima}\fi \ifdim \tabu@wd\tabu@X@cols>\z@ \ifdim \tabu@wd\tabu@X@cols<\wd\tabu@box \tabu@wddef\tabu@X@cols {\the\wd\tabu@box}% \tabu@debug{\tabu@spaces\tabu@spaces * \the\tabu@X@cols. X[-\csname tabu@X\the\tabu@X@cols\endcsname]: target=\the\dimexpr\tabu@temp\relax\space \expandafter\expandafter\expandafter\string\tabu@wd\tabu@X@cols =\tabu@wd\tabu@X@cols}% \fi\fi \box\tabu@box \egroup % end of \vtop (measure) }% \tabu@measure@endpbox \def\tabu@wd#1{\csname tabu@W\the\tabu@nested @\number#1\endcsname} \def\tabu@wddef#1{\expandafter\xdef \csname tabu@W\the\tabu@nested @\number#1\endcsname} \def\tabu@wdlet#1{\global\expandafter\let \csname tabu@W\the\tabu@nested @\number#1\endcsname} \def\tabu@naturalX@min{\z@} \def\tabu@naturalX@max{\z@} % \end{macrocode} % \end{macro} % \end{macro} % % % \subsection{\cs{everycr} setup and \cs{tabuphantomline}} % % \begin{macro}{\tabu@setup@everycr} % % \cs{ialign} resets \cs{everycr} to an empty token. This macro sets \cs{everycr} for the % \textt{tabu} environment. % % \begin{macrocode} \def\tabu@setup@everycr{% \tabu@firstclinetrue \let\tabu@first@cline \z@ \def\tabu@restoreeverycr {\let\everycr \tabu@everycr}% \def\everycr{\afterassignment\tabu@restoreeverycr \@temptokena}% \tabu@everycr\expandafter{\the\tabu@everycr \noalign{% \ifcase\tabu@first@cline \global\let\tabu@first@cline \tw@ \or\global\let\tabu@first@cline \tw@ \or\global\tabu@firstclinefalse \global\let\tabu@first@cline \m@ne \fi}% \tabu@rowfontreset }% }% \tabu@setup@everycr % \end{macrocode} % \end{macro} % % \begin{macro}{\tabuphantomline} % % 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\tabuphantomline{\crcr\noalign{% \global\let\@arstrutbox \voidb@x \iftabu@colortbl \xdef\tabu@minrowclearance{\the\minrowclearance}% \global\minrowclearance \z@ \fi \global\let\vcenter \vbox \ifnum \tabu@nested>\z@ \vspace*{\dimexpr\extrarowheight-\ht\@arstrutbox}\fi \toks@{}\count@\@ne \@whilenum\count@<\tabu@nbcols\do{\advance\count@\@ne \toks@\expandafter{\the\toks@&}}% \toks@\expandafter{\the\toks@ \cr\noalign{% \global\let\@arstrutbox \tabu@arstrutbox \global\let\vcenter \tabu@vcenter \iftabu@colortbl \global\minrowclearance \tabu@minrowclearance\relax\fi \global\let\tabu@first@cline \@ne}}% \expandafter}\the\toks@ }% \tabuphantomline % \end{macrocode} % \end{macro} % % % % \subsection(Lines inside tabu){Lines inside \textt{tabu}} % % \subsubsection{Vertical lines} % % % \begin{macro}{\tabuvline@rewrite} % % \textt\textbar\ is defined as a new column type but only inside the group % where \cs{@mkpream} does its job. This way, the modification is very local % to \textt{tabu}. % % \begin{macro}{\tabu@lines} % % This feature is disabled with the \textt{light} option. % % \begin{macrocode} \def\tabu@lines{{\endlinechar\m@ne \scantokens{\def\x{|}}% \expandafter}\expandafter\tabu@lines@ \x }% \tabu@lines \def\tabu@lines@#1{% \tabu@newcolumntype #1{\tabuvline@rewrite}% \NC@list\expandafter{\the\NC@list \NC@do #1}% }% \tabu@lines@ \newcommand*\tabuvline@rewrite[1][]{\tabuvline@arg{#1}% \expandafter \NC@find \tabu@temp} \def\tabu@vline#1{\vrule width#1} % \end{macrocode} % \end{macro} % \end{macro} % % % \begin{macro}{\tabuvline@arg} % % A tedious (and fastidious) macro to parse the optional argument of \textt\textbar\ vertical lines... % \begin{macrocode} \def\tabuvline@arg#1{% \ifx\\#1\\% \edef\tabu@temp{!{% \iftabu@colortbl\begingroup\noexpand\CT@arc@\fi \noexpand\tabu@vline\arrayrulewidth \iftabu@colortbl\endgroup\fi}}% \else \futurelet \tabu@temp \tabuvline@argi #1\p@\p@\@nnil \tabuvline@argiii \fi }% \tabuvline@arg \def\tabuvline@argi{% \let\tabu@color \@empty \ifcat A\noexpand\tabu@temp \@tempdima\arrayrulewidth \expandafter\tabu@getlinecolor \else \expandafter\tabuvline@argii \fi }% \tabuvline@argi \def\tabuvline@argii#1\@nnil{% \tabu@maybecolor \@tempdima #1 \@nnil }% \tabuvline@argii \def\tabuvline@argiii{% \edef\tabu@temp{!{\begingroup \ifx\tabu@color\@empty \iftabu@colortbl \noexpand\CT@arc@ \fi \else \tabu@color\fi \noexpand\tabu@vline{\the\@tempdima}\endgroup}}% }% \tabuvline@argiii % \end{macrocode} % \end{macro} % % % \subsubsection{Horizontal lines: \cs{tabucline}} % % \begin{macro}{\tabucline} % % \cs{tabucline}\M[style or spec.]\M*{start-end} % % \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][]{\toks@{}% \tabu@startstop{#2}\tabu@getlinespec{#1}\@multicnt\@ne \ifnum\tabu@start>\tabu@stop \else\ifx\tabu@xleaders\relax \else \toks@{\noalign{\global\let\@arstrutbox \voidb@x}}% %% \iftabu@firstcline\if\tabu@align t\vskip-\ht\@arstrutbox\fi\fi \@whilenum\@multicnt<\tabu@start\do{\advance\@multicnt\@ne \toks@\expandafter{\the\toks@ &}}% \loop \toks@\expandafter{\the\toks@ \omit }% \ifnum \@multicnt=\@ne \expandafter \tabu@add \csname tabu@tok@\the\@multicnt L\endcsname \@nil \fi \ifcase 0\if@tempswa\else\ifnum \@multicnt<\tabu@stop 1\fi\fi\relax \toks@\expandafter{\the\toks@ \begingroup}% \toks@\expandafter{\the\expandafter\toks@ \tabu@xleaders \endgroup}% \fi \ifcase 0\if@tempswa\else\ifnum \@multicnt<\tabu@stop 1\fi\fi\relax \expandafter \tabu@add \csname tabu@tok@\the\@multicnt R\endcsname \@nil \fi \ifnum\@multicnt<\tabu@stop \advance\@multicnt\@ne \if@tempswa \toks@\expandafter{\the\toks@ &}% \else \toks@\expandafter{\the\toks@ \span}\fi \repeat \@whilenum\@multicnt<\tabu@nbcols\do{\advance\@multicnt\@ne \toks@\expandafter{\the\toks@ &}}% \toks@\expandafter{\the\toks@ \cr \noalign{\global\let\@arstrutbox \tabu@arstrutbox}}% %% \tabu@debug{LIGNE AJOUTEE:\the\toks@}% \fi\fi \ifnum0=`{\fi\expandafter}\the\toks@ }% \tabu@cline \def\tabu@add #1\@nil{\toks@\expandafter{\the\toks@ \begingroup #1\endgroup\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{% \@defaultunits \tabu@start \number0#1\relax\@nnil \@defaultunits \tabu@stop \number0#2\relax\@nnil \ifnum\tabu@start>\tabu@nbcols\tabu@start \tabu@nbcols\else \ifnum\tabu@start<\@ne \tabu@start \@ne \fi\fi \ifnum\tabu@stop>\tabu@nbcols \tabu@stop \tabu@nbcols \else \ifnum\tabu@stop<\@ne \tabu@stop \tabu@nbcols\fi\fi }% \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@\detokenize{#1}\endcsname \csname tabu@line@style@\detokenize{#1}\endcsname \else \tabu@getline{#1\p@ on0pt off0pt}\fi\fi\fi\fi\fi }% \tabu@getlinespec \def\tabu@defleaders#1{% \def\tabu@xleaders{\iftabu@colortbl\CT@arc@\fi \xleaders\hbox{\lower.5\extrarowheight#1}\tabu@leaderfill}} \def\tabucline@warn#1{\PackageWarning{tabu} {Undefined line syle: #1 \MessageBreak Using default line style instead}% \let\tabu@xleaders \tabu@defaultleaders }% \tabucline@warn % \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\@tempa\else \@tempdimb \z@ \tabu@lineoff off0pt \p@\@nnil \fi \fi }% \tabu@lineon \def\tabu@lineoff #1off#2\@nnil{% \tabu@maybecolor \@tempdimc #2\p@ \@nnil \iftabu@colortbl \ifx \tabu@color\@empty \def\tabu@color{\noexpand\CT@arc@}% \fi\fi \ifdim \@tempdimb=\z@ \ifdim \@tempdimc>\z@ \@tempdimb \tabu@dashgap\relax\fi\fi \ifdim \@tempdimc=\z@ \ifdim \@tempdimb>\z@ \@tempdimc \tabu@linedash\relax\fi\fi \ifdim \@tempdima<\z@ \else \ifdim \@tempdimb<\z@ \else \ifdim \@tempdimc<\z@ \else \edef \tabu@xleaders{\tabu@color\xleaders \ifdim\@tempdimc>\z@ \hbox\bgroup \kern\the\dimexpr\@tempdimc/2\relax\fi \noexpand\iftabu@firstcline \vrule depth\dimexpr\the\@tempdima \ifdim\@tempdimb>\z@ width\the\@tempdimb\fi \noexpand\else \vrule height\dimexpr-\extrarowheight+\the\@tempdima depth\dimexpr\extrarowheight \ifdim\@tempdimb>\z@ width\the\@tempdimb\fi \noexpand\fi \ifdim\@tempdimc>\z@ \kern\the\dimexpr\@tempdimc/2\egroup\fi \tabu@leaderfill}% \fi\fi\fi }% \tabu@lineoff % \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@\detokenize{#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{\iftabu@colortbl\CT@arc@\fi \leaders \iftabu@firstcline \vrule depth \arrayrulewidth \else \vrule height\dimexpr-\extrarowheight+\arrayrulewidth depth \extrarowheight \fi \tabu@leaderfill} \let\tabu@leaderfill \hfil % \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\catcode`\^=7\edef\^{\string^}\tabu@makeatletter \catcode32=13\let =\ \catcode`\^^@=13\def^^@{\hskip\parfillskip\null\linebreak}% \endlinechar\m@ne}} {\catcode64=13\edef @{\string @}\expandafter\xdef \csname tabu@makeatletter\endcsname{\catcode64=13\def\noexpand @{\unskip @}}} \newcommand\tabu@sanitizetext[1][\ttfamily]{\begingroup \tabu@verb #1\tabu@s@nitizetext} \long\def\tabu@s@nitizetext#1{\@makeother\{\@makeother\}% \everyeof{\noexpand}\scantokens{#1}\endgroup} % \end{macrocode} % \end{macro} % % \subsection{Numbers in \textt{tabu}} % % \subsubsection{\cs{tabudecimal}} % % \begin{macro}{\tabudecimal} % % \cs{tabu@tabudecimal} is \cs{tabudecimal} inside \textt{tabu}. % % \begin{macrocode} \def\tabu@tabudecimal#1{% \def\tabu@decimal{#1}\@temptokena{}% \let\tabu@getdecimal@ \tabu@getdecimal@ignorespaces \tabu@scandecimal }% \tabu@tabudecimal \def\tabu@scandecimal{\futurelet \tabu@temp \tabu@getdecimal@} \def\tabu@skipdecimal#1{#1\tabu@scandecimal} \def\tabu@getdecimal@ignorespaces{% \ifcase 0\ifx\tabu@temp\ignorespaces\else \ifx\tabu@temp\@sptoken1\else 2\fi\fi\relax \let\tabu@getdecimal@ \tabu@getdecimal \expandafter\tabu@skipdecimal \or \expandafter\tabu@gobblespace\expandafter\tabu@scandecimal \else \expandafter\tabu@skipdecimal \fi }% \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{ } \let\tabu@@tabudecimal \tabu@tabudecimal % \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{\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{macrocode} \newcommand*\savetabu[1]{\noalign{% \ifx\\#1\\\tabu@savewarn{}{The tabu will not be saved}\else \@ifundefined{tabu@saved@\string#1}{}{\tabu@savewarn{#1}{Overwritting}}% {% \toks0\expandafter{\tabu@savedpreamble}% \toks1\expandafter{\tabu@savedparam}% \toks2\expandafter{\tabu@savedpream}% \toks3{}% \iftabu@negcoef \edef\tabu@savewd{\tabu@savewd{\number\numexpr1}}% \toks3\expandafter{\tabu@savewd}\fi \expandafter\xdef\csname tabu@saved@\string#1\endcsname##1{% \noexpand\ifcase##1\relax \noexpand\ifdim\tabu@target>\z@ \noexpand\tabu@warn@usetabu \noexpand\fi \tabu@target \the\tabu@target\relax \tabucolX \the\tabucolX\relax \the\toks1% \gdef\noexpand\tabu@usetabu{% \the\toks1% \def\noexpand\@halignto{\@halignto}% \tabucolX \the\tabucolX\relax \def\noexpand\@preamble{\the\toks0}% \noexpand\tabu@make@arstrutbox \the\toks3 \noexpand\ifx \noexpand\tabu@align\noexpand\tabu@aligndefault@text \def\noexpand\tabu@align{\tabu@align}% \noexpand\fi}% \aftergroup\noexpand\tabu@usetabu \noexpand\else \noexpand\ifdim\tabu@target=\z@ \tabu@target \the\tabu@target\relax \noexpand\fi \gdef\noexpand\tabu@preamble{% \noexpand\ifx \noexpand\tabu@align\noexpand\tabu@aligndefault@text \def\noexpand\tabu@align{\tabu@align}% \noexpand\fi}% \aftergroup\noexpand\tabu@preamble \noexpand\fi \the\toks2}% \tabu@message@save{#1}}% \fi}% }% \savetabu \def\tabu@aligndefault@text{\tabu@aligndefault}% \def\tabu@warn@usetabu{\PackageWarning{tabu} {Specifying a target with \string\usetabu\space is useless \MessageBreak The target cannot be changed!}} \def\tabu@savewd#1{% \ifnum#1>\tabu@nbcols \expandafter \@gobble \else \ifdim\tabu@wd{#1}>\z@ \noexpand\tabu@wddef{#1}{\tabu@wd{#1}}\fi \expandafter\tabu@savewd % loop \fi{#1+1}% }% \tabu@savewd \def\tabu@make@arstrutbox{% \@tempdima \ht \strutbox \advance \@tempdima by\extrarowheight \setbox \@arstrutbox \hbox{\vrule \@height \arraystretch \@tempdima \@depth \arraystretch \dp \strutbox \@width \z@}% }% \tabu@make@arstrutbox % \end{macrocode} % \end{macro} % % \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\let\tabu@rowfontreset \tabu@rowfont@reset \global\let\tabu@@cellleft \tabu@cellleft \global\let\tabu@@cellright \tabu@cellright \gdef\tabu@cellfont{\let\color \tabu@colorleavevmode#2\let\color \tabu@colorORI}% \ifcsname tabu@cell@#1\endcsname % row alignment \csname tabu@cell@#1\endcsname \fi \toks@\expandafter {\tabu@cellleft\tabu@cellfont}% inside \noalign group ok \xdef\tabu@cellleft {\the\toks@}% \ifnum0=`{\fi}% end of noalign group }% \rowfont \def\tabu@colorleavevmode{\leavevmode\tabu@colorORI} \AtBeginDocument{\let\tabu@colorORI \color} % \end{macrocode} % \end{macro} % % % \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@rowfontreset \@empty \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 }% }% \tabu@rowfont@reset \let\tabu@rowfontreset\@empty % \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\tabu@prepnext@tokORI \prepnext@tok }% original definition \def\tabu@prepnext@tok{% \ifnum \count@<\z@ % \@tempcnta \@M % \tabu@nbcols\z@ \xdef\tabu@global@temp{\tabu@global@temp \tabu@nbcols\z@}% \expandafter\let\csname tabu@tok@1L\endcsname \relax \tabu@cellrightfalse \else \ifcase \numexpr \count@-\@tempcnta \relax % (case 0): prev. token is left \advance \tabu@nbcols\@ne \expandafter\let\csname tabu@tok@\the\tabu@nbcols R\endcsname \relax \expandafter\gdef\expandafter\tabu@global@temp\expandafter{% \tabu@global@temp \advance\tabu@nbcols\@ne}% \iftabu@cellright % before-previous token is right and is finished \tabu@cellrightfalse % \tabu@savetok R\tabu@preptokenright \fi \ifnum \tabu@nbcols=\@ne \tabu@savetok L\fi \tabu@preptokenleft \or % (case 1) previous token is right \tabu@savetok R\tabu@cellrighttrue \else % special column: do not change the token \ifnum \tabu@nbcols>\z@ %special column: always on the right of normal one \tabu@savetok R% \else % unless this is the very first column (\tabu@nbcols=0) \advance\tabu@nbcols\@ne \tabu@savetok L\advance\tabu@nbcols\m@ne \fi \iftabu@cellright % before-previous token is right \tabu@cellrightfalse \tabu@preptokenright \fi \fi % \ifcase \fi \tabu@prepnext@tokORI }% \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{% \ifnum \@chclass=\@ne \toks@\toks\count@ \else\ifnum\@chclass=5 \toks@\toks\count@ \else \toks@{}\fi\fi \unless\ifx#1\relax \toks@\expandafter\expandafter\expandafter{% \expandafter#1\the\toks@}\fi \toks@\expandafter{\expandafter\def\expandafter#1\expandafter{% \the\toks@}}% \@temptokena\expandafter{\tabu@global@temp}% \xdef\tabu@global@temp {\the\@temptokena \the\toks@}% \expandafter\endgroup \the\toks@ }% \tabu@savetok % \end{macrocode} % \end{macro} % % \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{\textt{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{\textt{tabu} \cs{fcolorbox}} % % \cs{tabu@fcolorbox} works exactly like \xpackage{xcolor} \cs{fcolorbox} but allows the syntax: % % \cs{fcolorbox}\M*{frame color}\M*{background color}\cs{bgroup}...\cs{egroup} % % suitable for use insed tabular columns. \cs{fcolorbox} is \cs{let} to \cs{tabu@fcolorbox} at the entry inside a \textt{tabu} % environment. % % \begin{macrocode} \def\tabu@color@b@x#1#2{\leavevmode \def\tabu@do@color@b@x{#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}\box\z@}}% \afterassignment\tabu@begin@color@b@x \setbox\z@ \hbox }% \tabu@color@b@x \def\tabu@begin@color@b@x{% \bgroup \kern\fboxsep \set@color \aftergroup\tabu@end@color@b@x }% \tabu@begin@color@b@x \def\tabu@end@color@b@x{\kern\fboxsep \egroup \dimen@\ht\z@\advance\dimen@\fboxsep\ht\z@\dimen@ \dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@ \tabu@do@color@b@x }% \tabu@end@color@b@x % \end{macrocode} % % % \subsubsection{\cs{centering}, \cs{raggedright}, \cs{raggedleft}} % % Inside \textt{tabu} environment, no need to add \cs{arraybackslash} after these commands. % % \begin{macrocode} \def\tabu@temp#1#2{{\toks@\expandafter{#2\arraybackslash}\xdef#1{\the\toks@}}} \tabu@temp \tabu@centering \centering \tabu@temp \tabu@raggedleft \raggedleft \tabu@temp \tabu@raggedright \raggedright \def\tabu@trivlist{\expandafter\def\expandafter\@trivlist\expandafter{% \expandafter\let\expandafter\\\expandafter\@normalcr\@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, colors without \xpackage{colortbl} and empty \textt p columns} % % \xpackage{arydshln} redefines \cs{@endpbox} for \textt p columns. The definition is stored in \cs{adl@act@endpbox}. % Here it is: % % \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). % % Finally, \xpackage{arydshln} is not compatible with colors in columns, such that: \textt{>\M*{\cs{color}\M*{red}}p{3in}}, % Unless \xpackage{colortbl} is also loaded, the color group is missing. % % Fixed inside \textt{tabu}. % % \begin{macrocode} \def\tabu@adl@act@endpbox{% \unskip \ifhmode \nobreak \fi \@finalstrut \@arstrutbox \egroup \egroup \adl@colhtdp \box\adl@box \hfil }% \tabu@adl@act@endpbox \def\tabu@adl@fix{% \let\adl@xarraydashrule \tabu@adl@xarraydashrule % arydshln \let\adl@act@endpbox \tabu@adl@act@endpbox % arydshln \let\adl@act@@endpbox \tabu@adl@act@endpbox % arydshln \let\@preamerror \@preamerr % arydshln }% \tabu@adl@fix % \end{macrocode} % % % \begin{macrocode} % % \end{macrocode} % % \restoregeometry % \bookmarksetup{bold*} % \pagesetup*{ % left/offset-=1cm,right/offset+=1cm, % head/color=LightSteelBlue, % head/left=\moveleft1cm\vbox to0pt{\vss\setbox0=\null\ht0=0pt\wd0=\paperwidth\dp0=\headheight\rlap{\colorbox{GhostWhite}{\box0}}}\vskip-\headheight t\,a\,b\,u\,\ \ i\,n\,d\,e\,x, % } % % \begin{thebibliography}{9} % % \bibitem{array} % \textit{A new implementation of \LaTeX's \textt{tabular} and \textt{array} environments} by Frank Mittelbach\\ % 2008/09/09 v2.4c -- Tabular extension package (FMi) \\ % \href{http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/array.html}{\nolinkurl{CTAN:help/Catalogue/entries/array.html}} % % \bibitem{varwidth} % \textit{The \xpackage{varwidth} package} by Donald Arseneau \\ % 2009/03/30 ver 0.92 -- Variable-width minipages \\ % \href{http://www.ctan.org/tex-archive/help/Catalogue/entries/varwidth.html}{\nolinkurl{CTAN:help/Catalogue/entries/varwidth.html}} % % \bibitem{enumitem-zref} % \textit{The \xpackage{enumitem-zref} package} by \FC \\ % 2010/11/28 ver 1.1 -- Extended references for enumitem pkg \\ % \href{http://www.ctan.org/tex-archive/help/Catalogue/entries/enumitem-zref.html}{\nolinkurl{CTAN:help/Catalogue/entries/enumitem-zref.html}} % \label{enumitem-zref} % % \end{thebibliography} % % % % \begin{History} % % \def\Version#1{\HistVersion{#1}\setitemize{name=#1,leftmargin=2em}\itemize} % % \sectionformat\subsection[hang]{font=\large\bfseries\macrocodecolor} % % \begin{Version}{2010/12/28 v1.8}\HistLabel{1.8} % \item \csref{tracingtabu} / \hyperref[debugshow]{\textt{debugshow}} package option:\\ % reporting of the time elapsed during trials (if \cs{pdfelapsedtime} and thus \hologo{pdfTeX} is available) \\ % Slight modifications for better reporting on the \xext{log} file. % \item Fix a bug when \csref{savetabu} is used after \cs{multicolumn} (\cs{multicolumn} globally redefines \cs{@preamble}). % \item Fix a bug with \csref{tabucline} and \cs{CT@arc@} (\xpackage{colortbl}). % \item Better privacy of columns types specifically defined for \textt{tabu}. % \item Improvement in the rewritting process (but only very few people should notice...) % \item Documentation. % \end{Version} % % \begin{Version}{2010/12/18 v1.7}\HistLabel{1.7} % \item Code optimisation % \item Modification in the columns rewritting process (bug with some new column types defined by the user). % \end{Version} % % \begin{Version}{2010/12/07 v1.5}\HistLabel{1.5} % \item Implementation of negativ width coefficients for \textt X columns (cf. \refitem{tabu X columns,2}[\nameref*{tabu X columns} point \ref]). % \item Columns natural widths computation (for \textt{tabu spread} with \textt X columns and negativ coefficients) % is based on the code of the \xpackage{varwidth} package by Donald Arseneau. % \item \textt{longtabu} is now provided, based on the \xpackage{longtable} package by David Carlisle. \\ % \textt{longtabu} can be used just like \textt{tabu}. % \item Vertical lines can be used whatever the catcode of \textbf\textbar\ is. % \item \csref{savetabu} reports saved informations in the \xext{log} (\hyperref[debugshow]{\textt{debugshow}} option). % \item \cs{savetabu} ... \cs{usetabu} now restores the \cs{halign} preamble rather than the \textt{tabu} preamble! \\ % \csref{preamble} can be use in the \textt{tabu} preamble to restore a \texttt{tabu} preamble. % \item \csref{tabucline} is more robust with ``special'' preambles containing\, \texttbf>\, or\, \texttbf<\, tokens. \\ % \cs{tabucline} now takes care of \cs{arrayrulecolor} (package \xpackage{colortbl}). % \item \Xpackage{enumitem-zref} package has been added to the documentation (see the link \refitem{2010/12/07 v1.5,1}[point 1]) % \item Optimisation of some parts of the code. % \end{Version} % % \begin{Version}{2010/11/22 v1.4}\HistLabel{1.4} % \item Compatibility improvement with \xpackage{linegoal} for the syntax: \\ % \cs{begin}\M*{tabu}\textt{ to\cs{linegoal}}\M*{...} % \item Hyper footnotes now work correctly. % \item Fix a bug when using colored vertical lines in \textt{tabu} in math mode. % \item Fix a bug with vertical lines and \xpackage{colortbl} \cs{arrayrulecolor} specification. % \item Fix a compatibility bug with \xpackage{arydshln}: when nesting a tabular that use % vertical dashed lines (\xpackage{arydshln}) inside \textt{tabu spread} with \textt X columns. % \end{Version} % % \begin{Version}{2010/11/18 v1.3}\HistLabel{1.3} % \item Fix a bug that may appear in \cs{tabucline} depending on the preamble due to arbitrary \cs{countdef}. % \item Improvement in the use of \cs{everycr}: no \cs{global} stuff. Thus bug fixed when nesting \textt{tabu} % inside \hologo{AmS}-\textt{align} environment for example. Same issue with \cs{rowfont} which now works % without global modification of \cs{everycr}. % \item No phantom line is added to \textt{tabu} but a command \cs{tabuphantomline} is provided for this purpose % (required with \cs{multicolumn} in some cases). % \item Improvement on vertical alignment. % \item To do: an example file to test a wide range of possibilities... % \item Documentation. % \end{Version} % % \begin{Version}{2010/11/15 v1.2}\HistLabel{1.2} % \item Improvement in parameters parsing for optional parameters (\textt\textbar\ and \cs{tabucline}). % \item Modification / optimization in \cs{tabu@prepnext@tok}. % \item Modification of \cs{tabucline} to get better results with \textt m columns (\textt{X[m]}) % and also when \cs{minrowclearance} $>0$ (package \xpackage{colortbl}). % \end{Version} % % \begin{Version}{2010/10/28 v1.1}\HistLabel{1.1} % \item First version. % \end{Version} % % \end{History} % % % \PrintIndex % % \Finale