diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/exsheets/exsheets.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 138 |
1 files changed, 86 insertions, 52 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index 09df4ddcab7..73136dadac1 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty @@ -8,7 +8,7 @@ % Web: http://www.mychemistry.eu/forums/forum/exsheets % E-Mail: contact@mychemistry.eu % ---------------------------------------------------------------------------- -% Copyright 2011-2016 Clemens Niederberger +% Copyright 2011-2017 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -28,8 +28,8 @@ \RequirePackage { expl3 , xparse } \ExplSyntaxOn -\tl_const:Nn \c_exsheets_date_tl {2016/09/07} -\tl_const:Nn \c_exsheets_version_tl {0.21e} +\tl_const:Nn \c_exsheets_date_tl {2017/02/08} +\tl_const:Nn \c_exsheets_version_tl {0.21i} \tl_const:Nn \c_exsheets_info_tl {Yet~ another~ package~ for~ the~ creation~ of~ exercise~ sheets~ and~ exams.} @@ -167,7 +167,7 @@ % ---------------------------------------------------------------------------- \RequirePackage - { xtemplate , l3sort , l3keys2e , etoolbox , environ , pgfcore } + { xtemplate , l3keys2e , etoolbox , environ , pgfcore } % ---------------------------------------------------------------------------- % write to aux file: @@ -271,10 +271,10 @@ \tl_set:Nn \l__exsheets_heading_instance_tl {block} \tl_new:N \l__exsheets_question_heading_instance_tl \tl_new:N \l__exsheets_solution_heading_instance_tl -\tl_new:N \l_exsheets_heading_title_user_format_tl -\tl_set:Nn \l_exsheets_heading_title_user_format_tl { \normalsize\bfseries } -\tl_new:N \l_exsheets_heading_subtitle_user_format_tl -\tl_set:Nn \l_exsheets_heading_subtitle_user_format_tl { \normalsize\itshape } +\tl_new:N \l_exsheets_heading_title_question_format_tl +\tl_new:N \l_exsheets_heading_title_solution_format_tl +\tl_new:N \l_exsheets_heading_subtitle_question_format_tl +\tl_new:N \l_exsheets_heading_subtitle_solution_format_tl \tl_new:N \l__exsheets_questions_toclevel_tl \tl_set:Nn \l__exsheets_questions_toclevel_tl {subsection} \tl_new:N \l__exsheets_solutions_toclevel_tl @@ -345,6 +345,8 @@ \dim_new:N \l__exsheets_solutions_skip_below_dim \dim_set:Nn \l__exsheets_solutions_skip_below_dim { .5\baselineskip } \dim_new:N \l__exsheets_blank_dim +\dim_new:N \l__exsheets_blank_line_increment_dim +\dim_new:N \l__exsheets_blank_line_minimum_length_dim \seq_new:N \l__exsheets_use_tags_seq \seq_new:N \g_exsheets_included_questions_seq @@ -398,10 +400,26 @@ headings .tl_set:N = \l__exsheets_heading_instance_tl , load-headings .code:n = \exsheets_option_dropped:n {load-headings} , - headings-format .tl_set:N = - \l_exsheets_heading_title_user_format_tl , - subtitle-format .tl_set:N = - \l_exsheets_heading_subtitle_user_format_tl , + question/headings-format .tl_set:N = + \l_exsheets_heading_title_question_format_tl , + solution/headings-format .tl_set:N = + \l_exsheets_heading_title_solution_format_tl , + headings-format .meta:n = + { + question/headings-format = {#1} , + solution/headings-format = {#1} + } , + headings-format .initial:n = \normalsize\bfseries , + question/subtitle-format .tl_set:N = + \l_exsheets_heading_subtitle_question_format_tl , + solution/subtitle-format .tl_set:N = + \l_exsheets_heading_subtitle_solution_format_tl , + subtitle-format .meta:n = + { + question/subtitle-format = {#1} , + solution/subtitle-format = {#1} + } , + subtitle-format .initial:n = \normalsize\itshape , load-tasks .code:n = \exsheets_option_dropped:n {load-tasks} , use-ref .bool_set:N = \l__exsheets_solutions_by_ref_bool , @@ -1543,38 +1561,34 @@ } \cs_generate_variant:Nn \__exsheets_restore_number_from_and_do:Nnn { NV } -\NewDocumentCommand \QuestionNumber {m} +\DeclareExpandableDocumentCommand \QuestionNumber {m} { \exsheets_question_number:n {#1} } -\cs_new_protected:Npn \exsheets_question_number:n #1 - { - \prop_get:NnNTF \g__exsheets_questions_id_prop {#1} \l__exsheets_tmpa_tl - { \__exsheets_question_number:c { exsheets@question@\l__exsheets_tmpa_tl } } - { \textbf {??} } - } +\cs_new:Npn \exsheets_question_number:n #1 + { \exsheets_get_question_property:nn {counter} {#1} } -\cs_new_protected:Npn \__exsheets_question_number:N #1 - { - \cs_if_exist:NTF #1 - { - \exp_after:wN \__exsheets_get_question_number:w #1 \q_stop - \ReadCounterPatternFrom [exsheets] \l__exsheets_qu_counter_pattern_tl - } - { \textbf {??} } - } -\cs_generate_variant:Nn \__exsheets_question_number:N { c } - -\cs_new_protected:Npn \__exsheets_get_question_number:w #1-#2-#3 \q_stop - { - \cs_if_exist:NT \thechapter - { \int_set:Nn \l__exsheets_counter_ch_int {#1} } - \int_set:Nn \l__exsheets_counter_sec_int {#2} - \int_set:Nn \l_exsheets_counter_qu_int {#3} - } +% \cs_new_protected:Npn \__exsheets_question_number:N #1 +% { +% \cs_if_exist:NTF #1 +% { +% \exp_after:wN \__exsheets_get_question_number:w #1 \q_stop +% \ReadCounterPatternFrom [exsheets] \l__exsheets_qu_counter_pattern_tl +% } +% { \textbf {??} } +% } +% \cs_generate_variant:Nn \__exsheets_question_number:N { c } + +% \cs_new_protected:Npn \__exsheets_get_question_number:w #1-#2-#3 \q_stop +% { +% \cs_if_exist:NT \thechapter +% { \int_set:Nn \l__exsheets_counter_ch_int {#1} } +% \int_set:Nn \l__exsheets_counter_sec_int {#2} +% \int_set:Nn \l_exsheets_counter_qu_int {#3} +% } % map ID's to number of used questions \cs_new_protected:Npn \exsheets@used@id #1#2 - { \prop_gput:Nnn \g__exsheets_questions_used_prop {#2} {#1} } + { \prop_gput:Nnn \g__exsheets_questions_used_prop {#1} {#2} } \cs_new_protected:Npn \__exsheets_mark_as_used:n #1 { @@ -1672,6 +1686,8 @@ } \cs_generate_variant:Nn \exsheets_set_question_properties:n { x } +% #1: property +% #2: ID \prg_new_conditional:Npnn \exsheets_if_question_property:nn #1#2 {T,F,TF} { \prop_if_in:cnTF { g__exsheets_question_property_#1_prop } {#2} @@ -1726,13 +1742,16 @@ } \cs_generate_variant:Nn \exsheets_get_question_property:nn { no , nV } -\cs_new_protected:Npn \ForEachQuestion #1 +\cs_new_protected:Npn \exsheets_for_each_question_do:n #1 { \int_gzero:N \g__exsheets_tmpa_int \prop_map_inline:Nn \g__exsheets_questions_used_prop { \int_gincr:N \g__exsheets_tmpa_int #1 } } +\NewDocumentCommand \ForEachQuestion {m} + { \exsheets_for_each_question_do:n {#1} } + \cs_new:Npn \iflastquestion { \int_compare:nTF @@ -2294,6 +2313,7 @@ { \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} @@ -2518,8 +2538,8 @@ \seq_sort:Nn \l__exsheets_tmpa_seq { \int_compare:nNnTF {##1} > {##2} - { \sort_reversed: } - { \sort_ordered: } + { \sort_return_swapped: } + { \sort_return_same: } } } \seq_map_inline:Nn \l__exsheets_tmpa_seq @@ -2573,8 +2593,7 @@ { \group_begin: \tl_set:Nn \CurrentQuestionID {#1} - \tl_set:Nx \l__exsheets_tmpa_tl - { \exsheets_get_question_property:nn {counter} {#1} } + \tl_set:Nx \l__exsheets_tmpa_tl { \exsheets_question_number:n {#1} } \__exsheets_surround_with:nVV { \exp_args:Nnx @@ -2695,7 +2714,13 @@ } , linespread .code:n = \bool_set_true:N \l__exsheets_blank_linespread_bool - \tl_set:Nn \l__exsheets_blank_linespread_tl {#1} + \tl_set:Nn \l__exsheets_blank_linespread_tl {#1} , + line-increment .dim_set:N = + \l__exsheets_blank_line_increment_dim , + line-increment .initial:n = 1pt , + line-minimum-length .dim_set:N = + \l__exsheets_blank_line_minimum_length_dim , + line-minimum-length .initial:n = 2em } \NewDocumentCommand \blank { som } @@ -2734,7 +2759,7 @@ } } } - + \cs_new_protected:Npn \__exsheets_blank_skip:N #1 { \bool_if:NTF \l__exsheets_blank_width_bool @@ -2744,22 +2769,24 @@ { \dim_to_fp:n {#1} * \l__exsheets_blank_scale_tl } \dim_set:Nn \l__exsheets_tmpa_dim { \fp_to_dim:N \l__exsheets_tmpa_fp } } - \dim_compare:nTF { \l__exsheets_tmpa_dim > 2em } + \dim_compare:nTF + { \l__exsheets_tmpa_dim > \l__exsheets_blank_line_minimum_length_dim } { \mode_if_math:TF { \exsheets_write_blank:n { \skip_horizontal:N \l__exsheets_tmpa_dim } } { - \exsheets_write_blank:n { \skip_horizontal:n { 1em } } - \dim_sub:Nn \l__exsheets_tmpa_dim { 2em } \dim_do_while:nn { \l__exsheets_tmpa_dim > \c_zero_dim } { \tex_penalty:D \hyphenpenalty - \dim_compare:nTF { \l__exsheets_tmpa_dim < 1pt } + \dim_compare:nTF + { \l__exsheets_tmpa_dim < \l__exsheets_blank_line_increment_dim } { \exsheets_write_blank:n { \skip_horizontal:N \l__exsheets_tmpa_dim } } - { \exsheets_write_blank:n { \skip_horizontal:n { 1pt } } } - \dim_sub:Nn \l__exsheets_tmpa_dim { 1pt } + { + \exsheets_write_blank:n + { \skip_horizontal:N \l__exsheets_blank_line_increment_dim } + } + \dim_sub:Nn \l__exsheets_tmpa_dim { \l__exsheets_blank_line_increment_dim } } - \exsheets_write_blank:n { \skip_horizontal:n { 1em } } } } { \exsheets_write_blank:n { \skip_horizontal:N \l__exsheets_tmpa_dim } } @@ -3190,6 +3217,13 @@ HISTORY: 2016/09/07 v0.21e - fix issue #29 - fix issue #35 - fix issue #36 +2016/09/17 v0.21f - make \exsheets_question_number:n an alias of + \exsheets_get_question_property:nn {counter}; this + also makes \QuestionNumber an alias of + \GetQuestionProperty {counter} +2016/10/25 v0.21g - smaller steps when creating the blank lines +2016/11/28 v0.21h - bug in \exsheets@used@id fixed +2017/02/08 v0.21i - adapt to l3sort integration into l3kernel %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: |