diff options
author | Karl Berry <karl@freefriends.org> | 2014-05-13 22:10:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-05-13 22:10:53 +0000 |
commit | a24fc3622e5dd5faa555ff702953f83bb38d0bb3 (patch) | |
tree | 96857f68da314b09306dee7a971f61d5394dc5ef /Master/texmf-dist/tex/latex/exsheets/exsheets.sty | |
parent | 965a87a0387a9b227aca0cf47913062116a7d735 (diff) |
exsheets (11may14)
git-svn-id: svn://tug.org/texlive/trunk@34014 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/exsheets/exsheets.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 77 |
1 files changed, 62 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index e3f631830bd..6b3ebe04da2 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-2013 Clemens Niederberger +% Copyright 2011-2014 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{2013/12/27} -\def\exsheets@version{0.12b} +\def\exsheets@date{2014/05/11} +\def\exsheets@version{0.13} \RequirePackage { expl3 , xparse } \ProvidesExplPackage @@ -58,6 +58,7 @@ \cs_generate_variant:Nn \prop_gput:Nnn { Nx , Nxx } \cs_generate_variant:Nn \prop_gput:Nnn { cf , cff } \cs_generate_variant:Nn \tl_if_blank:nTF { x } +\cs_generate_variant:Nn \tl_if_eq:nnF { x } % ---------------------------------------------------------------------------- % temporary variables @@ -679,7 +680,7 @@ } } -\cs_new:Npn \exsheets_vary:w +\cs_new_protected:Npn \exsheets_vary:w { \__exsheets_variation_i:n } \cs_new:Npn \exsheets_last_variant: { } @@ -1036,7 +1037,7 @@ \fp_new:N \g__exsheets_this_question_points_fp \fp_new:N \g__exsheets_this_question_bonus_fp -\cs_new:Npn \__exsheets_read_points:w #1 ! #2 ! #3 \q_stop +\cs_new_protected:Npn \__exsheets_read_points:w #1 ! #2 ! #3 \q_stop { \tl_if_blank:nTF { #1 } { @@ -1290,11 +1291,11 @@ \bool_if:nTF { \l__exsheets_parse_points_bool && !\l__exsheets_only_print_points_bool } { - \__exsheets_use_heading:VVVnnV + \__exsheets_use_heading:VVVVnV \l__exsheets_question_heading_instance_tl \l__exsheets_questions_title_tl \l__exsheets_qu_counter_interpretation_tl - { \l__exsheets_question_points_fp } + \l__exsheets_question_points_fp { \l__exsheets_question_bonus_fp } \l__exsheets_tmpa_tl } @@ -1313,11 +1314,11 @@ \l__exsheets_tmpa_tl } { - \__exsheets_use_heading:VVVnnV + \__exsheets_use_heading:VVVVnV \l__exsheets_question_heading_instance_tl \l__exsheets_questions_title_tl \l__exsheets_qu_counter_interpretation_tl - { \l__exsheets_questions_points_tl } + \l__exsheets_questions_points_tl { 0 } \l__exsheets_tmpa_tl } @@ -1445,7 +1446,7 @@ } { #2 } { #3 } { #4 } { #5 } { #6 } } -\cs_generate_variant:Nn \__exsheets_use_heading:nnnnnn { V , VVVnnV } +\cs_generate_variant:Nn \__exsheets_use_heading:nnnnnn { V , VVVnnV , VVVVnV } \bool_new:N \l__exsheets_exam_bool \bool_set_false:N \l__exsheets_exam_bool @@ -1541,8 +1542,9 @@ \cs_new:Npn \exsheets_get_question_property:nn #1#2 { - \prop_if_in:cnT { g__exsheets_question_property_#1_prop } { #2 } + \prop_if_in:cnTF { g__exsheets_question_property_#1_prop } { #2 } { \prop_get:cn { g__exsheets_question_property_#1_prop } { #2 } } + { ?? } } \cs_generate_variant:Nn \exsheets_get_question_property:nn { no } @@ -1572,14 +1574,14 @@ \cs_new_protected:Npn \exsheets_debug_box:nn #1#2 { - \exsheets_par: + \par \noindent \group_begin: \normalfont\normalsize\normalcolor \colorbox { exsheetsdebugcolor } { \parbox { \dim_eval:n { #1 - 2 \fboxsep } } { #2 } } \group_end: - \exsheets_par: + \par } \cs_new:Npn \__exsheets_list_comma: {} @@ -2143,11 +2145,15 @@ exsheets_print_solutions / all .code:n = { \exsheets_print_solutions_all: } , exsheets_print_solutions / byID .code:n = - { \exsheets_print_solutions_byID:n { #1 } } + { \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 } \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: @@ -2310,8 +2316,31 @@ \__exsheets_print_solutions_all:nn } +\cs_new:Npn \__exsheets_sectioning_hook:nn #1#2 + { + \bool_if:nT { + !\int_compare_p:n + { + \use:c { l__exsheets_current_#1_int } + = + \use:c { l__exsheets_counter_#1_int } + } + && + !\int_compare_p:n + { \use:c { l__exsheets_counter_#1_int } = 0 } + } + { #2 } + } +\cs_generate_variant:Nn \__exsheets_sectioning_hook:nn { nV } + \cs_new_protected:Npn \__exsheets_print_solutions_all:nn #1#2 { + \int_set_eq:NN + \l__exsheets_current_sec_int + \l__exsheets_counter_sec_int + \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 @@ -2321,6 +2350,13 @@ { #1 } \l__exsheets_tmpb_tl \prop_get:NnN \g__exsheets_solutions_questions_id_prop { #1 } \l__exsheets_tmpc_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: \eSaveCounterPatternFrom [ exsheets ] \l__exsheets_current_pattern_interpretation_tl \l__exsheets_current_pattern_tl @@ -2656,7 +2692,7 @@ % ---------------------------------------------------------------------------- % SETUP -\NewDocumentCommand \SetupExSheets { o m } +\NewDocumentCommand \SetupExSheets { o +m } { \IfNoValueTF { #1 } { \keys_set:nn { exsheets } { #2 } } @@ -2935,9 +2971,20 @@ HISTORY: 2013/12/27 v0.12b - ensure that points are not parsed if a leading bang is inserted - fix bug in parsing the points +2014/05/11 v0.13 - new options: + * chapter-hook + * section-hook + These options provide hooks to add code in the list + of solutions (when printed with \printsolutions[all]) + when solutions from a new section or chapter are + printed %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: +- add a `tags' concept +- 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 |