summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cellprops/cellprops.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-30 03:00:43 +0000
committerNorbert Preining <norbert@preining.info>2019-09-30 03:00:43 +0000
commitbbbe8128e7ae9d816a221377dbf5ff3969bb203b (patch)
tree0283a521760b879b30e61872f14f235645745675 /macros/latex/contrib/cellprops/cellprops.dtx
parent14ce8b68fe7df49e8a8891bb94c63b9a846da232 (diff)
CTAN sync 201909300300
Diffstat (limited to 'macros/latex/contrib/cellprops/cellprops.dtx')
-rw-r--r--macros/latex/contrib/cellprops/cellprops.dtx117
1 files changed, 64 insertions, 53 deletions
diff --git a/macros/latex/contrib/cellprops/cellprops.dtx b/macros/latex/contrib/cellprops/cellprops.dtx
index 1ee1a858b5..67b4dc8cd2 100644
--- a/macros/latex/contrib/cellprops/cellprops.dtx
+++ b/macros/latex/contrib/cellprops/cellprops.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
% vim: tw=80 spl=en
%
-%% File: cellprops.dtx (C) Copyright 2018 RIVAUD Julien
+%% File: cellprops.dtx (C) Copyright 2016-2019 RIVAUD Julien
%%
%% It may be distributed and/or modified under the conditions of the
%% General Public License (GPL), either version 3 of this
@@ -11,11 +11,11 @@
% The version of expl3 required is tested as early as possible, as
% some really old versions do not define \ProvidesExplPackage.
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\RequirePackage{expl3}[2016/01/19]
+\RequirePackage{expl3}[2018/06/19]
\def\ExplFileName{cellprops}
\def\ExplFileDescription{CSS-like cell and table properties}
-\def\ExplFileDate{2018/07/16}
-\def\ExplFileVersion{1.4}
+\def\ExplFileDate{2019/09/29}
+\def\ExplFileVersion{1.6}
%</driver|package>
%<*driver>
\documentclass[full]{l3doc}
@@ -103,12 +103,12 @@
% text-align: left;
% }
% }
-% \begin{array}{nnnn}
+% \begin{array}{nnnp{5em}}
% This is text & A_2 & A_3 & A_4 \\
% B1 & This is maths & B_3 & \\
% C1 & C_2 & X & Y \\
% D1 & D_2 & DX & v \\
-% E & F & \int_a^b f(t) dt & v \\
+% & F & \int_a^b f(t) dt & v \\
% \end{array}
% \]
% you can use:
@@ -274,17 +274,17 @@
% \end{description}
%
% Most of these properties are straight-forward. You should check a
-% CSSĀ documentation to get more information. A very good source is the Mozilla
+% CSS documentation to get more information. A very good source is the Mozilla
% Developer Network.
%
% Here are the supported column types:
% \begin{itemize}
% \item "n": The most basic cell type, hbox, honoring all properties.
-% \item "l", "c", and "r": Same as "n" but with forced "text-align".
-% \item "M"\<coltype>: Same as \<coltype> but enforces "math-mode: math". The
-% net effect is that "Mc" will create a centered column whose contents are
-% in non-display math mode.
-% \item "T"\<coltype>: Same as \<coltype> but enforces "math-mode: text".
+% \item "l", "c" and "r": Same as "n" but with forced "text-align".
+% \item "Ml", "Mc" and "Mr": Same as column "l", "c" and "r" but enforces
+% "math-mode: math". The net effect is that "Mc" will create a centered
+% column whose contents are in non-display math mode.
+% \item "T"\<align>: Same as "M"\<align> but enforces "math-mode: text".
% \item "p{"\<width>"}", "m"\<width> and "b"\<width>: parbox cell with the
% corresponding vertical alignment (\cs{vtop}, \cs{vcenter} or \cs{vbox}).
% \item "*{"\<count>"}{"\<coltypes>"}": same as in \pkg{array} or
@@ -361,6 +361,7 @@
\RequirePackage{xparse}
\RequirePackage{xcolor}
+\RequirePackage{etoolbox}
% \end{macrocode}
%
% \subsection{Loading and fixing \pkg{mdwtab}}
@@ -458,7 +459,7 @@
\seq_map_inline:Nn \l_tmpa_seq {
\tl_if_empty:nF {##1} {
\exp_args:NNV \seq_set_split:Nnn \l_tmpb_seq \c_colon_str {##1}
- \int_compare:nNnTF {\seq_count:N \l_tmpb_seq} = \c_two {
+ \int_compare:nNnTF {\seq_count:N \l_tmpb_seq} = { 2 } {
\seq_get_left:NN \l_tmpb_seq \l_tmpa_tl
\exp_args:NNV \str_set:Nn \l_tmpa_str \l_tmpa_tl
\seq_get_right:NN \l_tmpb_seq \l_tmpa_tl
@@ -516,7 +517,7 @@
\str_if_eq:nnTF {#2} {inherit} {
\@@_generic_setter:nnn \exp_not:n {#1} {\c_@@_inherit_color_tl}
}{
- \str_case_x:nnF { \str_range:nnn {#2} {1} {4} } {
+ \str_case_e:nnF { \str_range:nnn {#2} {1} {4} } {
{rgb(} {
\@@_generic_setter:nnn \use:n {#1} {
\exp_not:n {\color[RGB]} {\str_range:nnn {#2} {5} {-2}}
@@ -904,8 +905,36 @@
\exp_args:Nx \tab@preamble
{ \exp_not:N\@@_startrow: \the\tab@preamble \exp_not:N\@@_endrow: }
}
+% \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
+% \cs{@@_update_color:Nn} is to set the inherit fallback to the already
+% existing value of \verb|#1| then set \verb|#1| to the CSS value, which can be
+% the inherit variable.
+%
+% \begin{macrocode}
+\cs_new_protected_nopar:Nn \@@_update_color:Nn {
+ \@@_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
+ }
+}
-
+\cs_new_protected_nopar:Nn \@@_update_colors: {
+ \@@_update_color:Nn \l_@@_color_tl {color}
+ \@@_update_color:Nn \l_@@_bgcolor_tl {background-color}
+}
+% \end{macrocode}
+%
+% Patch the \cs{@array}, \cs{LT@array}, \cs{@mkpream}, \cs{endarray} and
+% \cs{endlongtable} commands, so that we can properly setup our line and column
+% counting system. This is the most brittle part of \pkg{cellprops}, and subject
+% to compatibility problems with other packages that patch those (\pkg{hyperref}
+% in particular).
+%
+% \begin{macrocode}
+\AtEndPreamble{%
\cs_set_eq:NN \@@_orig_array:w \@array
\cs_set_protected_nopar:Npn \@array[#1]#2 {
\@@_array_init:
@@ -926,26 +955,6 @@
\@@_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
-% \cs{@@_update_color:Nn} is to set the inherit fallback to the already
-% existing value of \verb|#1| then set \verb|#1| to the CSS value, which can be
-% the inherit variable.
-%
-% \begin{macrocode}
-\cs_new_protected_nopar:Nn \@@_update_color:Nn {
- \@@_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
- }
-}
-
-\cs_new_protected_nopar:Nn \@@_update_colors: {
- \@@_update_color:Nn \l_@@_color_tl {color}
- \@@_update_color:Nn \l_@@_bgcolor_tl {background-color}
-}
\cs_new_nopar:Nn \@@_end_array:n {
\tl_if_empty:NF \g_@@_borders_tl { \\ }
@@ -971,7 +980,7 @@
\bool_if:NF \g_@@_inrow_bool {
\bool_gset_true:N \g_@@_inrow_bool
\int_gincr:N \g_@@_row_int
- \int_gset_eq:NN \g_@@_col_int \c_one
+ \int_gset_eq:NN \g_@@_col_int \c_one_int
\dim_gzero:N \g_@@_ht_dim
\dim_gzero:N \g_@@_dp_dim
}
@@ -1013,6 +1022,8 @@
}
}
+}
+
\cs_new_nopar:Nn \@@_fix_valign_end:n {
\noalign{
\dim_set:Nn \l_tmpa_dim {#1}
@@ -1020,7 +1031,7 @@
\exp_args:NV \tl_if_eq:nnTF \tab@hlstate {b} {
\dim_gadd:Nn \tab@endheight { \g_@@_dp_dim + \l_tmpa_dim }
}{
- \int_compare:nNnT \g_@@_row_int = \c_one {
+ \int_compare:nNnT \g_@@_row_int = \c_one_int {
\dim_gadd:Nn \tab@endheight { \g_@@_ht_dim }
}
}
@@ -1118,7 +1129,7 @@
\@@_begin_raw_cell:n {
#1
\hbox_set:Nw \l_@@_cell_box
- \str_case_x:nnF {\@@_get_property:n {math-mode}} {
+ \str_case_e:nnF {\@@_get_property:n {math-mode}} {
{ text } { \tab@btext }
{ math } { \tab@bmaths }
}{% any other treated as |auto|
@@ -1128,7 +1139,7 @@
}
\cs_new_protected_nopar:Nn \@@_endcell: {
- \str_case_x:nnF {\@@_get_property:n {math-mode}} {
+ \str_case_e:nnF {\@@_get_property:n {math-mode}} {
{ text } { \tab@etext }
{ math } { \tab@emaths }
}{% any other treated as |auto|
@@ -1179,7 +1190,7 @@
#1
\hbox_set_end:
\@@_end_raw_cell:
- \spewnotes\hfil
+ \spewnotes
}
\cs_new_protected_nopar:Nn \@@_begin_raw_cell:n {
@@ -1341,17 +1352,7 @@
{\g_@@_dp_dim}
{\box_dp:N \l_@@_cell_box}
}
- % Handle hpadding and halign
- \skip_set:Nn \l_tmpa_skip {
- \dim_max:nn
- {0pt}
- { (\@@_get_property:n {min-width})
- - \box_wd:N \l_@@_cell_box }
- }
- \skip_add:Nn \l_tmpa_skip {
- 0pt plus 1fil
- }
- % padding-left and border-left
+ % Handle padding-left and border-left
\@@_get_border_info:n {left}
\skip_set:Nn \l_@@_left_skip
{\@@_get_property:n {padding-left} + \l_@@_border_width_dim}
@@ -1387,7 +1388,17 @@
\exp_not:n { \kern \c_zero_dim }
}
}
- \str_case_x:nnF {\@@_get_property:n {text-align}} {
+ % Handle hpadding and halign
+ \skip_set:Nn \l_tmpa_skip {
+ \dim_max:nn
+ {0pt}
+ { (\@@_get_property:n {min-width})
+ - \box_wd:N \l_@@_cell_box }
+ }
+ \skip_add:Nn \l_tmpa_skip {
+ 1sp plus 1fil
+ }
+ \str_case_e:nnF {\@@_get_property:n {text-align}} {
{ right } {
\skip_add:Nn \l_@@_left_skip { \l_tmpa_skip }
}
@@ -1415,7 +1426,7 @@
\group_end:
}
\skip_horizontal:N \l_@@_left_skip
- \box_use_clear:N \l_@@_cell_box
+ \box_use_drop:N \l_@@_cell_box
\skip_horizontal:N \l_@@_right_skip
\kern\c_zero_dim
\group_end: