marei: headline/colspec keys for SimpleTabular
authorMarei (peiTeX) <marei@peitex.de>
Fri, 25 Sep 2020 12:50:13 +0000 (14:50 +0200)
committerJan Büren <jan@kivitendo.de>
Wed, 21 Oct 2020 11:42:03 +0000 (13:42 +0200)
templates/print/marei/kiviletter.sty

index 3cfec44..76b21b7 100644 (file)
@@ -386,14 +386,24 @@ contents={\usebox\shippingAddressBox}
 
 \RequirePackage{xltabular}
 
+\keys_define:nn {kivi/SimpleTabular} {
+       colspec .tl_set:N =\l_kivi_SimpleTabular_colspec_tl,
+       colspec .initial:n = {rrX},
+       headline .tl_set:N = \l_kivi_SimpleTabular_headline_tl,
+       headline .initial:n = {\bfseries\position & \bfseries\menge & \bfseries\bezeichnung},
+}
 
-\newenvironment{SimpleTabular}[1][\bfseries\position & \bfseries\menge & \bfseries\bezeichnung]
+\newenvironment{SimpleTabular}[1][]
 {
+       \tl_if_in:nnTF {#1} {=} {\keys_set:nn {kivi/SimpleTabular} {#1}} {\tl_if_empty:nF {#1} {\tl_set:Nn \l_kivi_SimpleTabular_headline_tl {#1}}}
        \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
-       \xltabular{\linewidth}{@{}rrX@{}}
+       \tl_put_right:Nn \l_kivi_SimpleTabular_colspec_tl {@{}}
+       \tl_put_left:Nn \l_kivi_SimpleTabular_colspec_tl {@{}}
+       \exp_args:NnV \xltabular{\linewidth}\l_kivi_SimpleTabular_colspec_tl
        \toprule
-       #1\\
-       \midrule\\\endhead
+       \l_kivi_SimpleTabular_headline_tl\\
+       \midrule
+       \endhead
        \midrule
        \rlap{\makebox[\textwidth][r]{\weiteraufnaechsterseite}}\\
        \endfoot