diff options
Diffstat (limited to 'macros/latex/contrib/sdaps/sdapslayout.dtx')
-rw-r--r-- | macros/latex/contrib/sdaps/sdapslayout.dtx | 74 |
1 files changed, 17 insertions, 57 deletions
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 <henrimenke@gmail.com> -% Copyright (C) 2015-2016 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'. % @@ -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: } |