From a9c203f032c12d1f3a909386dbfec74d965e731b Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Tue, 26 Jan 2016 22:51:02 +0000
Subject: exsheets (26jan15)

git-svn-id: svn://tug.org/texlive/trunk@39484 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 248 +++++++++++-----------
 1 file changed, 127 insertions(+), 121 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/exsheets/exsheets.sty')

diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
index 4ee87c0109a..67ddf52f531 100644
--- a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
+++ b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
@@ -8,7 +8,7 @@
 % Web:    http://www.mychemistry.eu/forums/forum/exsheets
 % E-Mail: contact@mychemistry.eu
 % ----------------------------------------------------------------------------
-% Copyright 2011-2015 Clemens Niederberger
+% Copyright 2011-2016 Clemens Niederberger
 % 
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3
@@ -25,20 +25,26 @@
 % If you have any ideas, questions, suggestions or bugs to report, please
 % feel free to contact me.
 % ----------------------------------------------------------------------------
-\def\exsheets@date{2015/11/18}
-\def\exsheets@version{0.20}
-
 \RequirePackage { expl3 , xparse }
+\ExplSyntaxOn
+
+\tl_const:Nn \c_exsheets_date_tl    {2016/01/26}
+\tl_const:Nn \c_exsheets_version_tl {0.21}
+\tl_const:Nn \c_exsheets_info_tl
+  {Yet~ another~ package~ for~ the~ creation~ of~ exercise~ sheets~ and~ exams.}
+
 \ProvidesExplPackage
   {exsheets}
-  {\exsheets@date}
-  {\exsheets@version}
-  {Yet another package for the creation of exercise sheets and exams.}
+  {\c_exsheets_date_tl}
+  {\c_exsheets_version_tl}
+  {\c_exsheets_info_tl}
 
 % ----------------------------------------------------------------------------
 % variants of kernel functions:
 \cs_generate_variant:Nn \prop_get:NnN    { NV , Nx , cV , cf }
-\cs_generate_variant:Nn \prop_get:NnNTF  { Nx }
+\cs_generate_variant:Nn \prop_get:NnNF   { NV , Nx , cV , cf }
+\cs_generate_variant:Nn \prop_get:NnNT   { NV , Nx , cV , cf }
+\cs_generate_variant:Nn \prop_get:NnNTF  { NV , Nx , cV , cf }
 \cs_generate_variant:Nn \prop_gput:Nnn   { Nf , Nff , Nfx , Nx , Nxx , NxV , cf , cff }
 \cs_generate_variant:Nn \prop_gput_if_new:Nnn { Nxx }
 \cs_generate_variant:Nn \tl_if_blank:nTF { x }
@@ -66,6 +72,12 @@
 
 % ----------------------------------------------------------------------------
 % messages
