tabu_doxygen.sty 112 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557
  1. %%
  2. %% This is file `tabu.sty',
  3. %% generated with the docstrip utility.
  4. %%
  5. %% The original source files were:
  6. %%
  7. %% tabu.dtx (with options: `package')
  8. %%
  9. %% This is a generated file.
  10. %% Copyright (FC) 2010-2011 - lppl
  11. %%
  12. %% tabu : 2011/02/26 v2.8 - tabu : Flexible LaTeX tabulars
  13. %%
  14. %% **********************************************************************************************
  15. %% \begin{tabu} { preamble } => default target: \linewidth or \linegoal
  16. %% \begin{tabu} to <dimen>{ preamble } => target specified
  17. %% \begin{tabu} spread <dimen>{ preamble } => target relative to the ``natural width''
  18. %%
  19. %% tabu works in text and in math modes.
  20. %%
  21. %% X columns: automatic width adjustment + horizontal and vertical alignment
  22. %% \begin{tabu} { X[4c] X[1c] X[-2ml] }
  23. %%
  24. %% Horizontal lines and / or leaders:
  25. %% \hline\hline => double horizontal line
  26. %% \firsthline\hline => for nested tabulars
  27. %% \lasthline\hline => for nested tabulars
  28. %% \tabucline[line spec]{column-column} => ``funny'' lines (dash/leader)
  29. %% Automatic lines / leaders :
  30. %% \everyrow{\hline\hline}
  31. %%
  32. %% Vertical lines and / or leaders:
  33. %% \begin{tabu} { |[3pt red] X[4c] X[1c] X[-2ml] |[3pt blue] }
  34. %% \begin{tabu} { |[3pt red] X[4c] X[1c] X[-2ml] |[3pt on 2pt off 4pt blue] }
  35. %%
  36. %% Fixed vertical spacing adjustment:
  37. %% \extrarowheight=<dimen> \extrarowdepth=<dimen>
  38. %% or: \extrarowsep=<dimen> => may be prefixed by \global
  39. %%
  40. %% Dynamic vertical spacing adjustment:
  41. %% \abovetabulinesep=<dimen> \belowtabulinesep=<dimen>
  42. %% or: \tabulinesep=<dimen> => may be prefixed by \global
  43. %%
  44. %% delarray.sty shortcuts: in math and text modes
  45. %% \begin{tabu} .... \({ preamble }\)
  46. %%
  47. %% Algorithms reports:
  48. %% \tracingtabu=1 \tracingtabu=2
  49. %%
  50. %% **********************************************************************************************
  51. %%
  52. %% This work may be distributed and/or modified under the
  53. %% conditions of the LaTeX Project Public License, either
  54. %% version 1.3 of this license or (at your option) any later
  55. %% version. The latest version of this license is in
  56. %% http://www.latex-project.org/lppl.txt
  57. %%
  58. %% This work consists of the main source file tabu.dtx
  59. %% and the derived files
  60. %% tabu.sty, tabu.pdf, tabu.ins
  61. %%
  62. %% tabu : Flexible LaTeX tabulars
  63. %% lppl copyright 2010-2011 by FC <florent.chervet@free.fr>
  64. %%
  65. \NeedsTeXFormat{LaTeX2e}[2005/12/01]
  66. \ProvidesPackage{tabu_doxygen}[2011/02/26 v2.8 - flexible LaTeX tabulars (FC), frozen version for doxygen]
  67. \RequirePackage{array}[2008/09/09]
  68. \RequirePackage{varwidth}[2009/03/30]
  69. \AtEndOfPackage{\tabu@AtEnd \let\tabu@AtEnd \@undefined}
  70. \let\tabu@AtEnd\@empty
  71. \def\TMP@EnsureCode#1={%
  72. \edef\tabu@AtEnd{\tabu@AtEnd
  73. \catcode#1 \the\catcode#1}%
  74. \catcode#1=%
  75. }% \TMP@EnsureCode
  76. \TMP@EnsureCode 33 = 12 % !
  77. \TMP@EnsureCode 58 = 12 % : (for siunitx)
  78. \TMP@EnsureCode124 = 12 % |
  79. \TMP@EnsureCode 36 = 3 % $ = math shift
  80. \TMP@EnsureCode 38 = 4 % & = tab alignment character
  81. \TMP@EnsureCode 32 = 10 % space
  82. \TMP@EnsureCode 94 = 7 % ^
  83. \TMP@EnsureCode 95 = 8 % _
  84. %% Constants --------------------------------------------------------
  85. \newcount \c@taburow \def\thetaburow {\number\c@taburow}
  86. \newcount \tabu@nbcols
  87. \newcount \tabu@cnt
  88. \newcount \tabu@Xcol
  89. \let\tabu@start \@tempcnta
  90. \let\tabu@stop \@tempcntb
  91. \newcount \tabu@alloc \tabu@alloc=\m@ne
  92. \newcount \tabu@nested
  93. \def\tabu@alloc@{\global\advance\tabu@alloc \@ne \tabu@nested\tabu@alloc}
  94. \newdimen \tabu@target
  95. \newdimen \tabu@spreadtarget
  96. \newdimen \tabu@naturalX
  97. \newdimen \tabucolX
  98. \let\tabu@DELTA \@tempdimc
  99. \let\tabu@thick \@tempdima
  100. \let\tabu@on \@tempdimb
  101. \let\tabu@off \@tempdimc
  102. \newdimen \tabu@Xsum
  103. \newdimen \extrarowdepth
  104. \newdimen \abovetabulinesep
  105. \newdimen \belowtabulinesep
  106. \newdimen \tabustrutrule \tabustrutrule \z@
  107. \newtoks \tabu@thebody
  108. \newtoks \tabu@footnotes
  109. \newsavebox \tabu@box
  110. \newsavebox \tabu@arstrutbox
  111. \newsavebox \tabu@hleads
  112. \newsavebox \tabu@vleads
  113. \newif \iftabu@colortbl
  114. \newif \iftabu@siunitx
  115. \newif \iftabu@measuring
  116. \newif \iftabu@spread
  117. \newif \iftabu@negcoef
  118. \newif \iftabu@everyrow
  119. \def\tabu@everyrowtrue {\global\let\iftabu@everyrow \iftrue}
  120. \def\tabu@everyrowfalse{\global\let\iftabu@everyrow \iffalse}
  121. \newif \iftabu@long
  122. \newif \iftabuscantokens
  123. \def\tabu@rescan {\tabu@verbatim \scantokens }
  124. %% Utilities (for internal usage) -----------------------------------
  125. \def\tabu@gobblespace #1 {#1}
  126. \def\tabu@gobbletoken #1#2{#1}
  127. \def\tabu@gobbleX{\futurelet\@let@token \tabu@gobblex}
  128. \def\tabu@gobblex{\if ^^J\noexpand\@let@token \expandafter\@gobble
  129. \else\ifx \@sptoken\@let@token
  130. \expandafter\tabu@gobblespace\expandafter\tabu@gobbleX
  131. \fi\fi
  132. }% \tabu@gobblex
  133. \def\tabu@X{^^J}
  134. {\obeyspaces
  135. \global\let\tabu@spxiii= % saves an active space (for \ifx)
  136. \gdef\tabu@@spxiii{ }}
  137. \def\tabu@ifenvir {% only for \multicolumn
  138. \expandafter\tabu@if@nvir\csname\@currenvir\endcsname
  139. }% \tabu@ifenvir
  140. \def\tabu@if@nvir #1{\csname @\ifx\tabu#1first\else
  141. \ifx\longtabu#1first\else
  142. second\fi\fi oftwo\endcsname
  143. }% \tabu@ifenvir
  144. \def\tabu@modulo #1#2{\numexpr\ifnum\numexpr#1=\z@ 0\else #1-(#1-(#2-1)/2)/(#2)*(#2)\fi}
  145. {\catcode`\&=3
  146. \gdef\tabu@strtrim #1{% #1 = control sequence to trim
  147. \ifodd 1\ifx #1\@empty \else \ifx #1\space \else 0\fi \fi
  148. \let\tabu@c@l@r \@empty \let#1\@empty
  149. \else \expandafter \tabu@trimspaces #1&#1\@nnil
  150. \fi
  151. }% \tabu@strtrim
  152. \gdef\tabu@trimspaces #1&#2\@nnil{\let\tabu@c@l@r=#2\tabu@firstspace .#1& &#2}%
  153. \gdef\tabu@firstspace #1#2#3 &{\tabu@lastspace #2#3&}
  154. \gdef\tabu@lastspace #1&#2&#3{\def #3{#1}%
  155. \ifx #3\tabu@c@l@r \def\tabu@c@l@r{\protect\color{#1}}\expandafter\remove@to@nnil \fi
  156. \tabu@trimspaces #1&#3\@nnil}
  157. }% \catcode
  158. \def\tabu@sanitizearg #1#2{{%
  159. \csname \ifcsname if@safe@actives\endcsname % <babel>
  160. @safe@activestrue\else
  161. relax\fi \endcsname
  162. \edef#2{#1}\tabu@strtrim#2\@onelevel@sanitize#2%
  163. \expandafter}\expandafter\def\expandafter#2\expandafter{#2}%
  164. }% \tabu@sanitizearg
  165. \def\tabu@textbar #1{\begingroup \endlinechar\m@ne \scantokens{\def\:{|}}%
  166. \expandafter\endgroup \expandafter#1\:% !!! semi simple group !!!
  167. }% \tabu@textbar
  168. \def\tabu@everyrow@bgroup{\iftabu@everyrow \begingroup \else \noalign{\ifnum0=`}\fi \fi}
  169. \def\tabu@everyrow@egroup{%
  170. \iftabu@everyrow \expandafter \endgroup \the\toks@
  171. \else \ifnum0=`{\fi}%
  172. \fi
  173. }% \tabu@everyrow@egroup
  174. \def\tabu@arstrut {\global\setbox\@arstrutbox \hbox{\vrule
  175. height \arraystretch \dimexpr\ht\strutbox+\extrarowheight
  176. depth \arraystretch \dimexpr\dp\strutbox+\extrarowdepth
  177. width \z@}%
  178. }% \tabu@arstrut
  179. \def\tabu@rearstrut {%
  180. \@tempdima \arraystretch\dimexpr\ht\strutbox+\extrarowheight \relax
  181. \@tempdimb \arraystretch\dimexpr\dp\strutbox+\extrarowdepth \relax
  182. \ifodd 1\ifdim \ht\@arstrutbox=\@tempdima
  183. \ifdim \dp\@arstrutbox=\@tempdimb 0 \fi\fi
  184. \tabu@mkarstrut
  185. \fi
  186. }% \tabu@rearstrut
  187. \def\tabu@@DBG #1{\ifdim\tabustrutrule>\z@ \color{#1}\fi}
  188. \def\tabu@DBG@arstrut {\global\setbox\@arstrutbox
  189. \hbox to\z@{\hbox to\z@{\hss
  190. {\tabu@DBG{cyan}\vrule
  191. height \arraystretch \dimexpr\ht\strutbox+\extrarowheight
  192. depth \z@
  193. width \tabustrutrule}\kern-\tabustrutrule
  194. {\tabu@DBG{pink}\vrule
  195. height \z@
  196. depth \arraystretch \dimexpr\dp\strutbox+\extrarowdepth
  197. width \tabustrutrule}}}%
  198. }% \tabu@DBG@arstrut
  199. \def\tabu@save@decl{\toks\count@ \expandafter{\the\toks\expandafter\count@
  200. \@nextchar}}%
  201. \def\tabu@savedecl{\ifcat$\d@llarend\else
  202. \let\save@decl \tabu@save@decl \fi % no inversion of tokens in text mode
  203. }% \tabu@savedecl
  204. \def\tabu@finalstrut #1{\unskip\ifhmode\nobreak\fi\vrule height\z@ depth\z@ width\z@}
  205. \newcommand*\tabuDisableCommands {\g@addto@macro\tabu@trialh@@k }
  206. \let\tabu@trialh@@k \@empty
  207. \def\tabu@nowrite #1#{{\afterassignment}\toks@}
  208. \let\tabu@write\write
  209. \let\tabu@immediate\immediate
  210. \def\tabu@WRITE{\begingroup
  211. \def\immediate\write{\aftergroup\endgroup
  212. \tabu@immediate\tabu@write}%
  213. }% \tabu@WRITE
  214. \expandafter\def\expandafter\tabu@GenericError\expandafter{%
  215. \expandafter\tabu@WRITE\GenericError}
  216. \def\tabu@warn{\tabu@WRITE\PackageWarning{tabu}}
  217. \def\tabu@noxfootnote [#1]{\@gobble}
  218. \def\tabu@nocolor #1#{\@gobble}
  219. \newcommand*\tabu@norowcolor[2][]{}
  220. \def\tabu@maybesiunitx #1{\def\tabu@temp{#1}%
  221. \futurelet\@let@token \tabu@m@ybesiunitx}
  222. \def\tabu@m@ybesiunitx #1{\def\tabu@m@ybesiunitx {%
  223. \ifx #1\@let@token \let\tabu@cellleft \@empty \let\tabu@cellright \@empty \fi
  224. \tabu@temp}% \tabu@m@ybesiunitx
  225. }\expandafter\tabu@m@ybesiunitx \csname siunitx_table_collect_begin:Nn\endcsname
  226. \def\tabu@celllalign@def #1{\def\tabu@celllalign{\tabu@maybesiunitx{#1}}}%
  227. %% Fixed vertical spacing adjustment: \extrarowsep ------------------
  228. \newcommand*\extrarowsep{\edef\tabu@C@extra{\the\numexpr\tabu@C@extra+1}%
  229. \iftabu@everyrow \aftergroup\tabu@Gextra
  230. \else \aftergroup\tabu@n@Gextra
  231. \fi
  232. \@ifnextchar={\tabu@gobbletoken\tabu@extra} \tabu@extra
  233. }% \extrarowsep
  234. \def\tabu@extra {\@ifnextchar_%
  235. {\tabu@gobbletoken{\tabu@setextra\extrarowheight \extrarowdepth}}
  236. {\ifx ^\@let@token \def\tabu@temp{%
  237. \tabu@gobbletoken{\tabu@setextra\extrarowdepth \extrarowheight}}%
  238. \else \let\tabu@temp \@empty
  239. \afterassignment \tabu@setextrasep \extrarowdepth
  240. \fi \tabu@temp}%
  241. }% \tabu@extra
  242. \def\tabu@setextra #1#2{\def\tabu@temp{\tabu@extr@#1#2}\afterassignment\tabu@temp#2}
  243. \def\tabu@extr@ #1#2{\@ifnextchar^%
  244. {\tabu@gobbletoken{\tabu@setextra\extrarowdepth \extrarowheight}}
  245. {\ifx _\@let@token \def\tabu@temp{%
  246. \tabu@gobbletoken{\tabu@setextra\extrarowheight \extrarowdepth}}%
  247. \else \let\tabu@temp \@empty
  248. \tabu@Gsave \tabu@G@extra \tabu@C@extra \extrarowheight \extrarowdepth
  249. \fi \tabu@temp}%
  250. }% \tabu@extr@
  251. \def\tabu@setextrasep {\extrarowheight=\extrarowdepth
  252. \tabu@Gsave \tabu@G@extra \tabu@C@extra \extrarowheight \extrarowdepth
  253. }% \tabu@setextrasep
  254. \def\tabu@Gextra{\ifx \tabu@G@extra\@empty \else {\tabu@Rextra}\fi}
  255. \def\tabu@n@Gextra{\ifx \tabu@G@extra\@empty \else \noalign{\tabu@Rextra}\fi}
  256. \def\tabu@Rextra{\tabu@Grestore \tabu@G@extra \tabu@C@extra}
  257. \let\tabu@C@extra \z@
  258. \let\tabu@G@extra \@empty
  259. %% Dynamic vertical spacing adjustment: \tabulinesep ----------------
  260. \newcommand*\tabulinesep{\edef\tabu@C@linesep{\the\numexpr\tabu@C@linesep+1}%
  261. \iftabu@everyrow \aftergroup\tabu@Glinesep
  262. \else \aftergroup\tabu@n@Glinesep
  263. \fi
  264. \@ifnextchar={\tabu@gobbletoken\tabu@linesep} \tabu@linesep
  265. }% \tabulinesep
  266. \def\tabu@linesep {\@ifnextchar_%
  267. {\tabu@gobbletoken{\tabu@setsep\abovetabulinesep \belowtabulinesep}}
  268. {\ifx ^\@let@token \def\tabu@temp{%
  269. \tabu@gobbletoken{\tabu@setsep\belowtabulinesep \abovetabulinesep}}%
  270. \else \let\tabu@temp \@empty
  271. \afterassignment \tabu@setlinesep \abovetabulinesep
  272. \fi \tabu@temp}%
  273. }% \tabu@linesep
  274. \def\tabu@setsep #1#2{\def\tabu@temp{\tabu@sets@p#1#2}\afterassignment\tabu@temp#2}
  275. \def\tabu@sets@p #1#2{\@ifnextchar^%
  276. {\tabu@gobbletoken{\tabu@setsep\belowtabulinesep \abovetabulinesep}}
  277. {\ifx _\@let@token \def\tabu@temp{%
  278. \tabu@gobbletoken{\tabu@setsep\abovetabulinesep \belowtabulinesep}}%
  279. \else \let\tabu@temp \@empty
  280. \tabu@Gsave \tabu@G@linesep \tabu@C@linesep \abovetabulinesep \belowtabulinesep
  281. \fi \tabu@temp}%
  282. }% \tabu@sets@p
  283. \def\tabu@setlinesep {\belowtabulinesep=\abovetabulinesep
  284. \tabu@Gsave \tabu@G@linesep \tabu@C@linesep \abovetabulinesep \belowtabulinesep
  285. }% \tabu@setlinesep
  286. \def\tabu@Glinesep{\ifx \tabu@G@linesep\@empty \else {\tabu@Rlinesep}\fi}
  287. \def\tabu@n@Glinesep{\ifx \tabu@G@linesep\@empty \else \noalign{\tabu@Rlinesep}\fi}
  288. \def\tabu@Rlinesep{\tabu@Grestore \tabu@G@linesep \tabu@C@linesep}
  289. \let\tabu@C@linesep \z@
  290. \let\tabu@G@linesep \@empty
  291. %% \global\extrarowsep and \global\tabulinesep -------------------
  292. \def\tabu@Gsave #1#2#3#4{\xdef#1{#1%
  293. \toks#2{\toks\the\currentgrouplevel{\global#3\the#3\global#4\the#4}}}%
  294. }% \tabu@Gsave
  295. \def\tabu@Grestore#1#2{%
  296. \toks#2{}#1\toks\currentgrouplevel\expandafter{\expandafter}\the\toks#2\relax
  297. \ifcat$\the\toks\currentgrouplevel$\else
  298. \global\let#1\@empty \global\let#2\z@
  299. \the\toks\currentgrouplevel
  300. \fi
  301. }% \tabu@Grestore
  302. %% Setting code for every row ---------------------------------------
  303. \newcommand*\everyrow{\tabu@everyrow@bgroup
  304. \tabu@start \z@ \tabu@stop \z@ \tabu@evrstartstop
  305. }% \everyrow
  306. \def\tabu@evrstartstop {\@ifnextchar^%
  307. {\afterassignment \tabu@evrstartstop \tabu@stop=}%
  308. {\ifx ^\@let@token
  309. \afterassignment\tabu@evrstartstop \tabu@start=%
  310. \else \afterassignment\tabu@everyr@w \toks@
  311. \fi}%
  312. }% \tabu@evrstartstop
  313. \def\tabu@everyr@w {%
  314. \xdef\tabu@everyrow{%
  315. \noexpand\tabu@everyrowfalse
  316. \let\noalign \relax
  317. \noexpand\tabu@rowfontreset
  318. \iftabu@colortbl \noexpand\tabu@rc@ \fi % \taburowcolors
  319. \let\noexpand\tabu@docline \noexpand\tabu@docline@evr
  320. \the\toks@
  321. \noexpand\tabu@evrh@@k
  322. \noexpand\tabu@rearstrut
  323. \global\advance\c@taburow \@ne}%
  324. \iftabu@everyrow \toks@\expandafter
  325. {\expandafter\def\expandafter\tabu@evr@L\expandafter{\the\toks@}\ignorespaces}%
  326. \else \xdef\tabu@evr@G{\the\toks@}%
  327. \fi
  328. \tabu@everyrow@egroup
  329. }% \tabu@everyr@w
  330. \def\tabu@evr {\def\tabu@evrh@@k} % for internal use only
  331. \tabu@evr{}
  332. %% line style and leaders -------------------------------------------
  333. \newcommand*\newtabulinestyle [1]{%
  334. {\@for \@tempa :=#1\do{\expandafter\tabu@newlinestyle \@tempa==\@nil}}%
  335. }% \newtabulinestyle
  336. \def\tabu@newlinestyle #1=#2=#3\@nil{\tabu@getline {#2}%
  337. \tabu@sanitizearg {#1}\@tempa
  338. \ifodd 1\ifx \@tempa\@empty \ifdefined\tabu@linestyle@ 0 \fi\fi
  339. \global\expandafter\let
  340. \csname tabu@linestyle@\@tempa \endcsname =\tabu@thestyle \fi
  341. }% \tabu@newlinestyle
  342. \newcommand*\tabulinestyle [1]{\tabu@everyrow@bgroup \tabu@getline{#1}%
  343. \iftabu@everyrow
  344. \toks@\expandafter{\expandafter \def \expandafter
  345. \tabu@ls@L\expandafter{\tabu@thestyle}\ignorespaces}%
  346. \gdef\tabu@ls@{\tabu@ls@L}%
  347. \else
  348. \global\let\tabu@ls@G \tabu@thestyle
  349. \gdef\tabu@ls@{\tabu@ls@G}%
  350. \fi
  351. \tabu@everyrow@egroup
  352. }% \tabulinestyle
  353. \newcommand*\taburulecolor{\tabu@everyrow@bgroup \tabu@textbar \tabu@rulecolor}
  354. \def\tabu@rulecolor #1{\toks@{}%
  355. \def\tabu@temp #1##1#1{\tabu@ruledrsc{##1}}\@ifnextchar #1%
  356. \tabu@temp
  357. \tabu@rulearc
  358. }% \tabu@rulecolor
  359. \def\tabu@ruledrsc #1{\edef\tabu@temp{#1}\tabu@strtrim\tabu@temp
  360. \ifx \tabu@temp\@empty \def\tabu@temp{\tabu@rule@drsc@ {}{}}%
  361. \else \edef\tabu@temp{\noexpand\tabu@rule@drsc@ {}{\tabu@temp}}%
  362. \fi
  363. \tabu@temp
  364. }% \tabu@ruledrsc@
  365. \def\tabu@ruledrsc@ #1#{\tabu@rule@drsc@ {#1}}
  366. \def\tabu@rule@drsc@ #1#2{%
  367. \iftabu@everyrow
  368. \ifx \\#1#2\\\toks@{\let\CT@drsc@ \relax}%
  369. \else \toks@{\def\CT@drsc@{\color #1{#2}}}%
  370. \fi
  371. \else
  372. \ifx \\#1#2\\\global\let\CT@drsc@ \relax
  373. \else \gdef\CT@drsc@{\color #1{#2}}%
  374. \fi
  375. \fi
  376. \tabu@rulearc
  377. }% \tabu@rule@drsc@
  378. \def\tabu@rulearc #1#{\tabu@rule@arc@ {#1}}
  379. \def\tabu@rule@arc@ #1#2{%
  380. \iftabu@everyrow
  381. \ifx \\#1#2\\\toks@\expandafter{\the\toks@ \def\CT@arc@{}}%
  382. \else \toks@\expandafter{\the\toks@ \def\CT@arc@{\color #1{#2}}}%
  383. \fi
  384. \toks@\expandafter{\the\toks@
  385. \let\tabu@arc@L \CT@arc@
  386. \let\tabu@drsc@L \CT@drsc@
  387. \ignorespaces}%
  388. \else
  389. \ifx \\#1#2\\\gdef\CT@arc@{}%
  390. \else \gdef\CT@arc@{\color #1{#2}}%
  391. \fi
  392. \global\let\tabu@arc@G \CT@arc@
  393. \global\let\tabu@drsc@G \CT@drsc@
  394. \fi
  395. \tabu@everyrow@egroup
  396. }% \tabu@rule@arc@
  397. \def\taburowcolors {\tabu@everyrow@bgroup \@testopt \tabu@rowcolors 1}
  398. \def\tabu@rowcolors [#1]#2#{\tabu@rowc@lors{#1}{#2}}
  399. \def\tabu@rowc@lors #1#2#3{%
  400. \toks@{}\@defaultunits \count@ =\number0#2\relax \@nnil
  401. \@defaultunits \tabu@start =\number0#1\relax \@nnil
  402. \ifnum \count@<\tw@ \count@=\tw@ \fi
  403. \advance\tabu@start \m@ne
  404. \ifnum \tabu@start<\z@ \tabu@start \z@ \fi
  405. \tabu@rowcolorseries #3\in@..\in@ \@nnil
  406. }% \tabu@rowcolors
  407. \def\tabu@rowcolorseries #1..#2\in@ #3\@nnil {%
  408. \ifx \in@#1\relax
  409. \iftabu@everyrow \toks@{\def\tabu@rc@{}\let\tabu@rc@L \tabu@rc@}%
  410. \else \gdef\tabu@rc@{}\global\let\tabu@rc@G \tabu@rc@
  411. \fi
  412. \else
  413. \ifx \\#2\\\tabu@rowcolorserieserror \fi
  414. \tabu@sanitizearg{#1}\tabu@temp
  415. \tabu@sanitizearg{#2}\@tempa
  416. \advance\count@ \m@ne
  417. \iftabu@everyrow
  418. \def\tabu@rc@ ##1##2##3##4{\def\tabu@rc@{%
  419. \ifnum ##2=\c@taburow
  420. \definecolorseries{tabu@rcseries@\the\tabu@nested}{rgb}{last}{##3}{##4}\fi
  421. \ifnum \c@taburow<##2 \else
  422. \ifnum \tabu@modulo {\c@taburow-##2}{##1+1}=\z@
  423. \resetcolorseries[{##1}]{tabu@rcseries@\the\tabu@nested}\fi
  424. \xglobal\colorlet{tabu@rc@\the\tabu@nested}{tabu@rcseries@\the\tabu@nested!!+}%
  425. \rowcolor{tabu@rc@\the\tabu@nested}\fi}%
  426. }\edef\x{\noexpand\tabu@rc@ {\the\count@}
  427. {\the\tabu@start}
  428. {\tabu@temp}
  429. {\@tempa}%
  430. }\x
  431. \toks@\expandafter{\expandafter\def\expandafter\tabu@rc@\expandafter{\tabu@rc@}}%
  432. \toks@\expandafter{\the\toks@ \let\tabu@rc@L \tabu@rc@ \ignorespaces}%
  433. \else % inside \noalign
  434. \definecolorseries{tabu@rcseries@\the\tabu@nested}{rgb}{last}{\tabu@temp}{\@tempa}%
  435. \expandafter\resetcolorseries\expandafter[\the\count@]{tabu@rcseries@\the\tabu@nested}%
  436. \xglobal\colorlet{tabu@rc@\the\tabu@nested}{tabu@rcseries@\the\tabu@nested!!+}%
  437. \let\noalign \relax \rowcolor{tabu@rc@\the\tabu@nested}%
  438. \def\tabu@rc@ ##1##2{\gdef\tabu@rc@{%
  439. \ifnum \tabu@modulo {\c@taburow-##2}{##1+1}=\@ne
  440. \resetcolorseries[{##1}]{tabu@rcseries@\the\tabu@nested}\fi
  441. \xglobal\colorlet{tabu@rc@\the\tabu@nested}{tabu@rcseries@\the\tabu@nested!!+}%
  442. \rowcolor{tabu@rc@\the\tabu@nested}}%
  443. }\edef\x{\noexpand\tabu@rc@{\the\count@}{\the\c@taburow}}\x
  444. \global\let\tabu@rc@G \tabu@rc@
  445. \fi
  446. \fi
  447. \tabu@everyrow@egroup
  448. }% \tabu@rowcolorseries
  449. \tabuDisableCommands {\let\tabu@rc@ \@empty }
  450. \def\tabu@rowcolorserieserror {\PackageError{tabu}
  451. {Invalid syntax for \string\taburowcolors
  452. \MessageBreak Please look at the documentation!}\@ehd
  453. }% \tabu@rowcolorserieserror
  454. \newcommand*\tabureset {%
  455. \tabulinesep=\z@ \extrarowsep=\z@ \extratabsurround=\z@
  456. \tabulinestyle{}\everyrow{}\taburulecolor||{}\taburowcolors{}%
  457. }% \tabureset
  458. %% Parsing the line styles ------------------------------------------
  459. \def\tabu@getline #1{\begingroup
  460. \csname \ifcsname if@safe@actives\endcsname % <babel>
  461. @safe@activestrue\else
  462. relax\fi \endcsname
  463. \edef\tabu@temp{#1}\tabu@sanitizearg{#1}\@tempa
  464. \let\tabu@thestyle \relax
  465. \ifcsname tabu@linestyle@\@tempa \endcsname
  466. \edef\tabu@thestyle{\endgroup
  467. \def\tabu@thestyle{\expandafter\noexpand
  468. \csname tabu@linestyle@\@tempa\endcsname}%
  469. }\tabu@thestyle
  470. \else \expandafter\tabu@definestyle \tabu@temp \@nil
  471. \fi
  472. }% \tabu@getline
  473. \def\tabu@definestyle #1#2\@nil {\endlinechar \m@ne \makeatletter
  474. \tabu@thick \maxdimen \tabu@on \maxdimen \tabu@off \maxdimen
  475. \let\tabu@c@lon \@undefined \let\tabu@c@loff \@undefined
  476. \ifodd 1\ifcat .#1\else\ifcat\relax #1\else 0\fi\fi % catcode 12 or non expandable cs
  477. \def\tabu@temp{\tabu@getparam{thick}}%
  478. \else \def\tabu@temp{\tabu@getparam{thick}\maxdimen}%
  479. \fi
  480. {%
  481. \let\tabu@ \relax
  482. \def\:{\obeyspaces \tabu@oXIII \tabu@commaXIII \edef\:}% (space active \: happy ;-))
  483. \scantokens{\:{\tabu@temp #1#2 \tabu@\tabu@}}%
  484. \expandafter}\expandafter
  485. \def\expandafter\:\expandafter{\:}% line spec rewritten now ;-)
  486. \def\;{\def\:}%
  487. \scantokens\expandafter{\expandafter\;\expandafter{\:}}% space is now inactive (catcode 10)
  488. \let\tabu@ \tabu@getcolor \:% all arguments are ready now ;-)
  489. \ifdefined\tabu@c@lon \else \let\tabu@c@lon\@empty \fi
  490. \ifx \tabu@c@lon\@empty \def\tabu@c@lon{\CT@arc@}\fi
  491. \ifdefined\tabu@c@loff \else \let\tabu@c@loff \@empty \fi
  492. \ifdim \tabu@on=\maxdimen \ifdim \tabu@off<\maxdimen
  493. \tabu@on \tabulineon \fi\fi
  494. \ifdim \tabu@off=\maxdimen \ifdim \tabu@on<\maxdimen
  495. \tabu@off \tabulineoff \fi\fi
  496. \ifodd 1\ifdim \tabu@off=\maxdimen \ifdim \tabu@on=\maxdimen 0 \fi\fi
  497. \in@true % <leaders>
  498. \else \in@false % <rule>
  499. \fi
  500. \ifdim\tabu@thick=\maxdimen \def\tabu@thick{\arrayrulewidth}%
  501. \else \edef\tabu@thick{\the\tabu@thick}%
  502. \fi
  503. \edef \tabu@thestyle ##1##2{\endgroup
  504. \def\tabu@thestyle{%
  505. \ifin@ \noexpand\tabu@leadersstyle {\tabu@thick}
  506. {\the\tabu@on}{##1}
  507. {\the\tabu@off}{##2}%
  508. \else \noexpand\tabu@rulesstyle
  509. {##1\vrule width \tabu@thick}%
  510. {##1\leaders \hrule height \tabu@thick \hfil}%
  511. \fi}%
  512. }\expandafter \expandafter
  513. \expandafter \tabu@thestyle \expandafter
  514. \expandafter \expandafter
  515. {\expandafter\tabu@c@lon\expandafter}\expandafter{\tabu@c@loff}%
  516. }% \tabu@definestyle
  517. {\catcode`\O=\active \lccode`\O=`\o \catcode`\,=\active
  518. \lowercase{\gdef\tabu@oXIII {\catcode`\o=\active \let O=\tabu@oxiii}}
  519. \gdef\tabu@commaXIII {\catcode`\,=\active \let ,=\space}
  520. }% \catcode
  521. \def\tabu@oxiii #1{%
  522. \ifcase \ifx n#1\z@ \else
  523. \ifx f#1\@ne\else
  524. \tw@ \fi\fi
  525. \expandafter\tabu@onxiii
  526. \or \expandafter\tabu@ofxiii
  527. \else o%
  528. \fi#1}%
  529. \def\tabu@onxiii #1#2{%
  530. \ifcase \ifx !#2\tw@ \else
  531. \ifcat.\noexpand#2\z@ \else
  532. \ifx \tabu@spxiii#2\@ne\else
  533. \tw@ \fi\fi\fi
  534. \tabu@getparam{on}#2\expandafter\@gobble
  535. \or \expandafter\tabu@onxiii % (space is active)
  536. \else o\expandafter\@firstofone
  537. \fi{#1#2}}%
  538. \def\tabu@ofxiii #1#2{%
  539. \ifx #2f\expandafter\tabu@offxiii
  540. \else o\expandafter\@firstofone
  541. \fi{#1#2}}
  542. \def\tabu@offxiii #1#2{%
  543. \ifcase \ifx !#2\tw@ \else
  544. \ifcat.\noexpand#2\z@ \else
  545. \ifx\tabu@spxiii#2\@ne \else
  546. \tw@ \fi\fi\fi
  547. \tabu@getparam{off}#2\expandafter\@gobble
  548. \or \expandafter\tabu@offxiii % (space is active)
  549. \else o\expandafter\@firstofone
  550. \fi{#1#2}}
  551. \def\tabu@getparam #1{\tabu@ \csname tabu@#1\endcsname=}
  552. \def\tabu@getcolor #1{% \tabu@ <- \tabu@getcolor after \edef
  553. \ifx \tabu@#1\else % no more spec
  554. \let\tabu@theparam=#1\afterassignment \tabu@getc@l@r #1\fi
  555. }% \tabu@getcolor
  556. \def\tabu@getc@l@r #1\tabu@ {%
  557. \def\tabu@temp{#1}\tabu@strtrim \tabu@temp
  558. \ifx \tabu@temp\@empty
  559. \else%\ifcsname \string\color@\tabu@temp \endcsname % if the color exists
  560. \ifx \tabu@theparam \tabu@off \let\tabu@c@loff \tabu@c@l@r
  561. \else \let\tabu@c@lon \tabu@c@l@r
  562. \fi
  563. %\else \tabu@warncolour{\tabu@temp}%
  564. \fi%\fi
  565. \tabu@ % next spec
  566. }% \tabu@getc@l@r
  567. \def\tabu@warncolour #1{\PackageWarning{tabu}
  568. {Color #1 is not defined. Default color used}%
  569. }% \tabu@warncolour
  570. \def\tabu@leadersstyle #1#2#3#4#5{\def\tabu@leaders{{#1}{#2}{#3}{#4}{#5}}%
  571. \ifx \tabu@leaders\tabu@leaders@G \else
  572. \tabu@LEADERS{#1}{#2}{#3}{#4}{#5}\fi
  573. }% \tabu@leadersstyle
  574. \def\tabu@rulesstyle #1#2{\let\tabu@leaders \@undefined
  575. \gdef\tabu@thevrule{#1}\gdef\tabu@thehrule{#2}%
  576. }% \tabu@rulesstyle
  577. %% The leaders boxes ------------------------------------------------
  578. \def\tabu@LEADERS #1#2#3#4#5{%% width, dash, dash color, gap, gap color
  579. {\let\color \tabu@color % => during trials -> \color = \tabu@nocolor
  580. {% % but the leaders boxes should have colors !
  581. \def\@therule{\vrule}\def\@thick{height}\def\@length{width}%
  582. \def\@box{\hbox}\def\@unbox{\unhbox}\def\@elt{\wd}%
  583. \def\@skip{\hskip}\def\@ss{\hss}\def\tabu@leads{\tabu@hleads}%
  584. \tabu@l@@d@rs {#1}{#2}{#3}{#4}{#5}%
  585. \global\let\tabu@thehleaders \tabu@theleaders
  586. }%
  587. {%
  588. \def\@therule{\hrule}\def\@thick{width}\def\@length{height}%
  589. \def\@box{\vbox}\def\@unbox{\unvbox}\def\@elt{\ht}%
  590. \def\@skip{\vskip}\def\@ss{\vss}\def\tabu@leads{\tabu@vleads}%
  591. \tabu@l@@d@rs {#1}{#2}{#3}{#4}{#5}%
  592. \global\let\tabu@thevleaders \tabu@theleaders
  593. }%
  594. \gdef\tabu@leaders@G{{#1}{#2}{#3}{#4}{#5}}%
  595. }%
  596. }% \tabu@LEADERS
  597. \def\tabu@therule #1#2{\@therule \@thick#1\@length\dimexpr#2/2 \@depth\z@}
  598. \def\tabu@l@@d@rs #1#2#3#4#5{%% width, dash, dash color, gap, gap color
  599. \global\setbox \tabu@leads=\@box{%
  600. {#3\tabu@therule{#1}{#2}}%
  601. \ifx\\#5\\\@skip#4\else{#5\tabu@therule{#1}{#4*2}}\fi
  602. {#3\tabu@therule{#1}{#2}}}%
  603. \global\setbox\tabu@leads=\@box to\@elt\tabu@leads{\@ss
  604. {#3\tabu@therule{#1}{#2}}\@unbox\tabu@leads}%
  605. \edef\tabu@theleaders ##1{\def\noexpand\tabu@theleaders {%
  606. {##1\tabu@therule{#1}{#2}}%
  607. \xleaders \copy\tabu@leads \@ss
  608. \tabu@therule{0pt}{-#2}{##1\tabu@therule{#1}{#2}}}%
  609. }\tabu@theleaders{#3}%
  610. }% \tabu@l@@d@rs
  611. %% \tabu \endtabu \tabu* \longtabu \endlongtabu \longtabu* ----------
  612. \newcommand*\tabu {\tabu@longfalse
  613. \ifmmode \def\tabu@ {\array}\def\endtabu {\endarray}%
  614. \else \def\tabu@ {\tabu@tabular}\def\endtabu {\endtabular}\fi
  615. \expandafter\let\csname tabu*\endcsname \tabu
  616. \expandafter\def\csname endtabu*\endcsname{\endtabu}%
  617. \tabu@spreadfalse \tabu@negcoeffalse \tabu@settarget
  618. }% {tabu}
  619. \let\tabu@tabular \tabular % <For LyX: some users redefine \tabular...>
  620. \expandafter\def\csname tabu*\endcsname{\tabuscantokenstrue \tabu}
  621. \newcommand*\longtabu {\tabu@longtrue
  622. \ifmmode\PackageError{tabu}{longtabu not allowed in math mode}\fi
  623. \def\tabu@{\longtable}\def\endlongtabu{\endlongtable}%
  624. \LTchunksize=\@M
  625. \expandafter\let\csname tabu*\endcsname \tabu
  626. \expandafter\def\csname endlongtabu*\endcsname{\endlongtabu}%
  627. \let\LT@startpbox \tabu@LT@startpbox % \everypar{ array struts }
  628. \tabu@spreadfalse \tabu@negcoeffalse \tabu@settarget
  629. }% {longtabu}
  630. \expandafter\def\csname longtabu*\endcsname{\tabuscantokenstrue \longtabu}
  631. \def\tabu@nolongtabu{\PackageError{tabu}
  632. {longtabu requires the longtable package}\@ehd}
  633. %% Read the target and then : \tabular or \@array ------------------
  634. \def\tabu@settarget {\futurelet\@let@token \tabu@sett@rget }
  635. \def\tabu@sett@rget {\tabu@target \z@
  636. \ifcase \ifx \bgroup\@let@token \z@ \else
  637. \ifx \@sptoken\@let@token \@ne \else
  638. \if t\@let@token \tw@ \else
  639. \if s\@let@token \thr@@\else
  640. \z@\fi\fi\fi\fi
  641. \expandafter\tabu@begin
  642. \or \expandafter\tabu@gobblespace\expandafter\tabu@settarget
  643. \or \expandafter\tabu@to
  644. \or \expandafter\tabu@spread
  645. \fi
  646. }% \tabu@sett@rget
  647. \def\tabu@to to{\def\tabu@halignto{to}\tabu@gettarget}
  648. \def\tabu@spread spread{\tabu@spreadtrue\def\tabu@halignto{spread}\tabu@gettarget}
  649. \def\tabu@gettarget {\afterassignment\tabu@linegoaltarget \tabu@target }
  650. \def\tabu@linegoaltarget {\futurelet\tabu@temp \tabu@linegoalt@rget }
  651. \def\tabu@linegoalt@rget {%
  652. \ifx \tabu@temp\LNGL@setlinegoal
  653. \LNGL@setlinegoal \expandafter \@firstoftwo \fi % @gobbles \LNGL@setlinegoal
  654. \tabu@begin
  655. }% \tabu@linegoalt@rget
  656. \def\tabu@begin #1#{%
  657. \iftabu@measuring \expandafter\tabu@nestedmeasure \fi
  658. \ifdim \tabu@target=\z@ \let\tabu@halignto \@empty
  659. \else \edef\tabu@halignto{\tabu@halignto\the\tabu@target}%
  660. \fi
  661. \@testopt \tabu@tabu@ \tabu@aligndefault #1\@nil
  662. }% \tabu@begin
  663. \long\def\tabu@tabu@ [#1]#2\@nil #3{\tabu@setup
  664. \def\tabu@align {#1}\def\tabu@savedpream{\NC@find #3}%
  665. \tabu@ [\tabu@align ]#2{#3\tabu@rewritefirst }%
  666. }% \tabu@tabu@
  667. \def\tabu@nestedmeasure {%
  668. \ifodd 1\iftabu@spread \else \ifdim\tabu@target=\z@ \else 0 \fi\fi\relax
  669. \tabu@spreadtrue
  670. \else \begingroup \iffalse{\fi \ifnum0=`}\fi
  671. \toks@{}\def\tabu@stack{b}%
  672. \expandafter\tabu@collectbody\expandafter\tabu@quickrule
  673. \expandafter\endgroup
  674. \fi
  675. }% \tabu@nestedmeasure
  676. \def\tabu@quickrule {\indent\vrule height\z@ depth\z@ width\tabu@target}
  677. %% \tabu@setup \tabu@init \tabu@indent
  678. \def\tabu@setup{\tabu@alloc@
  679. \ifcase \tabu@nested
  680. \ifmmode \else \iftabu@spread\else \ifdim\tabu@target=\z@
  681. \let\tabu@afterendpar \par
  682. \fi\fi\fi
  683. \def\tabu@aligndefault{c}\tabu@init \tabu@indent
  684. \else % <nested tabu>
  685. \def\tabu@aligndefault{t}\let\tabudefaulttarget \linewidth
  686. \fi
  687. \let\tabu@thetarget \tabudefaulttarget \let\tabu@restored \@undefined
  688. \edef\tabu@NC@list{\the\NC@list}\NC@list{\NC@do \tabu@rewritefirst}%
  689. \everycr{}\let\@startpbox \tabu@startpbox % for nested tabu inside longtabu...
  690. \let\@endpbox \tabu@endpbox % idem " " " " " "
  691. \let\@tabarray \tabu@tabarray % idem " " " " " "
  692. \tabu@setcleanup \tabu@setreset
  693. }% \tabu@setup
  694. \def\tabu@init{\tabu@starttimer \tabu@measuringfalse
  695. \edef\tabu@hfuzz {\the\dimexpr\hfuzz+1sp}\global\tabu@footnotes{}%
  696. \let\firsthline \tabu@firsthline \let\lasthline \tabu@lasthline
  697. \let\firstline \tabu@firstline \let\lastline \tabu@lastline
  698. \let\hline \tabu@hline \let\@xhline \tabu@xhline
  699. \let\color \tabu@color \let\@arstrutbox \tabu@arstrutbox
  700. \iftabu@colortbl\else\let\LT@@hline \tabu@LT@@hline \fi
  701. \tabu@trivlist %<restore \\=\@normalcr inside lists>
  702. \let\@footnotetext \tabu@footnotetext \let\@xfootnotetext \tabu@xfootnotetext
  703. \let\@xfootnote \tabu@xfootnote \let\centering \tabu@centering
  704. \let\raggedright \tabu@raggedright \let\raggedleft \tabu@raggedleft
  705. \let\tabudecimal \tabu@tabudecimal \let\Centering \tabu@Centering
  706. \let\RaggedRight \tabu@RaggedRight \let\RaggedLeft \tabu@RaggedLeft
  707. \let\justifying \tabu@justifying \let\rowfont \tabu@rowfont
  708. \let\fbox \tabu@fbox \let\color@b@x \tabu@color@b@x
  709. \let\tabu@@everycr \everycr \let\tabu@@everypar \everypar
  710. \let\tabu@prepnext@tokORI \prepnext@tok\let\prepnext@tok \tabu@prepnext@tok
  711. \let\tabu@multicolumnORI\multicolumn \let\multicolumn \tabu@multicolumn
  712. \let\tabu@startpbox \@startpbox % for nested tabu inside longtabu pfff !!!
  713. \let\tabu@endpbox \@endpbox % idem " " " " " " "
  714. \let\tabu@tabarray \@tabarray % idem " " " " " " "
  715. \tabu@adl@fix \let\endarray \tabu@endarray % <fix> colortbl & arydshln (delarray)
  716. \iftabu@colortbl\CT@everycr\expandafter{\expandafter\iftabu@everyrow \the\CT@everycr \fi}\fi
  717. }% \tabu@init
  718. \def\tabu@indent{% correction for indentation
  719. \ifdim \parindent>\z@\ifx \linewidth\tabudefaulttarget
  720. \everypar\expandafter{%
  721. \the\everypar\everypar\expandafter{\the\everypar}%
  722. \setbox\z@=\lastbox
  723. \ifdim\wd\z@>\z@ \edef\tabu@thetarget
  724. {\the\dimexpr -\wd\z@+\tabudefaulttarget}\fi
  725. \box\z@}%
  726. \fi\fi
  727. }% \tabu@indent
  728. \def\tabu@setcleanup {% saves last global assignments
  729. \ifodd 1\ifmmode \else \iftabu@long \else 0\fi\fi\relax
  730. \def\tabu@aftergroupcleanup{%
  731. \def\tabu@aftergroupcleanup{\aftergroup\tabu@cleanup}}%
  732. \else
  733. \def\tabu@aftergroupcleanup{%
  734. \aftergroup\aftergroup\aftergroup\tabu@cleanup
  735. \let\tabu@aftergroupcleanup \relax}%
  736. \fi
  737. \let\tabu@arc@Gsave \tabu@arc@G
  738. \let\tabu@arc@G \tabu@arc@L % <init>
  739. \let\tabu@drsc@Gsave \tabu@drsc@G
  740. \let\tabu@drsc@G \tabu@drsc@L % <init>
  741. \let\tabu@ls@Gsave \tabu@ls@G
  742. \let\tabu@ls@G \tabu@ls@L % <init>
  743. \let\tabu@rc@Gsave \tabu@rc@G
  744. \let\tabu@rc@G \tabu@rc@L % <init>
  745. \let\tabu@evr@Gsave \tabu@evr@G
  746. \let\tabu@evr@G \tabu@evr@L % <init>
  747. \let\tabu@celllalign@save \tabu@celllalign
  748. \let\tabu@cellralign@save \tabu@cellralign
  749. \let\tabu@cellleft@save \tabu@cellleft
  750. \let\tabu@cellright@save \tabu@cellright
  751. \let\tabu@@celllalign@save \tabu@@celllalign
  752. \let\tabu@@cellralign@save \tabu@@cellralign
  753. \let\tabu@@cellleft@save \tabu@@cellleft
  754. \let\tabu@@cellright@save \tabu@@cellright
  755. \let\tabu@rowfontreset@save \tabu@rowfontreset
  756. \let\tabu@@rowfontreset@save\tabu@@rowfontreset
  757. \let\tabu@rowfontreset \@empty
  758. \edef\tabu@alloc@save {\the\tabu@alloc}% restore at \tabu@reset
  759. \edef\c@taburow@save {\the\c@taburow}%
  760. \edef\tabu@naturalX@save {\the\tabu@naturalX}%
  761. \let\tabu@naturalXmin@save \tabu@naturalXmin
  762. \let\tabu@naturalXmax@save \tabu@naturalXmax
  763. \let\tabu@mkarstrut@save \tabu@mkarstrut
  764. \edef\tabu@clarstrut{%
  765. \extrarowheight \the\dimexpr \ht\@arstrutbox-\ht\strutbox \relax
  766. \extrarowdepth \the\dimexpr \dp\@arstrutbox-\dp\strutbox \relax
  767. \let\noexpand\@arraystretch \@ne \noexpand\tabu@rearstrut}%
  768. }% \tabu@setcleanup
  769. \def\tabu@cleanup {\begingroup
  770. \globaldefs\@ne \tabu@everyrowtrue
  771. \let\tabu@arc@G \tabu@arc@Gsave
  772. \let\CT@arc@ \tabu@arc@G
  773. \let\tabu@drsc@G \tabu@drsc@Gsave
  774. \let\CT@drsc@ \tabu@drsc@G
  775. \let\tabu@ls@G \tabu@ls@Gsave
  776. \let\tabu@ls@ \tabu@ls@G
  777. \let\tabu@rc@G \tabu@rc@Gsave
  778. \let\tabu@rc@ \tabu@rc@G
  779. \let\CT@do@color \relax
  780. \let\tabu@evr@G \tabu@evr@Gsave
  781. \let\tabu@celllalign \tabu@celllalign@save
  782. \let\tabu@cellralign \tabu@cellralign@save
  783. \let\tabu@cellleft \tabu@cellleft@save
  784. \let\tabu@cellright \tabu@cellright@save
  785. \let\tabu@@celllalign \tabu@@celllalign@save
  786. \let\tabu@@cellralign \tabu@@cellralign@save
  787. \let\tabu@@cellleft \tabu@@cellleft@save
  788. \let\tabu@@cellright \tabu@@cellright@save
  789. \let\tabu@rowfontreset \tabu@rowfontreset@save
  790. \let\tabu@@rowfontreset \tabu@@rowfontreset@save
  791. \tabu@naturalX =\tabu@naturalX@save
  792. \let\tabu@naturalXmax \tabu@naturalXmax@save
  793. \let\tabu@naturalXmin \tabu@naturalXmin@save
  794. \let\tabu@mkarstrut \tabu@mkarstrut@save
  795. \c@taburow =\c@taburow@save
  796. \ifcase \tabu@nested \tabu@alloc \m@ne\fi
  797. \endgroup % <end of \globaldefs>
  798. \ifcase \tabu@nested
  799. \the\tabu@footnotes \global\tabu@footnotes{}%
  800. \tabu@afterendpar \tabu@elapsedtime
  801. \fi
  802. \tabu@clarstrut
  803. \everyrow\expandafter {\tabu@evr@G}%
  804. }% \tabu@cleanup
  805. \let\tabu@afterendpar \relax
  806. \def\tabu@setreset {%
  807. \edef\tabu@savedparams {% \relax for \tabu@message@save
  808. \ifmmode \col@sep \the\arraycolsep
  809. \else \col@sep \the\tabcolsep \fi \relax
  810. \arrayrulewidth \the\arrayrulewidth \relax
  811. \doublerulesep \the\doublerulesep \relax
  812. \extratabsurround \the\extratabsurround \relax
  813. \extrarowheight \the\extrarowheight \relax
  814. \extrarowdepth \the\extrarowdepth \relax
  815. \abovetabulinesep \the\abovetabulinesep \relax
  816. \belowtabulinesep \the\belowtabulinesep \relax
  817. \def\noexpand\arraystretch{\arraystretch}%
  818. \ifdefined\minrowclearance \minrowclearance\the\minrowclearance\relax\fi}%
  819. \begingroup
  820. \@temptokena\expandafter{\tabu@savedparams}% => only for \savetabu / \usetabu
  821. \ifx \tabu@arc@L\relax \else \tabu@setsave \tabu@arc@L \fi
  822. \ifx \tabu@drsc@L\relax \else \tabu@setsave \tabu@drsc@L \fi
  823. \tabu@setsave \tabu@ls@L \tabu@setsave \tabu@evr@L
  824. \expandafter \endgroup \expandafter
  825. \def\expandafter\tabu@saved@ \expandafter{\the\@temptokena
  826. \let\tabu@arc@G \tabu@arc@L
  827. \let\tabu@drsc@G \tabu@drsc@L
  828. \let\tabu@ls@G \tabu@ls@L
  829. \let\tabu@rc@G \tabu@rc@L
  830. \let\tabu@evr@G \tabu@evr@L}%
  831. \def\tabu@reset{\tabu@savedparams
  832. \tabu@everyrowtrue \c@taburow \z@
  833. \let\CT@arc@ \tabu@arc@L
  834. \let\CT@drsc@ \tabu@drsc@L
  835. \let\tabu@ls@ \tabu@ls@L
  836. \let\tabu@rc@ \tabu@rc@L
  837. \global\tabu@alloc \tabu@alloc@save
  838. \everyrow\expandafter{\tabu@evr@L}}%
  839. }% \tabu@reset
  840. \def\tabu@setsave #1{\expandafter\tabu@sets@ve #1\@nil{#1}}
  841. \long\def\tabu@sets@ve #1\@nil #2{\@temptokena\expandafter{\the\@temptokena \def#2{#1}}}
  842. %% The Rewriting Process -------------------------------------------
  843. \def\tabu@newcolumntype #1{%
  844. \expandafter\tabu@new@columntype
  845. \csname NC@find@\string#1\expandafter\endcsname
  846. \csname NC@rewrite@\string#1\endcsname
  847. {#1}%
  848. }% \tabu@newcolumntype
  849. \def\tabu@new@columntype #1#2#3{%
  850. \def#1##1#3{\NC@{##1}}%
  851. \let#2\relax \newcommand*#2%
  852. }% \tabu@new@columntype
  853. \def\tabu@privatecolumntype #1{%
  854. \expandafter\tabu@private@columntype
  855. \csname NC@find@\string#1\expandafter\endcsname
  856. \csname NC@rewrite@\string#1\expandafter\endcsname
  857. \csname tabu@NC@find@\string#1\expandafter\endcsname
  858. \csname tabu@NC@rewrite@\string#1\endcsname
  859. {#1}%
  860. }% \tabu@privatecolumntype
  861. \def\tabu@private@columntype#1#2#3#4{%
  862. \g@addto@macro\tabu@privatecolumns{\let#1#3\let#2#4}%
  863. \tabu@new@columntype#3#4%
  864. }% \tabu@private@columntype
  865. \let\tabu@privatecolumns \@empty
  866. \newcommand*\tabucolumn [1]{\expandafter \def \expandafter
  867. \tabu@highprioritycolumns\expandafter{\tabu@highprioritycolumns
  868. \NC@do #1}}%
  869. \let\tabu@highprioritycolumns \@empty
  870. %% The | ``column'' : rewriting process --------------------------
  871. \tabu@privatecolumntype |{\tabu@rewritevline}
  872. \newcommand*\tabu@rewritevline[1][]{\tabu@vlinearg{#1}%
  873. \expandafter \NC@find \tabu@rewritten}
  874. \def\tabu@lines #1{%
  875. \ifx|#1\else \tabu@privatecolumntype #1{\tabu@rewritevline}\fi
  876. \NC@list\expandafter{\the\NC@list \NC@do #1}%
  877. }% \tabu@lines@
  878. \def\tabu@vlinearg #1{%
  879. \ifx\\#1\\\def\tabu@thestyle {\tabu@ls@}%
  880. \else\tabu@getline {#1}%
  881. \fi
  882. \def\tabu@rewritten ##1{\def\tabu@rewritten{!{##1\tabu@thevline}}%
  883. }\expandafter\tabu@rewritten\expandafter{\tabu@thestyle}%
  884. \expandafter \tabu@keepls \tabu@thestyle \@nil
  885. }% \tabu@vlinearg
  886. \def\tabu@keepls #1\@nil{%
  887. \ifcat $\@cdr #1\@nil $%
  888. \ifx \relax#1\else
  889. \ifx \tabu@ls@#1\else
  890. \let#1\relax
  891. \xdef\tabu@mkpreambuffer{\tabu@mkpreambuffer
  892. \tabu@savels\noexpand#1}\fi\fi\fi
  893. }% \tabu@keepls
  894. \def\tabu@thevline {\begingroup
  895. \ifdefined\tabu@leaders
  896. \setbox\@tempboxa=\vtop to\dimexpr
  897. \ht\@arstrutbox+\dp\@arstrutbox{{\tabu@thevleaders}}%
  898. \ht\@tempboxa=\ht\@arstrutbox \dp\@tempboxa=\dp\@arstrutbox
  899. \box\@tempboxa
  900. \else
  901. \tabu@thevrule
  902. \fi \endgroup
  903. }% \tabu@thevline
  904. \def\tabu@savels #1{%
  905. \expandafter\let\csname\string#1\endcsname #1%
  906. \expandafter\def\expandafter\tabu@reset\expandafter{\tabu@reset
  907. \tabu@resetls#1}}%
  908. \def\tabu@resetls #1{\expandafter\let\expandafter#1\csname\string#1\endcsname}%
  909. %% \multicolumn inside tabu environment -----------------------------
  910. \tabu@newcolumntype \tabu@rewritemulticolumn{%
  911. \aftergroup \tabu@endrewritemulticolumn % after \@mkpream group
  912. \NC@list{\NC@do *}\tabu@textbar \tabu@lines
  913. \tabu@savedecl
  914. \tabu@privatecolumns
  915. \NC@list\expandafter{\the\expandafter\NC@list \tabu@NC@list}%
  916. \let\tabu@savels \relax
  917. \NC@find
  918. }% \tabu@rewritemulticolumn
  919. \def\tabu@endrewritemulticolumn{\gdef\tabu@mkpreambuffer{}\endgroup}
  920. \def\tabu@multicolumn{\tabu@ifenvir \tabu@multic@lumn \tabu@multicolumnORI}
  921. \long\def\tabu@multic@lumn #1#2#3{\multispan{#1}\begingroup
  922. \tabu@everyrowtrue
  923. \NC@list{\NC@do \tabu@rewritemulticolumn}%
  924. \expandafter\@gobbletwo % gobbles \multispan{#1}
  925. \tabu@multicolumnORI{#1}{\tabu@rewritemulticolumn #2}%
  926. {\iftabuscantokens \tabu@rescan \else \expandafter\@firstofone \fi
  927. {#3}}%
  928. }% \tabu@multic@lumn
  929. %% The X column(s): rewriting process -----------------------------
  930. \tabu@privatecolumntype X[1][]{\begingroup \tabu@siunitx{\endgroup \tabu@rewriteX {#1}}}
  931. \def\tabu@nosiunitx #1{#1{}{}\expandafter \NC@find \tabu@rewritten }
  932. \def\tabu@siunitx #1{\@ifnextchar \bgroup
  933. {\tabu@rewriteX@Ss{#1}}
  934. {\tabu@nosiunitx{#1}}}
  935. \def\tabu@rewriteX@Ss #1#2{\@temptokena{}%
  936. \@defaultunits \let\tabu@temp =#2\relax\@nnil
  937. \ifodd 1\ifx S\tabu@temp \else \ifx s\tabu@temp \else 0 \fi\fi
  938. \def\NC@find{\def\NC@find >####1####2<####3\relax{#1 {####1}{####3}%
  939. }\expandafter\NC@find \the\@temptokena \relax
  940. }\expandafter\NC@rewrite@S \@gobble #2\relax
  941. \else \tabu@siunitxerror
  942. \fi
  943. \expandafter \NC@find \tabu@rewritten
  944. }% \tabu@rewriteX@Ss
  945. \def\tabu@siunitxerror {\PackageError{tabu}{Not a S nor s column !
  946. \MessageBreak X column can only embed siunitx S or s columns}\@ehd
  947. }% \tabu@siunitxerror
  948. \def\tabu@rewriteX #1#2#3{\tabu@Xarg {#1}{#2}{#3}%
  949. \iftabu@measuring
  950. \else \tabu@measuringtrue % first X column found in the preamble
  951. \let\@halignto \relax \let\tabu@halignto \relax
  952. \iftabu@spread \tabu@spreadtarget \tabu@target \tabu@target \z@
  953. \else \tabu@spreadtarget \z@ \fi
  954. \ifdim \tabu@target=\z@
  955. \setlength\tabu@target \tabu@thetarget
  956. \tabu@message{\tabu@message@defaulttarget}%
  957. \else \tabu@message{\tabu@message@target}\fi
  958. \fi
  959. }% \tabu@rewriteX
  960. \def\tabu@rewriteXrestore #1#2#3{\let\@halignto \relax
  961. \def\tabu@rewritten{l}}
  962. \def\tabu@Xarg #1#2#3{%
  963. \advance\tabu@Xcol \@ne \let\tabu@Xlcr \@empty
  964. \let\tabu@Xdisp \@empty \let\tabu@Xmath \@empty
  965. \ifx\\#1\\% <shortcut when no option>
  966. \def\tabu@rewritten{p}\tabucolX \p@ % <default coef = 1>
  967. \else
  968. \let\tabu@rewritten \@empty \let\tabu@temp \@empty \tabucolX \z@
  969. \tabu@Xparse {}#1\relax
  970. \fi
  971. \tabu@Xrewritten{#2}{#3}%
  972. }% \tabu@Xarg
  973. \def\tabu@Xparse #1{\futurelet\@let@token \tabu@Xtest}
  974. \expandafter\def\expandafter\tabu@Xparsespace\space{\tabu@Xparse{}}
  975. \def\tabu@Xtest{%
  976. \ifcase \ifx \relax\@let@token \z@ \else
  977. \if ,\@let@token \m@ne\else
  978. \if p\@let@token 1\else
  979. \if m\@let@token 2\else
  980. \if b\@let@token 3\else
  981. \if l\@let@token 4\else
  982. \if c\@let@token 5\else
  983. \if r\@let@token 6\else
  984. \if j\@let@token 7\else
  985. \if L\@let@token 8\else
  986. \if C\@let@token 9\else
  987. \if R\@let@token 10\else
  988. \if J\@let@token 11\else
  989. \ifx \@sptoken\@let@token 12\else
  990. \if .\@let@token 13\else
  991. \if -\@let@token 13\else
  992. \ifcat $\@let@token 14\else
  993. 15\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax
  994. \or \tabu@Xtype {p}%
  995. \or \tabu@Xtype {m}%
  996. \or \tabu@Xtype {b}%
  997. \or \tabu@Xalign \raggedright\relax
  998. \or \tabu@Xalign \centering\relax
  999. \or \tabu@Xalign \raggedleft\relax
  1000. \or \tabu@Xalign \tabu@justify\relax
  1001. \or \tabu@Xalign \RaggedRight\raggedright
  1002. \or \tabu@Xalign \Centering\centering
  1003. \or \tabu@Xalign \RaggedLeft\raggedleft
  1004. \or \tabu@Xalign \justifying\tabu@justify
  1005. \or \expandafter \tabu@Xparsespace
  1006. \or \expandafter \tabu@Xcoef
  1007. \or \expandafter \tabu@Xm@th
  1008. \or \tabu@Xcoef{}%
  1009. \else\expandafter \tabu@Xparse
  1010. \fi
  1011. }% \tabu@Xtest
  1012. \def\tabu@Xalign #1#2{%
  1013. \ifx \tabu@Xlcr\@empty \else \PackageWarning{tabu}
  1014. {Duplicate horizontal alignment specification}\fi
  1015. \ifdefined#1\def\tabu@Xlcr{#1}\let#1\relax
  1016. \else \def\tabu@Xlcr{#2}\let#2\relax\fi
  1017. \expandafter\tabu@Xparse
  1018. }% \tabu@Xalign
  1019. \def\tabu@Xtype #1{%
  1020. \ifx \tabu@rewritten\@empty \else \PackageWarning{tabu}
  1021. {Duplicate vertical alignment specification}\fi
  1022. \def\tabu@rewritten{#1}\expandafter\tabu@Xparse
  1023. }% \tabu@Xtype
  1024. \def\tabu@Xcoef#1{\edef\tabu@temp{\tabu@temp#1}%
  1025. \afterassignment\tabu@Xc@ef \tabu@cnt\number\if-#10\fi
  1026. }% \tabu@Xcoef
  1027. \def\tabu@Xc@ef{\advance\tabucolX \tabu@temp\the\tabu@cnt\p@
  1028. \tabu@Xparse{}%
  1029. }% \tabu@Xc@ef
  1030. \def\tabu@Xm@th #1{\futurelet \@let@token \tabu@Xd@sp}
  1031. \def\tabu@Xd@sp{\let\tabu@Xmath=$%
  1032. \ifx $\@let@token \def\tabu@Xdisp{\displaystyle}%
  1033. \expandafter\tabu@Xparse
  1034. \else \expandafter\tabu@Xparse\expandafter{\expandafter}%
  1035. \fi
  1036. }% \tabu@Xd@sp
  1037. \def\tabu@Xrewritten {%
  1038. \ifx \tabu@rewritten\@empty \def\tabu@rewritten{p}\fi
  1039. \ifdim \tabucolX<\z@ \tabu@negcoeftrue
  1040. \else\ifdim \tabucolX=\z@ \tabucolX \p@
  1041. \fi\fi
  1042. \edef\tabu@temp{{\the\tabu@Xcol}{\tabu@strippt\tabucolX}}%
  1043. \edef\tabu@Xcoefs{\tabu@Xcoefs \tabu@ \tabu@temp}%
  1044. \edef\tabu@rewritten ##1##2{\def\noexpand\tabu@rewritten{%
  1045. >{\tabu@Xlcr \ifx$\tabu@Xmath$\tabu@Xdisp\fi ##1}%
  1046. \tabu@rewritten {\tabu@hsize \tabu@temp}%
  1047. <{##2\ifx$\tabu@Xmath$\fi}}%
  1048. }\tabu@rewritten
  1049. }% \tabu@Xrewritten
  1050. \def\tabu@hsize #1#2{%
  1051. \ifdim #2\p@<\z@
  1052. \ifdim \tabucolX=\maxdimen \tabu@wd{#1}\else
  1053. \ifdim \tabu@wd{#1}<-#2\tabucolX \tabu@wd{#1}\else -#2\tabucolX\fi
  1054. \fi
  1055. \else #2\tabucolX
  1056. \fi
  1057. }% \tabu@hsize
  1058. %% \usetabu and \preamble: rewriting process ---------------------
  1059. \tabu@privatecolumntype \usetabu [1]{%
  1060. \ifx\\#1\\\tabu@saveerr{}\else
  1061. \@ifundefined{tabu@saved@\string#1}
  1062. {\tabu@saveerr{#1}}
  1063. {\let\tabu@rewriteX \tabu@rewriteXrestore
  1064. \csname tabu@saved@\string#1\expandafter\endcsname\expandafter\@ne}%
  1065. \fi
  1066. }% \NC@rewrite@\usetabu
  1067. \tabu@privatecolumntype \preamble [1]{%
  1068. \ifx\\#1\\\tabu@saveerr{}\else
  1069. \@ifundefined{tabu@saved@\string#1}
  1070. {\tabu@saveerr{#1}}
  1071. {\csname tabu@saved@\string#1\expandafter\endcsname\expandafter\z@}%
  1072. \fi
  1073. }% \NC@rewrite@\preamble
  1074. %% Controlling the rewriting process -------------------------------
  1075. \tabu@newcolumntype \tabu@rewritefirst{%
  1076. \iftabu@long \aftergroup \tabu@longpream % <the whole implementation is here !>
  1077. \else \aftergroup \tabu@pream
  1078. \fi
  1079. \let\tabu@ \relax \let\tabu@hsize \relax
  1080. \let\tabu@Xcoefs \@empty \let\tabu@savels \relax
  1081. \tabu@Xcol \z@ \tabu@cnt \tw@
  1082. \gdef\tabu@mkpreambuffer{\tabu@{}}\tabu@measuringfalse
  1083. \global\setbox\@arstrutbox \box\@arstrutbox
  1084. \NC@list{\NC@do *}\tabu@textbar \tabu@lines
  1085. \NC@list\expandafter{\the\NC@list \NC@do X}%
  1086. \iftabu@siunitx % <siunitx S and s columns>
  1087. \NC@list\expandafter{\the\NC@list \NC@do S\NC@do s}\fi
  1088. \NC@list\expandafter{\the\expandafter\NC@list \tabu@highprioritycolumns}%
  1089. \expandafter\def\expandafter\tabu@NC@list\expandafter{%
  1090. \the\expandafter\NC@list \tabu@NC@list}% % * | X S <original>
  1091. \NC@list\expandafter{\expandafter \NC@do \expandafter\usetabu
  1092. \expandafter \NC@do \expandafter\preamble
  1093. \the\NC@list \NC@do \tabu@rewritemiddle
  1094. \NC@do \tabu@rewritelast}%
  1095. \tabu@savedecl
  1096. \tabu@privatecolumns
  1097. \edef\tabu@prev{\the\@temptokena}\NC@find \tabu@rewritemiddle
  1098. }% NC@rewrite@\tabu@rewritefirst
  1099. \tabu@newcolumntype \tabu@rewritemiddle{%
  1100. \edef\tabu@temp{\the\@temptokena}\NC@find \tabu@rewritelast
  1101. }% \NC@rewrite@\tabu@rewritemiddle
  1102. \tabu@newcolumntype \tabu@rewritelast{%
  1103. \ifx \tabu@temp\tabu@prev \advance\tabu@cnt \m@ne
  1104. \NC@list\expandafter{\tabu@NC@list \NC@do \tabu@rewritemiddle
  1105. \NC@do \tabu@rewritelast}%
  1106. \else \let\tabu@prev\tabu@temp
  1107. \fi
  1108. \ifcase \tabu@cnt \expandafter\tabu@endrewrite
  1109. \else \expandafter\NC@find \expandafter\tabu@rewritemiddle
  1110. \fi
  1111. }% \NC@rewrite@\tabu@rewritelast
  1112. %% Choosing the strategy --------------------------------------------
  1113. \def\tabu@endrewrite {%
  1114. \let\tabu@temp \NC@find
  1115. \ifx \@arrayright\relax \let\@arrayright \@empty \fi
  1116. \count@=%
  1117. \ifx \@finalstrut\tabu@finalstrut \z@ % outer in mode 0 print
  1118. \iftabu@measuring
  1119. \xdef\tabu@mkpreambuffer{\tabu@mkpreambuffer
  1120. \tabu@target \csname tabu@\the\tabu@nested.T\endcsname
  1121. \tabucolX \csname tabu@\the\tabu@nested.X\endcsname
  1122. \edef\@halignto {\ifx\@arrayright\@empty to\tabu@target\fi}}%
  1123. \fi
  1124. \else\iftabu@measuring 4 % X columns
  1125. \xdef\tabu@mkpreambuffer{\tabu@{\tabu@mkpreambuffer
  1126. \tabu@target \the\tabu@target
  1127. \tabu@spreadtarget \the\tabu@spreadtarget}%
  1128. \def\noexpand\tabu@Xcoefs{\tabu@Xcoefs}%
  1129. \edef\tabu@halignto{\ifx \@arrayright\@empty to\tabu@target\fi}}%
  1130. \let\tabu@Xcoefs \relax
  1131. \else\ifcase\tabu@nested \thr@@ % outer, no X
  1132. \global\let\tabu@afterendpar \relax
  1133. \else \@ne % inner, no X, outer in mode 1 or 2
  1134. \fi
  1135. \ifdefined\tabu@usetabu
  1136. \else \ifdim\tabu@target=\z@
  1137. \else \let\tabu@temp \tabu@extracolsep
  1138. \fi\fi
  1139. \fi
  1140. \fi
  1141. \xdef\tabu@mkpreambuffer{\count@ \the\count@ \tabu@mkpreambuffer}%
  1142. \tabu@temp
  1143. }% \tabu@endrewrite
  1144. \def\tabu@extracolsep{\@defaultunits \expandafter\let
  1145. \expandafter\tabu@temp \expandafter=\the\@temptokena \relax\@nnil
  1146. \ifx \tabu@temp\@sptoken
  1147. \expandafter\tabu@gobblespace \expandafter\tabu@extracolsep
  1148. \else
  1149. \edef\tabu@temp{\noexpand\NC@find
  1150. \if |\noexpand\tabu@temp @%
  1151. \else\if !\noexpand\tabu@temp @%
  1152. \else !%
  1153. \fi\fi
  1154. {\noexpand\extracolsep\noexpand\@flushglue}}%
  1155. \fi
  1156. \tabu@temp
  1157. }% \tabu@extrac@lsep
  1158. %% Implementing the strategy ----------------------------------------
  1159. \long\def\tabu@pream #1\@preamble {%
  1160. \let\tabu@ \tabu@@ \tabu@mkpreambuffer \tabu@aftergroupcleanup
  1161. \NC@list\expandafter {\tabu@NC@list}% in case of nesting...
  1162. \ifdefined\tabu@usetabu \tabu@usetabu \tabu@target \z@ \fi
  1163. \let\tabu@savedpreamble \@preamble
  1164. \global\let\tabu@elapsedtime \relax
  1165. \tabu@thebody ={#1\tabu@aftergroupcleanup}%
  1166. \tabu@thebody =\expandafter{\the\expandafter\tabu@thebody
  1167. \@preamble}%
  1168. \edef\tabuthepreamble {\the\tabu@thebody}% ( no @ allowed for \scantokens )
  1169. \tabu@select
  1170. }% \tabu@pream
  1171. \long\def\tabu@longpream #1\LT@bchunk #2\LT@bchunk{%
  1172. \let\tabu@ \tabu@@ \tabu@mkpreambuffer \tabu@aftergroupcleanup
  1173. \NC@list\expandafter {\tabu@NC@list}% in case of nesting...
  1174. \let\tabu@savedpreamble \@preamble
  1175. \global\let\tabu@elapsedtime \relax
  1176. \tabu@thebody ={#1\LT@bchunk #2\tabu@aftergroupcleanup \LT@bchunk}%
  1177. \edef\tabuthepreamble {\the\tabu@thebody}% ( no @ allowed for \scantokens )
  1178. \tabu@select
  1179. }% \tabu@longpream
  1180. \def\tabu@select {%
  1181. \ifnum\tabu@nested>\z@ \tabuscantokensfalse \fi
  1182. \ifnum \count@=\@ne \iftabu@measuring \count@=\tw@ \fi\fi
  1183. \ifcase \count@
  1184. \global\let\tabu@elapsedtime \relax
  1185. \tabu@seteverycr
  1186. \expandafter \tabuthepreamble % vertical adjustment (inherited from outer)
  1187. \or % exit in vertical measure + struts per cell because no X and outer in mode 3
  1188. \tabu@evr{\tabu@verticalinit}\tabu@celllalign@def{\tabu@verticalmeasure}%
  1189. \def\tabu@cellralign{\tabu@verticalspacing}%
  1190. \tabu@seteverycr
  1191. \expandafter \tabuthepreamble
  1192. \or % exit without measure because no X and outer in mode 4
  1193. \tabu@evr{}\tabu@celllalign@def{}\let\tabu@cellralign \@empty
  1194. \tabu@seteverycr
  1195. \expandafter \tabuthepreamble
  1196. \else % needs trials
  1197. \tabu@evr{}\tabu@celllalign@def{}\let\tabu@cellralign \@empty
  1198. \tabu@savecounters
  1199. \expandafter \tabu@setstrategy
  1200. \fi
  1201. }% \tabu@select
  1202. \def\tabu@@ {\gdef\tabu@mkpreambuffer}
  1203. %% Protections to set up before trials ------------------------------
  1204. \def\tabu@setstrategy {\begingroup % <trials group>
  1205. \tabu@trialh@@k \tabu@cnt \z@ % number of trials
  1206. \hbadness \@M \let\hbadness \@tempcnta
  1207. \hfuzz \maxdimen \let\hfuzz \@tempdima
  1208. \let\write \tabu@nowrite\let\GenericError \tabu@GenericError
  1209. \let\savetabu \@gobble \let\tabudefaulttarget \linewidth
  1210. \let\@footnotetext \@gobble \let\@xfootnote \tabu@xfootnote
  1211. \let\color \tabu@nocolor\let\rowcolor \tabu@norowcolor
  1212. \let\tabu@aftergroupcleanup \relax % only after the last trial
  1213. \tabu@mkpreambuffer
  1214. \ifnum \count@>\thr@@ \let\@halignto \@empty \tabucolX@init
  1215. \def\tabu@lasttry{\m@ne\p@}\fi
  1216. \begingroup \iffalse{\fi \ifnum0=`}\fi
  1217. \toks@{}\def\tabu@stack{b}\iftabuscantokens \endlinechar=10 \obeyspaces \fi %
  1218. \tabu@collectbody \tabu@strategy %
  1219. }% \tabu@setstrategy
  1220. \def\tabu@savecounters{%
  1221. \def\@elt ##1{\csname c@##1\endcsname\the\csname c@##1\endcsname}%
  1222. \edef\tabu@clckpt {\begingroup \globaldefs=\@ne \cl@@ckpt \endgroup}\let\@elt \relax
  1223. }% \tabu@savecounters
  1224. \def\tabucolX@init {% \tabucolX <= \tabu@target / (sum coefs > 0)
  1225. \dimen@ \z@ \tabu@Xsum \z@ \tabucolX \z@ \let\tabu@ \tabu@Xinit \tabu@Xcoefs
  1226. \ifdim \dimen@>\z@
  1227. \@tempdima \dimexpr \tabu@target *\p@/\dimen@ + \tabu@hfuzz\relax
  1228. \ifdim \tabucolX<\@tempdima \tabucolX \@tempdima \fi
  1229. \fi
  1230. }% \tabucolX@init
  1231. \def\tabu@Xinit #1#2{\tabu@Xcol #1 \advance \tabu@Xsum
  1232. \ifdim #2\p@>\z@ #2\p@ \advance\dimen@ #2\p@
  1233. \else -#2\p@ \tabu@negcoeftrue
  1234. \@tempdima \dimexpr \tabu@target*\p@/\dimexpr-#2\p@\relax \relax
  1235. \ifdim \tabucolX<\@tempdima \tabucolX \@tempdima \fi
  1236. \tabu@wddef{#1}{0pt}%
  1237. \fi
  1238. }% \tabu@Xinit
  1239. %% Collecting the environment body ----------------------------------
  1240. \long\def\tabu@collectbody #1#2\end #3{%
  1241. \edef\tabu@stack{\tabu@pushbegins #2\begin\end\expandafter\@gobble\tabu@stack}%
  1242. \ifx \tabu@stack\@empty
  1243. \toks@\expandafter{\expandafter\tabu@thebody\expandafter{\the\toks@ #2}%
  1244. \def\tabu@end@envir{\end{#3}}%
  1245. \iftabuscantokens
  1246. \iftabu@long \def\tabu@endenvir {\end{#3}\tabu@gobbleX}%
  1247. \else \def\tabu@endenvir {\let\endarray \@empty
  1248. \end{#3}\tabu@gobbleX}%
  1249. \fi
  1250. \else \def\tabu@endenvir {\end{#3}}\fi}%
  1251. \let\tabu@collectbody \tabu@endofcollect
  1252. \else\def\tabu@temp{#3}%
  1253. \ifx \tabu@temp\@empty \toks@\expandafter{\the\toks@ #2\end }%
  1254. \else \ifx\tabu@temp\tabu@@spxiii \toks@\expandafter{\the\toks@ #2\end #3}%
  1255. \else \ifx\tabu@temp\tabu@X \toks@\expandafter{\the\toks@ #2\end #3}%
  1256. \else \toks@\expandafter{\the\toks@ #2\end{#3}}%
  1257. \fi\fi\fi
  1258. \fi
  1259. \tabu@collectbody{#1}%
  1260. }% \tabu@collectbody
  1261. \long\def\tabu@pushbegins#1\begin#2{\ifx\end#2\else b\expandafter\tabu@pushbegins\fi}%
  1262. \def\tabu@endofcollect #1{\ifnum0=`{}\fi
  1263. \expandafter\endgroup \the\toks@ #1%
  1264. }% \tabu@endofcollect
  1265. %% The trials: switching between strategies -------------------------
  1266. \def\tabu@strategy {\relax % stops \count@ assignment !
  1267. \ifcase\count@ % case 0 = print with vertical adjustment (outer is finished)
  1268. \expandafter \tabu@endoftrials
  1269. \or % case 1 = exit in vertical measure (outer in mode 3)
  1270. \expandafter\xdef\csname tabu@\the\tabu@nested.T\endcsname{\the\tabu@target}%
  1271. \expandafter\xdef\csname tabu@\the\tabu@nested.X\endcsname{\the\tabucolX}%
  1272. \expandafter \tabu@endoftrials
  1273. \or % case 2 = exit with a rule replacing the table (outer in mode 4)
  1274. \expandafter \tabu@quickend
  1275. \or % case 3 = outer is in mode 3 because of no X
  1276. \begingroup
  1277. \tabu@evr{\tabu@verticalinit}\tabu@celllalign@def{\tabu@verticalmeasure}%
  1278. \def\tabu@cellralign{\tabu@verticalspacing}%
  1279. \expandafter \tabu@measuring
  1280. \else % case 4 = horizontal measure
  1281. \begingroup
  1282. \global\let\tabu@elapsedtime \tabu@message@etime
  1283. \long\def\multicolumn##1##2##3{\multispan{##1}}%
  1284. \let\tabu@startpboxORI \@startpbox
  1285. \iftabu@spread
  1286. \def\tabu@naturalXmax {\z@}%
  1287. \let\tabu@naturalXmin \tabu@naturalXmax
  1288. \tabu@evr{\global\tabu@naturalX \z@}%
  1289. \let\@startpbox \tabu@startpboxmeasure
  1290. \else\iftabu@negcoef
  1291. \let\@startpbox \tabu@startpboxmeasure
  1292. \else \let\@startpbox \tabu@startpboxquick
  1293. \fi\fi
  1294. \expandafter \tabu@measuring
  1295. \fi
  1296. }% \tabu@strategy
  1297. \def\tabu@measuring{\expandafter \tabu@trial \expandafter
  1298. \count@ \the\count@ \tabu@endtrial
  1299. }% \tabu@measuring
  1300. \def\tabu@trial{\iftabu@long \tabu@longtrial \else \tabu@shorttrial \fi}
  1301. \def\tabu@shorttrial {\setbox\tabu@box \hbox\bgroup \tabu@seteverycr
  1302. \ifx \tabu@savecounters\relax \else
  1303. \let\tabu@savecounters \relax \tabu@clckpt \fi
  1304. $\iftabuscantokens \tabu@rescan \else \expandafter\@secondoftwo \fi
  1305. \expandafter{\expandafter \tabuthepreamble
  1306. \the\tabu@thebody
  1307. \csname tabu@adl@endtrial\endcsname
  1308. \endarray}$\egroup % got \tabu@box
  1309. }% \tabu@shorttrial
  1310. \def\tabu@longtrial {\setbox\tabu@box \hbox\bgroup \tabu@seteverycr
  1311. \ifx \tabu@savecounters\relax \else
  1312. \let\tabu@savecounters \relax \tabu@clckpt \fi
  1313. \iftabuscantokens \tabu@rescan \else \expandafter\@secondoftwo \fi
  1314. \expandafter{\expandafter \tabuthepreamble
  1315. \the\tabu@thebody
  1316. \tabuendlongtrial}\egroup % got \tabu@box
  1317. }% \tabu@longtrial
  1318. \def\tabuendlongtrial{% no @ allowed for \scantokens
  1319. \LT@echunk \global\setbox\@ne \hbox{\unhbox\@ne}\kern\wd\@ne
  1320. \LT@get@widths
  1321. }% \tabuendlongtrial
  1322. \def\tabu@adl@endtrial{% <arydshln in nested trials - problem for global column counters!>
  1323. \crcr \noalign{\global\adl@ncol \tabu@nbcols}}% anything global is crap, junky and fails !
  1324. \def\tabu@seteverycr {\tabu@reset
  1325. \everycr \expandafter{\the\everycr \tabu@everycr}%
  1326. \let\everycr \tabu@noeverycr % <for ialign>
  1327. }% \tabu@seteverycr
  1328. \def\tabu@noeverycr{{\aftergroup\tabu@restoreeverycr \afterassignment}\toks@}
  1329. \def\tabu@restoreeverycr {\let\everycr \tabu@@everycr}
  1330. \def\tabu@everycr {\iftabu@everyrow \noalign{\tabu@everyrow}\fi}
  1331. \def\tabu@endoftrials {%
  1332. \iftabuscantokens \expandafter\@firstoftwo
  1333. \else \expandafter\@secondoftwo
  1334. \fi
  1335. {\expandafter \tabu@closetrialsgroup \expandafter
  1336. \tabu@rescan \expandafter{%
  1337. \expandafter\tabuthepreamble
  1338. \the\expandafter\tabu@thebody
  1339. \iftabu@long \else \endarray \fi}}
  1340. {\expandafter\tabu@closetrialsgroup \expandafter
  1341. \tabuthepreamble
  1342. \the\tabu@thebody}%
  1343. \tabu@endenvir % Finish !
  1344. }% \tabu@endoftrials
  1345. \def\tabu@closetrialsgroup {%
  1346. \toks@\expandafter{\tabu@endenvir}%
  1347. \edef\tabu@bufferX{\endgroup
  1348. \tabucolX \the\tabucolX
  1349. \tabu@target \the\tabu@target
  1350. \tabu@cnt \the\tabu@cnt
  1351. \def\noexpand\tabu@endenvir{\the\toks@}%
  1352. %Quid de \@halignto = \tabu@halignto ??
  1353. }% \tabu@bufferX
  1354. \tabu@bufferX
  1355. \ifcase\tabu@nested % print out (outer in mode 0)
  1356. \global\tabu@cnt \tabu@cnt
  1357. \tabu@evr{\tabu@verticaldynamicadjustment}%
  1358. \tabu@celllalign@def{\everypar{}}\let\tabu@cellralign \@empty
  1359. \let\@finalstrut \tabu@finalstrut
  1360. \else % vertical measure of nested tabu
  1361. \tabu@evr{\tabu@verticalinit}%
  1362. \tabu@celllalign@def{\tabu@verticalmeasure}%
  1363. \def\tabu@cellralign{\tabu@verticalspacing}%
  1364. \fi
  1365. \tabu@clckpt \let\@halignto \tabu@halignto
  1366. \let\@halignto \@empty
  1367. \tabu@seteverycr
  1368. \ifdim \tabustrutrule>\z@ \ifnum\tabu@nested=\z@
  1369. \setbox\@arstrutbox \box\voidb@x % force \@arstrutbox to be rebuilt (visible struts)
  1370. \fi\fi
  1371. }% \tabu@closetrialsgroup
  1372. \def\tabu@quickend {\expandafter \endgroup \expandafter
  1373. \tabu@target \the\tabu@target \tabu@quickrule
  1374. \let\endarray \relax \tabu@endenvir
  1375. }% \tabu@quickend
  1376. \def\tabu@endtrial {\relax % stops \count@ assignment !
  1377. \ifcase \count@ \tabu@err % case 0 = impossible here
  1378. \or \tabu@err % case 1 = impossible here
  1379. \or \tabu@err % case 2 = impossible here
  1380. \or % case 3 = outer goes into mode 0
  1381. \def\tabu@bufferX{\endgroup}\count@ \z@
  1382. \else % case 4 = outer goes into mode 3
  1383. \iftabu@spread \tabu@spreadarith % inner into mode 1 (outer in mode 3)
  1384. \else \tabu@arith % or 2 (outer in mode 4)
  1385. \fi
  1386. \count@=%
  1387. \ifcase\tabu@nested \thr@@ % outer goes into mode 3
  1388. \else\iftabu@measuring \tw@ % outer is in mode 4
  1389. \else \@ne % outer is in mode 3
  1390. \fi\fi
  1391. \edef\tabu@bufferX{\endgroup
  1392. \tabucolX \the\tabucolX
  1393. \tabu@target \the\tabu@target}%
  1394. \fi
  1395. \expandafter \tabu@bufferX \expandafter
  1396. \count@ \the\count@ \tabu@strategy
  1397. }% \tabu@endtrial
  1398. \def\tabu@err{\errmessage{(tabu) Internal impossible error! (\count@=\the\count@)}}
  1399. %% The algorithms: compute the widths / stop or go on ---------------
  1400. \def\tabu@arithnegcoef {%
  1401. \@tempdima \z@ \dimen@ \z@ \let\tabu@ \tabu@arith@negcoef \tabu@Xcoefs
  1402. }% \tabu@arithnegcoef
  1403. \def\tabu@arith@negcoef #1#2{%
  1404. \ifdim #2\p@>\z@ \advance\dimen@ #2\p@ % saturated by definition
  1405. \advance\@tempdima #2\tabucolX
  1406. \else
  1407. \ifdim -#2\tabucolX <\tabu@wd{#1}% c_i X < natural width <= \tabu@target-> saturated
  1408. \advance\dimen@ -#2\p@
  1409. \advance\@tempdima -#2\tabucolX
  1410. \else
  1411. \advance\@tempdima \tabu@wd{#1}% natural width <= c_i X => neutralised
  1412. \ifdim \tabu@wd{#1}<\tabu@target \else % neutralised
  1413. \advance\dimen@ -#2\p@ % saturated (natural width = tabu@target)
  1414. \fi
  1415. \fi
  1416. \fi
  1417. }% \tabu@arith@negcoef
  1418. \def\tabu@givespace #1#2{% here \tabu@DELTA < \z@
  1419. \ifdim \@tempdima=\z@
  1420. \tabu@wddef{#1}{\the\dimexpr -\tabu@DELTA*\p@/\tabu@Xsum}%
  1421. \else
  1422. \tabu@wddef{#1}{\the\dimexpr \tabu@hsize{#1}{#2}
  1423. *(\p@ -\tabu@DELTA*\p@/\@tempdima)/\p@\relax}%
  1424. \fi
  1425. }% \tabu@givespace
  1426. \def\tabu@arith {\advance\tabu@cnt \@ne
  1427. \ifnum \tabu@cnt=\@ne \tabu@message{\tabu@titles}\fi
  1428. \tabu@arithnegcoef
  1429. \@tempdimb \dimexpr \wd\tabu@box -\@tempdima \relax % <incompressible material>
  1430. \tabu@DELTA = \dimexpr \wd\tabu@box - \tabu@target \relax
  1431. \tabu@message{\tabu@message@arith}%
  1432. \ifdim \tabu@DELTA <\tabu@hfuzz
  1433. \ifdim \tabu@DELTA<\z@ % wd (tabu)<\tabu@target ?
  1434. \let\tabu@ \tabu@givespace \tabu@Xcoefs
  1435. \advance\@tempdima \@tempdimb \advance\@tempdima -\tabu@DELTA % for message
  1436. \else % already converged: nothing to do but nearly impossible...
  1437. \fi
  1438. \tabucolX \maxdimen
  1439. \tabu@measuringfalse
  1440. \else % need for narrower X columns
  1441. \tabucolX =\dimexpr (\@tempdima -\tabu@DELTA) *\p@/\tabu@Xsum \relax
  1442. \tabu@measuringtrue
  1443. \@whilesw \iftabu@measuring\fi {%
  1444. \advance\tabu@cnt \@ne
  1445. \tabu@arithnegcoef
  1446. \tabu@DELTA =\dimexpr \@tempdima+\@tempdimb -\tabu@target \relax % always < 0 here
  1447. \tabu@message{\tabu@header
  1448. \tabu@msgalign \tabucolX { }{ }{ }{ }{ }\@@
  1449. \tabu@msgalign \@tempdima+\@tempdimb { }{ }{ }{ }{ }\@@
  1450. \tabu@msgalign \tabu@target { }{ }{ }{ }{ }\@@
  1451. \tabu@msgalign@PT \dimen@ { }{}{}{}{}{}{}\@@
  1452. \ifdim -\tabu@DELTA<\tabu@hfuzz \tabu@spaces target ok\else
  1453. \tabu@msgalign \dimexpr -\tabu@DELTA *\p@/\dimen@ {}{}{}{}{}\@@
  1454. \fi}%
  1455. \ifdim -\tabu@DELTA<\tabu@hfuzz
  1456. \advance\@tempdima \@tempdimb % for message
  1457. \tabu@measuringfalse
  1458. \else
  1459. \advance\tabucolX \dimexpr -\tabu@DELTA *\p@/\dimen@ \relax
  1460. \fi
  1461. }%
  1462. \fi
  1463. \tabu@message{\tabu@message@reached}%
  1464. \edef\tabu@bufferX{\endgroup \tabu@cnt \the\tabu@cnt
  1465. \tabucolX \the\tabucolX
  1466. \tabu@target \the\tabu@target}%
  1467. }% \tabu@arith
  1468. \def\tabu@spreadarith {%
  1469. \dimen@ \z@ \@tempdima \tabu@naturalXmax \let\tabu@ \tabu@spread@arith \tabu@Xcoefs
  1470. \edef\tabu@naturalXmin {\the\dimexpr\tabu@naturalXmin*\dimen@/\p@}%
  1471. \@tempdimc =\dimexpr \wd\tabu@box -\tabu@naturalXmax+\tabu@naturalXmin \relax
  1472. \iftabu@measuring
  1473. \tabu@target =\dimexpr \@tempdimc+\tabu@spreadtarget \relax
  1474. \edef\tabu@bufferX{\endgroup \tabucolX \the\tabucolX \tabu@target\the\tabu@target}%
  1475. \else
  1476. \tabu@message{\tabu@message@spreadarith}%
  1477. \ifdim \dimexpr \@tempdimc+\tabu@spreadtarget >\tabu@target
  1478. \tabu@message{(tabu) spread
  1479. \ifdim \@tempdimc>\tabu@target useless here: default target used%
  1480. \else too large: reduced to fit default target\fi.}%
  1481. \else
  1482. \tabu@target =\dimexpr \@tempdimc+\tabu@spreadtarget \relax
  1483. \tabu@message{(tabu) spread: New target set to \the\tabu@target^^J}%
  1484. \fi
  1485. \begingroup \let\tabu@wddef \@gobbletwo
  1486. \@tempdimb \@tempdima
  1487. \tabucolX@init
  1488. \tabu@arithnegcoef
  1489. \wd\tabu@box =\dimexpr \wd\tabu@box +\@tempdima-\@tempdimb \relax
  1490. \expandafter\endgroup \expandafter\tabucolX \the\tabucolX
  1491. \tabu@arith
  1492. \fi
  1493. }% \tabu@spreadarith
  1494. \def\tabu@spread@arith #1#2{%
  1495. \ifdim #2\p@>\z@ \advance\dimen@ #2\p@
  1496. \else \advance\@tempdima \tabu@wd{#1}\relax
  1497. \fi
  1498. }% \tabu@spread@arith
  1499. %% Reporting in the .log file ---------------------------------------
  1500. \def\tabu@message@defaulttarget{%
  1501. \ifnum\tabu@nested=\z@^^J(tabu) Default target:
  1502. \ifx\tabudefaulttarget\linewidth \string\linewidth
  1503. \ifdim \tabu@thetarget=\linewidth \else
  1504. -\the\dimexpr\linewidth-\tabu@thetarget\fi =
  1505. \else\ifx\tabudefaulttarget\linegoal\string\linegoal=
  1506. \fi\fi
  1507. \else (tabu) Default target (nested): \fi
  1508. \the\tabu@target \on@line
  1509. \ifnum\tabu@nested=\z@ , page \the\c@page\fi}
  1510. \def\tabu@message@target {^^J(tabu) Target specified:
  1511. \the\tabu@target \on@line, page \the\c@page}
  1512. \def\tabu@message@arith {\tabu@header
  1513. \tabu@msgalign \tabucolX { }{ }{ }{ }{ }\@@
  1514. \tabu@msgalign \wd\tabu@box { }{ }{ }{ }{ }\@@
  1515. \tabu@msgalign \tabu@target { }{ }{ }{ }{ }\@@
  1516. \tabu@msgalign@PT \dimen@ { }{}{}{}{}{}{}\@@
  1517. \ifdim \tabu@DELTA<\tabu@hfuzz giving space\else
  1518. \tabu@msgalign \dimexpr (\@tempdima-\tabu@DELTA) *\p@/\tabu@Xsum -\tabucolX {}{}{}{}{}\@@
  1519. \fi
  1520. }% \tabu@message@arith
  1521. \def\tabu@message@spreadarith {\tabu@spreadheader
  1522. \tabu@msgalign \tabu@spreadtarget { }{ }{ }{ }{}\@@
  1523. \tabu@msgalign \wd\tabu@box { }{ }{ }{ }{}\@@
  1524. \tabu@msgalign -\tabu@naturalXmax { }{}{}{}{}\@@
  1525. \tabu@msgalign \tabu@naturalXmin { }{ }{ }{ }{}\@@
  1526. \tabu@msgalign \ifdim \dimexpr\@tempdimc>\tabu@target \tabu@target
  1527. \else \@tempdimc+\tabu@spreadtarget \fi
  1528. {}{}{}{}{}\@@}
  1529. \def\tabu@message@negcoef #1#2{
  1530. \tabu@spaces\tabu@spaces\space * #1. X[\rem@pt#2]:
  1531. \space width = \tabu@wd {#1}
  1532. \expandafter\string\csname tabu@\the\tabu@nested.W\number#1\endcsname
  1533. \ifdim -\tabu@pt#2\tabucolX<\tabu@target
  1534. < \number-\rem@pt#2 X
  1535. = \the\dimexpr -\tabu@pt#2\tabucolX \relax
  1536. \else
  1537. <= \the\tabu@target\space < \number-\rem@pt#2 X\fi}
  1538. \def\tabu@message@reached{\tabu@header
  1539. ******* Reached Target:
  1540. hfuzz = \tabu@hfuzz\on@line\space *******}
  1541. \def\tabu@message@etime{\edef\tabu@stoptime{\the\pdfelapsedtime}%
  1542. \tabu@message{(tabu)\tabu@spaces Time elapsed during measure:
  1543. \the\numexpr(\tabu@stoptime-\tabu@starttime-32767)/65536\relax sec
  1544. \the\numexpr\numexpr(\tabu@stoptime-\tabu@starttime)
  1545. -\numexpr(\tabu@stoptime-\tabu@starttime-32767)/65536\relax*65536\relax
  1546. *1000/65536\relax ms \tabu@spaces(\the\tabu@cnt\space
  1547. cycle\ifnum\tabu@cnt>\@ne s\fi)^^J^^J}}
  1548. \def\tabu@message@verticalsp {%
  1549. \ifdim \@tempdima>\tabu@ht
  1550. \ifdim \@tempdimb>\tabu@dp
  1551. \expandafter\expandafter\expandafter\string\tabu@ht =
  1552. \tabu@msgalign \@tempdima { }{ }{ }{ }{ }\@@
  1553. \expandafter\expandafter\expandafter\string\tabu@dp =
  1554. \tabu@msgalign \@tempdimb { }{ }{ }{ }{ }\@@^^J%
  1555. \else
  1556. \expandafter\expandafter\expandafter\string\tabu@ht =
  1557. \tabu@msgalign \@tempdima { }{ }{ }{ }{ }\@@^^J%
  1558. \fi
  1559. \else\ifdim \@tempdimb>\tabu@dp
  1560. \tabu@spaces\tabu@spaces\tabu@spaces
  1561. \expandafter\expandafter\expandafter\string\tabu@dp =
  1562. \tabu@msgalign \@tempdimb { }{ }{ }{ }{ }\@@^^J\fi
  1563. \fi
  1564. }% \tabu@message@verticalsp
  1565. \edef\tabu@spaces{\@spaces}
  1566. \def\tabu@strippt{\expandafter\tabu@pt\the}
  1567. {\@makeother\P \@makeother\T\lowercase{\gdef\tabu@pt #1PT{#1}}}
  1568. \def\tabu@msgalign{\expandafter\tabu@msg@align\the\dimexpr}
  1569. \def\tabu@msgalign@PT{\expandafter\tabu@msg@align\romannumeral-`\0\tabu@strippt}
  1570. \def\do #1{%
  1571. \def\tabu@msg@align##1.##2##3##4##5##6##7##8##9\@@{%
  1572. \ifnum##1<10 #1 #1\else
  1573. \ifnum##1<100 #1 \else
  1574. \ifnum##1<\@m #1\fi\fi\fi
  1575. ##1.##2##3##4##5##6##7##8#1}%
  1576. \def\tabu@header{(tabu) \ifnum\tabu@cnt<10 #1\fi\the\tabu@cnt) }%
  1577. \def\tabu@titles{\ifnum \tabu@nested=\z@
  1578. (tabu) Try#1 #1 tabu X #1 #1 #1tabu Width #1 #1 Target
  1579. #1 #1 #1 Coefs #1 #1 #1 Update^^J\fi}%
  1580. \def\tabu@spreadheader{%
  1581. (tabu) Try#1 #1 Spread #1 #1 tabu Width #1 #1 #1 Nat. X #1 #1 #1 #1Nat. Min.
  1582. #1 New Target^^J%
  1583. (tabu) sprd}
  1584. \def\tabu@message@save {\begingroup
  1585. \def\x ####1{\tabu@msg@align ####1{ }{ }{ }{ }{}\@@}
  1586. \def\z ####1{\expandafter\x\expandafter{\romannumeral-`\0\tabu@strippt
  1587. \dimexpr####1\p@{ }{ }}}%
  1588. \let\color \relax \def\tabu@rulesstyle ####1####2{\detokenize{####1}}%
  1589. \let\CT@arc@ \relax \let\@preamble \@gobble
  1590. \let\tabu@savedpream \@firstofone
  1591. \let\tabu@savedparams \@firstofone
  1592. \def\tabu@target ####1\relax {(tabu) target #1 #1 #1 #1 #1 = \x{####1}^^J}%
  1593. \def\tabucolX ####1\relax {(tabu) X columns width#1 = \x{####1}^^J}%
  1594. \def\tabu@nbcols ####1\relax {(tabu) Number of columns: \z{####1}^^J}%
  1595. \def\tabu@aligndefault ####1{(tabu) Default alignment: #1 #1 ####1^^J}%
  1596. \def\col@sep ####1\relax {(tabu) column sep #1 #1 #1 = \x{####1}^^J}%
  1597. \def\arrayrulewidth ####1\relax{(tabu) arrayrulewidth #1 = \x{####1}}%
  1598. \def\doublerulesep ####1\relax { doublerulesep = \x{####1}^^J}%
  1599. \def\extratabsurround####1\relax{(tabu) extratabsurround = \x{####1}^^J}%
  1600. \def\extrarowheight ####1\relax{(tabu) extrarowheight #1 = \x{####1}}%
  1601. \def\extrarowdepth ####1\relax {extrarowdepth = \x{####1}^^J}%
  1602. \def\abovetabulinesep####1\relax{(tabu) abovetabulinesep=\x{####1} }%
  1603. \def\belowtabulinesep####1\relax{ belowtabulinesep=\x{####1}^^J}%
  1604. \def\arraystretch ####1{(tabu) arraystretch #1 #1 = \z{####1}^^J}%
  1605. \def\minrowclearance####1\relax{(tabu) minrowclearance #1 = \x{####1}^^J}%
  1606. \def\tabu@arc@L ####1{(tabu) taburulecolor #1 #1 = ####1^^J}%
  1607. \def\tabu@drsc@L ####1{(tabu) tabudoublerulecolor= ####1^^J}%
  1608. \def\tabu@evr@L ####1{(tabu) everyrow #1 #1 #1 #1 = \detokenize{####1}^^J}%
  1609. \def\tabu@ls@L ####1{(tabu) line style = \detokenize{####1}^^J}%
  1610. \def\NC@find ####1\@nil{(tabu) tabu preamble#1 #1 = \detokenize{####1}^^J}%
  1611. \def\tabu@wddef####1####2{(tabu) Natural width ####1 = \x{####2}^^J}%
  1612. \let\edef \@gobbletwo \let\def \@empty \let\let \@gobbletwo
  1613. \tabu@message{%
  1614. (tabu) \string\savetabu{\tabu@temp}: \on@line^^J%
  1615. \tabu@usetabu \@nil^^J}%
  1616. \endgroup}
  1617. }\do{ }
  1618. %% Measuring the natural width (varwidth) - store the results -------
  1619. \def\tabu@startpboxmeasure #1{\bgroup % entering \vtop
  1620. \edef\tabu@temp{\expandafter\@secondoftwo \ifx\tabu@hsize #1\else\relax\fi}%
  1621. \ifodd 1\ifx \tabu@temp\@empty 0 \else % starts with \tabu@hsize ?
  1622. \iftabu@spread \else % if spread -> measure
  1623. \ifdim \tabu@temp\p@>\z@ 0 \fi\fi\fi% if coef>0 -> do not measure
  1624. \let\@startpbox \tabu@startpboxORI % restore immediately (nesting)
  1625. \tabu@measuringtrue % for the quick option...
  1626. \tabu@Xcol =\expandafter\@firstoftwo\ifx\tabu@hsize #1\fi
  1627. \ifdim \tabu@temp\p@>\z@ \ifdim \tabu@temp\tabucolX<\tabu@target
  1628. \tabu@target=\tabu@temp\tabucolX \fi\fi
  1629. \setbox\tabu@box \hbox \bgroup
  1630. \begin{varwidth}\tabu@target
  1631. \let\FV@ListProcessLine \tabu@FV@ListProcessLine % \hbox to natural width...
  1632. \narrowragged \arraybackslash \parfillskip \@flushglue
  1633. \ifdefined\pdfadjustspacing \pdfadjustspacing\z@ \fi
  1634. \bgroup \aftergroup\tabu@endpboxmeasure
  1635. \ifdefined \cellspacetoplimit \tabu@cellspacepatch \fi
  1636. \else \expandafter\@gobble
  1637. \tabu@startpboxquick{#1}% \@gobble \bgroup
  1638. \fi
  1639. }% \tabu@startpboxmeasure
  1640. \def\tabu@cellspacepatch{\def\bcolumn##1\@nil{}\let\ecolumn\@empty
  1641. \bgroup\color@begingroup}
  1642. \def\tabu@endpboxmeasure {%
  1643. \@finalstrut \@arstrutbox
  1644. \end{varwidth}\egroup % <got my \tabu@box>
  1645. \ifdim \tabu@temp\p@ <\z@ % neg coef
  1646. \ifdim \tabu@wd\tabu@Xcol <\wd\tabu@box
  1647. \tabu@wddef\tabu@Xcol {\the\wd\tabu@box}%
  1648. \tabu@debug{\tabu@message@endpboxmeasure}%
  1649. \fi
  1650. \else % spread coef>0
  1651. \global\advance \tabu@naturalX \wd\tabu@box
  1652. \@tempdima =\dimexpr \wd\tabu@box *\p@/\dimexpr \tabu@temp\p@\relax \relax
  1653. \ifdim \tabu@naturalXmax <\tabu@naturalX
  1654. \xdef\tabu@naturalXmax {\the\tabu@naturalX}\fi
  1655. \ifdim \tabu@naturalXmin <\@tempdima
  1656. \xdef\tabu@naturalXmin {\the\@tempdima}\fi
  1657. \fi
  1658. \box\tabu@box \egroup % end of \vtop (measure) restore \tabu@target
  1659. }% \tabu@endpboxmeasure
  1660. \def\tabu@wddef #1{\expandafter\xdef
  1661. \csname tabu@\the\tabu@nested.W\number#1\endcsname}
  1662. \def\tabu@wd #1{\csname tabu@\the\tabu@nested.W\number#1\endcsname}
  1663. \def\tabu@message@endpboxmeasure{\tabu@spaces\tabu@spaces<-> % <-> save natural wd
  1664. \the\tabu@Xcol. X[\tabu@temp]:
  1665. target = \the\tabucolX \space
  1666. \expandafter\expandafter\expandafter\string\tabu@wd\tabu@Xcol
  1667. =\tabu@wd\tabu@Xcol
  1668. }% \tabu@message@endpboxmeasure
  1669. \def\tabu@startpboxquick {\bgroup
  1670. \let\@startpbox \tabu@startpboxORI % restore immediately
  1671. \let\tabu \tabu@quick % \begin is expanded before...
  1672. \expandafter\@gobble \@startpbox % gobbles \bgroup
  1673. }% \tabu@startpboxquick
  1674. \def\tabu@quick {\begingroup \iffalse{\fi \ifnum0=`}\fi
  1675. \toks@{}\def\tabu@stack{b}\tabu@collectbody \tabu@endquick
  1676. }% \tabu@quick
  1677. \def\tabu@endquick {%
  1678. \ifodd 1\ifx\tabu@end@envir\tabu@endtabu \else
  1679. \ifx\tabu@end@envir\tabu@endtabus \else 0\fi\fi\relax
  1680. \endgroup
  1681. \else \let\endtabu \relax
  1682. \tabu@end@envir
  1683. \fi
  1684. }% \tabu@quick
  1685. \def\tabu@endtabu {\end{tabu}}
  1686. \def\tabu@endtabus {\end{tabu*}}
  1687. %% Measuring the heights and depths - store the results -------------
  1688. \def\tabu@verticalmeasure{\everypar{}%
  1689. \ifnum \currentgrouptype>12 % 14=semi-simple, 15=math shift group
  1690. \setbox\tabu@box =\hbox\bgroup
  1691. \let\tabu@verticalspacing \tabu@verticalsp@lcr
  1692. \d@llarbegin % after \hbox ...
  1693. \else
  1694. \edef\tabu@temp{\ifnum\currentgrouptype=5\vtop
  1695. \else\ifnum\currentgrouptype=12\vcenter
  1696. \else\vbox\fi\fi}%
  1697. \setbox\tabu@box \hbox\bgroup$\tabu@temp \bgroup
  1698. \let\tabu@verticalspacing \tabu@verticalsp@pmb
  1699. \fi
  1700. }% \tabu@verticalmeasure
  1701. \def\tabu@verticalsp@lcr{%
  1702. \d@llarend \egroup % <got my \tabu@box>
  1703. \@tempdima \dimexpr \ht\tabu@box+\abovetabulinesep
  1704. \@tempdimb \dimexpr \dp\tabu@box+\belowtabulinesep \relax
  1705. \ifdim\tabustrutrule>\z@ \tabu@debug{\tabu@message@verticalsp}\fi
  1706. \ifdim \tabu@ht<\@tempdima \tabu@htdef{\the\@tempdima}\fi
  1707. \ifdim \tabu@dp<\@tempdimb \tabu@dpdef{\the\@tempdimb}\fi
  1708. \noindent\vrule height\@tempdima depth\@tempdimb
  1709. }% \tabu@verticalsp@lcr
  1710. \def\tabu@verticalsp@pmb{% inserts struts as needed
  1711. \par \expandafter\egroup
  1712. \expandafter$\expandafter
  1713. \egroup \expandafter
  1714. \@tempdimc \the\prevdepth
  1715. \@tempdima \dimexpr \ht\tabu@box+\abovetabulinesep
  1716. \@tempdimb \dimexpr \dp\tabu@box+\belowtabulinesep \relax
  1717. \ifdim\tabustrutrule>\z@ \tabu@debug{\tabu@message@verticalsp}\fi
  1718. \ifdim \tabu@ht<\@tempdima \tabu@htdef{\the\@tempdima}\fi
  1719. \ifdim \tabu@dp<\@tempdimb \tabu@dpdef{\the\@tempdimb}\fi
  1720. \let\@finalstrut \@gobble
  1721. \hrule height\@tempdima depth\@tempdimb width\hsize
  1722. %% \box\tabu@box
  1723. }% \tabu@verticalsp@pmb
  1724. \def\tabu@verticalinit{%
  1725. \ifnum \c@taburow=\z@ \tabu@rearstrut \fi % after \tabu@reset !
  1726. \advance\c@taburow \@ne
  1727. \tabu@htdef{\the\ht\@arstrutbox}\tabu@dpdef{\the\dp\@arstrutbox}%
  1728. \advance\c@taburow \m@ne
  1729. }% \tabu@verticalinit
  1730. \def\tabu@htdef {\expandafter\xdef \csname tabu@\the\tabu@nested.H\the\c@taburow\endcsname}
  1731. \def\tabu@ht {\csname tabu@\the\tabu@nested.H\the\c@taburow\endcsname}
  1732. \def\tabu@dpdef {\expandafter\xdef \csname tabu@\the\tabu@nested.D\the\c@taburow\endcsname}
  1733. \def\tabu@dp {\csname tabu@\the\tabu@nested.D\the\c@taburow\endcsname}
  1734. \def\tabu@verticaldynamicadjustment {%
  1735. \advance\c@taburow \@ne
  1736. \extrarowheight \dimexpr\tabu@ht - \ht\strutbox
  1737. \extrarowdepth \dimexpr\tabu@dp - \dp\strutbox
  1738. \let\arraystretch \@empty
  1739. \advance\c@taburow \m@ne
  1740. }% \tabu@verticaldynamicadjustment
  1741. \def\tabuphantomline{\crcr \noalign{%
  1742. {\globaldefs \@ne
  1743. \setbox\@arstrutbox \box\voidb@x
  1744. \let\tabu@@celllalign \tabu@celllalign
  1745. \let\tabu@@cellralign \tabu@cellralign
  1746. \let\tabu@@cellleft \tabu@cellleft
  1747. \let\tabu@@cellright \tabu@cellright
  1748. \let\tabu@@thevline \tabu@thevline
  1749. \let\tabu@celllalign \@empty
  1750. \let\tabu@cellralign \@empty
  1751. \let\tabu@cellright \@empty
  1752. \let\tabu@cellleft \@empty
  1753. \let\tabu@thevline \relax}%
  1754. \edef\tabu@temp{\tabu@multispan \tabu@nbcols{\noindent &}}%
  1755. \toks@\expandafter{\tabu@temp \noindent\tabu@everyrowfalse \cr
  1756. \noalign{\tabu@rearstrut
  1757. {\globaldefs\@ne
  1758. \let\tabu@celllalign \tabu@@celllalign
  1759. \let\tabu@cellralign \tabu@@cellralign
  1760. \let\tabu@cellleft \tabu@@cellleft
  1761. \let\tabu@cellright \tabu@@cellright
  1762. \let\tabu@thevline \tabu@@thevline}}}%
  1763. \expandafter}\the\toks@
  1764. }% \tabuphantomline
  1765. %% \firsthline and \lasthline corrections ---------------------------
  1766. \def\tabu@firstline {\tabu@hlineAZ \tabu@firsthlinecorrection {}}
  1767. \def\tabu@firsthline{\tabu@hlineAZ \tabu@firsthlinecorrection \hline}
  1768. \def\tabu@lastline {\tabu@hlineAZ \tabu@lasthlinecorrection {}}
  1769. \def\tabu@lasthline {\tabu@hlineAZ \tabu@lasthlinecorrection \hline}
  1770. \def\tabu@hline {% replaces \hline if no colortbl (see \AtBeginDocument)
  1771. \noalign{\ifnum0=`}\fi
  1772. {\CT@arc@\hrule height\arrayrulewidth}%
  1773. \futurelet \tabu@temp \tabu@xhline
  1774. }% \tabu@hline
  1775. \def\tabu@xhline{%
  1776. \ifx \tabu@temp \hline
  1777. {\ifx \CT@drsc@\relax \vskip
  1778. \else\ifx \CT@drsc@\@empty \vskip
  1779. \else \CT@drsc@\hrule height
  1780. \fi\fi
  1781. \doublerulesep}%
  1782. \fi
  1783. \ifnum0=`{\fi}%
  1784. }% \tabu@xhline
  1785. \def\tabu@hlineAZ #1#2{\noalign{\ifnum0=`}\fi \dimen@ \z@ \count@ \z@
  1786. \toks@{}\def\tabu@hlinecorrection{#1}\def\tabu@temp{#2}%
  1787. \tabu@hlineAZsurround
  1788. }% \tabu@hlineAZ
  1789. \newcommand*\tabu@hlineAZsurround[1][\extratabsurround]{%
  1790. \extratabsurround #1\let\tabucline \tabucline@scan
  1791. \let\hline \tabu@hlinescan \let\firsthline \hline
  1792. \let\cline \tabu@clinescan \let\lasthline \hline
  1793. \expandafter \futurelet \expandafter \tabu@temp
  1794. \expandafter \tabu@nexthlineAZ \tabu@temp
  1795. }% \tabu@hlineAZsurround
  1796. \def\tabu@hlinescan {\tabu@thick \arrayrulewidth \tabu@xhlineAZ \hline}
  1797. \def\tabu@clinescan #1{\tabu@thick \arrayrulewidth \tabu@xhlineAZ {\cline{#1}}}
  1798. \def\tabucline@scan{\@testopt \tabucline@sc@n {}}
  1799. \def\tabucline@sc@n #1[#2]{\tabu@xhlineAZ {\tabucline[{#1}]{#2}}}
  1800. \def\tabu@nexthlineAZ{%
  1801. \ifx \tabu@temp\hline \else
  1802. \ifx \tabu@temp\cline \else
  1803. \ifx \tabu@temp\tabucline \else
  1804. \tabu@hlinecorrection
  1805. \fi\fi\fi
  1806. }% \tabu@nexthlineAZ
  1807. \def\tabu@xhlineAZ #1{%
  1808. \toks@\expandafter{\the\toks@ #1}%
  1809. \@tempdimc \tabu@thick % The last line width
  1810. \ifcase\count@ \@tempdimb \tabu@thick % The first line width
  1811. \else \advance\dimen@ \dimexpr \tabu@thick+\doublerulesep \relax
  1812. \fi
  1813. \advance\count@ \@ne \futurelet \tabu@temp \tabu@nexthlineAZ
  1814. }% \tabu@xhlineAZ
  1815. \def\tabu@firsthlinecorrection{% \count@ = number of \hline -1
  1816. \@tempdima \dimexpr \ht\@arstrutbox+\dimen@
  1817. \edef\firsthline{% <local in \noalign>
  1818. \omit \hbox to\z@{\hss{\noexpand\tabu@DBG{yellow}\vrule
  1819. height \the\dimexpr\@tempdima+\extratabsurround
  1820. depth \dp\@arstrutbox
  1821. width \tabustrutrule}\hss}\cr
  1822. \noalign{\vskip -\the\dimexpr \@tempdima+\@tempdimb
  1823. +\dp\@arstrutbox \relax}%
  1824. \the\toks@
  1825. }\ifnum0=`{\fi
  1826. \expandafter}\firsthline % we are then !
  1827. }% \tabu@firsthlinecorrection
  1828. \def\tabu@lasthlinecorrection{%
  1829. \@tempdima \dimexpr \dp\@arstrutbox+\dimen@+\@tempdimb+\@tempdimc
  1830. \edef\lasthline{% <local in \noalign>
  1831. \the\toks@
  1832. \noalign{\vskip -\the\dimexpr\dimen@+\@tempdimb+\dp\@arstrutbox}%
  1833. \omit \hbox to\z@{\hss{\noexpand\tabu@DBG{yellow}\vrule
  1834. depth \the\dimexpr \dp\@arstrutbox+\@tempdimb+\dimen@
  1835. +\extratabsurround-\@tempdimc
  1836. height \z@
  1837. width \tabustrutrule}\hss}\cr
  1838. }\ifnum0=`{\fi
  1839. \expandafter}\lasthline % we are then !
  1840. }% \tabu@lasthlinecorrection
  1841. \def\tabu@LT@@hline{%
  1842. \ifx\LT@next\hline
  1843. \global\let\LT@next \@gobble
  1844. \ifx \CT@drsc@\relax
  1845. \gdef\CT@LT@sep{%
  1846. \noalign{\penalty-\@medpenalty\vskip\doublerulesep}}%
  1847. \else
  1848. \gdef\CT@LT@sep{%
  1849. \multispan\LT@cols{%
  1850. \CT@drsc@\leaders\hrule\@height\doublerulesep\hfill}\cr}%
  1851. \fi
  1852. \else
  1853. \global\let\LT@next\empty
  1854. \gdef\CT@LT@sep{%
  1855. \noalign{\penalty-\@lowpenalty\vskip-\arrayrulewidth}}%
  1856. \fi
  1857. \ifnum0=`{\fi}%
  1858. \multispan\LT@cols
  1859. {\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill}\cr
  1860. \CT@LT@sep
  1861. \multispan\LT@cols
  1862. {\CT@arc@\leaders\hrule\@height\arrayrulewidth\hfill}\cr
  1863. \noalign{\penalty\@M}%
  1864. \LT@next
  1865. }% \tabu@LT@@hline
  1866. %% Horizontal lines : \tabucline ------------------------------------
  1867. \let\tabu@start \@tempcnta
  1868. \let\tabu@stop \@tempcntb
  1869. \newcommand*\tabucline{\noalign{\ifnum0=`}\fi \tabu@cline}
  1870. \newcommand*\tabu@cline[2][]{\tabu@startstop{#2}%
  1871. \ifnum \tabu@stop<\z@ \toks@{}%
  1872. \else \tabu@clinearg{#1}\tabu@thestyle
  1873. \edef\tabucline{\toks@{%
  1874. \ifnum \tabu@start>\z@ \omit
  1875. \tabu@multispan\tabu@start {\span\omit}&\fi
  1876. \omit \tabu@multispan\tabu@stop {\span\omit}%
  1877. \tabu@thehline\cr
  1878. }}\tabucline
  1879. \tabu@tracinglines{(tabu:tabucline) Style: #1^^J\the\toks@^^J^^J}%
  1880. \fi
  1881. \futurelet \tabu@temp \tabu@xcline
  1882. }% \tabu@cline
  1883. \def\tabu@clinearg #1{%
  1884. \ifx\\#1\\\let\tabu@thestyle \tabu@ls@
  1885. \else \@defaultunits \expandafter\let\expandafter\@tempa
  1886. \romannumeral-`\0#1\relax \@nnil
  1887. \ifx \hbox\@tempa \tabu@clinebox{#1}%
  1888. \else\ifx \box\@tempa \tabu@clinebox{#1}%
  1889. \else\ifx \vbox\@tempa \tabu@clinebox{#1}%
  1890. \else\ifx \vtop\@tempa \tabu@clinebox{#1}%
  1891. \else\ifx \copy\@tempa \tabu@clinebox{#1}%
  1892. \else\ifx \leaders\@tempa \tabu@clineleads{#1}%
  1893. \else\ifx \cleaders\@tempa \tabu@clineleads{#1}%
  1894. \else\ifx \xleaders\@tempa \tabu@clineleads{#1}%
  1895. \else\tabu@getline {#1}%
  1896. \fi\fi\fi\fi\fi\fi\fi\fi
  1897. \fi
  1898. }% \tabu@clinearg
  1899. \def\tabu@clinebox #1{\tabu@clineleads{\xleaders#1\hss}}
  1900. \def\tabu@clineleads #1{%
  1901. \let\tabu@thestyle \relax \let\tabu@leaders \@undefined
  1902. \gdef\tabu@thehrule{#1}}
  1903. \def\tabu@thehline{\begingroup
  1904. \ifdefined\tabu@leaders
  1905. \noexpand\tabu@thehleaders
  1906. \else \noexpand\tabu@thehrule
  1907. \fi \endgroup
  1908. }% \tabu@thehline
  1909. \def\tabu@xcline{%
  1910. \ifx \tabu@temp\tabucline
  1911. \toks@\expandafter{\the\toks@ \noalign
  1912. {\ifx\CT@drsc@\relax \vskip
  1913. \else \CT@drsc@\hrule height
  1914. \fi
  1915. \doublerulesep}}%
  1916. \fi
  1917. \tabu@docline
  1918. }% \tabu@xcline
  1919. \def\tabu@docline {\ifnum0=`{\fi \expandafter}\the\toks@}
  1920. \def\tabu@docline@evr {\xdef\tabu@doclineafter{\the\toks@}%
  1921. \ifnum0=`{\fi}\aftergroup\tabu@doclineafter}
  1922. \def\tabu@multispan #1#2{%
  1923. \ifnum\numexpr#1>\@ne #2\expandafter\tabu@multispan
  1924. \else \expandafter\@gobbletwo
  1925. \fi {#1-1}{#2}%
  1926. }% \tabu@multispan
  1927. \def\tabu@startstop #1{\tabu@start@stop #1\relax 1-\tabu@nbcols \@nnil}
  1928. \def\tabu@start@stop #1-#2\@nnil{%
  1929. \@defaultunits \tabu@start\number 0#1\relax \@nnil
  1930. \@defaultunits \tabu@stop \number 0#2\relax \@nnil
  1931. \tabu@stop \ifnum \tabu@start>\tabu@nbcols \m@ne
  1932. \else\ifnum \tabu@stop=\z@ \tabu@nbcols
  1933. \else\ifnum \tabu@stop>\tabu@nbcols \tabu@nbcols
  1934. \else \tabu@stop
  1935. \fi\fi\fi
  1936. \advance\tabu@start \m@ne
  1937. \ifnum \tabu@start>\z@ \advance\tabu@stop -\tabu@start \fi
  1938. }% \tabu@start@stop
  1939. %% Numbers: siunitx S columns (and \tabudecimal) -------------------
  1940. \def\tabu@tabudecimal #1{%
  1941. \def\tabu@decimal{#1}\@temptokena{}%
  1942. \let\tabu@getdecimal@ \tabu@getdecimal@ignorespaces
  1943. \tabu@scandecimal
  1944. }% \tabu@tabudecimal
  1945. \def\tabu@scandecimal{\futurelet \tabu@temp \tabu@getdecimal@}
  1946. \def\tabu@skipdecimal#1{#1\tabu@scandecimal}
  1947. \def\tabu@getdecimal@ignorespaces{%
  1948. \ifcase 0\ifx\tabu@temp\ignorespaces\else
  1949. \ifx\tabu@temp\@sptoken1\else
  1950. 2\fi\fi\relax
  1951. \let\tabu@getdecimal@ \tabu@getdecimal
  1952. \expandafter\tabu@skipdecimal
  1953. \or \expandafter\tabu@gobblespace\expandafter\tabu@scandecimal
  1954. \else \expandafter\tabu@skipdecimal
  1955. \fi
  1956. }% \tabu@getdecimal@ignorespaces
  1957. \def\tabu@get@decimal#1{\@temptokena\expandafter{\the\@temptokena #1}%
  1958. \tabu@scandecimal}
  1959. \def\do#1{%
  1960. \def\tabu@get@decimalspace#1{%
  1961. \@temptokena\expandafter{\the\@temptokena #1}\tabu@scandecimal}%
  1962. }\do{ }
  1963. \let\tabu@@tabudecimal \tabu@tabudecimal
  1964. \def\tabu@getdecimal{%
  1965. \ifcase 0\ifx 0\tabu@temp\else
  1966. \ifx 1\tabu@temp\else
  1967. \ifx 2\tabu@temp\else
  1968. \ifx 3\tabu@temp\else
  1969. \ifx 4\tabu@temp\else
  1970. \ifx 5\tabu@temp\else
  1971. \ifx 6\tabu@temp\else
  1972. \ifx 7\tabu@temp\else
  1973. \ifx 8\tabu@temp\else
  1974. \ifx 9\tabu@temp\else
  1975. \ifx .\tabu@temp\else
  1976. \ifx ,\tabu@temp\else
  1977. \ifx -\tabu@temp\else
  1978. \ifx +\tabu@temp\else
  1979. \ifx e\tabu@temp\else
  1980. \ifx E\tabu@temp\else
  1981. \ifx\tabu@cellleft\tabu@temp1\else
  1982. \ifx\ignorespaces\tabu@temp1\else
  1983. \ifx\@sptoken\tabu@temp2\else
  1984. 3\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\relax
  1985. \expandafter\tabu@get@decimal
  1986. \or \expandafter\tabu@skipdecimal
  1987. \or \expandafter\tabu@get@decimalspace
  1988. \else\expandafter\tabu@printdecimal
  1989. \fi
  1990. }% \tabu@getdecimal
  1991. \def\tabu@printdecimal{%
  1992. \edef\tabu@temp{\the\@temptokena}%
  1993. \ifx\tabu@temp\@empty\else
  1994. \ifx\tabu@temp\space\else
  1995. \expandafter\tabu@decimal\expandafter{\the\@temptokena}%
  1996. \fi\fi
  1997. }% \tabu@printdecimal
  1998. %% Verbatim inside X columns ----------------------------------------
  1999. \def\tabu@verbatim{%
  2000. \let\verb \tabu@verb
  2001. \let\FV@DefineCheckEnd \tabu@FV@DefineCheckEnd
  2002. }% \tabu@verbatim
  2003. \let\tabu@ltx@verb \verb
  2004. \def\tabu@verb{\@ifstar {\tabu@ltx@verb*} \tabu@ltx@verb}
  2005. \def\tabu@fancyvrb {%
  2006. \def\tabu@FV@DefineCheckEnd ##1{%
  2007. \def\tabu@FV@DefineCheckEnd{%
  2008. ##1% <original definition (if fancyvrb is loaded)>
  2009. \let\FV@CheckEnd \tabu@FV@CheckEnd
  2010. \let\FV@@CheckEnd \tabu@FV@@CheckEnd
  2011. \let\FV@@@CheckEnd \tabu@FV@@@CheckEnd
  2012. \edef\FV@EndScanning{%
  2013. \def\noexpand\next{\noexpand\end{\FV@EnvironName}}%
  2014. \global\let\noexpand\FV@EnvironName\relax
  2015. \noexpand\next}%
  2016. \xdef\FV@EnvironName{\detokenize\expandafter{\FV@EnvironName}}}%
  2017. }\expandafter\tabu@FV@DefineCheckEnd\expandafter{\FV@DefineCheckEnd}
  2018. }% \tabu@fancyvrb
  2019. \def\tabu@FV@CheckEnd #1{\expandafter\FV@@CheckEnd \detokenize{#1\end{}}\@nil}
  2020. \edef\tabu@FV@@@CheckEnd {\detokenize{\end{}}}
  2021. \begingroup
  2022. \catcode`\[1 \catcode`\]2
  2023. \@makeother\{ \@makeother\}
  2024. \edef\x[\endgroup
  2025. \def\noexpand\tabu@FV@@CheckEnd ##1\detokenize[\end{]##2\detokenize[}]##3%
  2026. ]\x \@nil{\def\@tempa{#2}\def\@tempb{#3}}
  2027. \def\tabu@FV@ListProcessLine #1{%
  2028. \hbox {%to \hsize{%
  2029. \kern\leftmargin
  2030. \hbox {%to \linewidth{%
  2031. \FV@LeftListNumber
  2032. \FV@LeftListFrame
  2033. \FancyVerbFormatLine{#1}\hss
  2034. %% DG/SR modification begin - Jan. 28, 1998 (for numbers=right add-on)
  2035. %% \FV@RightListFrame}%
  2036. \FV@RightListFrame
  2037. \FV@RightListNumber}%
  2038. %% DG/SR modification end
  2039. \hss}}
  2040. %% \savetabu --------------------------------------------------------
  2041. \newcommand*\savetabu[1]{\noalign{%
  2042. \tabu@sanitizearg{#1}\tabu@temp
  2043. \ifx \tabu@temp\@empty \tabu@savewarn{}{The tabu will not be saved}\else
  2044. \@ifundefined{tabu@saved@\tabu@temp}{}{\tabu@savewarn{#1}{Overwriting}}%
  2045. \ifdefined\tabu@restored \expandafter\let
  2046. \csname tabu@saved@\tabu@temp \endcsname \tabu@restored
  2047. \else {\tabu@save}%
  2048. \fi
  2049. \fi}%
  2050. }% \savetabu
  2051. \def\tabu@save {%
  2052. \toks0\expandafter{\tabu@saved@}%
  2053. \iftabu@negcoef
  2054. \let\tabu@wddef \relax \let\tabu@ \tabu@savewd \edef\tabu@savewd{\tabu@Xcoefs}%
  2055. \toks0\expandafter{\the\toks\expandafter0\tabu@savewd}\fi
  2056. \toks1\expandafter{\tabu@savedpream}%
  2057. \toks2\expandafter{\tabu@savedpreamble}%
  2058. \let\@preamble \relax
  2059. \let\tabu@savedpream \relax \let\tabu@savedparams \relax
  2060. \edef\tabu@preamble{%
  2061. \def\noexpand\tabu@aligndefault{\tabu@align}%
  2062. \def\tabu@savedparams {\noexpand\the\toks0}%
  2063. \def\tabu@savedpream {\noexpand\the\toks1}}%
  2064. \edef\tabu@usetabu{%
  2065. \def\@preamble {\noexpand\the\toks2}%
  2066. \tabu@target \the\tabu@target \relax
  2067. \tabucolX \the\tabucolX \relax
  2068. \tabu@nbcols \the\tabu@nbcols \relax
  2069. \def\noexpand\tabu@aligndefault{\tabu@align}%
  2070. \def\tabu@savedparams {\noexpand\the\toks0}%
  2071. \def\tabu@savedpream {\noexpand\the\toks1}}%
  2072. \let\tabu@aligndefault \relax \let\@sharp \relax
  2073. \edef\@tempa{\noexpand\tabu@s@ved
  2074. {\tabu@usetabu}
  2075. {\tabu@preamble}
  2076. {\the\toks1}}\@tempa
  2077. \tabu@message@save
  2078. }% \tabu@save
  2079. \long\def\tabu@s@ved #1#2#3{%
  2080. \def\tabu@usetabu{#1}% <for \tabu@message@save>
  2081. \expandafter\gdef\csname tabu@saved@\tabu@temp\endcsname ##1{%
  2082. \ifodd ##1% \usetabu
  2083. \tabu@measuringfalse \tabu@spreadfalse % Just in case...
  2084. \gdef\tabu@usetabu {%
  2085. \ifdim \tabu@target>\z@ \tabu@warn@usetabu \fi
  2086. \global\let\tabu@usetabu \@undefined
  2087. \def\@halignto {to\tabu@target}%
  2088. #1%
  2089. \ifx \tabu@align\tabu@aligndefault@text
  2090. \ifnum \tabu@nested=\z@
  2091. \let\tabu@align \tabu@aligndefault \fi\fi}%
  2092. \else % \preamble
  2093. \gdef\tabu@preamble {%
  2094. \global\let\tabu@preamble \@undefined
  2095. #2%
  2096. \ifx \tabu@align\tabu@aligndefault@text
  2097. \ifnum \tabu@nested=\z@
  2098. \let\tabu@align \tabu@aligndefault \fi\fi}%
  2099. \fi
  2100. #3}%
  2101. }% \tabu@s@ved
  2102. \def\tabu@aligndefault@text {\tabu@aligndefault}%
  2103. \def\tabu@warn@usetabu {\PackageWarning{tabu}
  2104. {Specifying a target with \string\usetabu\space is useless
  2105. \MessageBreak The target cannot be changed!}}
  2106. \def\tabu@savewd #1#2{\ifdim #2\p@<\z@ \tabu@wddef{#1}{\tabu@wd{#1}}\fi}
  2107. \def\tabu@savewarn#1#2{\PackageInfo{tabu}
  2108. {User-name `#1' already used for \string\savetabu
  2109. \MessageBreak #2}}%
  2110. \def\tabu@saveerr#1{\PackageError{tabu}
  2111. {User-name `#1' is unknown for \string\usetabu
  2112. \MessageBreak I cannot restore an unknown preamble!}\@ehd}
  2113. %% \rowfont ---------------------------------------------------------
  2114. \newskip \tabu@cellskip
  2115. \def\tabu@rowfont{\ifdim \baselineskip=\z@\noalign\fi
  2116. {\ifnum0=`}\fi \tabu@row@font}
  2117. \newcommand*\tabu@row@font[2][]{%
  2118. \ifnum7=\currentgrouptype
  2119. \global\let\tabu@@cellleft \tabu@cellleft
  2120. \global\let\tabu@@cellright \tabu@cellright
  2121. \global\let\tabu@@celllalign \tabu@celllalign
  2122. \global\let\tabu@@cellralign \tabu@cellralign
  2123. \global\let\tabu@@rowfontreset\tabu@rowfontreset
  2124. \fi
  2125. \global\let\tabu@rowfontreset \tabu@rowfont@reset
  2126. \expandafter\gdef\expandafter\tabu@cellleft\expandafter{\tabu@cellleft #2}%
  2127. \ifcsname tabu@cell@#1\endcsname % row alignment
  2128. \csname tabu@cell@#1\endcsname \fi
  2129. \ifnum0=`{\fi}% end of group / noalign group
  2130. }% \rowfont
  2131. \def\tabu@ifcolorleavevmode #1{\let\color \tabu@leavevmodecolor #1\let\color\tabu@color}%
  2132. \def\tabu@rowfont@reset{%
  2133. \global\let\tabu@rowfontreset \tabu@@rowfontreset
  2134. \global\let\tabu@cellleft \tabu@@cellleft
  2135. \global\let\tabu@cellright \tabu@@cellright
  2136. \global\let\tabu@cellfont \@empty
  2137. \global\let\tabu@celllalign \tabu@@celllalign
  2138. \global\let\tabu@cellralign \tabu@@cellralign
  2139. }% \tabu@@rowfontreset
  2140. \let\tabu@rowfontreset \@empty % overwritten \AtBeginDocument if colortbl
  2141. %% \tabu@prepnext@tok -----------------------------------------------
  2142. \newif \iftabu@cellright
  2143. \def\tabu@prepnext@tok{%
  2144. \ifnum \count@<\z@ % <first initialisation>
  2145. \@tempcnta \@M % <not initialized by array.sty>
  2146. \tabu@nbcols\z@
  2147. \let\tabu@fornoopORI \@fornoop
  2148. \tabu@cellrightfalse
  2149. \else
  2150. \ifcase \numexpr \count@-\@tempcnta \relax % (case 0): prev. token is left
  2151. \advance \tabu@nbcols \@ne
  2152. \iftabu@cellright % before-previous token is right and is finished
  2153. \tabu@cellrightfalse % <only once>
  2154. \tabu@righttok
  2155. \fi
  2156. \tabu@lefttok
  2157. \or % (case 1) previous token is right
  2158. \tabu@cellrighttrue \let\@fornoop \tabu@lastnoop
  2159. \else % special column: do not change the token
  2160. \iftabu@cellright % before-previous token is right
  2161. \tabu@cellrightfalse
  2162. \tabu@righttok
  2163. \fi
  2164. \fi % \ifcase
  2165. \fi
  2166. \tabu@prepnext@tokORI
  2167. }% \tabu@prepnext@tok
  2168. \long\def\tabu@lastnoop#1\@@#2#3{\tabu@lastn@@p #2\@nextchar \in@\in@@}
  2169. \def\tabu@lastn@@p #1\@nextchar #2#3\in@@{%
  2170. \ifx \in@#2\else
  2171. \let\@fornoop \tabu@fornoopORI
  2172. \xdef\tabu@mkpreambuffer{\tabu@nbcols\the\tabu@nbcols \tabu@mkpreambuffer}%
  2173. \toks0\expandafter{\expandafter\tabu@everyrowtrue \the\toks0}%
  2174. \expandafter\prepnext@tok
  2175. \fi
  2176. }% \tabu@lastnoop
  2177. \def\tabu@righttok{%
  2178. \advance \count@ \m@ne
  2179. \toks\count@\expandafter {\the\toks\count@ \tabu@cellright \tabu@cellralign}%
  2180. \advance \count@ \@ne
  2181. }% \tabu@righttok
  2182. \def\tabu@lefttok{\toks\count@\expandafter{\expandafter\tabu@celllalign
  2183. \the\toks\count@ \tabu@cellleft}% after because of $
  2184. }% \tabu@lefttok
  2185. %% Neutralisation of glues ------------------------------------------
  2186. \let\tabu@cellleft \@empty
  2187. \let\tabu@cellright \@empty
  2188. \tabu@celllalign@def{\tabu@cellleft}%
  2189. \let\tabu@cellralign \@empty
  2190. \def\tabu@cell@align #1#2#3{%
  2191. \let\tabu@maybesiunitx \toks@ \tabu@celllalign
  2192. \global \expandafter \tabu@celllalign@def \expandafter {\the\toks@ #1}%
  2193. \toks@\expandafter{\tabu@cellralign #2}%
  2194. \xdef\tabu@cellralign{\the\toks@}%
  2195. \toks@\expandafter{\tabu@cellleft #3}%
  2196. \xdef\tabu@cellleft{\the\toks@}%
  2197. }% \tabu@cell@align
  2198. \def\tabu@cell@l{% force alignment to left
  2199. \tabu@cell@align
  2200. {\tabu@removehfil \raggedright \tabu@cellleft}% left
  2201. {\tabu@flush1\tabu@ignorehfil}% right
  2202. \raggedright
  2203. }% \tabu@cell@l
  2204. \def\tabu@cell@c{% force alignment to center
  2205. \tabu@cell@align
  2206. {\tabu@removehfil \centering \tabu@flush{.5}\tabu@cellleft}
  2207. {\tabu@flush{.5}\tabu@ignorehfil}
  2208. \centering
  2209. }% \tabu@cell@c
  2210. \def\tabu@cell@r{% force alignment to right
  2211. \tabu@cell@align
  2212. {\tabu@removehfil \raggedleft \tabu@flush1\tabu@cellleft}
  2213. \tabu@ignorehfil
  2214. \raggedleft
  2215. }% \tabu@cell@r
  2216. \def\tabu@cell@j{% force justification (for p, m, b columns)
  2217. \tabu@cell@align
  2218. {\tabu@justify\tabu@cellleft}
  2219. {}
  2220. \tabu@justify
  2221. }% \tabu@cell@j
  2222. \def\tabu@justify{%
  2223. \leftskip\z@skip \@rightskip\leftskip \rightskip\@rightskip
  2224. \parfillskip\@flushglue
  2225. }% \tabu@justify
  2226. %% ragged2e settings
  2227. \def\tabu@cell@L{% force alignment to left (ragged2e)
  2228. \tabu@cell@align
  2229. {\tabu@removehfil \RaggedRight \tabu@cellleft}
  2230. {\tabu@flush 1\tabu@ignorehfil}
  2231. \RaggedRight
  2232. }% \tabu@cell@L
  2233. \def\tabu@cell@C{% force alignment to center (ragged2e)
  2234. \tabu@cell@align
  2235. {\tabu@removehfil \Centering \tabu@flush{.5}\tabu@cellleft}
  2236. {\tabu@flush{.5}\tabu@ignorehfil}
  2237. \Centering
  2238. }% \tabu@cell@C
  2239. \def\tabu@cell@R{% force alignment to right (ragged2e)
  2240. \tabu@cell@align
  2241. {\tabu@removehfil \RaggedLeft \tabu@flush 1\tabu@cellleft}
  2242. \tabu@ignorehfil
  2243. \RaggedLeft
  2244. }% \tabu@cell@R
  2245. \def\tabu@cell@J{% force justification (ragged2e)
  2246. \tabu@cell@align
  2247. {\justifying \tabu@cellleft}
  2248. {}
  2249. \justifying
  2250. }% \tabu@cell@J
  2251. \def\tabu@flush#1{%
  2252. \iftabu@colortbl % colortbl uses \hfill rather than \hfil
  2253. \hskip \ifnum13<\currentgrouptype \stretch{#1}%
  2254. \else \ifdim#1pt<\p@ \tabu@cellskip
  2255. \else \stretch{#1}
  2256. \fi\fi \relax
  2257. \else % array.sty
  2258. \ifnum 13<\currentgrouptype
  2259. \hfil \hskip1sp \relax \fi
  2260. \fi
  2261. }% \tabu@flush
  2262. \let\tabu@hfil \hfil
  2263. \let\tabu@hfill \hfill
  2264. \let\tabu@hskip \hskip
  2265. \def\tabu@removehfil{%
  2266. \iftabu@colortbl
  2267. \unkern \tabu@cellskip =\lastskip
  2268. \ifnum\gluestretchorder\tabu@cellskip =\tw@ \hskip-\tabu@cellskip
  2269. \else \tabu@cellskip \z@skip
  2270. \fi
  2271. \else
  2272. \ifdim\lastskip=1sp\unskip\fi
  2273. \ifnum\gluestretchorder\lastskip =\@ne
  2274. \hfilneg % \hfilneg for array.sty but not for colortbl...
  2275. \fi
  2276. \fi
  2277. }% \tabu@removehfil
  2278. \def\tabu@ignorehfil{\aftergroup \tabu@nohfil}
  2279. \def\tabu@nohfil{% \hfil -> do nothing + restore original \hfil
  2280. \def\hfil{\let\hfil \tabu@hfil}% local to (alignment template) group
  2281. }% \tabu@nohfil
  2282. \def\tabu@colortblalignments {% if colortbl
  2283. \def\tabu@nohfil{%
  2284. \def\hfil {\let\hfil \tabu@hfil}% local to (alignment template) group
  2285. \def\hfill {\let\hfill \tabu@hfill}% (colortbl uses \hfill) pfff...
  2286. \def\hskip ####1\relax{\let\hskip \tabu@hskip}}% local
  2287. }% \tabu@colortblalignments
  2288. %% Taking care of footnotes and hyperfootnotes ----------------------
  2289. \long\def\tabu@footnotetext #1{%
  2290. \edef\@tempa{\the\tabu@footnotes
  2291. \noexpand\footnotetext [\the\csname c@\@mpfn\endcsname]}%
  2292. \global\tabu@footnotes\expandafter{\@tempa {#1}}}%
  2293. \long\def\tabu@xfootnotetext [#1]#2{%
  2294. \global\tabu@footnotes\expandafter{\the\tabu@footnotes
  2295. \footnotetext [{#1}]{#2}}}
  2296. \let\tabu@xfootnote \@xfootnote
  2297. \long\def\tabu@Hy@ftntext{\tabu@Hy@ftntxt {\the \c@footnote }}
  2298. \long\def\tabu@Hy@xfootnote [#1]{%
  2299. \begingroup
  2300. \value\@mpfn #1\relax
  2301. \protected@xdef \@thefnmark {\thempfn}%
  2302. \endgroup
  2303. \@footnotemark \tabu@Hy@ftntxt {#1}%
  2304. }% \tabu@Hy@xfootnote
  2305. \long\def\tabu@Hy@ftntxt #1#2{%
  2306. \edef\@tempa{%
  2307. \the\tabu@footnotes
  2308. \begingroup
  2309. \value\@mpfn #1\relax
  2310. \noexpand\protected@xdef\noexpand\@thefnmark {\noexpand\thempfn}%
  2311. \expandafter \noexpand \expandafter
  2312. \tabu@Hy@footnotetext \expandafter{\Hy@footnote@currentHref}%
  2313. }%
  2314. \global\tabu@footnotes\expandafter{\@tempa {#2}%
  2315. \endgroup}%
  2316. }% \tabu@Hy@ftntxt
  2317. \long\def\tabu@Hy@footnotetext #1#2{%
  2318. \H@@footnotetext{%
  2319. \ifHy@nesting
  2320. \hyper@@anchor {#1}{#2}%
  2321. \else
  2322. \Hy@raisedlink{%
  2323. \hyper@@anchor {#1}{\relax}%
  2324. }%
  2325. \def\@currentHref {#1}%
  2326. \let\@currentlabelname \@empty
  2327. #2%
  2328. \fi
  2329. }%
  2330. }% \tabu@Hy@footnotetext
  2331. %% No need for \arraybackslash ! ------------------------------------
  2332. \def\tabu@latextwoe {%
  2333. \def\tabu@temp##1##2##3{{\toks@\expandafter{##2##3}\xdef##1{\the\toks@}}}
  2334. \tabu@temp \tabu@centering \centering \arraybackslash
  2335. \tabu@temp \tabu@raggedleft \raggedleft \arraybackslash
  2336. \tabu@temp \tabu@raggedright \raggedright \arraybackslash
  2337. }% \tabu@latextwoe
  2338. \def\tabu@raggedtwoe {%
  2339. \def\tabu@temp ##1##2##3{{\toks@\expandafter{##2##3}\xdef##1{\the\toks@}}}
  2340. \tabu@temp \tabu@Centering \Centering \arraybackslash
  2341. \tabu@temp \tabu@RaggedLeft \RaggedLeft \arraybackslash
  2342. \tabu@temp \tabu@RaggedRight \RaggedRight \arraybackslash
  2343. \tabu@temp \tabu@justifying \justifying \arraybackslash
  2344. }% \tabu@raggedtwoe
  2345. \def\tabu@normalcrbackslash{\let\\\@normalcr}
  2346. \def\tabu@trivlist{\expandafter\def\expandafter\@trivlist\expandafter{%
  2347. \expandafter\tabu@normalcrbackslash \@trivlist}}
  2348. %% Utilities: \fbox \fcolorbox and \tabudecimal -------------------
  2349. \def\tabu@fbox {\leavevmode\afterassignment\tabu@beginfbox \setbox\@tempboxa\hbox}
  2350. \def\tabu@beginfbox {\bgroup \kern\fboxsep
  2351. \bgroup\aftergroup\tabu@endfbox}
  2352. \def\tabu@endfbox {\kern\fboxsep\egroup\egroup
  2353. \@frameb@x\relax}
  2354. \def\tabu@color@b@x #1#2{\leavevmode \bgroup
  2355. \def\tabu@docolor@b@x{#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}\box\z@}}%
  2356. \afterassignment\tabu@begincolor@b@x \setbox\z@ \hbox
  2357. }% \tabu@color@b@x
  2358. \def\tabu@begincolor@b@x {\kern\fboxsep \bgroup
  2359. \aftergroup\tabu@endcolor@b@x \set@color}
  2360. \def\tabu@endcolor@b@x {\kern\fboxsep \egroup
  2361. \dimen@\ht\z@ \advance\dimen@ \fboxsep \ht\z@ \dimen@
  2362. \dimen@\dp\z@ \advance\dimen@ \fboxsep \dp\z@ \dimen@
  2363. \tabu@docolor@b@x \egroup
  2364. }% \tabu@endcolor@b@x
  2365. %% Corrections (arydshln, delarray, colortbl) -----------------------
  2366. \def\tabu@fix@arrayright {%% \@arrayright is missing from \endarray
  2367. \iftabu@colortbl
  2368. \ifdefined\adl@array % <colortbl + arydshln>
  2369. \def\tabu@endarray{%
  2370. \adl@endarray \egroup \adl@arrayrestore \CT@end \egroup %<original>
  2371. \@arrayright % <FC>
  2372. \gdef\@preamble{}}% <FC>
  2373. \else % <colortbl / no arydshln>
  2374. \def\tabu@endarray{%
  2375. \crcr \egroup \egroup %<original>
  2376. \@arrayright % <FC>
  2377. \gdef\@preamble{}\CT@end}%
  2378. \fi
  2379. \else
  2380. \ifdefined\adl@array % <arydshln / no colortbl>
  2381. \def\tabu@endarray{%
  2382. \adl@endarray \egroup \adl@arrayrestore \egroup %<original>
  2383. \@arrayright % <FC>
  2384. \gdef\@preamble{}}% <FC>
  2385. \else % <no arydshln / no colotbl + \@arrayright missing>
  2386. \PackageWarning{tabu}
  2387. {\string\@arrayright\space is missing from the
  2388. \MessageBreak definition of \string\endarray.
  2389. \MessageBreak Compatibility with delarray.sty is broken.}%
  2390. \fi\fi
  2391. }% \tabu@fix@arrayright
  2392. \def\tabu@adl@xarraydashrule #1#2#3{%
  2393. \ifnum\@lastchclass=\adl@class@start\else
  2394. \ifnum\@lastchclass=\@ne\else
  2395. \ifnum\@lastchclass=5 \else % <FC> @-arg (class 5) and !-arg (class 1)
  2396. \adl@leftrulefalse \fi\fi % must be treated the same
  2397. \fi
  2398. \ifadl@zwvrule\else \ifadl@inactive\else
  2399. \@addtopreamble{\vrule\@width\arrayrulewidth
  2400. \@height\z@ \@depth\z@}\fi \fi
  2401. \ifadl@leftrule
  2402. \@addtopreamble{\adl@vlineL{\CT@arc@}{\adl@dashgapcolor}%
  2403. {\number#1}#3}%
  2404. \else \@addtopreamble{\adl@vlineR{\CT@arc@}{\adl@dashgapcolor}%
  2405. {\number#2}#3}
  2406. \fi
  2407. }% \tabu@adl@xarraydashrule
  2408. \def\tabu@adl@act@endpbox {%
  2409. \unskip \ifhmode \nobreak \fi \@finalstrut \@arstrutbox
  2410. \egroup \egroup
  2411. \adl@colhtdp \box\adl@box \hfil
  2412. }% \tabu@adl@act@endpbox
  2413. \def\tabu@adl@fix {%
  2414. \let\adl@xarraydashrule \tabu@adl@xarraydashrule % <fix> arydshln
  2415. \let\adl@act@endpbox \tabu@adl@act@endpbox % <fix> arydshln
  2416. \let\adl@act@@endpbox \tabu@adl@act@endpbox % <fix> arydshln
  2417. \let\@preamerror \@preamerr % <fix> arydshln
  2418. }% \tabu@adl@fix
  2419. %% Correction for longtable' \@startbox definition ------------------
  2420. %% => \everypar is ``missing'' : TeX should be in vertical mode
  2421. \def\tabu@LT@startpbox #1{%
  2422. \bgroup
  2423. \let\@footnotetext\LT@p@ftntext
  2424. \setlength\hsize{#1}%
  2425. \@arrayparboxrestore
  2426. \everypar{%
  2427. \vrule \@height \ht\@arstrutbox \@width \z@
  2428. \everypar{}}%
  2429. }% \tabu@LT@startpbox
  2430. %% \tracingtabu and the package options ------------------
  2431. \DeclareOption{delarray}{\AtEndOfPackage{\RequirePackage{delarray}}}
  2432. \DeclareOption{linegoal}{%
  2433. \AtEndOfPackage{%
  2434. \RequirePackage{linegoal}[2010/12/07]%
  2435. \let\tabudefaulttarget \linegoal% \linegoal is \linewidth if not pdfTeX
  2436. }}
  2437. \DeclareOption{scantokens}{\tabuscantokenstrue}
  2438. \DeclareOption{debugshow}{\AtEndOfPackage{\tracingtabu=\tw@}}
  2439. \def\tracingtabu {\begingroup\@ifnextchar=%
  2440. {\afterassignment\tabu@tracing\count@}
  2441. {\afterassignment\tabu@tracing\count@1\relax}}
  2442. \def\tabu@tracing{\expandafter\endgroup
  2443. \expandafter\tabu@tr@cing \the\count@ \relax
  2444. }% \tabu@tracing
  2445. \def\tabu@tr@cing #1\relax {%
  2446. \ifnum#1>\thr@@ \let\tabu@tracinglines\message
  2447. \else \let\tabu@tracinglines\@gobble
  2448. \fi
  2449. \ifnum#1>\tw@ \let\tabu@DBG \tabu@@DBG
  2450. \def\tabu@mkarstrut {\tabu@DBG@arstrut}%
  2451. \tabustrutrule 1.5\p@
  2452. \else \let\tabu@DBG \@gobble
  2453. \def\tabu@mkarstrut {\tabu@arstrut}%
  2454. \tabustrutrule \z@
  2455. \fi
  2456. \ifnum#1>\@ne \let\tabu@debug \message
  2457. \else \let\tabu@debug \@gobble
  2458. \fi
  2459. \ifnum#1>\z@
  2460. \let\tabu@message \message
  2461. \let\tabu@tracing@save \tabu@message@save
  2462. \let\tabu@starttimer \tabu@pdftimer
  2463. \else
  2464. \let\tabu@message \@gobble
  2465. \let\tabu@tracing@save \@gobble
  2466. \let\tabu@starttimer \relax
  2467. \fi
  2468. }% \tabu@tr@cing
  2469. %% Setup \AtBeginDocument
  2470. \AtBeginDocument{\tabu@AtBeginDocument}
  2471. \def\tabu@AtBeginDocument{\let\tabu@AtBeginDocument \@undefined
  2472. \ifdefined\arrayrulecolor \tabu@colortbltrue % <colortbl>
  2473. \tabu@colortblalignments % different glues are used
  2474. \else \tabu@colortblfalse \fi
  2475. \ifdefined\CT@arc@ \else \let\CT@arc@ \relax \fi
  2476. \ifdefined\CT@drsc@\else \let\CT@drsc@ \relax \fi
  2477. \let\tabu@arc@L \CT@arc@ \let\tabu@drsc@L \CT@drsc@
  2478. \ifodd 1\ifcsname siunitx_table_collect_begin:Nn\endcsname % <siunitx: ok>
  2479. \expandafter\ifx
  2480. \csname siunitx_table_collect_begin:Nn\endcsname\relax 0\fi\fi\relax
  2481. \tabu@siunitxtrue
  2482. \else \let\tabu@maybesiunitx \@firstofone % <not siunitx: setup>
  2483. \let\tabu@siunitx \tabu@nosiunitx
  2484. \tabu@siunitxfalse
  2485. \fi
  2486. \ifdefined\adl@array % <arydshln>
  2487. \else \let\tabu@adl@fix \relax
  2488. \let\tabu@adl@endtrial \@empty \fi
  2489. \ifdefined\longtable % <longtable>
  2490. \else \let\longtabu \tabu@nolongtabu \fi
  2491. \ifdefined\cellspacetoplimit \tabu@warn@cellspace\fi
  2492. \csname\ifcsname ifHy@hyperfootnotes\endcsname % <hyperfootnotes>
  2493. ifHy@hyperfootnotes\else iffalse\fi\endcsname
  2494. \let\tabu@footnotetext \tabu@Hy@ftntext
  2495. \let\tabu@xfootnote \tabu@Hy@xfootnote \fi
  2496. \ifdefined\FV@DefineCheckEnd% <fancyvrb>
  2497. \tabu@fancyvrb \fi
  2498. \ifdefined\color % <color / xcolor>
  2499. \let\tabu@color \color
  2500. \def\tabu@leavevmodecolor ##1{%
  2501. \def\tabu@leavevmodecolor {\leavevmode ##1}%
  2502. }\expandafter\tabu@leavevmodecolor\expandafter{\color}%
  2503. \else
  2504. \let\tabu@color \tabu@nocolor
  2505. \let\tabu@leavevmodecolor \@firstofone \fi
  2506. \tabu@latextwoe
  2507. \ifdefined\@raggedtwoe@everyselectfont % <ragged2e>
  2508. \tabu@raggedtwoe
  2509. \else
  2510. \let\tabu@cell@L \tabu@cell@l
  2511. \let\tabu@cell@R \tabu@cell@r
  2512. \let\tabu@cell@C \tabu@cell@c
  2513. \let\tabu@cell@J \tabu@cell@j \fi
  2514. \expandafter\in@ \expandafter\@arrayright \expandafter{\endarray}%
  2515. \ifin@ \let\tabu@endarray \endarray
  2516. \else \tabu@fix@arrayright \fi% <fix for colortbl & arydshln (delarray)>
  2517. \everyrow{}%
  2518. }% \tabu@AtBeginDocument
  2519. \def\tabu@warn@cellspace{%
  2520. \PackageWarning{tabu}{%
  2521. Package cellspace has some limitations
  2522. \MessageBreak And redefines some macros of array.sty.
  2523. \MessageBreak Please use \string\tabulinesep\space to control
  2524. \MessageBreak vertical spacing of lines inside tabu environment}%
  2525. }% \tabu@warn@cellspace
  2526. %% tabu Package initialisation
  2527. \tabuscantokensfalse
  2528. \let\tabu@arc@G \relax
  2529. \let\tabu@drsc@G \relax
  2530. \let\tabu@evr@G \@empty
  2531. \let\tabu@rc@G \@empty
  2532. \def\tabu@ls@G {\tabu@linestyle@}%
  2533. \let\tabu@@rowfontreset \@empty % <init>
  2534. \let\tabu@@celllalign \@empty
  2535. \let\tabu@@cellralign \@empty
  2536. \let\tabu@@cellleft \@empty
  2537. \let\tabu@@cellright \@empty
  2538. \def\tabu@naturalXmin {\z@}
  2539. \def\tabu@naturalXmax {\z@}
  2540. \let\tabu@rowfontreset \@empty
  2541. \def\tabulineon {4pt}\let\tabulineoff \tabulineon
  2542. \tabu@everyrowtrue
  2543. \ifdefined\pdfelapsedtime % <pdfTeX>
  2544. \def\tabu@pdftimer {\xdef\tabu@starttime{\the\pdfelapsedtime}}%
  2545. \else \let\tabu@pdftimer \relax \let\tabu@message@etime \relax
  2546. \fi
  2547. \tracingtabu=\z@
  2548. \newtabulinestyle {=\maxdimen}% creates the 'factory' settings \tabu@linestyle@
  2549. \tabulinestyle{}
  2550. \taburowcolors{}
  2551. \let\tabudefaulttarget \linewidth
  2552. \ProcessOptions* % \ProcessOptions* is quicker !
  2553. \endinput
  2554. %%
  2555. %% End of file `tabu.sty'.