summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-02-12 21:16:42 +0000
committerKarl Berry <karl@freefriends.org>2022-02-12 21:16:42 +0000
commit34ae39d969c759aab9b3d41b0bd830ab717e8b65 (patch)
tree5be7ffd55cd376ac091ec8cbd08f31db1490e8a7 /Master/texmf-dist/tex/latex
parente693cca0faa732710182c7d86d1663a62dcbeb7f (diff)
xsim (12feb22)
git-svn-id: svn://tug.org/texlive/trunk@61988 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim-manual.cls19
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.sty352
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.style.layouts.code.tex2
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsimverb.sty15
4 files changed, 276 insertions, 112 deletions
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls b/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls
index 6d09782c370..3d3a0839110 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls
+++ b/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls
@@ -6,9 +6,9 @@
% ----------------------------------------------------------------------------
% Clemens Niederberger
% Web: https://github.com/cgnieder/xsim
-% E-Mail: contact@mychemistry.eu
+% E-Mail: clemens@cnltx.de
% ----------------------------------------------------------------------------
-% Copyright 2017--2021 Clemens Niederberger
+% Copyright 2017--2022 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
@@ -51,7 +51,7 @@
the official successor of the \cnltxpackagenameformat{exsheets} package ,
url = https://github.com/cgnieder/xsim ,
authors = Clemens Niederberger ,
- email = contact@mychemistry.eu ,
+ email = clemens@cnltx.de ,
quote-format = \small\biolinumLF ,
add-cmds = {
blank ,
@@ -179,10 +179,12 @@
XSIMatenddocument ,
XSIMexpandcode ,
XSIMsetfilebegin ,
+ XSIMsetfilebeginX ,
XSIMfilewritestart ,
XSIMfilewritestop ,
XSIMgobblechars ,
XSIMsetfileend ,
+ XSIMsetfileendX ,
XSIMifblankT ,
XSIMifblankF ,
XSIMifblankTF ,
@@ -854,7 +856,7 @@
\begin{cnltxcode}[
step and label={examplefile}{example:##1} ,
sidebyside align=top seam,sidebyside,
- righthand width=.3\linewidth,
+ righthand width=5.2cm,
sidebyside gap=1em,
lower separated=false,
bottom=1mm,
@@ -872,9 +874,11 @@
type=pdf,
ext=.##1.pdf,
read=.##1.pdf,
- pagebox=cropbox,
- viewport=4.5cm 18.6cm 8.7cm 23cm,
- clip]{\xsim@example@pdffile@path}%
+ % pagebox=cropbox,
+ % viewport=4.5cm 18.6cm 8.7cm 23cm,
+ % clip
+ width=5cm
+ ]{\xsim@example@pdffile@path}%
}%
}%
\end{cnltxcode}
@@ -999,6 +1003,7 @@
\xsim@add@version{0.20a} {2021-02-01}
\xsim@add@version{0.20b} {2021-02-02}
\xsim@add@version{0.20c} {2021-02-03}
+\xsim@add@version{0.21} {2022-02-12}
% ----------------------------------------------------------------------------
\newrobustcmd*\xsimauxfileinfo{%
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.sty b/Master/texmf-dist/tex/latex/xsim/xsim.sty
index c8024775288..a178ceab61a 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.sty
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.sty
@@ -6,9 +6,9 @@
% ----------------------------------------------------------------------------
% Clemens Niederberger
% Web: https://github.com/cgnieder/xsim
-% E-Mail: contact@mychemistry.eu
+% E-Mail: clemens@cnltx.de
% ----------------------------------------------------------------------------
-% Copyright 2017--2021 Clemens Niederberger
+% Copyright 2017--2022 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
@@ -29,10 +29,10 @@
\ExplSyntaxOn
-\tl_const:Nn \c_xsim_date_tl {2021/02/03}
+\tl_const:Nn \c_xsim_date_tl {2022/02/12}
\tl_const:Nn \c_xsim_version_major_number_tl {0}
-\tl_const:Nn \c_xsim_version_minor_number_tl {20}
-\tl_const:Nn \c_xsim_version_subrelease_tl {c}
+\tl_const:Nn \c_xsim_version_minor_number_tl {21}
+\tl_const:Nn \c_xsim_version_subrelease_tl {}
\tl_const:Nx \c_xsim_version_number_tl
{
\c_xsim_version_major_number_tl .
@@ -248,7 +248,7 @@
\tl_if_exist:NF \c_xsim_version_tl
{ \tl_set:Nx \l__xsim_module_version_tl {\c_xsimverb_version_tl} }
-\hook_gput_code:nnn {package/after/xsim} {xsim}
+\hook_gput_code:nnn {package/xsim/after} {xsim}
{
\tl_set:NV \l__xsim_module_date_tl \c_xsim_date_tl
\tl_set:NV \l__xsim_module_version_tl \c_xsim_version_tl
@@ -376,6 +376,7 @@
\cs_generate_variant:Nn \file_input:n {V,x}
\cs_generate_variant:Nn \file_if_exist:nT {V,x}
\cs_generate_variant:Nn \file_if_exist:nTF {V}
+\cs_generate_variant:Nn \file_get_mdfive_hash:nN {V}
\cs_generate_variant:Nn \msg_error:nnnnn {nnnxx}
\cs_generate_variant:Nn \msg_warning:nnn {nnV}
\cs_generate_variant:Nn \keys_define:nn {nx}
@@ -386,6 +387,7 @@
\cs_generate_variant:Nn \tl_if_blank:nTF {f,e}
\cs_generate_variant:Nn \tl_set_rescan:Nnn {Nnx}
\cs_generate_variant:Nn \iow_now:Nn {NV}
+\cs_generate_variant:Nn \iow_open:Nn {NV}
\cs_generate_variant:Nn \str_if_eq:nnT {x}
\cs_generate_variant:Nn \str_if_eq:nnF {xx}
\cs_generate_variant:Nn \str_if_eq_p:nn {e}
@@ -554,7 +556,7 @@
{ \msg_expandable_error:nnn {xsim} {attribute-not-set} {#1::#2} }
}
}
-
+
% #1: attribute
% #2: item
\prg_new_conditional:Npnn \xsim_attribute_if_set:nn #1#2 {p,T,F,TF}
@@ -640,8 +642,15 @@
\xsim_if_use_aux:F
{
\iow_new:N \l__xsim_aux_file_iow
+ \tl_new:N \l__xsim_mdfive_hash_tl
+ \tl_const:Nx \c_xsim_auxfile_tl { \c_sys_jobname_str .xsim }
\hook_gput_code:nnn {begindocument} {xsim}
- { \iow_open:Nn \l__xsim_aux_file_iow { \c_sys_jobname_str .xsim } }
+ {
+ \file_get_mdfive_hash:VN
+ \c_xsim_auxfile_tl
+ \l__xsim_mdfive_hash_tl
+ \iow_open:NV \l__xsim_aux_file_iow \c_xsim_auxfile_tl
+ }
}
\cs_new_protected:Npn \xsim_close_aux:
@@ -649,6 +658,10 @@
\xsim_if_use_aux:F
{
\iow_close:N \l__xsim_aux_file_iow
+ \file_get_mdfive_hash:VN
+ \c_xsim_auxfile_tl
+ \l__xsim_tmpa_tl
+ \tl_if_eq:NNF \l__xsim_mdfive_hash_tl \l__xsim_tmpa_tl { \xsim_rerun: }
\legacy_if:nT {@filesw}
{ \iow_now:Nx \@auxout { \token_to_str:N \XSIM {readaux} } }
}
@@ -656,8 +669,8 @@
\xsim_new_aux_property:cpn {readaux}
{
- \file_if_exist:nT { \c_sys_jobname_str .xsim }
- { \file_input:n { \c_sys_jobname_str .xsim } }
+ \file_if_exist:VT \c_xsim_auxfile_tl
+ { \file_input:V \c_xsim_auxfile_tl }
}
% ----------------------------------------------------------------------------
@@ -717,7 +730,7 @@
{ \seq_gremove_all:cV {g__xsim_list_#1_seq} \l__xsim_tmpa_str }
\seq_gput_right:cV {g__xsim_list_#1_seq} \l__xsim_tmpa_str
}
-\cs_generate_variant:Nn \xsim_add_to_list:nn {nx}
+\cs_generate_variant:Nn \xsim_add_to_list:nn {nx,nV}
% #1: name
% #2: entry
@@ -1215,6 +1228,12 @@
{ \xsim_attribute_get:nn {#1!#2} {#3} }
\cs_generate_variant:Nn \xsim_get_property:nnn {nx,ne,xx,oo,no,nnf,nf,oof,nV}
+% #1: type
+% #2: id
+% #3: property
+\cs_new:Npn \xsim_show_property:nnn #1#2#3
+ { \xsim_attribute_show:nn {#1!#2} {#3} }
+
% #1: property
% #2: value
\cs_new:Npn \xsim_get_id_for_property:nn #1#2
@@ -1338,11 +1357,10 @@
}
\tl_new:N \l__xsim_file_name_signature_tl
-\tl_new:N \l__xsim_file_path_tl
-\tl_new:N \l__xsim_file_path_and_name_tl
-\tl_new:N \l__xsim_file_name_tl
+\tl_new:N \l_xsim_file_path_tl
+\tl_new:N \l_xsim_file_path_and_name_tl
+\tl_new:N \l_xsim_file_name_tl
\tl_new:N \l__xsim_file_extension_tl
-\tl_new:N \l__xsim_solution_tl
\bool_new:N \l__xsim_options_given_bool
\bool_new:N \l__xsim_insert_mode_bool
@@ -1361,7 +1379,7 @@
\keys_define:nn {xsim}
{
- path .tl_set:N = \l__xsim_file_path_tl ,
+ path .tl_set:N = \l_xsim_file_path_tl ,
file-extension .tl_set:N = \l__xsim_file_extension_tl ,
file-extension .initial:n = tex
}
@@ -1388,18 +1406,18 @@
% #1: type
% #2: id
% #3: exercise|solution
-\cs_new_protected:Npn \__xsim_set_file_signature:nnn #1#2#3
+\cs_new_protected:Npn \xsim_set_file_signature:nnn #1#2#3
{ \tl_set:Nn \l__xsim_file_name_signature_tl {#1-#2-#3} }
-\cs_generate_variant:Nn \__xsim_set_file_signature:nnn {nx,nV}
+\cs_generate_variant:Nn \xsim_set_file_signature:nnn {nx,nV}
-\tl_set:Nn \l__xsim_file_name_tl
+\tl_set:Nn \l_xsim_file_name_tl
{ \c_sys_jobname_str - \l__xsim_file_name_signature_tl -body . \l__xsim_file_extension_tl }
-\tl_set:Nn \l__xsim_file_path_and_name_tl
+\tl_set:Nn \l_xsim_file_path_and_name_tl
{
- \tl_if_blank:VF \l__xsim_file_path_tl
- { \l__xsim_file_path_tl / }
- \l__xsim_file_name_tl
+ \tl_if_blank:VF \l_xsim_file_path_tl
+ { \l_xsim_file_path_tl / }
+ \l_xsim_file_name_tl
}
% #1: type
@@ -1474,14 +1492,14 @@
{
\xsim_verbose:n
{ Starting~ to~ write~ #3~ environment~ type~ `#1'~ id~ `#2' }
- \__xsim_set_file_signature:nnn {#1} {#2} {#3}
+ \xsim_set_file_signature:nnn {#1} {#2} {#3}
\__xsim_file_info:nnnVV {#1} {#2} {#3}
- \l__xsim_file_name_tl
- \l__xsim_file_path_tl
+ \l_xsim_file_name_tl
+ \l_xsim_file_path_tl
\int_zero:N \l_xsim_line_gobble_int
\xsim_file_write_start:nV
{ \l__xsim_options_given_bool }
- \l__xsim_file_path_and_name_tl
+ \l_xsim_file_path_and_name_tl
}
\cs_new_protected:Npn \__xsim_write_environment_body_end:
@@ -1496,8 +1514,11 @@
{
\xsim_verbose:n { Saving~ #3~ environment~ type~ `#1'~ id~ `#2' }
\xsim_set_property:nnnn {#1} {#2} {#3-body} {#4}
- \xsim_if_exchange:nnnF {#1} {#2} {#3}
- { \xsim_set_property:nnnn {#1} {#2} {solution-body} {#4} }
+ \xsim_if_exchange:nnnT {#1} {#2} {#3}
+ {
+ \tl_if_eq:nnT {#3} {exercise}
+ { \xsim_set_property:nnnn {#1} {#2} {solution-body} {#4} }
+ }
}
\cs_new:Npn \__xsim_save_environment_body_end: { }
@@ -1609,9 +1630,9 @@
\xsim_if_write_to_files:TF
{
\xsim_if_exchange:nnnTF {#1} {#2} {#3}
- { \__xsim_set_file_signature:nnn {#1} {#2} {exercise} }
- { \__xsim_set_file_signature:nnn {#1} {#2} {#3} }
- \file_if_exist:VTF \l__xsim_file_path_and_name_tl
+ { \xsim_set_file_signature:nnn {#1} {#2} {exercise} }
+ { \xsim_set_file_signature:nnn {#1} {#2} {#3} }
+ \file_if_exist:VTF \l_xsim_file_path_and_name_tl
{ \prg_return_true: }
{ \prg_return_false: }
}
@@ -1654,15 +1675,15 @@
\cs_new_protected:Npn \xsim_input:nnn #1#2#3
{
\xsim_if_exchange:nnnTF {#1} {#2} {#3}
- { \__xsim_set_file_signature:nnn {#1} {#2} {exercise} }
- { \__xsim_set_file_signature:nnn {#1} {#2} {#3} }
+ { \xsim_set_file_signature:nnn {#1} {#2} {exercise} }
+ { \xsim_set_file_signature:nnn {#1} {#2} {#3} }
\xsim_if_write_to_files:TF
{
- \file_if_exist:VTF \l__xsim_file_path_and_name_tl
- { \file_input:V \l__xsim_file_path_and_name_tl }
+ \file_if_exist:VTF \l_xsim_file_path_and_name_tl
+ { \file_input:V \l_xsim_file_path_and_name_tl }
{
\xsim_verbose:n
- { File~ `\l__xsim_file_path_and_name_tl'~ doesn't~ exist. }
+ { File~ `\l_xsim_file_path_and_name_tl'~ doesn't~ exist. }
}
}
{
@@ -1671,7 +1692,7 @@
{ \xsim_get_property:nnn {#1} {#2} {#3-body} }
}
}
-\cs_generate_variant:Nn \xsim_input:nnn {oo}
+\cs_generate_variant:Nn \xsim_input:nnn {oo,nV}
\prg_new_conditional:Npnn \xsim_if_insert_mode: {T,F,TF}
{
@@ -1911,12 +1932,14 @@
\seq_new:c {l__xsim_chosen_tags_#1_seq}
\bool_new:c {l__xsim_ignore_untagged_#1_bool}
\bool_new:c {l____xsim_tagged_#1_bool}
+ \bool_new:c {l__xsim_use_unmatched_#1_bool}
\keys_define:nn {xsim}
{
#1/ignore-untagged .bool_set:c = {l__xsim_ignore_untagged_#1_bool} ,
#1/ignore-untagged .initial:n = true ,
- #1 .code:n =
- \seq_set_from_clist:cn {l__xsim_chosen_tags_#1_seq} {##1}
+ #1 .code:n = \seq_set_from_clist:cn {l__xsim_chosen_tags_#1_seq} {##1} ,
+ #1/use-unmatched .bool_set:c = {l__xsim_use_unmatched_#1_bool} ,
+ #1/use-unmatched .initial:n = false
}
\prg_new_protected_conditional:cpnn {xsim_if_#1_value:n} ##1 {T,F,TF}
{
@@ -2047,7 +2070,7 @@
{ \prg_return_true: }
{ \prg_return_false: }
}
-\prg_generate_conditional_variant:Nnn \xsim_has_tags:nnnn {nnVV} {T}
+\prg_generate_conditional_variant:Nnn \xsim_has_tags:nnnn {nnVV} {T,F}
% #1: exercise type
% #2: id
@@ -2067,6 +2090,59 @@
{ \prg_return_false: }
}
+% #1: exercise type
+% #2: id
+% #3: tag type
+\prg_new_protected_conditional:Npnn \xsim_if_tags_match:nnn #1#2#3 {T,F,TF}
+ {
+ \bool_set_false:c {l____xsim_tagged_#3_bool}
+ \seq_if_empty:cTF {l__xsim_chosen_tags_#3_seq}
+ { \bool_set_true:c {l____xsim_tagged_#3_bool} }
+ {
+ \seq_set_from_clist:Nx
+ \l__xsim_tmpa_seq
+ { \xsim_get_property:nnn {#1} {#2} {#3} }
+ \seq_if_empty:NTF \l__xsim_tmpa_seq
+ {
+ \bool_set_eq:cc
+ {l____xsim_tagged_#3_bool}
+ {l__xsim_ignore_untagged_#3_bool}
+ }
+ {
+ \seq_map_inline:Nn \l__xsim_tmpa_seq
+ {
+ \seq_if_in:cnT {l__xsim_chosen_tags_#3_seq} {##1}
+ {
+ \bool_set_true:c {l____xsim_tagged_#3_bool}
+ \seq_map_break:
+ }
+ }
+ }
+ }
+ \bool_if:cTF {l____xsim_tagged_#3_bool}
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+
+\prg_new_protected_conditional:Npnn \xsim_if_tagged_use:nn #1#2 {T,F,TF}
+ {
+ \bool_set_true:N \l____xsim_tagged_bool
+ \seq_map_inline:Nn \l__xsim_tag_types_seq
+ {
+ \xsim_if_tags_match:nnnF {#1} {#2} {##1}
+ {
+
+ \bool_if:cF {l__xsim_use_unmatched_##1_bool}
+ {
+ \bool_set_false:N \l____xsim_tagged_bool
+ \seq_map_break:
+ }
+ }
+ }
+ \bool_if:NTF \l____xsim_tagged_bool
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
% #1: exercise type
% #2: id
@@ -2492,6 +2568,8 @@
% ----------------------------------------------------------------------------
\xsim_new_list:n {types}
+\xsim_new_list:n {order}
+\xsim_at_end_document:n { \xsim_update_list:n {order} }
\xsim_new_list:n {idtypes}
% #1: true|false (fixed parameter)
@@ -2635,6 +2713,9 @@
\cs_new_protected:Npn \xsim_foreach_exercise_id:n #1
{ \int_step_inline:nnnn {1} {1} { \g_xsim_max_id_int } {#1} }
+\cs_new_protected:Npn \xsim_foreach_exercise_order:n #1
+ { \xsim_foreach_new_list_entry:nn {order} {#1} }
+
% #1: macro name
% #2: 0 to 9 times `n' (= number of arguments of internal item)
% #3: code; may contain a suiting \__xsim_loop_item:<nnn>
@@ -2681,6 +2762,16 @@
}
}
+\xsim_define_loop_macro:Nnn \xsim_foreach_exercise_type_order:nn
+ {nnnnnn}
+ {
+ \xsim_foreach_exercise_type:n
+ {
+ \xsim_foreach_exercise_order:n
+ { \__xsim_deliver_exercise_details:nnn {##1} {####1} {#1} }
+ }
+ }
+
\xsim_define_loop_macro:Nnn \xsim_foreach_exercise_id_type:nn
{nnnnnn}
{
@@ -2859,6 +2950,9 @@
% boolean:
\xsim_declare_property:nnnn
{ \c_false_bool } { \c_true_bool } { \c_false_bool } {#1}
+ % boolean:
+ \xsim_declare_property:nnnn
+ { \c_false_bool } { \c_true_bool } { \c_false_bool } {#1!}
% boolean, noupdate:
\xsim_declare_property:nnnn
{ \c_false_bool } { \c_true_bool } { \c_true_bool } {(#2)}
@@ -2927,36 +3021,44 @@
\prg_new_conditional:Npnn \xsim_exercise_if_use:nn #1#2 {T,F,TF}
{
- \xsim_if_boolean_property:nnnTF {#1} {#2} {(used)}
- { \prg_return_false: }
+ \xsim_if_boolean_property:nnnTF {#1} {#2} {use!}
+ { \prg_return_true: }
{
- \xsim_if_insert_mode:TF
- {
- \xsim_if_property_set:nnnTF {#1} {#2} {use}
- {
- \xsim_if_boolean_property:nnnTF {#1} {#2} {use}
- { \prg_return_true: }
- { \prg_return_false: }
- }
- {
- \bool_if:cTF {l__xsim_#1_exercise_use_bool}
- { \prg_return_false: }
- { \prg_return_true: }
- }
- }
+ \xsim_if_tagged_use:nnTF {#1} {#2}
{
- \xsim_if_property_set:nnnTF {#1} {#2} {use}
- {
- \xsim_if_boolean_property:nnnTF {#1} {#2} {use}
- { \prg_return_true: }
- { \prg_return_false: }
- }
+ \xsim_if_boolean_property:nnnTF {#1} {#2} {(used)}
+ { \prg_return_false: }
{
- \bool_if:cTF {l__xsim_#1_exercise_use_bool}
- { \prg_return_true: }
- { \prg_return_false: }
+ \xsim_if_insert_mode:TF
+ {
+ \xsim_if_property_set:nnnTF {#1} {#2} {use}
+ {
+ \xsim_if_boolean_property:nnnTF {#1} {#2} {use}
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ {
+ \bool_if:cTF {l__xsim_#1_exercise_use_bool}
+ { \prg_return_false: }
+ { \prg_return_true: }
+ }
+ }
+ {
+ \xsim_if_property_set:nnnTF {#1} {#2} {use}
+ {
+ \xsim_if_boolean_property:nnnTF {#1} {#2} {use}
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ {
+ \bool_if:cTF {l__xsim_#1_exercise_use_bool}
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ }
}
}
+ { \prg_return_false: }
}
}
\prg_generate_conditional_variant:Nnn \xsim_exercise_if_use:nn {nV} {T,TF}
@@ -2993,29 +3095,33 @@
\prg_new_conditional:Npnn \xsim_exercise_if_print:nn #1#2 {T,F,TF}
{
- \xsim_if_tagged:nnTF {#1} {#2}
+ \xsim_if_boolean_property:nnnTF {#1} {#2} {print!}
+ { \prg_return_true: }
{
- \xsim_if_insert_mode:TF
- { \prg_return_true: }
+ \xsim_if_tagged:nnTF {#1} {#2}
{
- \bool_if:cTF {l__xsim_#1_exercise_print_bool}
+ \xsim_if_insert_mode:TF
+ { \prg_return_true: }
{
- \xsim_if_property_set:nnnTF {#1} {#2} {print}
+ \bool_if:cTF {l__xsim_#1_exercise_print_bool}
+ {
+ \xsim_if_property_set:nnnTF {#1} {#2} {print}
+ {
+ \xsim_if_boolean_property:nnnTF {#1} {#2} {print}
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+ { \prg_return_true: }
+ }
{
\xsim_if_boolean_property:nnnTF {#1} {#2} {print}
{ \prg_return_true: }
{ \prg_return_false: }
}
- { \prg_return_true: }
- }
- {
- \xsim_if_boolean_property:nnnTF {#1} {#2} {print}
- { \prg_return_true: }
- { \prg_return_false: }
}
}
+ { \prg_return_false: }
}
- { \prg_return_false: }
}
\prg_generate_conditional_variant:Nnn \xsim_exercise_if_print:nn {nV} {T,TF}
@@ -3079,6 +3185,7 @@
}
\xsim_exercise_if_use:nVT {#1} \g_xsim_exercise_id_tl
{
+ \xsim_add_to_list:nV {order} \g_xsim_exercise_id_tl
\xsim_set_property:nVnn {#1} \g_xsim_exercise_id_tl {(used)} {true}
\xsim_set_property:nVnn {#1} \g_xsim_exercise_id_tl {used} {true}
\xsim_update_goals:nV {#1} \g_xsim_exercise_id_tl
@@ -3577,8 +3684,33 @@
\xsim_attribute_set:nnn {collection:conditions} {#1} {#2}
\seq_gput_right:Nn \g__xsim_collections_seq {#1}
\xsim_new_list:n {collection:#1}
+ \bool_new:c {l__xsim_collection_#1_condition_all_bool}
+ \keys_define:nn {xsim/collection/#1}
+ {
+ match-all .bool_set:c = {l__xsim_collection_#1_condition_all_bool} ,
+ match-all .initial:n = true ,
+ match-any .bool_set_inverse:c = {l__xsim_collection_#1_condition_all_bool}
+ }
+ \xsim_before_begin_document:n
+ {
+ \xsim_foreach_exercise_type:n
+ {
+ \int_new:c {g_xsim_collection_##1_in_#1_int}
+ \newcounter {total##1in#1}
+ }
+ }
\xsim_at_end_document:n
- { \xsim_update_list:n {collection:#1} }
+ {
+ \xsim_update_list:n {collection:#1}
+ \xsim_foreach_exercise_type:n
+ {
+ \xsim_write_to_aux:x
+ {
+ \token_to_str:N \setcounter {total##1in#1}
+ { \int_use:c {g_xsim_collection_##1_in_#1_int} }
+ }
+ }
+ }
}
}
@@ -3710,7 +3842,9 @@
% #3: ID
\prg_new_protected_conditional:Npnn \xsim_collection_conditions_if:nnn #1#2#3 {T,F,TF}
{
- \bool_set_false:N \l____xsim_collection_condition_bool
+ \bool_if:cTF {l__xsim_collection_#1_condition_all_bool}
+ { \bool_set_true:N \l____xsim_collection_condition_bool }
+ { \bool_set_false:N \l____xsim_collection_condition_bool }
\clist_set:Nx \l__xsim_tmpa_clist
{ \xsim_attribute_get:nn {collection:conditions} {#1} }
\clist_if_empty:NTF \l__xsim_tmpa_clist
@@ -3725,10 +3859,20 @@
{ \__xsim_get_condition_values:w ##1 \q_stop }
\xsim_if_tag_type_exist:VTF \l__xsim_tmpa_tl
{
- \xsim_has_tags:nnVVT {#2} {#3} \l__xsim_tmpa_tl \l__xsim_tmpb_tl
+ \bool_if:cTF {l__xsim_collection_#1_condition_all_bool}
{
- \bool_set_true:N \l____xsim_collection_condition_bool
- \clist_map_break:
+ \xsim_has_tags:nnVVF {#2} {#3} \l__xsim_tmpa_tl \l__xsim_tmpb_tl
+ {
+ \bool_set_false:N \l____xsim_collection_condition_bool
+ \clist_map_break:
+ }
+ }
+ {
+ \xsim_has_tags:nnVVT {#2} {#3} \l__xsim_tmpa_tl \l__xsim_tmpb_tl
+ {
+ \bool_set_true:N \l____xsim_collection_condition_bool
+ \clist_map_break:
+ }
}
}
{ \msg_warning:nnV {xsim} {tag-unknown} \l__xsim_tmpa_tl }
@@ -3770,6 +3914,7 @@
{ \clist_put_right:Nn \l__xsim_tmpa_clist {#1} }
\xsim_set_property:nnnV {#2} {#3} {collections} \l__xsim_tmpa_clist
\xsim_add_to_list:nn {collection:#1} {#2-#3}
+ \int_gincr:c {g_xsim_collection_#2_in_#1_int}
}
% ----------------------------------------------------------------------------
@@ -3825,15 +3970,17 @@
{
\clist_pop:NN \l__xsim_tmpa_clist \l__xsim_tmpa_tl
\clist_pop:NN \l__xsim_tmpb_clist \l__xsim_tmpb_tl
- \str_case:Vn \l__xsim_print_collection_choice_tl
- {
- {exercises} { \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {exercise} }
- {solutions} { \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {solution} }
- {both} {
- \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {exercise}
- \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {solution}
- }
- }
+ \str_case:Vn \l__xsim_print_collection_choice_tl
+ {
+ {exercises}
+ { \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {exercise} }
+ {solutions}
+ { \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {solution} }
+ {both} {
+ \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {exercise}
+ \xsim_insert:nVnn {##1} \l__xsim_tmpb_tl {} {solution}
+ }
+ }
}
}
}
@@ -3869,10 +4016,7 @@
\cs_set_protected:Npn \xsim_write_cloze_filled:n ##1 {#1} ,
filled-style .initial:n = \underline {#1} ,
style .meta:n =
- {
- blank-style = #1 ,
- filled-style = #1
- } ,
+ { blank-style = #1 , filled-style = #1 } ,
fill .bool_set:N = \l__xsim_fill_blank_bool ,
fill .initial:n = false ,
scale .tl_set:N = \l__xsim_blank_scale_tl ,
@@ -4996,6 +5140,14 @@
\tl_clear:N \XSIMtmp
}
+\NewDocumentCommand \ForEachUsedExerciseByOrder {+m}
+ {
+ \tl_set_eq:NN \XSIMtmp \ExerciseType
+ \xsim_foreach_exercise_type_order:nn {used} {#1}
+ \tl_set_eq:NN \ExerciseType \XSIMtmp
+ \tl_clear:N \XSIMtmp
+ }
+
% ----------------------------------------------------------------------------
\NewDocumentCommand \DeclareExerciseTranslations {mm}
@@ -5397,7 +5549,7 @@
{ \XSIMmixedcase { \GetExerciseParameter {exercise-name} } }
&
}
- \ForEachUsedExerciseByType
+ \ForEachUsedExerciseByOrder
{
\XSIMifeqT {#1} { \ExerciseTableType {#1} }
{
@@ -5417,7 +5569,7 @@
\XSIMtranslate {total} \\
\midrule \XSIMmixedcase { \XSIMtranslate {points} } &
}
- \ForEachUsedExerciseByType
+ \ForEachUsedExerciseByOrder
{
\XSIMifeqT {#1} { \ExerciseTableType {#1} }
{
@@ -5433,7 +5585,7 @@
\\ \midrule
\XSIMtranslate {reached} &
}
- \ForEachUsedExerciseByType
+ \ForEachUsedExerciseByOrder
{
\XSIMifeqT {#1} { \ExerciseTableType {#1} }
{ \XSIMputright \ExerciseTableCode {&} }
@@ -5465,7 +5617,7 @@
\XSIMtranslate {reached} \\
\midrule
}
- \ForEachUsedExerciseByType
+ \ForEachUsedExerciseByOrder
{
\XSIMifeqT {#1} { \ExerciseTableType {#1} }
{
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 120df82fef8..143f04a84c5 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
@@ -8,7 +8,7 @@
% Web: https://github.com/cgnieder/xsim
% E-Mail: contact@mychemistry.eu
% ----------------------------------------------------------------------------
-% Copyright 2017--2021 Clemens Niederberger
+% Copyright 2017--2022 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
diff --git a/Master/texmf-dist/tex/latex/xsim/xsimverb.sty b/Master/texmf-dist/tex/latex/xsim/xsimverb.sty
index 712440d4231..a81146719c6 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsimverb.sty
+++ b/Master/texmf-dist/tex/latex/xsim/xsimverb.sty
@@ -6,9 +6,9 @@
% ----------------------------------------------------------------------------
% Clemens Niederberger
% Web: https://github.com/cgnieder/xsim
-% E-Mail: contact@mychemistry.eu
+% E-Mail: clemens@cnltx.de
% ----------------------------------------------------------------------------
-% Copyright 2017--2021 Clemens Niederberger
+% Copyright 2017--2022 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
@@ -28,9 +28,9 @@
\RequirePackage {l3keys2e}
\ExplSyntaxOn
-\tl_const:Nn \c_xsimverb_date_tl {2021/01/31}
+\tl_const:Nn \c_xsimverb_date_tl {2022/02/12}
\tl_const:Nn \c_xsimverb_version_major_number_tl {0}
-\tl_const:Nn \c_xsimverb_version_minor_number_tl {3}
+\tl_const:Nn \c_xsimverb_version_minor_number_tl {4}
\tl_const:Nn \c_xsimverb_version_subrelease_tl {}
\tl_const:Nx \c_xsimverb_version_number_tl
{
@@ -288,6 +288,7 @@
}
% ----------------------------------------------------------------------------
+\cs_generate_variant:Nn \tl_set:Nn {Ne}
\NewDocumentCommand \XSIMfilewritestart {sm}
{
@@ -302,9 +303,15 @@
\NewDocumentCommand \XSIMsetfilebegin {+m}
{ \tl_set:Nn \l_xsim_file_begin_tl {#1} }
+\NewDocumentCommand \XSIMsetfilebeginX {+m}
+ { \tl_set:Ne \l_xsim_file_begin_tl {#1} }
+
\NewDocumentCommand \XSIMsetfileend {+m}
{ \tl_set:Nn \l_xsim_file_end_tl {#1} }
+\NewDocumentCommand \XSIMsetfileendX {+m}
+ { \tl_set:Ne \l_xsim_file_end_tl {#1} }
+
\NewDocumentCommand \XSIMgobblechars {m}
{ \int_set:Nn \l_xsim_line_gobble_int {#1} }