From 7c9bd99e29ba8005ab0135a0738cda1317e7d084 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 8 Sep 2016 21:58:30 +0000 Subject: exsheets (8sep16) git-svn-id: svn://tug.org/texlive/trunk@42020 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/exsheets/README | 2 +- .../texmf-dist/doc/latex/exsheets/exsheets_en.pdf | Bin 673432 -> 666488 bytes .../texmf-dist/doc/latex/exsheets/exsheets_en.tex | 6 +- .../doc/latex/exsheets/grading-table.pdf | Bin 26474 -> 26475 bytes .../doc/latex/exsheets/grading-table.tex | 10 +- Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 161 ++++++++++----------- 6 files changed, 85 insertions(+), 94 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/exsheets/README b/Master/texmf-dist/doc/latex/exsheets/README index f561af09fbe..39d0ecbec78 100644 --- a/Master/texmf-dist/doc/latex/exsheets/README +++ b/Master/texmf-dist/doc/latex/exsheets/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -EXSHEETS 2016/08/14 v0.21d +EXSHEETS 2016/09/07 v0.21e bundled packages: the EXSHEETS package Yet another package for the creation of exercise sheets diff --git a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf index 28ccc83887e..6fc39115038 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 d59a68c4f28..2f52f587d72 100644 --- a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex +++ b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex @@ -33,6 +33,7 @@ \documentclass[load-preamble+]{cnltx-doc} \usepackage{exsheets} +\usepackage{bookmark} \setcnltx{ package = {exsheets} , @@ -1023,7 +1024,7 @@ each. You have two possibilities to display and count them: points. \end{options} -\begin{example} +\begin{example}[add-sourcecode-options={literate=}] \SetupExSheets[points]{name=point/s,number-format=\color{red}} \begin{question}{1} This one's easy so only 1 point can be earned. @@ -2043,7 +2044,6 @@ All of the following examples use the same question call: A `block' heading. \sample \end{question} -\newpage \subsubsection{The `runin' Instance} \begin{sourcecode} \DeclareInstance{exsheets-heading}{runin}{default}{ @@ -2082,7 +2082,6 @@ All of the following examples use the same question call: A `simple' heading. \sample \end{question} -\newpage \subsubsection{The `empty' Instance} \sinceversion{0.9a} \begin{sourcecode} @@ -2289,7 +2288,6 @@ All of the following examples use the same question call: A `runin-fixed-nr' heading. \sample \end{question} -\newpage \subsubsection{The `runin-nr-wp' Instance} \begin{sourcecode} \DeclareInstance{exsheets-heading}{runin-nr-wp}{default}{ diff --git a/Master/texmf-dist/doc/latex/exsheets/grading-table.pdf b/Master/texmf-dist/doc/latex/exsheets/grading-table.pdf index 248ccb5dba7..5854584c383 100644 Binary files a/Master/texmf-dist/doc/latex/exsheets/grading-table.pdf and b/Master/texmf-dist/doc/latex/exsheets/grading-table.pdf differ diff --git a/Master/texmf-dist/doc/latex/exsheets/grading-table.tex b/Master/texmf-dist/doc/latex/exsheets/grading-table.tex index 6b65f8c475e..e1b4f2d0b95 100644 --- a/Master/texmf-dist/doc/latex/exsheets/grading-table.tex +++ b/Master/texmf-dist/doc/latex/exsheets/grading-table.tex @@ -3,13 +3,13 @@ \begin{document} -\begin{question}{3}\SetQuestionProperties{points=3} +\begin{question}{3} \end{question} -\begin{question}{5}\SetQuestionProperties{points=5} +\begin{question}{5} \end{question} -\begin{question}{10}\SetQuestionProperties{points=10} +\begin{question}{10} \end{question} -\begin{question}{8}\SetQuestionProperties{points=8} +\begin{question}{8} \end{question} \begin{tabular}{|l|*{\numberofquestions}{c|}c|}\hline @@ -18,4 +18,4 @@ Reached & \ForEachQuestion{\iflastquestion{}{&}} & \\ \hline \end{tabular} -\end{document} \ No newline at end of file +\end{document} diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index 9509f543385..09df4ddcab7 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty @@ -28,8 +28,8 @@ \RequirePackage { expl3 , xparse } \ExplSyntaxOn -\tl_const:Nn \c_exsheets_date_tl {2016/08/14} -\tl_const:Nn \c_exsheets_version_tl {0.21d} +\tl_const:Nn \c_exsheets_date_tl {2016/09/07} +\tl_const:Nn \c_exsheets_version_tl {0.21e} \tl_const:Nn \c_exsheets_info_tl {Yet~ another~ package~ for~ the~ creation~ of~ exercise~ sheets~ and~ exams.} @@ -228,11 +228,10 @@ \bool_new:N \l__exsheets_include_random_bool \bool_new:N \l__exsheets_include_by_id_bool \bool_set_true:N \l__exsheets_include_all_bool +\bool_new:N \l__exsheets_include_questions_no_duplicates_bool \bool_new:N \l__exsheets_use_selection_bool \bool_new:N \l__exsheets_solutions_print_bool \bool_set_false:N \l__exsheets_solutions_print_bool -\bool_new:N \l__exsheets_solutions_print_here_bool -\bool_set_false:N \l__exsheets_solutions_print_here_bool \bool_new:N \l__exsheets_solutions_print_section_bool \bool_set_false:N \l__exsheets_solutions_print_section_bool \bool_new:N \l__exsheets_solutions_print_chapter_bool @@ -1138,40 +1137,43 @@ !\l__exsheets_questions_deactivate_bool } { - % label: - \tl_if_blank:VTF \l__exsheets_questions_label_tl + \exsheets_if_current_question_is_used:T { - \bool_if:NT \l__exsheets_auto_label_bool + % label: + \tl_if_blank:VTF \l__exsheets_questions_label_tl { - \exsheets_label:V \g__exsheets_questions_current_id_tl - \exsheets_set_ref_properties:V \CurrentQuestionID + \bool_if:NT \l__exsheets_auto_label_bool + { + \exsheets_label:V \g__exsheets_questions_current_id_tl + \exsheets_set_ref_properties:V \CurrentQuestionID + } } - } - { - \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_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 - \l__exsheets_questions_post_body_hook_tl - \exsheets_set_question_properties:x - { - \tl_if_blank:VF \l__exsheets_questions_subtitle_tl - { subtitle = { \exp_not:V \l__exsheets_questions_subtitle_tl } , } - counter = \l__exsheets_qu_counter_interpretation_tl , - % number = \int_to_arabic:V \g__exsheets_questions_id_int , - \bool_if:NF \l__exsheets_points_questions_default_bool { - \fp_compare:nT { \g__exsheets_this_question_points_fp > 0 } - { points = \fp_to_decimal:N \g__exsheets_this_question_points_fp , } - \fp_compare:nT { \g__exsheets_this_question_bonus_fp > 0 } - { bonus-points = \fp_to_decimal:N \g__exsheets_this_question_bonus_fp } + \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_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 + \l__exsheets_questions_post_body_hook_tl + \exsheets_set_question_properties:x + { + \tl_if_blank:VF \l__exsheets_questions_subtitle_tl + { subtitle = { \exp_not:V \l__exsheets_questions_subtitle_tl } , } + counter = \l__exsheets_qu_counter_interpretation_tl , + % number = \int_to_arabic:V \g__exsheets_questions_id_int , + \bool_if:NF \l__exsheets_points_questions_default_bool + { + \fp_compare:nT { \g__exsheets_this_question_points_fp > 0 } + { points = \fp_to_decimal:N \g__exsheets_this_question_points_fp , } + \fp_compare:nT { \g__exsheets_this_question_bonus_fp > 0 } + { bonus-points = \fp_to_decimal:N \g__exsheets_this_question_bonus_fp } + } + } + \bool_if:NT \l__exsheets_questions_print_bool {#2} } - \bool_if:NT \l__exsheets_questions_print_bool {#2} } } @@ -1308,6 +1310,7 @@ % Optionen: \tl_if_blank:nF {#1} { \keys_set:nn { exsheets / question } {#1} } % ID: + \__exsheets_determine_question_usage: \bool_if:nT { (\l__exsheets_questions_deactivate_bool && \l__exsheets_select_questions_bool) @@ -1328,28 +1331,6 @@ } \tl_use:N \l__exsheets_after_begin_question_tl \tl_clear:N \l__exsheets_after_begin_question_tl - \bool_if:nT - { - !\l__exsheets_questions_deactivate_bool && - !\l__exsheets_select_questions_bool - } - { - \bool_if:NT \l__exsheets_questions_use_bool - { - % TODO: write this to the aux file and at this point check if the - % entry is already present - % \prop_gput:NVV \g__exsheets_questions_used_prop - % \g__exsheets_questions_current_id_tl - % \g__exsheets_questions_id_int - \int_gincr:N \g__exsheets_questions_used_int - \__exsheets_mark_as_used_x:nn - { \int_use:N \g__exsheets_questions_used_int } - { \tl_use:N \g__exsheets_questions_current_id_tl } - } - \prop_gput:NVV \g__exsheets_questions_id_prop - \g__exsheets_questions_current_id_tl - \g__exsheets_questions_id_int - } } % #1: points or blank @@ -1405,7 +1386,6 @@ !\l__exsheets_questions_deactivate_bool } { - \__exsheets_determine_question_usage: \exsheets_if_current_question_is_used:T { \refstepcounter {question} } \__exsheets_get_sectioning_numbers: @@ -1421,8 +1401,11 @@ ) } { - \exsheets_add_points:V \l__exsheets_question_points_fp - \exsheets_add_bonus:V \l__exsheets_question_bonus_fp + \exsheets_if_current_question_is_used:T + { + \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 { @@ -1593,11 +1576,14 @@ \cs_new_protected:Npn \exsheets@used@id #1#2 { \prop_gput:Nnn \g__exsheets_questions_used_prop {#2} {#1} } -\cs_new_protected:Npn \__exsheets_mark_as_used_x:nn #1#2 +\cs_new_protected:Npn \__exsheets_mark_as_used:n #1 { - \prop_gput_if_new:Nxx \g__exsheets_questions_used_prop {#2} {#1} + \int_gincr:N \g__exsheets_questions_used_int + \prop_gput_if_new:Nxx \g__exsheets_questions_used_prop + {#1} + { \int_use:N \g__exsheets_questions_used_int } \exsheets_write_to_aux_x:n - { \exsheets@used@id {#1} {#2} } + { \exsheets@used@id {#1} { \int_use:N \g__exsheets_questions_used_int } } } % ---------------------------------------------------------------------------- @@ -1885,6 +1871,11 @@ \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 + \bool_if:NT \l__exsheets_include_questions_no_duplicates_bool + { + \seq_map_inline:Nn \g_exsheets_included_questions_seq + { \clist_put_right:Nn \l__exsheets_exclude_id_clist {####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 @@ -1892,6 +1883,7 @@ \clist_clear:N \l__exsheets_include_id_clist \clist_clear:N \l__exsheets_exclude_id_clist \int_gzero:N \g__exsheets_selection_number_int + % \seq_show:N \g_exsheets_included_questions_seq } \bool_set_false:N \l__exsheets_select_questions_bool } @@ -1917,12 +1909,13 @@ \bool_set_false:N \l__exsheets_include_all_bool \bool_set_true:N \l__exsheets_include_random_bool \bool_set_false:N \l__exsheets_include_by_id_bool - \int_set:Nn \l__exsheets_include_random_int {#1} + \int_set:Nn \l__exsheets_include_random_int {#1} , + no-duplicates .bool_set:N = \l__exsheets_include_questions_no_duplicates_bool } \cs_new_protected:Npn \__exsheets_select_question:n #1 { - \bool_if:NT \l__exsheets_select_questions_bool + \bool_if:NTF \l__exsheets_select_questions_bool { \bool_if:NTF \l__exsheets_questions_deactivate_bool { @@ -1957,11 +1950,14 @@ \g__exsheets_questions_id_int } \prop_get:NxN \g__exsheets_included_questions_prop - { \int_use:N \l__exsheets_tmpa_int } + { \int_use:N \l__exsheets_tmpa_int } \l__exsheets_tmpa_tl \__exsheets_select_question_by_id:V \l__exsheets_tmpa_tl } } + { + \__exsheets_use_question:n {#1} + } } \cs_generate_variant:Nn \__exsheets_select_question:n { V } @@ -1977,16 +1973,7 @@ \bool_gset_true:N \g__exsheets_questions_use_bool \clist_gput_right:Nn \questionsincludedlast {#1} \seq_gput_right:Nn \g_exsheets_included_questions_seq {#1} - \int_gincr:N \g__exsheets_questions_used_int - \__exsheets_mark_as_used_x:nn - { \int_use:N \g__exsheets_questions_used_int } - {#1} - % \prop_gput:NnV \g__exsheets_questions_used_prop - % {#1} - % \g__exsheets_questions_id_int - \prop_gput:NnV \g__exsheets_questions_id_prop - {#1} - \g__exsheets_questions_id_int + \__exsheets_use_question:n {#1} } } {% parsing list of included IDs @@ -2002,16 +1989,12 @@ \bool_gset_true:N \g__exsheets_questions_use_bool \clist_gput_right:Nn \questionsincludedlast {#1} \seq_gput_right:Nn \g_exsheets_included_questions_seq {#1} - % \prop_gput:NnV \g__exsheets_questions_used_prop + \__exsheets_use_question:n {#1} + % \exsheets_if_current_question_is_used:T + % { \__exsheets_mark_as_used:n {#1} } + % \prop_gput:NnV \g__exsheets_questions_id_prop % {#1} % \g__exsheets_questions_id_int - \int_gincr:N \g__exsheets_questions_used_int - \__exsheets_mark_as_used_x:nn - { \int_use:N \g__exsheets_questions_used_int } - {#1} - \prop_gput:NnV \g__exsheets_questions_id_prop - {#1} - \g__exsheets_questions_id_int } } { \bool_gset_false:N \g__exsheets_questions_use_bool } @@ -2019,6 +2002,15 @@ } \cs_generate_variant:Nn \__exsheets_select_question_by_id:n { V } +\cs_new_protected:Npn \__exsheets_use_question:n #1 + { + \exsheets_if_current_question_is_used:T + { \__exsheets_mark_as_used:n {#1} } + \prop_gput:NnV \g__exsheets_questions_id_prop + {#1} + \g__exsheets_questions_id_int + } + % TODO: poor efficiency -- there should be no need to map through % \l__exsheets_class_prop *two* times \cs_new_protected:Npn \__exsheets_select_question_random:n #1 @@ -2166,7 +2158,7 @@ % print here \exsheets_if_current_question_is_used:T { - \bool_if:NT \l__exsheets_solutions_print_here_bool + \bool_if:NT \l__exsheets_solutions_print_bool { \int_set:Nn \l_exsheets_counter_qu_int { \arabic {question} } \__exsheets_get_sectioning_numbers: @@ -2302,7 +2294,6 @@ { \group_begin: \bool_set_true:N \l__exsheets_solutions_print_bool - \bool_set_true:N \l__exsheets_inside_solution_bool \cs_set:Npn \S ##1 { \exref { exse:##1 } } \cs_set:Npn \C ##1 { \exref { exch:##1 } } \keys_set:nn { exsheets / exsheets_print_solutions } {#1} @@ -2621,7 +2612,6 @@ print / true .code:n = { \bool_set_true:N \l__exsheets_solutions_print_bool - \bool_set_true:N \l__exsheets_solutions_print_here_bool \bool_set_false:N \l__exsheets_solutions_print_section_bool \bool_set_false:N \l__exsheets_solutions_print_chapter_bool \bool_set_false:N \l__exsheets_solutions_print_all_bool @@ -3197,6 +3187,9 @@ HISTORY: should always have the same number pattern as the corresponding questions 2016/08/14 v0.21d - fix issue #32 +2016/09/07 v0.21e - fix issue #29 + - fix issue #35 + - fix issue #36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: -- cgit v1.2.3