summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/xsim
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-09-20 22:36:23 +0000
committerKarl Berry <karl@freefriends.org>2017-09-20 22:36:23 +0000
commitbaaddc3c242540fcc6eef178a4576c34df84c339 (patch)
tree3dd7e8072b95be228ebfff3acb9f40f0e7823b88 /Master/texmf-dist/tex/latex/xsim
parent6fdb207f55c75b496f116c760eab2e1640de2b88 (diff)
xsim (20sep17)
git-svn-id: svn://tug.org/texlive/trunk@45355 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/xsim')
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim-manual.cls132
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.auxfile.code.tex2
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.base.code.tex2
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.blanks.code.tex45
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.collections.code.tex7
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.definitions.code.tex7
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.environments.code.tex45
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.exercises.code.tex53
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.goals.code.tex4
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.grades.code.tex2
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.interface.code.tex65
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.layouts.code.tex77
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.modules.code.tex14
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex13
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.random.code.tex2
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.solutions.code.tex157
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.sty8
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.tags.code.tex5
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.templates.code.tex2
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.translations.code.tex2
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsim.verbwrite.code.tex3
-rw-r--r--Master/texmf-dist/tex/latex/xsim/xsimverb.sty2
22 files changed, 453 insertions, 196 deletions
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls b/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls
index 56121054dd8..23fb8db3f24 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls
+++ b/Master/texmf-dist/tex/latex/xsim/xsim-manual.cls
@@ -29,7 +29,7 @@
% please ignore the contents of this file -- it is not a good example for
% coding...
%
-\ProvidesClass{xsim-manual}[2017/04/14]
+\ProvidesClass{xsim-manual}[2017/09/18]
\LoadClass[load-preamble,add-index]{cnltx-doc}
\RequirePackage{imakeidx}
@@ -185,6 +185,7 @@
DeclareFloatingEnvironment ,
enddescription ,
endtcolorbox ,
+ hint ,
hoehe ,
iflist ,
IfNoValueTF ,
@@ -202,12 +203,14 @@
pkg ,
pointsandbonus ,
printA, printC, printE ,
+ printhints ,
printcompletepoints ,
printsumofpointsandbonus ,
setlist ,
settasks ,
tcbuselibrary ,
tcolorbox ,
+ thechapter ,
thesection ,
toprule ,
whileboolexpr ,
@@ -222,6 +225,21 @@
module-sep = {\texttt{/}}%
}
+
+\RequirePackage[en-US]{datetime2}
+\newrobustcmd*\xsim@add@version[2]{\csdef{xsimversion#1}{\DTMdate{#2}}}
+\renewrobustcmd*\sinceversion[1]{%
+ \cnltx@version@note{\GetTranslation{cnltx-introduced}~#1 (\csuse{xsimversion#1})}%
+}
+\renewrobustcmd*\changedversion[1]{%
+ \cnltx@version@note{\GetTranslation{cnltx-changed}~#1 (\csuse{xsimversion#1})}%
+}
+
+\newnote*\sincechanged[2]{\GetTranslation{cnltx-introduced}~#1
+ (\csuse{xsimversion#1}), changed with version~#2 (\csuse{xsimversion#2})}
+
+\renewcommand*\versionnoteformat{\scriptsize\sffamily\RaggedRight}
+
\renewcommand*\cnltx@module@text[2]{%
\begingroup
\reversemarginpar
@@ -569,6 +587,7 @@
}
\DeclareExerciseCollection{foo}
+\DeclareExerciseCollection{layouts}
\newrobustcmd*\TF{%
\colorlet{outside}{.}%
@@ -582,6 +601,9 @@
\renewrobustcmd*\code[1]{\begingroup\codefont\let\^\textasciicircum#1\endgroup}
+% ----------------------------------------------------------------------------
+\loadxsimstyle{layouts}
+
\DeclareExerciseEnvironmentTemplate{tcolorbox}
{%
\tcolorbox[
@@ -603,7 +625,7 @@
\IfInsideSolutionF{%
\GetExercisePropertyT{points}
{ % notice the space
- (\PropertyValue
+ (\printgoal{\PropertyValue}
\IfExerciseGoalSingularTF{points}
{\XSIMtranslate{point}}
{\XSIMtranslate{points}})%
@@ -613,50 +635,6 @@
}
{\endtcolorbox}
-\RequirePackage{needspace}
-
-\DeclareExerciseEnvironmentTemplate{runin}
- {%
- \par\vspace{\baselineskip}
- \Needspace*{2\baselineskip}
- \noindent
- \textbf{\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}}%
- \GetExercisePropertyT{subtitle}{ \textit{#1}} %
- \GetExercisePropertyT{points}{%
- \marginpar{%
- \PropertyValue
- \GetExercisePropertyT{bonus-points}{+\PropertyValue}%
- \,\IfExerciseGoalSingularTF{points}
- {\XSIMtranslate{point}}
- {\XSIMtranslate{points}}%
- }%
- }%
- }
- {}
-
-\DeclareExerciseEnvironmentTemplate{margin}
- {%
- \par\vspace{\baselineskip}
- \Needspace*{2\baselineskip}
- \noindent
- \llap{%
- \smash{%
- \tabular[t]{@{}r@{}}
- \textbf{\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}}
- \IfExercisePropertySetT{points}{%
- \tabularnewline
- (%
- \GetExerciseProperty{points}%
- \GetExercisePropertyT{bonus-points}{+#1}%
- \,\XSIMtranslate{point-abbr}%
- )%
- }%
- \endtabular
- } % notice the space
- }%
- }
- {}
-
\DeclareExerciseProperty*{bonus}
\DeclareExerciseEnvironmentTemplate{bonus}
{%
@@ -685,6 +663,8 @@
}
{}
+% ----------------------------------------------------------------------------
+
\DeclareExerciseType{problem}{
exercise-env = problem ,
solution-env = answer ,
@@ -696,6 +676,8 @@
\RequirePackage{hyperref,bookmark}
+% ----------------------------------------------------------------------------
+
\newcounter{examplefile}
\newcounter{examplefiles}
\newcommand*\xsim@add@example[1]{%
@@ -703,22 +685,25 @@
\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\do##1{%
- \stepcounter{examplefile}%
\begin{cnltxcode}[
+ step and label={examplefile}{example:##1} ,
sidebyside align=top seam,sidebyside,
righthand width=\linewidth/4,
sidebyside gap=0pt,
lower separated=false,
- title=Example~\theexamplefile\ \enquote{##1}
- \href{../examples/xsim.##1.tex}{\color{white}[\TeX]}
- \href{../examples/xsim.##1.pdf}{\color{white}[PDF]}%
+ title=Example~\theexamplefile\ \enquote{\texttt{##1}}
+ \href{\xsim@example@texfile@path{##1}}{\color{white}[\TeX]}
+ \href{\xsim@example@pdffile@path{##1}}{\color{white}[PDF]}%
]
- \lstinputlisting[style=cnltx,lastline=10]{../examples/xsim.##1.tex}
+ \bookmark[level=2,dest=examplefile.\arabic{examplefile}]{Example~\theexamplefile\ (##1)}%
+ \lstinputlisting[style=cnltx,lastline=10]{\xsim@example@texfile@path{##1}}
\tcblower
\fbox{%
- \href{../examples/xsim.##1.pdf}{%
- \includegraphics[width=.8\linewidth]{../examples/{xsim.##1}.pdf}}}%
+ \href{\xsim@example@pdffile@path{##1}}{%
+ \includegraphics[width=.8\linewidth]{\xsim@example@pdffile@path{##1}}}}%
\end{cnltxcode}
}%
\dolistloop\xsim@examplefiles
@@ -732,24 +717,65 @@
\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{texwelt-6698}
\xsim@add@example{texwelt-15093}
\xsim@add@example{golatex-16824}
\xsim@add@example{golatex-18844}
+% ----------------------------------------------------------------------------
+
+\newcommand*\listlayouts{%
+ \def\do##1{%
+ \begin{cnltxcode}[{title=Layout \enquote{\texttt{##1}}}]
+ \ifcsdef{xsim@layout@extra@##1}
+ {\csuse{xsim@layout@extra@##1}}
+ {}%
+ \xsimsetup{exercise/template={##1}}
+ \let\marginpar\marginnote
+ \XSIMexpandcode{%
+ \printexercise{exercise}{\GetExerciseIdForProperty{ID}{showlayout}}
+ }%
+ \end{cnltxcode}
+ }%
+ \dolistloop\xsim@layouts
+}
+
+\NewDocumentCommand\xsim@add@layout{mo}{%
+ \listadd\xsim@layouts{#1}%
+ \IfNoValueF{#2}{\csdef{xsim@layout@extra@#1}{#2}}%
+}
+
+\xsim@add@layout{default}
+\xsim@add@layout{runin}[\renewcommand*\theexercise{\arabic{exercise}.}]
+\xsim@add@layout{margin}[\renewcommand*\theexercise{\arabic{exercise}.}]
+
+\xsim@add@version{0.8} {2017-05-18}
+\xsim@add@version{0.8a} {2017-05-19}
+\xsim@add@version{0.8b} {2017-05-23}
+\xsim@add@version{0.9} {2017-06-20}
+\xsim@add@version{0.10} {2017-09-19}
+
+% ----------------------------------------------------------------------------
\endinput
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.auxfile.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.auxfile.code.tex
index 2a0f95846f3..2959a910915 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.auxfile.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.auxfile.code.tex
@@ -179,4 +179,4 @@
{ \seq_item:cn {g__xsim_list_recorded_#1_seq} {#2} }
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.base.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.base.code.tex
index 30be8b9d18f..abec4de0501 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.base.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.base.code.tex
@@ -166,4 +166,4 @@
{ \keys_set:nn {xsim} {#1} }
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.blanks.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.blanks.code.tex
index 323b7bd52f9..55b1db7cf45 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.blanks.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.blanks.code.tex
@@ -29,6 +29,7 @@
\bool_new:N \l__xsim_blank_width_bool
\bool_new:N \l__xsim_blank_linespread_bool
+\bool_new:N \l__xsim_fill_blank_bool
\tl_new:N \l__xsim_blank_linespread_tl
\tl_new:N \l__xsim_blank_scale_tl
\dim_new:N \l__xsim_blank_dim
@@ -41,32 +42,34 @@
\keys_define:nn {xsim/blank}
{
- blank-style .code:n =
+ blank-style .code:n =
\cs_set_protected:Npn \xsim_write_cloze_blank:n ##1 {#1} ,
- blank-style .initial:n = \underline {#1} ,
- filled-style .code:n =
+ blank-style .initial:n = \underline {#1} ,
+ filled-style .code:n =
\cs_set_protected:Npn \xsim_write_cloze_filled:n ##1 {#1} ,
- filled-style .initial:n = \underline {#1} ,
- style .meta:n =
+ filled-style .initial:n = \underline {#1} ,
+ style .meta:n =
{
blank-style = #1 ,
filled-style = #1
} ,
- scale .tl_set:N = \l__xsim_blank_scale_tl ,
- scale .initial:n = 1 ,
- width .code:n =
+ fill .bool_set:N = \l__xsim_fill_blank_bool ,
+ fill .initial:n = false ,
+ scale .tl_set:N = \l__xsim_blank_scale_tl ,
+ scale .initial:n = 1 ,
+ width .code:n =
{
\bool_set_true:N \l__xsim_blank_width_bool
\dim_set:Nn \l__xsim_blank_dim {#1}
} ,
- linespread .code:n =
+ linespread .code:n =
\bool_set_true:N \l__xsim_blank_linespread_bool
\tl_set:Nn \l__xsim_blank_linespread_tl {#1} ,
- linespread .initial:n = 1 ,
- line-increment .dim_set:N = \l__xsim_blank_line_increment_dim ,
- line-increment .initial:n = 1pt ,
- line-minimum-length .dim_set:N = \l__xsim_blank_line_minimum_length_dim ,
- line-minimum-length .initial:n = 2em
+ linespread .initial:n = 1 ,
+ line-increment .dim_set:N = \l__xsim_blank_line_increment_dim ,
+ line-increment .initial:n = 1pt ,
+ line-minimum-length .dim_set:N = \l__xsim_blank_line_minimum_length_dim ,
+ line-minimum-length .initial:n = 2em
}
\cs_new_protected:Npn \xsim_blank:n #1
@@ -75,7 +78,8 @@
\mode_if_math:TF
{ \hbox_set:Nn \l__xsim_blank_box { $ \m@th \mathpalette{}{#1} $ } }
{ \hbox_set:Nn \l__xsim_blank_box {#1} }
- \xsim_if_inside_solution:TF
+ \bool_if:nTF
+ { \xsim_if_inside_solution_p: || \l__xsim_fill_blank_bool }
{ \xsim_write_cloze_filled:n {#1} }
{
\bool_if:NTF \l__xsim_blank_width_bool
@@ -103,9 +107,9 @@
{
% I wonder what the correct l3 way would be -- if there is
% one, yet:
- \tex_hfil:D
+ % \tex_hfil:D
\tex_penalty:D \hyphenpenalty
- \tex_hfilneg:D
+ % \tex_hfilneg:D
\dim_compare:nTF
{ \l__xsim_tmpa_dim < \l__xsim_blank_line_increment_dim }
{ \xsim_write_cloze_blank:n { \skip_horizontal:N \l__xsim_tmpa_dim } }
@@ -117,12 +121,15 @@
}
}
}
- { \xsim_write_cloze_blank:n { \skip_horizontal:N \l__xsim_tmpa_dim } }
+ {
+ \xsim_write_cloze_blank:n
+ { \skip_horizontal:N \l__xsim_blank_line_minimum_length_dim }
+ }
}
\cs_generate_variant:Nn \__xsim_blank_skip:n { V }
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
the following code from Heiko Oberdieck in d.c.t.t served as inspiration
and basis for the \blank command:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.collections.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.collections.code.tex
index 8bf0c0bc705..e3945e86a43 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.collections.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.collections.code.tex
@@ -127,8 +127,9 @@
\xsim_if_collection_exists:nF {#1}
{ \msg_error:nnn {xsim} {unknown-collection} {#1} }
\xsim_activate_collection:nn {#1} {#2}
- \xsim_setup:n { #2/print = false }
+ \xsim_setup:x { \xsim_get_parameter:nn {#2} {exercise-env} /print = false }
}
+\cs_generate_variant:Nn \xsim_setup:n {x}
% start collection for all exercise types:
% #1: collection name
@@ -139,7 +140,7 @@
{ \msg_error:nnn {xsim} {unknown-collection} {#1} }
\xsim_activate_collection:n {#1}
\xsim_foreach_exercise_type:n
- { \xsim_setup:n { ##1/print = false } }
+ { \xsim_setup:x { \xsim_get_parameter:nn {##1} {exercise-env} /print = false } }
}
% stop collection:
@@ -392,4 +393,4 @@
}
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.definitions.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.definitions.code.tex
index a30c44a76fc..824da2241ea 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.definitions.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.definitions.code.tex
@@ -58,6 +58,7 @@
}
\DeclareExerciseProperty {section-value}
\DeclareExerciseProperty {section}
+\DeclareExerciseProperty {sectioning}
% those are additional and wouldn't *need* to be present except for
% pre-defined templates which make use of them:
@@ -183,9 +184,9 @@
\marginpar
{
\IfInsideSolutionF { \rule {1.2cm} {1pt} \slash }
- \PropertyValue
+ \printgoal {\PropertyValue}
\GetExercisePropertyT {bonus-points}
- { \nobreakspace ( + \PropertyValue ) }
+ { \nobreakspace ( + \printgoal {\PropertyValue} ) }
\nobreakspace\XSIMtranslate {point-abbr}
}
}
@@ -427,4 +428,4 @@
}
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
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 43a46ab6146..aa89ce5ee2c 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.environments.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.environments.code.tex
@@ -33,13 +33,29 @@
\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
\bool_new:N \l__xsim_options_given_bool
\bool_new:N \l__xsim_insert_mode_bool
+\tl_new:N \ExerciseText
+\tl_set:Nn \ExerciseText { \msg_error:nn {xsim} {only-in-solution} }
+
+% ----------------------------------------------------------------------------
+
+\msg_new:nnn {xsim} {only-in-solution}
+ {
+ You~ can't~ use~ \token_to_str:N \ExerciseText \c_space_tl inside~ an~
+ exercise.~ It~ is~ only~ allowed~ inside~ solution~ environments!
+ }
+
% ----------------------------------------------------------------------------
\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
+ }
% ----------------------------------------------------------------------------
@@ -68,7 +84,7 @@
\cs_generate_variant:Nn \__xsim_set_file_signature:nnn {nx,nV}
\tl_set:Nn \l__xsim_file_name_tl
- { \c_sys_jobname_str - \l__xsim_file_name_signature_tl -body.tex }
+ { \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
{
@@ -276,6 +292,13 @@
\xsim_set_properties:nnn {#1} {#2}
{ print=true , used=true }
}
+ \str_if_eq:nnT {#4} {solution}
+ {
+ \__xsim_set_file_signature:nnn {#1} {#2} {exercise}
+ \tl_set_from_file:Nnn \ExerciseText {}
+ {\l__xsim_file_path_and_name_tl}
+ \tl_trim_spaces:N \ExerciseText
+ }
\use:x
{
\xsim_use_hook:nnn {#1} {#4} {pre}
@@ -283,7 +306,7 @@
{begin}
{ \xsim_get_parameter:nn {#1} {#4-template} }
\xsim_use_hook:nnn {#1} {#4} {begin}
- \file_input:n { \exp_not:V \l__xsim_file_path_and_name_tl }
+ \xsim_input:nnn {#1} {#2} {#4}
\xsim_use_hook:nnn {#1} {#4} {end}
\xsim_use_template:nn
{end}
@@ -293,12 +316,24 @@
\group_end:
}
{
- \xsim_verbose:n
+ \xsim_verbose:x
{ File~ `\l__xsim_file_path_and_name_tl'~ doesn't~ exist. }
}
}
\cs_generate_variant:Nn \xsim_insert:nnnn {nV,VV,nnnV}
+% #1: type
+% #2: id
+% #3: exercise|solution
+\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 }
+ \group_end:
+ }
+\cs_generate_variant:Nn \xsim_input:nnn {oo}
+
\prg_new_conditional:Npnn \xsim_if_insert_mode: {T,F,TF}
{
\bool_if:NTF \l__xsim_insert_mode_bool
@@ -342,4 +377,4 @@
}
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.exercises.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.exercises.code.tex
index 59434ec3071..185544564f5 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.exercises.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.exercises.code.tex
@@ -65,6 +65,13 @@
exercise~ type~ `#2'.
}
+\msg_new:nnn {xsim} {unknown-parameter}
+ {
+ You~ tried~ to~ retrieve~ the~ parameter~ `#1'~ \msg_line_context: . \\
+ This~ parameter~ does~ not~ exist.~ Check~ for~ a~ typo~ or~ \\
+ define~ the~ parameter~ yourself.
+ }
+
% ----------------------------------------------------------------------------
\xsim_new_list:n {types}
@@ -126,7 +133,7 @@
{
\seq_map_inline:Nn \l__xsim_mandatory_parameters_seq
{
- \xsim_if_parameter:nnF {#1} {##1}
+ \xsim_if_parameter_set:nnF {#1} {##1}
{ \msg_error:nnnn {xsim} {mandatory-parameter} {##1} {#1} }
}
}
@@ -148,7 +155,7 @@
{
\xsim_if_parameter_fixed:nTF {#1}
{
- \xsim_if_parameter:nnTF {#1} {#2}
+ \xsim_if_parameter_set:nnTF {#1} {#2}
{
\msg_warning:nnnn {xsim} {parameter-fixed} {#1} {#2}
\xsim_verbose:n
@@ -178,13 +185,41 @@
{ \prop_item:cn {l__xsim_#1_type_parameters_prop} {#2} }
\cs_generate_variant:Nn \xsim_get_parameter:nn {o}
-\prg_new_conditional:Npnn \xsim_if_parameter:nn #1#2 {p,T,F,TF}
+\prg_new_conditional:Npnn \xsim_if_parameter_set:nn #1#2 {p,T,F,TF}
{
\prop_if_in:cnTF {l__xsim_#1_type_parameters_prop} {#2}
{ \prg_return_true: }
{ \prg_return_false: }
}
+\cs_new:Npn \__xsim_get_parameter_tmp:n #1 {}
+\cs_generate_variant:Nn \__xsim_get_parameter_tmp:n {V}
+
+% #1: type
+% #2: parameter
+\cs_new_protected:Npn \xsim_get_parameter_if_set:nnTF #1#2#3#4
+ {
+ \group_begin:
+ \xsim_if_parameter_exist:nTF {#2}
+ {
+ \xsim_if_parameter_set:nnTF {#1} {#2}
+ {
+ \tl_set:Nx \ParameterValue
+ { \xsim_get_parameter:nn {#1} {#2} }
+ \cs_set:Npn \__xsim_get_parameter_tmp:n ##1 {#3}
+ \__xsim_get_parameter_tmp:V \ParameterValue
+ }
+ {#4}
+ }
+ { \msg_error:nnn {xsim} {unknown-parameter} {#2} }
+ \group_end:
+ }
+\cs_new_protected:Npn \xsim_get_parameter_if_set:nnT #1#2#3
+ { \xsim_get_parameter_if_set:nnTF {#1} {#2} {#3} {} }
+\cs_new_protected:Npn \xsim_get_parameter_if_set:nnF #1#2#3
+ { \xsim_get_parameter_if_set:nnTF {#1} {#2} {} {#3} }
+\cs_generate_variant:Nn \xsim_get_parameter_if_set:nnTF {o}
+
% ----------------------------------------------------------------------------
% inside the argument `#1' refers to the type
\cs_new_protected:Npn \xsim_foreach_exercise_type:n #1
@@ -282,12 +317,12 @@
\xsim_set_parameter:nnx {#1} {number}
{ number of \xsim_get_parameter:nn {#1} {exercise-env} s }
\xsim_check_mandatory_parameters:n {#1}
- \xsim_if_parameter:nnF {#1} {counter}
+ \xsim_if_parameter_set:nnF {#1} {counter}
{
\xsim_set_parameters:nx {#1}
{ counter = \xsim_get_parameter:nn {#1} {exercise-env} }
}
- \xsim_if_parameter:nnF {#1} {solution-counter}
+ \xsim_if_parameter_set:nnF {#1} {solution-counter}
{
\xsim_set_parameters:nx {#1}
{ solution-counter = \xsim_get_parameter:nn {#1} {solution-env} }
@@ -355,6 +390,12 @@
section-value = \arabic{section} ,
section = \thesection ,
page-value = \arabic{page} ,
+ sectioning =
+ { \cs_if_exist:NTF \chapter { \arabic{chapter} } {0} }
+ { \arabic {section} }
+ { \arabic {subsection} }
+ { \arabic {subsubsection} }
+ { \arabic {paragraph} } ,
page = \thepage ,
used = false
}
@@ -512,4 +553,4 @@
}
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.goals.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.goals.code.tex
index 8a881eb22ad..d537754fa72 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.goals.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.goals.code.tex
@@ -139,7 +139,7 @@
% #3: value != 1
\cs_new_protected:Npn \xsim_print_goal:nnn #1#2#3
{
- \__xsim_print_goal:n { \fp_to_decimal:n {#1} }
+ \__xsim_print_goal:x { \fp_to_decimal:n {#1} }
\fp_compare:nTF { (#1) = 1 } {#2} {#3}
}
@@ -304,4 +304,4 @@
}
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.grades.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.grades.code.tex
index 0fe0d162db5..141aaa3da3f 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.grades.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.grades.code.tex
@@ -150,4 +150,4 @@
}
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.interface.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.interface.code.tex
index b1006f49356..2c9f0c56449 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.interface.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.interface.code.tex
@@ -53,6 +53,15 @@
% ----------------------------------------------------------------------------
+\ProvideDocumentCommand \IfExistSolutionTF {+m+m}
+ { \xsim_if_solution_exists:ooTF {\ExerciseType} {\ExerciseID} {#1} {#2} }
+
+\NewDocumentCommand \IfExistSolutionT {+m}
+ { \IfExistSolutionTF {#1} {} }
+
+\NewDocumentCommand \IfExistSolutionF {+m}
+ { \IfExistSolutionTF {} {#1} }
+
\NewExpandableDocumentCommand \IfInsideSolutionTF {+m+m}
{ \xsim_if_inside_solution:TF {#1} {#2} }
@@ -138,8 +147,17 @@
\@onlypreamble \DeclareExercisePropertyAlias
\NewDocumentCommand \SetExerciseProperty {mmm+m}
+ { \xsim_set_property:xxnn {\ExerciseType} {\ExerciseID} {#3} {#4} }
+
+\NewDocumentCommand \SetExpandedExerciseProperty {mmm+m}
+ { \xsim_set_property:xxnx {\ExerciseType} {\ExerciseID} {#3} {#4} }
+
+\NewDocumentCommand \ExerciseSetProperty {mmm+m}
{ \xsim_set_property:nnnn {#1} {#2} {#3} {#4} }
+\NewDocumentCommand \ExerciseSetExpandedProperty {mmm+m}
+ { \xsim_set_property:nnnx {#1} {#2} {#3} {#4} }
+
\NewExpandableDocumentCommand \IfExercisePropertyExistTF {+m+m+m}
{ \xsim_if_property_exist:nTF {#1} {#2} {#3} }
@@ -238,6 +256,36 @@
{ \GetExerciseParameter {exercise-name} }
}
+\NewDocumentCommand \GetExerciseBody {m}
+ { \xsim_input:oon { \ExerciseType } { \ExerciseID } {#1} }
+
+\NewExpandableDocumentCommand \IfExerciseParameterSetTF {+m+m+m}
+ { \xsim_if_parameter_set:nnTF {\ExerciseType} {#1} {#2} {#3} }
+
+\NewExpandableDocumentCommand \IfExerciseParameterSetT {+m+m}
+ { \IfExerciseParameterSetTF {#1} {#2} {} }
+
+\NewExpandableDocumentCommand \IfExerciseParameterSetF {+m+m}
+ { \IfExerciseParameterSetTF {#1} {} {#2} }
+
+\NewExpandableDocumentCommand \ExerciseParameterIfSetTF {+m+m+m+m}
+ { \xsim_if_parameter_set:nnTF {#1} {#2} {#3} {#4} }
+
+\NewExpandableDocumentCommand \ExerciseParameterIfSetT {+m+m+m}
+ { \ExerciseParameterIfSetTF {#1} {#2} {#3} {} }
+
+\NewExpandableDocumentCommand \ExerciseParameterIfSetF {+m+m+m}
+ { \ExerciseParameterIfSetTF {#1} {#2} {} {#3} }
+
+\NewDocumentCommand \GetExerciseParameterTF {m+m+m}
+ { \xsim_get_parameter_if_set:onTF {\ExerciseType} {#1} {#2} {#3} }
+
+\NewDocumentCommand \GetExerciseParameterT {m+m}
+ { \GetExerciseParameterTF {#1} {#2} {} }
+
+\NewDocumentCommand \GetExerciseParameterF {m+m+m}
+ { \GetExerciseParameterTF {#1} {} {#2} }
+
% ----------------------------------------------------------------------------
\NewDocumentCommand \ExercisePropertyIfSetTF {mmm+m+m}
@@ -548,6 +596,21 @@
% ----------------------------------------------------------------------------
+\NewDocumentCommand \printforexercises {sO{}+mO{}}
+ {
+ \IfBooleanTF {#1}
+ {
+ \xsim_foreach_exercise_type:n
+ { \xsim_print_type_code:nnnnn { \c_true_bool } {#2} {#4} {##1} {#3} }
+ }
+ {
+ \xsim_foreach_exercise_type:n
+ { \xsim_print_type_code:nnnnn { \c_false_bool } {#2} {#4} {##1} {#3} }
+ }
+ }
+
+% ----------------------------------------------------------------------------
+
\NewDocumentCommand \xsimsetup {m}
{ \xsim_setup:n {#1} }
@@ -562,4 +625,4 @@
{ \xsim_if_chapter:F {#1} }
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.layouts.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.layouts.code.tex
new file mode 100644
index 00000000000..3b94b6cc518
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.layouts.code.tex
@@ -0,0 +1,77 @@
+% ----------------------------------------------------------------------------
+% the XSIM package - layouts style
+%
+% eXercise Sheets IMproved
+%
+% ----------------------------------------------------------------------------
+% Clemens Niederberger
+% Web: https://github.com/cgnieder/xsim
+% E-Mail: contact@mychemistry.eu
+% ----------------------------------------------------------------------------
+% Copyright 2017 Clemens Niederberger
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Clemens Niederberger.
+% ----------------------------------------------------------------------------
+% If you have any ideas, questions, suggestions or bugs to report, please
+% feel free to contact me.
+% ----------------------------------------------------------------------------
+\xsimstyle{layouts}[2017/09/14]
+
+\RequirePackage{needspace}
+
+\DeclareExerciseEnvironmentTemplate{runin}
+ {%
+ \par\vspace{\baselineskip}
+ \Needspace*{2\baselineskip}
+ \noindent
+ \textbf{\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}}%
+ \GetExercisePropertyT{subtitle}{ \textit{#1}} % <<< notice the space
+ \IfInsideSolutionF{%
+ \GetExercisePropertyT{points}{%
+ \marginpar{%
+ \printgoal{\PropertyValue}%
+ \GetExercisePropertyT{bonus-points}{+\printgoal{\PropertyValue}}%
+ \,\IfExerciseGoalSingularTF{points}
+ {\XSIMtranslate{point}}
+ {\XSIMtranslate{points}}%
+ }%
+ }%
+ }%
+ }
+ {}
+
+\RequirePackage{array}
+
+\DeclareExerciseEnvironmentTemplate{margin}
+ {%
+ \trivlist
+ \item[\llap{%
+ \smash{%
+ \tabular[t]{@{}r@{}}
+ \textbf{\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}}
+ \IfExercisePropertySetT{points}{%
+ \tabularnewline
+ (%
+ \printgoal{\GetExerciseProperty{points}}%
+ \GetExercisePropertyT{bonus-points}{+\printgoal{#1}}%
+ \,\XSIMtranslate{point-abbr}%
+ )%
+ }%
+ \endtabular
+ }%
+ }]\relax
+ }
+ {\endtrivlist}
+
+% ----------------------------------------------------------------------------
+\endinput
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.modules.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.modules.code.tex
index 1e5d7d5cfa1..a2913f4ad80 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.modules.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.modules.code.tex
@@ -191,21 +191,21 @@
% define a xsim module:
% #1: name
% #2: description
-\NewDocumentCommand \XSIMmodule {mm} { \__xsim_module:nn {#1} {#2}
-\ExplSyntaxOn }
+\NewDocumentCommand \XSIMmodule {mm}
+ { \__xsim_module:nn {#1} {#2} \ExplSyntaxOn }
% --------------------------------------------------------------------------
% style files
-\NewDocumentCommand \xsimstyle {sm}
+\NewDocumentCommand \xsimstyle {smO{}}
{
- \__xsim_module:nn {#2} {}
- \IfBooleanF {#1} { \ExplSyntaxOn }
+ \__xsim_module:nn {#2} {#3}
+ \IfBooleanT {#1} { \ExplSyntaxOn }
}
\cs_new_protected:Npn \xsim_style_options:nn #1#2
{ \keys_define:nn {xsim/#1} {#2} }
-\NewDocumentCommand \loadxsimstyle {m} { \xsim_load_module:n {#1} }
+\NewDocumentCommand \loadxsimstyle {m} { \xsim_load_modules:n {#1} }
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex
index ec88d1be00a..a932faf4472 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.properties.code.tex
@@ -178,7 +178,7 @@
}
{ \msg_error:nnn {xsim} {unknown-property} {#3} }
}
-\cs_generate_variant:Nn \xsim_set_property:nnnn {nnxx,nnnV,nV,nVnx,nnnx}
+\cs_generate_variant:Nn \xsim_set_property:nnnn {nnxx,nnnV,nV,nVnx,nnnx,xx,xxnx}
\cs_new_protected:Npn \__xsim_set_boolean_property:nnnn #1#2#3#4
{
@@ -416,9 +416,6 @@
{ \prop_item:Nn \g__xsim_properties_prop { #2 ! #1 ! #3 } }
\cs_generate_variant:Nn \xsim_get_property:nnn {nx,xx,oo,no,nnf,nf,oof,nV}
-\cs_new:Npn \__xsim_get_property_tmp:n #1 {}
-\cs_generate_variant:Nn \__xsim_get_property_tmp:n {V}
-
% #1: property
% #2: value
\cs_new:Npn \xsim_get_id_for_property:nn #1#2
@@ -430,6 +427,9 @@
{ \prop_item:cn {g__xsim_property_#1_type_prop} {#2} }
\cs_generate_variant:Nn \xsim_get_type_for_property:nn {nV}
+\cs_new:Npn \__xsim_get_property_tmp:n #1 {}
+\cs_generate_variant:Nn \__xsim_get_property_tmp:n {V}
+
% #1: type
% #2: id
% #3: property
@@ -467,7 +467,8 @@
{
\xsim_if_property_set:nnnTF {#1} {#2} {#3}
{
- \bool_if:cTF { c_ \xsim_get_property:nnn {#1} {#2} {#3} _bool}
+ \bool_if:cTF
+ {c_ \xsim_get_property:nnn {#1} {#2} {#3} _bool}
{ \prg_return_true: }
{ \prg_return_false: }
}
@@ -492,4 +493,4 @@
\cs_generate_variant:Nn \xsim_gsave_property:nnnN {nx,xx}
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.random.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.random.code.tex
index 3120c800bd8..0730d04d454 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.random.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.random.code.tex
@@ -304,4 +304,4 @@
% \xsim_get_id_for_property:nn {ID} {}
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
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 101c19aa23c..6855f635968 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.solutions.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.solutions.code.tex
@@ -30,6 +30,7 @@
\xsim_load_modules:n {tags,properties}
\bool_new:N \l_xsim_inside_solution_bool
+\bool_new:N \l__xsim_include_question_bool
\bool_new:N \l__xsim_printsolutions_headings_bool
\bool_new:N \l__xsim_printsolutions_conditions_bool
\bool_new:N \l____xsim_this_condition_bool
@@ -79,14 +80,15 @@
% #1: type
% #2: id
-\prg_new_conditional:Npnn \xsim_if_solution_exists:nn #1#2 {T,F,TF}
+\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
{ \prg_return_true: }
{ \prg_return_false: }
}
-\cs_generate_variant:Nn \xsim_if_solution_exists:nnT {VV}
+\cs_generate_variant:Nn \xsim_if_solution_exists:nnT {VV,oo}
+\cs_generate_variant:Nn \xsim_if_solution_exists:nnTF {oo}
% #1: type
% #2: options
@@ -101,84 +103,65 @@
% ----------------------------------------------------------------------------
-% per section condition:
-% #1: type
-% #2: id
-% #3: boolean property
-\prg_new_protected_conditional:Npnn
- \__xsim_if_solutions_per_section:nnn #1#2#3 {T,F,TF}
+% #1: conditional base function (three n args)% #2: name
+% #3: code (refer to type and id with `#1' and `#2'), #3 refers to the boolean
+% properties use/print
+\cs_new_protected:Npn \xsim_new_solutions_condition:Nnn #1#2#3
{
- \xsim_if_in_list:nnTF {#3} {#1-#2=={true}}
+ \prg_new_protected_conditional:Npnn #1 ##1##2##3 {T,F,TF}
{
- \__xsim_printsolutions_if_condition:nTF {per-section}
+ \xsim_if_in_list:nnTF {##3} {##1-##2=={true}}
{
- \__xsim_printsolutions_condition_true:
- \xsim_if_in_list:nxTF {section-value}
- { #1-#2 == { \int_use:N \l_xsim_printsolutions_section_int } }
- {
- \tl_set:Nx \ExerciseSection
- { \xsim_get_property:nnn {#1} {#2} {section} }
- \prg_return_true:
- }
+ \__xsim_printsolutions_if_condition:nTF {#2}
+ { \__xsim_printsolutions_condition_true: #3 }
{ \prg_return_false: }
}
{ \prg_return_false: }
}
+ }
+
+% per section condition:
+\xsim_new_solutions_condition:Nnn \__xsim_if_solutions_per_section:nnn
+ {per-section}
+ {
+ \xsim_if_in_list:nxTF {section-value}
+ { #1-#2 == { \int_use:N \l_xsim_printsolutions_section_int } }
+ {
+ \tl_set:Nx \ExerciseSection
+ { \xsim_get_property:nnn {#1} {#2} {section} }
+ \prg_return_true:
+ }
{ \prg_return_false: }
}
% per chapter condition:
-% #1: type
-% #2: id
-% #3: boolean property
-\prg_new_protected_conditional:Npnn
- \__xsim_if_solutions_per_chapter:nnn #1#2#3 {T,F,TF}
+\xsim_new_solutions_condition:Nnn \__xsim_if_solutions_per_chapter:nnn
+ {per-chapter}
{
- \xsim_if_in_list:nnTF {#3} {#1-#2=={true}}
+ \xsim_if_in_list:nxTF {chapter-value}
+ { #1-#2 == { \int_use:N \l_xsim_printsolutions_chapter_int } }
{
- \__xsim_printsolutions_if_condition:nTF {per-chapter}
- {
- \__xsim_printsolutions_condition_true:
- \xsim_if_in_list:nxTF {chapter-value}
- { #1-#2 == { \int_use:N \l_xsim_printsolutions_chapter_int } }
- {
- \tl_set:Nx \ExerciseChapter
- { \xsim_get_property:nnn {#1} {#2} {chapter} }
- \prg_return_true:
- }
- { \prg_return_false: }
- }
- { \prg_return_false: }
+ \tl_set:Nx \ExerciseChapter
+ { \xsim_get_property:nnn {#1} {#2} {chapter} }
+ \prg_return_true:
}
{ \prg_return_false: }
}
% per collection condition:
-% #1: type
-% #2: id
-% #3: boolean property
-\prg_new_protected_conditional:Npnn
- \__xsim_if_solutions_in_collection:nnn #1#2#3 {T,F,TF}
+\xsim_new_solutions_condition:Nnn \__xsim_if_solutions_in_collection:nnn
+ {per-collection}
{
- \xsim_if_in_list:nnTF {#3} {#1-#2=={true}}
+ \tl_if_blank:VTF \l__xsim_printsolutions_collection_tl
+ { \prg_return_false: }
{
- \__xsim_printsolutions_if_condition:nTF {per-collection}
- {
- \__xsim_printsolutions_condition_true:
- \tl_if_blank:VTF \l__xsim_printsolutions_collection_tl
- { \prg_return_false: }
- {
- \xsim_if_in_collection:VnnTF
- \l__xsim_printsolutions_collection_tl
- {#1}
- {#2}
- { \prg_return_true: }
- { \prg_return_false: }
- }
- }
+ \xsim_if_in_collection:VnnTF
+ \l__xsim_printsolutions_collection_tl
+ {#1}
+ {#2}
+ { \prg_return_true: }
{ \prg_return_false: }
}
- { \prg_return_false: }
}
% ----------------------------------------------------------------------------
@@ -206,7 +189,7 @@
% #1: name
% #2: condition
-\cs_new_protected:Npn \__xsim_declare_printsolutions_condition:nn #1#2
+\cs_new_protected:Npn \xsim_declare_printsolutions_condition:nn #1#2
{
\bool_new:c {l__xsim_printsolutions_#1_condition_bool}
\prop_put:Nnn \l__xsim_printsolutions_conditions_prop {#1} {#2}
@@ -270,25 +253,26 @@
% ----------------------------------------------------------------------------
% #1: boolean -- if true only the solutions of printed exercises will be
% output
-% #2: options
-% #3: type
-\cs_new_protected:Npn \xsim_print_type_solutions:nnn #1#2#3
+% #2: pre
+% #3: post
+% #4: type
+% #5: code (refer to type with #1 and id with #2)
+\cs_new_protected:Npn \xsim_print_type_code:nnnnn #1#2#3#4#5
{
- \xsim_verbose:n
- { Printing~ solutions~ for~ exercise~ type~ `#3'. }
\group_begin:
- \keys_set:nn {xsim/print-solutions} {#2}
+ \cs_set_protected:Npn \__xsim_print_entry:nn ##1##2 {#5}
+ #2
\bool_set_false:N \l__xsim_tmpa_bool
\bool_if:nTF {#1}
{
- \xsim_if_solutions_do:nnn {#3} {print}
+ \xsim_if_solutions_do:nnn {#4} {print}
{ \bool_set_true:N \l__xsim_tmpa_bool }
}
{
- \xsim_if_solutions_do:nnn {#3} {use}
+ \xsim_if_solutions_do:nnn {#4} {use}
{ \bool_set_true:N \l__xsim_tmpa_bool }
}
- \tl_set:Nn \ExerciseType {#3}
+ \tl_set:Nn \ExerciseType {#4}
\bool_if:NT \l__xsim_tmpa_bool
{
\bool_if:NT \l__xsim_printsolutions_headings_bool
@@ -300,19 +284,38 @@
}
\bool_if:nTF {#1}
{
- \xsim_if_solutions_do:nnn {#3} {print}
- { \xsim_insert:nnnn {#3} {##2} {} {solution} }
+ \xsim_if_solutions_do:nnn {#4} {print}
+ { \__xsim_print_entry:nn {#4} {##2} }
}
{
- \xsim_if_solutions_do:nnn {#3} {use}
- { \xsim_insert:nnnn {#3} {##2} {} {solution} }
+ \xsim_if_solutions_do:nnn {#4} {use}
+ { \__xsim_print_entry:nn {#4} {##2} }
}
+ #3
\group_end:
}
% #1: boolean -- if true only the solutions of printed exercises will be
% output
% #2: options
+% #3: type
+\cs_new_protected:Npn \xsim_print_type_solutions:nnn #1#2#3
+ {
+ \xsim_print_type_code:nnnnn
+ {#1}
+ {
+ \xsim_verbose:n
+ { Printing~ solutions~ for~ exercise~ type~ `#3'. }
+ \keys_set:nn {xsim/print-solutions} {#2}
+ }
+ {}
+ {#3}
+ { \xsim_insert:nnnn {##1} {##2} {} {solution} }
+ }
+
+% #1: boolean -- if true only the solutions of printed exercises will be
+% output
+% #2: options
\cs_new_protected:Npn \xsim_print_all_solutions_per_type:nn #1#2
{
\xsim_foreach_exercise_type:n
@@ -348,11 +351,11 @@
% ----------------------------------------------------------------------------
-\__xsim_declare_printsolutions_condition:nn {per-section}
+\xsim_declare_printsolutions_condition:nn {per-section}
{ \__xsim_if_solutions_per_section:nnnTF }
-\__xsim_declare_printsolutions_condition:nn {per-chapter}
+\xsim_declare_printsolutions_condition:nn {per-chapter}
{ \__xsim_if_solutions_per_chapter:nnnTF }
-\__xsim_declare_printsolutions_condition:nn {per-collection}
+\xsim_declare_printsolutions_condition:nn {per-collection}
{ \__xsim_if_solutions_in_collection:nnnTF }
% ----------------------------------------------------------------------------
@@ -363,6 +366,8 @@
headings .initial:n = true ,
headings-template .tl_set:N = \l__xsim_printsolutions_headings_template_tl ,
headings-template .initial:n = default ,
+ include-exercise .bool_set:N = \l__xsim_include_question_bool ,
+ include-exercise .initial:n = false ,
section .choice: ,
section/true .code:n =
\__xsim_printsolutions_condition:nn {per-section} {true}
@@ -399,4 +404,4 @@
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.sty b/Master/texmf-dist/tex/latex/xsim/xsim.sty
index 7bc7248c47e..b7ce1cf4b3f 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.sty
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.sty
@@ -29,10 +29,10 @@
\ExplSyntaxOn
-\tl_const:Nn \c_xsim_date_tl {2017/05/19}
+\tl_const:Nn \c_xsim_date_tl {2017/09/19}
\tl_const:Nn \c_xsim_version_major_number_tl {0}
-\tl_const:Nn \c_xsim_version_minor_number_tl {8}
-\tl_const:Nn \c_xsim_version_subrelease_tl {a}
+\tl_const:Nn \c_xsim_version_minor_number_tl {10}
+\tl_const:Nn \c_xsim_version_subrelease_tl {}
\tl_const:Nx \c_xsim_version_number_tl
{
\c_xsim_version_major_number_tl .
@@ -106,4 +106,4 @@
\AtEndDocument { \xsim_do_rerun: }
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.tags.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.tags.code.tex
index b438afb203e..57e0dfd38bf 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.tags.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.tags.code.tex
@@ -61,7 +61,7 @@
{ \c_false_bool }
{ \c_false_bool }
{#1}
- \__xsim_declare_printsolutions_condition:nn {#1}
+ \xsim_declare_printsolutions_condition:nn {#1}
{ \__xsim_printsolutions_if_tagged:nnnnTF {#1} }
\keys_define:nn {xsim/print-solutions}
{
@@ -89,7 +89,6 @@
\__xsim_printsolutions_if_condition:nTF {#1}
{
\__xsim_printsolutions_condition_true:
- % TODO: doesn't return anything
\xsim_if_tagged:nnnTF {#2} {#3} {#1}
{ \prg_return_true: }
{ \prg_return_false: }
@@ -192,4 +191,4 @@
\cs_generate_variant:Nn \xsim_exercise_tags_use:nnnnnn {oo}
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.templates.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.templates.code.tex
index f08ff904b4c..fa62e3f96c4 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.templates.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.templates.code.tex
@@ -169,4 +169,4 @@
\cs_generate_variant:Nn \xsim_use_template:nn {nx,nV}
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsim.translations.code.tex b/Master/texmf-dist/tex/latex/xsim/xsim.translations.code.tex
index a52d3708632..83feaf8169d 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.translations.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.translations.code.tex
@@ -143,4 +143,4 @@
}
% ----------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop:
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 ae0338463b1..748550657d5 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsim.verbwrite.code.tex
+++ b/Master/texmf-dist/tex/latex/xsim/xsim.verbwrite.code.tex
@@ -189,7 +189,7 @@
\NewDocumentCommand \XSIMfilewritestart {sm}
{
\IfBooleanTF {#1}
- { \xsim_file_write_start:nn { \c_false_bool } {#2} }
+ { \xsim_file_write_start:nn { \c_false_bool } {#2} }
{ \xsim_file_write_start:nn { \c_true_bool } {#2} }
}
@@ -206,3 +206,4 @@
{ \int_set:Nn \l_xsim_line_gobble_int {#1} }
% ----------------------------------------------------------------------------
+\file_input_stop:
diff --git a/Master/texmf-dist/tex/latex/xsim/xsimverb.sty b/Master/texmf-dist/tex/latex/xsim/xsimverb.sty
index da6ab48c9ee..ec5fbd14dde 100644
--- a/Master/texmf-dist/tex/latex/xsim/xsimverb.sty
+++ b/Master/texmf-dist/tex/latex/xsim/xsimverb.sty
@@ -63,4 +63,4 @@
\xsim_load_module:n {verbwrite}
% --------------------------------------------------------------------------
-\tex_endinput:D
+\file_input_stop: