texlive[52314] Master/texmf-dist: xsim (7oct19)

commits+karl at tug.org commits+karl at tug.org
Mon Oct 7 22:58:33 CEST 2019


Revision: 52314
          http://tug.org/svn/texlive?view=revision&revision=52314
Author:   karl
Date:     2019-10-07 22:58:33 +0200 (Mon, 07 Oct 2019)
Log Message:
-----------
xsim (7oct19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/xsim/README
    trunk/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.pdf
    trunk/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.tex
    trunk/Master/texmf-dist/doc/latex/xsim/xsim.history
    trunk/Master/texmf-dist/doc/latex/xsim/xsim_manual.pdf
    trunk/Master/texmf-dist/doc/latex/xsim/xsim_manual.tex
    trunk/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls
    trunk/Master/texmf-dist/tex/latex/xsim/xsim.environments.code.tex
    trunk/Master/texmf-dist/tex/latex/xsim/xsim.solutions.code.tex
    trunk/Master/texmf-dist/tex/latex/xsim/xsim.sty
    trunk/Master/texmf-dist/tex/latex/xsim/xsim.verbwrite.code.tex

Modified: trunk/Master/texmf-dist/doc/latex/xsim/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xsim/README	2019-10-07 20:58:09 UTC (rev 52313)
+++ trunk/Master/texmf-dist/doc/latex/xsim/README	2019-10-07 20:58:33 UTC (rev 52314)
@@ -1,5 +1,5 @@
 --------------------------------------------------------------------------
-XSIM 2019/09/30 v0.12
+XSIM 2019/10/06 v0.13
 
   eXercise Sheets IMproved
 

Modified: trunk/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.tex	2019-10-07 20:58:09 UTC (rev 52313)
+++ trunk/Master/texmf-dist/doc/latex/xsim/examples/xsim.texsx-338165.tex	2019-10-07 20:58:33 UTC (rev 52314)
@@ -8,9 +8,7 @@
 \usepackage{xsim}
 \usepackage{tcolorbox}
 \tcbuselibrary{breakable, skins}
-\settasks{
-  counter-format = tsk.
-}
+\settasks{ label = \arabic*. }
 
 \DeclareExerciseEnvironmentTemplate{boxed}
   {%

Modified: trunk/Master/texmf-dist/doc/latex/xsim/xsim.history
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xsim/xsim.history	2019-10-07 20:58:09 UTC (rev 52313)
+++ trunk/Master/texmf-dist/doc/latex/xsim/xsim.history	2019-10-07 20:58:33 UTC (rev 52314)
@@ -114,3 +114,4 @@
  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'

Modified: trunk/Master/texmf-dist/doc/latex/xsim/xsim_manual.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/xsim/xsim_manual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xsim/xsim_manual.tex	2019-10-07 20:58:09 UTC (rev 52313)
+++ trunk/Master/texmf-dist/doc/latex/xsim/xsim_manual.tex	2019-10-07 20:58:33 UTC (rev 52314)
@@ -128,6 +128,12 @@
       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 @@
   \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 @@
 
 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}

Modified: trunk/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls	2019-10-07 20:58:09 UTC (rev 52313)
+++ trunk/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls	2019-10-07 20:58:33 UTC (rev 52314)
@@ -263,6 +263,9 @@
 }
 
 \def\libertine at figurestyle{LF}
