From a24fc3622e5dd5faa555ff702953f83bb38d0bb3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 13 May 2014 22:10:53 +0000 Subject: exsheets (11may14) git-svn-id: svn://tug.org/texlive/trunk@34014 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/exsheets/README | 8 +-- .../doc/latex/exsheets/cntformats_en.pdf | Bin 416464 -> 416521 bytes .../doc/latex/exsheets/cntformats_en.tex | 2 +- .../texmf-dist/doc/latex/exsheets/exsheets_en.pdf | Bin 666590 -> 670403 bytes .../texmf-dist/doc/latex/exsheets/exsheets_en.tex | 30 +++++++- Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf | Bin 443086 -> 445066 bytes Master/texmf-dist/doc/latex/exsheets/tasks_en.tex | 2 +- .../texmf-dist/tex/latex/exsheets/cntformats.sty | 2 +- .../tex/latex/exsheets/exsheets-listings.sty | 2 +- Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 77 +++++++++++++++++---- .../tex/latex/exsheets/exsheets_headings.def | 3 +- Master/texmf-dist/tex/latex/exsheets/tasks.sty | 11 +-- 12 files changed, 107 insertions(+), 30 deletions(-) diff --git a/Master/texmf-dist/doc/latex/exsheets/README b/Master/texmf-dist/doc/latex/exsheets/README index ca7232c0adf..319d5e15641 100644 --- a/Master/texmf-dist/doc/latex/exsheets/README +++ b/Master/texmf-dist/doc/latex/exsheets/README @@ -1,13 +1,13 @@ -------------------------------------------------------------------------- -EXSHEETS 2013/12/27 +EXSHEETS 2014/05/11 bundled packages: -the EXSHEETS package v0.12b +the EXSHEETS package v0.13 Yet another package for the creation of exercise sheets the EXSHEETS-LISTINGS package v0.2 Using listings in exsheets the CNTFORMATS package v0.6 A different way to read counters. -the TASKS package v0.9b +the TASKS package v0.9c Horizontal columned lists. -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ Clemens Niederberger Web: https://bitbucket.org/cgnieder/exsheets/ E-Mail: contact@mychemistry.eu -------------------------------------------------------------------------- -Copyright 2011-2013 Clemens Niederberger +Copyright 2011-2014 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/doc/latex/exsheets/cntformats_en.pdf b/Master/texmf-dist/doc/latex/exsheets/cntformats_en.pdf index bcb1bc621b0..5ce72181de8 100644 Binary files a/Master/texmf-dist/doc/latex/exsheets/cntformats_en.pdf and b/Master/texmf-dist/doc/latex/exsheets/cntformats_en.pdf differ diff --git a/Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex b/Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex index 8fa6ed82b38..261b9bdb6d3 100644 --- a/Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex +++ b/Master/texmf-dist/doc/latex/exsheets/cntformats_en.tex @@ -12,7 +12,7 @@ % Web: https://bitbucket.org/cgnieder/exsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2011-2013 Clemens Niederberger +% Copyright 2011-2014 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/doc/latex/exsheets/exsheets_en.pdf b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.pdf index e1ec17c653c..59593bf3880 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 09d853ff8a3..ea18bc5f1a2 100644 --- a/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex +++ b/Master/texmf-dist/doc/latex/exsheets/exsheets_en.tex @@ -13,7 +13,7 @@ % Web: https://bitbucket.org/cgnieder/exsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2011-2013 Clemens Niederberger +% Copyright 2011-2014 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -410,6 +410,17 @@ packages \pkg{cleveref}. Question properties can now be retrieved before the question is printed (by writing the properties to the \code{aux} file). +\subsection{Version 0.13} +New options: +\begin{itemize} + \item \option{chapter-hook} allows to add code to the list of solutions when + the solutions of a new chapter are printed, see + section~\ref{sec:solutions-print-all}. + \item \option{section-hook} allows to add code to the list of solutions when + the solutions of a new section are printed, see + section~\ref{sec:solutions-print-all}. +\end{itemize} + \section{Thanks} I need to thank the many users who gave me feedback so far! For one thing this shows me that \ExSheets\ is useful to people. It also led to many @@ -950,7 +961,7 @@ They might come in handy if you want two versions of an exercise sheet, one with the exercises and one with the solutions, and you want to add different titles to these versions, for instance. -\subsection{Print all} +\subsection{Print all}\label{sec:solutions-print-all} The first and easiest usage of \cs{printsolutions} is the following: \begin{sourcecode} \printsolutions @@ -965,6 +976,21 @@ explained in the next sections. \printsolutions \end{example} +Two options aloow to add code to the list of solutions when used with +\cs{printsolutions}\Oarg{all} (which is the same as using it without option): + +\begin{options} + \keyval{chapter-hook}{code} + \sinceversion{0.13}Adds \meta{code} to the list of solutions every time + solutions from a new chapter are printed (before the solutions of the + corresponding chapter are printed). + \keyval{section-hook}{code} + \sinceversion{0.13}Adds \meta{code} to the list of solutions every time + solutions from a new section are printed (before the solutions of the + corresponding section are printed). +\end{options} + + \subsection{Print per chapter/section} \minisec{Current chapter/section} If you are not creating an exercise sheet or an exam but are writing a diff --git a/Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf b/Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf index 03888e0a218..e70bac5f399 100644 Binary files a/Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf and b/Master/texmf-dist/doc/latex/exsheets/tasks_en.pdf differ diff --git a/Master/texmf-dist/doc/latex/exsheets/tasks_en.tex b/Master/texmf-dist/doc/latex/exsheets/tasks_en.tex index 5a9ff2442cc..8489ad90296 100644 --- a/Master/texmf-dist/doc/latex/exsheets/tasks_en.tex +++ b/Master/texmf-dist/doc/latex/exsheets/tasks_en.tex @@ -12,7 +12,7 @@ % Web: https://bitbucket.org/cgnieder/exsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2011-2013 Clemens Niederberger +% Copyright 2011-2014 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/cntformats.sty b/Master/texmf-dist/tex/latex/exsheets/cntformats.sty index cb2cccd2db0..22a10598aef 100644 --- a/Master/texmf-dist/tex/latex/exsheets/cntformats.sty +++ b/Master/texmf-dist/tex/latex/exsheets/cntformats.sty @@ -9,7 +9,7 @@ % Web: https://bitbucket.org/cgnieder/exsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2012-2013 Clemens Niederberger +% Copyright 2012-2014 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-listings.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty index 6e27fa7c90c..544ad1ce34d 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-2013 Clemens Niederberger +% Copyright 2011-2014 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.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index e3f631830bd..6b3ebe04da2 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty @@ -8,7 +8,7 @@ % Web: https://bitbucket.org/cgnieder/exsheets/ % E-Mail: contact@mychemistry.eu % ---------------------------------------------------------------------------- -% Copyright 2011-2013 Clemens Niederberger +% Copyright 2011-2014 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -25,8 +25,8 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % ---------------------------------------------------------------------------- -\def\exsheets@date{2013/12/27} -\def\exsheets@version{0.12b} +\def\exsheets@date{2014/05/11} +\def\exsheets@version{0.13} \RequirePackage { expl3 , xparse } \ProvidesExplPackage @@ -58,6 +58,7 @@ \cs_generate_variant:Nn \prop_gput:Nnn { Nx , Nxx } \cs_generate_variant:Nn \prop_gput:Nnn { cf , cff } \cs_generate_variant:Nn \tl_if_blank:nTF { x } +\cs_generate_variant:Nn \tl_if_eq:nnF { x } % ---------------------------------------------------------------------------- % temporary variables @@ -679,7 +680,7 @@ } } -\cs_new:Npn \exsheets_vary:w +\cs_new_protected:Npn \exsheets_vary:w { \__exsheets_variation_i:n } \cs_new:Npn \exsheets_last_variant: { } @@ -1036,7 +1037,7 @@ \fp_new:N \g__exsheets_this_question_points_fp \fp_new:N \g__exsheets_this_question_bonus_fp -\cs_new:Npn \__exsheets_read_points:w #1 ! #2 ! #3 \q_stop +\cs_new_protected:Npn \__exsheets_read_points:w #1 ! #2 ! #3 \q_stop { \tl_if_blank:nTF { #1 } { @@ -1290,11 +1291,11 @@ \bool_if:nTF { \l__exsheets_parse_points_bool && !\l__exsheets_only_print_points_bool } { - \__exsheets_use_heading:VVVnnV + \__exsheets_use_heading:VVVVnV \l__exsheets_question_heading_instance_tl \l__exsheets_questions_title_tl \l__exsheets_qu_counter_interpretation_tl - { \l__exsheets_question_points_fp } + \l__exsheets_question_points_fp { \l__exsheets_question_bonus_fp } \l__exsheets_tmpa_tl } @@ -1313,11 +1314,11 @@ \l__exsheets_tmpa_tl } { - \__exsheets_use_heading:VVVnnV + \__exsheets_use_heading:VVVVnV \l__exsheets_question_heading_instance_tl \l__exsheets_questions_title_tl \l__exsheets_qu_counter_interpretation_tl - { \l__exsheets_questions_points_tl } + \l__exsheets_questions_points_tl { 0 } \l__exsheets_tmpa_tl } @@ -1445,7 +1446,7 @@ } { #2 } { #3 } { #4 } { #5 } { #6 } } -\cs_generate_variant:Nn \__exsheets_use_heading:nnnnnn { V , VVVnnV } +\cs_generate_variant:Nn \__exsheets_use_heading:nnnnnn { V , VVVnnV , VVVVnV } \bool_new:N \l__exsheets_exam_bool \bool_set_false:N \l__exsheets_exam_bool @@ -1541,8 +1542,9 @@ \cs_new:Npn \exsheets_get_question_property:nn #1#2 { - \prop_if_in:cnT { g__exsheets_question_property_#1_prop } { #2 } + \prop_if_in:cnTF { g__exsheets_question_property_#1_prop } { #2 } { \prop_get:cn { g__exsheets_question_property_#1_prop } { #2 } } + { ?? } } \cs_generate_variant:Nn \exsheets_get_question_property:nn { no } @@ -1572,14 +1574,14 @@ \cs_new_protected:Npn \exsheets_debug_box:nn #1#2 { - \exsheets_par: + \par \noindent \group_begin: \normalfont\normalsize\normalcolor \colorbox { exsheetsdebugcolor } { \parbox { \dim_eval:n { #1 - 2 \fboxsep } } { #2 } } \group_end: - \exsheets_par: + \par } \cs_new:Npn \__exsheets_list_comma: {} @@ -2143,11 +2145,15 @@ exsheets_print_solutions / all .code:n = { \exsheets_print_solutions_all: } , exsheets_print_solutions / byID .code:n = - { \exsheets_print_solutions_byID:n { #1 } } + { \exsheets_print_solutions_byID:n { #1 } } , + chapter-hook .tl_set:N = \l__exsheets_new_chapter_hook_tl , + section-hook .tl_set:N = \l__exsheets_new_section_hook_tl } \int_new:N \l__exsheets_counter_ch_int +\int_new:N \l__exsheets_current_ch_int \int_new:N \l__exsheets_counter_sec_int +\int_new:N \l__exsheets_current_sec_int \int_new:N \l__exsheets_counter_qu_int \cs_new_protected:Npn \__exsheets_get_sectioning_numbers: @@ -2310,8 +2316,31 @@ \__exsheets_print_solutions_all:nn } +\cs_new:Npn \__exsheets_sectioning_hook:nn #1#2 + { + \bool_if:nT { + !\int_compare_p:n + { + \use:c { l__exsheets_current_#1_int } + = + \use:c { l__exsheets_counter_#1_int } + } + && + !\int_compare_p:n + { \use:c { l__exsheets_counter_#1_int } = 0 } + } + { #2 } + } +\cs_generate_variant:Nn \__exsheets_sectioning_hook:nn { nV } + \cs_new_protected:Npn \__exsheets_print_solutions_all:nn #1#2 { + \int_set_eq:NN + \l__exsheets_current_sec_int + \l__exsheets_counter_sec_int + \int_set_eq:NN + \l__exsheets_current_ch_int + \l__exsheets_counter_ch_int \__exsheets_read_number:w #2 \q_stop \prop_get:NnNT \g__exsheets_solutions_names_prop { #1 } \l__exsheets_tmpa_tl @@ -2321,6 +2350,13 @@ { #1 } \l__exsheets_tmpb_tl \prop_get:NnN \g__exsheets_solutions_questions_id_prop { #1 } \l__exsheets_tmpc_tl + \group_begin: + \tl_set_eq:NN \CurrentQuestionID \l__exsheets_tmpc_tl + \__exsheets_sectioning_hook:nV { ch } + \l__exsheets_new_chapter_hook_tl + \__exsheets_sectioning_hook:nV { sec } + \l__exsheets_new_section_hook_tl + \group_end: \eSaveCounterPatternFrom [ exsheets ] \l__exsheets_current_pattern_interpretation_tl \l__exsheets_current_pattern_tl @@ -2656,7 +2692,7 @@ % ---------------------------------------------------------------------------- % SETUP -\NewDocumentCommand \SetupExSheets { o m } +\NewDocumentCommand \SetupExSheets { o +m } { \IfNoValueTF { #1 } { \keys_set:nn { exsheets } { #2 } } @@ -2935,9 +2971,20 @@ HISTORY: 2013/12/27 v0.12b - ensure that points are not parsed if a leading bang is inserted - fix bug in parsing the points +2014/05/11 v0.13 - new options: + * chapter-hook + * section-hook + These options provide hooks to add code in the list + of solutions (when printed with \printsolutions[all]) + when solutions from a new section or chapter are + printed %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: +- add a `tags' concept +- add user interface that removes \par and vertical skip after + question/solution environments. + (equal to \cs_set_eq:NN \exsheets_par: \scan_stop: ) - points/decimal-marker, points/frac (?), points/format (?,im interface) - points: swedish style - \examspace inside {tasks} => possible? (\pagegoal-\pagetotal) gives wrong diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def index a40d2187e8e..770f8593248 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def @@ -336,7 +336,8 @@ \group_begin: \tl_use:N \l__exsheets_heading_title_format_tl \strut \group_end: - \fp_compare:nF { #3 = 0 } + % \exp_args:Nx \tl_show:n { #3 } + \tl_if_eq:xnF { #3 } { 0 } { \tl_use:N \l__exsheets_heading_points_pre_code_tl { \exsheets_print_points:n { #3 } } diff --git a/Master/texmf-dist/tex/latex/exsheets/tasks.sty b/Master/texmf-dist/tex/latex/exsheets/tasks.sty index 45726ca6519..8985933e0ad 100644 --- a/Master/texmf-dist/tex/latex/exsheets/tasks.sty +++ b/Master/texmf-dist/tex/latex/exsheets/tasks.sty @@ -8,7 +8,7 @@ % Web: https://bitbucket.org/cgnieder/exsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2011-2013 Clemens Niederberger +% Copyright 2011-2014 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 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -\def\@tasks@date{2013/12/03} -\def\@tasks@version{0.9b} +\def\@tasks@date{2014/05/11} +\def\@tasks@version{0.9c} \RequirePackage { expl3 , xparse , l3keys2e } \ProvidesExplPackage @@ -85,7 +85,7 @@ \tl_new:N \l__tasks_item_fill_left_tl \tl_new:N \l__tasks_item_fill_right_tl \tl_new:N \l__tasks_label_align_tl -\tl_new:N \task +% \tl_new:N \task \tl_new:N \l__tasks_item_tl \tl_new:N \l__tasks_tmp_label_tl @@ -596,3 +596,6 @@ won't any more 2013/12/03 v0.9b - add missing \noindent for the case when \listparindent is non-zero, fixes http://tex.stackexchange.com/q/148082/5049 +2014/05/11 v0.9c - remove definition of the \task macro: it is not necessary + for `tasks' to function but it conflicts e.g. with `ltxdoc' + class -- cgit v1.2.3