diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/exsheets/exsheets.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 132 |
1 files changed, 100 insertions, 32 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index ac5272f23aa..4d3c3481917 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty @@ -31,8 +31,8 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % ---------------------------------------------------------------------------- -\def\exsheets@date{2012/11/08} -\def\exsheets@version{0.4} +\def\exsheets@date{2012/12/02} +\def\exsheets@version{0.5} \RequirePackage { expl3 , xparse } \ProvidesExplPackage @@ -151,6 +151,8 @@ \tl_new:N \l__exsheets_heading_instance_tl \tl_set:Nn \l__exsheets_heading_instance_tl { block } +\tl_new:N \l__exsheets_question_heading_instance_tl +\tl_new:N \l__exsheets_solution_heading_instance_tl \tl_new:N \l__exsheets_heading_title_user_format_tl \tl_set:Nn \l__exsheets_heading_title_user_format_tl { \normalsize\bfseries } \tl_new:N \l__exsheets_questions_toclevel_tl @@ -807,13 +809,19 @@ \cs_new:Npn \IfInsideQuestionF { \bool_if:NF \l__exsheets_inside_question_bool } +\cs_new_eq:NN \exsheets_par: \par + \NewEnviron { __exsheets_questions_internal: } { \csappto { BODY } { - \par - \dim_compare:nNnT { \parskip } = { 0pt } - { \exsheets_glue:N \l__exsheets_questions_skip_below_dim } + \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 } + } } \bool_if:nT { @@ -828,10 +836,12 @@ } \prop_new:N \g__exsheets_questions_id_prop +\prop_new:N \g__exsheets_questions_meta_prop \prop_new:N \g__exsheets_questions_used_prop \int_new:N \g__exsheets_questions_used_int \tl_new:N \l__exsheets_questions_id_tl +\tl_new:N \l__exsheets_questions_meta_tl \tl_new:N \g__exsheets_questions_current_id_tl \tl_new:N \l__exsheets_title_tl @@ -860,18 +870,6 @@ { \bool_gset_true:N \g__exsheets_questions_use_bool } % Optionen: \IfNoValueF { #1 } { \keys_set:nn { exsheets / question } { #1 } } - % Punktevergabe: - \IfNoValueTF { #2 } - { - \__exsheets_read_points:n { 0 } - \bool_if:NT \l__exsheets_points_questions_default_bool - { - \fp_set_eq:NN - \l__exsheets_question_points_fp - \l__exsheets_points_default_fp - } - } - { \__exsheets_read_points:n { #2 } } % ID: \int_gincr:N \g__exsheets_questions_id_int \tl_if_blank:VTF \l__exsheets_questions_id_tl @@ -903,6 +901,36 @@ \tl_gset:Nx \g__exsheets_questions_current_id_tl { \tl_use:N \l__exsheets_questions_id_tl } } + % Punktevergabe: + \IfNoValueTF { #2 } + { + \__exsheets_read_points:n { 0 } + \bool_if:NT \l__exsheets_points_questions_default_bool + { + \fp_set_eq:NN + \l__exsheets_question_points_fp + \l__exsheets_points_default_fp + \exp_args:Nx \SetQuestionProperties + { points = \fp_to_tl:N \l__exsheets_points_default_fp } + } + } + { + \__exsheets_read_points:n { #2 } + \SetQuestionProperties{points=#2} + } + \tl_if_blank:VT \l__exsheets_question_heading_instance_tl + { + \tl_set_eq:NN + \l__exsheets_question_heading_instance_tl + \l__exsheets_heading_instance_tl + } + % meta: + \tl_if_blank:VF \l__exsheets_questions_meta_tl + { + \prop_gput:NVV \g__exsheets_questions_meta_prop + \g__exsheets_questions_current_id_tl + \l__exsheets_questions_meta_tl + } % Auswahl der Frage: \__exsheets_select_question:V \g__exsheets_questions_current_id_tl \bool_if:nT @@ -946,7 +974,7 @@ { \tl_set_eq:NN \l__exsheets_title_tl \l__exsheets_questions_name_tl } { \tl_set_eq:NN \l__exsheets_title_tl \l__exsheets_exsheets_name_tl } \__exsheets_use_heading:VVVnn - \l__exsheets_heading_instance_tl + \l__exsheets_question_heading_instance_tl \l__exsheets_title_tl \l__exsheets_qu_counter_interpretation_tl { \l__exsheets_question_points_fp } @@ -1092,6 +1120,8 @@ name .code:n = \tl_set:Nn \l__exsheets_exsheets_name_tl { #1 } \tl_set:Nn \l__exsheets_questions_name_tl { #1 } , + headings .tl_set:N = \l__exsheets_question_heading_instance_tl , + meta .tl_set:N = \l__exsheets_questions_meta_tl , print .bool_set:N = \l__exsheets_questions_print_bool , print .default:n = true , ID .tl_set:N = \l__exsheets_questions_id_tl , @@ -1128,6 +1158,8 @@ { \exsheets_declare_question_property:n { #1 } } \@onlypreamble\DeclareQuestionProperty +\DeclareQuestionProperty{points} + \NewDocumentCommand \SetQuestionProperties { m } { \exsheets_set_question_properties:n { #1 } } @@ -1209,6 +1241,8 @@ \NewDocumentCommand \DebugExSheets { G{true} } { \use:c { bool_set_#1:N } \l__exsheets_questions_debug_bool } +\cs_new:Npn \CurrentQuestionID { \g__exsheets_questions_current_id_tl } + % ---------------------------------------------------------------------------- % include random/selected questions from a file: \bool_new:N \l__exsheets_select_questions_bool @@ -1266,7 +1300,7 @@ \prop_length:N \g__exsheets_selected_questions_prop \c_space_tl questions. } - \par + \exsheets_par: } \bool_set_false:N \l__exsheets_questions_deactivate_bool \__exsheets_select_question_random:n { ##1 } @@ -1424,9 +1458,14 @@ \__exsheets_solutions_name:VV \l__exsheets_qu_counter_interpretation_tl \l__exsheets_solutions_name_tl - \use:n { #1 } \par - \dim_compare:nNnT { \parskip } = { 0pt } - { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim } + \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 } + } } } \cs_generate_variant:Nn \prop_gput:Nnn { Nff,Nfx,Nfn,Nxx } @@ -1455,6 +1494,12 @@ \bool_set_true:N \l__exsheets_inside_solution_bool \IfNoValueF { #1 } { \keys_set:nn { exsheets / solution } { #1 } } } + \tl_if_blank:VT \l__exsheets_solution_heading_instance_tl + { + \tl_set_eq:NN + \l__exsheets_solution_heading_instance_tl + \l__exsheets_heading_instance_tl + } \__exsheets_solution_internal: } { \end__exsheets_solution_internal: } @@ -1465,7 +1510,7 @@ \cs_new_nopar:Npn \__exsheets_solutions_name:nn #1#2 { \__exsheets_use_heading:Vnnnn - \l__exsheets_heading_instance_tl + \l__exsheets_solution_heading_instance_tl { #2 } { #1 } { 0 } { 0 } } \cs_generate_variant:Nn \__exsheets_solutions_name:nn { VV } @@ -1574,9 +1619,14 @@ \exsheets_solutions_print_name:VV \l__exsheets_current_pattern_tl \l__exsheets_tmpa_tl - \tl_use:N \l__exsheets_tmpb_tl \par - \dim_compare:nNnT { \parskip } = { 0pt } - { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim } + \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 } + } } } @@ -1719,9 +1769,14 @@ \exsheets_solutions_print_name:VV \l__exsheets_current_pattern_tl \l__exsheets_tmpa_tl - \tl_use:N \l__exsheets_tmpb_tl \par - \dim_compare:nNnT { \parskip } = { 0pt } - { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim } + \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 } + } } } @@ -1767,9 +1822,14 @@ \exsheets_solutions_print_name:VV \l__exsheets_current_pattern_tl \l__exsheets_tmpa_tl - \tl_use:N \l__exsheets_tmpb_tl \par - \dim_compare:nNnT { \parskip } = { 0pt } - { \exsheets_glue:N \l__exsheets_solutions_skip_below_dim } + \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 } + } } } } @@ -1814,6 +1874,7 @@ \keys_define:nn { exsheets / solution } { + headings .tl_set:N = \l__exsheets_solution_heading_instance_tl , print .choice: , print / true .code:n = { @@ -2051,6 +2112,7 @@ \DeclareTranslation { Spanish } { exsheets-exercise-name } { Ejercicio } \DeclareTranslation { Catalan } { exsheets-exercise-name } { Exercir } \DeclareTranslation { Turkish } { exsheets-exercise-name } { Egzersiz } + \DeclareTranslation { Croatian } { exsheets-exercise-name } { Primjer } % translation for the question \DeclareTranslation { English } { exsheets-question-name } { Question } \DeclareTranslation { British } { exsheets-question-name } { Question } @@ -2061,6 +2123,7 @@ \DeclareTranslation { Spanish } { exsheets-question-name } { Pregunta } \DeclareTranslation { Catalan } { exsheets-question-name } { Q\"uesti\'o } \DeclareTranslation { Turkish } { exsheets-question-name } { Soru } + \DeclareTranslation { Croatian } { exsheets-question-name } { Zadatak } % translation for the solutions \DeclareTranslation { English } { exsheets-solution-name } { Solution } \DeclareTranslation { British } { exsheets-solution-name } { Solution } @@ -2071,6 +2134,7 @@ \DeclareTranslation { Spanish } { exsheets-solution-name } { Soluci\'on } \DeclareTranslation { Catalan } { exsheets-solution-name } { Soluci\'o } \DeclareTranslation { Turkish } { exsheets-solution-name } { \c C\"oz\"um } + \DeclareTranslation { Croatian } { exsheets-solution-name } { Rje\v{s}enje } % the actual translating \tl_set:Nn \l__exsheets_exsheets_name_tl { \GetTranslation { exsheets-exercise-name } } @@ -2172,7 +2236,11 @@ HISTORY: 2012/11/08 v0.4 - compatibility with KOMA-Script's `parskip' option: now no unwanted skip and no overfull hbox is produced - env {task} now supports inner environments +2012/12/02 v0.5 - added \CurrentQuestionID %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: - points/decimal-marker, points/frac (?), points/format (?,im interface) +- bug in {tasks} in {solution}: label werden nicht richtig upgedatet! +- add possibility to choose different headings instances for questions and + solutions
\ No newline at end of file |