diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/exsheets/exsheets.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 230 |
1 files changed, 131 insertions, 99 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index 64ce0f3e650..0ac48c0717c 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{2013/07/17} -\def\exsheets@version{0.9i} +\def\exsheets@date{2013/10/11} +\def\exsheets@version{0.10} \RequirePackage { expl3 , xparse } \ProvidesExplPackage @@ -201,8 +201,10 @@ \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_heading_title_user_format_tl +\tl_set:Nn \l_exsheets_heading_title_user_format_tl { \normalsize\bfseries } +\tl_new:N \l_exsheets_subtitle_format_tl +\tl_set:Nn \l_exsheets_subtitle_format_tl { \normalsize\bfseries\itshape } \tl_new:N \l__exsheets_questions_toclevel_tl \tl_set:Nn \l__exsheets_questions_toclevel_tl { subsection } \tl_new:N \l__exsheets_solutions_toclevel_tl @@ -224,7 +226,9 @@ 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 , - headings-format .tl_set:N = \l__exsheets_heading_title_user_format_tl , + headings-format .tl_set:N = + \l_exsheets_heading_title_user_format_tl , + subtitle-format .tl_set:N = \l_exsheets_subtitle_format_tl , load-tasks .bool_set:N = \l__exsheets_load_tasks_bool , use-ref .bool_set:N = \l__exsheets_solutions_by_ref_bool , totoc .choice: , @@ -764,7 +768,7 @@ } % ---------------------------------------------------------------------------- -% Aufgaben und Lösungen +% Aufgaben und Lösungen \bool_new:N \g__exsheets_questions_use_bool \bool_gset_true:N \g__exsheets_questions_use_bool \bool_new:N \l__exsheets_questions_use_bool @@ -900,8 +904,8 @@ % die 'question' Umgebung \tl_new:N \l__exsheets_questions_name_tl \tl_set:Nn \l__exsheets_questions_name_tl { Question } -\tl_new:N \l__exsheets_exsheets_name_tl -\tl_set:Nn \l__exsheets_exsheets_name_tl { Exercise } +\tl_new:N \l__exsheets_exercise_name_tl +\tl_set:Nn \l__exsheets_exercise_name_tl { Exercise } \bool_new:N \l__exsheets_questions_print_bool \bool_set_true:N \l__exsheets_questions_print_bool @@ -944,14 +948,14 @@ } \prop_new:N \g__exsheets_questions_id_prop -\prop_new:N \g__exsheets_questions_meta_prop +\prop_new:N \g__exsheets_questions_subtitle_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 \l__exsheets_questions_subtitle_tl \tl_new:N \g__exsheets_questions_current_id_tl -\tl_new:N \l__exsheets_title_tl +\tl_new:N \l__exsheets_questions_title_tl \tl_new:N \l__exsheets_questions_label_tl \tl_new:N \l__exsheets_questions_points_tl @@ -1028,11 +1032,11 @@ } % FIXME: rather useless since it isn't used at all, see also % exsheets_headings.def - \tl_if_blank:VF \l__exsheets_questions_meta_tl + \tl_if_blank:VF \l__exsheets_questions_subtitle_tl { - \prop_gput:NVV \g__exsheets_questions_meta_prop + \prop_gput:NVV \g__exsheets_questions_subtitle_prop \g__exsheets_questions_current_id_tl - \l__exsheets_questions_meta_tl + \l__exsheets_questions_subtitle_tl } } \bool_if:nT @@ -1091,8 +1095,8 @@ } { \tl_clear:N \l__exsheets_step_counter_tl - % das ist etwas mühsam: abhängig von der Nutzung der verschiedenen - % Gruppierungsmöglichkeiten muss der Counter erhöht werden: + % das ist etwas mühsam: abhängig von der Nutzung der verschiedenen + % Gruppierungsmöglichkeiten muss der Counter erhöht werden: \prop_map_inline:Nn \l__exsheets_class_prop { \use:c { __exsheets_questions_use_##1: } @@ -1109,7 +1113,7 @@ { \tl_put_right:Nn \l__exsheets_step_counter_tl { y } } { \tl_put_right:Nn \l__exsheets_step_counter_tl { n } } } - % erhöhe jetzt, wenn kein Nein dabei war: + % erhöhe jetzt, wenn kein Nein dabei war: \tl_if_in:NnF \l__exsheets_step_counter_tl { n } { \refstepcounter{question} } \__exsheets_get_sectioning_numbers: @@ -1131,24 +1135,34 @@ \bool_if:NT \l__exsheets_questions_print_bool { \bool_if:NTF \l__exsheets_exam_bool - { \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 } + { + \tl_set_eq:NN + \l__exsheets_questions_title_tl + \l__exsheets_questions_name_tl + } + { + \tl_set_eq:NN + \l__exsheets_questions_title_tl + \l__exsheets_exercise_name_tl + } \bool_if:NTF \l__exsheets_parse_points_bool { - \__exsheets_use_heading:VVVnn + \__exsheets_use_heading:VVVnnV \l__exsheets_question_heading_instance_tl - \l__exsheets_title_tl + \l__exsheets_questions_title_tl \l__exsheets_qu_counter_interpretation_tl { \l__exsheets_question_points_fp } { \l__exsheets_question_bonus_fp } + \g__exsheets_questions_current_id_tl } { - \__exsheets_use_heading:VVVnn + \__exsheets_use_heading:VVVnnV \l__exsheets_question_heading_instance_tl - \l__exsheets_title_tl + \l__exsheets_questions_title_tl \l__exsheets_qu_counter_interpretation_tl { \l__exsheets_questions_points_tl } { 0 } + \g__exsheets_questions_current_id_tl } } } @@ -1264,7 +1278,8 @@ % #3: number % #4: points % #5: bonus -\cs_new_nopar:Npn \__exsheets_use_heading:nnnnn #1#2#3#4#5 +% #6: id +\cs_new_nopar:Npn \__exsheets_use_heading:nnnnnn #1#2#3#4#5#6 { \IfInstanceExistTF { exsheets-heading } { #1 } { \UseInstance { exsheets-heading } { #1 } } @@ -1272,9 +1287,9 @@ \msg_warning:nnx { exsheets} { headings } { #1 } \UseInstance { exsheets-heading } { block } } - { #2 } { #3 } { #4 } { #5 } + { #2 } { #3 } { #4 } { #5 } { #6 } } -\cs_generate_variant:Nn \__exsheets_use_heading:nnnnn { V , VV , VVV } +\cs_generate_variant:Nn \__exsheets_use_heading:nnnnnn { V , VVVnnV } \bool_new:N \l__exsheets_exam_bool \bool_set_false:N \l__exsheets_exam_bool @@ -1290,10 +1305,10 @@ type / exercise .code:n = \bool_set_false:N \l__exsheets_exam_bool , name .code:n = - \tl_set:Nn \l__exsheets_exsheets_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 , - meta .tl_set:N = \l__exsheets_questions_meta_tl , + subtitle .tl_set:N = \l__exsheets_questions_subtitle_tl , print .bool_set:N = \l__exsheets_questions_print_bool , print .default:n = true , ID .tl_set:N = \l__exsheets_questions_id_tl , @@ -1786,9 +1801,10 @@ { \int_set:Nn \l__exsheets_counter_qu_int { \arabic{question} } \__exsheets_get_sectioning_numbers: - \__exsheets_solutions_name:VV + \__exsheets_solutions_name:VVV \l__exsheets_qu_counter_interpretation_tl \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 } @@ -1855,7 +1871,7 @@ \bool_new:N \l__exsheets_solutions_runin_bool \bool_set_false:N \l__exsheets_solutions_runin_bool -\cs_new_protected_nopar:Npn \__exsheets_solutions_name:nn #1#2 +\cs_new_protected_nopar:Npn \__exsheets_solutions_name:nnn #1#2#3 { \tl_if_blank:VT \l__exsheets_solution_heading_instance_tl { @@ -1863,17 +1879,17 @@ \l__exsheets_solution_heading_instance_tl \l__exsheets_heading_instance_tl } - \__exsheets_use_heading:Vnnnn + \__exsheets_use_heading:Vnnnnn \l__exsheets_solution_heading_instance_tl - { #2 } { #1 } { 0 } { 0 } + { #2 } { #1 } { 0 } { 0 } { #3 } } -\cs_generate_variant:Nn \__exsheets_solutions_name:nn { VV } +\cs_generate_variant:Nn \__exsheets_solutions_name:nnn { VV , VVV } -\tl_new:N \l__exsheets_solutions_name_style_tl -\tl_set:Nn \l__exsheets_solutions_name_style_tl { \normalsize \bfseries } +\tl_new:N \l_exsheets_solutions_name_style_tl +\tl_set:Nn \l_exsheets_solutions_name_style_tl { \normalsize \bfseries } \cs_new:Npn \exsheets_solutions_name_style:n #1 - { \l__exsheets_solutions_name_style_tl #1 } + { \l_exsheets_solutions_name_style_tl #1 } % ---------------------------------------------------------------------------- % print solutions: @@ -1976,13 +1992,16 @@ { #1 } \l__exsheets_tmpa_tl \prop_get:NnN \g__exsheets_solutions_content_prop { #1 } \l__exsheets_tmpb_tl + \prop_get:NnN \g__exsheets_solutions_questions_id_prop + { #1 } \l__exsheets_tmpc_tl \eSaveCounterPatternFrom [ exsheets ] \l__exsheets_current_pattern_interpretation_tl \l__exsheets_current_pattern_tl \l__exsheets_qu_counter_pattern_tl - \exsheets_solutions_print_name:VV + \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 } @@ -2126,13 +2145,16 @@ \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 + \prop_get:NnN \g__exsheets_solutions_questions_id_prop + { #1 } \l__exsheets_tmpc_tl \eSaveCounterPatternFrom [ exsheets ] \l__exsheets_current_pattern_interpretation_tl \l__exsheets_current_pattern_tl \l__exsheets_qu_counter_pattern_tl - \exsheets_solutions_print_name:VV + \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 } @@ -2175,6 +2197,8 @@ { \prop_get:NnN \g__exsheets_solutions_content_prop { ##1 } \l__exsheets_tmpb_tl + \prop_get:NnN \g__exsheets_solutions_questions_id_prop + { ##1 } \l__exsheets_tmpc_tl \__exsheets_restore_number_from_and_do:Nnn \g__exsheets_question_number_prop { ##1 } @@ -2183,9 +2207,10 @@ \l__exsheets_current_pattern_interpretation_tl \l__exsheets_current_pattern_tl \l__exsheets_qu_counter_pattern_tl - \exsheets_solutions_print_name:VV + \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 } @@ -2215,16 +2240,16 @@ \int_set:Nn \l__exsheets_counter_qu_int { #3 } } -\cs_new_protected_nopar:Npn \exsheets_solutions_print_name:nn #1#2 +\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:nn { } { #2 } } - { \__exsheets_solutions_name:nn { #1 } { #2 } } + { \__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:nn { VV } +\cs_generate_variant:Nn \exsheets_solutions_print_name:nnn { VVV } \cs_new:Npn \PrintSolutionsTF { \bool_if:NTF \l__exsheets_solutions_print_bool } @@ -2483,62 +2508,63 @@ % ---------------------------------------------------------------------------- % Sprachanpassungen -\file_if_exist:nT { translations.sty } - { - \RequirePackage { translations } - % translation for the exercises - \DeclareTranslationFallback { exsheets-exercise-name } { Exercise } - \DeclareTranslation { English } { exsheets-exercise-name } { Exercise } - \DeclareTranslation { British } { exsheets-exercise-name } { Exercise } - \DeclareTranslation { American } { exsheets-exercise-name } { Exercise } - \DeclareTranslation { French } { exsheets-exercise-name } { Exercise } - \DeclareTranslation { German } { exsheets-exercise-name } { \"Ubung } - \DeclareTranslation { Italian } { exsheets-exercise-name } { Esercizio } - \DeclareTranslation { Spanish } { exsheets-exercise-name } { Ejercicio } - \DeclareTranslation { Catalan } { exsheets-exercise-name } { Exercici } - \DeclareTranslation { Turkish } { exsheets-exercise-name } { Egzersiz } - \DeclareTranslation { Croatian } { exsheets-exercise-name } { Primjer } - \DeclareTranslation { Hungarian } { exsheets-exercise-name } { Gyakorol } - \DeclareTranslation { Danish } { exsheets-exercise-name } { \O{}velse } - \DeclareTranslation { Portuges } { exsheets-exercise-name } { Exerc\'\i cio } - % translation for the question - \DeclareTranslationFallback { exsheets-question-name } { Question } - \DeclareTranslation { English } { exsheets-question-name } { Question } - \DeclareTranslation { British } { exsheets-question-name } { Question } - \DeclareTranslation { American } { exsheets-question-name } { Question } - \DeclareTranslation { French } { exsheets-question-name } { Question } - \DeclareTranslation { German } { exsheets-question-name } { Aufgabe } - \DeclareTranslation { Italian } { exsheets-question-name } { Questione } - \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 } - \DeclareTranslation { Hungarian } { exsheets-question-name } { Feladat } - \DeclareTranslation { Danish } { exsheets-question-name } { Opgave } - \DeclareTranslation { Portuges } { exsheets-question-name } { Quest\~ao } - % translation for the solutions - \DeclareTranslationFallback { exsheets-solution-name } { Solution } - \DeclareTranslation { English } { exsheets-solution-name } { Solution } - \DeclareTranslation { British } { exsheets-solution-name } { Solution } - \DeclareTranslation { American } { exsheets-solution-name } { Solution } - \DeclareTranslation { French } { exsheets-solution-name } { Solution } - \DeclareTranslation { German } { exsheets-solution-name } { L\"osung } - \DeclareTranslation { Italian } { exsheets-solution-name } { Soluzione } - \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 } - \DeclareTranslation { Hungarian } { exsheets-solution-name } { Megold\'{a}s } - \DeclareTranslation { Danish } { exsheets-solution-name } { Opl\o{}sning } - \DeclareTranslation { Portuges } { exsheets-solution-name } { Solu\c c\~ao } - % the actual translating - \tl_set:Nn \l__exsheets_exsheets_name_tl - { \GetTranslation { exsheets-exercise-name } } - \tl_set:Nn \l__exsheets_questions_name_tl - { \GetTranslation { exsheets-question-name } } - \tl_set:Nn \l__exsheets_solutions_name_tl - { \GetTranslation { exsheets-solution-name } } - } +\RequirePackage { translations } +% translation for the exercises +\DeclareTranslationFallback { exsheets-exercise-name } { Exercise } +\DeclareTranslation { English } { exsheets-exercise-name } { Exercise } +\DeclareTranslation { British } { exsheets-exercise-name } { Exercise } +\DeclareTranslation { American } { exsheets-exercise-name } { Exercise } +\DeclareTranslation { French } { exsheets-exercise-name } { Exercise } +\DeclareTranslation { German } { exsheets-exercise-name } { \"Ubung } +\DeclareTranslation { Italian } { exsheets-exercise-name } { Esercizio } +\DeclareTranslation { Spanish } { exsheets-exercise-name } { Ejercicio } +\DeclareTranslation { Catalan } { exsheets-exercise-name } { Exercici } +\DeclareTranslation { Turkish } { exsheets-exercise-name } { Egzersiz } +\DeclareTranslation { Croatian } { exsheets-exercise-name } { Primjer } +\DeclareTranslation { Hungarian } { exsheets-exercise-name } { Gyakorol } +\DeclareTranslation { Danish } { exsheets-exercise-name } { \O{}velse } +\DeclareTranslation { Norsk } { exsheets-exercise-name } { Oppgave } +\DeclareTranslation { Portuges } { exsheets-exercise-name } { Exerc\'\i cio } +% translation for the question +\DeclareTranslationFallback { exsheets-question-name } { Question } +\DeclareTranslation { English } { exsheets-question-name } { Question } +\DeclareTranslation { British } { exsheets-question-name } { Question } +\DeclareTranslation { American } { exsheets-question-name } { Question } +\DeclareTranslation { French } { exsheets-question-name } { Question } +\DeclareTranslation { German } { exsheets-question-name } { Aufgabe } +\DeclareTranslation { Italian } { exsheets-question-name } { Questione } +\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 } +\DeclareTranslation { Hungarian } { exsheets-question-name } { Feladat } +\DeclareTranslation { Danish } { exsheets-question-name } { Opgave } +\DeclareTranslation { Norsk } { exsheets-question-name } { Oppgave } +\DeclareTranslation { Portuges } { exsheets-question-name } { Quest\~ao } +% translation for the solutions +\DeclareTranslationFallback { exsheets-solution-name } { Solution } +\DeclareTranslation { English } { exsheets-solution-name } { Solution } +\DeclareTranslation { British } { exsheets-solution-name } { Solution } +\DeclareTranslation { American } { exsheets-solution-name } { Solution } +\DeclareTranslation { French } { exsheets-solution-name } { Solution } +\DeclareTranslation { German } { exsheets-solution-name } { L\"osung } +\DeclareTranslation { Italian } { exsheets-solution-name } { Soluzione } +\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 } +\DeclareTranslation { Hungarian } { exsheets-solution-name } { Megold\'{a}s } +\DeclareTranslation { Danish } { exsheets-solution-name } { Opl\o{}sning } +\DeclareTranslation { Norsk } { exsheets-solution-name } { L\o{}sning } +\DeclareTranslation { Portuges } { exsheets-solution-name } { Solu\c c\~ao } +% the actual translating +\tl_set:Nn \l__exsheets_exercise_name_tl + { \GetTranslation { exsheets-exercise-name } } +\tl_set:Nn \l__exsheets_questions_name_tl + { \GetTranslation { exsheets-question-name } } +\tl_set:Nn \l__exsheets_solutions_name_tl + { \GetTranslation { exsheets-solution-name } } + % ---------------------------------------------------------------------------- % save total points in .aux file to make it available for \allpoints anywhere @@ -2700,6 +2726,12 @@ HISTORY: 2013/07/17 v0.9i - made \g__exsheets_total_bonus_fp and \g__exsheets_total_points_fp public - removed `translations' from the bundle +2013/10/11 v0.10 - require `translations' like any other package + - added `exsheets-listings' package + - added Norwegian translations + - changed horizontal spaces declared as `1ex' into + `.3333em' in the declarations of the headings + instances %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |