summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/keyvaltable
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-02-21 22:54:25 +0000
committerKarl Berry <karl@freefriends.org>2020-02-21 22:54:25 +0000
commit8c001b9ec06abf4a378fbe9fd81bde3e5343d6c1 (patch)
tree38b64b09487f20a4b4235b8222f92114e9da3af6 /Master/texmf-dist/tex/latex/keyvaltable
parentee6d6cebcf0c8b850920001a6420f42c156050b0 (diff)
keyvaltable (21feb20)
git-svn-id: svn://tug.org/texlive/trunk@53861 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/keyvaltable')
-rw-r--r--Master/texmf-dist/tex/latex/keyvaltable/keyvaltable.sty235
1 files changed, 165 insertions, 70 deletions
diff --git a/Master/texmf-dist/tex/latex/keyvaltable/keyvaltable.sty b/Master/texmf-dist/tex/latex/keyvaltable/keyvaltable.sty
index de0350c02a6..2101d3a66ed 100644
--- a/Master/texmf-dist/tex/latex/keyvaltable/keyvaltable.sty
+++ b/Master/texmf-dist/tex/latex/keyvaltable/keyvaltable.sty
@@ -6,7 +6,7 @@
%%
%% keyvaltable.dtx (with options: `package')
%%
-%% Copyright (C) 2016-2018 by Richard Grewe <r-g+tex@posteo.net>
+%% Copyright (C) 2016-2020 by Richard Grewe <r-g+tex@posteo.net>
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.2 of this license
@@ -20,7 +20,7 @@
%%
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{keyvaltable}
- [2019/05/11 v2.0 Package for filling tables using key-value lists]
+ [2020/02/19 v2.1 Package for filling tables using key-value lists]
\RequirePackage{etoolbox}
\RequirePackage{xkeyval}
\RequirePackage{trimspaces}
@@ -37,6 +37,8 @@
\expandafter\kvt@setkeys\expandafter{#1}{#2}}
\newcommand\kvt@setcskeys[2]{%
\expandafter\kvt@setcmdkeys\expandafter{\csname #1\endcsname}{#2}}
+\newcommand\kvt@setkeys@nopresets[2]{%
+ \kvt@xkv@disablepreset[kvt]{#2}{\kvt@setkeys{#1}{#2}}}
\newcommand\kvt@colsetkeys[2]{\setkeys[KeyValTable]{#1}{#2}}
\newcommand\kvt@colsetcmdkeys[2]{%
\expandafter\kvt@colsetkeys\expandafter{#1}{#2}}
@@ -57,10 +59,6 @@
\newcommand\kvtTableOpt[1]{\csname cmdkvt@Table@#1\endcsname}
\define@cmdkey[kvt]{Table}{rowbg}{}
\define@cmdkey[kvt]{Table}{headbg}{}
-\define@boolkey[kvt]{Table}{norowbg}[true]{%
- \kvt@setkeys{rowbg={}}{Table}}
-\define@key[kvt]{Table}{nobg}[true]{%
- \kvt@setkeys{rowbg={},headbg={}}{Table}}
\define@cmdkey[kvt]{Table}{headalign}{}
\define@cmdkey[kvt]{Table}{headformat}{}
\define@cmdkey[kvt]{Table}{width}{}
@@ -68,7 +66,18 @@
\define@boolkey[kvt]{Table}{showrules}{}
\define@cmdkey[kvt]{Table}{caption}{}
\define@cmdkey[kvt]{Table}{label}{}
-
+\define@choicekey[kvt]{Table}{valign}{t,c,b}
+ {\csdef{cmdkvt@Table@valign}{#1}}
+\define@choicekey[kvt]{Table}{halign}{l,c,r}
+ {\csdef{cmdkvt@Table@halign}{#1}}
+\define@boolkey[kvt]{Table}{norowbg}[true]{%
+ \kvt@setkeys{rowbg={}}{Table}}
+\define@boolkey[kvt]{Table}{nobg}[true]{%
+ \kvt@setkeys{rowbg={},headbg={}}{Table}}
+\define@boolkey[kvt]{Table}{norules}[true]{%
+ \ifbool{#1}
+ {\kvt@setkeys{showrules=false}{Table}}
+ {\kvt@setkeys{showrules=true}{Table}}}
\define@choicekey[kvt]{Table}{shape}
{multipage,onepage,tabular,longtable,tabularx,xltabular,tabu,longtabu}
{\csdef{cmdkvt@Table@shape}{#1}}
@@ -86,11 +95,11 @@
\newcommand\kvt@def@globalopts[2]{%
\forcsvlist{\kvt@def@globalopt{#1}}{#2}}
\define@cmdkey[kvt]{ColGroup}{span}{%
- \csdef{kvt@colgrp@span@\kvt@@colgrp}{#1}}
+ \csgdef{kvt@colgrp@span@\kvt@@tname @\kvt@@colgrp}{#1}}
\define@cmdkey[kvt]{ColGroup}{align}{%
- \csdef{kvt@colgrp@align@\kvt@@colgrp}{#1}}
+ \csgdef{kvt@colgrp@align@\kvt@@tname @\kvt@@colgrp}{#1}}
\define@cmdkey[kvt]{ColGroup}{format}{%
- \csdef{kvt@colgrp@format@\kvt@@colgrp}{#1}}
+ \csgdef{kvt@colgrp@format@\kvt@@tname @\kvt@@colgrp}{#1}}
\kvt@def@globalopts{ColGroup}{align, format}
\define@cmdkey[kvt]{Layout}{headers}{%
\expandafter\kvt@parseheadrows\expandafter{\kvt@@tname}{#1}}
@@ -102,11 +111,23 @@
\csdef{kvt@@hdcell@align@\kvt@@hdcell}{#1}}
\kvt@def@globalopts{HeadCell}{align}
\define@cmdkey[kvt]{Row}{bg}{}
+\define@cmdkey[kvt]{Row}{format}{}
+\define@cmdkey[kvt]{Row}{format*}{}
+\define@cmdkey[kvt]{Row}{format!}{}
+\define@cmdkey[kvt]{Row}{align}{}
+\define@boolkey[kvt]{Row}{headlike}[true]{%
+ \ifbool{#1}{%
+ \edef\kvt@@opts{%
+ bg={\expandonce\cmdkvt@Table@headbg},%
+ format!={\expandonce\cmdkvt@Table@headformat},%
+ align={\expandonce\cmdkvt@Table@headalign}}%
+ \expandafter\kvt@setkeys@nopresets\expandafter{\kvt@@opts}{Row}%
+ }{}}
\define@boolkey[kvt]{Row}{hidden}[true]{}
\define@cmdkey[kvt]{Row}{below}{}
\define@cmdkey[kvt]{Row}{above}{}
\define@key[kvt]{Row}{around}{%
- \kvt@setkeys{below={#1},above={#1}}{Row}}
+ \kvt@setkeys@nopresets{below={#1},above={#1}}{Row}}
\define@key[kvt]{Row}{style}{\kvt@UseRowStyles{#1}}
\define@boolkey[kvt]{Row}{uncounted}[true]{}
\define@boolkey[kvt]{Row}{expand}[true]{}
@@ -151,12 +172,12 @@
\string\NewKeyValTable}}{}%
\csdef{kvt@options@#2}{#1}%
\csdef{kvt@headings@#2}{}%
- \csedef{kvt@alignments@#2}{p{0pt}\expandonce\kvt@HackIntercolSpace}%
+ \csdef{kvt@alignments@#2}{}%
\csdef{kvt@allcolumns@#2}{}%
\csdef{kvt@displaycols@#2}{}%
\csdef{kvt@rowcount@#2}{0}%
\csdef{kvt@rows@#2}{}%
- \csdef{kvt@headings@#2}{\kvt@defaultheader}
+ \csdef{kvt@headings@#2}{\kvt@defaultheader}%
\listadd\kvt@alltables{#2}%
\def\do##1{%
\kvt@parsecolspec{#2}##1::\@undefined}%
@@ -193,21 +214,19 @@
\undef\kvt@@column}
\newcommand\kvt@defaultheader{%
\noexpand\kvt@rowcolorornot{\cmdkvt@Table@headbg}%
- \kvt@defaultheader@i}
-\newcommand\kvt@defaultheader@i[1]{%
- \kvt@ifnil{#1}{\noexpand\tabularnewline}{%
- \unexpanded{&}%
+ \kvt@defaultheader@i{}}
+\newcommand\kvt@defaultheader@i[2]{%
+ \kvt@ifnil{#2}{\noexpand\tabularnewline}{%
+ \unexpanded{#1}%
\ifdefvoid\cmdkvt@Table@headalign
- {\expandonce\cmdkvt@Table@headformat{\unexpanded{#1}}}
+ {\expandonce\cmdkvt@Table@headformat{\unexpanded{#2}}}
{\noexpand\multicolumn{1}{\expandonce\cmdkvt@Table@headalign}
- {\expandonce\cmdkvt@Table@headformat{\unexpanded{#1}}}}%
- \kvt@defaultheader@i}}
+ {\expandonce\cmdkvt@Table@headformat{\unexpanded{#2}}}}%
+ \kvt@defaultheader@i{&}}}
\newcommand\kvt@ifnil[1]{%
\ifx\@nil#1\relax
\expandafter\@firstoftwo\else
\expandafter\@secondoftwo\fi}
-\newcommand\kvt@HackIntercolSpace{%
- @{\hspace{-.5\arrayrulewidth}}}
\newcommand\kvt@alltables{}
\newcommand\kvt@parselayout[2]{%
\def\kvt@@tname{#2}%
@@ -231,18 +250,20 @@
columns groups.}}{}%
\def\kvt@@colgrp{#2}%
\kvt@setkeys{#3}{ColGroup}%
- \kvt@checkcolgroupcs{kvt@colgrp@span@\kvt@@colgrp}{#1}{#2}%
+ \kvt@checkcolgroupcs{kvt@colgrp@span@#1@#2}{#1}{#2}%
\eappto\kvt@@result{%
\noexpand\define@cmdkey[KeyValTable]{#1}{#2}{%
\ifdefvoid\kvt@@colgrp@first{}{%
- \noexpand\setkeys[KeyValTable]{#1}{%
- \expandonce\kvt@@colgrp@first*=\noexpand\multicolumn
- {\expandonce\kvt@@colgrp@n}%
- {\csexpandonce{kvt@colgrp@align@#2}}%
- {\csexpandonce{kvt@colgrp@format@#2}{\unexpanded{##1}}}}%
+ \noexpand\kvt@xkv@disablepreset[KeyValTable]{#1}{%
+ \noexpand\setkeys[KeyValTable]{#1}{%
+ \expandonce\kvt@@colgrp@first=\noexpand\kvt@@@colgroup
+ {\unexpanded{#2}}%
+ {\expandonce\kvt@@colgrp@n}%
+ {\csexpandonce{kvt@colgrp@align@#1@#2}}%
+ {\unexpanded{##1}}}}%
}%
- }%
- \noexpand\listcsadd{kvt@grpcolkeys@#1}{#2}}}
+ }}%
+ \listcsadd{kvt@grpcolkeys@#1}{#2}}
\newcommand\kvt@checkcolgroup[3]{%
\def\kvt@@psvdo##1{%
\ifinlistcs{##1}{kvt@allcolumns@#2}{}{\kvt@error
@@ -271,7 +292,8 @@
{Compare `\string\kvt@@curgrp' to the column ordering as
specified in `\string\NewKeyValTable{#1}'}%
\fi
- \edef\kvt@@colgrp@n{\the\numexpr\kvt@@colgrp@n+1\relax}}%
+ \edef\kvt@@colgrp@n{\the\numexpr\kvt@@colgrp@n+1\relax}%
+ \csundef{kvt@@incolgrp@##1}}%
}\forlistcsloop{\kvt@@coldo}{kvt@displaycols@#2}}
\newcommand\kvt@checkcolgroupcs[3]{%
\expandafter\expandafter\expandafter
@@ -303,6 +325,7 @@
\let\kvt@@tmpgrphd\@empty
\kvt@@span\z@
\undef\kvt@@curhd \undef\kvt@@lasthd
+ \kvt@def@atseconduse\kvt@@switchcol{\appto\kvt@@tmpgrphd{&}}%
\def\do##1{\letcs\kvt@@curhd{kvt@@hdcellof@##1}%
\ifdefequal\kvt@@curhd\kvt@@lasthd
{\advance\kvt@@span\@ne}%
@@ -323,23 +346,19 @@
\newcommand\kvt@rowcolorornot[1]{\ifstrempty{#1}{}{\rowcolor{#1}}}
\newcount\kvt@@span
\newcommand\kvt@concludecolumn{%
- \ifdefequal\kvt@@tmpgrphd\@empty
- {\let\kvt@@extraalign\kvt@HackIntercolSpace}
- {\let\kvt@@extraalign\@empty}%
- \appto\kvt@@tmpgrphd{&}%
+ \kvt@@switchcol
\ifdefvoid\kvt@@lasthd{}{%
\eappto\kvt@@tmpgrphd{\noexpand\multicolumn
{\the\kvt@@span}
- {\expandonce\kvt@@extraalign
- \csexpandonce{kvt@@hdcell@align@\kvt@@lasthd}}
+ {\csexpandonce{kvt@@hdcell@align@\kvt@@lasthd}}
{\csexpandonce{kvt@@hdcell@head@\kvt@@lasthd}}}%
\cslet{kvt@@hdcelldone@\kvt@@lasthd}{\@ne}}}
\def\kvt@parsehdcolspec#1#2:#3:#4\@undefined{%
\def\kvt@@colreg##1{%
\ifinlistcs{##1}{kvt@allcolumns@#1}{}
- {\kvt@error{Column `##1', referenced in header cell `#2', not known
- in table type `#1'}{Check the \string\NewKeyValTable{#1} for
- the names of known columns and check `##1' for a typo.}}%
+ {\kvt@error{Column `##1', referenced in header cell `#2', not
+ known in table type `#1'}{Check the \string\NewKeyValTable{#1}
+ for the names of known columns and check `##1' for a typo.}}%
\ifcsmacro{kvt@@hdcellof@##1}
{\kvt@error{Column `##1' used in more than one header cell}
{Check the fourth, optional argument of \string\NewKeyValTable
@@ -367,8 +386,6 @@
\csuse{kvt@StartTable@\cmdkvt@Table@shape}{#2}%
}{%
\csuse{kvt@EndTable@\cmdkvt@Table@shape}}
-\AfterEndEnvironment{KeyValTable}{%
- \csdef{kvt@rowcount@\kvt@@recenttable}{\thekvtTypeRow}}
\newcommand\kvt@SetOptions[2]{%
\begingroup\edef\kvt@@do{\endgroup\noexpand%
\kvt@setkeys{\csexpandonce{kvt@options@#1},\unexpanded{#2}}{Table}%
@@ -380,6 +397,8 @@
{\def\kvt@@rule##1{\csuse{##1rule}}}
{\def\kvt@@rule##1{}}%
\appto\kvt@@endhook{\kvt@@rule{bottom}}
+ \appto\kvt@@endhook{%
+ \noalign{\csxdef{kvt@rowcount@#2}{\thekvtTypeRow}}}%
\ifdefempty\cmdkvt@Table@caption{}{%
\metatblHasCaption{#1}
{\appto\kvt@@endhook{\rowcolor{white}%
@@ -389,6 +408,16 @@
\label\expandafter{\cmdkvt@Table@label}}}}
{\kvt@warn{Caption lost, table environment '#1'
does not support captions.}}}%
+ \ifdefvoid{\cmdkvt@Table@valign}{}{\metatblCanVAlign{#1}{}
+ {\undef{\cmdkvt@Table@valign}%
+ \kvt@warn{Table environment '#1' of table '#2'
+ does not support the vertical alignment option (valign).
+ Ignoring the option}}}%
+ \ifdefvoid{\cmdkvt@Table@halign}{}{\metatblCanHAlign{#1}{}
+ {\undef{\cmdkvt@Table@halign}%
+ \kvt@warn{Table environment '#1' of table '#2'
+ does not support the horizontal alignment option (halign).
+ Ignoring the option}}}%
\setcounter{kvtRow}{0}%
\setcounter{kvtTypeRow}{\csuse{kvt@rowcount@#2}}%
\begingroup\edef\kvt@@do{\endgroup
@@ -398,11 +427,16 @@
{1}}%
{\expandonce\cmdkvt@Table@rowbg}}%
\expandafter\noexpand\csname #1\endcsname
+ \ifdefvoid{\cmdkvt@Table@halign}{}
+ {\metatblIsTabu{#1}{}{[\cmdkvt@Table@halign]}}%
\metatblHasWidth{#1}
{\metatblIsTabu{#1}
{to \expandonce\cmdkvt@Table@width}
{{\expandonce\cmdkvt@Table@width}}}
{}%
+ \ifdefvoid{\cmdkvt@Table@valign}{}{[\cmdkvt@Table@valign]}%
+ \ifdefvoid{\cmdkvt@Table@halign}{}
+ {\metatblIsTabu{#1}{[\cmdkvt@Table@halign]}{}}%
{\csexpandonce{kvt@alignments@#2}}%
\noexpand\kvt@@rule{top}%
\ifbool{kvt@Table@showhead}
@@ -451,6 +485,10 @@
\metatbl@boolprop{hasWidth}{#1}}
\define@boolkey[metatbl]{EnvProp}{hasCaption}{%
\metatbl@boolprop{hasCaption}{#1}}
+\define@boolkey[metatbl]{EnvProp}{canVAlign}{%
+ \metatbl@boolprop{canVAlign}{#1}}
+\define@boolkey[metatbl]{EnvProp}{canHAlign}{%
+ \metatbl@boolprop{canHAlign}{#1}}
\define@cmdkey[metatbl]{EnvProp}{packages}{\metatbl@setprop{pkg}{#1}}
\define@key[metatbl]{EnvProp}{atEnd}{\metatbl@setprop[1]{atEnd}{#1}}
\newrobustcmd\metatblRegisterEnv[2]{%
@@ -466,11 +504,15 @@
\newcommand\metatblIsTabu[1]{\ifbool{metatbl@EnvProp@isTabu@#1}}
\newcommand\metatblHasWidth[1]{\ifbool{metatbl@EnvProp@hasWidth@#1}}
\newcommand\metatblHasCaption[1]{\ifbool{metatbl@EnvProp@hasCaption@#1}}
+\newcommand\metatblCanVAlign[1]{\ifbool{metatbl@EnvProp@canVAlign@#1}}
+\newcommand\metatblCanHAlign[1]{\ifbool{metatbl@EnvProp@canHAlign@#1}}
\newcommand\metatblUsePackage[1]{%
- \def\do##1{\metatbl@csnamearg\usepackage{metatbl@EnvProp@pkg@##1}}%
+ \def\do##1{%
+ \metatbl@csnamearg\usepackage{metatbl@EnvProp@pkg@##1}}%
\docsvlist{#1}}
\newcommand\metatblRequire[1]{%
- \def\do##1{\metatbl@csnamearg\RequirePackage{metatbl@EnvProp@pkg@##1}}%
+ \def\do##1{%
+ \metatbl@csnamearg\RequirePackage{metatbl@EnvProp@pkg@##1}}%
\docsvlist{#1}}
\newcommand\metatblAtEnd[2]{% #1=env-name, #2=code
\csname metatbl@EnvProp@atEnd@#1\endcsname{#2}}
@@ -479,11 +521,13 @@
\expandafter\expandafter\expandafter{\csname#2\endcsname}}
\metatblRegisterEnv{tabular}{%
isLong=false, hasWidth=false, isTabu=false, hasCaption=false,
+ canVAlign=true, canHAlign=false,
packages={},
atEnd={\preto\endtabular{#1}},
}
\metatblRegisterEnv{tabularx}{%
isLong=false, hasWidth=true, isTabu=false, hasCaption=false,
+ canVAlign=true, canHAlign=false,
packages=tabularx,
atEnd={%
\preto\TX@endtabularx{\toks@\expandafter{\the\toks@#1}}%
@@ -491,28 +535,32 @@
}
\metatblRegisterEnv{longtable}{%
isLong=true, hasWidth=false, isTabu=false, hasCaption=true,
+ canVAlign=false, canHAlign=true,
packages={longtable},
atEnd={\preto\endlongtable{#1}},
}
\metatblRegisterEnv{xltabular}{%
isLong=true, hasWidth=true, isTabu=false, hasCaption=true,
+ canVAlign=false, canHAlign=true,
packages=xltabular,
atEnd={\preto\XLT@ii@TX@endtabularx{\toks@\expandafter{\the\toks@#1}}},
}
\metatblRegisterEnv{tabu}{%
isLong=false, hasWidth=true, isTabu=true, hasCaption=false,
+ canVAlign=true, canHAlign=false,
packages={tabu},
atEnd={\preto\endtabular{#1}},
}
\metatblRegisterEnv{longtabu}{%
isLong=true, hasWidth=true, isTabu=true, hasCaption=true,
+ canVAlign=false, canHAlign=true,
packages={tabu,longtable},
atEnd={\preto\endlongtable{#1}},
}
\newrobustcmd\metatbl@ifhasXcolumns[1]{%
\begingroup
\def\metatbl@@branch{\@secondoftwo}%
- \def\NC@rewrite@X{\def\metatbl@@branch{\@firstoftwo}\NC@find}%
+ \def\NC@rewrite@X{\def\metatbl@@branch{\@firstoftwo}\NC@find l}%
\@mkpream{#1}%
\expandafter\endgroup\metatbl@@branch}
\newcommand\kvt@AddKeyValRow[3]{%
@@ -535,44 +583,91 @@
\eappto\kvt@@row{\noexpand\rowcolor{\expandonce\cmdkvt@Row@bg}}}%
\ifbool{kvt@Row@uncounted}{}{%
\appto\kvt@@row{\noalign{\kvt@stepcounters}}}%
+ \ifdefvoid\cmdkvt@Row@align
+ {\let\kvt@@rowmkmulticolumn\@empty}
+ {\edef\kvt@@rowmkmulticolumn{%
+ \noexpand\multicolumn{1}{\expandonce\cmdkvt@Row@align}}}%
+ \ifcsvoid{cmdkvt@Row@format!}
+ {\edef\kvt@@cellfmtbuilder##1##2{%
+ \noexpand\edef##1####1{%
+ \noexpand\kvt@expandonce@onearg\noexpand\kvt@@mkmulticolumn
+ {\ifcsvoid{cmdkvt@Row@format*}{\@firstofone}
+ {\noexpand\unexpanded{\csexpandonce{cmdkvt@Row@format*}}}%
+ {\noexpand\csexpandonce{##2}{%
+ \ifdefvoid\cmdkvt@Row@format{\@firstofone}
+ {\noexpand\unexpanded{\expandonce\cmdkvt@Row@format}}%
+ {####1}}}}}}}%
+ {\edef\kvt@@cellfmtbuilder##1##2{%
+ \noexpand\edef##1####1{%
+ \noexpand\kvt@expandonce@onearg\noexpand\kvt@@mkmulticolumn{%
+ \noexpand\unexpanded{\csexpandonce{cmdkvt@Row@format!}}%
+ {####1}}}}}%
\kvt@@span=0\relax
+ \kvt@def@atseconduse\kvt@@switchcol{\appto\kvt@@row{&}}%
\def\do##1{%
- \ifcsvoid{cmdKeyValTable@#2@##1}
- {\letcs\kvt@@cell{kvt@col@default@#2@##1}}
- {\letcs\kvt@@cell{cmdKeyValTable@#2@##1}%
- \ifbool{kvt@Row@expandonce}
- {\expandafter\let\expandafter\kvt@@cell\kvt@@cell}{}%
- \ifbool{kvt@Row@expand}
- {\protected@edef\kvt@@cell{\kvt@@cell}}{}}%
- \ifcsvoid{kvt@@noformat@#2@##1}
- {\edef\kvt@@formatter{\expandonce{\csname kvt@col@format@#2@##1\endcsname}}}%
- {\def\kvt@@formatter{\@firstofone}}%
- \edef\kvt@@fmtcell{\expandonce\kvt@@formatter{%
- \expandonce\kvt@@cell}}%
- \csundef{kvt@@noformat@#2@##1}%
\ifnumgreater\kvt@@span{0}
{\advance\kvt@@span\m@ne
- \ifstrempty\kvt@@cell{\def\kvt@@fmtcell{}}{}}
- {\appto\kvt@@row{&}}%
- \expandafter\kvt@CheckMulticolumn\kvt@@cell
- \relax\relax\relax\relax\@undefined
- \expandafter\appto\expandafter\kvt@@row\expandafter{\kvt@@fmtcell}%
+ \ifcsvoid{cmdKeyValTable@#2@##1}{}
+ {\ifdefvoid\kvt@@curcgname
+ {\kvt@error{Column '##1' nonempty inside a
+ \string\multicolumn}{}}
+ {\kvt@error{Column '##1' nonempty inside column group
+ '\kvt@@curcgname'}{}}}}
+ {\kvt@@switchcol
+ \let\kvt@@mkmulticolumn\kvt@@rowmkmulticolumn
+ \letcs\kvt@@curcolformat{kvt@col@format@#2@##1}%
+ \ifcsvoid{cmdKeyValTable@#2@##1}
+ {\letcs\kvt@@cell{kvt@col@default@#2@##1}}
+ {\letcs\kvt@@cell{cmdKeyValTable@#2@##1}%
+ \expandafter\kvt@CheckMulticolumn\expandafter{\kvt@@cell}{#2}%
+ \ifbool{kvt@Row@expandonce}
+ {\expandafter\let\expandafter\kvt@@cell\kvt@@cell}{}%
+ \ifbool{kvt@Row@expand}
+ {\protected@edef\kvt@@cell{\kvt@@cell}}{}}%
+ \ifcsvoid{kvt@@noformat@#2@##1}
+ {\kvt@@cellfmtbuilder\kvt@@formatter{kvt@@curcolformat}}%
+ {\let\kvt@@formatter\@firstofone}%
+ \csundef{kvt@@noformat@#2@##1}%
+ \edef\kvt@@fmtcell{\expandafter\expandonce\expandafter{%
+ \expandafter\kvt@@formatter\expandafter{%
+ \kvt@@cell}}}%
+ \expandafter\appto\expandafter\kvt@@row\expandafter{%
+ \kvt@@fmtcell}}%
}\dolistcsloop{kvt@displaycols@#2}%
+ \undef\kvt@@cellfmtbuilder
\appto\kvt@@row{\tabularnewline}%
\ifdefvoid\cmdkvt@Row@below{}{%
\eappto\kvt@@row{\noexpand\noalign{\noexpand\vspace{%
\expandonce\cmdkvt@Row@below}}}}%
#1}
+\newcommand\kvt@def@atseconduse[2]{\def#1{\def#1{#2}}}
+\newcommand\kvt@expandonce@onearg[2]{%
+ \ifdefequal{#1}{\@empty}{#2}{\expandonce{#1}{#2}}}
\newcommand\kvt@stepcounters[1][1]{%
\addtocounter{kvtRow}{#1}%
\addtocounter{kvtTypeRow}{#1}%
\addtocounter{kvtTotalRow}{#1}}
-\def\kvt@CheckMulticolumn#1#2#3#4\@undefined{%
- \ifx#1\multicolumn
- \kvt@@span=#2\relax \advance\kvt@@span\m@ne
- \edef\kvt@@fmtcell{\unexpanded{\multicolumn{#2}{#3}}%
- {\expandonce\kvt@@formatter{\expandonce{#4}}}}%
- \fi}
+\newcommand\kvt@CheckMulticolumn[2]{%
+ \kvt@CheckMulticolumn@i{#2}#1%
+ \relax\relax\relax\relax\relax\kvt@@undefined}
+\def\kvt@CheckMulticolumn@i#1#2#3#4#5#6#7\kvt@@undefined{%
+ \ifdefmacro{#2}{%
+ \ifx#2\multicolumn
+ \kvt@SetMulticolumn{#4}{#3}{#5}%
+ \let\kvt@@curcgname\@empty
+ \else\ifx#2\kvt@@@colgroup
+ \letcs\kvt@@curcolformat{kvt@colgrp@format@#1@#3}%
+ \def\kvt@@curcgname{#3}%
+ \ifdefvoid\cmdkvt@Row@align
+ {\kvt@SetMulticolumn{#5}{#4}{#6}}
+ {\expandafter
+ \kvt@SetMulticolumn\expandafter{\cmdkvt@Row@align}{#4}{#6}}%
+ \fi\fi}{}}
+\newcommand\kvt@@@colgroup{kvt@@@colgroup}
+\newcommand\kvt@SetMulticolumn[3]{%
+ \kvt@@span=#2\relax \advance\kvt@@span\m@ne
+ \def\kvt@@cell{#3}%
+ \def\kvt@@mkmulticolumn{\multicolumn{#2}{#1}}}
\newcommand\kvtNewRowStyle[2]{%
\ifcsundef{kvt@@rowstyle@#1}
{\csdef{kvt@@rowstyle@#1}{#2}}
@@ -708,7 +803,7 @@
\kvt@DefineDualTabEnv{multipage}{longtable}{xltabular}
}
\kvt@IfVersion{<}{2.0}{%
- \let\kvt@parselayout=\kvt@parseheadrows
+ \renewcommand\kvt@parselayout[2]{\kvt@parseheadrows{#2}{#1}}%
}{}
\endinput
%%