From 20bb32deefaa3ad8f476dd80e6b082cf7d6a6e6a Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 11 Feb 2015 00:08:37 +0000
Subject: exsheets (9feb15)

git-svn-id: svn://tug.org/texlive/trunk@36252 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 132 ++++++++++++----------
 1 file changed, 74 insertions(+), 58 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 563a4d10dfd..758f981d217 100644
--- a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
+++ b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
@@ -8,7 +8,7 @@
 % Web:    https://bitbucket.org/cgnieder/exsheets/
 % E-Mail: contact@mychemistry.eu
 % ----------------------------------------------------------------------------
-% Copyright 2011-2014 Clemens Niederberger
+% Copyright 2011-2015 Clemens Niederberger
 % 
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3
@@ -25,8 +25,8 @@
 % If you have any ideas, questions, suggestions or bugs to report, please
 % feel free to contact me.
 % ----------------------------------------------------------------------------
-\def\exsheets@date{2014/10/14}
-\def\exsheets@version{0.17}
+\def\exsheets@date{2015/02/09}
+\def\exsheets@version{0.18}
 
 \RequirePackage { expl3 , xparse }
 \ProvidesExplPackage
@@ -219,6 +219,8 @@
 \bool_new:N \l__exsheets_questions_totoc_bool
 \bool_new:N \l__exsheets_solutions_totoc_bool
 \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
 
 \tl_new:N   \l__exsheets_heading_instance_tl
 \tl_set:Nn  \l__exsheets_heading_instance_tl { block }
@@ -229,9 +231,16 @@
 \tl_new:N   \l_exsheets_heading_subtitle_user_format_tl
 \tl_set:Nn  \l_exsheets_heading_subtitle_user_format_tl { \normalsize\itshape }
 \tl_new:N   \l__exsheets_questions_toclevel_tl
-\tl_set:Nn  \l__exsheets_questions_toclevel_tl { subsection }
+\tl_set:Nn  \l__exsheets_questions_toclevel_tl {subsection}
 \tl_new:N   \l__exsheets_solutions_toclevel_tl
