diff options
author | Norbert Preining <norbert@preining.info> | 2020-02-24 03:01:26 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-02-24 03:01:26 +0000 |
commit | 33f4ae660b866731387e4c21e528aaa283009d6c (patch) | |
tree | c1f1449987542917a209c7e108a1a48f81fc70e3 /macros/latex/contrib/xsim/code | |
parent | 0908ef0004729f1b45b8d9687656f2f92fc122ae (diff) |
CTAN sync 202002240301
Diffstat (limited to 'macros/latex/contrib/xsim/code')
7 files changed, 81 insertions, 26 deletions
diff --git a/macros/latex/contrib/xsim/code/xsim.environments.code.tex b/macros/latex/contrib/xsim/code/xsim.environments.code.tex index 37a3df68e9..ce4b281ba0 100644 --- a/macros/latex/contrib/xsim/code/xsim.environments.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.environments.code.tex @@ -427,7 +427,7 @@ } } } -\cs_generate_variant:Nn \xsim_insert:nnnn {nV,VV,nnnV,xx} +\cs_generate_variant:Nn \xsim_insert:nnnn {nV,VV,nnnV,xx,ne} % #1: type % #2: id diff --git a/macros/latex/contrib/xsim/code/xsim.interface.code.tex b/macros/latex/contrib/xsim/code/xsim.interface.code.tex index 0eb8535e3f..b0ca92a1c4 100644 --- a/macros/latex/contrib/xsim/code/xsim.interface.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.interface.code.tex @@ -513,10 +513,10 @@ { \xsim_foreach_exercise_id_type:nn {print} {#1} } \NewDocumentCommand \ForEachUsedExerciseByType {+m} - { \xsim_foreach_exercise_type_id:nn {use} {#1} } + { \xsim_foreach_exercise_type_id:nn {used} {#1} } \NewDocumentCommand \ForEachUsedExerciseByID {+m} - { \xsim_foreach_exercise_id_type:nn {use} {#1} } + { \xsim_foreach_exercise_id_type:nn {used} {#1} } % ---------------------------------------------------------------------------- @@ -553,10 +553,10 @@ { \group_begin: \keys_set:nn {xsim/random} {#1} - \xsim_print_random_list:VnV + \xsim_print_random_list:VnN \l_xsim_random_collection_tl {#2} - \l_xsim_random_exclude_list_tl + \l_xsim_random_exclude_list_clist \group_end: } @@ -610,22 +610,34 @@ % ---------------------------------------------------------------------------- \NewDocumentCommand \XSIMprint {mO{}mm} - { \xsim_insert:nnnn {#3} {#4} {#2} {#1} } + { \xsim_insert:nenn {#3} { \xsim_normalize_id:n {#4} } {#2} {#1} } \NewDocumentCommand \XSIMxprint {mO{}mm} - { \xsim_insert:xxnn {#3} {#4} {#2} {#1} } + { \xsim_insert:xxnn {#3} { \xsim_normalize_id:e {#4} } {#2} {#1} } \NewDocumentCommand \printexercise {O{}mm} - { \xsim_insert:nnnn {#2} {#3} {#1} {exercise} } + { + \clist_map_inline:nn {#3} + { \xsim_insert:nenn {#2} { \xsim_normalize_id:n {##1} } {#1} {exercise} } + } \NewDocumentCommand \xprintexercise {O{}mm} - { \xsim_insert:xxnn {#2} {#3} {#1} {exercise} } + { + \clist_map_inline:nn {#3} + { \xsim_insert:xxnn {#2} { \xsim_normalize_id:e {##1} } {#1} {exercise} } + } \NewDocumentCommand \printsolution {O{}mm} - { \xsim_insert:nnnn {#2} {#3} {#1} {solution} } + { + \clist_map_inline:nn {#3} + { \xsim_insert:nenn {#2} { \xsim_normalize_id:n {##1} } {#1} {solution} } + } \NewDocumentCommand \xprintsolution {O{}mm} - { \xsim_insert:xxnn {#2} {#3} {#1} {solution} } + { + \clist_map_inline:nn {#3} + { \xsim_insert:xxnn {#2} { \xsim_normalize_id:e {##1} } {#1} {solution} } + } % ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/xsim/code/xsim.properties.code.tex b/macros/latex/contrib/xsim/code/xsim.properties.code.tex index 825b8f2517..0bbc972f21 100644 --- a/macros/latex/contrib/xsim/code/xsim.properties.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.properties.code.tex @@ -447,6 +447,16 @@ { \prop_item:cn {g__xsim_property_#1_type_prop} {#2} } \cs_generate_variant:Nn \xsim_get_type_for_property:nn {nV} +% #1: id or ID +\cs_new:Npn \xsim_normalize_id:n #1 + { + \tl_if_blank:eTF + { \xsim_get_id_for_property:nn {ID} {#1} } + {#1} + { \xsim_get_id_for_property:nn {ID} {#1} } + } +\cs_generate_variant:Nn \xsim_normalize_id:n {e} + \cs_new:Npn \__xsim_get_property_tmp:n #1 {} \cs_generate_variant:Nn \__xsim_get_property_tmp:n {V} diff --git a/macros/latex/contrib/xsim/code/xsim.random.code.tex b/macros/latex/contrib/xsim/code/xsim.random.code.tex index 2087adf9de..422963792f 100644 --- a/macros/latex/contrib/xsim/code/xsim.random.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.random.code.tex @@ -40,7 +40,6 @@ \xsim_load_modules:n {collections} \tl_new:N \l_xsim_random_collection_tl -\tl_new:N \l_xsim_random_exclude_list_tl \tl_new:N \l__xsim_print_random_choice_tl \tl_const:Nn \c__xsim_print_random_both_tl {both} \tl_const:Nn \c__xsim_print_random_exercise_tl {exercise} @@ -49,6 +48,7 @@ \seq_new:N \l__xsim_allowed_exercise_ids_seq \int_new:N \g__xsim_random_list_id_int \bool_new:N \l__xsim_sort_random_bool +\clist_new:N \l_xsim_random_exclude_list_clist % #1: random list id % #2: csv list of integers @@ -106,8 +106,8 @@ % #1: collection % #2: number of items -% #3: csv list of excluded ids -\cs_new_protected:Npn \xsim_print_random_list:nnn #1#2#3 +% #3: clist variable of excluded ids +\cs_new_protected:Npn \xsim_print_random_list:nnN #1#2#3 { \xsim_if_collection_exist:nTF {#1} { @@ -122,7 +122,7 @@ { \xsim_get_type_for_property:nn {id} {##1} } \xsim_if_in_collection:nVnT {#1} \l__xsim_tmpa_tl {##1} { - \clist_if_in:nnF {#3} {##1} + \clist_if_in:NnF #3 {##1} { \seq_put_right:Nn \l__xsim_allowed_exercise_ids_seq {##1} } } } @@ -157,7 +157,7 @@ } { \msg_error:nnn {xsim} {unknown-collection} {#1} } } -\cs_generate_variant:Nn \xsim_print_random_list:nnn {VnV} +\cs_generate_variant:Nn \xsim_print_random_list:nnN {V} % #1: random list id % #2: max number to choose from @@ -299,8 +299,9 @@ } } \seq_remove_duplicates:N \l__xsim_tmpa_seq - \tl_set:Nx \l_xsim_random_exclude_list_tl - { \seq_use:Nn \l__xsim_tmpa_seq {,} } + \clist_set_from_seq:NN + \l_xsim_random_exclude_list_clist + \l__xsim_tmpa_seq } % use this in the exclude list: diff --git a/macros/latex/contrib/xsim/code/xsim.solutions.code.tex b/macros/latex/contrib/xsim/code/xsim.solutions.code.tex index 902f377864..2666d1aa86 100644 --- a/macros/latex/contrib/xsim/code/xsim.solutions.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.solutions.code.tex @@ -104,7 +104,8 @@ % ---------------------------------------------------------------------------- -% #1: conditional base function (three n args)% #2: name +% #1: conditional base function (three n args) +% #2: name % #3: code (refer to type and id with `#1' and `#2'), #3 refers to the boolean % properties use/print \cs_new_protected:Npn \xsim_new_solutions_condition:Nnn #1#2#3 @@ -270,7 +271,7 @@ { \bool_set_true:N \l__xsim_tmpa_bool } } { - \xsim_if_solutions_do:nnn {#4} {use} + \xsim_if_solutions_do:nnn {#4} {used} { \bool_set_true:N \l__xsim_tmpa_bool } } \tl_set:Nn \ExerciseType {#4} @@ -289,7 +290,7 @@ { \__xsim_print_entry:nn {#4} {##2} } } { - \xsim_if_solutions_do:nnn {#4} {use} + \xsim_if_solutions_do:nnn {#4} {used} { \__xsim_print_entry:nn {#4} {##2} } } #3 @@ -341,9 +342,9 @@ } } { - \xsim_foreach_exercise_id_type:nn {use} + \xsim_foreach_exercise_id_type:nn {used} { - \xsim_if_this_solution_do:nnnn {##1} {##2} {use} + \xsim_if_this_solution_do:nnnn {##1} {##2} {used} { \xsim_insert:nnnn {##1} {##2} {} {solution} } } } @@ -406,3 +407,5 @@ % ---------------------------------------------------------------------------- \file_input_stop: + +2020/02/23 - resolve bug #56 diff --git a/macros/latex/contrib/xsim/code/xsim.sty b/macros/latex/contrib/xsim/code/xsim.sty index 0939f4796a..8cd0f23796 100644 --- a/macros/latex/contrib/xsim/code/xsim.sty +++ b/macros/latex/contrib/xsim/code/xsim.sty @@ -29,9 +29,9 @@ \ExplSyntaxOn -\tl_const:Nn \c_xsim_date_tl {2020/02/21} +\tl_const:Nn \c_xsim_date_tl {2020/02/23} \tl_const:Nn \c_xsim_version_major_number_tl {0} -\tl_const:Nn \c_xsim_version_minor_number_tl {17} +\tl_const:Nn \c_xsim_version_minor_number_tl {18} \tl_const:Nn \c_xsim_version_subrelease_tl {} \tl_const:Nx \c_xsim_version_number_tl { diff --git a/macros/latex/contrib/xsim/code/xsim.style.layouts.code.tex b/macros/latex/contrib/xsim/code/xsim.style.layouts.code.tex index 11ab475b2a..31f5810bce 100644 --- a/macros/latex/contrib/xsim/code/xsim.style.layouts.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.style.layouts.code.tex @@ -73,7 +73,7 @@ } {\endtrivlist} -\DeclareExerciseEnvironmentTemplate{minimal} +\DeclareExerciseEnvironmentTemplate{inline} {% \textbf{\GetExerciseProperty{counter}}% \IfInsideSolutionF{% @@ -88,5 +88,34 @@ } {} +\DeclareExerciseEnvironmentTemplate{minimal} + {\par\UseExerciseTemplate{begin}{inline}} + {\UseExerciseTemplate{end}{inline}\par} + +\DeclareExerciseEnvironmentTemplate{centered} + {% + \par\vspace{\baselineskip} + \Needspace*{2\baselineskip} + \noindent + \hfil\textbf{\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}}% + \GetExercisePropertyT{subtitle}{ \textit{#1}}\hfil + \par\noindent + \IfInsideSolutionF{% + \GetExercisePropertyT{points}{% + \marginpar{% + \printgoal{\PropertyValue}% + \GetExercisePropertyT{bonus-points}{+\printgoal{\PropertyValue}}% + \,\IfExerciseGoalSingularTF{points} + {\XSIMtranslate{point}} + {\XSIMtranslate{points}}% + }% + }% + }% + } + {} + % ---------------------------------------------------------------------------- \endinput + +2020/02/23 - added: inline, centered + - adapt to removed \par from the generic environments |