From f5074945222244f9ac46c0dc66b3d2fe979c31a3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 15 Oct 2014 22:21:57 +0000 Subject: exsheets (15oct14) git-svn-id: svn://tug.org/texlive/trunk@35381 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 106 ++++++++++++++-------- 1 file changed, 68 insertions(+), 38 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index 5f358be1e6c..563a4d10dfd 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty @@ -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/09/14} -\def\exsheets@version{0.16} +\def\exsheets@date{2014/10/14} +\def\exsheets@version{0.17} \RequirePackage { expl3 , xparse } \ProvidesExplPackage @@ -246,7 +246,6 @@ headings .tl_set:N = \l__exsheets_heading_instance_tl , load-headings .code:n = \exsheets_option_dropped:n {load-headings} , -% .bool_set:N = \l__exsheets_load_headings_bool , headings-format .tl_set:N = \l_exsheets_heading_title_user_format_tl , subtitle-format .tl_set:N = @@ -795,7 +794,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 @@ -842,21 +841,20 @@ use-#2 .code:n = { \bool_gset_true:c { g__exsheets_use_#2_bool } - \use:c { __exsheets_activate_#2:n } { ##1 } + \use:c { __exsheets_activate_#2:n } {##1} } , question / #1 .code:n = \bool_set_true:c { l__exsheets_questions_#1_bool } - \tl_set:cn { l__exsheets_questions_#1_tl } { ##1 } -% \exsheets_set_question_properties:n { #1 = ##1 } + \tl_set:cn { l__exsheets_questions_#1_tl } {##1} } \cs_new_protected:cpn { __exsheets_activate_#2:n } ##1 { \prop_gclear:c { g__exsheets_#2_active_prop } - \seq_set_split:Nnn \l__exsheets_tmpa_seq { , } { ##1 } + \seq_set_split:Nnn \l__exsheets_tmpa_seq { , } {##1} \seq_map_inline:Nn \l__exsheets_tmpa_seq { \prop_gput:cnn { g__exsheets_#2_active_prop } - { ####1 } { \__exsheets_dummy: } + {####1} { \__exsheets_dummy: } } } \cs_new_protected:cpn { __exsheets_questions_use_#2: } @@ -2219,6 +2217,14 @@ \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 +\int_new:N \l__exsheets_current_sec_int +\int_new:N \l__exsheets_counter_qu_int + \keys_define:nn {exsheets} { exsheets_print_solutions .choice: , @@ -2231,15 +2237,10 @@ 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 + section-hook .tl_set:N = \l__exsheets_new_section_hook_tl , + use-saved-counter-format .bool_set: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 -\int_new:N \l__exsheets_current_sec_int -\int_new:N \l__exsheets_counter_qu_int - \cs_new_protected:Npn \__exsheets_get_sectioning_numbers: { \cs_if_exist:NT \chapter @@ -2262,15 +2263,24 @@ {#1} \l__exsheets_tmpd_tl \group_begin: \tl_set_eq:NN \CurrentQuestionID \l__exsheets_tmpc_tl - \__exsheets_sectioning_hook:nV { ch } + \__exsheets_sectioning_hook:nV {ch} \l__exsheets_new_chapter_hook_tl - \__exsheets_sectioning_hook:nV { sec } + \__exsheets_sectioning_hook:nV {sec} \l__exsheets_new_section_hook_tl \group_end: - \eSaveCounterPatternFrom [ exsheets ] - \l__exsheets_current_pattern_interpretation_tl - \l__exsheets_current_pattern_tl - \l__exsheets_tmpd_tl + \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 @@ -2445,10 +2455,19 @@ \__exsheets_sectioning_hook:nV { sec } \l__exsheets_new_section_hook_tl \group_end: - \eSaveCounterPatternFrom [ exsheets ] - \l__exsheets_current_pattern_interpretation_tl - \l__exsheets_current_pattern_tl - \l__exsheets_tmpd_tl + \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 @@ -2466,14 +2485,14 @@ \seq_map_inline:Nn \l__exsheets_solutions_byID_seq { \prop_get:NnN \g__exsheets_questions_id_prop - { ##1 } \l__exsheets_tmpa_tl + {##1} \l__exsheets_tmpa_tl \seq_put_right:NV \l__exsheets_tmpa_seq \l__exsheets_tmpa_tl } \bool_if:NT \l__exsheets_print_byID_sorted_bool { \seq_sort:Nn \l__exsheets_tmpa_seq { - \int_compare:nNnTF { ##1 } > { ##2 } + \int_compare:nNnTF {##1} > {##2} { \sort_reversed: } { \sort_ordered: } } @@ -2481,23 +2500,34 @@ \seq_map_inline:Nn \l__exsheets_tmpa_seq { \group_begin: - \tl_if_eq:nnF { ##1 } { \q_no_value } + \tl_if_eq:nnF {##1} { \q_no_value } { \prop_get:NnNT \g__exsheets_solutions_names_prop - { ##1 } \l__exsheets_tmpa_tl + {##1} \l__exsheets_tmpa_tl { \prop_get:NnN \g__exsheets_solutions_content_prop - { ##1 } \l__exsheets_tmpb_tl + {##1} \l__exsheets_tmpb_tl \prop_get:NnN \g__exsheets_solutions_questions_id_prop - { ##1 } \l__exsheets_tmpc_tl + {##1} \l__exsheets_tmpc_tl + \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 - { ##1 } + {##1} { - \eSaveCounterPatternFrom [ exsheets ] - \l__exsheets_current_pattern_interpretation_tl - \l__exsheets_current_pattern_tl - \l__exsheets_qu_counter_pattern_tl + \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 @@ -3121,6 +3151,7 @@ HISTORY: - fix issue #22 - fix issue #23 - use only one version number for the whole bundle +2014/10/14 v0.17 - new option `use-saved-counter-format' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: @@ -3133,4 +3164,3 @@ HISTORY: - \examspace inside {tasks} => possible? (\pagegoal-\pagetotal) gives wrong values here - remove doubled points name if total points are unknown - -- cgit v1.2.3