diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/cntformats.sty | 349 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 585 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/tasks.cfg | 55 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/tasks.sty | 601 |
6 files changed, 304 insertions, 1292 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/cntformats.sty b/Master/texmf-dist/tex/latex/exsheets/cntformats.sty deleted file mode 100644 index 22a10598aef..00000000000 --- a/Master/texmf-dist/tex/latex/exsheets/cntformats.sty +++ /dev/null @@ -1,349 +0,0 @@ -% -------------------------------------------------------------------------- -% the CNTFORMATS package -% -% A different way to read counters -% -% This package is part of the exsheets bundle -% -------------------------------------------------------------------------- -% Clemens Niederberger -% Web: https://bitbucket.org/cgnieder/exsheets/ -% E-Mail: contact@mychemistry.eu -% -------------------------------------------------------------------------- -% 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 -% 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. -% -------------------------------------------------------------------------- -% The cntformats package is part of the exsheets bundle -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- -\def\@cntfmts@date{2013/10/11} -\def\@cntfmts@version{v0.6} - -\ProvidesPackage{cntformats}[% - \@cntfmts@date\space - \@cntfmts@version\space - A different way to read counters. (CN)] -\RequirePackage{etoolbox,cnltx-base} -% -------------------------------------------------------------------------- -% message handling -\def\@cntfmts@error@message{% - For details have a look at the `exsheets' manual.} - -\cnltx@create@generic@message{@cntfmts}{cntformats}{Error}{\@cntfmts@error@message} -\cnltx@create@generic@message{@cntfmts}{cntformats}{Warning}{} -\cnltx@create@generic@message{@cntfmts}{cntformats}{WarningNoLine}{} -\cnltx@create@generic@message{@cntfmts}{cntformats}{Info}{} - -\def\@cntfmts@err@already@defined#1{% - \@cntfmts@error{The counter `#1' already exists!}} -\def\@cntfmts@err@unknown@counter#1{% - \@cntfmts@error{The counter `#1' is undefined!}} -\def\@cntfmts@err@pattern@defined#1#2{% - \@cntfmts@error{The pattern `#2' for module `#1' is already defined!}} -\def\@cntfmts@err@pattern@undefined#1#2{% - \@cntfmts@error{The pattern `#2' for module `#1' is undefined!}} - -% ---------------------------------------------------------------------------- -% tokenlist analyzing and manipulating -% if you happen to read this code and notice some obvious reasons why these -% macros shoudn't be used like this, please send me your improved version -% (seriously! But please explain why yours is better) -% \long\def\@cntfmts@ifintl#1#2{% -% \def\@cntfmts@intl@tmpa##1#2{}% -% \expandafter\if\expandafter\relax\expandafter -% \detokenize\expandafter{\@cntfmts@intl@tmpa#1{}{}#2}\relax% -% \expandafter\@secondoftwo -% \else -% \expandafter\@firstoftwo -% \fi -% } -% \long\def\@cntfmts@ifintlcs#1{% -% \expandafter\@cntfmts@ifintl\expandafter{#1}} - -% \long\def\@cntfmts@replaceonceincs#1#2#3{% -% \@cntfmts@ifintlcs#1{#2}% -% {\@cntfmts@replace@once@incs#1{#2}{#3}}{}% -% } -% \long\def\@cntfmts@replace@once@incs#1#2#3{% -% \def\@cntfmts@replo@tmpa##1#2##2\q@stop{% -% \def#1{##1#3##2}}% -% \expandafter\@cntfmts@replo@tmpa#1\q@stop -% } - -% \long\def\@cntfmts@replaceallin#1#2#3{% -% \def\@cntfmts@repla@tmpa{#1}% -% \@cntfmts@replaceonceincs\@cntfmts@repla@tmpa{#2}{#3}% -% \@cntfmts@ifintlcs\@cntfmts@repla@tmpa{#2}% -% {\expandafter\@cntfmts@replaceallin\expandafter{\@cntfmts@repla@tmpa}{#2}{#3}}% -% {\expandonce\@cntfmts@repla@tmpa}% -% } -% \long\def\@cntfmts@replaceallincs#1#2#3{% -% \@cntfmts@replaceonceincs#1{#2}{#3}% -% \@cntfmts@ifintlcs#1{#2}{\@cntfmts@replaceallincs#1{#2}{#3}}{}% -% } - -% ---------------------------------------------------------------------------- -% expansion tools -% heavily inspired by expl3's \exp_args:N<spec> -- one might say: copied -% \long\def\@cntfmts@getnextbraced#1#2#3{#2\@cntfmts@firstofone{#3{#1}}} -% \long\def\@cntfmts@firstofone#1{#1} -% \long\def\@cntfmts@braced@unexpanded#1\@cntfmts@firstofone#2#3{% -% #1\@cntfmts@firstofone{#2{#3}}} -% \long\def\@cntfmts@braced@expandedonce#1\@cntfmts@firstofone#2#3{% -% \expandafter\@cntfmts@getnextbraced\expandafter{#3}{#1}{#2}} - -% \long\def\@cntfmts@expand@first{% -% \@cntfmts@braced@expandedonce -% \@cntfmts@firstofone} - -% \long\def\@cntfmts@expand@second{% -% \@cntfmts@braced@unexpanded -% \@cntfmts@braced@expandedonce -% \@cntfmts@firstofone} - -% \long\def\@cntfmts@expand@third{% -% \@cntfmts@braced@unexpanded -% \@cntfmts@braced@unexpanded -% \@cntfmts@braced@expandedonce -% \@cntfmts@firstofone} - -% ---------------------------------------------------------------------------- -% expandable commands with optional argument (and no mandatory) -% this is probably not very robust. If you know what you're doing you're -% probably able to define a better version yourself. If not: don't use this -% one! -% \long\def\@cntfmts@isopt@#1[#2\q@marker#3#{% -% \if\relax\detokenize{#1#2}\relax -% \expandafter\@firstoftwo -% \else -% \expandafter\@secondoftwo -% \fi} -% \long\def\@cntfmts@isopt#1#2#3{% -% \@cntfmts@isopt@#1\q@marker[\q@marker{#2#1}{#2[{#3}]{#1}}} - -% \long\def\@cntfmts@defwopt#1[#2]#3{% -% \long\def#1##1{\@cntfmts@isopt{##1}{\csuse{\@cntfmts@strip@bs#1@opt}}{#2}}% -% \long\csdef{\@cntfmts@strip@bs#1@opt}[##1]{#3}} - -% \def\@cntfmts@strip@bs{\expandafter\@gobble\string} - -% ---------------------------------------------------------------------------- -% #1: module -% #2: counter -\def\@cntfmts@def@counter@read#1#2#3{% - \cnltx@expandargs(no)\csdef - {@#1@read@#3@counter}% - {\csname @#1@read@#2@counter\endcsname}% -} - -% create pattern for an existing counter: -% #1: module -% #2: counter -% #3: id -\newcommand*\@cntfmts@add@counter@pattern[3][cntfmts]{% - \ifcsdef{c@#2} - {}{\@cntfmts@err@unknown@counter{#2}}% - \ifcsdef{@#1@#2@counter} - {\@cntfmts@err@pattern@defined{#1}{#2}} - {\csdef{@#1@#2@counter}{}}% - \listcsadd{@#1@counter@ids}{#3}% - \@cntfmts@def@counter@read{#1}{#2}{#3}% -} - -\newcommand*\@cntfmts@add@counter@pattern@nostar[3][cntfmts]{% - \@cntfmts@add@counter@pattern[#1]{#2}{#3}% - \cnltx@expandargs(nno)\@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}% -} - -\newrobustcmd*\AddCounterPattern{% - \@ifstar - {\@cntfmts@add@counter@pattern} - {\@cntfmts@add@counter@pattern@nostar}% -} -\@onlypreamble\AddCounterPattern - -% create pattern for a new counter -% #1: counter -% #2: id -\newcommand*\@cntfmts@new@counter@pattern[3][cntfmts]{% - \ifcsdef{the#2} - {\@cntfmts@err@counter@defined{#2}}{}% - \newcounter{#2}% - \listcsadd{@#1@counter@ids}{#3}% - \@cntfmts@def@counter@read{#1}{#2}{#3}% - \csdef{@#1@#2@counter}{} -} - -\newcommand*\@cntfmts@new@counter@pattern@nostar[3][cntfmts]{% - \@cntfmts@new@counter@pattern[#1]{#2}{#3}% - \cnltx@expandargs(nno)\@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}% -} - -\newrobustcmd*\NewCounterPattern{% - \@ifstar - {\@cntfmts@new@counter@pattern} - {\@cntfmts@new@counter@pattern@nostar}% -} -\@onlypreamble\NewCounterPattern - -% renew pattern: -\newcommand*\@cntfmts@renew@counter@pattern[3][cntfmts]{% - \ifcsdef{the#2} - {}{\@cntfmts@err@unknown@counter{#2}}% - \ifcsdef{@#1@#2@counter}{} - {\@cntfmts@err@pattern@undefined{#1}{#2}}% - \ifinlistcs{@#1@counter@ids}{#3} - {}{\listcsadd{@#1@counter@ids}{#3}}% - \@cntfmts@def@counter@read{#1}{#2}{#3}% -} - -\newcommand*\@cntfmts@renew@counter@pattern@nostar[3][cntfmts]{% - \@cntfmts@renew@counter@pattern[#1]{#2}{#3}% - \cnltx@expandargs(nno)\@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}% -} - -\newrobustcmd\RenewCounterPattern{% - \@ifstar - {\@cntfmts@renew@counter@pattern} - {\@cntfmts@renew@counter@pattern@nostar}% -} -\@onlypreamble\RenewCounterPattern - -% ---------------------------------------------------------------------------- -% assign a different internal command to <counter> than \c@<counter> -% can/must be used after a call from \AddCounterPattern* or -% \NewCounterPattern* -% #1: module -% #2: counter -% #3: internal command -\def\@cntfmts@create@read@counter#1#2#3{% - \expandafter\newexpandablecmd - \expandafter*\csname @#1@read@#2@counter\endcsname[1][]{% - \ifblank{##1} - {\@arabic{#3}} - {\csuse{@cntfmts@counter@type@##1}{#3}}% - }% -} - -\newrobustcmd*\ReadCounterFrom[3][cntfmts]{% - \@cntfmts@create@read@counter{#1}{#2}{#3}% -} - -% ---------------------------------------------------------------------------- -% pattern formats -% #1: key -% #2: number presentation command like \@alph -\def\@cntfmts@new@pattern@format#1#2{% - \csdef{@cntfmts@counter@type@#1}{#2}% -} - -\newrobustcmd*\NewPatternFormat[2]{% - \@cntfmts@new@pattern@format{#1}{#2}% -} -\@onlypreamble\NewPatternFormat - -% ---------------------------------------------------------------------------- -% interpret and print pattern: -% #1: module -% #2: list -% #3: pattern -\def\@cntfmts@read@counter@pattern#1#2#3{% - \def\@cntfmts@parsed@pattern{#3\@empty}% - \forlistcsloop{\@cntfmts@replace@pattern{#1}}{#2}% -} -% #1: module -% #2: pattern-key -\def\@cntfmts@replace@pattern#1#2{% - \cnltx@replace@all\@cntfmts@parsed@pattern - {#2}{\csuse{@#1@read@#2@counter}}% -} - -\newrobustcmd*\ReadCounterPattern[2][cntfmts]{% - \@cntfmts@read@counter@pattern{#1}{@#1@counter@ids}{#2}\@cntfmts@parsed@pattern -} - -\newrobustcmd*\ReadCounterPatternFrom[2][cntfmts]{% - \cnltx@expandargs(nno)\@cntfmts@read@counter@pattern{#1}{@#1@counter@ids}{#2}% - \@cntfmts@parsed@pattern -} - -% #1: save pattern in -% #2: save interpretation in -% #3: pattern -% #4: module -\newcommand*\@cntfmts@save@counter@pattern[4]{% - \@cntfmts@read@counter@pattern{#4}{@#4@counter@ids}{#3}% - \let#2\@cntfmts@parsed@pattern - \def#1{#3}% -} - -\newcommand*\@cntfmts@esave@counter@pattern[4]{% - \@cntfmts@read@counter@pattern{#4}{@#4@counter@ids}{#3}% - \edef#2{\@cntfmts@parsed@pattern}% - \def#1{#3}% -} - -\newrobustcmd*\SaveCounterPattern[4][cntfmts]{% - \@cntfmts@save@counter@pattern{#2}{#3}{#4}{#1}% -} - -\newrobustcmd*\SaveCounterPatternFrom[4][cntfmts]{% - \cnltx@expandargs(nno)\@cntfmts@save@counter@pattern{#2}{#3}{#4}{#1}% -} - -\newrobustcmd*\eSaveCounterPattern[4][cntfmts]{% - \@cntfmts@esave@counter@pattern{#2}{#3}{#4}{#1}% -} - -\newrobustcmd*\eSaveCounterPatternFrom[4][cntfmts]{% - \cnltx@expandargs(nno)\@cntfmts@esave@counter@pattern{#2}{#3}{#4}{#1}% -} - -% ---------------------------------------------------------------------------- -% predefined formats and pattern -\NewPatternFormat{a}{\@alph} -\NewPatternFormat{A}{\@Alph} -\NewPatternFormat{1}{\@arabic} -\NewPatternFormat{r}{\@roman} -\NewPatternFormat{R}{\@Roman} - -\ifdef\c@paragraph - {\AddCounterPattern{paragraph}{pg}}{} -\ifdef\c@subsubsection - {\AddCounterPattern{subsubsection}{ssse}}{} -\ifdef\c@subsection - {\AddCounterPattern{subsection}{sse}}{} -\ifdef\c@section - {\AddCounterPattern{section}{se}}{} -\ifdef\c@chapter - {\AddCounterPattern{chapter}{ch}}{} - -\endinput - -% HISTORY: -2012/09/30 v0.2beta - first version (as part of the `exsheets' bundle) -2012/11/08 v0.4 - stepped number with `exsheets' until now; next stepping - won't synchronize but will step to whatever deems - appropriate -2012/04/23 v0.5 - changed tests for heading commands to test explicitly for - the associated counters - - change test for counter in \@cntfmts@add@counter@pattern - from \the<ounter> to \c@<ounter> - - rename tokenlist test macros to use cntformats' - namespace -2013/10/11 v0.6 - use my `cnltx-base' package for the programming tools it - provides; this allows to get rid of the artefacts in the - expanded patterns - diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index f6425d9bb7d..4e628c964af 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty @@ -25,8 +25,8 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % ---------------------------------------------------------------------------- -\def\exsheets@date{2014/06/28} -\def\exsheets@version{0.14} +\def\exsheets@date{2014/07/20} +\def\exsheets@version{0.15} \RequirePackage { expl3 , xparse } \ProvidesExplPackage @@ -37,10 +37,10 @@ % -------------------------------------------------------------------------- % check expl3 version: -\@ifpackagelater { expl3 } { 2012/11/21 } +\@ifpackagelater {expl3} {2014/01/01} { } { - \PackageError { exsheets } { Support~package~expl3~too~old } + \PackageError {exsheets} {Support~package~expl3~too~old} { You~need~to~update~your~installation~of~the~bundles~'l3kernel'~and~ 'l3packages'.\MessageBreak @@ -78,19 +78,19 @@ % ---------------------------------------------------------------------------- % messages -\msg_new:nnn { exsheets} { totalpoints } +\msg_new:nnn {exsheets} {totalpoints} { You~need~to~activate~`points/parse'~if~you~want~to~use~ \token_to_str:N \totalpoints .~I~will~do~nothing~instead. } -\msg_new:nnn { exsheets} { parse-points } +\msg_new:nnn {exsheets} {parse-points} { You~need~to~activate~`points/parse'~if~you~want~to~use~ \token_to_str:N #1 .~I~will~do~nothing~instead. } -\msg_new:nnn { exsheets} { headings } +\msg_new:nnn {exsheets} {headings} { You~requested~the~headings~instance~`#1'~\msg_line_context: \c_space_tl which~is~not~defined.~Did~you~forget~to~use~the~package~option~ @@ -98,52 +98,52 @@ pretend~nothing~happened. } -\msg_new:nnn { exsheets } { random-file } +\msg_new:nnn {exsheets} {random-file} { You~asked~me~to~select~#1~questions~from~file~#2~which~contains~#3~questions.~ I'll~select~all~of~them. } -\msg_new:nnn { exsheets } { random-selectable } +\msg_new:nnn {exsheets} {random-selectable} { You~asked~me~to~select~#1~questions~from~file~#2~which~contains~#3~questions.~ #4~of~these~are~selectable,~so~I'll~select~all~of~them. } -\msg_new:nnn { exsheets } { only-inside-question } +\msg_new:nnn {exsheets} {only-inside-question} { The~command~`~\token_to_str:N #1 \c_space_tl'~can~only~be~used~inside~ the~question~environment. } -\msg_new:nnn { exsheets } { loading-configurations } +\msg_new:nnn {exsheets} {loading-configurations} { Loading~custom~configurations~file~`exsheets_configurations.cgf'. } -\msg_new:nnn { exsheets } { deprecated-command } +\msg_new:nnn {exsheets} {deprecated-command} { The~command~`~\token_to_str:N #1 \c_space_tl'~is~deprecated.~ Use~`~\token_to_str:N #2 \c_space_tl'~instead. } -\msg_new:nnn { exsheets } { dropped-option } +\msg_new:nnn {exsheets} {dropped-option} { The~option~`#1'~has~been~dropped. } -\msg_new:nnn { exsheets } { grade-missing } +\msg_new:nnn {exsheets} {grade-missing} { The~grade~`#1'~has~never~been~declared. } -\msg_new:nnn { exsheets } { grade-parse } +\msg_new:nnn {exsheets} {grade-parse} { I~cannot~calculate~the~points~for~grade~`#1'~since~you're~using~the~option~ `points/parse=false'. } -\msg_new:nnn { exsheets } { variations } +\msg_new:nnn {exsheets} {variations} { The~number~of~variations~must~at~least~be~`2'.~You~chose~`#1'~hence~I'm~ doing~nothing. } -\msg_new:nnn { exsheets } { variant } +\msg_new:nnn {exsheets} {variant} { You~must~choose~an~integer~between~`1'~and~`#1'.~You~chose~`#2'~hence~ I'm~doing~nothing. @@ -152,11 +152,11 @@ \cs_new_protected:Npn \exsheets_depr_cmd:nn #1#2 { \cs_new:Npn #1 - { \msg_warning:nnnn { exsheets } { deprecated-command } { #1 } { #2 } #2 } + { \msg_warning:nnnn {exsheets} { deprecated-command } {#1} {#2} #2 } } \cs_new_protected:Npn \exsheets_option_dropped:n #1 - { \msg_warning:nnn { exsheets } { dropped-option } { #1 } } + { \msg_warning:nnn {exsheets} { dropped-option } {#1} } % ---------------------------------------------------------------------------- \RequirePackage @@ -172,7 +172,7 @@ % ---------------------------------------------------------------------------- % write to aux file: \cs_new_protected:Npn \exsheets_write_to_aux_x:n #1 - { \if@filesw \iow_now:Nx \@auxout { #1 } \fi } + { \if@filesw \iow_now:Nx \@auxout {#1} \fi } % prevent compilatin errors when exsheets is removed from a document: \AtBeginDocument{ @@ -215,8 +215,6 @@ % ---------------------------------------------------------------------------- % (also) package options: -\bool_new:N \l__exsheets_load_headings_bool -\bool_new:N \l__exsheets_load_tasks_bool \bool_new:N \l__exsheets_solutions_by_ref_bool \bool_new:N \l__exsheets_questions_totoc_bool \bool_new:N \l__exsheets_solutions_totoc_bool @@ -237,28 +235,27 @@ \tl_new:N \l__exsheets_solutions_pre_hook_tl \tl_new:N \l__exsheets_solutions_post_hook_tl -\AtBeginDocument{ - \cs_if_exist:NF \phantomsection - { \cs_new:Npn \phantomsection {} } -} -\keys_define:nn { exsheets } +\keys_define:nn {exsheets} { color .code:n = - \exsheets_option_dropped:n { color } , + \exsheets_option_dropped:n {color} , counter-format .code:n = \SaveCounterPattern [ exsheets ] \l__exsheets_qu_counter_pattern_tl \l__exsheets_qu_counter_interpretation_tl - { #1 } , + {#1} , counter-within .code:n = \@addtoreset{question}{#1} , headings .tl_set:N = \l__exsheets_heading_instance_tl , - load-headings .bool_set:N = \l__exsheets_load_headings_bool , + load-headings .code:n = + \exsheets_option_dropped:n {load-headings} , +% .bool_set:N = \l__exsheets_load_headings_bool , headings-format .tl_set:N = \l_exsheets_heading_title_user_format_tl , subtitle-format .tl_set:N = \l_heading_exsheets_subtitle_user_format_tl , - load-tasks .bool_set:N = \l__exsheets_load_tasks_bool , + load-tasks .code:n = + \exsheets_option_dropped:n {load-tasks} , use-ref .bool_set:N = \l__exsheets_solutions_by_ref_bool , totoc .choice: , totoc / true .code:n = @@ -271,16 +268,16 @@ questions-totoc .bool_set:N = \l__exsheets_questions_totoc_bool , solutions-totoc .bool_set:N = \l__exsheets_solutions_totoc_bool , toc-level .code:n = - \tl_set:Nn \l__exsheets_questions_toclevel_tl { #1 } - \tl_set:Nn \l__exsheets_solutions_toclevel_tl { #1 } , + \tl_set:Nn \l__exsheets_questions_toclevel_tl {#1} + \tl_set:Nn \l__exsheets_solutions_toclevel_tl {#1} , questions-toc-level .tl_set:N = \l__exsheets_questions_toclevel_tl , solutions-toc-level .tl_set:N = \l__exsheets_solutions_toclevel_tl , auto-label .bool_set:N = \l__exsheets_auto_label_bool } -\keys_set:nn { exsheets} { counter-format = qu. } +\keys_set:nn {exsheets} { counter-format = qu. } % process package options: -\ProcessKeysOptions { exsheets } +\ProcessKeysOptions {exsheets} % ---------------------------------------------------------------------------- % points for exercises @@ -322,50 +319,50 @@ \cs_new_protected_nopar:Npn \exsheets_set_points_name:n #1 { - \tl_if_in:nnTF { #1 } { / } + \tl_if_in:nnTF {#1} { / } { \__exsheets_set_points_name_aux:nn #1 \q_stop } { \__exsheets_set_points_name_aux:nn #1 / \q_stop } } \cs_new_protected_nopar:Npn \__exsheets_set_points_name_aux:nn #1/#2 \q_stop { - \tl_set:Nn \l__exsheets_points_name_tl { #1 } + \tl_set:Nn \l__exsheets_points_name_tl {#1} \tl_set:Nn \l__exsheets_points_name_plural_tl { #1#2 } } \cs_new_protected_nopar:Npn \exsheets_set_bonus_name:n #1 { - \tl_if_in:nnTF { #1 } { / } + \tl_if_in:nnTF {#1} { / } { \__exsheets_set_bonus_name_aux:nn #1 \q_stop } { \__exsheets_set_bonus_name_aux:nn #1 / \q_stop } } \cs_new_protected_nopar:Npn \__exsheets_set_bonus_name_aux:nn #1/#2 \q_stop { - \tl_set:Nn \l__exsheets_bonus_name_tl { #1 } + \tl_set:Nn \l__exsheets_bonus_name_tl {#1} \tl_set:Nn \l__exsheets_bonus_name_plural_tl { #1#2 } } % FIXME: \fp_add will deprecate! \cs_new_protected_nopar:Npn \exsheets_add_points:n #1 { - \fp_gadd:Nn \g__exsheets_points_sum_fp { #1 } - \fp_gadd:Nn \g__exsheets_this_question_points_fp { #1 } + \fp_gadd:Nn \g__exsheets_points_sum_fp {#1} + \fp_gadd:Nn \g__exsheets_this_question_points_fp {#1} } \cs_generate_variant:Nn \exsheets_add_points:n { V } \cs_new_protected_nopar:Npn \exsheets_add_bonus:n #1 { - \fp_gadd:Nn \g__exsheets_bonus_sum_fp { #1 } - \fp_gadd:Nn \g__exsheets_this_question_bonus_fp { #1 } + \fp_gadd:Nn \g__exsheets_bonus_sum_fp {#1} + \fp_gadd:Nn \g__exsheets_this_question_bonus_fp {#1} } \cs_generate_variant:Nn \exsheets_add_bonus:n { V } \cs_new_protected_nopar:Npn \exsheets@sum@of@points #1 - { \fp_gset:Nn \g_exsheets_total_points_fp { #1 } } + { \fp_gset:Nn \g_exsheets_total_points_fp {#1} } \cs_new_protected_nopar:Npn \exsheets@sum@of@bonus #1 - { \fp_gset:Nn \g_exsheets_total_bonus_fp { #1 } } + { \fp_gset:Nn \g_exsheets_total_bonus_fp {#1} } \cs_new_nopar:Npn \exsheets_parse_points:n #1 { @@ -373,8 +370,8 @@ \tl_use:N \l__exsheets_points_number_format_tl { \bool_if:NTF \l__exsheets_parse_points_bool - { \exsheets_num:n { \fp_to_decimal:n { #1 } } } - { \use:n { #1 } } + { \exsheets_num:n { \fp_to_decimal:n {#1} } } + { \use:n {#1} } } \group_end: } @@ -386,8 +383,8 @@ \tl_use:N \l__exsheets_bonus_number_format_tl { \bool_if:NTF \l__exsheets_parse_points_bool - { \exsheets_num:n { \fp_to_decimal:n { #1 } } } - { \use:n { #1 } } + { \exsheets_num:n { \fp_to_decimal:n {#1} } } + { \use:n {#1} } } \group_end: } @@ -396,7 +393,7 @@ \cs_new_protected_nopar:Npn \exsheets_num:n #1 { \group_begin: - \fp_set:Nn \l__exsheets_tmpa_tl { #1 } + \fp_set:Nn \l__exsheets_tmpa_tl {#1} \fp_to_tl:N \l__exsheets_tmpa_tl \group_end: } @@ -411,7 +408,7 @@ { \bool_if:NTF \l__exsheets_parse_points_bool { - \tl_if_eq:nnTF { #1 } { ?? } + \tl_if_eq:nnTF {#1} { ?? } { \tl_use:N \l__exsheets_points_name_plural_tl } { \fp_compare:nTF { #1 <= 1 } @@ -434,7 +431,7 @@ { \bool_if:NTF \l__exsheets_parse_points_bool { - \tl_if_eq:nnTF { #1 } { ?? } + \tl_if_eq:nnTF {#1} { ?? } { \tl_use:N \l__exsheets_bonus_name_plural_tl } { \fp_compare:nTF { #1 <= 1 } @@ -452,34 +449,34 @@ { \bool_if:NTF \l__exsheets_inside_question_bool { - \exsheets_add_points:n { #2 } - \IfBooleanF { #1 } { \exsheets_print_points:n { #2 } } + \exsheets_add_points:n {#2} + \IfBooleanF {#1} { \exsheets_print_points:n {#2} } } - { \msg_error:nnn { exsheets } { only-inside-question } { \addpoints } } + { \msg_error:nnn {exsheets} {only-inside-question} {\addpoints} } } \NewDocumentCommand \addbonus { sm } { \bool_if:NTF \l__exsheets_inside_question_bool { - \exsheets_add_bonus:n { #2 } - \IfBooleanF { #1 } { \exsheets_print_bonus:n { #2 } } + \exsheets_add_bonus:n {#2} + \IfBooleanF {#1} { \exsheets_print_bonus:n {#2} } } - { \msg_error:nnn { exsheets } { only-inside-question } { \addbonus } } + { \msg_error:nnn {exsheets} {only-inside-question} {\addbonus} } } \NewDocumentCommand \points { sm } { - \IfBooleanTF { #1 } - { \exsheets_parse_points:n { #2 } } - { \exsheets_print_points:n { #2 } } + \IfBooleanTF {#1} + { \exsheets_parse_points:n {#2} } + { \exsheets_print_points:n {#2} } } \NewDocumentCommand \bonus { sm } { - \IfBooleanTF { #1 } - { \exsheets_parse_bonus:n { #2 } } - { \exsheets_print_bonus:n { #2 } } + \IfBooleanTF {#1} + { \exsheets_parse_bonus:n {#2} } + { \exsheets_print_bonus:n {#2} } } \cs_new_protected_nopar:Npn \exsheets_print_points:n #1 @@ -487,8 +484,8 @@ \group_begin: \tl_use:N \l__exsheets_points_format_tl { - \exsheets_parse_points:n { #1 } - \exsheets_points_name:n { #1 } + \exsheets_parse_points:n {#1} + \exsheets_points_name:n {#1} } \group_end: } @@ -496,8 +493,8 @@ \cs_new_protected_nopar:Npn \exsheets_print_bonus:n #1 { - \exsheets_parse_bonus:n { #1 } - \exsheets_bonus_name:n { #1 } + \exsheets_parse_bonus:n {#1} + \exsheets_bonus_name:n {#1} } \cs_generate_variant:Nn \exsheets_print_bonus:n { V } @@ -505,44 +502,44 @@ { \bool_if:NTF \l__exsheets_parse_points_bool { - \IfBooleanTF { #1 } + \IfBooleanTF {#1} { \exsheets_parse_points:n { \g_exsheets_total_points_fp } } { \exsheets_print_points:n { \g_exsheets_total_points_fp } } } - { \msg_warning:nnn { exsheets } { parse-points } { \pointssum } } + { \msg_warning:nnn {exsheets} {parse-points} {\pointssum} } } \NewDocumentCommand \bonussum { s } { \bool_if:NTF \l__exsheets_parse_points_bool { - \IfBooleanTF { #1 } + \IfBooleanTF {#1} { \exsheets_parse_bonus:n { \g_exsheets_total_bonus_fp } } { \exsheets_print_bonus:n { \g_exsheets_total_bonus_fp } } } - { \msg_warning:nnn { exsheets } { parse-points } { \bonussum } } + { \msg_warning:nnn {exsheets} {parse-points} {\bonussum} } } \NewDocumentCommand \currentpointssum { s } { \bool_if:NTF \l__exsheets_parse_points_bool { - \IfBooleanTF { #1 } + \IfBooleanTF {#1} { \exsheets_parse_points:n { \g__exsheets_points_sum_fp } } { \exsheets_print_points:n { \g__exsheets_points_sum_fp } } } - { \msg_warning:nnn { exsheets } { parse-points } { \currentpointssum } } + { \msg_warning:nnn {exsheets} {parse-points} {\currentpointssum} } } \NewDocumentCommand \currentbonussum { s } { \bool_if:NTF \l__exsheets_parse_points_bool { - \IfBooleanTF { #1 } + \IfBooleanTF {#1} { \exsheets_parse_bonus:n { \g__exsheets_bonus_sum_fp } } { \exsheets_print_bonus:n { \g__exsheets_bonus_sum_fp } } } - { \msg_warning:nnn { exsheets } { parse-points } { \currentbonussum } } + { \msg_warning:nnn {exsheets} {parse-points} {\currentbonussum} } } \NewDocumentCommand \totalpoints { s } @@ -551,7 +548,7 @@ \tl_use:N \l__exsheets_points_format_tl { \exsheets_totalpoints: - \IfBooleanF { #1 } + \IfBooleanF {#1} { \bool_if:nT { @@ -561,7 +558,7 @@ { \exsheets_points_name:n { \g_exsheets_total_points_fp } } } \exsheets_totalbonus: - \IfBooleanF { #1 } + \IfBooleanF {#1} { \fp_compare:nF { \g_exsheets_total_bonus_fp = 0 } { @@ -590,7 +587,7 @@ { \g_exsheets_total_points_fp } } } - { \msg_warning:nn { exsheets } { totalpoints } } + { \msg_warning:nn {exsheets} {totalpoints} } } \cs_new_nopar:Npn \exsheets_totalbonus: @@ -610,12 +607,12 @@ \keys_define:nn { exsheets / points } { name .code:n = - \exsheets_set_points_name:n { #1 } - \exsheets_set_bonus_name:n { #1 } , + \exsheets_set_points_name:n {#1} + \exsheets_set_bonus_name:n {#1} , name-plural .code:n = - \tl_set:Nn \l__exsheets_points_name_plural_tl { #1 } - \tl_set:Nn \l__exsheets_bonus_name_plural_tl { #1 } , - bonus-name .code:n = \exsheets_set_bonus_name:n { #1 } , + \tl_set:Nn \l__exsheets_points_name_plural_tl {#1} + \tl_set:Nn \l__exsheets_bonus_name_plural_tl {#1} , + bonus-name .code:n = \exsheets_set_bonus_name:n {#1} , bonus-plural .tl_set:N = \l__exsheets_bonus_name_plural_tl , pre-bonus .tl_set:N = \l__exsheets_points_pre_bonus_marker_tl , post-bonus .tl_set:N = \l__exsheets_points_post_bonus_marker_tl , @@ -634,10 +631,10 @@ \cs_new_protected:Npn \exsheets_set_variations:n #1 { - \int_compare:nNnTF { #1 } < { 2 } - { \msg_warning:nnn { exsheets } { variations } { #1 } } + \int_compare:nNnTF {#1} < { 2 } + { \msg_warning:nnn {exsheets} {variations} {#1} } { - \int_set:Nn \l__exsheets_variations_int { #1 } + \int_set:Nn \l__exsheets_variations_int {#1} \int_zero:N \l__exsheets_tmpa_int \int_do_while:nNnn { \l__exsheets_tmpa_int } < { \l__exsheets_variations_int } @@ -658,8 +655,8 @@ { \bool_if:nTF { - \int_compare_p:nNn { #1 } > { 0 } && - \int_compare_p:nNn { #1 } < { \l__exsheets_variations_int + 1 } + \int_compare_p:nNn {#1} > { 0 } && + \int_compare_p:nNn {#1} < { \l__exsheets_variations_int + 1 } } { \int_zero:N \l__exsheets_tmpa_int @@ -670,7 +667,7 @@ \__exsheets_reset_variation_auxiliary:x { \int_use:N \l__exsheets_tmpa_int } } - \cs_set:cpn { __exsheets_variation_ \int_to_roman:n { #1 } :n } ##1 + \cs_set:cpn { __exsheets_variation_ \int_to_roman:n {#1} :n } ##1 { ##1 \cs_set:Npn \exsheets_last_variant: { ##1 } @@ -678,8 +675,8 @@ } } { - \msg_warning:nnxx { exsheets } { variant } - { \int_use:N \l__exsheets_variations_int } { #1 } + \msg_warning:nnxx {exsheets} {variant} + { \int_use:N \l__exsheets_variations_int } {#1} } } @@ -690,23 +687,23 @@ \cs_new_protected:Npn \__exsheets_generate_variation_auxiliary:n #1 { - \cs_if_exist:cTF { __exsheets_variation_ \int_to_roman:n { #1 } :n } - { \cs_set:cpn { __exsheets_variation_ \int_to_roman:n { #1 } :n } { } } - { \cs_new:cpn { __exsheets_variation_ \int_to_roman:n { #1 } :n } { } } + \cs_if_exist:cTF { __exsheets_variation_ \int_to_roman:n {#1} :n } + { \cs_set:cpn { __exsheets_variation_ \int_to_roman:n {#1} :n } { } } + { \cs_new:cpn { __exsheets_variation_ \int_to_roman:n {#1} :n } { } } } \cs_new_protected:Npn \__exsheets_reset_variation_auxiliary:n #1 { - \cs_set:cpn { __exsheets_variation_ \int_to_roman:n { #1 } :n } ##1 + \cs_set:cpn { __exsheets_variation_ \int_to_roman:n {#1} :n } ##1 { \use:c { __exsheets_variation_ \int_to_roman:n { #1 + 1 } :n } } } \cs_generate_variant:Nn \__exsheets_reset_variation_auxiliary:n { x } \NewDocumentCommand \SetVariations { m } - { \exsheets_set_variations:n { #1 } } + { \exsheets_set_variations:n {#1} } \NewDocumentCommand \variant { m } - { \exsheets_variant:n { #1 } } + { \exsheets_variant:n {#1} } \NewDocumentCommand \vary { } { \exsheets_vary:w } @@ -742,19 +739,19 @@ \cs_new:Npn \exsheets_strip_braces:N #1 { \exp_after:wN \__exsheets_strip_braces:w \exp_after:wN #1#1 \q_stop } \cs_new_protected:Npn \__exsheets_strip_braces:w #1#2 \q_stop - { \tl_set:Nn #1 { #2 } } + { \tl_set:Nn #1 {#2} } \cs_new_protected:Npn \__exsheets_declare_relgrades:n #1 { - \clist_set:Nn \l__exsheets_tmpa_clist { #1 } + \clist_set:Nn \l__exsheets_tmpa_clist {#1} \clist_map_inline:Nn \l__exsheets_tmpa_clist { \__exsheets_declare_relgrade:w ##1 \q_stop } } \cs_new_protected:Npn \__exsheets_declare_relgrade:w #1 = #2 \q_stop { - \tl_set:Nn \l__exsheets_tmpa_tl { #1 } - \tl_set:Nn \l__exsheets_tmpb_tl { #2 } + \tl_set:Nn \l__exsheets_tmpa_tl {#1} + \tl_set:Nn \l__exsheets_tmpb_tl {#2} \tl_trim_spaces:N \l__exsheets_tmpa_tl \exsheets_strip_braces:N \l__exsheets_tmpa_tl \tl_trim_spaces:N \l__exsheets_tmpb_tl @@ -765,12 +762,12 @@ } \NewDocumentCommand \DeclareRelGrades { m } - { \__exsheets_declare_relgrades:n { #1 } } + { \__exsheets_declare_relgrades:n {#1} } \@onlypreamble \DeclareRelGrades \cs_new_protected:Npn \__exsheets_grade:nn #1#2 { - \prop_get:NnNTF \l__exsheets_relgrades_prop { #2 } \l__exsheets_tmpa_fp + \prop_get:NnNTF \l__exsheets_relgrades_prop {#2} \l__exsheets_tmpa_fp { \bool_if:NTF \l__exsheets_parse_points_bool { @@ -782,16 +779,16 @@ { min( \__exsheets_grade_rounded: , \g_exsheets_total_points_fp ) } } } - { \msg_warning:nnn { exsheets } { grade-parse } { #1 } \textbf{??} } + { \msg_warning:nnn {exsheets} {grade-parse} {#1} \textbf{??} } } - { \msg_warning:nnn { exsheets } { grade-missing } { #1 } \textbf{??} } + { \msg_warning:nnn {exsheets} {grade-missing} {#1} \textbf{??} } } \NewDocumentCommand \grade { sm } { - \IfBooleanTF { #1 } - { \__exsheets_grade:nn { 0 } { #2 } } - { \__exsheets_grade:nn { 1 } { #2 } } + \IfBooleanTF {#1} + { \__exsheets_grade:nn { 0 } {#2} } + { \__exsheets_grade:nn { 1 } {#2} } } \keys_define:nn { exsheets / grades } @@ -821,11 +818,11 @@ \cs_new_nopar:Npn \exsheets_glue:N #1 { \cleaders \vbox:n {} \skip_vertical:N #1 } -\keys_define:nn { exsheets } +\keys_define:nn {exsheets} { skip-below .code:n = - \dim_set:Nn \l__exsheets_questions_skip_below_dim { #1 } - \dim_set:Nn \l__exsheets_solutions_skip_below_dim { #1 } + \dim_set:Nn \l__exsheets_questions_skip_below_dim {#1} + \dim_set:Nn \l__exsheets_solutions_skip_below_dim {#1} } % Einteilung in Klassen, Themen und andere Gruppierungen: @@ -835,7 +832,7 @@ \cs_new_protected:Npn \exsheets_new_question_class:nn #1#2 { - \prop_put:Nnn \l__exsheets_class_prop { #2 } { #1 } + \prop_put:Nnn \l__exsheets_class_prop {#2} {#1} \prop_new:c { g__exsheets_questions_#1_prop } \prop_new:c { g__exsheets_#2_prop } \prop_new:c { g__exsheets_#2_active_prop } @@ -843,7 +840,7 @@ \bool_new:c { g__exsheets_use_#2_bool } \bool_new:c { l__exsheets_#1_active_bool } \tl_new:c { l__exsheets_questions_#1_tl } - \keys_define:nn { exsheets } + \keys_define:nn {exsheets} { use-#2 .code:n = { @@ -926,13 +923,13 @@ \cs_new_protected:Npn \exsheets_declare_question_class:nn #1#2 { - \prop_if_in:NnTF \l__exsheets_class_prop { #2 } + \prop_if_in:NnTF \l__exsheets_class_prop {#2} {} - { \exsheets_new_question_class:nn { #1 } { #2 } } + { \exsheets_new_question_class:nn {#1} {#2} } } \NewDocumentCommand \DeclareQuestionClass { mm } - { \exsheets_declare_question_class:nn { #1 } { #2 } } + { \exsheets_declare_question_class:nn {#1} {#2} } \@onlypreamble \DeclareQuestionClass \cs_new:Npn \exsheets_get_question_class:n #1 @@ -942,28 +939,28 @@ } \DeclareExpandableDocumentCommand \GetQuestionClass { m } - { \exsheets_get_question_class:n { #1 } } + { \exsheets_get_question_class:n {#1} } \cs_new_protected:Npn \exsheets_print_question_class:nTF #1#2#3 { \group_begin: \tl_set:Nx \l__exsheets_tmpa_tl - { \exsheets_get_question_class:n { #1 } } + { \exsheets_get_question_class:n {#1} } \tl_if_blank:VTF \l__exsheets_tmpa_tl - { #3 } + {#3} { - \cs_set_protected:Npn \__exsheets_print_question_class:n ##1 { #2 } + \cs_set_protected:Npn \__exsheets_print_question_class:n ##1 {#2} \__exsheets_print_question_class:n - { \exsheets_get_question_class:n { #1 } } + { \exsheets_get_question_class:n {#1} } } \group_end: } \NewDocumentCommand \PrintQuestionClassTF { mmm } - { \exsheets_print_question_class:nTF { #1 } { #2 } { #3 } } + { \exsheets_print_question_class:nTF {#1} {#2} {#3} } \NewDocumentCommand \PrintQuestionClassT { mm } - { \exsheets_print_question_class:nTF { #1 } { #2 } { } } + { \exsheets_print_question_class:nTF {#1} {#2} { } } \NewDocumentCommand \PrintQuestionClassF { mm } - { \exsheets_print_question_class:nTF { #1 } { } { #2 } } + { \exsheets_print_question_class:nTF {#1} { } {#2} } % ---------------------------------------------------------------------------- % die 'question' Umgebung @@ -1089,10 +1086,10 @@ \cs_new_protected:Npn \__exsheets_read_points:w #1 ! #2 ! #3 \q_stop { - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { \bool_set_true:N \l__exsheets_only_print_points_bool - \tl_set:Nn \l__exsheets_questions_points_tl { #2 } + \tl_set:Nn \l__exsheets_questions_points_tl {#2} } { \bool_set_false:N \l__exsheets_only_print_points_bool @@ -1102,22 +1099,22 @@ \cs_new_protected:Npn \__exsheets_read_points_aux:w #1+#2+#3 \q_stop { - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { \fp_zero:N \l__exsheets_question_points_fp } - { \fp_set:Nn \l__exsheets_question_points_fp { #1 } } - \tl_if_blank:nTF { #2 } + { \fp_set:Nn \l__exsheets_question_points_fp {#1} } + \tl_if_blank:nTF {#2} { \fp_zero:N \l__exsheets_question_bonus_fp } { - \tl_if_blank:nTF { #3 } + \tl_if_blank:nTF {#3} { \fp_zero:N \l__exsheets_question_bonus_fp } - { \fp_set:Nn \l__exsheets_question_bonus_fp { #2 } } + { \fp_set:Nn \l__exsheets_question_bonus_fp {#2} } } } \cs_new_protected:Npn \__exsheets_read_points:n #1 { \bool_if:NTF \l__exsheets_parse_points_bool { \__exsheets_read_points:w #1!! \q_stop } - { \tl_set:Nn \l__exsheets_questions_points_tl { #1 } } + { \tl_set:Nn \l__exsheets_questions_points_tl {#1} } } \cs_new:Npn \exsheets_label_format:n #1 { qu:#1 } @@ -1132,7 +1129,7 @@ \cs_new_protected:Npn \exsheets_update_referencing_command:NN #1#2 { \cs_set:Npx #1 ##1 - { \exp_not:o { #2 } { \exsheets_label_format:n { ##1 } } } + { \exp_not:o {#2} { \exsheets_label_format:n { ##1 } } } } \cs_new_protected:Npn \exsheets_update_referencing_commands: @@ -1146,25 +1143,25 @@ { \exsheets_set_question_properties:x { - ref = \exp_not:o { \exsheets_ref:n { #1 } } , - pageref = \exp_not:o { \exsheets_pageref:n { #1 } } + ref = \exp_not:o { \exsheets_ref:n {#1} } , + pageref = \exp_not:o { \exsheets_pageref:n {#1} } } } \cs_generate_variant:Nn \exsheets_set_ref_properties:n { V } -\keys_define:nn { exsheets } +\keys_define:nn {exsheets} { label-format .code:n = - \cs_set:Npn \exsheets_label_format:n ##1 { #1 } + \cs_set:Npn \exsheets_label_format:n ##1 {#1} \exsheets_update_referencing_commands: , label-cmd .code:n = - \cs_set:Npn \__exsheets_label:n { #1 } + \cs_set:Npn \__exsheets_label:n {#1} \exsheets_update_referencing_commands: , ref-cmd .code:n = - \cs_set:Npn \__exsheets_ref:n { #1 } + \cs_set:Npn \__exsheets_ref:n {#1} \exsheets_update_referencing_commands: , page-ref-cmd .code:n = - \cs_set:Npn \__exsheets_pageref:n { #1 } + \cs_set:Npn \__exsheets_pageref:n {#1} \exsheets_update_referencing_commands: } @@ -1176,7 +1173,7 @@ \bool_if:NT \l__exsheets_questions_use_bool { \bool_gset_true:N \g__exsheets_questions_use_bool } % Optionen: - \IfNoValueF { #1 } { \keys_set:nn { exsheets / question } { #1 } } + \IfNoValueF {#1} { \keys_set:nn { exsheets / question } {#1} } % ID: \bool_if:nT { @@ -1221,7 +1218,7 @@ % Punktevergabe: \fp_gzero:N \g__exsheets_this_question_points_fp \fp_gzero:N \g__exsheets_this_question_bonus_fp - \IfNoValueTF { #2 } + \IfNoValueTF {#2} { \__exsheets_read_points:n { 0 } \bool_if:NT \l__exsheets_points_questions_default_bool @@ -1241,7 +1238,7 @@ \fp_gset_eq:NN \g__exsheets_this_question_bonus_fp \l__exsheets_question_bonus_fp - \__exsheets_read_points:n { #2 } + \__exsheets_read_points:n {#2} % check if moving this to a later point has negative effects... % \exsheets_set_question_properties:n { points = #2 } } @@ -1374,8 +1371,8 @@ \cs_new_protected:Npn \__exsheets_save_number_in_aux_x:Nnn #1#2#3 { - \prop_gput:Nfx #1 { #2 } { #3 } - \exsheets_write_to_aux_x:n { \exsheets@save@number { #2 } { #3 } } + \prop_gput:Nfx #1 {#2} {#3} + \exsheets_write_to_aux_x:n { \exsheets@save@number {#2} {#3} } } \cs_new_protected:Npn \__exsheets_save_number_in:N #1 @@ -1411,7 +1408,7 @@ \cs_new_protected:Npn \__exsheets_restore_number_from_and_do:Nnn #1#2#3 { - \prop_get:NnN #1 { #2 } \l__exsheets_tmpc_tl + \prop_get:NnN #1 {#2} \l__exsheets_tmpc_tl \tl_if_eq:NNF \l__exsheets_tmpc_tl \q_no_value { \exp_after:wN @@ -1424,11 +1421,11 @@ \cs_generate_variant:Nn \__exsheets_restore_number_from_and_do:Nnn { NV } \NewDocumentCommand \QuestionNumber { m } - { \exsheets_question_number:n { #1 } } + { \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 + \prop_get:NnNTF \g__exsheets_questions_id_prop {#1} \l__exsheets_tmpa_tl { \__exsheets_question_number:c { exsheets@question@\l__exsheets_tmpa_tl } } { \textbf{??} } } @@ -1447,9 +1444,9 @@ \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 } + { \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 @@ -1465,9 +1462,12 @@ % ---------------------------------------------------------------------------- % title of a question: -\input { exsheets_headings.def } -\bool_if:NT \l__exsheets_load_headings_bool - { \input { exsheets_headings.cfg } } +\cs_if_exist:NF \exsheets_headings_files_loaded: + { + \file_input:n {exsheets_headings.def} + \file_input:n {exsheets_headings.cfg} + } + % #1: instance % #2: title % #3: number @@ -1476,13 +1476,13 @@ % #6: id \cs_new:Npn \exsheets_use_heading:nnnnnn #1#2#3#4#5#6 { - \IfInstanceExistTF { exsheets-heading } { #1 } - { \UseInstance { exsheets-heading } { #1 } } + \IfInstanceExistTF {exsheets-heading} {#1} + { \UseInstance {exsheets-heading} {#1} } { - \msg_warning:nnx { exsheets} { headings } { #1 } - \UseInstance { exsheets-heading } { block } + \msg_warning:nnx {exsheets} {headings} {#1} + \UseInstance {exsheets-heading} {block} } - { #2 } { #3 } { #4 } { #5 } { #6 } + {#2} {#3} {#4} {#5} {#6} } \cs_generate_variant:Nn \exsheets_use_heading:nnnnnn { V , VVVnnV , VVVVnV } @@ -1503,8 +1503,8 @@ type / exercise .code:n = \bool_set_false:N \l__exsheets_exam_bool , name .code:n = - \tl_set:Nn \l__exsheets_exercise_name_tl { #1 } - \tl_set:Nn \l__exsheets_questions_name_tl { #1 } , + \tl_set:Nn \l__exsheets_exercise_name_tl {#1} + \tl_set:Nn \l__exsheets_questions_name_tl {#1} , headings .tl_set:N = \l__exsheets_question_heading_instance_tl , subtitle .tl_set:N = \l__exsheets_questions_subtitle_tl , print .bool_set:N = \l__exsheets_questions_print_bool , @@ -1531,28 +1531,38 @@ { \prop_new:c { g__exsheets_question_property_#1_prop } \keys_define:nn { question / meta } - { #1 .code:n = \__exsheets_question_set_property:nn { #1 } { ##1 } } + { #1 .code:n = \__exsheets_question_set_property:nn {#1} { ##1 } } } \NewDocumentCommand \DeclareQuestionProperty { m } - { \exsheets_declare_question_property:n { #1 } } + { \exsheets_declare_question_property:n {#1} } \@onlypreamble \DeclareQuestionProperty \cs_new_protected:Npn \exsheets_set_question_properties:n #1 { \@bsphack \bool_if:NTF \l__exsheets_inside_question_bool - { \keys_set:nn { question / meta } { #1 } } - { - \msg_error:nnn { exsheets } { only-inside-question } - { \SetQuestionProperties } - } + { \keys_set:nn { question / meta } {#1} } + { \msg_error:nnn {exsheets} {only-inside-question} {\SetQuestionProperties} } \@esphack } \cs_generate_variant:Nn \exsheets_set_question_properties:n { x } -\NewDocumentCommand \SetQuestionProperties { m } - { \exsheets_set_question_properties:n { #1 } } +\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} + { \prg_return_true: } + { \prg_return_false: } + } +\DeclareExpandableDocumentCommand \IfQuestionPropertyTF { } + { \exsheets_if_question_property:nnTF } +\DeclareExpandableDocumentCommand \IfQuestionPropertyT { } + { \exsheets_if_question_property:nnT } +\DeclareExpandableDocumentCommand \IfQuestionPropertyF { } + { \exsheets_if_question_property:nnF } + +\NewDocumentCommand \SetQuestionProperties { +m } + { \exsheets_set_question_properties:n {#1} } % #1: ID % #2: property @@ -1560,7 +1570,7 @@ \cs_new:Npn \exsheets@question@property #1#2#3 { \prop_gput:cnn { g__exsheets_question_property_#2_prop } - { #1 } { #3 } + {#1} {#3} } % #1: property @@ -1568,7 +1578,7 @@ \cs_new_protected:Npn \__exsheets_question_set_property:nn #1#2 { \prop_gput:cVn { g__exsheets_question_property_#1_prop } - \CurrentQuestionID { #2 } + \CurrentQuestionID {#2} % watch if this has negativ effects: \exsheets_write_to_aux_x:n { @@ -1582,12 +1592,12 @@ % #1: property % #2: ID \DeclareExpandableDocumentCommand \GetQuestionProperty { mm } - { \exsheets_get_question_property:no { #1 } { #2 } } + { \exsheets_get_question_property:no {#1} {#2} } \cs_new:Npn \exsheets_get_question_property:nn #1#2 { - \prop_if_in:cnTF { g__exsheets_question_property_#1_prop } { #2 } - { \prop_get:cn { 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 } @@ -1632,7 +1642,7 @@ \group_begin: \normalfont\normalsize\normalcolor \colorbox { exsheetsdebugcolor } - { \parbox { \dim_eval:n { #1 - 2 \fboxsep } } { #2 } } + { \parbox { \dim_eval:n { #1 - 2 \fboxsep } } {#2} } \group_end: \par } @@ -1690,7 +1700,7 @@ \int_zero:N \l__exsheets_include_random_int \cs_new:Npn \exsheets_file_input_if_exist:n #1 - { \file_if_exist:nT { #1 } { \file_input:n { #1 } } } + { \file_if_exist:nT {#1} { \file_input:n {#1} } } \cs_new_protected:Npn \exsheets_prop_count:N #1 { @@ -1708,9 +1718,9 @@ \NewDocumentCommand \includequestions { om } { \group_begin: - \IfNoValueF { #1 } - { \keys_set:nn { exsheets / include } { #1 } } - \exsheets_include_questions:n { #2 } + \IfNoValueF {#1} + { \keys_set:nn { exsheets / include } {#1} } + \exsheets_include_questions:n {#2} \group_end: } @@ -1721,7 +1731,7 @@ { \bool_set_true:N \l__exsheets_select_questions_bool \clist_gclear:N \questionsincludedlast - \seq_set_split:Nnn \l__exsheets_tmpa_seq { , } { #1 } + \seq_set_split:Nnn \l__exsheets_tmpa_seq { , } {#1} \seq_map_inline:Nn \l__exsheets_tmpa_seq { \bool_set_true:N \l__exsheets_questions_deactivate_bool @@ -1776,7 +1786,7 @@ \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 } , + \clist_set:Nn \l__exsheets_include_id_clist {#1} , % 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: @@ -1785,7 +1795,7 @@ \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} } \int_new:N \g__exsheets_selection_number_int @@ -1802,11 +1812,11 @@ \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 } + { \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_use:N \g__exsheets_questions_id_int } {#1} } } } @@ -1841,44 +1851,44 @@ {% parsing list of excluded IDs \clist_if_in:NnTF \l__exsheets_exclude_id_clist - { #1 } + {#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 } + \clist_gput_right:Nn \questionsincludedlast {#1} \int_gincr:N \g__exsheets_questions_used_int \__exsheets_mark_as_used_x:nn { \int_use:N \g__exsheets_questions_used_int } - { #1 } + {#1} % \prop_gput:NnV \g__exsheets_questions_used_prop - % { #1 } + % {#1} % \g__exsheets_questions_id_int \prop_gput:NnV \g__exsheets_questions_id_prop - { #1 } + {#1} \g__exsheets_questions_id_int } } {% parsing list of included IDs \clist_if_in:NnTF \l__exsheets_include_id_clist - { #1 } + {#1} { \clist_if_in:NnTF \l__exsheets_exclude_id_clist - { #1 } + {#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 } + \clist_gput_right:Nn \questionsincludedlast {#1} % \prop_gput:NnV \g__exsheets_questions_used_prop - % { #1 } + % {#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 } + {#1} \prop_gput:NnV \g__exsheets_questions_id_prop - { #1 } + {#1} \g__exsheets_questions_id_int } } @@ -1921,9 +1931,9 @@ \int_compare:nTF { \l__exsheets_include_random_int >= \l__exsheets_tmpa_int } { % not enough questions available: - \msg_warning:nnxxx { exsheets } { random-file } + \msg_warning:nnxxx {exsheets} {random-file} { \int_use:N \l__exsheets_include_random_int } - { #1 } + {#1} { \int_use:N \l__exsheets_tmpa_int } \bool_set_true:N \l__exsheets_include_all_bool } @@ -1937,9 +1947,9 @@ } { % not enough questions selectable: - \msg_warning:nnxxxx { exsheets } { random-selectable } + \msg_warning:nnxxxx {exsheets} {random-selectable} { \int_use:N \l__exsheets_include_random_int } - { #1 } + {#1} { \int_use:N \l__exsheets_tmpa_int } { \int_use:N \l__exsheets_tmpb_int } \bool_set_true:N \l__exsheets_include_all_bool @@ -1989,7 +1999,7 @@ } \NewDocumentCommand \PrintIfIncludeActiveTF { mm } - { \bool_if:NTF \l__exsheets_questions_deactivate_bool { #2 } { #1 } } + { \bool_if:NTF \l__exsheets_questions_deactivate_bool {#2} {#1} } \NewDocumentCommand \PrintIfIncludeActiveT { } { \bool_if:NF \l__exsheets_questions_deactivate_bool } @@ -2027,7 +2037,7 @@ { \int_set_eq:NN \l__exsheets_tmpe_int \g__exsheets_questions_id_int } \prop_gput:Nxn \g__exsheets_solutions_content_prop { \int_use:N \g__exsheets_questions_id_int } - { #1 } + {#1} \prop_gput:NxV \g__exsheets_solutions_questions_id_prop { \int_use:N \g__exsheets_questions_id_int } \g__exsheets_questions_current_id_tl @@ -2046,7 +2056,7 @@ \l__exsheets_qu_counter_interpretation_tl \l__exsheets_solutions_name_tl \g__exsheets_questions_current_id_tl - \use:n { #1 } + \use:n {#1} \exsheets_h_or_vspace:N \l__exsheets_solutions_skip_below_dim } } @@ -2093,7 +2103,7 @@ \bool_if:NT \l__exsheets_solutions_use_bool { \bool_set_true:N \l__exsheets_inside_solution_bool - \IfNoValueF { #1 } { \keys_set:nn { exsheets / solution } { #1 } } + \IfNoValueF {#1} { \keys_set:nn { exsheets / solution } {#1} } % \tl_use:N \l__exsheets_solutions_pre_hook_tl } \tl_if_blank:VT \l__exsheets_solution_heading_instance_tl @@ -2123,7 +2133,7 @@ } \exsheets_use_heading:Vnnnnn \l__exsheets_solution_heading_instance_tl - { #2 } { #1 } { 0 } { 0 } { #3 } + {#2} {#1} { 0 } { 0 } {#3} } \cs_generate_variant:Nn \__exsheets_solutions_name:nnn { VV , VVV } @@ -2163,14 +2173,14 @@ { \cs_new_eq:NN \__exsheets_saved_label:n \label \cs_set:Npn \label #1 - { \__exsheets_saved_label:n { #1 } \__exsheets_exlabel:n { #1 } } + { \__exsheets_saved_label:n {#1} \__exsheets_exlabel:n {#1} } } % this is like \ref from latex.ltx \cs_new:Npn \__exsheets_exref:n #1 { \cs_if_exist:cTF { r@#1 } - { \__exsheets_exref_aux:n { #1 } } + { \__exsheets_exref_aux:n {#1} } { 1\relax \protect\G@refundefinedtrue @@ -2185,7 +2195,7 @@ % user command: \NewDocumentCommand \printsolutions { O{all} } - { \exsheets_print_solutions:n { #1 } } + { \exsheets_print_solutions:n {#1} } % internal command: \cs_new_protected:Npn \exsheets_print_solutions:n #1 @@ -2195,21 +2205,21 @@ \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 } + \keys_set:nn { exsheets / exsheets_print_solutions } {#1} \group_end: } -\keys_define:nn { exsheets } +\keys_define:nn {exsheets} { exsheets_print_solutions .choice: , exsheets_print_solutions / section .code:n = - { \exsheets_print_solutions_section:n { #1 } } , + { \exsheets_print_solutions_section:n {#1} } , exsheets_print_solutions / chapter .code:n = - { \exsheets_print_solutions_chapter:n { #1 } } , + { \exsheets_print_solutions_chapter:n {#1} } , 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 } @@ -2230,16 +2240,16 @@ \cs_new_protected:Npn \__exsheets_print_solution_if:nn #1#2 { - \bool_if:nT { #2 } + \bool_if:nT {#2} { \prop_get:NnN \g__exsheets_solutions_names_prop - { #1 } \l__exsheets_tmpa_tl + {#1} \l__exsheets_tmpa_tl \prop_get:NnN \g__exsheets_solutions_content_prop - { #1 } \l__exsheets_tmpb_tl + {#1} \l__exsheets_tmpb_tl \prop_get:NnN \g__exsheets_solutions_questions_id_prop - { #1 } \l__exsheets_tmpc_tl + {#1} \l__exsheets_tmpc_tl \prop_get:NnN \g__exsheets_solutions_counter_prop - { #1 } \l__exsheets_tmpd_tl + {#1} \l__exsheets_tmpd_tl \eSaveCounterPatternFrom [ exsheets ] \l__exsheets_current_pattern_interpretation_tl \l__exsheets_current_pattern_tl @@ -2256,7 +2266,7 @@ % print by section: \cs_new:Npn \exsheets_print_solutions_section:n #1 { - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { \prop_map_inline:Nn \g__exsheets_question_number_prop { @@ -2268,7 +2278,7 @@ } } { - \clist_map_inline:nn { #1 } + \clist_map_inline:nn {#1} { \__exsheets_print_solutions_by_section:w ##1-- \q_stop } } } @@ -2276,12 +2286,12 @@ \cs_new_protected:Npn \__exsheets_print_solutions_by_section:w #1-#2-#3 \q_stop { % wenn #3=-, dann range-Input - \tl_if_eq:nnTF { #3 } { - } + \tl_if_eq:nnTF {#3} { - } { \int_zero:N \l__exsheets_tmpa_int \int_set_eq:NN \l__exsheets_tmpb_int \c_ten_thousand - \tl_if_blank:nF { #1 } { \int_set:Nn \l__exsheets_tmpa_int { #1 } } - \tl_if_blank:nF { #2 } { \int_set:Nn \l__exsheets_tmpb_int { #2 } } + \tl_if_blank:nF {#1} { \int_set:Nn \l__exsheets_tmpa_int {#1} } + \tl_if_blank:nF {#2} { \int_set:Nn \l__exsheets_tmpb_int {#2} } \int_do_while:nn { \l__exsheets_tmpa_int <= \l__exsheets_tmpb_int } { \prop_map_inline:Nn \g__exsheets_question_number_prop @@ -2299,7 +2309,7 @@ \prop_map_inline:Nn \g__exsheets_question_number_prop { \prop_if_in:NnT \g__exsheets_solutions_names_prop { ##1 } - { \__exsheets_print_solutions_section:nnn { ##1 } { ##2 } { #1 } } + { \__exsheets_print_solutions_section:nnn { ##1 } { ##2 } {#1} } } } } @@ -2307,14 +2317,14 @@ \cs_new:Npn \__exsheets_print_solutions_section:nnn #1#2#3 { \__exsheets_read_number:w #2 \q_stop - \__exsheets_print_solution_if:nn { #1 } + \__exsheets_print_solution_if:nn {#1} { \int_compare_p:n { \l__exsheets_counter_sec_int = #3 } } } % print by chapter: \cs_new:Npn \exsheets_print_solutions_chapter:n #1 { - \tl_if_blank:nTF { #1 } + \tl_if_blank:nTF {#1} { \prop_map_inline:Nn \g__exsheets_question_number_prop { @@ -2326,7 +2336,7 @@ } } { - \clist_map_inline:nn { #1 } + \clist_map_inline:nn {#1} { \__exsheets_print_solutions_by_chapter:w ##1-- \q_stop } } } @@ -2334,12 +2344,12 @@ \cs_new_protected:Npn \__exsheets_print_solutions_by_chapter:w #1-#2-#3 \q_stop { % wenn #3=-, dann range-Input - \tl_if_eq:nnTF { #3 } { - } + \tl_if_eq:nnTF {#3} { - } { \int_zero:N \l__exsheets_tmpa_int \int_set_eq:NN \l__exsheets_tmpb_int \c_ten_thousand - \tl_if_blank:nF { #1 } { \int_set:Nn \l__exsheets_tmpa_int { #1 } } - \tl_if_blank:nF { #2 } { \int_set:Nn \l__exsheets_tmpb_int { #2 } } + \tl_if_blank:nF {#1} { \int_set:Nn \l__exsheets_tmpa_int {#1} } + \tl_if_blank:nF {#2} { \int_set:Nn \l__exsheets_tmpb_int {#2} } \int_do_while:nn { \l__exsheets_tmpa_int <= \l__exsheets_tmpb_int } { \prop_map_inline:Nn \g__exsheets_question_number_prop @@ -2357,7 +2367,7 @@ \prop_map_inline:Nn \g__exsheets_question_number_prop { \prop_if_in:NnT \g__exsheets_solutions_names_prop { ##1 } - { \__exsheets_print_solutions_chapter:nnn { ##1 } { ##2 } { #1 } } + { \__exsheets_print_solutions_chapter:nnn { ##1 } { ##2 } {#1} } } } } @@ -2365,7 +2375,7 @@ \cs_new:Npn \__exsheets_print_solutions_chapter:nnn #1#2#3 { \__exsheets_read_number:w #2 \q_stop - \__exsheets_print_solution_if:nn { #1 } + \__exsheets_print_solution_if:nn {#1} { \int_compare_p:n { \l__exsheets_counter_ch_int = #3 } } } @@ -2389,7 +2399,7 @@ !\int_compare_p:n { \use:c { l__exsheets_counter_#1_int } = 0 } } - { #2 } + {#2} } \cs_generate_variant:Nn \__exsheets_sectioning_hook:nn { nV } @@ -2403,15 +2413,15 @@ \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 + {#1} \l__exsheets_tmpa_tl { \tl_set_eq:NN \l__exsheets_solutions_name_tl \l__exsheets_tmpa_tl \prop_get:NnN \g__exsheets_solutions_content_prop - { #1 } \l__exsheets_tmpb_tl + {#1} \l__exsheets_tmpb_tl \prop_get:NnN \g__exsheets_solutions_questions_id_prop - { #1 } \l__exsheets_tmpc_tl + {#1} \l__exsheets_tmpc_tl \prop_get:NnN \g__exsheets_solutions_counter_prop - { #1 } \l__exsheets_tmpd_tl + {#1} \l__exsheets_tmpd_tl \group_begin: \tl_set_eq:NN \CurrentQuestionID \l__exsheets_tmpc_tl \__exsheets_sectioning_hook:nV { ch } @@ -2436,7 +2446,7 @@ \seq_new:N \l__exsheets_solutions_byID_seq \cs_new_protected:Npn \exsheets_print_solutions_byID:n #1 { - \seq_set_split:Nnn \l__exsheets_solutions_byID_seq { , } { #1 } + \seq_set_split:Nnn \l__exsheets_solutions_byID_seq { , } {#1} \seq_clear:N \l__exsheets_tmpa_seq \seq_map_inline:Nn \l__exsheets_solutions_byID_seq { @@ -2491,22 +2501,22 @@ \int_zero:N \l__exsheets_counter_ch_int \int_zero:N \l__exsheets_counter_sec_int \int_zero:N \l__exsheets_counter_qu_int - \tl_if_in:nnF { #1 } { @@@ } + \tl_if_in:nnF {#1} { @@@ } { - \tl_if_blank:nF { #1 } - { \int_set:Nn \l__exsheets_counter_ch_int { #1 } } + \tl_if_blank:nF {#1} + { \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 } + \int_set:Nn \l__exsheets_counter_sec_int {#2} + \int_set:Nn \l__exsheets_counter_qu_int {#3} } \cs_new_protected_nopar:Npn \exsheets_solutions_print_name:nnn #1#2#3 { \tl_set_rescan:Nnn \l__exsheets_tmpa_tl - { \char_set_catcode_letter:N \@ } { #1 } - \tl_if_in:nnTF { #1 } { @@@ } - { \__exsheets_solutions_name:nnn { } { #2 } { #3 } } - { \__exsheets_solutions_name:nnn { #1 } { #2 } { #3 } } + { \char_set_catcode_letter:N \@ } {#1} + \tl_if_in:nnTF {#1} { @@@ } + { \__exsheets_solutions_name:nnn { } {#2} {#3} } + { \__exsheets_solutions_name:nnn {#1} { #2 } {#3} } \tex_penalty:D \c_ten_thousand } \cs_generate_variant:Nn \exsheets_solutions_print_name:nnn { VVV } @@ -2549,43 +2559,42 @@ % create question/solution pairs \cs_new_protected:Npn \__exsheets_new_qu_sol_pair:nnnnnn #1#2#3#4#5#6 { - \NewDocumentEnvironment { #1 } { O{}G{} } - { \keys_set:nn { exsheets } { #3 } \__exsheets_question: {#2,##1} {##2} } + \NewDocumentEnvironment {#1} { O{}G{} } + { \keys_set:nn {exsheets} {#3} \__exsheets_question: {#2,##1} {##2} } { \end__exsheets_question: } - \NewDocumentEnvironment { #4 } { O{} } - { \keys_set:nn { exsheets } { #6 } \__exsheets_solution: {#5,##1} } + \NewDocumentEnvironment {#4} { O{} } + { \keys_set:nn {exsheets} {#6} \__exsheets_solution: {#5,##1} } { \end__exsheets_solution: } } \cs_new_protected:Npn \__exsheets_renew_qu_sol_pair:nnnnnn #1#2#3#4#5#6 { - \RenewDocumentEnvironment { #1 } { O{}G{} } - { \keys_set:nn { exsheets } { #3 } \__exsheets_question: {#2,##1} {##2} } + \RenewDocumentEnvironment {#1} { O{}G{} } + { \keys_set:nn {exsheets} {#3} \__exsheets_question: {#2,##1} {##2} } { \end__exsheets_question: } - \RenewDocumentEnvironment { #4 } { O{} } - { \keys_set:nn { exsheets } { #6 } \__exsheets_solution: {#5,##1} } + \RenewDocumentEnvironment {#4} { O{} } + { \keys_set:nn {exsheets} {#6} \__exsheets_solution: {#5,##1} } { \end__exsheets_solution: } } \NewDocumentCommand \NewQuSolPair { mO{}O{}mO{}O{} } - { \__exsheets_new_qu_sol_pair:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } } + { \__exsheets_new_qu_sol_pair:nnnnnn {#1} {#2} {#3} {#4} {#5} {#6} } \@onlypreamble \NewQuSolPair \NewDocumentCommand \RenewQuSolPair { mO{}O{}mO{}O{} } - { \__exsheets_renew_qu_sol_pair:nnnnnn { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } } + { \__exsheets_renew_qu_sol_pair:nnnnnn {#1} {#2} {#3} {#4} {#5} {#6} } \@onlypreamble \RenewQuSolPair % ---------------------------------------------------------------------------- % the `tasks' list -\bool_if:NTF \l__exsheets_load_tasks_bool - { \RequirePackage [ more ] { tasks } } - { \RequirePackage { tasks } } -\AddCounterPattern* [ tasks ] { question } { qu } -\ReadCounterFrom [ tasks ] { question } \l__exsheets_counter_qu_int +\RequirePackage {tasks} [2014/07/03] +\AddCounterPattern* [tasks] {question} {qu} +\ReadCounterFrom [tasks] {question} \l__exsheets_counter_qu_int % ---------------------------------------------------------------------------- % the \blank{<words>} command -\RequirePackage { ulem } \normalem +\RequirePackage {ulem} \normalem + \dim_new:N \l__exsheets_blank_dim \tl_new:N \l__exsheets_blank_linespread_tl \tl_set:Nn \l__exsheets_blank_linespread_tl { 1 } @@ -2595,7 +2604,7 @@ \bool_new:N \l__exsheets_blank_width_bool \bool_new:N \l__exsheets_blank_linespread_bool -\cs_new:Npn \exsheets_write_blank:n #1 { #1 } +\cs_new:Npn \exsheets_write_blank:n #1 {#1} \cs_set_eq:NN \exsheets_write_blank:n \uline \keys_define:nn { exsheets / blank } @@ -2615,29 +2624,29 @@ width .code:n = { \bool_set_true:N \l__exsheets_blank_width_bool - \dim_set:Nn \l__exsheets_blank_dim { #1 } + \dim_set:Nn \l__exsheets_blank_dim {#1} } , 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} } \NewDocumentCommand \blank { som } { \group_begin: - \IfNoValueF { #2 } { \keys_set:nn { exsheets / blank } { #2 } } + \IfNoValueF {#2} { \keys_set:nn { exsheets / blank } {#2} } \mode_if_vertical:TF { - \IfBooleanF { #1 } { \noindent } - \exsheets_blank:n { #3 } - \IfBooleanF { #1 } + \IfBooleanF {#1} { \noindent } + \exsheets_blank:n {#3} + \IfBooleanF {#1} { \bool_if:NT \l__exsheets_blank_linespread_bool { \linespread { \l__exsheets_blank_linespread_tl } \selectfont } \par } } - { \exsheets_blank:n { #3 } } + { \exsheets_blank:n {#3} } \group_end: } @@ -2646,9 +2655,9 @@ \box_clear:N \l__exsheets_blank_box \mode_if_math:TF { \hbox_set:Nn \l__exsheets_blank_box { $ \m@th \mathpalette{}{#1} $ } } - { \hbox_set:Nn \l__exsheets_blank_box { #1 } } + { \hbox_set:Nn \l__exsheets_blank_box {#1} } \bool_if:NTF \l__exsheets_inside_solution_bool - { \exsheets_write_blank:n { #1 } } + { \exsheets_write_blank:n {#1} } { \bool_if:NTF \l__exsheets_blank_width_bool { \__exsheets_blank_skip:N \l__exsheets_blank_dim } @@ -2662,10 +2671,10 @@ \cs_new_protected:Npn \__exsheets_blank_skip:N #1 { \bool_if:NTF \l__exsheets_blank_width_bool - { \dim_set:Nn \l__exsheets_tmpa_dim { #1 } } + { \dim_set:Nn \l__exsheets_tmpa_dim {#1} } { \fp_set:Nn \l__exsheets_tmpa_fp - { \dim_to_fp:n { #1 } * \l__exsheets_blank_scale_tl } + { \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 } @@ -2725,13 +2734,13 @@ { \par \tex_penalty:D -100 \scan_stop: - \dim_set:Nn \l__exsheets_tmpa_dim { #2 } + \dim_set:Nn \l__exsheets_tmpa_dim {#2} \dim_set:Nn \l__exsheets_tmpb_dim { \pagegoal - \pagetotal - \baselineskip } \dim_compare:nTF { \l__exsheets_tmpa_dim > \l__exsheets_tmpb_dim } { \dim_compare:nT { \l__exsheets_tmpb_dim > 0pt } { \vfil } \break - \IfBooleanF { #1 } + \IfBooleanF {#1} { \dim_sub:Nn \l__exsheets_tmpa_dim { \l__exsheets_tmpb_dim } \vspace* { \l__exsheets_tmpa_dim } @@ -2740,15 +2749,15 @@ { \skip_vertical:N \l__exsheets_tmpa_dim } } \NewDocumentCommand \examspace { sm } - { \__exsheets_examspace:nn { #1 } { #2 } } + { \__exsheets_examspace:nn {#1} {#2} } % ---------------------------------------------------------------------------- % SETUP \NewDocumentCommand \SetupExSheets { o +m } { - \IfNoValueTF { #1 } - { \keys_set:nn { exsheets } { #2 } } - { \keys_set:nn { exsheets / #1 } { #2 } } + \IfNoValueTF {#1} + { \keys_set:nn {exsheets} {#2} } + { \keys_set:nn { exsheets / #1 } {#2} } } % ---------------------------------------------------------------------------- @@ -2852,12 +2861,12 @@ % ---------------------------------------------------------------------------- % load custom configuration -\file_if_exist:nT { exsheets_configurations.cfg } +\file_if_exist:nT {exsheets_configurations.cfg} { \AtBeginDocument { - \msg_info:nn { exsheets } { loading-configurations } - \file_input:n { exsheets_configurations.cfg } + \msg_info:nn {exsheets} {loading-configurations} + \file_input:n {exsheets_configurations.cfg} } } @@ -3055,6 +3064,12 @@ HISTORY: - \ForEachQuestion, \numberofquestions and \iflastquestion are now available before any questions have been typeset +2014/07/20 v0.15 - remove `tasks' from the bundle and into a package of + its own + - remove `cntformats' from the bundle and into a package of + its own + - drop options `load-headings' and `load-tasks' + - new command \IfQuestionPropertyTF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg index 19f8ebfc137..058ac8f46e7 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg @@ -29,6 +29,8 @@ \ProvidesFile{exsheets_headings.cfg} [\exsheets@date\space v\exsheets@version\space ExSheets headings instances] +\cs_new:Npn \exsheets_headings_files_loaded: {} + % EMPTY: \DeclareInstance { exsheets-heading } { empty } { default } { diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def index 770f8593248..83fe81bf4d1 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def @@ -378,7 +378,7 @@ \bool_if:nT { \l__exsheets_questions_totoc_bool && \l__exsheets_inside_question_bool } { - \phantomsection + \use:c {phantomsection} \addcontentsline { toc } { \l__exsheets_questions_toclevel_tl } { \bool_if:NTF \l__exsheets_heading_toc_reversed_bool @@ -389,7 +389,7 @@ \bool_if:nT { \l__exsheets_solutions_totoc_bool && !\l__exsheets_inside_question_bool } { - \phantomsection + \use:c {phantomsection} \addcontentsline { toc } { \l__exsheets_solutions_toclevel_tl } { \bool_if:NTF \l__exsheets_heading_toc_reversed_bool diff --git a/Master/texmf-dist/tex/latex/exsheets/tasks.cfg b/Master/texmf-dist/tex/latex/exsheets/tasks.cfg deleted file mode 100644 index 5ac789f91d0..00000000000 --- a/Master/texmf-dist/tex/latex/exsheets/tasks.cfg +++ /dev/null @@ -1,55 +0,0 @@ -% -------------------------------------------------------------------------- -% the TASKS package -% -% Horizontal columned lists. -% -% -------------------------------------------------------------------------- -% Clemens Niederberger -% Web: https://bitbucket.org/cgnieder/exsheets/ -% E-Mail: contact@mychemistry.eu -% -------------------------------------------------------------------------- -% Copyright 2011-2013 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. -% -------------------------------------------------------------------------- -% The tasks package consists of the files -% - tasks.sty, tasks.cfg -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- -% further instances for the `tasks' environment -\ProvidesFile{tasks.cfg} - [\@tasks@date\space v\@tasks@version\space tasks instances] - -\cs_new:Npn \tasks_config_file_loaded: {} - -% ITEMIZE: -\DeclareInstance { tasks } { itemize } { default } - { - enumerate = false , - label-width = 1.125em - } - -% ENUMERATE: -\DeclareInstance { tasks } { enumerate } { default } - { counter-format = tsk. } - -% MULTIPLECHOICE -\DeclareInstance { tasks } { multiplechoice } { default } - { - enumerate = false , - label = \choicebox - } - -\tex_endinput:D
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/exsheets/tasks.sty b/Master/texmf-dist/tex/latex/exsheets/tasks.sty deleted file mode 100644 index 8985933e0ad..00000000000 --- a/Master/texmf-dist/tex/latex/exsheets/tasks.sty +++ /dev/null @@ -1,601 +0,0 @@ -% -------------------------------------------------------------------------- -% the TASKS package -% -% Horizontal columned lists. -% -% -------------------------------------------------------------------------- -% Clemens Niederberger -% Web: https://bitbucket.org/cgnieder/exsheets/ -% E-Mail: contact@mychemistry.eu -% -------------------------------------------------------------------------- -% 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 -% 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. -% -------------------------------------------------------------------------- -% The tasks package consists of the files -% - tasks.sty, tasks.cfg -% -------------------------------------------------------------------------- -% If you have any ideas, questions, suggestions or bugs to report, please -% feel free to contact me. -% -------------------------------------------------------------------------- -\def\@tasks@date{2014/05/11} -\def\@tasks@version{0.9c} - -\RequirePackage { expl3 , xparse , l3keys2e } -\ProvidesExplPackage - {tasks} - {\@tasks@date} - {\@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 - -\int_new:N \l__tasks_depth_int -\int_new:N \g__tasks_int -\int_new:N \g__tasks_total_items_int -\int_new:N \l__tasks_columns_int -\int_new:N \l__tasks_rows_int - -\bool_new:N \l__tasks_enumerate_bool -\bool_new:N \l__tasks_resume_bool -\bool_new:N \l__tasks_load_tasks_bool -\bool_new:N \l__tasks_label_width_bool -\bool_new:N \l__tasks_item_indent_bool -\bool_new:N \l__tasks_label_offset_bool -\bool_new:N \l__tasks_custom_label_bool -\bool_new:N \l__tasks_custom_after_item_skip_bool - -\tl_new:N \l__tasks_instance_tl -\tl_new:N \l__tasks_label_tl -\tl_new:N \l__tasks_custom_label_tl -\tl_new:N \l__tasks_label_pattern_tl -\tl_new:N \l__tasks_custom_label_pattern_tl -\tl_new:N \l__tasks_label_format_tl -\tl_new:N \l__tasks_custom_label_format_tl -\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 \l__tasks_item_tl -\tl_new:N \l__tasks_tmp_label_tl - -\dim_new:N \l__tasks_item_indent_dim -\dim_new:N \l__tasks_item_default_indent_dim -\dim_new:N \l__tasks_item_width_dim -\dim_new:N \l__tasks_label_width_dim -\dim_new:N \l__tasks_label_default_width_dim -\dim_new:N \l__tasks_label_offset_dim -\dim_new:N \l__tasks_label_default_offset_dim - -\skip_new:N \l__tasks_after_item_skip -\skip_new:N \l__tasks_custom_after_item_skip -\skip_new:N \l__tasks_before_list_skip -\skip_new:N \l__tasks_after_list_skip - -\NewCounterPattern* [ tasks ] { task } { tsk } -\ReadCounterFrom [ tasks ] { task } \g__tasks_int - -% temporary variables: -\tl_new:N \l__tasks_tmpa_tl -\int_new:N \g__tasks_tmpa_int -\int_new:N \l__tasks_tmpb_int -\coffin_new:N \l__tasks_tmpa_coffin -\coffin_new:N \l__tasks_tmpb_coffin -\coffin_new:N \l__tasks_tmpc_coffin - -\cs_new_eq:NN \__tasks_debug:n \use:n - -% -------------------------------------------------------------------------- -% collect the tasks: -\cs_new_protected:Npn \__tasks_collect_tasks:nw #1#2 \end #3 - { - \tl_put_right:Nn \l__tasks_body_tl { #1 } - \end { #3 } - \tl_if_eq:nnF { #1 } { #3 } - { \__tasks_collect_tasks:nw { #1 } } - } - -% #1: instance -% #2: number of columns -% #3: item separator -% #4: environment body -\cs_new_protected:Npn \__tasks:nnnn #1#2#3#4 - { - \seq_set_split:Nnn \l__tasks_seq { #3 } { #4 } - % remove the first (empty) item: - \seq_pop_left:NN \l__tasks_seq \l__tasks_tmpa_tl - \tl_if_blank:VF \l__tasks_tmpa_tl - { \tl_show:N \l__tasks_tmpa_tl \@noitemerr } - \int_gset:Nn \g__tasks_total_items_int - { \seq_count:N \l__tasks_seq } - \UseInstance { tasks } { #1 } - { \g__tasks_total_items_int } - { #2 } - { \l__tasks_custom_label_pattern_tl } - % just to be sure: - \seq_clear:N \l__tasks_seq - } -\cs_generate_variant:Nn \__tasks:nnnn { VnnV } - -\cs_new_protected:Npn \__tasks_task:nnw #1#2[#3,#4][#5,#6](#7,#8) - { - \dim_set:Nn \l__tasks_item_width_dim - { - \linewidth / \l__tasks_columns_int - - \l__tasks_depth_int \l__tasks_item_indent_dim - } - \int_gincr:N \g__tasks_tmpa_int - \__tasks_gset_rows_num:NN - \g__tasks_total_items_int - \l__tasks_columns_int - \int_compare:nT { \g__tasks_tmpa_int > \l__tasks_columns_int } - { - \int_gset:Nn \g__tasks_tmpa_int { 1 } - \int_incr:N \l__tasks_tmpb_int - } - % the item: - \hcoffin_set:Nn \l__tasks_tmpa_coffin - { - \vcoffin_set:Nnn \l__tasks_tmpc_coffin - { \l__tasks_item_width_dim } - { \__tasks_setup: #2 } - \coffin_typeset:Nnnnn \l__tasks_tmpc_coffin - { l } { T } { 0pt } { 0pt } - } - % the label: - \hcoffin_set:Nn \l__tasks_tmpb_coffin - { - \vcoffin_set:Nnn \l__tasks_tmpc_coffin - { \l__tasks_label_width_dim } - { - \noindent - \tl_use:N \l__tasks_item_fill_left_tl - \strut #1 - \tl_use:N \l__tasks_item_fill_right_tl - } - \__tasks_debug:n - { - \coffin_typeset:Nnnnn \l__tasks_tmpc_coffin - { l } { T } { 0pt } { 0pt } - } - } - \coffin_attach:NnnNnnnn - \l__tasks_tmpa_coffin { l } { T } - \l__tasks_tmpb_coffin { l } { T } - { - \l__tasks_label_width_dim - \l__tasks_label_offset_dim } { 0pt } - % typeset label & item: - % need this when a new row starts: - \int_compare:nT { \g__tasks_tmpa_int = 1 } - { \skip_vertical:N \c_zero_skip } - \noindent - \skip_horizontal:N \l__tasks_item_indent_dim - \__tasks_debug:n - { - \coffin_typeset:Nnnnn \l__tasks_tmpa_coffin - { l } { T } { 0pt } { 0pt } - } - % need this before a new row starts: - \bool_if:nT - { - ( \int_compare_p:n { \g__tasks_tmpa_int = \l__tasks_columns_int } ) - && - ( \int_compare_p:n { \l__tasks_tmpb_int != \l__tasks_rows_int } ) - } - { \skip_vertical:N \l__tasks_after_item_skip } - \coffin_clear:N \l__tasks_tmpa_coffin - \coffin_clear:N \l__tasks_tmpb_coffin - \coffin_clear:N \l__tasks_tmpc_coffin - } -\cs_generate_variant:Nn \__tasks_task:nnw { VV } - -\cs_new_protected:Npn \__tasks_setup: - { - \dim_set:Nn \parskip { 0pt } - \skip_set:Nn \parfillskip { 0pt plus 1fil } - \dim_set_eq:NN \parskip \parsep - \dim_set_eq:NN \parindent \listparindent - \noindent - \strut - } - -\cs_new_protected:Npn \__tasks_gset_rows_num:NN #1#2 - { - \int_gset:Nn \l__tasks_rows_int { \int_div_truncate:nn { #1 } { #2 } } - \int_compare:nNnT { \int_mod:nn { #1 } { #2 } } > { 0 } - { \int_gincr:N \l__tasks_rows_int } - } - -\cs_new_protected:Npn \__tasks_label_align:n #1 - { - \clist_if_in:nnTF { left , center , right } { #1 } - { - \tl_if_eq:nnT { #1 } { left } - { - \tl_clear:N \l__tasks_item_fill_left_tl - \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfill - } - \tl_if_eq:nnT { #1 } { right } - { - \tl_set_eq:NN \l__tasks_item_fill_left_tl \hfill - \tl_clear:N \l__tasks_item_fill_right_tl - } - \tl_if_eq:nnT { #1 } { center } - { - \tl_set_eq:NN \l__tasks_item_fill_left_tl \hfill - \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfill - } - } - { - \tl_clear:N \l__tasks_item_fill_left_tl - \tl_set_eq:NN \l__tasks_item_fill_right_tl \hfill - } - } -\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 -% #3: label-format -\DeclareObjectType { tasks } { 3 } -% the `default' template interface: -\DeclareTemplateInterface { tasks } { default } { 3 } - { - enumerate : boolean = true , - label : tokenlist , - indent : length = 2.5em , - counter-format : tokenlist = tsk[a]) , - label-format : tokenlist , - label-width : length = 1em , - label-offset : length = .3333em , - after-item-skip : skip = 1ex plus 1ex minus 1ex - } - -% in the next three commands we want a really unlikely to occurr marker; for -% this we use $ with unusual catcode in ``$tasks$default$label$'': -\char_set_catcode_alignment:N \$ - -% the `default' template code: -\DeclareTemplateCode { tasks } { default } { 3 } - { - enumerate = \l__tasks_enumerate_bool , - label = \l__tasks_label_tl , - indent = \l__tasks_item_default_indent_dim , - counter-format = \l__tasks_label_pattern_tl , - label-format = \l__tasks_label_format_tl , - label-width = \l__tasks_label_default_width_dim , - label-offset = \l__tasks_label_default_offset_dim , - after-item-skip = \l__tasks_after_item_skip - } - { - \AssignTemplateKeys - \bool_if:NF \l__tasks_label_width_bool - { - \dim_set_eq:NN - \l__tasks_label_width_dim - \l__tasks_label_default_width_dim - } - \bool_if:NF \l__tasks_item_indent_bool - { - \dim_set_eq:NN - \l__tasks_item_indent_dim - \l__tasks_item_default_indent_dim - } - \bool_if:NF \l__tasks_label_offset_bool - { - \dim_set_eq:NN - \l__tasks_label_offset_dim - \l__tasks_label_default_offset_dim - } - \bool_if:NT \l__tasks_custom_after_item_skip_bool - { - \skip_set_eq:NN - \l__tasks_after_item_skip - \l__tasks_custom_after_item_skip - } - \bool_if:NT \l__tasks_custom_label_bool - { - \tl_set_eq:NN - \l__tasks_label_tl - \l__tasks_custom_label_tl - \bool_set_false:N \l__tasks_enumerate_bool - } - \__tasks_label_align:V \l__tasks_label_align_tl - % need this for enumerate list: - \bool_if:nT { !\l__tasks_resume_bool && \l__tasks_enumerate_bool } - { \int_gzero:N \g__tasks_int } - \int_set:Nn \l__tasks_columns_int { #2 } - % set all the items in their own coffins and join with the ground: - \int_gzero:N \g__tasks_tmpa_int - \int_set:Nn \l__tasks_tmpb_int { 1 } - \tl_if_blank:VF \l__tasks_custom_label_pattern_tl - { - \tl_set_eq:NN - \l__tasks_label_pattern_tl - \l__tasks_custom_label_pattern_tl - } - \tl_if_blank:VF \l__tasks_custom_label_format_tl - { - \tl_set_eq:NN - \l__tasks_label_format_tl - \l__tasks_custom_label_format_tl - } - \seq_map_inline:Nn \l__tasks_seq - { - \__tasks_read_item:w ##1 \q_stop - \bool_if:NTF \l__tasks_enumerate_bool - { - \tl_if_eq:VnT \l__tasks_tmp_label_tl { $tasks$default$label$ } - { - \int_gincr:N \g__tasks_int - \SaveCounterPatternFrom [ tasks ] - \l__tasks_tmpa_tl - \l__tasks_label_tl - \l__tasks_label_pattern_tl - \cs_gset:Npx \@currentlabel { \l__tasks_label_tl } - } - } - { - \tl_if_blank:VT \l__tasks_label_tl - { \tl_set_eq:NN \l__tasks_label_tl \labelitemi } - } - \tl_put_left:NV \l__tasks_label_tl \l__tasks_label_format_tl - \tl_if_eq:VnTF \l__tasks_tmp_label_tl { $tasks$default$label$ } - { - \__tasks_task:VVw - \l__tasks_label_tl - \l__tasks_item_tl - [ l , b ] [ l , t ] ( 0pt , 0pt ) - } - { - \__tasks_task:VVw - \l__tasks_tmp_label_tl - \l__tasks_item_tl - [ l , b ] [ l , t ] ( 0pt , 0pt ) - \tl_clear:N \l__tasks_tmp_label_tl - } - } - } -\cs_generate_variant:Nn \tl_if_eq:nnTF { V } -\cs_generate_variant:Nn \tl_if_eq:nnT { V } - -\cs_new:Npn \__tasks_read_item:w - { - \peek_meaning:NTF [ - { \__tasks_read_item_aux:w } - { \__tasks_read_item_aux:w[$tasks$default$label$] } - } - -\cs_new_protected:Npn \__tasks_read_item_aux:w [#1]#2 \q_stop - { - \tl_set:Nn \l__tasks_tmp_label_tl { #1 } - \tl_if_eq:nnF { #1 } { $tasks$default$label$ } - { \tl_put_left:NV \l__tasks_tmp_label_tl \l__tasks_label_format_tl } - \tl_set:Nn \l__tasks_item_tl { \ignorespaces #2 } - } - -\char_set_catcode_math_toggle:N \$ - -% -------------------------------------------------------------------------- -% choice box: -\bool_new:N \l__tasks_choice_checked_bool -\dim_new:N \l__tasks_choice_width_dim -\dim_set:Nn \l__tasks_choice_width_dim { 1.25ex } -\dim_new:N \l__tasks_choice_linewidth_dim -\dim_set:Nn \l__tasks_choice_linewidth_dim { .3pt } -\dim_new:N \l__tasks_choice_checkwidth_dim -\dim_set:Nn \l__tasks_choice_checkwidth_dim { .5pt } -\dim_new:N \l__tasks_choice_raise_dim -\dim_set:Nn \l__tasks_choice_raise_dim { .1ex } - -\cs_new_protected:Npn \tasks_choice: - { - \leavevmode - \group_begin: - \bool_set_false:N \l__tasks_choice_checked_bool - \box_move_up:nn - { \l__tasks_choice_raise_dim } - { \hbox:n { \__tasks_choice: } } - \group_end: - } - -\cs_new_protected:Npn \tasks_choice_checked: - { - \leavevmode - \group_begin: - \bool_set_true:N \l__tasks_choice_checked_bool - \box_move_up:nn - { \l__tasks_choice_raise_dim } - { \hbox:n { \__tasks_choice: } } - \group_end: - } - -\cs_new_protected:Npn \__tasks_choice: - {% - \dim_set:Nn \unitlength { .1\l__tasks_choice_width_dim } - \begin{picture}(10,0) - \linethickness \l__tasks_choice_linewidth_dim - \drawline(0,0)(0,10)(10,10)(10,0)(0,0) - \linethickness \l__tasks_choice_checkwidth_dim - \bool_if:NT \l__tasks_choice_checked_bool - { - \drawline(2,2)(8,8) - \drawline(2,8)(8,2) - } - \end{picture}% - } - -\providecommand* \choicebox { \tasks_choice: } -\providecommand* \checkedchoicebox { \tasks_choice_checked: } - -% -------------------------------------------------------------------------- -% base instance: -% ALPHABETIZE: a) b) c) -\DeclareInstance { tasks } { alphabetize } { default } { } - -\keys_define:nn { tasks / list } - { - style .tl_set:N = \l__tasks_instance_tl , - counter-format .tl_set:N = \l__tasks_custom_label_pattern_tl , - label .code:n = - \bool_set_true:N \l__tasks_custom_label_bool - \tl_set:Nn \l__tasks_custom_label_tl { #1 } , - label-format .tl_set:N = \l__tasks_custom_label_format_tl , - label-width .code:n = - \dim_set:Nn \l__tasks_label_width_dim { #1 } - \bool_set_true:N \l__tasks_label_width_bool , - label-offset .code:n = - \dim_set:Nn \l__tasks_label_offset_dim { #1 } - \bool_set_true:N \l__tasks_label_offset_bool , - label-align .tl_set:N = \l__tasks_label_align_tl , - item-indent .code:n = - \dim_set:Nn \l__tasks_item_indent_dim { #1 } - \bool_set_true:N \l__tasks_item_indent_bool , - before-skip .skip_set:N = \l__tasks_before_list_skip , - after-skip .skip_set:N = \l__tasks_after_list_skip , - after-item-skip .code:n = - \bool_set_true:N \l__tasks_custom_after_item_skip_bool - \skip_set:Nn \l__tasks_custom_after_item_skip { #1 } , - resume .bool_set:N = \l__tasks_resume_bool - } - -% -------------------------------------------------------------------------- -% the generic environment: -\NewEnviron { __tasks_env: } [ 3 ] - { - \keys_set:nn { tasks / list } { #2 } - \tl_if_blank:VT \l__tasks_instance_tl - { \keys_set:nn { tasks / list } { style = alphabetize } } - \skip_vertical:N \l__tasks_before_list_skip - \skip_vertical:N \c_zero_skip - \list {} - { - \dim_set:Nn \leftmargin { 0pt } - \dim_set:Nn \rightmargin { 0pt } - } - \item \scan_stop: - \int_incr:N \l__tasks_depth_int - \__tasks:VnnV \l__tasks_instance_tl { #3 } { #1 } \BODY - \endlist - \skip_vertical:N \l__tasks_after_list_skip - } - -% -------------------------------------------------------------------------- -% command to start a new row: -\cs_new_protected:Npn \tasks_new_row: - { - \int_gset:Nn \g__tasks_total_items_int - { \g__tasks_total_items_int + \l__tasks_columns_int - \g__tasks_tmpa_int } - \__tasks_gset_rows_num:NN - \g__tasks_total_items_int - \l__tasks_columns_int - \int_gset_eq:NN \g__tasks_tmpa_int \l__tasks_columns_int - } - -\NewDocumentCommand \startnewitemline {} - { \tasks_new_row: } - -% -------------------------------------------------------------------------- -% the user environment: -\NewDocumentCommand \NewTasks { O{}mO{\task}D(){1} } - { - \NewDocumentEnvironment { #2 } { O{}D(){#4} } - { \__tasks_env: { #3 } { #1,##1 } { ##2 } } - { \end__tasks_env: } - } - -\NewDocumentCommand \RenewTasks { O{}mO{\task}D(){1} } - { - \RenewDocumentEnvironment { #2 } { O{}D(){#4} } - { \__tasks_env: { #3 } { #1,##1 } { ##2 } } - { \end__tasks_env: } - } - -% -------------------------------------------------------------------------- -% default list: -\NewTasks { tasks } - -% -------------------------------------------------------------------------- -% package options: -\keys_define:nn { tasks / options } - { - more .bool_set:N = \l__tasks_load_tasks_bool - } - -\ProcessKeysOptions { tasks / options } - -\bool_if:NT \l__tasks_load_tasks_bool - { - \cs_if_exist:NF \tasks_config_file_loaded: - { \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 - -% HISTORY: -2013/01/19 v0.7 - extracted from `exsheets' package; this also lead to a - slightly new syntax and a few new options for it -2013/04/04 v0.8a - corrected \seq_length:N => \seq_count:N -2013/04/07 v0.9 - protected internal commands where appropriate - - made enumerated item referenceable with \label{} - and \ref{}; this introduced new options: - * the former `label-format' is now `counter-format' - * new: `label-format' - - changed defaults for `label-width' and `label-offset' - - ensure that the `after-item-skip' is only - inserted in between rows - - new option `after-item-skip' - - improvements when label are set with optional argument: - * a provided but empty argument is now correctly recognized - * the counter is _not_ stepped anymore for enumerated - lists when the optional argument is provided - - new command \startnewitemline that forces the next item to - be put at the beginning of a row -2013/04/22 v0.9a - new option `item-indent' - - synchronized version number with `exsheets' until now but - 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 |