From bd7d3c932c93859c248f542876101c00dd2fe6d7 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 7 Oct 2019 20:58:33 +0000 Subject: xsim (7oct19) git-svn-id: svn://tug.org/texlive/trunk@52314 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/xsim/README | 2 +- .../doc/latex/xsim/examples/xsim.texsx-338165.pdf | Bin 56889 -> 57235 bytes .../doc/latex/xsim/examples/xsim.texsx-338165.tex | 4 +- Master/texmf-dist/doc/latex/xsim/xsim.history | 1 + Master/texmf-dist/doc/latex/xsim/xsim_manual.pdf | Bin 1225761 -> 1220136 bytes Master/texmf-dist/doc/latex/xsim/xsim_manual.tex | 22 ++- Master/texmf-dist/tex/latex/xsim/xsim-manual.cls | 108 +++++++------ .../tex/latex/xsim/xsim.environments.code.tex | 171 +++++++++++++++++---- .../tex/latex/xsim/xsim.solutions.code.tex | 3 +- Master/texmf-dist/tex/latex/xsim/xsim.sty | 33 ++-- .../tex/latex/xsim/xsim.verbwrite.code.tex | 15 +- 11 files changed, 253 insertions(+), 106 deletions(-) diff --git a/Master/texmf-dist/doc/latex/xsim/README b/Master/texmf-dist/doc/latex/xsim/README index 722702fd3ca..5c33f5ca6cc 100644 --- a/Master/texmf-dist/doc/latex/xsim/README +++ b/Master/texmf-dist/doc/latex/xsim/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -XSIM 2019/09/30 v0.12 +XSIM 2019/10/06 v0.13 eXercise Sheets IMproved diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.pdf b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.pdf index f6557530a1d..4b5a09474d0 100644 Binary files a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.pdf and b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.pdf differ diff --git a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.tex b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.tex index e48d8880dab..a0b204f914e 100644 --- a/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.tex +++ b/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.tex @@ -8,9 +8,7 @@ \usepackage{xsim} \usepackage{tcolorbox} \tcbuselibrary{breakable, skins} -\settasks{ - counter-format = tsk. -} +\settasks{ label = \arabic*. } \DeclareExerciseEnvironmentTemplate{boxed} {% diff --git a/Master/texmf-dist/doc/latex/xsim/xsim.history b/Master/texmf-dist/doc/latex/xsim/xsim.history index a22d42ad031..c16a4ef7ec0 100644 --- a/Master/texmf-dist/doc/latex/xsim/xsim.history +++ b/Master/texmf-dist/doc/latex/xsim/xsim.history @@ -114,3 +114,4 @@ HISTORY: v0.12 2019/09/30 - add parameter versions for the plural forms of exercise and solution names - bug fixes (issues 37, 39, 43, 47) + v0.13 2019/10/06 - experimental package option `no-files' diff --git a/Master/texmf-dist/doc/latex/xsim/xsim_manual.pdf b/Master/texmf-dist/doc/latex/xsim/xsim_manual.pdf index bfd2c316412..b6fb1d329c8 100644 Binary files a/Master/texmf-dist/doc/latex/xsim/xsim_manual.pdf and b/Master/texmf-dist/doc/latex/xsim/xsim_manual.pdf differ diff --git a/Master/texmf-dist/doc/latex/xsim/xsim_manual.tex b/Master/texmf-dist/doc/latex/xsim/xsim_manual.tex index afc17fd68a2..9bf643e1ca6 100644 --- a/Master/texmf-dist/doc/latex/xsim/xsim_manual.tex +++ b/Master/texmf-dist/doc/latex/xsim/xsim_manual.tex @@ -128,6 +128,12 @@ meaning in this manual. probability of possibly faulty exercises after changes to the document.} The \option{final} option automatically disables this option. See also sections~\vref{sec:how-exerc-envir} and~\vref{sec:resolve-getting}. + \opt{no-files} + \sinceversion{0.13}This option prevents \xsim\ from writing the exercises + and solutions to external files. This will keep your working folder + ``clean'' but will also prevent using verbatim material in exercises and + solutions and will possibly slow processing further down. \emph{This + option is considered experimental. Feedback is very welcome.} \end{options} Those options are used the usual way as package option @@ -299,6 +305,19 @@ order to deal with this somehow \xsim\ offers the following option: \end{exercise} \end{sourcecode} +If\sinceversion{0.13} you don't like all the external files and the problems +which come with them \emph{and} if you don't need any verbatim or similar +material inside the exercises and solutions then you can use the following +package option: +\begin{options} + \opt{no-files} + This option prevents \xsim\ from writing the exercises and solutions to + external files. This will keep your working folder ``clean'' but will + also prevent using verbatim material in exercises and solutions and will + possibly slow processing further down. \emph{This option is considered + experimental. Feedback is very welcome.} +\end{options} + \begin{bewareofthedog} \xsim\ writes a lot of stuff to the auxfile for re-using information on subsequent compilations. If you add exercises, change properties \etc\ it @@ -557,8 +576,9 @@ others can be set using the optional argument of the exercise environment. This is better demonstrated with an example: \begin{example} + % \lipsum is provided by package `lipsum' \begin{exercise} - \lipsum[4] % from package `lipsum' + \lipsum[4] \verb+\GetExerciseProperty{id}+: \GetExerciseProperty{id} \par \verb+\GetExerciseAliasProperty{ID}+: \GetExerciseAliasProperty{ID} \par \verb+\GetExerciseProperty{ID}+: \GetExerciseProperty{ID} diff --git a/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls b/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls index 00bab726360..8d289452627 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls +++ b/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls @@ -263,6 +263,9 @@ } \def\libertine@figurestyle{LF} +\RequirePackage{amsmath} +\undef\lvert \undef\lVert +\undef\rvert \undef\rVert \RequirePackage[libertine]{newtxmath} \def\libertine@figurestyle{OsF} @@ -587,7 +590,7 @@ \RequirePackage{bookmark} \xsimsetup{ - clear-aux , + % clear-aux , path = exercises } @@ -688,7 +691,7 @@ \cs_set:Npn \__xsim_get_texwelt_number:w texwelt- #1 \q_stop: {#1} \cs_set:Npn \__xsim_get_golatex_number:w golatex- #1 \q_stop: {#1} -\newcommand* \xsim@example@links [1] { +\cs_new_protected:Npn \xsim@example@links #1 { \href { \xsim@example@texfile@path {#1} } { \color{white} [\TeX] } ~ \href { \xsim@example@pdffile@path {#1} } { \color{white} [PDF] } \tl_if_in:nnT {#1} {texsx} @@ -717,13 +720,20 @@ \newcounter{examplefile} \newcounter{examplefiles} -\newcommand*\xsim@add@example[1]{% +\newcommand*\xsim@add@example[2]{% \listadd\xsim@examplefiles{#1}% + \csdef{xsim@example@texfile@desc@#1}{#2}% \stepcounter{examplefiles}% } \newcommand*\listexamplefiles{% \def\xsim@example@texfile@path##1{./examples/xsim.##1.tex}% - \def\xsim@example@pdffile@path##1{./examples/{xsim.##1}.pdf}% + \def\xsim@example@pdffile@path{./examples/xsim}% + \def\xsim@example@desc##1{\csuse{xsim@example@texfile@desc@##1}}% + \def\xsim@example@title##1{% + Example~\theexamplefile: \xsim@example@desc{##1} + \\Links: \xsim@example@links{##1}\hfill File: \code{xsim.##1.tex}% + }% + \def\xsim@example@bookmark##1{Example~\theexamplefile\ (\xsim@example@desc{##1})}% \def\do##1{% \begin{cnltxcode}[ step and label={examplefile}{example:##1} , @@ -732,23 +742,22 @@ sidebyside gap=1em, lower separated=false, bottom=1mm, - % rightlower=0pt, - % halign lower=flush right, - % clip lower, - title=Example~\theexamplefile\ \enquote{\texttt{##1}} - \xsim@example@links{##1}% + title=\xsim@example@title{##1}% ] - \bookmark[level=2,dest=examplefile.\arabic{examplefile}]{Example~\theexamplefile\ (##1)}% - \lstinputlisting[style=cnltx,firstline=7,lastline=16]{\xsim@example@texfile@path{##1}} + \bookmark[level=2,dest=examplefile.\arabic{examplefile}]{\xsim@example@bookmark{##1}}% + \lstinputlisting[style=cnltx,firstline=7,lastline=15,firstnumber=7]{\xsim@example@texfile@path{##1}} \tcblower \fbox{% \href - {\xsim@example@pdffile@path{##1}} + {\xsim@example@pdffile@path.##1.pdf} {% \includegraphics[ + type=pdf, + ext=.##1.pdf, + read=.##1.pdf, pagebox=cropbox, - viewport=4.5cm 18cm 8.7cm 23.3cm, - clip]{\xsim@example@pdffile@path{##1}}% + viewport=4.5cm 18.6cm 8.7cm 23cm, + clip]{\xsim@example@pdffile@path}% }% }% \end{cnltxcode} @@ -756,41 +765,41 @@ \dolistloop\xsim@examplefiles } -\xsim@add@example{blanks} -\xsim@add@example{boxed-headings} -\xsim@add@example{code-and-output} -\xsim@add@example{collections} -\xsim@add@example{crossref} -\xsim@add@example{description-list} -\xsim@add@example{different-point-types} -\xsim@add@example{difficulties} -\xsim@add@example{hints} -\xsim@add@example{floating} -\xsim@add@example{grade-distribution} -\xsim@add@example{listings} -\xsim@add@example{multiplechoice} -\xsim@add@example{listofexercises} -\xsim@add@example{pointsums} -\xsim@add@example{randomexercises} -\xsim@add@example{various} -\xsim@add@example{texsx-13635} -\xsim@add@example{texsx-155630} -\xsim@add@example{texsx-199360} -\xsim@add@example{texsx-299534} -\xsim@add@example{texsx-305110} -\xsim@add@example{texsx-308883} -\xsim@add@example{texsx-338165} -\xsim@add@example{texsx-350028} -\xsim@add@example{texsx-369065} -\xsim@add@example{texsx-369636} -\xsim@add@example{texsx-369803} -\xsim@add@example{texsx-370642} -\xsim@add@example{texsx-391530} -\xsim@add@example{texsx-395273} -\xsim@add@example{texwelt-6698} -\xsim@add@example{texwelt-15093} -\xsim@add@example{golatex-80640} -\xsim@add@example{golatex-91339} +\xsim@add@example{blanks}{Create blank lines} +\xsim@add@example{boxed-headings}{Put headings in a box} +\xsim@add@example{code-and-output}{Create code examples} +\xsim@add@example{collections}{How to use collections} +\xsim@add@example{crossref}{Crossreferencing between problems and answers} +\xsim@add@example{description-list}{Exercises as a \code{description} list} +\xsim@add@example{different-point-types}{A custom point scheme} +\xsim@add@example{difficulties}{Difficulty levels} +\xsim@add@example{floating}{Floating exercises and a list of exercises} +\xsim@add@example{grade-distribution}{Using the grade distribution macros} +\xsim@add@example{hints}{Give hints} +\xsim@add@example{listings}{Use listings in exercises} +\xsim@add@example{listofexercises}{A custom list of exercises} +\xsim@add@example{multiplechoice}{Multiplechoice exercises} +\xsim@add@example{pointsums}{Sum of points} +\xsim@add@example{randomexercises}{Random exercises from a collection} +\xsim@add@example{various}{Various aspects of \xsim} +\xsim@add@example{texsx-13635}{Exercises like theorems} +\xsim@add@example{texsx-155630}{Random/custom order of exercises} +\xsim@add@example{texsx-199360}{Exercises and solutions in a \pkg*{tcolorbox}} +\xsim@add@example{texsx-299534}{Using \pkg*{pythontex}} +\xsim@add@example{texsx-305110}{Print solutions per chapter/section} +\xsim@add@example{texsx-308883}{Adapt how points are printed} +\xsim@add@example{texsx-338165}{Another \pkg*{tcolorbox} example} +\xsim@add@example{texsx-350028}{Fancy \pkg*{tcolorbox} and crossreferencing} +\xsim@add@example{texsx-369065}{Custom layout} +\xsim@add@example{texsx-369636}{An empty box for points} +\xsim@add@example{texsx-369803}{Layout adjustments} +\xsim@add@example{texsx-370642}{Minimalistic layout} +\xsim@add@example{texsx-391530}{Exercises and sub-exercises} +\xsim@add@example{texsx-395273}{Different aspects of exercises. Highlighted solutions} +\xsim@add@example{texwelt-6698}{Custom list of exercises} +\xsim@add@example{texwelt-15093}{Indicate difficulty level} +\xsim@add@example{golatex-80640}{Different versions for students and teachers} +\xsim@add@example{golatex-91339}{Another custom layout with rules} % ---------------------------------------------------------------------------- @@ -827,6 +836,7 @@ \xsim@add@version{0.10a} {2017-10-04} \xsim@add@version{0.11} {2018-02-12} \xsim@add@version{0.12} {2019-09-26} +\xsim@add@version{0.13} {2019-10-06} % ---------------------------------------------------------------------------- \endinput 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 49976aa53f2..b9235ba555e 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim.environments.code.tex +++ b/Master/texmf-dist/tex/latex/xsim/xsim.environments.code.tex @@ -29,6 +29,20 @@ \xsim_load_modules:n {templates,verbwrite} +\xsim_if_write_to_files:F + { + \xsim_declare_property:nnnn + { \c_false_bool } + { \c_false_bool } + { \c_false_bool } + {solution-body} + \xsim_declare_property:nnnn + { \c_false_bool } + { \c_false_bool } + { \c_false_bool } + {exercise-body} + } + \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 @@ -40,6 +54,9 @@ \tl_new:N \ExerciseText \tl_set:Nn \ExerciseText { \msg_error:nn {xsim} {only-in-solution} } +\cs_generate_variant:Nn \tl_set_rescan:Nnn {Nnx} +\cs_generate_variant:Nn \prop_put:Nnn {Nnx} + % ---------------------------------------------------------------------------- \msg_new:nnn {xsim} {only-in-solution} @@ -52,7 +69,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 } @@ -139,11 +156,29 @@ \cs_generate_variant:Nn \__xsim_file_info:nnnnn {nnnVV} % ---------------------------------------------------------------------------- +% #1: type +% #2: id +% #3: exercise|solution +% #4: potential environment body +\cs_new_protected:Npn \xsim_save_environment_body:nnnn #1#2#3#4 + { + \xsim_if_write_to_files:TF + { \__xsim_write_environment_body:nnn {#1} {#2} {#3} } + { \__xsim_save_environment_body:nnnn {#1} {#2} {#3} {#4} } + } +\cs_new_protected:Npn \xsim_save_environment_body_end: + { + \xsim_if_write_to_files:TF + { \__xsim_write_environment_body_end: } + { \__xsim_save_environment_body_end: } + } + +% writing to files: % #1: type % #2: id % #3: exercise|solution -\cs_new_protected:Npn \xsim_save_environment_body:nnn #1#2#3 +\cs_new_protected:Npn \__xsim_write_environment_body:nnn #1#2#3 { \xsim_verbose:n { Starting~ to~ write~ #3~ environment~ type~ `#1'~ id~ `#2' } @@ -157,9 +192,22 @@ \l__xsim_file_path_and_name_tl } -\cs_new_protected:Npn \xsim_save_environment_body_end: +\cs_new_protected:Npn \__xsim_write_environment_body_end: { \xsim_file_write_stop: } +% saving to property lists: +% #1: type +% #2: id +% #3: exercise|solution +% #4: environment body +\cs_new_protected:Npn \__xsim_save_environment_body:nnnn #1#2#3#4 + { + \xsim_verbose:n { Saving~ #3~ environment~ type~ `#1'~ id~ `#2' } + \xsim_set_property:nnnn {#1} {#2} {#3-body} {#4} + } + +\cs_new:Npn \__xsim_save_environment_body_end: { } + % ---------------------------------------------------------------------------- % #1: type % #2: exercise|solution @@ -206,9 +254,10 @@ % #1: type % #2: id % #3: exercise|solution -\cs_new_protected:Npn \xsim_start_environment:nnn #1#2#3 - { \xsim_save_environment_body:nnn {#1} {#2} {#3} } -\cs_generate_variant:Nn \xsim_start_environment:nnn {nV} +% #4: potential enironment body +\cs_new_protected:Npn \xsim_start_environment:nnnn #1#2#3#4 + { \xsim_save_environment_body:nnnn {#1} {#2} {#3} {#4} } +\cs_generate_variant:Nn \xsim_start_environment:nnnn {nV} % #1: type % #2: id @@ -237,12 +286,16 @@ {begin} { \xsim_get_parameter:nn {#1} {#3-template} } \xsim_use_hook:nnn {#1} {#3} {begin} - \file_if_exist:nTF { \exp_not:V \l__xsim_file_path_and_name_tl } - { \file_input:n { \exp_not:V \l__xsim_file_path_and_name_tl } } + \xsim_if_write_to_files:TF { - \xsim_verbose:n - { File~ `\l__xsim_file_path_and_name_tl'~ doesn't~ exist. } + \file_if_exist:nTF { \exp_not:V \l__xsim_file_path_and_name_tl } + { \file_input:n { \exp_not:V \l__xsim_file_path_and_name_tl } } + { + \xsim_verbose:n + { File~ `\l__xsim_file_path_and_name_tl'~ doesn't~ exist. } + } } + { \xsim_get_property:nnn {#1} {#2} {#3-body} } \xsim_use_hook:nnn {#1} {#3} {end} \xsim_use_template:nn {end} @@ -252,14 +305,36 @@ } } +% #1: type +% #2: id +% #3: exercise|solution +\prg_new_protected_conditional:Npnn \xsim_if_exists:nnn #1#2#3 {T,F,TF} + { + \xsim_if_write_to_files:TF + { + \__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: } + } + { + \xsim_if_property_exist:nTF {#3-body} + { + \xsim_if_property_set:nnnTF {#1} {#2} {#3-body} + { \prg_return_true: } + { \prg_return_false: } + } + { \prg_return_false: } + } + } + % #1: type % #2: id % #3: options % #4: exercise|solution \cs_new_protected:Npn \xsim_insert:nnnn #1#2#3#4 { - \__xsim_set_file_signature:nnn {#1} {#2} {#4} - \file_if_exist:VTF \l__xsim_file_path_and_name_tl + \xsim_if_exists:nnnTF {#1} {#2} {#4} { \xsim_verbose:n { Inserting~ #4~ type~ `#1'~ id~ `#2'. } @@ -294,9 +369,16 @@ } \str_if_eq:nnT {#4} {solution} { - \__xsim_set_file_signature:nnn {#1} {#2} {exercise} - \file_get:nnN {\l__xsim_file_path_and_name_tl} {} \ExerciseText - \tl_trim_spaces:N \ExerciseText + \xsim_if_write_to_files:TF + { + \__xsim_set_file_signature:nnn {#1} {#2} {exercise} + \file_get:nnN {\l__xsim_file_path_and_name_tl} {} \ExerciseText + \tl_trim_spaces:N \ExerciseText + } + { + \tl_set:Nx \ExerciseText + { \xsim_get_property:nnn {#1} {#2} {exercise-body} } + } } \use:x { @@ -315,8 +397,11 @@ \group_end: } { - \xsim_verbose:x - { File~ `\l__xsim_file_path_and_name_tl'~ doesn't~ exist. } + \xsim_if_write_to_files:T + { + \xsim_verbose:x + { File~ `\l__xsim_file_path_and_name_tl'~ doesn't~ exist. } + } } } \cs_generate_variant:Nn \xsim_insert:nnnn {nV,VV,nnnV} @@ -327,8 +412,12 @@ \cs_new_protected:Npn \xsim_input:nnn #1#2#3 { \group_begin: - \__xsim_set_file_signature:nnn {#1} {#2} {#3} - \file_input:n { \l__xsim_file_path_and_name_tl } + \xsim_if_write_to_files:TF + { + \__xsim_set_file_signature:nnn {#1} {#2} {#3} + \file_input:n { \l__xsim_file_path_and_name_tl } + } + { \xsim_get_property:nnn {#1} {#2} {#3-body} } \group_end: } \cs_generate_variant:Nn \xsim_input:nnn {oo} @@ -355,23 +444,46 @@ \xsim_new_hook:nnn {#1} {#2} {end} \xsim_new_hook:nnn {#1} {#2} {post} \xsim_new_hook:nnn {#1} {#2} {print-false} - \NewDocumentEnvironment - { \xsim_get_parameter:nn {#1} {#2-env} } {o} + \xsim_if_write_to_files:TF { - \IfNoValueTF {##1} + \NewDocumentEnvironment + { \xsim_get_parameter:nn {#1} {#2-env} } {!o} { - \bool_set_false:N \l__xsim_options_given_bool - \use:c {xsim_start_#2:nn} {#1} {} + \IfNoValueTF {##1} + { + \bool_set_false:N \l__xsim_options_given_bool + \use:c {xsim_start_#2:nn} {#1} {} + } + { + \bool_set_true:N \l__xsim_options_given_bool + \use:c {xsim_start_#2:nn} {#1} {##1} + } + \xsim_start_environment:nVnn {#1} \g_xsim_exercise_id_tl {#2} { } } { - \bool_set_true:N \l__xsim_options_given_bool - \use:c {xsim_start_#2:nn} {#1} {##1} + \xsim_stop_environment:nVn {#1} \g_xsim_exercise_id_tl {#2} + \use:c {xsim_stop_#2:n} {#1} } - \xsim_start_environment:nVn {#1} \g_xsim_exercise_id_tl {#2} } { - \xsim_stop_environment:nVn {#1} \g_xsim_exercise_id_tl {#2} - \use:c {xsim_stop_#2:n} {#1} + \NewDocumentEnvironment + { \xsim_get_parameter:nn {#1} {#2-env} } {o+b} + { + \IfNoValueTF {##1} + { + \bool_set_false:N \l__xsim_options_given_bool + \use:c {xsim_start_#2:nn} {#1} {} + } + { + \bool_set_true:N \l__xsim_options_given_bool + \use:c {xsim_start_#2:nn} {#1} {##1} + } + \xsim_start_environment:nVnn {#1} \g_xsim_exercise_id_tl {#2} {##2} + } + { + \xsim_stop_environment:nVn {#1} \g_xsim_exercise_id_tl {#2} + \use:c {xsim_stop_#2:n} {#1} + } } } @@ -379,3 +491,4 @@ \file_input_stop: 2019/02/17 - fix issue #43 +2019/10/03 - add possibility to save environment bodies to property 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 fda5152a50c..23e48d75f4e 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim.solutions.code.tex +++ b/Master/texmf-dist/tex/latex/xsim/xsim.solutions.code.tex @@ -82,8 +82,7 @@ % #2: id \prg_new_protected_conditional:Npnn \xsim_if_solution_exists:nn #1#2 {T,F,TF} { - \__xsim_set_file_signature:nnn {#1} {#2} {solution} - \file_if_exist:VTF \l__xsim_file_path_and_name_tl + \xsim_if_exists:nnnTF {#1} {#2} {solution} { \prg_return_true: } { \prg_return_false: } } diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.sty b/Master/texmf-dist/tex/latex/xsim/xsim.sty index 8570e7a186f..01dcbd96b37 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim.sty +++ b/Master/texmf-dist/tex/latex/xsim/xsim.sty @@ -25,13 +25,13 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % ---------------------------------------------------------------------------- -\RequirePackage {expl3,xparse} +\RequirePackage {expl3,xparse,l3keys2e} \ExplSyntaxOn -\tl_const:Nn \c_xsim_date_tl {2019/09/30} +\tl_const:Nn \c_xsim_date_tl {2019/10/06} \tl_const:Nn \c_xsim_version_major_number_tl {0} -\tl_const:Nn \c_xsim_version_minor_number_tl {12} +\tl_const:Nn \c_xsim_version_minor_number_tl {13} \tl_const:Nn \c_xsim_version_subrelease_tl {} \tl_const:Nx \c_xsim_version_number_tl { @@ -58,24 +58,25 @@ \bool_new:N \g_xsim_final_bool \bool_new:N \g_xsim_verbose_bool \bool_new:N \g_xsim_clear_aux_bool +\bool_new:N \l__xsim_write_to_file_bool -\keys_define:nn {xsim} +\keys_define:nn {xsim/package} { - final .bool_gset:N = \g_xsim_final_bool , - verbose .bool_gset:N = \g_xsim_verbose_bool , - clear-aux .bool_gset:N = \g_xsim_clear_aux_bool + final .bool_gset:N = \g_xsim_final_bool , + verbose .bool_gset:N = \g_xsim_verbose_bool , + clear-aux .bool_gset:N = \g_xsim_clear_aux_bool , + no-files .bool_gset_inverse:N = \g__xsim_write_to_file_bool , + no-files .initial:n = false } -\DeclareOption {final} - { \bool_gset_true:N \g_xsim_final_bool } +\ProcessKeysPackageOptions {xsim/package} -\DeclareOption {verbose} - { \bool_gset_true:N \g_xsim_verbose_bool } - -\DeclareOption {clear-aux} - { \bool_gset_true:N \g_xsim_clear_aux_bool } - -\ProcessOptions \scan_stop: +\prg_new_conditional:Npnn \xsim_if_write_to_files: {p,T,F,TF} + { + \bool_if:NTF \g__xsim_write_to_file_bool + { \prg_return_true: } + { \prg_return_false: } + } % -------------------------------------------------------------------------- diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.verbwrite.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.verbwrite.code.tex index a04ab8fed43..4738dc77868 100644 --- a/Master/texmf-dist/tex/latex/xsim/xsim.verbwrite.code.tex +++ b/Master/texmf-dist/tex/latex/xsim/xsim.verbwrite.code.tex @@ -103,10 +103,18 @@ % see http://tex.stackexchange.com/q/9035/5049 reasons \use:nx { \__xsim_file_write_start:n {#2} } - { \bool_if:nF {#1} { \c__xsim_active_eol_tl } } + { \bool_if:nF {#1} { \exp_not:V \c__xsim_active_eol_tl } } } \cs_generate_variant:Nn \xsim_file_write_start:nn {nV} +\cs_new_protected:Npn \__xsim_set_verb_catcodes: + { + \seq_map_inline:Nn \l_char_special_seq + { \char_set_catcode_other:N ##1 } + \int_step_inline:nnnn {128} {1} {255} + { \char_set_catcode_letter:n {##1} } + } + \group_begin: \char_set_catcode_active:n {13} % ^^M (carriage return, endlinechar) \char_set_catcode_active:n {12} % ^^L (form feed) @@ -130,10 +138,7 @@ { \l_xsim_file_begin_tl } % } % } % - \seq_map_inline:Nn \l_char_special_seq % - { \char_set_catcode_other:N ##1 } % - \int_step_inline:nnnn {128} {1} {255} % - { \char_set_catcode_letter:n {##1} } % + \__xsim_set_verb_catcodes: % \tl_set:Nx \l__xsim_tmpa_tl % { \c__xsim_backslash_char_tl end \cs_to_str:N \{ \@currenvir \cs_to_str:N \} } % \use:x % -- cgit v1.2.3