+\RequirePackage{amsmath}
+\undef\lvert \undef\lVert
+\undef\rvert \undef\rVert
 \RequirePackage[libertine]{newtxmath}
 \def\libertine at 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 at example@links [1] {
+\cs_new_protected:Npn \xsim at example@links #1 {
   \href { \xsim at example@texfile at path {#1} } { \color{white} [\TeX] } ~
   \href { \xsim at example@pdffile at path {#1} } { \color{white} [PDF] }
   \tl_if_in:nnT {#1} {texsx}
@@ -717,13 +720,20 @@
 
 \newcounter{examplefile}
 \newcounter{examplefiles}
-\newcommand*\xsim at add@example[1]{%
+\newcommand*\xsim at add@example[2]{%
   \listadd\xsim at examplefiles{#1}%
+  \csdef{xsim at example@texfile at desc@#1}{#2}%
   \stepcounter{examplefiles}%
 }
 \newcommand*\listexamplefiles{%
   \def\xsim at example@texfile at path##1{./examples/xsim.##1.tex}%
-  \def\xsim at example@pdffile at path##1{./examples/{xsim.##1}.pdf}%
+  \def\xsim at example@pdffile at path{./examples/xsim}%
+  \def\xsim at example@desc##1{\csuse{xsim at example@texfile at desc@##1}}%
+  \def\xsim at example@title##1{%
+    Example~\theexamplefile: \xsim at example@desc{##1}
+    \\Links: \xsim at example@links{##1}\hfill File: \code{xsim.##1.tex}%
+  }%
+  \def\xsim at example@bookmark##1{Example~\theexamplefile\ (\xsim at 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 at example@links{##1}%
+      title=\xsim at example@title{##1}%
     ]
-    \bookmark[level=2,dest=examplefile.\arabic{examplefile}]{Example~\theexamplefile\ (##1)}%
-    \lstinputlisting[style=cnltx,firstline=7,lastline=16]{\xsim at example@texfile at path{##1}}
+    \bookmark[level=2,dest=examplefile.\arabic{examplefile}]{\xsim at example@bookmark{##1}}%
+    \lstinputlisting[style=cnltx,firstline=7,lastline=15,firstnumber=7]{\xsim at example@texfile at path{##1}}
     \tcblower
     \fbox{%
       \href
-        {\xsim at example@pdffile at path{##1}}
+        {\xsim at example@pdffile at path.##1.pdf}
         {%
           \includegraphics[
+            type=pdf,
+            ext=.##1.pdf,
+            read=.##1.pdf,
             pagebox=cropbox,
-            viewport=4.5cm 18cm 8.7cm 23.3cm,
-            clip]{\xsim at example@pdffile at path{##1}}%
+            viewport=4.5cm 18.6cm 8.7cm 23cm,
+            clip]{\xsim at example@pdffile at path}%
         }%
     }%
     \end{cnltxcode}
@@ -756,41 +765,41 @@
   \dolistloop\xsim at examplefiles
 }
 
-\xsim at add@example{blanks}
-\xsim at add@example{boxed-headings}
-\xsim at add@example{code-and-output}
-\xsim at add@example{collections}
-\xsim at add@example{crossref}
-\xsim at add@example{description-list}
-\xsim at add@example{different-point-types}
-\xsim at add@example{difficulties}
-\xsim at add@example{hints}
-\xsim at add@example{floating}
-\xsim at add@example{grade-distribution}
-\xsim at add@example{listings}
-\xsim at add@example{multiplechoice}
-\xsim at add@example{listofexercises}
-\xsim at add@example{pointsums}
-\xsim at add@example{randomexercises}
-\xsim at add@example{various}
-\xsim at add@example{texsx-13635}
-\xsim at add@example{texsx-155630}
-\xsim at add@example{texsx-199360}
-\xsim at add@example{texsx-299534}
-\xsim at add@example{texsx-305110}
-\xsim at add@example{texsx-308883}
-\xsim at add@example{texsx-338165}
-\xsim at add@example{texsx-350028}
-\xsim at add@example{texsx-369065}
-\xsim at add@example{texsx-369636}
-\xsim at add@example{texsx-369803}
-\xsim at add@example{texsx-370642}
-\xsim at add@example{texsx-391530}
-\xsim at add@example{texsx-395273}
-\xsim at add@example{texwelt-6698}
-\xsim at add@example{texwelt-15093}
-\xsim at add@example{golatex-80640}
-\xsim at add@example{golatex-91339}
+\xsim at add@example{blanks}{Create blank lines}
+\xsim at add@example{boxed-headings}{Put headings in a box}
+\xsim at add@example{code-and-output}{Create code examples}
+\xsim at add@example{collections}{How to use collections}
+\xsim at add@example{crossref}{Crossreferencing between problems and answers}
+\xsim at add@example{description-list}{Exercises as a \code{description} list}
+\xsim at add@example{different-point-types}{A custom point scheme}
+\xsim at add@example{difficulties}{Difficulty levels}
+\xsim at add@example{floating}{Floating exercises and a list of exercises}
+\xsim at add@example{grade-distribution}{Using the grade distribution macros}
+\xsim at add@example{hints}{Give hints}
+\xsim at add@example{listings}{Use listings in exercises}
+\xsim at add@example{listofexercises}{A custom list of exercises}
+\xsim at add@example{multiplechoice}{Multiplechoice exercises}
+\xsim at add@example{pointsums}{Sum of points}
+\xsim at add@example{randomexercises}{Random exercises from a collection}
+\xsim at add@example{various}{Various aspects of \xsim}
+\xsim at add@example{texsx-13635}{Exercises like theorems}
+\xsim at add@example{texsx-155630}{Random/custom order of exercises}
+\xsim at add@example{texsx-199360}{Exercises and solutions in a \pkg*{tcolorbox}}
+\xsim at add@example{texsx-299534}{Using \pkg*{pythontex}}
+\xsim at add@example{texsx-305110}{Print solutions per chapter/section}
+\xsim at add@example{texsx-308883}{Adapt how points are printed}
+\xsim at add@example{texsx-338165}{Another \pkg*{tcolorbox} example}
+\xsim at add@example{texsx-350028}{Fancy \pkg*{tcolorbox} and crossreferencing}
+\xsim at add@example{texsx-369065}{Custom layout}
+\xsim at add@example{texsx-369636}{An empty box for points}
+\xsim at add@example{texsx-369803}{Layout adjustments}
+\xsim at add@example{texsx-370642}{Minimalistic layout}
+\xsim at add@example{texsx-391530}{Exercises and sub-exercises}
+\xsim at add@example{texsx-395273}{Different aspects of exercises. Highlighted solutions}
+\xsim at add@example{texwelt-6698}{Custom list of exercises}
+\xsim at add@example{texwelt-15093}{Indicate difficulty level}
+\xsim at add@example{golatex-80640}{Different versions for students and teachers}
+\xsim at add@example{golatex-91339}{Another custom layout with rules}
 
 % ----------------------------------------------------------------------------
 
@@ -827,6 +836,7 @@
 \xsim at add@version{0.10a} {2017-10-04}
 \xsim at add@version{0.11}  {2018-02-12}
 \xsim at add@version{0.12}  {2019-09-26}
+\xsim at add@version{0.13}  {2019-10-06}
 
 % ----------------------------------------------------------------------------
 \endinput

Modified: trunk/Master/texmf-dist/tex/latex/xsim/xsim.environments.code.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/xsim/xsim.environments.code.tex	2019-10-07 20:58:09 UTC (rev 52313)
+++ trunk/Master/texmf-dist/tex/latex/xsim/xsim.environments.code.tex	2019-10-07 20:58:33 UTC (rev 52314)
@@ -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}
@@ -254,12 +307,34 @@
 
 % #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

Modified: trunk/Master/texmf-dist/tex/latex/xsim/xsim.solutions.code.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/xsim/xsim.solutions.code.tex	2019-10-07 20:58:09 UTC (rev 52313)
+++ trunk/Master/texmf-dist/tex/latex/xsim/xsim.solutions.code.tex	2019-10-07 20:58:33 UTC (rev 52314)
@@ -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: }
   }

Modified: trunk/Master/texmf-dist/tex/latex/xsim/xsim.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/xsim/xsim.sty	2019-10-07 20:58:09 UTC (rev 52313)
+++ trunk/Master/texmf-dist/tex/latex/xsim/xsim.sty	2019-10-07 20:58:33 UTC (rev 52314)
@@ -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,25 +58,26 @@
 \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 }
+\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: }
+  }
 
-\DeclareOption {clear-aux}
-  { \bool_gset_true:N \g_xsim_clear_aux_bool }
-
-\ProcessOptions \scan_stop:
-
 % --------------------------------------------------------------------------
 
 % messages:

Modified: trunk/Master/texmf-dist/tex/latex/xsim/xsim.verbwrite.code.tex
===================================================================
--- trunk/Master/texmf-dist/tex/latex/xsim/xsim.verbwrite.code.tex	2019-10-07 20:58:09 UTC (rev 52313)
+++ trunk/Master/texmf-dist/tex/latex/xsim/xsim.verbwrite.code.tex	2019-10-07 20:58:33 UTC (rev 52314)
@@ -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 %



More information about the tex-live-commits mailing list