diff options
author | Karl Berry <karl@freefriends.org> | 2012-12-20 00:32:28 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-12-20 00:32:28 +0000 |
commit | 1101a024b69c93fcaa6ccad896013394b1f806d5 (patch) | |
tree | 5100de70e1a7f5e5b59f4c156ed3ede611b5b0dc /Master/texmf-dist/tex/latex/exsheets | |
parent | 739063891a32d329e0abff276ba180a8a8bdfa2e (diff) |
exsheets (19dec12)
git-svn-id: svn://tug.org/texlive/trunk@28583 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/exsheets')
-rw-r--r-- | Master/texmf-dist/tex/latex/exsheets/exsheets.sty | 169 |
1 files changed, 136 insertions, 33 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets.sty index 772c760b610..0aac0c3bf6f 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/12/06} -\def\exsheets@version{0.5a} +\def\exsheets@date{2012/12/18} +\def\exsheets@version{0.6} \RequirePackage { expl3 , xparse } \ProvidesExplPackage @@ -99,6 +99,18 @@ `points/parse=false'. } +\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 } + { + You~must~choose~an~integer~between~`1'~and~`#1'.~You~chose~`#2'~hence~ + I'm~doing~nothing. + } + \cs_new:Npn \exsheets_depr_cmd:nn #1#2 { \cs_new:Npn #1 @@ -511,7 +523,89 @@ } % ---------------------------------------------------------------------------- -% Noten-Verteilung +% variations of an exam, see http://tex.stackexchange.com/q/57012/5049 for +% inspiration of the following features +\int_zero_new:N \l__exsheets_variations_int + +\cs_new:Npn \exsheets_set_variations:n #1 + { + \int_compare:nNnTF { #1 } < { 2 } + { \msg_warning:nnn { exsheets } { variations } { #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 } + { + \int_incr:N \l__exsheets_tmpa_int + \__exsheets_generate_variation_auxiliary:n + { \l__exsheets_tmpa_int } + \__exsheets_reset_variation_auxiliary:x + { \int_use:N \l__exsheets_tmpa_int } + } + \__exsheets_generate_variation_auxiliary:n + { \l__exsheets_variations_int + 1 } + \exsheets_variant:n { 1 } + } + } + +\cs_new:Npn \exsheets_variant:n #1 + { + \bool_if:nTF + { + \int_compare_p:nNn { #1 } > { 0 } && + \int_compare_p:nNn { #1 } < { \l__exsheets_variations_int + 1 } + } + { + \int_zero:N \l__exsheets_tmpa_int + \int_do_while:nNnn + { \l__exsheets_tmpa_int } < { \l__exsheets_variations_int } + { + \int_incr:N \l__exsheets_tmpa_int + \__exsheets_reset_variation_auxiliary:x + { \int_use:N \l__exsheets_tmpa_int } + } + \cs_set:cpn { __exsheets_variation_ \int_to_roman:n { #1 } :n } ##1 + { ##1 \use:c { __exsheets_variation_ \int_to_roman:n { #1 + 1 } :n } } + } + { + \msg_warning:nnxx { exsheets } { variant } + { \int_use:N \l__exsheets_variations_int } { #1 } + } + } + +\cs_new:Npn \exsheets_vary:w + { \__exsheets_variation_i:n } + +\cs_new: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_new:Npn \__exsheets_reset_variation_auxiliary: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 } } + +\NewDocumentCommand \variant { m } + { \exsheets_variant:n { #1 } } + +\NewDocumentCommand \vary { } + { \exsheets_vary:w } + +% initiate: two variations, first is default +\SetVariations { 2 } +\variant { 1 } + +% ---------------------------------------------------------------------------- +% grades distribution \prop_new:N \l__exsheets_relgrades_prop \fp_new:N \l__exsheets_grade_round_fp \fp_zero:N \l__exsheets_grade_round_fp @@ -2116,38 +2210,44 @@ { \RequirePackage { translations } % translation for the exercises - \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 } { Exercir } - \DeclareTranslation { Turkish } { exsheets-exercise-name } { Egzersiz } - \DeclareTranslation { Croatian } { exsheets-exercise-name } { Primjer } + \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 } % translation for the 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 { 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 } % translation for the solutions - \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 { 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 } % the actual translating \tl_set:Nn \l__exsheets_exsheets_name_tl { \GetTranslation { exsheets-exercise-name } } @@ -2252,6 +2352,9 @@ HISTORY: 2012/12/02 v0.5 - added \CurrentQuestionID 2012/12/06 v0.5a - bug fix: solutions had wrong numbers with counter-format=se.qu and [print] option +2012/12/18 v0.6 - variations, Hungarian translations, corrected Catalanian + translations + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % TODO: |