improve FakeTable and tcolorbox options
authorMarei Peischl <marei@peitex.de>
Wed, 27 Nov 2019 12:10:52 +0000 (13:10 +0100)
committerJan Büren <jan@kivitendo.de>
Mon, 3 Feb 2020 11:21:38 +0000 (12:21 +0100)
kiviletter.sty

index b17e63b..7621a32 100644 (file)
@@ -126,34 +126,38 @@ align=tl,
 \seq_new:N \l_kivi_PricingTable_seq
 \seq_new:N \g_kivi_extraDescription_seq
 \newcommand{\FakeTable}[1]{
-       \kivi_save_LT@boxes:
-       \box_gset_eq:NN \LT@lastfoot \c_empty_box
-       \box_gset_eq:NN \LT@foot \c_empty_box
-       \endPricingTabular
+       \par
+       \CalcTabCols
        \seq_set_split:Nnn \l_kivi_PricingTable_seq {\tabularnewline} {#1}
        \begingroup
        \setlength{\tabcolsep}{\g_kivi_tabcolsep_dim}
        \seq_map_inline:Nn \l_kivi_PricingTable_seq {
        \seq_gclear:N \g_kivi_extraDescription_seq
-       \tabular{@{}p{\g_kivi_tab_pos_dim}p{\g_kivi_tab_id_dim}p{\g_kivi_tab_desc_dim}>{\raggedleft\arraybackslash}p{\g_kivi_tab_num_dim}*2{P<{\,\currency}}@{}}
+       \exp_args:NnV \use:n {\tabular[t]}\g_kivi_Pricing_colspec_tl
        ##1
        \endtabular
        \seq_if_empty:NTF \g_kivi_extraDescription_seq
        {\par\nointerlineskip}
        {\par\nointerlineskip
-               \begin{tcolorbox}[left~skip=\dim_eval:n {\g_kivi_tab_pos_dim+ \g_kivi_tab_id_dim +4\tabcolsep},right~skip=\dim_eval:n {\g_kivi_tab_num_dim+ 2\g_kivi_tab_price_dim +6\tabcolsep}, breakable, blank]
-               \seq_use:Nn \g_kivi_extraDescription_seq {\newline}
-               \end{tcolorbox}
+       \begin{tcolorbox}[
+               empty,
+               left=\dim_eval:n {\g_kivi_tab_pos_dim+ \g_kivi_tab_id_dim +4\g_kivi_tabcolsep_dim},
+               right=\dim_eval:n {\g_kivi_tab_num_dim+ 2\g_kivi_tab_price_dim +6\g_kivi_tabcolsep_dim},top=0pt,bottom=0pt,
+               boxsep=0pt,
+               breakable,
+               lines~before~break=1,
+       ]
+       \seq_use:Nn \g_kivi_extraDescription_seq {\\}
+       \end{tcolorbox}
+       \nointerlineskip
        }
        }
        \endgroup
-       \PricingTabular
-       \kivi_restore_LT@boxes:
 }
 
 
 \tl_new:N \g_kivi_Pricing_colspec_tl
-\tl_gset:Nn \g_kivi_Pricing_colspec_tl {@{}p{\g_kivi_tab_pos_dim}p{\g_kivi_tab_id_dim}p{\g_kivi_tab_desc_dim}>{\raggedleft\arraybackslash}p{\g_kivi_tab_num_dim}*2{P<{\,\currency}}@{}}
+\tl_gset:Nn \g_kivi_Pricing_colspec_tl {@{}p{\g_kivi_tab_pos_dim}p{\g_kivi_tab_id_dim}p{\g_kivi_tab_desc_dim}>{\raggedleft\arraybackslash}p{\g_kivi_tab_num_dim}*2{P}@{}}
 
 
 \clist_map_inline:nn {head, foot, firsthead, lastfoot} {%TODO reduce