diff options
author | Norbert Preining <norbert@preining.info> | 2019-10-14 03:00:58 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-10-14 03:00:58 +0000 |
commit | 370853b6ba0be6e880b2f320268d4fefbd6aeef6 (patch) | |
tree | 6d5fc61b99808ac12a520651d0b2f9c59d2b0a94 /macros/latex/contrib/xsim/code | |
parent | 3afcae17b4a1a6dffbaa749a6fd0b6406c4d34a9 (diff) |
CTAN sync 201910140300
Diffstat (limited to 'macros/latex/contrib/xsim/code')
7 files changed, 73 insertions, 24 deletions
diff --git a/macros/latex/contrib/xsim/code/xsim.definitions.code.tex b/macros/latex/contrib/xsim/code/xsim.definitions.code.tex index 02fb1444f7..2a7add33de 100644 --- a/macros/latex/contrib/xsim/code/xsim.definitions.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.definitions.code.tex @@ -42,6 +42,11 @@ \DeclareExerciseParameter* {solution-counter} \DeclareExerciseParameter* {number} +% these are additional - but are used in the `default' environment +% template: +\DeclareExerciseParameter {exercise-heading} +\DeclareExerciseParameter {solution-heading} + % ---------------------------------------------------------------------------- % not exactly a user choice, must be present at various places: @@ -63,7 +68,9 @@ \DeclareExerciseProperty {sectioning} % those are additional and wouldn't *need* to be present except for -% pre-defined templates which make use of them: +% pre-defined templates which make use of them (the page and page-value +% property actually needs to be defined for xsim to be able to save the +% corresponding values): \DeclareExerciseProperty {subtitle} \DeclareExerciseProperty {points} \DeclareExerciseProperty {bonus-points} @@ -166,23 +173,25 @@ solution-name = \XSIMtranslate {solution} , solutions-name = \XSIMtranslate {solutions} , exercise-template = default , - solution-template = default + solution-template = default , + exercise-heading = \subsection* , + solution-heading = \subsection* } % ---------------------------------------------------------------------------- \DeclareExerciseEnvironmentTemplate {default} { - \subsection* - { - \XSIMmixedcase { \GetExerciseName } \nobreakspace - \GetExerciseProperty {counter} - \IfInsideSolutionF - { - \IfExercisePropertySetT {subtitle} - { ~ { \normalfont \itshape \GetExerciseProperty {subtitle} } } - } - } + \GetExerciseHeadingF { \subsection* } + { + \XSIMmixedcase { \GetExerciseName } \nobreakspace + \GetExerciseProperty {counter} + \IfInsideSolutionF + { + \IfExercisePropertySetT {subtitle} + { ~ { \normalfont \itshape \GetExerciseProperty {subtitle} } } + } + } \GetExercisePropertyT {points} { \marginpar @@ -195,7 +204,7 @@ } } } - {} + { \par } % ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/xsim/code/xsim.environments.code.tex b/macros/latex/contrib/xsim/code/xsim.environments.code.tex index b9235ba555..2aacf63f51 100644 --- a/macros/latex/contrib/xsim/code/xsim.environments.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.environments.code.tex @@ -350,9 +350,9 @@ \xsim_step_exercise_counter:nn {#1} {#2} \xsim_set_properties:nnx {#1} {#2} { - page-value = \arabic{page} , + page-value = \the\value{page} , page = \thepage , - section-value = \arabic{section} , + section-value = \the\value{section} , section = \thesection } } @@ -360,7 +360,7 @@ { \xsim_set_properties:nnx {#1} {#2} { - chapter-value = \arabic{chapter} , + chapter-value = \the\value{chapter} , chapter = \thechapter } } diff --git a/macros/latex/contrib/xsim/code/xsim.exercises.code.tex b/macros/latex/contrib/xsim/code/xsim.exercises.code.tex index 98cebe3eb3..0de63e0460 100644 --- a/macros/latex/contrib/xsim/code/xsim.exercises.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.exercises.code.tex @@ -364,7 +364,11 @@ \xsim_get_parameter:nn {#1} {exercise-env} / name .code:n = \xsim_set_parameter:nnn {#1} {exercise-name} {####1} , \xsim_get_parameter:nn {#1} {solution-env} / name - .code:n = \xsim_set_parameter:nnn {#1} {solution-name} {####1} + .code:n = \xsim_set_parameter:nnn {#1} {solution-name} {####1} , + \xsim_get_parameter:nn {#1} {exercise-env} / heading + .code:n = \xsim_set_parameter:nnn {#1} {exercise-heading} {####1} , + \xsim_get_parameter:nn {#1} {solution-env} / heading + .code:n = \xsim_set_parameter:nnn {#1} {solution-heading} {####1} } \xsim_new_environment:nn {#1} {exercise} \xsim_new_environment:nn {#1} {solution} diff --git a/macros/latex/contrib/xsim/code/xsim.interface.code.tex b/macros/latex/contrib/xsim/code/xsim.interface.code.tex index b8798e9c47..3331f6278a 100644 --- a/macros/latex/contrib/xsim/code/xsim.interface.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.interface.code.tex @@ -256,6 +256,21 @@ { \GetExerciseParameter {exercise-name} } } +\NewExpandableDocumentCommand \GetExerciseHeadingF {m} + { + \IfInsideSolutionTF + { + \IfExerciseParameterSetTF {solution-heading} + { \GetExerciseParameter {solution-heading} } + {#1} + } + { + \IfExerciseParameterSetTF {exercise-heading} + { \GetExerciseParameter {exercise-heading} } + {#1} + } + } + \NewDocumentCommand \GetExerciseBody {m} { \xsim_input:oon { \ExerciseType } { \ExerciseID } {#1} } @@ -632,7 +647,7 @@ % ---------------------------------------------------------------------------- -\NewDocumentCommand \xsimsetup {m} +\NewDocumentCommand \xsimsetup {+m} { \xsim_setup:n {#1} } % ---------------------------------------------------------------------------- diff --git a/macros/latex/contrib/xsim/code/xsim.modules.code.tex b/macros/latex/contrib/xsim/code/xsim.modules.code.tex index 3d94ca4b61..3b874dbad0 100644 --- a/macros/latex/contrib/xsim/code/xsim.modules.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.modules.code.tex @@ -204,11 +204,17 @@ \IfBooleanT {#1} { \ExplSyntaxOn } } -\cs_new_protected:Npn \xsim_style_options:nn #1#2 - { \keys_define:nn {xsim/#1} {#2} } +% \cs_new_protected:Npn \xsim_style_options:nn #1#2 +% { \keys_define:nn {xsim/#1} {#2} } -\NewDocumentCommand \loadxsimstyle {m} +\cs_new_protected:Npn \xsim_load_style:n #1 { \clist_map_inline:nn {#1} { \xsim_load_module:n {style.##1} } } +\keys_define:nn {xsim} + { load-style .code:n = \xsim_load_style:n {#1} } + +\NewDocumentCommand \loadxsimstyle {m} + { \xsim_load_style:n {#1} } + % -------------------------------------------------------------------------- \file_input_stop: diff --git a/macros/latex/contrib/xsim/code/xsim.sty b/macros/latex/contrib/xsim/code/xsim.sty index 01dcbd96b3..59992c37d8 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 {2019/10/06} +\tl_const:Nn \c_xsim_date_tl {2019/10/13} \tl_const:Nn \c_xsim_version_major_number_tl {0} -\tl_const:Nn \c_xsim_version_minor_number_tl {13} +\tl_const:Nn \c_xsim_version_minor_number_tl {14} \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 304316eed0..756a61e838 100644 --- a/macros/latex/contrib/xsim/code/xsim.style.layouts.code.tex +++ b/macros/latex/contrib/xsim/code/xsim.style.layouts.code.tex @@ -25,7 +25,7 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % ---------------------------------------------------------------------------- -\xsimstyle{layouts}[2017/09/14] +\xsimstyle{layouts}[2019/10/12] \RequirePackage{needspace} @@ -73,5 +73,20 @@ } {\endtrivlist} +\DeclareExerciseEnvironmentTemplate{minimal} + {% + \textbf{\GetExerciseProperty{counter}}% + \IfInsideSolutionF{% + \GetExercisePropertyT{points}{ % <<< notice the space + (\printgoal{\PropertyValue}% + \GetExercisePropertyT{bonus-points}{+\printgoal{\PropertyValue}}% + \,\IfExerciseGoalSingularTF{points} + {\XSIMtranslate{point}} + {\XSIMtranslate{points}})% + }% + } % <<< notice the space + } + {} + % ---------------------------------------------------------------------------- \endinput |