-\tl_set:Nn  \l__exsheets_solutions_toclevel_tl { subsection }
+\tl_set:Nn  \l__exsheets_solutions_toclevel_tl {subsection}
+\tl_new:N   \l__exsheets_new_chapter_hook_tl
+\tl_new:N   \l__exsheets_new_section_hook_tl
+
+\dim_new:N  \l__exsheets_questions_skip_below_dim
+\dim_set:Nn \l__exsheets_questions_skip_below_dim { .5\baselineskip }
+\dim_new:N  \l__exsheets_solutions_skip_below_dim
+\dim_set:Nn \l__exsheets_solutions_skip_below_dim { .5\baselineskip }
 
 \keys_define:nn {exsheets}
   {
@@ -268,7 +277,26 @@
       \tl_set:Nn \l__exsheets_solutions_toclevel_tl {#1} ,
     questions-toc-level       .tl_set:N   = \l__exsheets_questions_toclevel_tl ,
     solutions-toc-level       .tl_set:N   = \l__exsheets_solutions_toclevel_tl ,
-    auto-label                .bool_set:N = \l__exsheets_auto_label_bool
+    skip-below                .code:n     =
+      \dim_set:Nn \l__exsheets_questions_skip_below_dim {#1}
+      \dim_set:Nn \l__exsheets_solutions_skip_below_dim {#1} ,
+    no-skip-below             .bool_set:N = \l__exsheets_no_skip_after_bool ,
+    auto-label                .bool_set:N = \l__exsheets_auto_label_bool ,
+    label-format              .code:n     =
+      \cs_set:Npn \exsheets_label_format:n ##1 {#1}
+      \exsheets_update_referencing_commands: ,
+    label-cmd                 .code:n     =
+      \cs_set:Npn \__exsheets_label:n {#1}
+      \exsheets_update_referencing_commands: ,
+    ref-cmd                   .code:n     =
+      \cs_set:Npn \__exsheets_ref:n {#1}
+      \exsheets_update_referencing_commands: ,
+    page-ref-cmd              .code:n     =
+      \cs_set:Npn \__exsheets_pageref:n {#1}
+      \exsheets_update_referencing_commands: ,
+    chapter-hook              .tl_set:N   = \l__exsheets_new_chapter_hook_tl ,
+    section-hook              .tl_set:N   = \l__exsheets_new_section_hook_tl ,
+    use-saved-counter-format  .bool_set:N = \l__exsheets_use_saved_pattern_bool
   }
 \keys_set:nn {exsheets} { counter-format = qu. }
 
@@ -794,7 +822,7 @@
   }
 
 % ----------------------------------------------------------------------------
-% Aufgaben und L�sungen
+% Aufgaben und Lösungen
 \bool_new:N        \g__exsheets_questions_use_bool
 \bool_gset_true:N  \g__exsheets_questions_use_bool
 \bool_new:N        \l__exsheets_questions_use_bool
@@ -806,21 +834,9 @@
 \bool_new:N        \l__exsheets_solutions_use_bool
 \bool_set_true:N   \l__exsheets_solutions_use_bool
 
-\dim_new:N         \l__exsheets_questions_skip_below_dim
-\dim_set:Nn        \l__exsheets_questions_skip_below_dim { .5\baselineskip }
-\dim_new:N         \l__exsheets_solutions_skip_below_dim
-\dim_set:Nn        \l__exsheets_solutions_skip_below_dim { .5\baselineskip }
-
 \cs_new_nopar:Npn \exsheets_glue:N #1
   { \cleaders \vbox:n {} \skip_vertical:N #1 }
 
-\keys_define:nn {exsheets}
-  {
-    skip-below .code:n =
-      \dim_set:Nn \l__exsheets_questions_skip_below_dim {#1}
-      \dim_set:Nn \l__exsheets_solutions_skip_below_dim {#1}
-  }
-
 % Einteilung in Klassen, Themen und andere Gruppierungen:
 \prop_new:N \l__exsheets_class_prop
 \tl_new:N   \g__exsheets_use_current_question_tl
@@ -989,8 +1005,13 @@
 
 \cs_new:Npn \exsheets_h_or_vspace:N #1
   {
-    \cs_if_eq:NNTF \exsheets_par: \scan_stop:
-      { \c_space_tl }% the `runin' case
+    \bool_if:nTF
+      {
+        \l__exsheets_heading_runin_bool ||
+        \l__exsheets_heading_inline_bool ||
+        \l__exsheets_no_skip_after_bool
+      }
+      { } % { \c_space_tl }
       {
         \exsheets_par:
         \dim_compare:nNnT { \parskip } = { 0pt }
@@ -1040,15 +1061,15 @@
       }
   }
 
-\cs_new:Npn \__exsheets_save_and_print_question_body:n #1
+\cs_new_protected:Npn \__exsheets_save_and_print_question_body:n #1
   {
-    \tl_use:N \l__exsheets_questions_pre_body_hook_tl
     \group_begin:
       \bool_if:NF \l__exsheets_save_question_body_to_aux_bool
         { \@fileswfalse }
       \exsheets_set_question_properties:n { question-body = {#1} }
     \group_end:
-    #1
+    \tl_use:N \l__exsheets_questions_pre_body_hook_tl
+      { #1 }
     \tl_use:N \l__exsheets_questions_post_body_hook_tl
     \exsheets_h_or_vspace:N \l__exsheets_questions_skip_below_dim
   }
@@ -1147,22 +1168,6 @@
   }
 \cs_generate_variant:Nn \exsheets_set_ref_properties:n { V }
 
-\keys_define:nn {exsheets}
-  {
-    label-format .code:n =
-      \cs_set:Npn \exsheets_label_format:n ##1 {#1}
-      \exsheets_update_referencing_commands: ,
-    label-cmd    .code:n =
-      \cs_set:Npn \__exsheets_label:n {#1}
-      \exsheets_update_referencing_commands: ,
-    ref-cmd      .code:n =
-      \cs_set:Npn \__exsheets_ref:n {#1}
-      \exsheets_update_referencing_commands: ,
-    page-ref-cmd .code:n =
-      \cs_set:Npn \__exsheets_pageref:n {#1}
-      \exsheets_update_referencing_commands:
-  }
-
 \exsheets_update_referencing_commands:
 
 \cs_new_protected:Npn \__exsheets_determine_question_usage:
@@ -1531,6 +1536,7 @@
       \bool_set_false:N  \l__exsheets_questions_use_bool ,
     use             .default:n   = true ,
     skip-below      .dim_set:N   = \l__exsheets_questions_skip_below_dim ,
+    no-skip-below   .bool_set:N  = \l__exsheets_no_skip_after_bool ,
     pre-hook        .tl_set:N    = \l__exsheets_questions_pre_hook_tl ,
     post-hook       .tl_set:N    = \l__exsheets_questions_post_hook_tl ,
     pre-body-hook   .tl_set:N    = \l__exsheets_questions_pre_body_hook_tl ,
@@ -2217,8 +2223,6 @@
     \group_end:
   }
 
-\bool_new:N \l__exsheets_use_saved_pattern_bool
-
 \int_new:N \l__exsheets_counter_ch_int
 \int_new:N \l__exsheets_current_ch_int
 \int_new:N \l__exsheets_counter_sec_int
@@ -2235,10 +2239,7 @@
     exsheets_print_solutions / all     .code:n    =
       { \exsheets_print_solutions_all: } ,
     exsheets_print_solutions / byID    .code:n    =
-      { \exsheets_print_solutions_byID:n {#1} } ,
-    chapter-hook .tl_set:N = \l__exsheets_new_chapter_hook_tl ,
-    section-hook .tl_set:N = \l__exsheets_new_section_hook_tl ,
-    use-saved-counter-format .bool_set:N = \l__exsheets_use_saved_pattern_bool
+      { \exsheets_print_solutions_byID:n {#1} }
   }
 
 \cs_new_protected:Npn \__exsheets_get_sectioning_numbers:
@@ -2571,16 +2572,26 @@
 % #4: body
 \cs_new_protected:Npn \__exsheets_print_solution:nnnn #1#2#3#4
   {
-    \tl_use:N \l__exsheets_solutions_pre_hook_tl
-    \exsheets_solutions_print_name:nnn {#1} {#2} {#3}
-    \tl_use:N \l__exsheets_solutions_pre_body_hook_tl
-    \use:n {#4}
-    \tl_use:N \l__exsheets_solutions_post_body_hook_tl
-    \tl_use:N \l__exsheets_solutions_post_hook_tl
-    \exsheets_h_or_vspace:N \l__exsheets_solutions_skip_below_dim
+    \exsheetsprintsolution
+      {
+        \tl_use:N \l__exsheets_solutions_pre_hook_tl
+        \exsheets_solutions_print_name:nnn {#1} {#2} {#3}
+      }
+      {
+        \tl_use:N \l__exsheets_solutions_pre_body_hook_tl
+        #4
+        \tl_use:N \l__exsheets_solutions_post_body_hook_tl
+        \tl_use:N \l__exsheets_solutions_post_hook_tl
+        \exsheets_h_or_vspace:N \l__exsheets_solutions_skip_below_dim
+      }
   }
 \cs_generate_variant:Nn \__exsheets_print_solution:nnnn { VVV, VVVV }
 
+% a user command to be redefined as needed; must have two mandatory arguments!
+% #1: heading
+% #2: body
+\cs_new:Npn \exsheetsprintsolution #1#2 { #1#2 }
+
 \cs_new:Npn \PrintSolutionsTF
   { \bool_if:NTF \l__exsheets_solutions_print_bool }
 \cs_new:Npn \PrintSolutionsT
@@ -2616,6 +2627,7 @@
     name            .tl_set:N   = \l__exsheets_solutions_name_tl ,
     sorted          .bool_set:N = \l__exsheets_print_byID_sorted_bool ,
     skip-below      .dim_set:N  = \l__exsheets_solutions_skip_below_dim ,
+    no-skip-below   .bool_set:N = \l__exsheets_no_skip_after_bool ,
     pre-body-hook   .tl_set:N   = \l__exsheets_solutions_pre_body_hook_tl ,
     post-body-hook  .tl_set:N   = \l__exsheets_solutions_post_body_hook_tl ,
     pre-hook        .tl_set:N   = \l__exsheets_solutions_pre_hook_tl ,
@@ -2866,7 +2878,7 @@
 \DeclareTranslation { Turkish   } { exsheets-exercise-name } { Egzersiz     }
 \DeclareTranslation { Croatian  } { exsheets-exercise-name } { Primjer      }
 \DeclareTranslation { Hungarian } { exsheets-exercise-name } { Gyakorol     }
-\DeclareTranslation { Danish    } { exsheets-exercise-name } { \O{}velse    }
+\DeclareTranslation { Danish    } { exsheets-exercise-name } { Opgave       }
 \DeclareTranslation { Norsk     } { exsheets-exercise-name } { Oppgave      }
 \DeclareTranslation { Portuges  } { exsheets-exercise-name } { Exerc\'\i cio }
 % translation for the question
@@ -2898,7 +2910,7 @@
 \DeclareTranslation { Turkish   } { exsheets-solution-name } { \c C\"oz\"um }
 \DeclareTranslation { Croatian  } { exsheets-solution-name } { Rje\v{s}enje }
 \DeclareTranslation { Hungarian } { exsheets-solution-name } { Megold\'{a}s }
-\DeclareTranslation { Danish    } { exsheets-solution-name } { Opl\o{}sning }
+\DeclareTranslation { Danish    } { exsheets-solution-name } { L\o{}sning   }
 \DeclareTranslation { Norsk     } { exsheets-solution-name } { L\o{}sning   }
 \DeclareTranslation { Portuges  } { exsheets-solution-name } { Solu\c c\~ao }
 % the actual translating
@@ -3152,13 +3164,17 @@ HISTORY:
                        - fix issue #23
                        - use only one version number for the whole bundle
 2014/10/14 v0.17       - new option `use-saved-counter-format'
+2015/02/09 v0.18       - added correct Danish translations - thanks to Jonas
+                         Nyrup
+                       - introduce \exsheetsprintsolution, see
+                         http://tex.stackexchange.com/q/227078/ for motivation
+                       - change test in \exsheets_h_or_vspace:N to something
+                         more reliable and meaningful
+                       - new option `no-skip-below'
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 % TODO:
 - add a `tags' concept => major task
-- add user interface that removes \par and vertical skip after
-  question/solution environments.
-  (equal to \cs_set_eq:NN \exsheets_par: \scan_stop: )
 - points/decimal-marker, points/frac (?), points/format (?,im interface)
 - points: swedish style
 - \examspace inside {tasks} => possible? (\pagegoal-\pagetotal) gives wrong
-- 
cgit v1.2.3

