From 0dc40a1ee19496b265caf65c297647f19b2a6096 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 13 Jun 2018 21:44:12 +0000 Subject: cellprops (13jun18) git-svn-id: svn://tug.org/texlive/trunk@48004 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/doc/latex/cellprops/cellprops.pdf | Bin 518401 -> 521900 bytes .../source/latex/cellprops/cellprops.dtx | 99 +++++++++++++++------ .../texmf-dist/tex/latex/cellprops/cellprops.sty | 86 +++++++++++++----- 3 files changed, 136 insertions(+), 49 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/cellprops/cellprops.pdf b/Master/texmf-dist/doc/latex/cellprops/cellprops.pdf index dbc70fafdaf..4c5b2e23a14 100644 Binary files a/Master/texmf-dist/doc/latex/cellprops/cellprops.pdf and b/Master/texmf-dist/doc/latex/cellprops/cellprops.pdf differ diff --git a/Master/texmf-dist/source/latex/cellprops/cellprops.dtx b/Master/texmf-dist/source/latex/cellprops/cellprops.dtx index 2ec12963014..bcb4bcd0388 100644 --- a/Master/texmf-dist/source/latex/cellprops/cellprops.dtx +++ b/Master/texmf-dist/source/latex/cellprops/cellprops.dtx @@ -15,7 +15,7 @@ \def\ExplFileName{cellprops} \def\ExplFileDescription{CSS-like cell and table properties} \def\ExplFileDate{2018/06/12} -\def\ExplFileVersion{1.1a} +\def\ExplFileVersion{1.2} % %<*driver> \documentclass[full]{l3doc} @@ -164,6 +164,8 @@ % corresponding vertical alignment (\cs{vtop}, \cs{vcenter} or \cs{vbox}). % \item "*{"\"}{"\"}": same as in \pkg{array} or % \pkg{mdwtab}. +% \item ">{"\"}" and "<{"\"}": +% same as in \pkg{array} or \pkg{mdwtab}. % \item You can try to use constructs of \pkg{array} or \pkg{mdwtab}, but they % might alter the function of \pkg{cellprops}. Most should be fine though. % \end{itemize} @@ -197,9 +199,16 @@ % handle those without slowing down the general case. % \end{itemize} % +% \subsection{Compatibility} +% +% This package has been tested compatible with \pkg{diagbox}, \pkg{spreadtab}, +% \pkg{collcell}. Compatibility with \pkg{longtable} has been specifically taken +% care of, provided \pkg{cellprops} is loaded afterwards. +% % \subsection{TODO} % -% Add "border" properties. Test with different table-oriented packages. Improve +% Add "border" properties. Test with different table-oriented packages, and add +% a test suite with compatibility tests. Improve % the documentation, and test more \LaTeX\ table constructs and preamble column % types. Enforce $n\ge0$ in ":nth-child" selectors to match the CSS % specification. @@ -268,7 +277,11 @@ } \cs_set_protected_nopar:Nn \@@_get_property:nN { - \tl_set_eq:Nc #2 { l_@@_property_value_#1_tl } + \tl_if_exist:cTF { l_@@_property_value_#1_tl } { + \tl_set_eq:Nc #2 { l_@@_property_value_#1_tl } + }{ + \tl_clear:N #2 + } } % \end{macrocode} % \end{macro} @@ -595,8 +608,7 @@ \tl_new:N \l_@@_bgcolor_tl % To count rows and columns -\cs_set_eq:NN \@@_orig_array: \@array -\cs_set_protected_nopar:Npn \@array[#1]#2 { +\cs_new_protected:Nn \@@_array_init: { \tl_set:Nx \l_@@_restore_tl { \bool_if:NTF \g_@@_inrow_bool { \exp_not:n {\bool_gset_true:N \g_@@_inrow_bool} @@ -614,12 +626,8 @@ } \int_gzero:N \g_@@_row_int \bool_gset_false:N \g_@@_inrow_bool - \cs_set_eq:NN \@@_orig_tab@initread: \tab@initread - \cs_set_protected_nopar:Npn \tab@initread { - \cs_set_eq:NN \tab@initread \@@_orig_tab@initread: - \tab@initread - \tl_put_left:Nn \tab@tabtext {\int_gincr:N \g_@@_col_int} - } + \cs_set_eq:NN \@@_orig_tab@readpreamble:n \tab@readpreamble + \cs_set_eq:NN \tab@readpreamble \@@_readpreamble:n % \end{macrocode} % Zero \cs{col@sep} but remember its value for the default padding. % \begin{macrocode} @@ -643,9 +651,43 @@ \tl_set_eq:NN \l_@@_color_tl \g_tmpa_tl \tl_set_eq:NN \l_@@_bgcolor_tl \g_tmpb_tl \@@_recall_properties:n {tr} - \@@_orig_array:[{#1}]{#2} +} + +\cs_set_nopar:Nn \@@_array_startcontent: { \hlx{s[\l_@@_tablepadding_top_dim]} } + +\cs_set_protected_nopar:Nn \@@_readpreamble:n { + \cs_set_eq:NN \tab@readpreamble \@@_orig_tab@readpreamble:n + \tl_put_left:Nn \tab@multicol {\@@_startrow:} + \tl_put_left:Nn \tab@tabtext {\int_gincr:N \g_@@_col_int} + \tab@readpreamble{#1} + \exp_args:Nx \tab@preamble + { \exp_not:N\@@_startrow: \the\tab@preamble \exp_not:N\@@_endrow: } +} + + +\cs_set_eq:NN \@@_orig_array:w \@array +\cs_set_protected_nopar:Npn \@array[#1]#2 { + \@@_array_init: + \@@_orig_array:w [#1]{#2} + \@@_array_startcontent: +} + +\cs_set_eq:NN \@@_orig_LTmkpream:n \@mkpream +\cs_set_protected_nopar:Npn \@mkpream#1 { + \group_end: + \@@_array_init: + \group_begin: + \@@_orig_LTmkpream:n {#1} +} + +\cs_set_eq:NN \@@_orig_LTarray:w \LT@array +\cs_set_protected_nopar:Npn \LT@array [#1]#2 { + \@@_orig_LTarray:w [#1]{#2} + \@@_array_startcontent: +} + % \end{macrocode} % The color inheritance is handled with \cs{l_@@_inherit_color_tl}, % \cs{l_@@_color_tl} and \cs{l_@@_bgcolor_tl}. The role of @@ -654,9 +696,9 @@ % the inherit variable. % \begin{macrocode} \cs_new_protected_nopar:Nn \@@_update_color:Nn { - \@@_get_property:nN {#2} \l_tmpc_tl - \exp_args:NV \tl_if_eq:NNF \l_tmpc_tl \c_@@_inherit_color_tl { - \tl_set_eq:NN #1 \l_tmpc_tl + \@@_get_property:nN {#2} \l_tmpa_tl + \exp_args:NV \tl_if_eq:NNF \l_tmpa_tl \c_@@_inherit_color_tl { + \tl_set_eq:NN #1 \l_tmpa_tl } } @@ -665,17 +707,24 @@ \@@_update_color:Nn \l_@@_bgcolor_tl {background-color} } -\cs_set_eq:NN \@@_orig_endarray: \endarray -\cs_set_nopar:Npn \endarray { +\cs_set_nopar:Nn \@@_end_array:n { \crcr \hlx{s[\l_@@_tablepadding_bottom_dim]} - \@@_orig_endarray: + #1 \tl_use:N \l_@@_restore_tl } -\cs_set_eq:NN \@@_orig_tab@startrow: \tab@startrow -\cs_set_nopar:Npn \tab@startrow { - \@@_orig_tab@startrow: +\cs_set_eq:NN \@@_orig_endarray: \endarray +\cs_set_nopar:Npn \endarray { + \@@_end_array:n { \@@_orig_endarray: } +} + +\cs_set_eq:NN \@@_orig_endLT: \endlongtable +\cs_set_nopar:Npn \endlongtable { + \@@_end_array:n { \@@_orig_endLT: } +} + +\cs_set_protected_nopar:Nn \@@_startrow: { \bool_if:NF \g_@@_inrow_bool { \bool_gset_true:N \g_@@_inrow_bool \int_gincr:N \g_@@_row_int @@ -685,16 +734,15 @@ } } -\cs_set_eq:NN \@@_orig_tab@arraycr: \tab@arraycr -\cs_set_protected_nopar:Npn \tab@arraycr { +\cs_set_protected_nopar:Npn \@@_endrow: { \bool_if:NT \g_@@_inrow_bool { \bool_gset_false:N \g_@@_inrow_bool \@@_fix_valign_end: } - \@@_orig_tab@arraycr: } - +\cs_set_eq:NN \@@_orig_tab@arraycr:n \tab@arraycr +\cs_set_nopar:Npn \tab@arraycr { \@@_endrow:\@@_orig_tab@arraycr:n } \cs_set_eq:NN \@@_orig_multicolumn:w \multicolumn \cs_set:Npn \multicolumn#1#2#3 { @@ -704,7 +752,6 @@ } } - \cs_new_protected_nopar:Nn \@@_fix_valign_end: { \exp_args:NV \tl_if_eq:nnTF \tab@hlstate {b} { \dim_gadd:Nn \tab@endheight { diff --git a/Master/texmf-dist/tex/latex/cellprops/cellprops.sty b/Master/texmf-dist/tex/latex/cellprops/cellprops.sty index 2f63c5f4419..b7b4441aca3 100644 --- a/Master/texmf-dist/tex/latex/cellprops/cellprops.sty +++ b/Master/texmf-dist/tex/latex/cellprops/cellprops.sty @@ -16,7 +16,7 @@ \def\ExplFileName{cellprops} \def\ExplFileDescription{CSS-like cell and table properties} \def\ExplFileDate{2018/06/12} -\def\ExplFileVersion{1.1a} +\def\ExplFileVersion{1.2} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -36,7 +36,11 @@ } \cs_set_protected_nopar:Nn \__cellprops_get_property:nN { - \tl_set_eq:Nc #2 { l__cellprops_property_value_#1_tl } + \tl_if_exist:cTF { l__cellprops_property_value_#1_tl } { + \tl_set_eq:Nc #2 { l__cellprops_property_value_#1_tl } + }{ + \tl_clear:N #2 + } } \cs_set_protected:Nn \__cellprops_define_properties:nn { \clist_map_inline:nn {#2} { @@ -317,8 +321,7 @@ \tl_new:N \l__cellprops_color_tl \tl_new:N \l__cellprops_bgcolor_tl -\cs_set_eq:NN \__cellprops_orig_array: \@array -\cs_set_protected_nopar:Npn \@array[#1]#2 { +\cs_new_protected:Nn \__cellprops_array_init: { \tl_set:Nx \l__cellprops_restore_tl { \bool_if:NTF \g__cellprops_inrow_bool { \exp_not:n {\bool_gset_true:N \g__cellprops_inrow_bool} @@ -336,12 +339,8 @@ } \int_gzero:N \g__cellprops_row_int \bool_gset_false:N \g__cellprops_inrow_bool - \cs_set_eq:NN \__cellprops_orig_tab@initread: \tab@initread - \cs_set_protected_nopar:Npn \tab@initread { - \cs_set_eq:NN \tab@initread \__cellprops_orig_tab@initread: - \tab@initread - \tl_put_left:Nn \tab@tabtext {\int_gincr:N \g__cellprops_col_int} - } + \cs_set_eq:NN \__cellprops_orig_tab@readpreamble:n \tab@readpreamble + \cs_set_eq:NN \tab@readpreamble \__cellprops_readpreamble:n \dim_set_eq:NN \l__cellprops_colsep_dim \col@sep \dim_zero:N \col@sep \dim_zero:N \tab@extrasep @@ -358,13 +357,46 @@ \tl_set_eq:NN \l__cellprops_color_tl \g_tmpa_tl \tl_set_eq:NN \l__cellprops_bgcolor_tl \g_tmpb_tl \__cellprops_recall_properties:n {tr} - \__cellprops_orig_array:[{#1}]{#2} +} + +\cs_set_nopar:Nn \__cellprops_array_startcontent: { \hlx{s[\l__cellprops_tablepadding_top_dim]} } + +\cs_set_protected_nopar:Nn \__cellprops_readpreamble:n { + \cs_set_eq:NN \tab@readpreamble \__cellprops_orig_tab@readpreamble:n + \tl_put_left:Nn \tab@multicol {\__cellprops_startrow:} + \tl_put_left:Nn \tab@tabtext {\int_gincr:N \g__cellprops_col_int} + \tab@readpreamble{#1} + \exp_args:Nx \tab@preamble + { \exp_not:N\__cellprops_startrow: \the\tab@preamble \exp_not:N\__cellprops_endrow: } +} + +\cs_set_eq:NN \__cellprops_orig_array:w \@array +\cs_set_protected_nopar:Npn \@array[#1]#2 { + \__cellprops_array_init: + \__cellprops_orig_array:w [#1]{#2} + \__cellprops_array_startcontent: +} + +\cs_set_eq:NN \__cellprops_orig_LTmkpream:n \@mkpream +\cs_set_protected_nopar:Npn \@mkpream#1 { + \group_end: + \__cellprops_array_init: + \group_begin: + \__cellprops_orig_LTmkpream:n {#1} +} + +\cs_set_eq:NN \__cellprops_orig_LTarray:w \LT@array +\cs_set_protected_nopar:Npn \LT@array [#1]#2 { + \__cellprops_orig_LTarray:w [#1]{#2} + \__cellprops_array_startcontent: +} + \cs_new_protected_nopar:Nn \__cellprops_update_color:Nn { - \__cellprops_get_property:nN {#2} \l_tmpc_tl - \exp_args:NV \tl_if_eq:NNF \l_tmpc_tl \c__cellprops_inherit_color_tl { - \tl_set_eq:NN #1 \l_tmpc_tl + \__cellprops_get_property:nN {#2} \l_tmpa_tl + \exp_args:NV \tl_if_eq:NNF \l_tmpa_tl \c__cellprops_inherit_color_tl { + \tl_set_eq:NN #1 \l_tmpa_tl } } @@ -373,17 +405,24 @@ \__cellprops_update_color:Nn \l__cellprops_bgcolor_tl {background-color} } -\cs_set_eq:NN \__cellprops_orig_endarray: \endarray -\cs_set_nopar:Npn \endarray { +\cs_set_nopar:Nn \__cellprops_end_array:n { \crcr \hlx{s[\l__cellprops_tablepadding_bottom_dim]} - \__cellprops_orig_endarray: + #1 \tl_use:N \l__cellprops_restore_tl } -\cs_set_eq:NN \__cellprops_orig_tab@startrow: \tab@startrow -\cs_set_nopar:Npn \tab@startrow { - \__cellprops_orig_tab@startrow: +\cs_set_eq:NN \__cellprops_orig_endarray: \endarray +\cs_set_nopar:Npn \endarray { + \__cellprops_end_array:n { \__cellprops_orig_endarray: } +} + +\cs_set_eq:NN \__cellprops_orig_endLT: \endlongtable +\cs_set_nopar:Npn \endlongtable { + \__cellprops_end_array:n { \__cellprops_orig_endLT: } +} + +\cs_set_protected_nopar:Nn \__cellprops_startrow: { \bool_if:NF \g__cellprops_inrow_bool { \bool_gset_true:N \g__cellprops_inrow_bool \int_gincr:N \g__cellprops_row_int @@ -393,15 +432,16 @@ } } -\cs_set_eq:NN \__cellprops_orig_tab@arraycr: \tab@arraycr -\cs_set_protected_nopar:Npn \tab@arraycr { +\cs_set_protected_nopar:Npn \__cellprops_endrow: { \bool_if:NT \g__cellprops_inrow_bool { \bool_gset_false:N \g__cellprops_inrow_bool \__cellprops_fix_valign_end: } - \__cellprops_orig_tab@arraycr: } +\cs_set_eq:NN \__cellprops_orig_tab@arraycr:n \tab@arraycr +\cs_set_nopar:Npn \tab@arraycr { \__cellprops_endrow:\__cellprops_orig_tab@arraycr:n } + \cs_set_eq:NN \__cellprops_orig_multicolumn:w \multicolumn \cs_set:Npn \multicolumn#1#2#3 { \__cellprops_orig_multicolumn:w {#1}{#2}{ -- cgit v1.2.3