summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/exsheets
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-06-28 22:38:21 +0000
committerKarl Berry <karl@freefriends.org>2014-06-28 22:38:21 +0000
commitc1ae351bd639f1e8b141d72b2241541f7fb654fb (patch)
tree6897e5ba6c43d565072d54974de43c885b231d24 /Master/texmf-dist/tex/latex/exsheets
parentfefa9d9a14a12b61735ac81b372041267c597461 (diff)
exsheets (28jun14)
git-svn-id: svn://tug.org/texlive/trunk@34475 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/exsheets')
-rw-r--r--Master/texmf-dist/tex/latex/exsheets/exsheets.sty306
1 files changed, 192 insertions, 114 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty
index 6b3ebe04da2..f6425d9bb7d 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/05/11}
-\def\exsheets@version{0.13}
+\def\exsheets@date{2014/06/28}
+\def\exsheets@version{0.14}
\RequirePackage { expl3 , xparse }
\ProvidesExplPackage
@@ -51,14 +51,13 @@
% ----------------------------------------------------------------------------
% variants of kernel functions:
-\cs_generate_variant:Nn \prop_get:NnN { Nx }
-\cs_generate_variant:Nn \prop_get:NnN { cf }
+\cs_generate_variant:Nn \prop_get:NnN { Nx , cf }
\cs_generate_variant:Nn \prop_get:NnNTF { Nx }
-\cs_generate_variant:Nn \prop_gput:Nnn { Nf , Nff , Nfx }
-\cs_generate_variant:Nn \prop_gput:Nnn { Nx , Nxx }
-\cs_generate_variant:Nn \prop_gput:Nnn { cf , cff }
+\cs_generate_variant:Nn \prop_gput:Nnn { Nf , Nff , Nfx , Nx , Nxx , NxV , cf , cff }
+\cs_generate_variant:Nn \prop_gput_if_new:Nnn { Nxx }
\cs_generate_variant:Nn \tl_if_blank:nTF { x }
-\cs_generate_variant:Nn \tl_if_eq:nnF { x }
+\cs_generate_variant:Nn \tl_if_eq:nnF { x }
+\cs_generate_variant:Nn \int_to_arabic:n { V }
% ----------------------------------------------------------------------------
% temporary variables
@@ -182,7 +181,9 @@
\exp_not:N \providecommand \exp_not:N \exsheets@question@property[3]{} ^^J
\exp_not:N \providecommand \exp_not:N \exsheets@save@number[2]{} ^^J
\exp_not:N \providecommand \exp_not:N \exsheets@sum@of@points[1]{} ^^J
- \exp_not:N \providecommand \exp_not:N \exsheets@sum@of@bonus[1]{}
+ \exp_not:N \providecommand \exp_not:N \exsheets@sum@of@bonus[1]{} ^^J
+ % \exp_not:N \providecommand \exp_not:N \exsheets@number@of@questions[1]{} ^^J
+ % \exp_not:N \providecommand \exp_not:N \numberofquestions{}
}
}
@@ -233,6 +234,8 @@
\tl_set:Nn \l__exsheets_questions_toclevel_tl { subsection }
\tl_new:N \l__exsheets_solutions_toclevel_tl
\tl_set:Nn \l__exsheets_solutions_toclevel_tl { subsection }
+\tl_new:N \l__exsheets_solutions_pre_hook_tl
+\tl_new:N \l__exsheets_solutions_post_hook_tl
\AtBeginDocument{
\cs_if_exist:NF \phantomsection
@@ -804,6 +807,8 @@
\bool_new:N \l__exsheets_questions_use_bool
\bool_set_true:N \l__exsheets_questions_use_bool
\bool_new:N \l__exsheets_questions_deactivate_bool
+\bool_new:N \l__exsheets_save_question_body_to_aux_bool
+\bool_set_false:N \l__exsheets_save_question_body_to_aux_bool
\bool_new:N \l__exsheets_solutions_use_bool
\bool_set_true:N \l__exsheets_solutions_use_bool
@@ -967,6 +972,9 @@
\tl_new:N \l__exsheets_exercise_name_tl
\tl_set:Nn \l__exsheets_exercise_name_tl { Exercise }
+\tl_new:N \l__exsheets_questions_pre_hook_tl
+\tl_new:N \l__exsheets_questions_post_hook_tl
+
\tl_new:N \CurrentQuestionID
\bool_new:N \l__exsheets_questions_print_bool
@@ -985,18 +993,19 @@
\cs_new_eq:NN \exsheets_par: \par
-\NewEnviron { __exsheets_questions_internal: }
+\cs_new:Npn \exsheets_h_or_vspace:N #1
{
- \csappto { BODY }
+ \cs_if_eq:NNTF \exsheets_par: \scan_stop:
+ { \c_space_tl }% the `runin' case
{
- \cs_if_eq:NNTF \exsheets_par: \scan_stop:
- { \c_space_tl }
- {
- \exsheets_par:
- \dim_compare:nNnT { \parskip } = { 0pt }
- { \exsheets_glue:N \l__exsheets_questions_skip_below_dim }
- }
+ \exsheets_par:
+ \dim_compare:nNnT { \parskip } = { 0pt }
+ { \exsheets_glue:N #1 }
}
+ }
+
+\NewEnviron { __exsheets_questions_internal: }
+ {
\bool_if:nT
{
\l__exsheets_questions_print_bool &&
@@ -1004,11 +1013,52 @@
!\l__exsheets_questions_deactivate_bool
}
{
+ % label:
+ \tl_if_blank:VTF \l__exsheets_questions_label_tl
+ {
+ \bool_if:NT \l__exsheets_auto_label_bool
+ {
+ \exsheets_label:V \g__exsheets_questions_current_id_tl
+ \exsheets_set_ref_properties:V \CurrentQuestionID
+ }
+ }
+ {
+ \exsheets_label:V \l__exsheets_questions_label_tl
+ \exsheets_set_ref_properties:V \l__exsheets_questions_label_tl
+ }
\__exsheets_save_number_in:N \g__exsheets_question_number_prop
- \BODY
+ \tl_use:N \l__exsheets_questions_pre_hook_tl
+ \__exsheets_save_and_print_question_body:V \BODY
+ \tl_use:N \l__exsheets_questions_post_hook_tl
+ \exsheets_h_or_vspace:N \l__exsheets_questions_skip_below_dim
+ \exsheets_set_question_properties:x
+ {
+ \tl_if_blank:VF \l__exsheets_questions_subtitle_tl
+ { subtitle = { \exp_not:V \l__exsheets_questions_subtitle_tl } , }
+ counter = \l__exsheets_qu_counter_interpretation_tl ,
+ % number = \int_to_arabic:V \g__exsheets_questions_id_int ,
+ \bool_if:NF \l__exsheets_points_questions_default_bool
+ {
+ \fp_compare:nT { \g__exsheets_this_question_points_fp > 0 }
+ { points = \fp_to_tl:N \g__exsheets_this_question_points_fp , }
+ \fp_compare:nT { \g__exsheets_this_question_bonus_fp > 0 }
+ { bonus-points = \fp_to_tl:N \g__exsheets_this_question_bonus_fp }
+ }
+ }
}
}
+\cs_new:Npn \__exsheets_save_and_print_question_body:n #1
+ {
+ \group_begin:
+ \bool_if:NF \l__exsheets_save_question_body_to_aux_bool
+ { \@fileswfalse }
+ \exsheets_set_question_properties:n { question-body = {#1} }
+ \group_end:
+ #1
+ }
+\cs_generate_variant:Nn \__exsheets_save_and_print_question_body:n { V }
+
\prop_new:N \g__exsheets_questions_id_prop
\prop_new:N \g__exsheets_questions_subtitle_prop
\prop_new:N \g__exsheets_questions_used_prop
@@ -1144,16 +1194,6 @@
{
\tl_gset:Nx \g__exsheets_questions_current_id_tl
{ \tl_use:N \l__exsheets_questions_id_tl }
- }
- \tl_if_blank:VF \l__exsheets_questions_subtitle_tl
- {
- \exsheets_set_question_properties:x
- { subtitle = { \exp_not:V \l__exsheets_questions_subtitle_tl } }
- % this is used in the headings instance; could maybe be replaced
- % by retrieving the property...
- % \prop_gput:NVV \g__exsheets_questions_subtitle_prop
- % \g__exsheets_questions_current_id_tl
- % \l__exsheets_questions_subtitle_tl
}
}
\bool_if:nT
@@ -1164,11 +1204,16 @@
{
\bool_if:NT \l__exsheets_questions_use_bool
{
- \prop_gput:NVV \g__exsheets_questions_used_prop
- \g__exsheets_questions_current_id_tl
- \g__exsheets_questions_id_int
+ % TODO: write this to the aux file and at this point check if the
+ % entry is already present
+ % \prop_gput:NVV \g__exsheets_questions_used_prop
+ % \g__exsheets_questions_current_id_tl
+ % \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 }
+ { \tl_use:N \g__exsheets_questions_current_id_tl }
+ }
\prop_gput:NVV \g__exsheets_questions_id_prop
\g__exsheets_questions_current_id_tl
\g__exsheets_questions_id_int
@@ -1193,6 +1238,9 @@
\fp_gset_eq:NN
\g__exsheets_this_question_points_fp
\l__exsheets_question_points_fp
+ \fp_gset_eq:NN
+ \g__exsheets_this_question_bonus_fp
+ \l__exsheets_question_bonus_fp
\__exsheets_read_points:n { #2 }
% check if moving this to a later point has negative effects...
% \exsheets_set_question_properties:n { points = #2 }
@@ -1235,19 +1283,6 @@
% erhöhe jetzt, wenn kein Nein dabei war:
\tl_if_in:NnF \l__exsheets_step_counter_tl { n }
{ \refstepcounter{question} }
- % label:
- \tl_if_blank:VTF \l__exsheets_questions_label_tl
- {
- \bool_if:NT \l__exsheets_auto_label_bool
- {
- \exsheets_label:V \g__exsheets_questions_current_id_tl
- \exsheets_set_ref_properties:V \g__exsheets_questions_current_id_tl
- }
- }
- {
- \exsheets_label:V \l__exsheets_questions_label_tl
- \exsheets_set_ref_properties:V \l__exsheets_questions_label_tl
- }
\__exsheets_get_sectioning_numbers:
\bool_if:nT
{
@@ -1291,7 +1326,7 @@
\bool_if:nTF
{ \l__exsheets_parse_points_bool && !\l__exsheets_only_print_points_bool }
{
- \__exsheets_use_heading:VVVVnV
+ \exsheets_use_heading:VVVVnV
\l__exsheets_question_heading_instance_tl
\l__exsheets_questions_title_tl
\l__exsheets_qu_counter_interpretation_tl
@@ -1305,7 +1340,7 @@
% might be dangerous to expand here...
\tl_if_blank:xTF { \l__exsheets_questions_points_tl }
{
- \__exsheets_use_heading:VVVnnV
+ \exsheets_use_heading:VVVnnV
\l__exsheets_question_heading_instance_tl
\l__exsheets_questions_title_tl
\l__exsheets_qu_counter_interpretation_tl
@@ -1314,7 +1349,7 @@
\l__exsheets_tmpa_tl
}
{
- \__exsheets_use_heading:VVVVnV
+ \exsheets_use_heading:VVVVnV
\l__exsheets_question_heading_instance_tl
\l__exsheets_questions_title_tl
\l__exsheets_qu_counter_interpretation_tl
@@ -1329,14 +1364,6 @@
}
{
\end__exsheets_questions_internal:
- \bool_if:NF \l__exsheets_points_questions_default_bool
- {
- \fp_compare:nT { \g__exsheets_this_question_points_fp > 0 }
- {
- \exsheets_set_question_properties:x
- { points = \fp_to_tl:N \g__exsheets_this_question_points_fp }
- }
- }
}
% current question number:
@@ -1406,7 +1433,7 @@
{ \textbf{??} }
}
-\cs_new:Npn \__exsheets_question_number:N #1
+\cs_new_protected:Npn \__exsheets_question_number:N #1
{
\cs_if_exist:NTF #1
{
@@ -1425,6 +1452,17 @@
\int_set:Nn \l__exsheets_counter_qu_int { #3 }
}
+% map ID's to number of used questions
+\cs_new_protected:Npn \exsheets@used@id #1#2
+ { \prop_gput:Nnn \g__exsheets_questions_used_prop {#2} {#1} }
+
+\cs_new_protected:Npn \__exsheets_mark_as_used_x:nn #1#2
+ {
+ \prop_gput_if_new:Nxx \g__exsheets_questions_used_prop {#2} {#1}
+ \exsheets_write_to_aux_x:n
+ { \exsheets@used@id {#1} {#2} }
+ }
+
% ----------------------------------------------------------------------------
% title of a question:
\input { exsheets_headings.def }
@@ -1436,7 +1474,7 @@
% #4: points
% #5: bonus
% #6: id
-\cs_new_nopar:Npn \__exsheets_use_heading:nnnnnn #1#2#3#4#5#6
+\cs_new:Npn \exsheets_use_heading:nnnnnn #1#2#3#4#5#6
{
\IfInstanceExistTF { exsheets-heading } { #1 }
{ \UseInstance { exsheets-heading } { #1 } }
@@ -1446,7 +1484,10 @@
}
{ #2 } { #3 } { #4 } { #5 } { #6 }
}
-\cs_generate_variant:Nn \__exsheets_use_heading:nnnnnn { V , VVVnnV , VVVVnV }
+\cs_generate_variant:Nn \exsheets_use_heading:nnnnnn { V , VVVnnV , VVVVnV }
+
+\NewDocumentCommand \ExSheetsHeading { mmmmmm }
+ { \exsheets_use_heading:nnnnnn {#1} {#2} {#3} {#4} {#5} {#6} }
\bool_new:N \l__exsheets_exam_bool
\bool_set_false:N \l__exsheets_exam_bool
@@ -1478,7 +1519,10 @@
\bool_gset_false:N \g__exsheets_questions_use_bool
\bool_set_false:N \l__exsheets_questions_use_bool ,
use .default:n = true ,
- skip-below .dim_set:N = \l__exsheets_questions_skip_below_dim
+ skip-below .dim_set:N = \l__exsheets_questions_skip_below_dim ,
+ pre-hook .tl_set:N = \l__exsheets_questions_pre_hook_tl ,
+ post-hook .tl_set:N = \l__exsheets_questions_post_hook_tl ,
+ save-to-aux .bool_set:N = \l__exsheets_save_question_body_to_aux_bool
}
% ----------------------------------------------------------------------------
@@ -1524,12 +1568,12 @@
\cs_new_protected:Npn \__exsheets_question_set_property:nn #1#2
{
\prop_gput:cVn { g__exsheets_question_property_#1_prop }
- \g__exsheets_questions_current_id_tl { #2 }
+ \CurrentQuestionID { #2 }
% watch if this has negativ effects:
\exsheets_write_to_aux_x:n
{
\exp_not:N \exsheets@question@property
- { \g__exsheets_questions_current_id_tl }
+ { \CurrentQuestionID }
{ \exp_not:n {#1} }
{ \exp_not:n {#2} }
}
@@ -1549,6 +1593,12 @@
\cs_generate_variant:Nn \exsheets_get_question_property:nn { no }
\int_new:N \g__exsheets_tmpa_int
+% \cs_new_protected:Npn \ForEachQuestion #1
+% {
+% \int_gzero:N \g__exsheets_tmpa_int
+% \int_step_inline:nnnn {1} {1} {\numberofquestions}
+% { \int_gincr:N \g__exsheets_tmpa_int #1 }
+% }
\cs_new_protected:Npn \ForEachQuestion #1
{
\int_gzero:N \g__exsheets_tmpa_int
@@ -1559,11 +1609,14 @@
\cs_new:Npn \iflastquestion
{
\int_compare:nTF
- { \g__exsheets_questions_used_int = \g__exsheets_tmpa_int }
+ { \numberofquestions = \g__exsheets_tmpa_int }
+ }
+
+\cs_if_exist:NF \numberofquestions
+ {
+ \cs_new:Npn \numberofquestions
+ { \int_to_arabic:V \g__exsheets_questions_used_int }
}
-
-\cs_new:Npn \numberofquestions
- { \int_use:N \g__exsheets_questions_used_int }
% ----------------------------------------------------------------------------
% debug-Info:
@@ -1793,10 +1846,13 @@
{
\bool_gset_true:N \g__exsheets_questions_use_bool
\clist_gput_right:Nn \questionsincludedlast { #1 }
- \prop_gput:NnV \g__exsheets_questions_used_prop
- { #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 }
+ % \prop_gput:NnV \g__exsheets_questions_used_prop
+ % { #1 }
+ % \g__exsheets_questions_id_int
\prop_gput:NnV \g__exsheets_questions_id_prop
{ #1 }
\g__exsheets_questions_id_int
@@ -1814,10 +1870,13 @@
{
\bool_gset_true:N \g__exsheets_questions_use_bool
\clist_gput_right:Nn \questionsincludedlast { #1 }
- \prop_gput:NnV \g__exsheets_questions_used_prop
- { #1 }
- \g__exsheets_questions_id_int
+ % \prop_gput:NnV \g__exsheets_questions_used_prop
+ % { #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 }
\prop_gput:NnV \g__exsheets_questions_id_prop
{ #1 }
\g__exsheets_questions_id_int
@@ -1955,6 +2014,7 @@
\prop_new:N \g__exsheets_solutions_content_prop
\prop_new:N \g__exsheets_solutions_questions_id_prop
\prop_new:N \g__exsheets_solutions_names_prop
+\prop_new:N \g__exsheets_solutions_counter_prop
\tl_new:N \l__exsheets_solutions_name_tl
\tl_set:Nn \l__exsheets_solutions_name_tl { Solution }
@@ -1965,15 +2025,18 @@
\bool_if:NTF \l__exsheets_include_all_bool
{ \int_set:Nn \l__exsheets_tmpe_int { \g__exsheets_questions_id_int -1 } }
{ \int_set_eq:NN \l__exsheets_tmpe_int \g__exsheets_questions_id_int }
- \prop_gput:Nff \g__exsheets_solutions_content_prop
+ \prop_gput:Nxn \g__exsheets_solutions_content_prop
{ \int_use:N \g__exsheets_questions_id_int }
{ #1 }
- \prop_gput:Nff \g__exsheets_solutions_questions_id_prop
+ \prop_gput:NxV \g__exsheets_solutions_questions_id_prop
+ { \int_use:N \g__exsheets_questions_id_int }
+ \g__exsheets_questions_current_id_tl
+ \prop_gput:NxV \g__exsheets_solutions_names_prop
{ \int_use:N \g__exsheets_questions_id_int }
- { \tl_use:N \g__exsheets_questions_current_id_tl }
- \prop_gput:Nff \g__exsheets_solutions_names_prop
+ \l__exsheets_solutions_name_tl
+ \prop_gput:NxV \g__exsheets_solutions_counter_prop
{ \int_use:N \g__exsheets_questions_id_int }
- { \tl_use:N \l__exsheets_solutions_name_tl }
+ \l__exsheets_qu_counter_pattern_tl
% print here
\bool_if:NT \l__exsheets_solutions_print_here_bool
{
@@ -1984,19 +2047,15 @@
\l__exsheets_solutions_name_tl
\g__exsheets_questions_current_id_tl
\use:n { #1 }
- \cs_if_eq:NNTF \exsheets_par: \scan_stop:
- { \c_space_tl }
- {
- \exsheets_par:
- \dim_compare:nNnT { \parskip } = { 0pt }
- { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim }
- }
+ \exsheets_h_or_vspace:N \l__exsheets_solutions_skip_below_dim
}
}
\cs_generate_variant:Nn \__exsheets_save_solution:n { V }
\NewEnviron { __exsheets_solution_internal: }
{
+ % \exp_args:NNV \cspreto \BODY \l__exsheets_solutions_pre_hook_tl
+ % \exp_args:NNV \csappto \BODY \l__exsheets_solutions_post_hook_tl
\bool_if:nT
{ \g__exsheets_questions_use_bool && \l__exsheets_solutions_use_bool }
{ \__exsheets_save_solution:V \BODY }
@@ -2035,6 +2094,7 @@
{
\bool_set_true:N \l__exsheets_inside_solution_bool
\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
{
@@ -2044,7 +2104,11 @@
}
\__exsheets_solution_internal:
}
- { \end__exsheets_solution_internal: }
+ {
+ \end__exsheets_solution_internal:
+ % \bool_if:NT \l__exsheets_solutions_use_bool
+ % { \tl_use:N \l__exsheets_solutions_post_hook_tl }
+ }
\bool_new:N \l__exsheets_solutions_runin_bool
\bool_set_false:N \l__exsheets_solutions_runin_bool
@@ -2057,7 +2121,7 @@
\l__exsheets_solution_heading_instance_tl
\l__exsheets_heading_instance_tl
}
- \__exsheets_use_heading:Vnnnnn
+ \exsheets_use_heading:Vnnnnn
\l__exsheets_solution_heading_instance_tl
{ #2 } { #1 } { 0 } { 0 } { #3 }
}
@@ -2174,22 +2238,18 @@
{ #1 } \l__exsheets_tmpb_tl
\prop_get:NnN \g__exsheets_solutions_questions_id_prop
{ #1 } \l__exsheets_tmpc_tl
+ \prop_get:NnN \g__exsheets_solutions_counter_prop
+ { #1 } \l__exsheets_tmpd_tl
\eSaveCounterPatternFrom [ exsheets ]
\l__exsheets_current_pattern_interpretation_tl
\l__exsheets_current_pattern_tl
- \l__exsheets_qu_counter_pattern_tl
+ \l__exsheets_tmpd_tl
\exsheets_solutions_print_name:VVV
\l__exsheets_current_pattern_tl
\l__exsheets_tmpa_tl
\l__exsheets_tmpc_tl
\tl_use:N \l__exsheets_tmpb_tl
- \cs_if_eq:NNTF \exsheets_par: \scan_stop:
- { \c_space_tl }
- {
- \exsheets_par:
- \dim_compare:nNnT { \parskip } = { 0pt }
- { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim }
- }
+ \exsheets_h_or_vspace:N \l__exsheets_solutions_skip_below_dim
}
}
@@ -2350,6 +2410,8 @@
{ #1 } \l__exsheets_tmpb_tl
\prop_get:NnN \g__exsheets_solutions_questions_id_prop
{ #1 } \l__exsheets_tmpc_tl
+ \prop_get:NnN \g__exsheets_solutions_counter_prop
+ { #1 } \l__exsheets_tmpd_tl
\group_begin:
\tl_set_eq:NN \CurrentQuestionID \l__exsheets_tmpc_tl
\__exsheets_sectioning_hook:nV { ch }
@@ -2360,19 +2422,13 @@
\eSaveCounterPatternFrom [ exsheets ]
\l__exsheets_current_pattern_interpretation_tl
\l__exsheets_current_pattern_tl
- \l__exsheets_qu_counter_pattern_tl
+ \l__exsheets_tmpd_tl
\exsheets_solutions_print_name:VVV
\l__exsheets_current_pattern_tl
\l__exsheets_tmpa_tl
\l__exsheets_tmpc_tl
\tl_use:N \l__exsheets_tmpb_tl
- \cs_if_eq:NNTF \exsheets_par: \scan_stop:
- { \c_space_tl }
- {
- \exsheets_par:
- \dim_compare:nNnT { \parskip } = { 0pt }
- { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim }
- }
+ \exsheets_h_or_vspace:N \l__exsheets_solutions_skip_below_dim
}
}
@@ -2422,13 +2478,7 @@
\l__exsheets_tmpa_tl
\l__exsheets_tmpc_tl
\tl_use:N \l__exsheets_tmpb_tl
- \cs_if_eq:NNTF \exsheets_par: \scan_stop:
- { \c_space_tl }
- {
- \exsheets_par:
- \dim_compare:nNnT { \parskip } = { 0pt }
- { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim }
- }
+ \exsheets_h_or_vspace:N \l__exsheets_solutions_skip_below_dim
}
}
}
@@ -2490,7 +2540,9 @@
print .default:n = true ,
name .tl_set:N = \l__exsheets_solutions_name_tl ,
sorted .bool_set:N = \l__exsheets_print_byID_sorted_bool ,
- skip-below .dim_set:N = \l__exsheets_solutions_skip_below_dim
+ skip-below .dim_set:N = \l__exsheets_solutions_skip_below_dim ,
+ % pre-hook .tl_set:N = \l__exsheets_solutions_pre_hook_tl ,
+ % post-hook .tl_set:N = \l__exsheets_solutions_post_hook_tl
}
% ----------------------------------------------------------------------------
@@ -2705,8 +2757,12 @@
\NewQuSolPair{question}{solution}
% properties:
-\DeclareQuestionProperty{points}
+% \DeclareQuestionProperty{number}
+\DeclareQuestionProperty{counter}
\DeclareQuestionProperty{subtitle}
+\DeclareQuestionProperty{question-body}
+\DeclareQuestionProperty{points}
+\DeclareQuestionProperty{bonus-points}
\bool_if:NT \l__exsheets_auto_label_bool
{
\DeclareQuestionProperty{ref}
@@ -2786,7 +2842,11 @@
\exp_not:N \exsheets@sum@of@points
{ \fp_eval:n { \g__exsheets_points_sum_fp } }^^J
\exp_not:N \exsheets@sum@of@bonus
- { \fp_eval:n { \g__exsheets_bonus_sum_fp } }
+ { \fp_eval:n { \g__exsheets_bonus_sum_fp } }^^J
+ \exp_not:N \gdef \exp_not:N \numberofquestions
+ { \int_use:N \g__exsheets_questions_used_int }
+ % \exsheets@number@of@questions
+ % { \int_to_arabic:V \g__exsheets_questions_id_int }
}
}
@@ -2978,10 +3038,27 @@ HISTORY:
of solutions (when printed with \printsolutions[all])
when solutions from a new section or chapter are
printed
+2014/05/11 v0.13a - bug fix: solutions get the counter-format that's
+ active when the corresponding `solution' environment
+ is placed in the source
+2014/06/27 v0.14 - new command: \ExSheetsHeading
+ - \__exsheets_use_heading:nnnnnn =>
+ \exsheets_use_heading:nnnnnn
+ - new options `question/pre-hook' and
+ `question/post-hook'
+ % `solution/pre-hook' and
+ % `solution/post-hook'
+ - new pre-defined property `question-body'
+ - new pre-defined property `bonus-points'
+ - new pre-defined property `counter'
+ - new option `question/save-to-aux'
+ - \ForEachQuestion, \numberofquestions and
+ \iflastquestion are now available before any
+ questions have been typeset
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TODO:
-- add a `tags' concept
+- add a `tags' concept => major task
- add user interface that removes \par and vertical skip after
question/solution environments.
(equal to \cs_set_eq:NN \exsheets_par: \scan_stop: )
@@ -2990,3 +3067,4 @@ HISTORY:
- \examspace inside {tasks} => possible? (\pagegoal-\pagetotal) gives wrong
values here
- remove doubled points name if total points are unknown
+