diff options
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/xsim/HISTORY | 23 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xsim/README | 8 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xsim/examples/xsim.issues-49.pdf | bin | 95608 -> 103971 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/xsim/examples/xsim.issues-49.tex | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-391530-exercises.tex | 12 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/xsim/xsim-manual.pdf | bin | 1353993 -> 1372251 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/xsim/xsim-manual.tex | 56 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/xsim/xsim-manual.cls | 19 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/xsim/xsim.sty | 352 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/xsim/xsim.style.layouts.code.tex | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/xsim/xsimverb.sty | 15 |
11 files changed, 350 insertions, 139 deletions
diff --git a/Master/texmf-dist/doc/latex/xsim/HISTORY b/Master/texmf-dist/doc/latex/xsim/HISTORY index 37068a327ab..b3ac707e962 100644 --- a/Master/texmf-dist/doc/latex/xsim/HISTORY +++ b/Master/texmf-dist/doc/latex/xsim/HISTORY @@ -5,9 +5,9 @@ XSIM -- eXercise Sheets IMproved -------------------------------------------------------------------------- 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 @@ -181,3 +181,22 @@ HISTORY: v0.20b 2021/02/02 - fix issue #78 v0.20c 2021/02/03 - fix issue #80 - add missing test in \xsim_if_exist:nnnTF + v0.21 2022/02/12 - make \__xsim_set_file_signature:nnn public + - make \l__xsim_file_path_and_name_tl, \l__xsim_file_name_tl + and \l__xsim_file_path_tl public + - introduce XSIMsetfilebeginX and XSIMsetfileendX (xsimverb) + - reduce comment line in automated comments in exercise and + solution files + - add option <tag>/use-unmatched + - document option `blank/fill' + - add counter foreach type and collection that holds the + number of exercises of a type in a collection + - fix issue #90 + - correct file hooks + - implement issue #88 + - fix issue #96 + - `use!' and `print!' had gone lost. Add them back in. + - add new options `match-all'/`match-any' for the collection + conditions. Resolves issue #94. + - new \ForEachUsedExerciseByOrder, used in the table + templates which resolves issue #85 diff --git a/Master/texmf-dist/doc/latex/xsim/README b/Master/texmf-dist/doc/latex/xsim/README index 7399405eaab..99a1f2cd5e5 100644 --- a/Master/texmf-dist/doc/latex/xsim/README +++ b/Master/texmf-dist/doc/latex/xsim/README @@ -1,15 +1,15 @@ -------------------------------------------------------------------------- -XSIM 2021/02/03 v0.20c -XSIMVERB 2021/01/31 v0.3 +XSIM 2022/02/12 v0.21 +XSIMVERB 2022/02/12 v0.4 eXercise Sheets IMproved -------------------------------------------------------------------------- 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 diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.issues-49.pdf b/Master/texmf-dist/doc/latex/xsim/examples/xsim.issues-49.pdf Binary files differindex 3ea1c70ace8..8ea46e93f00 100644 --- a/Master/texmf-dist/doc/latex/xsim/examples/xsim.issues-49.pdf +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.issues-49.pdf diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.issues-49.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.issues-49.tex index f9baf0a6015..b10d57a36a3 100644 --- a/Master/texmf-dist/doc/latex/xsim/examples/xsim.issues-49.tex +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.issues-49.tex @@ -9,7 +9,7 @@ \usepackage{tasks,fontawesome,fmtcount,multicol} \NewTasksEnvironment[label=\Alph*),label-width=12pt]{choices}[\choice] -\newcommand*\correct{\thetask\expanded{\SetExerciseProperty{choice}{\thetask}}} +\newcommand*\correct{\refstepcounter{task}\thetask\expanded{\SetExerciseProperty{choice}{\thetask}}} \NewTasksEnvironment[label=\Roman*,label-width=12pt]{options}[\option] diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-391530-exercises.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-391530-exercises.tex deleted file mode 100644 index 716921adc01..00000000000 --- a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-391530-exercises.tex +++ /dev/null @@ -1,12 +0,0 @@ -\begin{question} - Who is the Defence Minister? -\end{question} -\begin{question} - Who is the Home Minister? -\end{question} -\begin{question} - Who is the Finance Minister? -\end{question} -\begin{question} - Who is the External Affairs Minister? -\end{question} diff --git a/Master/texmf-dist/doc/latex/xsim/xsim-manual.pdf b/Master/texmf-dist/doc/latex/xsim/xsim-manual.pdf Binary files differindex 45529ae8d5f..4c701f0a5cb 100644 --- a/Master/texmf-dist/doc/latex/xsim/xsim-manual.pdf +++ b/Master/texmf-dist/doc/latex/xsim/xsim-manual.pdf diff --git a/Master/texmf-dist/doc/latex/xsim/xsim-manual.tex b/Master/texmf-dist/doc/latex/xsim/xsim-manual.tex index 00ad03acc8d..2b43735d366 100644 --- a/Master/texmf-dist/doc/latex/xsim/xsim-manual.tex +++ b/Master/texmf-dist/doc/latex/xsim/xsim-manual.tex @@ -1,5 +1,5 @@ -% !arara: pdflatex: { interaction: nonstopmode } -% !arara: biber +% arara: pdflatex: { interaction: nonstopmode } +% arara: biber % arara: pdflatex: { interaction: nonstopmode } % arara: pdflatex: { interaction: nonstopmode } % !arara: pdflatex: { interaction: nonstopmode } @@ -771,7 +771,8 @@ following code: \DeclareExerciseTagging{topics} \xsimsetup{tags/ignore-untagged=false} \end{sourcecode} -This means that these options are available: +For each new tag new options are defined and available. They are described +for the two predefined tags: \begin{options} \keyval{tags}{csv list of tags} Choose the set of tags whose associated exercises should be printed. @@ -783,6 +784,12 @@ This means that these options are available: \keybool{ignore-untagged}\Module{topics}\Default{true} If set to true exercises with no topics will be printed even if topics have been chosen with the option \option{topics}. + \keybool{use-unmatched}\Module{tags}\Default{false} + \sinceversion{0.21}If set to true exercises with no matching tags will be + used (i.e., for example the counter gets stepped). + \keybool{use-untagged}\Module{topics}\Default{true} + \sinceversion{0.21}If set to true exercises with no matching topics will + be used (i.e., for example the counter gets stepped). \end{options} It may happen that you choose certain tags for printing and want one or two @@ -981,6 +988,17 @@ collection can be printed as often as needed. exercises which fit the tags are automatically added to the new collection. \end{commands} +You\sinceversion{0.21} have a choice whether \emph{any} or \emph{all} of the +tags sould match. So \Oarg{topics=algebra,level=1} should probably match +\emph{all} conditions but the choice is up to you. For each defined collection +an option exists: +\begin{options} + \keybool{match-all}\Module{collection/\meta{name}}\Default{true} + If set to \code{true} \emph{all} conditions must be met. + \keybool{match-any}\Module{collection/\meta{name}}\Default{false} + The inverse option to \option{match-all}. If set to \code{true} \emph{any} of + the conditions must be met. +\end{options} \subsubsection{Activating collections} If a collection is not activated per default in can be activated (or @@ -999,7 +1017,7 @@ These commands do not influence exercises in other ways other than adding them to collections. \begin{commands} \command{collectexercises}[\marg{collection name}] - Activates the collection \meta{collection name} which now collects all + Activates the collectiocollectexercisesn \meta{collection name} which now collects all exercises until the collection is deactivated, starts a group with \cs*{begingroup} and sets the option \option{collect}, see below. \command{collectexercisesstop}[\marg{collection name}] @@ -1576,6 +1594,19 @@ yourself in order to achieve certain layouts\footnote{I plan to incorporate \item \code{\#5}: the \property{points} property of the exercise \item \code{\#6}: the \property{bonus-points} property of the exercise \end{itemize} + \command{ForEachUsedExerciseByOrder}[\marg{code}] + Loops\sinceversion{0.21} over each \emph{used} exercise ordered by the + exercise types and within each type by the order they have been used in + the document. Inside \meta{code} you can refer to several properties of + the corresponding exercise: + \begin{itemize} + \item \code{\#1}: the type of the exercise + \item \code{\#2}: the id of the exercise + \item \code{\#3}: the \property{counter} property of the exercise + \item \code{\#4}: the \property{subtitle} property of the exercise + \item \code{\#5}: the \property{points} property of the exercise + \item \code{\#6}: the \property{bonus-points} property of the exercise + \end{itemize} \command{ForEachPrintedExerciseByID}[\marg{code}] Loops over each \emph{printed} exercise order by the exercise id. Inside \meta{code} you can refer to several properties of the corresponding @@ -2148,7 +2179,7 @@ Those are the options for customization: Shortcut for setting both \option{blank-style} and \option{filled-style} at once. \keyval{scale}{decimal number}\Module{blank}\Default{\code{1}} -\textsc{} Scales the blank to \meta{decimal number} times its natural width. + Scales the blank to \meta{decimal number} times its natural width. \keyval{width}{dim}\Module{blank}\Default Sets the blank to a width of \meta{dim}. This takes precendence over \option{scale}. @@ -2161,7 +2192,10 @@ Those are the options for customization: end up with a non-ending compilation. Experiment with values to find the suiting one for your use case. \keyval{line-minimum-length}{dim}\Module{blank}\Default{\code{2em}} - The minimal length a line must have before it is built step by step. + The minimal length a line must have before it is built step by step. + \keybool{fill}\Module{blank}\Default{false} + If set to true, this will show the correct answers in the blanks within + an exercise as well. \end{options} \begin{example} @@ -2350,10 +2384,16 @@ also available in \xsim, too): This command can be used to write something to the external file \emph{before} the environment contents. Must be set before \cs{XSIMfilewritestart} in the \emph{begin} definition. + \command{XSIMsetfilebeginX}[\marg{code}] + \sinceversion{0.21}The same as \cs{XSIMsetfilebegin} but expands its + argument first. \command{XSIMsetfileend}[\marg{code}] This command can be used to write something to the external file \emph{after} the environment contents. Must be set before \cs{XSIMfilewritestart} in the \emph{begin} definition. + \command{XSIMsetfileendX}[\marg{code}] + \sinceversion{0.21}The same as \cs{XSIMsetfileend} but expands its + argument first. \command{XSIMgobblechars}[\marg{integer}] Determines how many characters are cut off of the beginning of each line of the environment body before it is written to the file. The default @@ -2368,8 +2408,8 @@ The following code shows an example of how to use those commands: \makeatletter \NewDocumentEnvironment{example}{o} {% - \XSIMsetfilebegin{\@percentchar\space file `\jobname.tmp'}% - \XSIMsetfileend{\@percentchar\space bye bye}% + \XSIMsetfilebeginX{\@percentchar\space file `\jobname.tmp'}% + \XSIMsetfileendX{\@percentchar\space bye bye}% \IfNoValueTF{#1} {\XSIMfilewritestart*{\jobname.tmp}} {\XSIMfilewritestart{\jobname.tmp}}% 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} } |