From 10e97945f3c4d2cea1d52090ee5f038652e2b9d2 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 10 Feb 2017 23:30:33 +0000 Subject: exsheets (9feb17) git-svn-id: svn://tug.org/texlive/trunk@43188 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/exsheets/exsheets-listings.sty | 16 +-- Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 138 +++++++++++++-------- .../tex/latex/exsheets/exsheets_configurations.cfg | 29 ++++- .../tex/latex/exsheets/exsheets_headings.cfg | 2 +- .../tex/latex/exsheets/exsheets_headings.def | 22 ++-- 5 files changed, 138 insertions(+), 69 deletions(-) (limited to 'Master/texmf-dist/tex/latex/exsheets') diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty index 35766b9129a..8e77c4aff43 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty @@ -8,7 +8,7 @@ % Web: https://bitbucket.org/cgnieder/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 @@ -93,7 +93,7 @@ \keys_set:nn {exsheets/listings/question} {#1,#4,##1} \int_gincr:N \g__exsheets_listings_question_int \lst@BeginWriteFile - { \c_job_name_tl - ex \int_use:N \g__exsheets_listings_question_int . lst } + { \c_sys_jobname_str - ex \int_use:N \g__exsheets_listings_question_int . lst } } { \lst@EndWriteFile @@ -105,7 +105,7 @@ \exp_not:V \l__exsheets_listings_question_pre_tl \exp_not:N \lstinputlisting [ \exp_not:V \l__exsheets_listings_question_code_tl ] - { \c_job_name_tl - ex \int_use:N \g__exsheets_listings_question_int . lst } + { \c_sys_jobname_str - ex \int_use:N \g__exsheets_listings_question_int . lst } \exp_not:V \l__exsheets_listings_question_post_tl } \end {#3} @@ -115,7 +115,7 @@ \keys_set:nn { exsheets / listings / solution } { #1,#7,##1 } \int_gincr:N \g__exsheets_listings_solution_int \lst@BeginWriteFile - { \c_job_name_tl - sol \int_use:N \g__exsheets_listings_solution_int . lst } + { \c_sys_jobname_str - sol \int_use:N \g__exsheets_listings_solution_int . lst } } { \lst@EndWriteFile @@ -126,7 +126,7 @@ \exp_not:V \l__exsheets_listings_solution_pre_tl \exp_not:N \lstinputlisting [ \exp_not:V \l__exsheets_listings_solution_code_tl ] - { \c_job_name_tl - sol \int_use:N \g__exsheets_listings_solution_int . lst } + { \c_sys_jobname_str - sol \int_use:N \g__exsheets_listings_solution_int . lst } \exp_not:V \l__exsheets_listings_solution_post_tl } \end {#6} @@ -141,5 +141,7 @@ \tex_endinput:D HISTORY -2013/09/18 v0.1 - first draft, see http://tex.stackexchange.com/a/133969/5049 -2013/10/11 v0.2 - first official version bundled with ExSheets +2013/09/18 - first draft, see http://tex.stackexchange.com/a/133969/5049 +2013/10/11 - first official version bundled with ExSheets +2017/02/08 - change deprecated \c_job_name_tl into the new \c_sys_jobname_str + 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: diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_configurations.cfg b/Master/texmf-dist/tex/latex/exsheets/exsheets_configurations.cfg index 3c64153c7ca..e5f7eb0046c 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_configurations.cfg +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_configurations.cfg @@ -1,5 +1,32 @@ +% ---------------------------------------------------------------------------- +% the EXSHEETS package +% +% Yet another package for the creation of exercise sheets +% +% ---------------------------------------------------------------------------- +% Clemens Niederberger +% Web: http://www.mychemistry.eu/forums/forum/exsheets +% E-Mail: contact@mychemistry.eu +% ---------------------------------------------------------------------------- +% 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 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% ---------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% ---------------------------------------------------------------------------- \ProvidesFile{exsheets_configurations.cfg} % Put your definitions and configurations here. -\endinput \ No newline at end of file +\endinput diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg index 3f899b23033..3badcdbbf44 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg @@ -8,7 +8,7 @@ % Web: https://bitbucket.org/cgnieder/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 diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def index b4a436a9520..e7100ce4d63 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def @@ -8,7 +8,7 @@ % Web: https://bitbucket.org/cgnieder/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 @@ -167,6 +167,14 @@ \exsheets_new_heading_coffin:n {points} \exsheets_new_heading_coffin:n {subtitle} +\cs_new_protected:Npn \exsheets_heading_format:nn #1#2 + { + \bool_if:NT \l__exsheets_inside_question_bool + { \tl_use:c {l_exsheets_heading_#1_question_format_tl} {#2} } + \bool_if:NT \l__exsheets_inside_solution_bool + { \tl_use:c {l_exsheets_heading_#1_solution_format_tl} {#2} } + } + % the `exsheets-heading' object: % #1 = title, % #2 = number, @@ -266,7 +274,7 @@ \tl_use:N \l__exsheets_heading_title_format_tl \strut \tl_use:N \l__exsheets_heading_title_pre_code_tl - { \tl_use:N \l_exsheets_heading_title_user_format_tl {#1} } + { \exsheets_heading_format:nn {title} {#1} } \tl_use:N \l__exsheets_heading_title_post_code_tl } \hcoffin_set:Nn \l__exsheets_heading_number_coffin @@ -276,22 +284,20 @@ { \tl_use:N \l__exsheets_heading_number_format_tl } \strut \tl_use:N \l__exsheets_heading_number_pre_code_tl - { \tl_use:N \l_exsheets_heading_title_user_format_tl {#2} } + { \exsheets_heading_format:nn {title} {#2} } \tl_use:N \l__exsheets_heading_number_post_code_tl } \hcoffin_set:Nn \l__exsheets_heading_subtitle_coffin { \exsheets_if_question_subtitle:T { - \tl_if_blank:VTF \l__exsheets_heading_subtitle_format_tl - { \tl_use:N \l__exsheets_heading_title_format_tl } - { \tl_use:N \l__exsheets_heading_subtitle_format_tl } \strut \tl_use:N \l__exsheets_heading_subtitle_pre_code_tl { \group_begin: - \tl_use:N \l_exsheets_heading_subtitle_user_format_tl - { \exsheets_get_question_property:nn {subtitle} {#5} } + \exsheets_heading_format:nn + {subtitle} + { \exsheets_get_question_property:nn {subtitle} {#5} } \group_end: } \tl_use:N \l__exsheets_heading_subtitle_post_code_tl -- cgit v1.2.3