+\msg_new:nnn {exsheets} {file-not-found}
+  {
+    You've~ requested~ the~ file~ `\tl_to_str:n {#1}'~ but~ I~ cannot~ find~
+    it~ \msg_line_context: .
+  }
+
 \msg_new:nnn {exsheets} {totalpoints}
   {
     You~ need~ to~ activate~ `points/parse'~ if~ you~ want~ to~ use~
@@ -176,6 +188,7 @@
       \exp_not:N \providecommand \exp_not:N \exsheets@save@number[2]{} ^^J
       \exp_not:N \providecommand \exp_not:N \exsheets@sum@of@points[1]{} ^^J
       \exp_not:N \providecommand \exp_not:N \exsheets@sum@of@bonus[1]{} ^^J
+      \exp_not:N \providecommand \exp_not:N \exsheets@use@id[2]{} ^^J
       % \exp_not:N \providecommand \exp_not:N \exsheets@number@of@questions[1]{} ^^J
       % \exp_not:N \providecommand \exp_not:N \numberofquestions{}
     }
@@ -205,7 +218,7 @@
 \ReadCounterFrom [ exsheets ] { section } \l__exsheets_counter_sec_int
 
 \NewCounterPattern* [ exsheets ] { question } { qu }
-\ReadCounterFrom [ exsheets ] { question } \l__exsheets_counter_qu_int
+\ReadCounterFrom [ exsheets ] { question } \l_exsheets_counter_qu_int
 
 % ----------------------------------------------------------------------------
 % (also) package options:
@@ -215,9 +228,10 @@
 \bool_new:N \l__exsheets_auto_label_bool
 \bool_new:N \l__exsheets_no_skip_after_bool
 \bool_new:N \l__exsheets_use_saved_pattern_bool
+\bool_set_true:N \l__exsheets_use_saved_pattern_bool
 
 \tl_new:N   \l__exsheets_heading_instance_tl
-\tl_set:Nn  \l__exsheets_heading_instance_tl { block }
+\tl_set:Nn  \l__exsheets_heading_instance_tl {block}
 \tl_new:N   \l__exsheets_question_heading_instance_tl
 \tl_new:N   \l__exsheets_solution_heading_instance_tl
 \tl_new:N   \l_exsheets_heading_title_user_format_tl
@@ -319,13 +333,13 @@
 \fp_new:N         \g_exsheets_total_bonus_fp
 
 \tl_new:N         \l__exsheets_points_name_tl
-\tl_set:Nn        \l__exsheets_points_name_tl { P. }
+\tl_set:Nn        \l__exsheets_points_name_tl {P.}
 \tl_new:N         \l__exsheets_points_name_plural_tl
-\tl_set:Nn        \l__exsheets_points_name_plural_tl { P. }
+\tl_set:Nn        \l__exsheets_points_name_plural_tl {P.}
 \tl_new:N         \l__exsheets_bonus_name_tl
-\tl_set:Nn        \l__exsheets_bonus_name_tl { P. }
+\tl_set:Nn        \l__exsheets_bonus_name_tl {P.}
 \tl_new:N         \l__exsheets_bonus_name_plural_tl
-\tl_set:Nn        \l__exsheets_bonus_name_plural_tl { P. }
+\tl_set:Nn        \l__exsheets_bonus_name_plural_tl {P.}
 \tl_new:N         \l__exsheets_points_number_format_tl
 \tl_new:N         \l__exsheets_bonus_number_format_tl
 \tl_new:N         \l__exsheets_points_pre_bonus_marker_tl
@@ -675,7 +689,7 @@
         \cs_set:cpn { __exsheets_variation_ \int_to_roman:n {#1} :n } ##1
           {
             ##1
-            \cs_set:Npn \exsheets_last_variant: { ##1 }
+            \cs_set:Npn \exsheets_last_variant: {##1}
             \use:c { __exsheets_variation_ \int_to_roman:n { #1 + 1 } :n }
           }
       }
@@ -864,10 +878,9 @@
               { \int_to_arabic:n { \g__exsheets_questions_id_int } }
               { \tl_use:c { l__exsheets_questions_#1_tl } }
             % add to #2 list, if it's a new one
-            \prop_get:cfN { g__exsheets_#2_prop }
+            \prop_get:cfNF { g__exsheets_#2_prop }
               { \tl_use:c { l__exsheets_questions_#1_tl } }
               \l__exsheets_tmpa_tl
-            \tl_if_eq:NNT \l__exsheets_tmpa_tl \q_no_value
               {
                 \prop_gput:cfn { g__exsheets_#2_prop }
                   { \tl_use:c { l__exsheets_questions_#1_tl } }
@@ -878,18 +891,17 @@
         \bool_if:cT { g__exsheets_use_#2_bool }
           {
             % is this question an active one?
-            \prop_get:cfN { g__exsheets_#2_active_prop }
+            \prop_get:cfNTF { g__exsheets_#2_active_prop }
               { \tl_use:c { l__exsheets_questions_#1_tl } }
               \l__exsheets_tmpa_tl
-            \tl_if_eq:NNTF \l__exsheets_tmpa_tl \q_no_value
-              {
-                \bool_set_false:c { l__exsheets_#1_active_bool }
-                \bool_set_false:N \l__exsheets_questions_print_bool
-              }
               {
                 \bool_set_true:c { l__exsheets_#1_active_bool }
                 \bool_set_true:N \l__exsheets_use_this_question_bool
               }
+              {
+                \bool_set_false:c { l__exsheets_#1_active_bool }
+                \bool_set_false:N \l__exsheets_questions_print_bool
+              }
           }
       }
     \cs_new_protected:cpn { __exsheets_solutions_use_#2: }
@@ -907,10 +919,9 @@
               \l__exsheets_tmpa_tl
               \l__exsheets_tmpb_tl
             % test if #1 is active
-            \prop_get:cVN { g__exsheets_#2_active_prop }
+            \prop_get:cVNF { g__exsheets_#2_active_prop }
               \l__exsheets_tmpb_tl
               \l__exsheets_tmpc_tl
-            \tl_if_eq:NNT \l__exsheets_tmpc_tl \q_no_value
               { \bool_set_false:N \l__exsheets_solutions_use_bool }
           }
       }
@@ -1066,7 +1077,7 @@
     \__exsheets_start_question_if_used:n {#1}
     \bool_if:nT
       {
-        \l__exsheets_questions_print_bool &&
+        % \l__exsheets_questions_print_bool &&
         \g__exsheets_questions_use_bool &&
         !\l__exsheets_questions_deactivate_bool
       }
@@ -1084,7 +1095,8 @@
             \exsheets_label:V \l__exsheets_questions_label_tl
             \exsheets_set_ref_properties:V \l__exsheets_questions_label_tl
           }
-        \__exsheets_save_number_in:N \g__exsheets_question_number_prop
+        \__exsheets_save_number_in:N \g_exsheets_question_identification_prop
+        % TODO: don't print, only save if \l__exsheets_questions_print_bool is false
         \__exsheets_save_and_print_question_body:VVV
           \BODY
           \l__exsheets_questions_pre_body_hook_tl
@@ -1103,7 +1115,7 @@
                   { bonus-points = \fp_to_decimal:N \g__exsheets_this_question_bonus_fp }
               }
           }
-        #2
+        \bool_if:NT \l__exsheets_questions_print_bool {#2}
       }
   }
 
@@ -1117,10 +1129,13 @@
         { \@fileswfalse }
       \exsheets_set_question_properties:n { question-body = {#1} }
     \group_end:
-    #2
-    { #1 }
-    #3
-    \exsheets_add_space:N \l__exsheets_questions_skip_below_dim
+    \bool_if:NT \l__exsheets_questions_print_bool
+      {
+        #2
+        { #1 }
+        #3
+        \exsheets_add_space:N \l__exsheets_questions_skip_below_dim
+      }
   }
 \cs_generate_variant:Nn \__exsheets_save_and_print_question_body:nnn { VVV }
 
@@ -1197,7 +1212,7 @@
 \cs_new_protected:Npn \exsheets_update_referencing_command:NN #1#2
   {
     \cs_set:Npx #1 ##1
-      { \exp_not:o {#2} { \exsheets_label_format:n { ##1 } } }
+      { \exp_not:o {#2} { \exsheets_label_format:n {##1} } }
   }
 
 \cs_new_protected:Npn \exsheets_update_referencing_commands:
@@ -1364,14 +1379,25 @@
               \l__exsheets_parse_points_bool
             ) ||
             (
-              \l__exsheets_parse_points_bool &&
-              \l__exsheets_questions_print_bool
+              \l__exsheets_parse_points_bool%  &&
+              % \l__exsheets_questions_print_bool
             )
           }
           {
             \exsheets_add_points:V \l__exsheets_question_points_fp
             \exsheets_add_bonus:V  \l__exsheets_question_bonus_fp
           }
+        \tl_if_blank:VTF \l__exsheets_questions_id_tl
+          {
+            \tl_set:Nx \l__exsheets_tmpa_tl
+               { \int_use:N \g__exsheets_questions_id_int }
+          }
+          {
+            \tl_set_eq:NN
+              \l__exsheets_tmpa_tl
+              \l__exsheets_questions_id_tl
+          }
+        \tl_set_eq:NN \CurrentQuestionID \l__exsheets_tmpa_tl
         \bool_if:NT \l__exsheets_questions_print_bool
           {
             \bool_if:NTF \l__exsheets_exam_bool
@@ -1385,17 +1411,6 @@
                   \l__exsheets_questions_title_tl
                   \l__exsheets_exercise_name_tl
               }
-            \tl_if_blank:VTF \l__exsheets_questions_id_tl
-              {
-                \tl_set:Nx \l__exsheets_tmpa_tl
-                  { \int_use:N \g__exsheets_questions_id_int }
-              }
-              {
-                \tl_set_eq:NN
-                  \l__exsheets_tmpa_tl
-                  \l__exsheets_questions_id_tl
-              }
-            \tl_set_eq:NN \CurrentQuestionID \l__exsheets_tmpa_tl
             \bool_if:nTF
               { \l__exsheets_parse_points_bool && !\l__exsheets_only_print_points_bool }
               {
@@ -1452,7 +1467,7 @@
   }
 
 % current question number:
-\prop_new:N \g__exsheets_question_number_prop
+\prop_new:N \g_exsheets_question_identification_prop
 
 \cs_new_protected:Npn \exsheets@save@number #1#2
   { \expandafter\global\expandafter\edef\csname exsheets@question@#1\endcsname{#2} }
@@ -1496,8 +1511,7 @@
 
 \cs_new_protected:Npn \__exsheets_restore_number_from_and_do:Nnn #1#2#3
   {
-    \prop_get:NnN #1 {#2} \l__exsheets_tmpc_tl
-    \tl_if_eq:NNF \l__exsheets_tmpc_tl \q_no_value
+    \prop_get:NnNT #1 {#2} \l__exsheets_tmpc_tl
       {
         \exp_after:wN
         \__exsheets_read_number:w \l__exsheets_tmpc_tl \q_stop
@@ -1534,7 +1548,7 @@
     \cs_if_exist:NT \thechapter
       { \int_set:Nn \l__exsheets_counter_ch_int {#1} }
     \int_set:Nn \l__exsheets_counter_sec_int {#2}
-    \int_set:Nn \l__exsheets_counter_qu_int {#3}
+    \int_set:Nn \l_exsheets_counter_qu_int {#3}
   }
 
 % map ID's to number of used questions
@@ -1622,7 +1636,7 @@
   {
     \prop_new:c { g__exsheets_question_property_#1_prop }
     \keys_define:nn { question / meta }
-      { #1 .code:n = \__exsheets_question_set_property:nn {#1} { ##1 } }
+      { #1 .code:n = \__exsheets_question_set_property:nn {#1} {##1} }
   }
 
 \NewDocumentCommand \DeclareQuestionProperty { m }
@@ -1801,6 +1815,8 @@
 
 \cs_new_protected:Npn \exsheets_file_input_if_exist:n #1
   { \file_if_exist:nT {#1} { \file_input:n {#1} } }
+\cs_new_protected:Npn \exsheets_file_input_if_exist:nF #1#2
+  { \file_if_exist:nTF {#1} { \file_input:n {#1} } {#2} }
 
 \cs_new_protected:Npn \exsheets_prop_count:N #1
   {
@@ -1842,7 +1858,8 @@
           \l__exsheets_tmpc_int
           \g__exsheets_questions_id_int
         \int_gzero:N \g__exsheets_select_random_int
-        \exsheets_file_input_if_exist:n { ##1 }
+        \exsheets_file_input_if_exist:nF {##1}
+          { \msg_error:nnn {exsheets} {file-not-found} {##1} }
         \__exsheets_prop_count:NN
           \g__exsheets_included_questions_prop
           \l__exsheets_tmpa_int
@@ -1851,7 +1868,7 @@
             \exsheets_debug_box:nn
               { \linewidth }
               {
-                The~file~ ` \texttt { \tl_to_str:n { ##1 } } ' ~contains~
+                The~file~ ` \texttt { \tl_to_str:n {##1} } ' ~contains~
                 \exsheets_prop_count:N \g__exsheets_included_questions_prop
                 \c_space_tl questions~with~the~following~IDs:\par
                 \cs_set_protected:Npn \__exsheets_list_comma:
@@ -1863,8 +1880,8 @@
         \bool_set_false:N \l__exsheets_questions_deactivate_bool
         \int_set_eq:NN    \l__exsheets_tmpd_int \g__exsheets_questions_id_int
         \int_gset_eq:NN   \g__exsheets_questions_id_int \l__exsheets_tmpc_int
-        \__exsheets_select_question_random:n { ##1 }
-        \exsheets_file_input_if_exist:n { ##1 }
+        \__exsheets_select_question_random:n {##1}
+        \exsheets_file_input_if_exist:n {##1}
         \int_gset_eq:NN   \g__exsheets_questions_id_int \l__exsheets_tmpd_int
         \prop_gclear:N    \g__exsheets_included_questions_prop
         \clist_clear:N    \l__exsheets_include_id_clist
@@ -2020,7 +2037,7 @@
                 \bool_if:cT { g__exsheets_use_####1_bool }
                   {
                     \bool_set_true:N \l__exsheets_use_selection_bool
-                    \prop_get:cnNT { g__exsheets_questions_####2_prop } { ##1 }
+                    \prop_get:cnNT { g__exsheets_questions_####2_prop } {##1}
                       \l__exsheets_tmpa_tl
                       {
                         \prop_if_in:cVT { g__exsheets_####1_active_prop }
@@ -2138,7 +2155,7 @@
 \bool_new:N       \l__exsheets_solutions_print_all_bool
 \bool_set_false:N \l__exsheets_solutions_print_all_bool
 
-% \prop_new:N       \g__exsheets_question_number_prop
+% \prop_new:N       \g_exsheets_question_identification_prop
 \prop_new:N       \g__exsheets_solutions_content_prop
 \prop_new:N       \g__exsheets_solutions_questions_id_prop
 \prop_new:N       \g__exsheets_solutions_names_prop
@@ -2170,7 +2187,7 @@
       {
         \bool_if:NT \l__exsheets_solutions_print_here_bool
           {
-            \int_set:Nn \l__exsheets_counter_qu_int { \arabic{question} }
+            \int_set:Nn \l_exsheets_counter_qu_int { \arabic{question} }
             \__exsheets_get_sectioning_numbers:
             \__exsheets_print_solution:VVVn
               \l__exsheets_qu_counter_interpretation_tl
@@ -2326,7 +2343,7 @@
 \int_new:N \l__exsheets_current_ch_int
 \int_new:N \l__exsheets_counter_sec_int
 \int_new:N \l__exsheets_current_sec_int
-\int_new:N \l__exsheets_counter_qu_int
+\int_new:N \l_exsheets_counter_qu_int
 
 \keys_define:nn {exsheets}
   {
@@ -2346,12 +2363,15 @@
     \cs_if_exist:NT \chapter
       { \int_set:Nn \l__exsheets_counter_ch_int { \arabic{chapter} } }
     \int_set:Nn \l__exsheets_counter_sec_int { \arabic{section} }
-    \int_set:Nn \l__exsheets_counter_qu_int { \arabic{question} }
+    \int_set:Nn \l_exsheets_counter_qu_int { \arabic{question} }
   }
 
+% #1: numeric ID
+% #2: condition
 \cs_new_protected:Npn \__exsheets_print_solution_if:nn #1#2
   {
-    \bool_if:nT {#2}
+    \bool_if:nT
+      { #2 && \prop_if_in_p:Nn \g__exsheets_solutions_questions_id_prop {#1} }
       {
         \prop_get:NnN \g__exsheets_solutions_names_prop
           {#1} \l__exsheets_tmpa_tl
@@ -2394,11 +2414,11 @@
   {
     \tl_if_blank:nTF {#1}
       {
-        \prop_map_inline:Nn \g__exsheets_question_number_prop
+        \prop_map_inline:Nn \g_exsheets_question_identification_prop
           {
-            \prop_if_in:NnT \g__exsheets_solutions_names_prop { ##1 }
+            \prop_if_in:NnT \g__exsheets_solutions_names_prop {##1}
               {
-                \__exsheets_print_solutions_section:nnn { ##1 } { ##2 }
+                \__exsheets_print_solutions_section:nnn {##1} {##2}
                   { \arabic{section} }
               }
           }
@@ -2420,22 +2440,22 @@
         \tl_if_blank:nF {#2} { \int_set:Nn \l__exsheets_tmpb_int {#2} }
         \int_do_while:nn { \l__exsheets_tmpa_int <= \l__exsheets_tmpb_int }
           {
-            \prop_map_inline:Nn \g__exsheets_question_number_prop
+            \prop_map_inline:Nn \g_exsheets_question_identification_prop
               {
-                \prop_if_in:NnT \g__exsheets_solutions_names_prop { ##1 }
+                \prop_if_in:NnT \g__exsheets_solutions_names_prop {##1}
                   {
                     \__exsheets_print_solutions_section:nnn
-                      { ##1 } { ##2 } { \l__exsheets_tmpa_int }
+                      {##1} {##2} { \l__exsheets_tmpa_int }
                   }
               }
             \int_incr:N \l__exsheets_tmpa_int
           }
       }
       {
-        \prop_map_inline:Nn \g__exsheets_question_number_prop
+        \prop_map_inline:Nn \g_exsheets_question_identification_prop
           {
-            \prop_if_in:NnT \g__exsheets_solutions_names_prop { ##1 }
-              { \__exsheets_print_solutions_section:nnn { ##1 } { ##2 } {#1} }
+            \prop_if_in:NnT \g__exsheets_solutions_names_prop {##1}
+              { \__exsheets_print_solutions_section:nnn {##1} {##2} {#1} }
           }
       }
   }
@@ -2452,11 +2472,11 @@
   {
     \tl_if_blank:nTF {#1}
       {
-        \prop_map_inline:Nn \g__exsheets_question_number_prop
+        \prop_map_inline:Nn \g_exsheets_question_identification_prop
           {
-            \prop_if_in:NnT \g__exsheets_solutions_names_prop { ##1 }
+            \prop_if_in:NnT \g__exsheets_solutions_names_prop {##1}
               {
-                \__exsheets_print_solutions_chapter:nnn { ##1 } { ##2 }
+                \__exsheets_print_solutions_chapter:nnn {##1} {##2}
                   { \arabic{chapter} }
               }
           }
@@ -2478,22 +2498,24 @@
         \tl_if_blank:nF {#2} { \int_set:Nn \l__exsheets_tmpb_int {#2} }
         \int_do_while:nn { \l__exsheets_tmpa_int <= \l__exsheets_tmpb_int }
           {
-            \prop_map_inline:Nn \g__exsheets_question_number_prop
+            \prop_map_inline:Nn \g_exsheets_question_identification_prop
               {
-                \prop_if_in:NnT \g__exsheets_solutions_names_prop { ##1 }
+                \prop_if_in:NnT \g__exsheets_solutions_names_prop {##1}
                   {
                     \__exsheets_print_solutions_chapter:nnn
-                      { ##1 } { ##2 } { \l__exsheets_tmpa_int }
+                      {##1}
+                      {##2}
+                      { \l__exsheets_tmpa_int }
                   }
               }
             \int_incr:N \l__exsheets_tmpa_int
           }
       }
       {
-        \prop_map_inline:Nn \g__exsheets_question_number_prop
+        \prop_map_inline:Nn \g_exsheets_question_identification_prop
           {
-            \prop_if_in:NnT \g__exsheets_solutions_names_prop { ##1 }
-              { \__exsheets_print_solutions_chapter:nnn { ##1 } { ##2 } {#1} }
+            \prop_if_in:NnT \g__exsheets_solutions_names_prop {##1}
+              { \__exsheets_print_solutions_chapter:nnn {##1} {##2} {#1} }
           }
       }
   }
@@ -2508,8 +2530,9 @@
 % print all:
 \cs_new_protected:Npn \exsheets_print_solutions_all:
   {
-    \prop_map_function:NN \g__exsheets_question_number_prop
+    \prop_map_function:NN \g_exsheets_question_identification_prop
       \__exsheets_print_solutions_all:nn
+    % \prop_show:N \g_exsheets_question_identification_prop
   }
 
 \cs_new:Npn \__exsheets_sectioning_hook:nn #1#2
@@ -2530,6 +2553,14 @@
 \cs_generate_variant:Nn \__exsheets_sectioning_hook:nn { nV }
 
 \cs_new_protected:Npn \__exsheets_print_solutions_all:nn #1#2
+  { \exsheets_print_solutions_if:nnn { \c_true_bool } {#1} {#2} }
+
+% #1: condition
+% #2: numeric question ID
+% #3: question number string (stored in \g_exsheets_question_identification_prop)
+% use function in a wrapper which in turn is fed to
+%    \prop_map_function:NN \g_exsheets_question_identification_prop 
+\cs_new_protected:Npn \exsheets_print_solutions_if:nnn #1#2#3
   {
     \int_set_eq:NN
       \l__exsheets_current_sec_int
@@ -2537,43 +2568,8 @@
     \int_set_eq:NN
       \l__exsheets_current_ch_int
       \l__exsheets_counter_ch_int
-    \__exsheets_read_number:w #2 \q_stop
-    \prop_get:NnNT \g__exsheets_solutions_names_prop
-      {#1} \l__exsheets_tmpa_tl
-      {
-        \tl_set_eq:NN \l__exsheets_solutions_name_tl \l__exsheets_tmpa_tl
-        \prop_get:NnN \g__exsheets_solutions_content_prop
-          {#1} \l__exsheets_tmpb_tl
-        \prop_get:NnN \g__exsheets_solutions_questions_id_prop
-          {#1} \l__exsheets_tmpc_tl
-        \prop_get:NnN \g__exsheets_solutions_counter_prop
-          {#1} \l__exsheets_tmpd_tl
-        \group_begin:
-          \tl_set_eq:NN \CurrentQuestionID \l__exsheets_tmpc_tl
-          \__exsheets_sectioning_hook:nV { ch }
-            \l__exsheets_new_chapter_hook_tl
-          \__exsheets_sectioning_hook:nV { sec }
-            \l__exsheets_new_section_hook_tl
-        \group_end:
-        \bool_if:NTF \l__exsheets_use_saved_pattern_bool
-          {
-            \eSaveCounterPatternFrom [ exsheets ]
-              \l__exsheets_current_pattern_interpretation_tl
-              \l__exsheets_current_pattern_tl
-              \l__exsheets_tmpd_tl
-          }
-          {
-            \eSaveCounterPatternFrom [ exsheets ]
-              \l__exsheets_current_pattern_interpretation_tl
-              \l__exsheets_current_pattern_tl
-              \l__exsheets_qu_counter_pattern_tl
-          }
-        \__exsheets_print_solution:VVVV
-          \l__exsheets_current_pattern_tl
-          \l__exsheets_tmpa_tl
-          \l__exsheets_tmpc_tl
-          \l__exsheets_tmpb_tl
-      }
+    \__exsheets_read_number:w #3 \q_stop
+    \__exsheets_print_solution_if:nn {#2} {#1}
   }
 
 % print by ID:
@@ -2612,7 +2608,7 @@
                   \prop_get:NnN \g__exsheets_solutions_counter_prop
                     {##1} \l__exsheets_tmpd_tl
                   \__exsheets_restore_number_from_and_do:Nnn
-                    \g__exsheets_question_number_prop
+                    \g_exsheets_question_identification_prop
                     {##1}
                     {
                       \bool_if:NTF \l__exsheets_use_saved_pattern_bool
@@ -2644,14 +2640,14 @@
   {
     \int_zero:N \l__exsheets_counter_ch_int
     \int_zero:N \l__exsheets_counter_sec_int
-    \int_zero:N \l__exsheets_counter_qu_int
+    \int_zero:N \l_exsheets_counter_qu_int
     \tl_if_in:nnF {#1} { @@@ }
       {
         \tl_if_blank:nF {#1}
           { \int_set:Nn \l__exsheets_counter_ch_int {#1} }
       }
     \int_set:Nn \l__exsheets_counter_sec_int {#2}
-    \int_set:Nn \l__exsheets_counter_qu_int {#3}
+    \int_set:Nn \l_exsheets_counter_qu_int {#3}
   }
 
 \cs_new_protected:Npn \exsheets_solutions_print_name:nnn #1#2#3
@@ -2778,7 +2774,7 @@
 % the `tasks' list
 \RequirePackage {tasks} [2014/07/03]
 \AddCounterPattern* [tasks] {question} {qu}
-\ReadCounterFrom    [tasks] {question} \l__exsheets_counter_qu_int
+\ReadCounterFrom    [tasks] {question} \l_exsheets_counter_qu_int
 
 % ----------------------------------------------------------------------------
 % the \blank{<words>} command
@@ -3290,6 +3286,16 @@ HISTORY:
                        - allow begin and end of pseudo-environments as hooks
                          to the question an solution environments
 2015/11/18 v0.20       - add tagging feature
+                       - new: \DeclareExSheetsHeadingContainer
+2016/01/26 v0.21       - give error message when \includequestions tries to
+                         load a file which can't be found (issue)
+                       - \exsheets_print_solutions_if:nnn
+                       - \l__exsheets_counter_qu_int =>
+                         \l_exsheets_counter_qu_int
+                       - \g__exsheets_question_number_prop =>
+                         \g_exsheets_question_identification_prop
+                       - make question properties accessable when question is
+                         not printed
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % TODO:
-- 
cgit v1.2.3

