From 7b19cae701283a0c7c6cb760c3b28ba912abdaea Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 16 Feb 2020 03:18:07 +0000 Subject: CTAN sync 202002160318 --- macros/latex/contrib/sdaps/README | 3 +- macros/latex/contrib/sdaps/sdapsarray.dtx | 63 +++++++++----- macros/latex/contrib/sdaps/sdapsarray.ins | 8 +- macros/latex/contrib/sdaps/sdapsarray.pdf | Bin 191217 -> 192001 bytes macros/latex/contrib/sdaps/sdapsbase.dtx | 24 ++++-- macros/latex/contrib/sdaps/sdapsbase.ins | 8 +- macros/latex/contrib/sdaps/sdapsbase.pdf | Bin 202251 -> 202996 bytes macros/latex/contrib/sdaps/sdapsclassic.dtx | 122 +++++++++++++++++++++------- macros/latex/contrib/sdaps/sdapsclassic.ins | 8 +- macros/latex/contrib/sdaps/sdapsclassic.pdf | Bin 173223 -> 174774 bytes macros/latex/contrib/sdaps/sdapslayout.dtx | 74 ++++------------- macros/latex/contrib/sdaps/sdapslayout.ins | 8 +- macros/latex/contrib/sdaps/sdapslayout.pdf | Bin 287460 -> 286999 bytes macros/latex/contrib/sdaps/sdapspdf.dtx | 6 +- macros/latex/contrib/sdaps/sdapspdf.ins | 8 +- macros/latex/contrib/sdaps/sdapspdf.pdf | Bin 144888 -> 144993 bytes 16 files changed, 180 insertions(+), 152 deletions(-) (limited to 'macros/latex/contrib/sdaps') diff --git a/macros/latex/contrib/sdaps/README b/macros/latex/contrib/sdaps/README index 3d955574b0..b5893766fd 100644 --- a/macros/latex/contrib/sdaps/README +++ b/macros/latex/contrib/sdaps/README @@ -1,11 +1,12 @@ SDAPS Class and Package repository ================================== +Version: 1.9.8 + This repository contains LaTeX classes and packages to create machine readable questionnaires. Metadata is generated for the whole document and it is possible to process created forms fully automatically using the SDAPS main program. -As of now, this package is included in the SDAPS unstable (1.9.0) distribution. Features ======== 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 +% Copyright (C) 2019 by Benjamin Berg % % 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: } } } { diff --git a/macros/latex/contrib/sdaps/sdapsarray.ins b/macros/latex/contrib/sdaps/sdapsarray.ins index 9acca30c07..e826845f84 100644 --- a/macros/latex/contrib/sdaps/sdapsarray.ins +++ b/macros/latex/contrib/sdaps/sdapsarray.ins @@ -2,12 +2,10 @@ %% Copyright (C) 2015 by Benjamin Berg %% %% 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'. %% @@ -26,12 +24,10 @@ This is a generated file. Copyright (C) 2015 by Benjamin Berg 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. \endpreamble diff --git a/macros/latex/contrib/sdaps/sdapsarray.pdf b/macros/latex/contrib/sdaps/sdapsarray.pdf index 3ff9734454..35f80796b9 100644 Binary files a/macros/latex/contrib/sdaps/sdapsarray.pdf and b/macros/latex/contrib/sdaps/sdapsarray.pdf differ diff --git a/macros/latex/contrib/sdaps/sdapsbase.dtx b/macros/latex/contrib/sdaps/sdapsbase.dtx index 94d86fd8cc..e97da6f2fc 100644 --- a/macros/latex/contrib/sdaps/sdapsbase.dtx +++ b/macros/latex/contrib/sdaps/sdapsbase.dtx @@ -1,14 +1,12 @@ % \iffalse meta-comment % -% Copyright (C) 2015 by Benjamin Berg +% Copyright (C) 2019 by Benjamin Berg % % 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'. % @@ -806,6 +804,7 @@ \dim_new:N \l_sdaps_checkbox_height_dim \tl_new:N \l_sdaps_checkbox_form_tl \tl_new:N \l_sdaps_checkbox_fill_tl +\tl_new:N \l_sdaps_checkbox_draw_tl \tl_new:N \l_sdaps_checkbox_var_tl \tl_new:N \l_sdaps_checkbox_value_tl \bool_new:N \l_sdaps_checkbox_draw_check_bool @@ -836,6 +835,9 @@ fill .tl_set:N = \l_sdaps_checkbox_fill_tl, fill .initial:n = { white }, + draw .tl_set:N = \l_sdaps_checkbox_draw_tl, + draw .initial:n = { . }, + draw_check .bool_set:N = \l_sdaps_checkbox_draw_check_bool, draw_check .default:n = true, draw_check .initial:n = false, @@ -900,10 +902,10 @@ \tikz[baseline={0.5\l_sdaps_checkbox_height_dim-0.8ex}]{% \tl_if_eq:VnT \l_sdaps_checkbox_form_tl { box } { - \draw[line~width=\l_sdaps_checkbox_linewidth_dim,fill=\l_sdaps_checkbox_fill_tl] (0.5\l_sdaps_checkbox_linewidth_dim, 0.5\l_sdaps_checkbox_linewidth_dim) rectangle +($(\l_sdaps_checkbox_width_dim, \l_sdaps_checkbox_height_dim)-(\l_sdaps_checkbox_linewidth_dim,\l_sdaps_checkbox_linewidth_dim)$);% + \draw[line~width=\l_sdaps_checkbox_linewidth_dim,fill=\l_sdaps_checkbox_fill_tl,draw=\l_sdaps_checkbox_draw_tl] (0.5\l_sdaps_checkbox_linewidth_dim, 0.5\l_sdaps_checkbox_linewidth_dim) rectangle +($(\l_sdaps_checkbox_width_dim, \l_sdaps_checkbox_height_dim)-(\l_sdaps_checkbox_linewidth_dim,\l_sdaps_checkbox_linewidth_dim)$);% } \tl_if_eq:VnT \l_sdaps_checkbox_form_tl { ellipse } { - \draw[line~width=\l_sdaps_checkbox_linewidth_dim,fill=\l_sdaps_checkbox_fill_tl] (0.5\l_sdaps_checkbox_width_dim, 0.5\l_sdaps_checkbox_height_dim) circle [x~radius=0.5\l_sdaps_checkbox_width_dim-0.5\l_sdaps_checkbox_linewidth_dim, y~radius=0.5\l_sdaps_checkbox_height_dim-0.5\l_sdaps_checkbox_linewidth_dim];% + \draw[line~width=\l_sdaps_checkbox_linewidth_dim,fill=\l_sdaps_checkbox_fill_tl,draw=\l_sdaps_checkbox_draw_tl] (0.5\l_sdaps_checkbox_width_dim, 0.5\l_sdaps_checkbox_height_dim) circle [x~radius=0.5\l_sdaps_checkbox_width_dim-0.5\l_sdaps_checkbox_linewidth_dim, y~radius=0.5\l_sdaps_checkbox_height_dim-0.5\l_sdaps_checkbox_linewidth_dim];% } % For the overlay we actually position the nodes relative to the checkbox @@ -1018,6 +1020,7 @@ \dim_new:N \l_sdaps_textbox_linewidth_dim \tl_new:N \l_sdaps_textbox_var_tl \tl_new:N \l_sdaps_textbox_fill_tl +\tl_new:N \l_sdaps_textbox_draw_tl \tl_new:N \l__sdaps_textbox_boxtype_tl @@ -1029,6 +1032,9 @@ fill .tl_set:N = \l_sdaps_textbox_fill_tl, fill .initial:n = { white }, + draw .tl_set:N = \l_sdaps_textbox_draw_tl, + draw .initial:n = { . }, + % Simple node overlay centered_text .tl_set:N = \l_sdaps_overlay_centered_text_tl, centered_text .initial:n = {}, @@ -1176,7 +1182,7 @@ \dim_set:Nn \l_sdaps_height_dim {\l__sdaps_height} % Draw the rectangle - \draw[line~width=\l_sdaps_textbox_linewidth_dim,fill=\l_sdaps_textbox_fill_tl] ($(\l_sdaps_x_dim, \l_sdaps_y_dim) + 0.5 * (\l_sdaps_textbox_linewidth_dim, -\l_sdaps_textbox_linewidth_dim)$) rectangle +($(\l_sdaps_width_dim, -\l_sdaps_height_dim) - (\l_sdaps_textbox_linewidth_dim, -\l_sdaps_textbox_linewidth_dim)$); + \draw[line~width=\l_sdaps_textbox_linewidth_dim,fill=\l_sdaps_textbox_fill_tl,draw=\l_sdaps_textbox_draw_tl] ($(\l_sdaps_x_dim, \l_sdaps_y_dim) + 0.5 * (\l_sdaps_textbox_linewidth_dim, -\l_sdaps_textbox_linewidth_dim)$) rectangle +($(\l_sdaps_width_dim, -\l_sdaps_height_dim) - (\l_sdaps_textbox_linewidth_dim, -\l_sdaps_textbox_linewidth_dim)$); \begin{scope} \seq_map_inline:Nn \g__sdaps_textbox_overlays_seq {##1} @@ -1267,7 +1273,7 @@ \dim_set:Nn \l_sdaps_height_dim {\l__sdaps_height} % Draw the rectangle - \draw[line~width=\l_sdaps_textbox_linewidth_dim,fill=\l_sdaps_textbox_fill_tl] ($(\l_sdaps_x_dim, \l_sdaps_y_dim) + 0.5 * (\l_sdaps_textbox_linewidth_dim, -\l_sdaps_textbox_linewidth_dim)$) rectangle +($(\l_sdaps_width_dim, -\l_sdaps_height_dim) - (\l_sdaps_textbox_linewidth_dim, -\l_sdaps_textbox_linewidth_dim)$); + \draw[line~width=\l_sdaps_textbox_linewidth_dim,fill=\l_sdaps_textbox_fill_tl,draw=\l_sdaps_textbox_draw_tl] ($(\l_sdaps_x_dim, \l_sdaps_y_dim) + 0.5 * (\l_sdaps_textbox_linewidth_dim, -\l_sdaps_textbox_linewidth_dim)$) rectangle +($(\l_sdaps_width_dim, -\l_sdaps_height_dim) - (\l_sdaps_textbox_linewidth_dim, -\l_sdaps_textbox_linewidth_dim)$); \begin{scope} \seq_map_inline:Nn \g__sdaps_textbox_overlays_seq {##1} @@ -1338,7 +1344,7 @@ % The textbox (rendered on the background) \begin{tikzpicture}[overlay] % Draw the rectangle - \draw[line~width=\l_sdaps_textbox_linewidth_dim,fill=\l_sdaps_textbox_fill_tl] ($(\l_sdaps_x_dim, \l_sdaps_y_dim) + 0.5 * (\l_sdaps_textbox_linewidth_dim, -\l_sdaps_textbox_linewidth_dim)$) rectangle +($(\l_sdaps_width_dim, -\l_sdaps_height_dim) - (\l_sdaps_textbox_linewidth_dim, -\l_sdaps_textbox_linewidth_dim)$); + \draw[line~width=\l_sdaps_textbox_linewidth_dim,fill=\l_sdaps_textbox_fill_tl,draw=\l_sdaps_textbox_draw_tl] ($(\l_sdaps_x_dim, \l_sdaps_y_dim) + 0.5 * (\l_sdaps_textbox_linewidth_dim, -\l_sdaps_textbox_linewidth_dim)$) rectangle +($(\l_sdaps_width_dim, -\l_sdaps_height_dim) - (\l_sdaps_textbox_linewidth_dim, -\l_sdaps_textbox_linewidth_dim)$); \begin{scope} \seq_map_inline:Nn \g__sdaps_textbox_overlays_seq {##1}% diff --git a/macros/latex/contrib/sdaps/sdapsbase.ins b/macros/latex/contrib/sdaps/sdapsbase.ins index 485de90df5..05f32682fc 100644 --- a/macros/latex/contrib/sdaps/sdapsbase.ins +++ b/macros/latex/contrib/sdaps/sdapsbase.ins @@ -2,12 +2,10 @@ %% Copyright (C) 2015 by Benjamin Berg %% %% 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'. %% @@ -26,12 +24,10 @@ This is a generated file. Copyright (C) 2015 by Benjamin Berg 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. \endpreamble diff --git a/macros/latex/contrib/sdaps/sdapsbase.pdf b/macros/latex/contrib/sdaps/sdapsbase.pdf index df99391a21..b65584ccbf 100644 Binary files a/macros/latex/contrib/sdaps/sdapsbase.pdf and b/macros/latex/contrib/sdaps/sdapsbase.pdf differ diff --git a/macros/latex/contrib/sdaps/sdapsclassic.dtx b/macros/latex/contrib/sdaps/sdapsclassic.dtx index d2f4002800..7694aa12ee 100644 --- a/macros/latex/contrib/sdaps/sdapsclassic.dtx +++ b/macros/latex/contrib/sdaps/sdapsclassic.dtx @@ -1,14 +1,12 @@ % \iffalse meta-comment % -% Copyright (C) 2015 by Benjamin Berg +% Copyright (C) 2019 by Benjamin Berg % % 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'. % @@ -290,7 +288,7 @@ %\setlength{\parskip}{0pt} \setlength\columnsep{10\p@} \setlength\columnseprule{0\p@} -% Redefine the spacings for \subsection ie. \questions. +% Redefine the spacings for \subsection ie. \_sdaps_classic_question. \renewcommand\section{\@startsection {section}{1}{\z@}% {-\parskip}% {\parskip}% @@ -341,7 +339,7 @@ \newcommand\qid{\tl_use:N \g__sdaps_questionnaire_id_tl} -\def\question#1{% +\def\_sdaps_classic_question#1{% \tl_if_empty:nTF{#1}{ \refstepcounter{subsection}% \par% @@ -471,7 +469,7 @@ \keys_set:nn { sdapsclassic / textbox } { #1 } \sdaps_classic_ensure_section: - \question{#3} + \_sdaps_classic_question{#3} \tl_if_empty:NTF \l_sdaps_classic_textbox_text_tl { \sdaps_qobject_begin:nnn { textbox } { Text } { #3 } @@ -571,7 +569,7 @@ \int_set:Nn \l_sdaps_singlemark_count_int { \themarkcheckboxcount } } - \question{#2}% + \_sdaps_classic_question{#2}% \sdaps_qobject_begin:nnn { singlemark } { range } { #2 } @@ -606,7 +604,7 @@ \int_set:Nn \l_sdaps_singlemark_count_int { \themarkcheckboxcount } } - \question{#2}% + \_sdaps_classic_question{#2}% \sdaps_qobject_begin:nnn { singlemark } { range } { #2 } @@ -634,6 +632,7 @@ \dim_new:N \l__sdaps_classic_choiceitem_pad_dim \int_new:N \l__sdaps_classic_choiceitem_cols_int \int_new:N \l__sdaps_classic_choiceitem_col_int +\dim_new:N \l__sdaps_classic_choicequestion_prevdepth_dim \coffin_new:N \l__sdaps_classic_choicequestion_coffin \msg_new:nnn { sdapsclassic } { choicequestion_wrong_mode } { Mode~should~always~be~vertical~inside~a~choicequestion.\\ This~likely~means~that~the~choicequestion~contains~content~other~than~one~of~the~permissable~macros. } @@ -692,7 +691,7 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \keys_set:nn { sdaps / choicequestion } { #1 } - \question{#2}% + \_sdaps_classic_question{#2}% % Setup the context \tl_if_eq:VnTF \l_sdaps_choicquestion_type_tl { multichoice } { @@ -716,6 +715,7 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \int_set:NV \l__sdaps_classic_choiceitem_cols_int \l_sdaps_choicequestion_cols_int \int_set:Nn \l__sdaps_classic_choiceitem_col_int { 0 } + \dim_set:Nn \l__sdaps_classic_choicequestion_prevdepth_dim { 1000pt } \coffin_clear:N \l__sdaps_classic_choicequestion_coffin % We have to be in vertical mode at this point. @@ -744,6 +744,7 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \choicequestion_widowpenalty \vbox:n { \skip_horizontal:N \@totalleftmargin \box_use:N \l__sdaps_classic_choicequestion_coffin } + \prevdepth=\l__sdaps_classic_choicequestion_prevdepth_dim \coffin_clear:N \l__sdaps_classic_choicequestion_coffin \sdaps_qobject_end:n { choicequestion } @@ -757,7 +758,7 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \endchoicequestion } -\cs_new_protected_nopar:Nn \_sdaps_classic_line_shipout_add:Nn +\cs_new_protected_nopar:Nn \_sdaps_classic_line_shipout_add:NNn { % We have to be in vertical mode at this point. \if_mode_vertical: @@ -767,11 +768,13 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \fi: % Is linewidth the right thing here? - \int_compare:nT { \l__sdaps_classic_choiceitem_col_int + #2 > \l__sdaps_classic_choiceitem_cols_int } { + \int_compare:nT { \l__sdaps_classic_choiceitem_col_int + #3 > \l__sdaps_classic_choiceitem_cols_int } { % We can only typeset a coffin in vertical mode if we use the box function \vbox:n { \skip_horizontal:N \@totalleftmargin \box_use:N \l__sdaps_classic_choicequestion_coffin } + \prevdepth=\l__sdaps_classic_choicequestion_prevdepth_dim \skip_vertical:N \l_sdaps_choicequestion_rowsep_dim \coffin_clear:N \l__sdaps_classic_choicequestion_coffin + \dim_set:Nn \l__sdaps_classic_choicequestion_prevdepth_dim { 1000pt } \choicequestion_clubpenalty \int_set:Nn \l__sdaps_classic_choiceitem_col_int { 0 } } @@ -779,8 +782,14 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \dim_set:Nn \l_tmpa_dim { \linewidth / \l__sdaps_classic_choiceitem_cols_int + \l__sdaps_classic_choiceitem_pad_dim / \l__sdaps_classic_choiceitem_cols_int } \dim_set:Nn \l_tmpa_dim { \l__sdaps_classic_choiceitem_col_int \l_tmpa_dim } + \dim_compare:nNnTF { \coffin_dp:N \l__sdaps_classic_choicequestion_coffin } > { \coffin_dp:N #1 } { + \dim_set:Nn \l__sdaps_classic_choicequestion_prevdepth_dim {\dim_min:nn { \l__sdaps_classic_choicequestion_prevdepth_dim } { #2 + \coffin_dp:N \l__sdaps_classic_choicequestion_coffin - \coffin_dp:N #1 } } + } { + \dim_set:Nn \l__sdaps_classic_choicequestion_prevdepth_dim {\dim_min:nn { \l__sdaps_classic_choicequestion_prevdepth_dim + \coffin_dp:N #1 - \coffin_dp:N \l__sdaps_classic_choicequestion_coffin } { #2 } } + } + \coffin_join:NnnNnnnn \l__sdaps_classic_choicequestion_coffin { l } { H } #1 { l } { H } { \l_tmpa_dim } { 0pt } - \int_add:Nn \l__sdaps_classic_choiceitem_col_int { #2 } + \int_add:Nn \l__sdaps_classic_choiceitem_col_int { #3 } } \providecommand*{\choiceitem}[2][]{% @@ -802,13 +811,16 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \hbox_set:Nn \l_tmpa_box { \strut \sdaps_checkbox:VV \l_sdaps_choicequestion_choice_var_tl \l_sdaps_choicequestion_choice_val_tl {}\ } \dim_set:Nn \l_tmpb_dim { \box_wd:N \l_tmpa_box } \hskip \l_sdaps_choicequestion_colsep_dim - \hbox_unpack_clear:N \l_tmpa_box + \hbox_unpack:N \l_tmpa_box \begin{minipage}[t]{\dim_eval:n { \l_tmpa_dim - \l_tmpb_dim - 2\l_sdaps_choicequestion_colsep_dim}} - \noindent \usekomafont{choiceitemfont} \tl_trim_spaces:n { #2 } + \noindent \usekomafont{choiceitemfont} \tl_trim_spaces:n { #2 }\strut + \par + \dim_gset:Nn \g_tmpa_dim { \dim_max:nn { \box_dp:N \l_tmpa_box } { \prevdepth } } + \unskip \end{minipage} } - \_sdaps_classic_line_shipout_add:Nn \l_tmpa_coffin { 1 } + \_sdaps_classic_line_shipout_add:NNn \l_tmpa_coffin \g_tmpa_dim { 1 } \ignorespaces } @@ -831,13 +843,16 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \hbox_set:Nn \l_tmpa_box { \strut \sdaps_checkbox:VV \l_sdaps_choicequestion_choice_var_tl \l_sdaps_choicequestion_choice_val_tl {}\ } \dim_set:Nn \l_tmpb_dim { \box_wd:N \l_tmpa_box } \hskip \l_sdaps_choicequestion_colsep_dim - \hbox_unpack_clear:N \l_tmpa_box + \hbox_unpack:N \l_tmpa_box \begin{minipage}[t]{\dim_eval:n { \l_tmpa_dim - \l_tmpb_dim - 2\l_sdaps_choicequestion_colsep_dim}} - \noindent \usekomafont{choiceitemfont} \tl_trim_spaces:n { #3 } + \noindent \usekomafont{choiceitemfont} \tl_trim_spaces:n { #3 }\strut + \par + \dim_gset:Nn \g_tmpa_dim { \dim_max:nn { \box_dp:N \l_tmpa_box } { \prevdepth } } + \unskip \end{minipage} } - \_sdaps_classic_line_shipout_add:Nn \l_tmpa_coffin { #2 } + \_sdaps_classic_line_shipout_add:NNn \l_tmpa_coffin \g_tmpa_dim { #2 } \ignorespaces } @@ -872,10 +887,13 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \dim_set:Nn \l_tmpb_dim { 0.5 \l_tmpb_dim + 0.8ex } \strut\ignorespaces \tl_trim_spaces:n { #4 } ~ \sdaps_textbox_hstretch:VVVnn \l_sdaps_choicequestion_choice_var_tl \l_tmpa_dim \l_tmpb_dim { 0pt } { 1 } + \par + \dim_gset:Nn \g_tmpa_dim { \prevdepth } + \unskip \end{minipage} } - \_sdaps_classic_line_shipout_add:Nn \l_tmpa_coffin { #3 } + \_sdaps_classic_line_shipout_add:NNn \l_tmpa_coffin \g_tmpa_dim { #3 } \ignorespaces } @@ -1050,12 +1068,30 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } % \begin{macrocode} % +\tl_new:N \l__sdaps_classic_group_var_tl +\tl_new:N \l__sdaps_classic_group_text_tl +\tl_new:N \l__sdaps_classic_group_extra_tl +\keys_define:nn { sdapsclassic / group } +{ + var .tl_set:N = \l__sdaps_classic_group_var_tl, + text .tl_set:N = \l__sdaps_classic_group_text_tl, +} \newenvironment { choicegroup } [ 2 ] [] { \group_begin: + \keys_set_known:nnN { sdapsclassic / group } { #1 } \l__sdaps_classic_group_extra_tl + + \_sdaps_classic_question{#2} + \tl_if_empty:NTF \l__sdaps_classic_group_text_tl { + \sdaps_qobject_begin:nnn { choicegroup } { Head } { #2 } + } { + \sdaps_qobject_begin:nnV { choicegroup } { Head } \l__sdaps_classic_group_text_tl + } - \question{#2} + \tl_if_empty:NF \l__sdaps_classic_group_var_tl { + \sdaps_qobject_append_var:V \l__sdaps_classic_group_var_tl + } % Undefine the question (and choice) commands in local scope so that they % can be redefined by choicearray without any issues. @@ -1063,7 +1099,7 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \cs_set_eq:NN\question\tex_undefined:D \cs_set_eq:NN\choice\tex_undefined:D - \begin{choicearray}[#1]{#2} + \expandafter\choicearray\expandafter[\l__sdaps_classic_group_extra_tl] % XXX: This is a bit of a hack, set in global scope because the choicearray % environment does evil things with scopes. \cs_gset_eq:NN\groupaddchoice\choice @@ -1073,15 +1109,27 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \cs_gset_eq:NN\groupaddchoice\undefined \cs_gset_eq:NN\choiceline\undefined - \end{choicearray} + \endchoicearray + + \sdaps_qobject_end:n { choicegroup } \group_end: } \newenvironment { optiongroup } [ 2 ] [] { \group_begin: + \keys_set_known:nnN { sdapsclassic / group } { #1 } \l__sdaps_classic_group_extra_tl - \question{#2} + \_sdaps_classic_question{#2} + \tl_if_empty:NTF \l__sdaps_classic_group_text_tl { + \sdaps_qobject_begin:nnn { optiongroup } { Head } { #2 } + } { + \sdaps_qobject_begin:nnV { optiongroup } { Head } \l__sdaps_classic_group_text_tl + } + + \tl_if_empty:NF \l__sdaps_classic_group_var_tl { + \sdaps_qobject_append_var:V \l__sdaps_classic_group_var_tl + } % Undefine the question (and choice) commands in local scope so that they % can be redefined by optionarray without any issues. @@ -1089,7 +1137,7 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \cs_set_eq:NN\question\tex_undefined:D \cs_set_eq:NN\choice\tex_undefined:D - \begin{optionarray}[#1]{#2} + \expandafter\optionarray\expandafter[\l__sdaps_classic_group_extra_tl] % XXX: This is a bit of a hack, set in global scope because the optionarray % environment does evil things with scopes. \cs_gset_eq:NN\groupaddchoice\choice @@ -1099,22 +1147,33 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } \cs_gset_eq:NN\groupaddoption\undefined \cs_gset_eq:NN\optionline\undefined - \end{optionarray} + \endoptionarray + \sdaps_qobject_end:n { optiongroup } \group_end: } \newenvironment { markgroup } [ 2 ] [] { \group_begin: + \keys_set_known:nnN { sdapsclassic / group } { #1 } \l__sdaps_classic_group_extra_tl - \question{#2} + \_sdaps_classic_question{#2} + \tl_if_empty:NTF \l__sdaps_classic_group_text_tl { + \sdaps_qobject_begin:nnn { markgroup } { Head } { #2 } + } { + \sdaps_qobject_begin:nnV { markgroup } { Head } \l__sdaps_classic_group_text_tl + } - % Undefine the question (and choice) commands in local scope so that they - % can be redefined by choicearray without any issues. + \tl_if_empty:NF \l__sdaps_classic_group_var_tl { + \sdaps_qobject_append_var:V \l__sdaps_classic_group_var_tl + } + + % Undefine the range command in local scope so that it can be redefined + % by rangearray without any issues. % Note that \cs_undefine:N works in global scope, so we cannot use it here. \cs_set_eq:NN\range\tex_undefined:D - \begin{rangearray}[#1]{#2} + \expandafter\rangearray\expandafter[\l__sdaps_classic_group_extra_tl] % XXX: This is a bit of a hack, set in global scope because the choicearray % environment does evil things with scopes. \cs_gset_eq:NN\markline\range @@ -1122,7 +1181,8 @@ you~can~get~similar~results~by~temporarily~changing~the~checkbox~style. } { \cs_gset_eq:NN\markline\undefined - \end{rangearray} + \endrangearray + \sdaps_qobject_end:n { markgroup } \group_end: } diff --git a/macros/latex/contrib/sdaps/sdapsclassic.ins b/macros/latex/contrib/sdaps/sdapsclassic.ins index 46aeca3506..a59dcbd001 100644 --- a/macros/latex/contrib/sdaps/sdapsclassic.ins +++ b/macros/latex/contrib/sdaps/sdapsclassic.ins @@ -2,12 +2,10 @@ %% Copyright (C) 2015 by Benjamin Berg %% %% 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'. %% @@ -26,12 +24,10 @@ This is a generated file. Copyright (C) 2015 by Benjamin Berg 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. \endpreamble diff --git a/macros/latex/contrib/sdaps/sdapsclassic.pdf b/macros/latex/contrib/sdaps/sdapsclassic.pdf index 0105d33275..fcb873935d 100644 Binary files a/macros/latex/contrib/sdaps/sdapsclassic.pdf and b/macros/latex/contrib/sdaps/sdapsclassic.pdf differ diff --git a/macros/latex/contrib/sdaps/sdapslayout.dtx b/macros/latex/contrib/sdaps/sdapslayout.dtx index 6788e55c5a..eed8031392 100644 --- a/macros/latex/contrib/sdaps/sdapslayout.dtx +++ b/macros/latex/contrib/sdaps/sdapslayout.dtx @@ -1,15 +1,13 @@ % \iffalse meta-comment % % Copyright (C) 2014 by Henry Menke -% Copyright (C) 2015-2016 by Benjamin Berg +% Copyright (C) 2019 by Benjamin Berg % % 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'. % @@ -112,8 +110,6 @@ \tl_new:N \l_sdaps_choicearray_qobject_type_tl \bool_new:N \l_sdaps_choicearray_horizontal_bool -\tl_new:N \l_sdaps_choicearray_var_tl -\tl_new:N \l_sdaps_choicearray_text_tl \tl_new:N \l_sdaps_choicearray_layouter_tl \tl_new:N \l_sdaps_choicearray_align_tl \tl_new:N \l_sdaps_choicearray_extra_tl @@ -136,8 +132,6 @@ horizontal .initial:n = true, vertical .bool_set_inverse:N = \l_sdaps_choicearray_horizontal_bool, vertical .default:n = true, - var .tl_set:N = \l_sdaps_choicearray_var_tl, - text .tl_set:N = \l_sdaps_choicearray_text_tl, layouter .tl_set:N = \l_sdaps_choicearray_layouter_tl, layouter .initial:n = default, align .tl_set:N = \l_sdaps_choicearray_align_tl, @@ -168,20 +162,10 @@ range .initial:n = {...} } -\cs_new_protected_nopar:Npn \_sdaps_choicearray_preprocess:nn #1#2 +\cs_new_protected_nopar:Npn \_sdaps_choicearray_preprocess:n #1 { \keys_set_known:nnN { sdaps / choicearray } { #1 } \l_sdaps_choicearray_extra_tl - \tl_if_empty:NTF \l_sdaps_choicearray_text_tl { - \sdaps_qobject_begin:nnn { choicearray } { Head } { #2 } - } { - \sdaps_qobject_begin:nnV { choicearray } { Head } \l_sdaps_choicearray_text_tl - } - - \tl_if_empty:NF \l_sdaps_choicearray_var_tl { - \sdaps_qobject_append_var:V \l_sdaps_choicearray_var_tl - } - \sdaps_checkbox_set_type:V \l_sdaps_choicearray_type_tl \tl_if_eq:VnTF \l_sdaps_choicearray_type_tl { multichoice } { \tl_set:Nn \l_sdaps_choicearray_qobject_type_tl { Choice } @@ -189,12 +173,7 @@ \tl_set:Nn \l_sdaps_choicearray_qobject_type_tl { Option } } } -\cs_generate_variant:Nn \_sdaps_choicearray_preprocess:nn { Vn } - -\cs_new_protected_nopar:Npn \_sdaps_choicearray_postprocess: -{ - \sdaps_qobject_end:n { choicearray } -} +\cs_generate_variant:Nn \_sdaps_choicearray_preprocess:n { V } \cs_new_protected_nopar:Npn \_sdaps_choicearray_process_choice_insert_tail_after:w { \bgroup @@ -375,8 +354,6 @@ % \begin{macrocode} -\tl_new:N \l_sdaps_rangearray_var_tl -\tl_new:N \l_sdaps_rangearray_text_tl \tl_new:N \l_sdaps_rangearray_align_tl \tl_new:N \l_sdaps_rangearray_extra_tl \int_new:N \l_sdaps_rangearray_rangecount_int @@ -387,14 +364,16 @@ \tl_new:N \g_sdaps_question_uppertext_tl \tl_new:N \g_sdaps_question_othertext_tl +\msg_new:nnn { sdapslayout } { option_not_supported } { The~#1~option~is~not~supported~by~this~environment. } + \keys_define:nn { sdaps / rangearray } { - var .tl_set:N = \l_sdaps_rangearray_var_tl, - text .tl_set:N = \l_sdaps_rangearray_text_tl, count .int_set:N = \l_sdaps_rangearray_rangecount_int, count .initial:n = 5, align .tl_set:N = \l_sdaps_rangearray_align_tl, align .initial:n = { }, + % Override and disallow flipping; it does not work currently + flip .code:n = { \msg_error:nnn { sdapslayout } { option_not_supported } { flip } }, other .bool_set:N = \l_sdaps_rangearray_other_bool, other .default:n = true, other .initial:n = false, @@ -409,28 +388,13 @@ other .tl_gset:N = \g_sdaps_question_othertext_tl, } -\cs_new_protected_nopar:Npn \_sdaps_rangearray_preprocess:nn #1#2 +\cs_new_protected_nopar:Npn \_sdaps_rangearray_preprocess:n #1 { \keys_set_known:nnN { sdaps / rangearray } { #1 } \l_sdaps_rangearray_extra_tl - \tl_if_empty:NTF \l_sdaps_rangearray_text_tl { - \sdaps_qobject_begin:nnn { rangearray } { Head } { #2 } - } { - \sdaps_qobject_begin:nnV { rangearray } { Head } \l_sdaps_rangearray_text_tl - } - \sdaps_checkbox_set_type:n { singlechoice } - - \tl_if_empty:NF \l_sdaps_rangearray_var_tl { - \sdaps_qobject_append_var:V \l_sdaps_rangearray_var_tl - } -} -\cs_generate_variant:Nn \_sdaps_rangearray_preprocess:nn { Vn } - -\cs_new_protected_nopar:Npn \_sdaps_rangearray_postprocess: -{ - \sdaps_qobject_end:n { rangearray } } +\cs_generate_variant:Nn \_sdaps_rangearray_preprocess:n { V } % Before/After the different parts @@ -683,7 +647,7 @@ % -\newenvironment { choicearray } [ 2 ] [] +\newenvironment { choicearray } [ 1 ] [] { \group_begin: @@ -700,7 +664,7 @@ } } - \_sdaps_choicearray_preprocess:Vn \l_tmpa_tl { #2 } + \_sdaps_choicearray_preprocess:V \l_tmpa_tl % Clear the variables \seq_gclear:N \g_sdaps_choices_filter_seq \seq_gclear:N \g_sdaps_choices_cell_seq @@ -724,21 +688,19 @@ { \endsdapsarray \group_end: - % Process keys - \_sdaps_choicearray_postprocess: \group_end: } -\newenvironment { optionarray } [ 2 ] [] +\newenvironment { optionarray } [ 1 ] [] { - \choicearray[singlechoice,#1] { #2 } + \choicearray[singlechoice,#1] } { \endchoicearray } -\newenvironment { rangearray } [ 2 ] [] +\newenvironment { rangearray } [ 1 ] [] { \group_begin: @@ -755,7 +717,7 @@ } } - \_sdaps_rangearray_preprocess:Vn \l_tmpa_tl { #2 } + \_sdaps_rangearray_preprocess:V \l_tmpa_tl \newcommand \range [ 1 ] [] { \_sdaps_rangearray_process_question:nw { ##1 } @@ -763,14 +725,12 @@ \group_begin: - \tl_set:Nx \l_tmpb_tl {keepenv,align=\l_sdaps_rangearray_align_tl,\l_sdaps_rangearray_extra_tl} + \tl_set:Nx \l_tmpb_tl {keepenv,align=\l_sdaps_rangearray_align_tl,no_header,\l_sdaps_rangearray_extra_tl} \expandafter\sdapsarray\expandafter[\l_tmpb_tl] } { \endsdapsarray \group_end: - % Process keys - \_sdaps_rangearray_postprocess: \group_end: } diff --git a/macros/latex/contrib/sdaps/sdapslayout.ins b/macros/latex/contrib/sdaps/sdapslayout.ins index c1656b754d..e7c1adcd8c 100644 --- a/macros/latex/contrib/sdaps/sdapslayout.ins +++ b/macros/latex/contrib/sdaps/sdapslayout.ins @@ -2,12 +2,10 @@ %% Copyright (C) 2015 by Benjamin Berg %% %% 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'. %% @@ -26,12 +24,10 @@ This is a generated file. Copyright (C) 2015 by Benjamin Berg 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. \endpreamble diff --git a/macros/latex/contrib/sdaps/sdapslayout.pdf b/macros/latex/contrib/sdaps/sdapslayout.pdf index f1f10773c6..be8a1aa4f3 100644 Binary files a/macros/latex/contrib/sdaps/sdapslayout.pdf and b/macros/latex/contrib/sdaps/sdapslayout.pdf differ diff --git a/macros/latex/contrib/sdaps/sdapspdf.dtx b/macros/latex/contrib/sdaps/sdapspdf.dtx index 76d0546abf..d243a260ef 100644 --- a/macros/latex/contrib/sdaps/sdapspdf.dtx +++ b/macros/latex/contrib/sdaps/sdapspdf.dtx @@ -1,15 +1,13 @@ % \iffalse meta-comment % % Copyright (C) 2014 by Henry Menke -% Copyright (C) 2015 by Benjamin Berg +% Copyright (C) 2019 by Benjamin Berg % % 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'. % diff --git a/macros/latex/contrib/sdaps/sdapspdf.ins b/macros/latex/contrib/sdaps/sdapspdf.ins index 96a5d913c5..f102772732 100644 --- a/macros/latex/contrib/sdaps/sdapspdf.ins +++ b/macros/latex/contrib/sdaps/sdapspdf.ins @@ -2,12 +2,10 @@ %% Copyright (C) 2015 by Benjamin Berg %% %% 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'. %% @@ -26,12 +24,10 @@ This is a generated file. Copyright (C) 2015 by Benjamin Berg 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. \endpreamble diff --git a/macros/latex/contrib/sdaps/sdapspdf.pdf b/macros/latex/contrib/sdaps/sdapspdf.pdf index 71199651ef..551fdf687c 100644 Binary files a/macros/latex/contrib/sdaps/sdapspdf.pdf and b/macros/latex/contrib/sdaps/sdapspdf.pdf differ -- cgit v1.2.3