summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/sdaps/sdapsarray.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/sdaps/sdapsarray.dtx')
-rw-r--r--macros/latex/contrib/sdaps/sdapsarray.dtx63
1 files changed, 43 insertions, 20 deletions
diff --git a/macros/latex/contrib/sdaps/sdapsarray.dtx b/macros/latex/contrib/sdaps/sdapsarray.dtx
index 185fc9b961..59cfffa097 100644
--- a/macros/latex/contrib/sdaps/sdapsarray.dtx
+++ b/macros/latex/contrib/sdaps/sdapsarray.dtx
@@ -1,14 +1,12 @@
% \iffalse meta-comment
%
-% Copyright (C) 2015 by Benjamin Berg <benjamin@sipsolutions.net>
+% Copyright (C) 2019 by Benjamin Berg <benjamin@sipsolutions.net>
%
% This work may be distributed and/or modified under the
-% conditions of the LaTeX Project Public License, either version 1.3
+% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
-% and version 1.3 or later is part of all distributions of LaTeX
-% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
@@ -260,6 +258,11 @@
\keys_set:nf { sdaps / array } { \prop_item:Nn \g__sdaps_array_layouter_prop { #1 } }
+ % Force cell layouter instead of column header layouter
+ \bool_if:NT \l_sdaps_sdapsarray_no_header_bool {
+ \tl_set:NV \l__sdaps_array_colhead_tl \l__sdaps_array_cell_tl
+ }
+
\_sdaps_array_open_tmpfiles:
\tl_gset_eq:NN \g__sdaps_array_last_row_tl \c_empty_tl
@@ -352,33 +355,49 @@
\msg_error:nn { sdapsarray } { wrong_mode }
\fi
- % Pagebreak detection
- \_sdaps_array_check_insert_header:N \g_tmpa_bool
% XXX: \l_tmpa_dim is the height to the first baseline in the box. Note that
% we use the real baseline in the case of the header row!
\l__sdaps_array_row_tl #1 #2 \l_tmpb_box \l_tmpa_dim
- \bool_if:NT \g_sdaps_array_first_row_bool {
- % Stow away the box for later use (before rewriting it to save the position)
+ \bool_if:nTF { \g_sdaps_array_first_row_bool && !\l_sdaps_sdapsarray_no_header_bool } {
+ % Stow away the box for later use
\box_gset_eq:NN \g__sdaps_array_header_box \l_tmpb_box
\dim_gset:Nn \g__sdaps_array_header_dim { \box_ht:N \g__sdaps_array_header_box + \box_dp:N \g__sdaps_array_header_box }
+ } {
+ % Pagebreak detection (not needed for header row)
+ \_sdaps_array_check_insert_header:N \g_tmpa_bool
+
+ \hbox_set:Nn \l_tmpb_box {
+ \pdfsavepos
+ \iow_shipout_x:Nn \g__sdaps_array_info_iow {
+ \thepage,
+ \the\pdflastxpos
+ }
+ \box_use:N \l_tmpb_box
+ }
}
- \hbox_set:Nn \l_tmpb_box {
- \pdfsavepos
- \iow_shipout_x:Nn \g__sdaps_array_info_iow {
- \thepage,
- \the\pdflastxpos
+ \bool_if:nTF { \g_sdaps_array_first_row_bool || \l_sdaps_sdapsarray_no_header_bool } {
+ \_sdaps_array_calc_interlineskip:nnN { \prevdepth } { \l_tmpa_dim } \l_tmpa_skip
+ \nointerlineskip
+ \skip_vertical:n { \l_tmpa_skip }
+
+ % However do not insert the rowskip in the case of the first line.
+ % We rely on surrounding code to insert proper spacing before/after
+ % the environment.
+ \bool_if:NT \g_sdaps_array_first_row_bool {
+ \skip_vertical:n { - \l_sdaps_sdapsarray_rowsep_dim }
}
+
\box_use:N \l_tmpb_box
- }
+ % For the header, insert a \nobreak, otherwise the normal inter-row penalty
+ \bool_if:NTF \l_sdaps_sdapsarray_no_header_bool {
+ \penalty\int_use:N\g_sdaps_array_row_penalty_tl
+ } {
+ \nobreak
+ }
- \bool_if:NTF \g_sdaps_array_first_row_bool {
\bool_gset_false:N \g_sdaps_array_first_row_bool
-
- \box_use:N \l_tmpb_box
- % Do not ever allow a break after the header line.
- \nobreak
} {
% The idea is simple. Before every line the header is re-inserted (either
% the real one or an empty box with the same dimensions). In the case that
@@ -757,6 +776,7 @@
\tl_new:N \l_sdaps_sdapsarray_angle_sine_tl
\dim_new:N \l_sdaps_sdapsarray_colsep_dim
\dim_new:N \l_sdaps_sdapsarray_rowsep_dim
+\bool_new:N \l_sdaps_sdapsarray_no_header_bool
\keys_define:nn { sdaps / sdapsarray }
{
@@ -770,6 +790,9 @@
keepenv .bool_set:N = \l_sdaps_sdapsarray_keepenv_bool,
keepenv .initial:n = false,
keepenv .default:n = true,
+ no_header .bool_set:N = \l_sdaps_sdapsarray_no_header_bool,
+ no_header .initial:n = false,
+ no_header .default:n = true,
angle .code:n = {
\int_set:Nn \l_sdaps_sdapsarray_angle_int {#1}
@@ -1104,7 +1127,7 @@
% (i.e. it could still be an alignment character). Execute the alignment
% code directly if the next character is &.
\bool_if:NF \l_sdaps_sdapsarray_keepenv_bool {
- \peek_charcode_remove:NT & { \sdaps_array_alignment: }
+ \peek_charcode_remove_ignore_spaces:NT & { \sdaps_array_alignment: }
}
}
{