diff options
author | Karl Berry <karl@freefriends.org> | 2020-02-24 14:31:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-02-24 14:31:15 +0000 |
commit | 765b5b157bf87a50e461b2c952c85ccb3e5fae11 (patch) | |
tree | fbb54c88afa02bdf59b0822db874c99f78bf51b3 /Master/texmf-dist/tex/latex | |
parent | 4a831c7965c49963c69ac193d14032cb2104b3a3 (diff) |
xsim (23feb20)
git-svn-id: svn://tug.org/texlive/trunk@53893 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
8 files changed, 95 insertions, 33 deletions
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls b/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls index 3fa56cc833b..1171fe9dd24 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls +++ b/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls @@ -29,7 +29,7 @@ % please ignore the contents of this file -- it is not a good example for % coding... % -\ProvidesClass{xsim-manual}[2019/12/29] +\ProvidesClass{xsim-manual}[2020/02/23] \LoadClass[load-preamble,add-index]{cnltx-doc} \RequirePackage{imakeidx} @@ -103,6 +103,7 @@ ForEachUsedExerciseByID , GetExerciseAliasProperty , GetExerciseHeadingF , + GetExerciseIdForProperty , GetExerciseName , GetExerciseParameter , GetExerciseProperty , @@ -248,6 +249,7 @@ \RequirePackage[en-US]{datetime2} +\DTMlangsetup[en-US]{abbr} \newrobustcmd*\xsim@add@version[2]{\csdef{xsimversion#1}{\DTMdate{#2}}} \renewrobustcmd*\sinceversion[1]{% \cnltx@version@note{\GetTranslation{cnltx-introduced}~#1 (\csuse{xsimversion#1})}% @@ -796,23 +798,24 @@ \newcommand*\listlayouts{% \def\do##1{% - \begin{cnltxcode}[{title=Layout \enquote{\texttt{##1}}}] + \begin{cnltxcode}[{title=Layout \enquote{\texttt{##1}}\csuse{xsim@layout@description@##1}}] \ifcsdef{xsim@layout@extra@##1} {\csuse{xsim@layout@extra@##1}} {}% \xsimsetup{exercise/template={##1}} \let\marginpar\marginnote - \XSIMexpandcode{% - \printexercise{exercise}{\GetExerciseIdForProperty{ID}{showlayout}} - }% + \printexercise{exercise}{showlayout}% \end{cnltxcode} }% \dolistloop\xsim@layouts } -\NewDocumentCommand\xsim@add@layout{mo}{% +\NewDocumentCommand\xsim@add@layout{moo}{% \listadd\xsim@layouts{#1}% \IfNoValueF{#2}{\csdef{xsim@layout@extra@#1}{#2}}% + \IfNoValueTF{#3} + {\csdef{xsim@layout@description@#1}{}} + {\csdef{xsim@layout@description@#1}{ \footnotesize(#3)}}% } % ---------------------------------------------------------------------------- @@ -862,7 +865,10 @@ \xsim@add@layout{default} \xsim@add@layout{runin}[\renewcommand*\theexercise{\arabic{exercise}.}] \xsim@add@layout{margin}[\renewcommand*\theexercise{\arabic{exercise}.}] -\xsim@add@layout{minimal}[\renewcommand*\theexercise{\arabic{exercise}.}] +\xsim@add@layout{inline}[\renewcommand*\theexercise{\arabic{exercise}.}] +\xsim@add@layout{minimal}[\renewcommand*\theexercise{\arabic{exercise}.}][Like +\enquote{\texttt{inline}} but as own paragraph.] +\xsim@add@layout{centered}[\renewcommand*\theexercise{\arabic{exercise}.}] % ---------------------------------------------------------------------------- % versions: @@ -892,6 +898,7 @@ \xsim@add@version{0.16} {2019-11-10} \xsim@add@version{0.16a} {2020-01-16} \xsim@add@version{0.17} {2020-02-21} +\xsim@add@version{0.18} {2020-02-23} % ---------------------------------------------------------------------------- \newrobustcmd*\xsimauxfileinfo{% diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.environments.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.environments.code.tex index 37a3df68e99..ce4b281ba02 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim.environments.code.tex +++ b/Master/texmf-dist/tex/latex/xsim/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/Master/texmf-dist/tex/latex/xsim/xsim.interface.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.interface.code.tex index 0eb8535e3f7..b0ca92a1c47 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim.interface.code.tex +++ b/Master/texmf-dist/tex/latex/xsim/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/Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex index 825b8f25176..0bbc972f219 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex +++ b/Master/texmf-dist/tex/latex/xsim/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/Master/texmf-dist/tex/latex/xsim/xsim.random.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.random.code.tex index 2087adf9de3..422963792f3 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim.random.code.tex +++ b/Master/texmf-dist/tex/latex/xsim/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/Master/texmf-dist/tex/latex/xsim/xsim.solutions.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.solutions.code.tex index 902f377864f..2666d1aa864 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim.solutions.code.tex +++ b/Master/texmf-dist/tex/latex/xsim/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/Master/texmf-dist/tex/latex/xsim/xsim.sty b/Master/texmf-dist/tex/latex/xsim/xsim.sty index 0939f4796a2..8cd0f237960 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim.sty +++ b/Master/texmf-dist/tex/latex/xsim/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/Master/texmf-dist/tex/latex/xsim/xsim.style.layouts.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.style.layouts.code.tex index 11ab475b2a2..31f5810bce5 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim.style.layouts.code.tex +++ b/Master/texmf-dist/tex/latex/xsim/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 |