summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-07-20 22:05:15 +0000
committerKarl Berry <karl@freefriends.org>2014-07-20 22:05:15 +0000
commit0e871146bcb1bf041dac127d5b76011aa31e28aa (patch)
tree527340c7b55c4780d82bb55b95844d571ed58ace /Master/texmf-dist/tex/latex/exsheets/exsheets.sty
parent320402419add6802f1b48c988bea73773d0d67d4 (diff)
exsheets (20jul14)
git-svn-id: svn://tug.org/texlive/trunk@34665 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/exsheets/exsheets.sty')
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets.sty585
1 files changed, 300 insertions, 285 deletions
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: