diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/exsheets')
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 247 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def | 7 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/tasks.sty | 30 |
3 files changed, 184 insertions, 100 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index f24065715ef..df10a42d33f 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty @@ -31,8 +31,8 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % ---------------------------------------------------------------------------- -\def\exsheets@date{2013/04/08} -\def\exsheets@version{0.9a} +\def\exsheets@date{2013/04/21} +\def\exsheets@version{0.9c} \RequirePackage { expl3 , xparse } \ProvidesExplPackage @@ -41,6 +41,29 @@ {\exsheets@version} {Yet another package for the creation of exercise sheets and exams.} +% -------------------------------------------------------------------------- +% check expl3 version: +\@ifpackagelater { expl3 } { 2012/11/21 } + { } + { + \PackageError { exsheets } { Support~package~expl3~too~old } + { + You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~ + 'l3packages'.\MessageBreak + Loading~exsheets~will~abort! + } + \tex_endinput:D + } + +% ---------------------------------------------------------------------------- +% variants of kernel functions: +\cs_generate_variant:Nn \prop_get:NnN { Nx } +\cs_generate_variant:Nn \prop_get:NnN { cf } +\cs_generate_variant:Nn \prop_get:NnNTF { Nx } +\cs_generate_variant:Nn \prop_gput:Nnn { Nf , Nff , Nfx } +\cs_generate_variant:Nn \prop_gput:Nnn { Nx , Nxx } +\cs_generate_variant:Nn \prop_gput:Nnn { cf , cff } + % ---------------------------------------------------------------------------- % temporary variables \tl_new:N \l__exsheets_tmpa_tl @@ -55,6 +78,7 @@ \seq_new:N \l__exsheets_tmpa_seq \fp_new:N \l__exsheets_tmpa_fp \clist_new:N \l__exsheets_tmpa_clist +\bool_new:N \l__exsheets_tmpa_bool % ---------------------------------------------------------------------------- % messages @@ -332,7 +356,7 @@ \fp_to_tl:N \l__exsheets_tmpa_tl \group_end: } -\cs_generate_variant:Nn \exsheets_num:n { x } +\cs_generate_variant:Nn \exsheets_num:n { V,x } \cs_new_nopar:Npn \exsheets_points_name:n #1 { @@ -827,8 +851,6 @@ } } } -\cs_generate_variant:Nn \prop_get:NnN { cf } -\cs_generate_variant:Nn \prop_gput:Nnn { cf , cff } \cs_new_protected:Npn \exsheets_declare_question_class:nn #1#2 { @@ -838,10 +860,7 @@ } \NewDocumentCommand \DeclareQuestionClass { mm } - { - \exsheets_declare_question_class:nn { #1 } { #2 } -% \exsheets_declare_question_property:n { #1 } - } + { \exsheets_declare_question_class:nn { #1 } { #2 } } \@onlypreamble \DeclareQuestionClass % ---------------------------------------------------------------------------- @@ -920,7 +939,7 @@ \cs_new_protected:Npn \__exsheets_read_points:n #1 { \__exsheets_read_points:w #1++ \q_stop } -\NewDocumentEnvironment { __exsheets_question: } { gg } +\newenvironment { __exsheets_question: } [2] { \bool_set_true:N \l__exsheets_inside_question_bool \bool_if:NT \l__exsheets_questions_use_bool @@ -938,33 +957,14 @@ \int_gincr:N \g__exsheets_questions_id_int \tl_if_blank:VTF \l__exsheets_questions_id_tl { - \prop_gput:NVV \g__exsheets_questions_id_prop - \g__exsheets_questions_id_int - \g__exsheets_questions_id_int - \bool_if:NT \l__exsheets_questions_use_bool - { - \prop_gput:NVV \g__exsheets_questions_used_prop - \g__exsheets_questions_id_int - \g__exsheets_questions_id_int - \int_gincr:N \g__exsheets_questions_used_int - } \tl_gset:Nx \g__exsheets_questions_current_id_tl { \int_use:N \g__exsheets_questions_id_int } } { - \prop_gput:NVV \g__exsheets_questions_id_prop - \l__exsheets_questions_id_tl - \g__exsheets_questions_id_int - \bool_if:NT \l__exsheets_questions_use_bool - { - \prop_gput:NVV \g__exsheets_questions_used_prop - \l__exsheets_questions_id_tl - \g__exsheets_questions_id_int - \int_gincr:N \g__exsheets_questions_used_int - } \tl_gset:Nx \g__exsheets_questions_current_id_tl { \tl_use:N \l__exsheets_questions_id_tl } } + % label: \tl_if_blank:VTF \l__exsheets_questions_label_tl { \bool_if:NT \l__exsheets_auto_label_bool @@ -985,6 +985,31 @@ pageref = \exp_not:N \pageref { \l__exsheets_questions_label_tl } } } + % FIXME: rather useless since it isn't used at all, see also + % exsheets_headings.def + \tl_if_blank:VF \l__exsheets_questions_meta_tl + { + \prop_gput:NVV \g__exsheets_questions_meta_prop + \g__exsheets_questions_current_id_tl + \l__exsheets_questions_meta_tl + } + } + \bool_if:nT + { + !\l__exsheets_questions_deactivate_bool && + !\l__exsheets_select_questions_bool + } + { + \bool_if:NT \l__exsheets_questions_use_bool + { + \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 + } + \prop_gput:NVV \g__exsheets_questions_id_prop + \g__exsheets_questions_current_id_tl + \g__exsheets_questions_id_int } % Punktevergabe: \IfNoValueTF { #2 } @@ -1009,19 +1034,10 @@ \l__exsheets_question_heading_instance_tl \l__exsheets_heading_instance_tl } - % meta: - \tl_if_blank:VF \l__exsheets_questions_meta_tl - { - \prop_gput:NVV \g__exsheets_questions_meta_prop - \g__exsheets_questions_current_id_tl - \l__exsheets_questions_meta_tl - } % Auswahl der Frage: \__exsheets_select_question:V \g__exsheets_questions_current_id_tl \prop_map_inline:Nn \l__exsheets_class_prop - { - \use:c { __exsheets_questions_use_##1: } - } + { \use:c { __exsheets_questions_use_##1: } } \bool_if:nT { \g__exsheets_questions_use_bool && @@ -1094,7 +1110,6 @@ \prop_gput:Nfx #1 { #2 } { #3 } \iow_now:Nx \@auxout { \exsheets@save@number { #2 } { #3 } } } -\cs_generate_variant:Nn \prop_get:NnNTF { Nx } \cs_new_protected:Npn \__exsheets_save_number_in:N #1 { @@ -1347,11 +1362,14 @@ \bool_new:N \l__exsheets_select_questions_bool \bool_new:N \l__exsheets_include_all_bool \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 -\prop_new:N \g__exsheets_selected_questions_prop + +\prop_new:N \g__exsheets_included_questions_prop \clist_new:N \l__exsheets_include_id_clist \clist_new:N \l__exsheets_exclude_id_clist \clist_new:N \questionsincludedlast + \int_new:N \l__exsheets_include_random_int \int_zero:N \l__exsheets_include_random_int @@ -1383,6 +1401,7 @@ \cs_new_protected:Npn \exsheets_include_questions:n #1 { \bool_set_true:N \l__exsheets_select_questions_bool + \clist_gclear:N \questionsincludedlast \seq_set_split:Nnn \l__exsheets_tmpa_seq { , } { #1 } \seq_map_inline:Nn \l__exsheets_tmpa_seq { @@ -1390,7 +1409,7 @@ \int_set_eq:NN \l__exsheets_tmpc_int \g__exsheets_questions_id_int \exsheets_file_input_if_exist:n { ##1 } \__exsheets_prop_count:NN - \g__exsheets_selected_questions_prop + \g__exsheets_included_questions_prop \l__exsheets_tmpa_int \bool_if:NT \l__exsheets_questions_debug_bool { @@ -1398,11 +1417,11 @@ { \linewidth } { The~file~ ` \texttt { \tl_to_str:n { ##1 } } ' ~contains~ - \exsheets_prop_count:N \g__exsheets_selected_questions_prop + \exsheets_prop_count:N \g__exsheets_included_questions_prop \c_space_tl questions~with~the~following~IDs:\par \cs_set_protected:Npn \__exsheets_list_comma: { \cs_set:Npn \__exsheets_list_comma: { ,~ } } - \prop_map_inline:Nn \g__exsheets_selected_questions_prop + \prop_map_inline:Nn \g__exsheets_included_questions_prop { \__exsheets_list_comma: ####2 } } } @@ -1410,24 +1429,9 @@ \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 \__exsheets_select_question_random:n { ##1 } - \clist_gclear:N \questionsincludedlast - \bool_if:nTF - { \l__exsheets_include_random_bool || \l__exsheets_include_by_id_bool } - { - \clist_gset_eq:NN - \questionsincludedlast - \l__exsheets_include_id_clist - } - { - \prop_map_inline:Nn \g__exsheets_selected_questions_prop - { - \clist_if_in:NnF \l__exsheets_exclude_id_clist { ####2 } - { \clist_gput_right:Nn \questionsincludedlast { ####2 } } - } - } \exsheets_file_input_if_exist:n { ##1 } \int_gset_eq:NN \g__exsheets_questions_id_int \l__exsheets_tmpd_int - \prop_gclear:N \g__exsheets_selected_questions_prop + \prop_gclear:N \g__exsheets_included_questions_prop \clist_clear:N \l__exsheets_include_id_clist \clist_clear:N \l__exsheets_exclude_id_clist \int_gzero:N \g__exsheets_selection_number_int @@ -1442,19 +1446,17 @@ % - exclude=<list of IDs> \keys_define:nn { exsheets / include } { - all .bool_set:N = \l__exsheets_include_all_bool , - IDs .code:n = + all .bool_set:N = \l__exsheets_include_all_bool , + IDs .code:n = \bool_set_false:N \l__exsheets_include_all_bool \bool_set_false:N \l__exsheets_include_random_bool \bool_set_true:N \l__exsheets_include_by_id_bool \clist_set:Nn \l__exsheets_include_id_clist { #1 } , - % the following option does _not_ set \l__exsheets_include_random_bool - % so it can be combined with the `random' option: - exclude .code:n = - \bool_set_false:N \l__exsheets_include_all_bool - \bool_set_false:N \l__exsheets_include_by_id_bool - \clist_set:Nn \l__exsheets_exclude_id_clist { #1 } , - random .code:n = + % the `exclude' option does _not_ set \l__exsheets_include_random_bool , + % \l__exsheets_include_by_id_bool or \l__exsheets_include_all_bool so + % it can be combined with the other options: + exclude .clist_set:N = \l__exsheets_exclude_id_clist , + random .code:n = \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 @@ -1472,53 +1474,95 @@ \bool_if:NT \l__exsheets_questions_use_bool { \int_gincr:N \g__exsheets_selection_number_int - \exp_args:NNx - \prop_gput:Nnn \g__exsheets_selected_questions_prop - { \int_use:N \g__exsheets_selection_number_int } { #1 } + \bool_if:NTF \l__exsheets_include_random_bool + { + \prop_gput:Nxn \g__exsheets_included_questions_prop + { \int_use:N \g__exsheets_selection_number_int } { #1 } + } + { + \prop_gput:Nxn \g__exsheets_included_questions_prop + { \int_use:N \g__exsheets_questions_id_int } { #1 } + } } } { \int_gincr:N \g__exsheets_questions_id_int - \int_set:Nn \l__exsheets_tmpa_int + \bool_if:NTF \l__exsheets_include_random_bool { - \int_mod:nn - { \g__exsheets_questions_id_int } - { \g__exsheets_selection_number_int } + \int_set:Nn \l__exsheets_tmpa_int + { + \int_mod:nn + { \g__exsheets_questions_id_int } + { \g__exsheets_selection_number_int } + } + \int_set:Nn \l__exsheets_tmpa_int { \l__exsheets_tmpa_int - 1 } + \int_compare:nTF { \l__exsheets_tmpa_int = -1 } + { + \int_set_eq:NN + \l__exsheets_tmpa_int + \g__exsheets_selection_number_int + } + { + \int_compare:nT { \l__exsheets_tmpa_int = 0 } + { \int_set:Nn \l__exsheets_tmpa_int { 1 } } + } } - \int_compare:nT { \l__exsheets_tmpa_int = 0 } { \int_set_eq:NN \l__exsheets_tmpa_int - \g__exsheets_selection_number_int + \g__exsheets_questions_id_int } - \prop_get:NxN \g__exsheets_selected_questions_prop + \prop_get:NxN \g__exsheets_included_questions_prop { \int_use:N \l__exsheets_tmpa_int } \l__exsheets_tmpa_tl - \bool_if:NF \l__exsheets_include_all_bool - { \__exsheets_select_question_by_id:V \l__exsheets_tmpa_tl } + \__exsheets_select_question_by_id:V \l__exsheets_tmpa_tl } } } \cs_generate_variant:Nn \__exsheets_select_question:n { V } -\cs_generate_variant:Nn \prop_get:NnN { Nx } \cs_new_protected:Npn \__exsheets_select_question_by_id:n #1 { - \bool_if:nTF - { \l__exsheets_include_by_id_bool || \l__exsheets_include_random_bool } - {% parsing list of included IDs - \clist_if_in:NnTF - \l__exsheets_include_id_clist - { #1 } - { \bool_gset_true:N \g__exsheets_questions_use_bool } - { \bool_gset_false:N \g__exsheets_questions_use_bool } - } + \bool_if:NTF \l__exsheets_include_all_bool {% parsing list of excluded IDs \clist_if_in:NnTF \l__exsheets_exclude_id_clist { #1 } { \bool_gset_false:N \g__exsheets_questions_use_bool } - { \bool_gset_true:N \g__exsheets_questions_use_bool } + { + \bool_gset_true:N \g__exsheets_questions_use_bool + \clist_gput_right:Nn \questionsincludedlast { #1 } + \prop_gput:NnV \g__exsheets_questions_used_prop + { #1 } + \g__exsheets_questions_id_int + \int_gincr:N \g__exsheets_questions_used_int + \prop_gput:NnV \g__exsheets_questions_id_prop + { #1 } + \g__exsheets_questions_id_int + } + } + {% parsing list of included IDs + \clist_if_in:NnTF + \l__exsheets_include_id_clist + { #1 } + { + \clist_if_in:NnTF + \l__exsheets_exclude_id_clist + { #1 } + { \bool_gset_false:N \g__exsheets_questions_use_bool } + { + \bool_gset_true:N \g__exsheets_questions_use_bool + \clist_gput_right:Nn \questionsincludedlast { #1 } + \prop_gput:NnV \g__exsheets_questions_used_prop + { #1 } + \g__exsheets_questions_id_int + \int_gincr:N \g__exsheets_questions_used_int + \prop_gput:NnV \g__exsheets_questions_id_prop + { #1 } + \g__exsheets_questions_id_int + } + } + { \bool_gset_false:N \g__exsheets_questions_use_bool } } } \cs_generate_variant:Nn \__exsheets_select_question_by_id:n { V } @@ -1533,11 +1577,11 @@ { % number of question in file: \__exsheets_prop_count:NN - \g__exsheets_selected_questions_prop + \g__exsheets_included_questions_prop \l__exsheets_tmpa_int % number of selectable questions in file: \int_zero:N \l__exsheets_tmpb_int - \prop_map_inline:Nn \g__exsheets_selected_questions_prop + \prop_map_inline:Nn \g__exsheets_included_questions_prop { \prop_map_inline:Nn \l__exsheets_class_prop { @@ -1587,7 +1631,7 @@ { \pgfmathparse { random(\int_use:N \l__exsheets_tmpa_int) } \tl_set_eq:NN \l__exsheets_tmpa_tl \pgfmathresult - \prop_get:NVN \g__exsheets_selected_questions_prop + \prop_get:NVN \g__exsheets_included_questions_prop \l__exsheets_tmpa_tl \l__exsheets_tmpb_tl \clist_if_in:NVF \l__exsheets_include_id_clist \l__exsheets_tmpb_tl @@ -1687,7 +1731,6 @@ } } } -\cs_generate_variant:Nn \prop_gput:Nnn { Nff,Nfx,Nfn,Nxx } \cs_generate_variant:Nn \__exsheets_save_solution:n { V } \NewEnviron { __exsheets_solution_internal: } @@ -1702,7 +1745,7 @@ \tl_new:N \l__exsheets_use_solution_tl -\NewDocumentEnvironment { __exsheets_solution: } { g } +\newenvironment { __exsheets_solution: } [1] { \tl_clear:N \l__exsheets_use_solution_tl \prop_map_inline:Nn \l__exsheets_class_prop @@ -2567,13 +2610,19 @@ HISTORY: recognized * the counter is _not_ stepped anymore for enumerated lists when the optional argument is provided - - tasks: new command \nextonnewrow that forces the next + - tasks: new command \startnewitemline that forces the next item to be put at the beginning of a row - exsheets: protected internal commands where appropriate - exsheets: added possibility to set general options with \NewQuSolPair and \RenewQuSolPair 2013/04/08 v0.9a - exsheets: added headings instance `empty' - translations: changed fallback warning into info +2013/04/18 v0.9b - fixed erroneous behaviour of \includequestions when + used more than once + - added hook \l__exsheets_heading_points_post_hook_tl +2013/04/21 v0.9c - bug fix: \ForEachQuestion seems to work correctly + again + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def index 66dbffcb590..c9f80403371 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def @@ -72,6 +72,7 @@ \tl_new:N \l__exsheets_heading_points_format_tl \tl_new:N \l__exsheets_heading_points_pre_code_tl \tl_new:N \l__exsheets_heading_points_post_code_tl +\tl_new:N \l__exsheets_heading_points_post_hook_tl \tl_new:N \l__exsheets_heading_joined_coffins_tl \tl_new:N \l__exsheets_heading_attached_coffins_tl @@ -281,6 +282,9 @@ { \tl_use:N \l__exsheets_heading_title_user_format_tl #2 } \tl_use:N \l__exsheets_heading_number_post_code_tl } + % TODO: if questions are included via \includequestions + % \g__exsheets_questions_current_id_tl doesn't hold the current ID any + % more when the questions are typeset \hcoffin_set:Nn \l__exsheets_heading_meta_coffin { \prop_get:NoNT \g__exsheets_questions_meta_prop @@ -336,6 +340,9 @@ \tl_use:N \l__exsheets_heading_points_post_code_tl } } + % this allows users to provide their own point system while also using + % exsheets' positioning mechanism: + \tl_use:N \l__exsheets_heading_points_post_hook_tl \bool_if:nT { !\l__exsheets_heading_runin_bool && !\l__exsheets_heading_inline_bool } { diff --git a/Master/texmf-dist/tex/latex/exsheets/tasks.sty b/Master/texmf-dist/tex/latex/exsheets/tasks.sty index b6f2d01eef5..d0b73f1f8f6 100644 --- a/Master/texmf-dist/tex/latex/exsheets/tasks.sty +++ b/Master/texmf-dist/tex/latex/exsheets/tasks.sty @@ -38,9 +38,25 @@ {\@tasks@version} {Horizontal columned lists.} +% -------------------------------------------------------------------------- +% check expl3 version: +\@ifpackagelater { expl3 } { 2012/11/21 } + { } + { + \PackageError { tasks } { Support~package~expl3~too~old } + { + You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~ + 'l3packages'.\MessageBreak + Loading~tasks~will~abort! + } + \tex_endinput:D + } + +% -------------------------------------------------------------------------- % requirements: \RequirePackage { epic , cntformats , xtemplate , environ } +% -------------------------------------------------------------------------- % variables: \seq_new:N \l__tasks_seq @@ -87,7 +103,7 @@ \NewCounterPattern* [ tasks ] { task } { tsk } \ReadCounterFrom [ tasks ] { task } \g__tasks_int -% scratch variables: +% temporary variables: \tl_new:N \l__tasks_tmpa_tl \int_new:N \g__tasks_tmpa_int \int_new:N \l__tasks_tmpb_int @@ -95,6 +111,7 @@ \coffin_new:N \l__tasks_tmpb_coffin \coffin_new:N \l__tasks_tmpc_coffin +% -------------------------------------------------------------------------- % collect the tasks: \cs_new_protected:Npn \__tasks_collect_tasks:nw #1#2 \end #3 { @@ -228,6 +245,7 @@ \cs_generate_variant:Nn \__tasks_label_align:n { V } \__tasks_label_align:n { left } +% -------------------------------------------------------------------------- % the `tasks' object: % #1: number of items % #2: number of columns @@ -358,6 +376,7 @@ \tl_set:Nn \l__tasks_item_tl { \ignorespaces #2 } } +% -------------------------------------------------------------------------- % choice box: \bool_new:N \l__tasks_choice_checked_bool \dim_new:N \l__tasks_choice_width_dim @@ -405,6 +424,7 @@ \providecommand* \choicebox { \tasks_choice: } \providecommand* \checkedchoicebox { \tasks_choice_checked: } +% -------------------------------------------------------------------------- % base instance: % ALPHABETIZE: a) b) c) \DeclareInstance { tasks } { alphabetize } { default } { } @@ -432,6 +452,7 @@ resume .bool_set:N = \l__tasks_resume_bool } +% -------------------------------------------------------------------------- % the generic environment: \NewEnviron { __tasks_env: } [ 3 ] { @@ -452,6 +473,7 @@ \skip_vertical:N \l__tasks_after_list_skip } +% -------------------------------------------------------------------------- % command to start a new row: \cs_new_protected:Npn \tasks_new_row: { @@ -466,6 +488,7 @@ \NewDocumentCommand \startnewitemline {} { \tasks_new_row: } +% -------------------------------------------------------------------------- % the user environment: \NewDocumentCommand \NewTasks { O{}mO{\task}D(){1} } { @@ -481,9 +504,11 @@ { \end__tasks_env: } } +% -------------------------------------------------------------------------- % default list: \NewTasks { tasks } +% -------------------------------------------------------------------------- % package options: \keys_define:nn { tasks / options } { @@ -498,10 +523,13 @@ { \input { tasks.cfg } } } +% -------------------------------------------------------------------------- +% setup: \cs_new_protected:Npn \tasks_setup:n #1 { \keys_set:nn { tasks / list } { #1 } } \NewDocumentCommand \settasks { m } { \tasks_setup:n { #1 } } +% -------------------------------------------------------------------------- \tex_endinput:D
\ No newline at end of file |