From b2005c74519c2b28a5192b1d297950b05774bff7 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 4 Jul 2015 21:46:17 +0000 Subject: exsheets (4jul15) git-svn-id: svn://tug.org/texlive/trunk@37764 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/exsheets/README | 8 +- .../texmf-dist/doc/latex/exsheets/exsheets_en.pdf | Bin 682183 -> 682240 bytes .../texmf-dist/doc/latex/exsheets/exsheets_en.tex | 8 +- Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 102 +++++++++++++++------ 4 files changed, 80 insertions(+), 38 deletions(-) diff --git a/Master/texmf-dist/doc/latex/exsheets/README b/Master/texmf-dist/doc/latex/exsheets/README index 42d20323809..c3671a498ee 100644 --- a/Master/texmf-dist/doc/latex/exsheets/README +++ b/Master/texmf-dist/doc/latex/exsheets/README @@ -1,14 +1,14 @@ -------------------------------------------------------------------------- -EXSHEETS 2015/05/06 +EXSHEETS 2015/07/04 bundled packages: -the EXSHEETS package v0.18a +the EXSHEETS package v0.19 Yet another package for the creation of exercise sheets -the EXSHEETS-LISTINGS package v0.18a +the EXSHEETS-LISTINGS package v0.19 Using listings in exsheets -------------------------------------------------------------------------- Clemens Niederberger -Web: https://bitbucket.org/cgnieder/exsheets/ +Web: http://www.mychemistry.eu/forums/forum/exsheets/ E-Mail: contact@mychemistry.eu -------------------------------------------------------------------------- Copyright 2011-2015 Clemens Niederberger diff --git a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf index 608d06a2fb1..41a36943031 100644 Binary files a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf and b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf differ diff --git a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex index 2cc970945b7..442df6ef252 100644 --- a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex +++ b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex @@ -1,5 +1,5 @@ -% arara: pdflatex -% arara: biber +% !arara: pdflatex +% !arara: biber % arara: pdflatex % arara: pdflatex % !arara: pdflatex @@ -10,7 +10,7 @@ % % -------------------------------------------------------------------------- % Clemens Niederberger -% Web: https://bitbucket.org/cgnieder/exsheets/ +% Web: http://www.mychemistry.eu/forums/forum/exsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- % Copyright 2011-2015 Clemens Niederberger @@ -38,7 +38,7 @@ package = {exsheets} , authors = Clemens Niederberger , email = contact@mychemistry.eu , - url = {https://bitbucket.org/cgnieder/exsheets/} , + url = {http://www.mychemistry.eu/forums/forum/exsheets/} , title = the \ExSheets\ bundle , info = {% the packages \ExSheets{} and \ExSheetslistings \\ diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index b6de309bd11..7e7c5e86aad 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{2015/05/06} -\def\exsheets@version{0.18a} +\def\exsheets@date{2015/07/04} +\def\exsheets@version{0.19} \RequirePackage { expl3 , xparse } \ProvidesExplPackage @@ -992,8 +992,11 @@ } } -\NewEnviron { __exsheets_questions_internal: } +% #1: pre question hook +% #2: post question hook +\NewEnviron { __exsheets_questions_internal: } [2] { + \__exsheets_start_question_if_used:n {#1} \bool_if:nT { \l__exsheets_questions_print_bool && @@ -1015,7 +1018,10 @@ \exsheets_set_ref_properties:V \l__exsheets_questions_label_tl } \__exsheets_save_number_in:N \g__exsheets_question_number_prop - \__exsheets_save_and_print_question_body:V \BODY + \__exsheets_save_and_print_question_body:VVV + \BODY + \l__exsheets_questions_pre_body_hook_tl + \l__exsheets_questions_post_body_hook_tl \exsheets_set_question_properties:x { \tl_if_blank:VF \l__exsheets_questions_subtitle_tl @@ -1030,23 +1036,26 @@ { bonus-points = \fp_to_tl:N \g__exsheets_this_question_bonus_fp } } } - \tl_use:N \l__exsheets_questions_post_hook_tl + #2 } } -\cs_new_protected:Npn \__exsheets_save_and_print_question_body:n #1 +% #1: body +% #2: pre body hook +% #3: post body hook +\cs_new_protected:Npn \__exsheets_save_and_print_question_body:nnn #1#2#3 { \group_begin: \bool_if:NF \l__exsheets_save_question_body_to_aux_bool { \@fileswfalse } \exsheets_set_question_properties:n { question-body = {#1} } \group_end: - \tl_use:N \l__exsheets_questions_pre_body_hook_tl - { #1 } - \tl_use:N \l__exsheets_questions_post_body_hook_tl + #2 + { #1 } + #3 \exsheets_h_or_vspace:N \l__exsheets_questions_skip_below_dim } -\cs_generate_variant:Nn \__exsheets_save_and_print_question_body:n { V } +\cs_generate_variant:Nn \__exsheets_save_and_print_question_body:nnn { VVV } \prop_new:N \g__exsheets_questions_id_prop \prop_new:N \g__exsheets_questions_subtitle_prop @@ -1171,8 +1180,8 @@ { \prg_return_true: } } - -\newenvironment { __exsheets_question: } [2] +% #1: options +\cs_new_protected:Npn \__exsheets_question_start:n #1 { \bool_set_true:N \l__exsheets_inside_question_bool \bool_if:NT \l__exsheets_questions_use_bool @@ -1220,10 +1229,15 @@ \g__exsheets_questions_current_id_tl \g__exsheets_questions_id_int } + } + +% #1: points or blank +\cs_new_protected:Npn \__exsheets_question_points:n #1 + { % Punktevergabe: \fp_gzero:N \g__exsheets_this_question_points_fp \fp_gzero:N \g__exsheets_this_question_bonus_fp - \tl_if_blank:nTF {#2} + \tl_if_blank:nTF {#1} { \__exsheets_read_points:n { 0 } \bool_if:NT \l__exsheets_points_questions_default_bool @@ -1243,10 +1257,15 @@ \fp_gset_eq:NN \g__exsheets_this_question_bonus_fp \l__exsheets_question_bonus_fp - \__exsheets_read_points:n {#2} + \__exsheets_read_points:n {#1} % check if moving this to a later point has negative effects... % \exsheets_set_question_properties:n { points = #2 } } + } + +% #1: pre question hook +\cs_new_protected:Npn \__exsheets_start_question_if_used:n #1 + { \tl_if_blank:VT \l__exsheets_question_heading_instance_tl { \tl_set_eq:NN @@ -1309,7 +1328,7 @@ \bool_if:nTF { \l__exsheets_parse_points_bool && !\l__exsheets_only_print_points_bool } { - \tl_use:N \l__exsheets_questions_pre_hook_tl + #1 \exsheets_use_heading:VVVVnV \l__exsheets_question_heading_instance_tl \l__exsheets_questions_title_tl @@ -1324,7 +1343,7 @@ % might be dangerous to expand here... \tl_if_blank:xTF { \l__exsheets_questions_points_tl } { - \tl_use:N \l__exsheets_questions_pre_hook_tl + #1 \exsheets_use_heading:VVVnnV \l__exsheets_question_heading_instance_tl \l__exsheets_questions_title_tl @@ -1334,7 +1353,7 @@ \l__exsheets_tmpa_tl } { - \tl_use:N \l__exsheets_questions_pre_hook_tl + #1 \exsheets_use_heading:VVVVnV \l__exsheets_question_heading_instance_tl \l__exsheets_questions_title_tl @@ -1346,7 +1365,16 @@ } } } - \__exsheets_questions_internal: + } +\cs_generate_variant:Nn \__exsheets_start_question_if_used:n {V} + +\newenvironment { __exsheets_question: } [2] + { + \__exsheets_question_start:n {#1} + \__exsheets_question_points:n {#2} + \exp_args:NVV \__exsheets_questions_internal: + \l__exsheets_questions_pre_hook_tl + \l__exsheets_questions_post_hook_tl } { \end__exsheets_questions_internal: @@ -2539,24 +2567,35 @@ } \cs_generate_variant:Nn \exsheets_solutions_print_name:nnn { VVV } +\cs_new:Npn \__exsheets_surround_with:nnn #1#2#3 { #2#1#3 } +\cs_generate_variant:Nn \__exsheets_surround_with:nnn { nVV } + +% think about the interface with \exsheetsprintsolution a bit more, especially +% about the placement of the hooks! + % #1: number % #2: name % #3: ID % #4: body \cs_new_protected:Npn \__exsheets_print_solution:nnnn #1#2#3#4 { - \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 - } + \group_begin: + \tl_set:Nn \CurrentQuestionID {#3} + \__exsheets_surround_with:nVV + { + \exp_args:Nnx + \exsheetsprintsolution + { \exsheets_solutions_print_name:nnn {#1} {#2} {#3} } + { + \exp_not:V \l__exsheets_solutions_pre_body_hook_tl + \exp_not:n {#4} + \exp_not:V \l__exsheets_solutions_post_body_hook_tl + } + } + \l__exsheets_solutions_pre_hook_tl + \l__exsheets_solutions_post_hook_tl + \exsheets_h_or_vspace:N \l__exsheets_solutions_skip_below_dim + \group_end: } \cs_generate_variant:Nn \__exsheets_print_solution:nnnn { VVV, VVVV } @@ -3149,6 +3188,9 @@ HISTORY: point - a few cosmetic changes to the points function definitions +2015/07/04 v0.19 - add http://tex.stackexchange.com/q/222814 + - allow begin and end of pseudo-environments as hooks + to the question an solution environments %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: -- cgit v1.2.3