diff options
Diffstat (limited to 'Master/texmf-dist/tex')
5 files changed, 513 insertions, 315 deletions
diff --git a/Master/texmf-dist/tex/latex/exsheets/cntformats.sty b/Master/texmf-dist/tex/latex/exsheets/cntformats.sty index f97ca6147e0..cb2cccd2db0 100644 --- a/Master/texmf-dist/tex/latex/exsheets/cntformats.sty +++ b/Master/texmf-dist/tex/latex/exsheets/cntformats.sty @@ -9,7 +9,7 @@ % Web: https://bitbucket.org/cgnieder/exsheets/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2012 Clemens Niederberger +% Copyright 2012-2013 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -28,29 +28,23 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -\def\@cntfmts@date{2012/04/23} -\def\@cntfmts@version{v0.5} - -\ProvidesPackage{cntformats}[\@cntfmts@date\space \@cntfmts@version\space A different way to read counters.] -\RequirePackage{etoolbox} +\def\@cntfmts@date{2013/10/11} +\def\@cntfmts@version{v0.6} + +\ProvidesPackage{cntformats}[% + \@cntfmts@date\space + \@cntfmts@version\space + A different way to read counters. (CN)] +\RequirePackage{etoolbox,cnltx-base} % -------------------------------------------------------------------------- % message handling \def\@cntfmts@error@message{% For details have a look at the `exsheets' manual.} -\def\@cntfmts@create@message#1{% - \ifstrequal{#1}{Error} - {% - \lowercase{\csdef{@cntfmts@#1}}##1{% - \csuse{Package#1}{cntformats}{##1}{\@cntfmts@error@message}}% - }{% - \lowercase{\csdef{@cntfmts@#1}}##1{% - \csuse{Package#1}{cntformats}{##1}}% - }} -\@cntfmts@create@message{Error} -\@cntfmts@create@message{Warning} -\@cntfmts@create@message{WarningNoLine} -\@cntfmts@create@message{Info} +\cnltx@create@generic@message{@cntfmts}{cntformats}{Error}{\@cntfmts@error@message} +\cnltx@create@generic@message{@cntfmts}{cntformats}{Warning}{} +\cnltx@create@generic@message{@cntfmts}{cntformats}{WarningNoLine}{} +\cnltx@create@generic@message{@cntfmts}{cntformats}{Info}{} \def\@cntfmts@err@already@defined#1{% \@cntfmts@error{The counter `#1' already exists!}} @@ -66,91 +60,93 @@ % if you happen to read this code and notice some obvious reasons why these % macros shoudn't be used like this, please send me your improved version % (seriously! But please explain why yours is better) -\long\def\@cntfmts@ifintl#1#2{% - \def\@cntfmts@intl@tmpa##1#2{}% - \expandafter\if\expandafter\relax\expandafter - \detokenize\expandafter{\@cntfmts@intl@tmpa#1{}{}#2}\relax% - \expandafter\@secondoftwo - \else - \expandafter\@firstoftwo - \fi -} -\long\def\@cntfmts@ifintlcs#1{% - \expandafter\@cntfmts@ifintl\expandafter{#1}} - -\long\def\@cntfmts@replaceonceincs#1#2#3{% - \@cntfmts@ifintlcs#1{#2}% - {\@cntfmts@replace@once@incs#1{#2}{#3}}{}% -} -\long\def\@cntfmts@replace@once@incs#1#2#3{% - \def\@cntfmts@replo@tmpa##1#2##2\q@stop{% - \def#1{##1#3##2}}% - \expandafter\@cntfmts@replo@tmpa#1\q@stop -} - -\long\def\@cntfmts@replaceallin#1#2#3{% - \def\@cntfmts@repla@tmpa{#1}% - \@cntfmts@replaceonceincs\@cntfmts@repla@tmpa{#2}{#3}% - \@cntfmts@ifintlcs\@cntfmts@repla@tmpa{#2}% - {\expandafter\@cntfmts@replaceallin\expandafter{\@cntfmts@repla@tmpa}{#2}{#3}}% - {\expandonce\@cntfmts@repla@tmpa}% -} -\long\def\@cntfmts@replaceallincs#1#2#3{% - \@cntfmts@replaceonceincs#1{#2}{#3}% - \@cntfmts@ifintlcs#1{#2}{\@cntfmts@replaceallincs#1{#2}{#3}}{}% -} +% \long\def\@cntfmts@ifintl#1#2{% +% \def\@cntfmts@intl@tmpa##1#2{}% +% \expandafter\if\expandafter\relax\expandafter +% \detokenize\expandafter{\@cntfmts@intl@tmpa#1{}{}#2}\relax% +% \expandafter\@secondoftwo +% \else +% \expandafter\@firstoftwo +% \fi +% } +% \long\def\@cntfmts@ifintlcs#1{% +% \expandafter\@cntfmts@ifintl\expandafter{#1}} + +% \long\def\@cntfmts@replaceonceincs#1#2#3{% +% \@cntfmts@ifintlcs#1{#2}% +% {\@cntfmts@replace@once@incs#1{#2}{#3}}{}% +% } +% \long\def\@cntfmts@replace@once@incs#1#2#3{% +% \def\@cntfmts@replo@tmpa##1#2##2\q@stop{% +% \def#1{##1#3##2}}% +% \expandafter\@cntfmts@replo@tmpa#1\q@stop +% } + +% \long\def\@cntfmts@replaceallin#1#2#3{% +% \def\@cntfmts@repla@tmpa{#1}% +% \@cntfmts@replaceonceincs\@cntfmts@repla@tmpa{#2}{#3}% +% \@cntfmts@ifintlcs\@cntfmts@repla@tmpa{#2}% +% {\expandafter\@cntfmts@replaceallin\expandafter{\@cntfmts@repla@tmpa}{#2}{#3}}% +% {\expandonce\@cntfmts@repla@tmpa}% +% } +% \long\def\@cntfmts@replaceallincs#1#2#3{% +% \@cntfmts@replaceonceincs#1{#2}{#3}% +% \@cntfmts@ifintlcs#1{#2}{\@cntfmts@replaceallincs#1{#2}{#3}}{}% +% } % ---------------------------------------------------------------------------- % expansion tools % heavily inspired by expl3's \exp_args:N<spec> -- one might say: copied -\long\def\@cntfmts@getnextbraced#1#2#3{#2\@cntfmts@firstofone{#3{#1}}} -\long\def\@cntfmts@firstofone#1{#1} -\long\def\@cntfmts@braced@unexpanded#1\@cntfmts@firstofone#2#3{% - #1\@cntfmts@firstofone{#2{#3}}} -\long\def\@cntfmts@braced@expandedonce#1\@cntfmts@firstofone#2#3{% - \expandafter\@cntfmts@getnextbraced\expandafter{#3}{#1}{#2}} - -\long\def\@cntfmts@expand@first{% - \@cntfmts@braced@expandedonce - \@cntfmts@firstofone} - -\long\def\@cntfmts@expand@second{% - \@cntfmts@braced@unexpanded - \@cntfmts@braced@expandedonce - \@cntfmts@firstofone} - -\long\def\@cntfmts@expand@third{% - \@cntfmts@braced@unexpanded - \@cntfmts@braced@unexpanded - \@cntfmts@braced@expandedonce - \@cntfmts@firstofone} +% \long\def\@cntfmts@getnextbraced#1#2#3{#2\@cntfmts@firstofone{#3{#1}}} +% \long\def\@cntfmts@firstofone#1{#1} +% \long\def\@cntfmts@braced@unexpanded#1\@cntfmts@firstofone#2#3{% +% #1\@cntfmts@firstofone{#2{#3}}} +% \long\def\@cntfmts@braced@expandedonce#1\@cntfmts@firstofone#2#3{% +% \expandafter\@cntfmts@getnextbraced\expandafter{#3}{#1}{#2}} + +% \long\def\@cntfmts@expand@first{% +% \@cntfmts@braced@expandedonce +% \@cntfmts@firstofone} + +% \long\def\@cntfmts@expand@second{% +% \@cntfmts@braced@unexpanded +% \@cntfmts@braced@expandedonce +% \@cntfmts@firstofone} + +% \long\def\@cntfmts@expand@third{% +% \@cntfmts@braced@unexpanded +% \@cntfmts@braced@unexpanded +% \@cntfmts@braced@expandedonce +% \@cntfmts@firstofone} % ---------------------------------------------------------------------------- % expandable commands with optional argument (and no mandatory) % this is probably not very robust. If you know what you're doing you're -% probably able to define a better version yourself. If not, don't use it -\long\def\@cntfmts@isopt@#1[#2\q@marker#3#{% - \if\relax\detokenize{#1#2}\relax - \expandafter\@firstoftwo - \else - \expandafter\@secondoftwo - \fi} -\long\def\@cntfmts@isopt#1#2#3{% - \@cntfmts@isopt@#1\q@marker[\q@marker{#2#1}{#2[{#3}]{#1}}} - -\long\def\@cntfmts@defwopt#1[#2]#3{% - \long\def#1##1{\@cntfmts@isopt{##1}{\csuse{\@cntfmts@strip@bs#1@opt}}{#2}}% - \long\csdef{\@cntfmts@strip@bs#1@opt}[##1]{#3}} - -\def\@cntfmts@strip@bs{\expandafter\@gobble\string} +% probably able to define a better version yourself. If not: don't use this +% one! +% \long\def\@cntfmts@isopt@#1[#2\q@marker#3#{% +% \if\relax\detokenize{#1#2}\relax +% \expandafter\@firstoftwo +% \else +% \expandafter\@secondoftwo +% \fi} +% \long\def\@cntfmts@isopt#1#2#3{% +% \@cntfmts@isopt@#1\q@marker[\q@marker{#2#1}{#2[{#3}]{#1}}} + +% \long\def\@cntfmts@defwopt#1[#2]#3{% +% \long\def#1##1{\@cntfmts@isopt{##1}{\csuse{\@cntfmts@strip@bs#1@opt}}{#2}}% +% \long\csdef{\@cntfmts@strip@bs#1@opt}[##1]{#3}} + +% \def\@cntfmts@strip@bs{\expandafter\@gobble\string} % ---------------------------------------------------------------------------- % #1: module % #2: counter \def\@cntfmts@def@counter@read#1#2#3{% - \@cntfmts@expand@second\csdef + \cnltx@expandargs(no)\csdef {@#1@read@#3@counter}% - {\csname @#1@read@#2@counter\endcsname}} + {\csname @#1@read@#2@counter\endcsname}% +} % create pattern for an existing counter: % #1: module @@ -168,13 +164,14 @@ \newcommand*\@cntfmts@add@counter@pattern@nostar[3][cntfmts]{% \@cntfmts@add@counter@pattern[#1]{#2}{#3}% - \@cntfmts@expand@third - \@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}} + \cnltx@expandargs(nno)\@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}% +} \newrobustcmd*\AddCounterPattern{% \@ifstar {\@cntfmts@add@counter@pattern} - {\@cntfmts@add@counter@pattern@nostar}} + {\@cntfmts@add@counter@pattern@nostar}% +} \@onlypreamble\AddCounterPattern % create pattern for a new counter @@ -191,13 +188,14 @@ \newcommand*\@cntfmts@new@counter@pattern@nostar[3][cntfmts]{% \@cntfmts@new@counter@pattern[#1]{#2}{#3}% - \@cntfmts@expand@third - \@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}} + \cnltx@expandargs(nno)\@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}% +} \newrobustcmd*\NewCounterPattern{% \@ifstar {\@cntfmts@new@counter@pattern} - {\@cntfmts@new@counter@pattern@nostar}} + {\@cntfmts@new@counter@pattern@nostar}% +} \@onlypreamble\NewCounterPattern % renew pattern: @@ -213,13 +211,14 @@ \newcommand*\@cntfmts@renew@counter@pattern@nostar[3][cntfmts]{% \@cntfmts@renew@counter@pattern[#1]{#2}{#3}% - \@cntfmts@expand@third - \@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}} + \cnltx@expandargs(nno)\@cntfmts@create@read@counter{#1}{#2}{\csname c@#2\endcsname}% +} \newrobustcmd\RenewCounterPattern{% \@ifstar {\@cntfmts@renew@counter@pattern} - {\@cntfmts@renew@counter@pattern@nostar}} + {\@cntfmts@renew@counter@pattern@nostar}% +} \@onlypreamble\RenewCounterPattern % ---------------------------------------------------------------------------- @@ -230,7 +229,8 @@ % #2: counter % #3: internal command \def\@cntfmts@create@read@counter#1#2#3{% - \expandafter\@cntfmts@defwopt\csname @#1@read@#2@counter\endcsname[]{% + \expandafter\newexpandablecmd + \expandafter*\csname @#1@read@#2@counter\endcsname[1][]{% \ifblank{##1} {\@arabic{#3}} {\csuse{@cntfmts@counter@type@##1}{#3}}% @@ -238,17 +238,20 @@ } \newrobustcmd*\ReadCounterFrom[3][cntfmts]{% - \@cntfmts@create@read@counter{#1}{#2}{#3}} + \@cntfmts@create@read@counter{#1}{#2}{#3}% +} % ---------------------------------------------------------------------------- % pattern formats % #1: key % #2: number presentation command like \@alph \def\@cntfmts@new@pattern@format#1#2{% - \csdef{@cntfmts@counter@type@#1}{#2}} + \csdef{@cntfmts@counter@type@#1}{#2}% +} \newrobustcmd*\NewPatternFormat[2]{% - \@cntfmts@new@pattern@format{#1}{#2}} + \@cntfmts@new@pattern@format{#1}{#2}% +} \@onlypreamble\NewPatternFormat % ---------------------------------------------------------------------------- @@ -257,21 +260,24 @@ % #2: list % #3: pattern \def\@cntfmts@read@counter@pattern#1#2#3{% - \def\@cntfmts@parsed@pattern{#3\relax}% + \def\@cntfmts@parsed@pattern{#3\@empty}% \forlistcsloop{\@cntfmts@replace@pattern{#1}}{#2}% } % #1: module % #2: pattern-key \def\@cntfmts@replace@pattern#1#2{% - \@cntfmts@replaceallincs\@cntfmts@parsed@pattern - {#2}{{}\csuse{@#1@read@#2@counter}}} + \cnltx@replace@all\@cntfmts@parsed@pattern + {#2}{\csuse{@#1@read@#2@counter}}% +} \newrobustcmd*\ReadCounterPattern[2][cntfmts]{% - \@cntfmts@read@counter@pattern{#1}{@#1@counter@ids}{#2}\@cntfmts@parsed@pattern} + \@cntfmts@read@counter@pattern{#1}{@#1@counter@ids}{#2}\@cntfmts@parsed@pattern +} \newrobustcmd*\ReadCounterPatternFrom[2][cntfmts]{% - \@cntfmts@expand@third\@cntfmts@read@counter@pattern{#1}{@#1@counter@ids}{#2}% - \@cntfmts@parsed@pattern} + \cnltx@expandargs(nno)\@cntfmts@read@counter@pattern{#1}{@#1@counter@ids}{#2}% + \@cntfmts@parsed@pattern +} % #1: save pattern in % #2: save interpretation in @@ -290,16 +296,20 @@ } \newrobustcmd*\SaveCounterPattern[4][cntfmts]{% - \@cntfmts@save@counter@pattern{#2}{#3}{#4}{#1}} + \@cntfmts@save@counter@pattern{#2}{#3}{#4}{#1}% +} \newrobustcmd*\SaveCounterPatternFrom[4][cntfmts]{% - \@cntfmts@expand@third\@cntfmts@save@counter@pattern{#2}{#3}{#4}{#1}} + \cnltx@expandargs(nno)\@cntfmts@save@counter@pattern{#2}{#3}{#4}{#1}% +} \newrobustcmd*\eSaveCounterPattern[4][cntfmts]{% - \@cntfmts@esave@counter@pattern{#2}{#3}{#4}{#1}} + \@cntfmts@esave@counter@pattern{#2}{#3}{#4}{#1}% +} \newrobustcmd*\eSaveCounterPatternFrom[4][cntfmts]{% - \@cntfmts@expand@third\@cntfmts@esave@counter@pattern{#2}{#3}{#4}{#1}} + \cnltx@expandargs(nno)\@cntfmts@esave@counter@pattern{#2}{#3}{#4}{#1}% +} % ---------------------------------------------------------------------------- % predefined formats and pattern @@ -333,4 +343,7 @@ from \the<ounter> to \c@<ounter> - rename tokenlist test macros to use cntformats' namespace -
\ No newline at end of file +2013/10/11 v0.6 - use my `cnltx-base' package for the programming tools it + provides; this allows to get rid of the artefacts in the + expanded patterns + diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty b/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty new file mode 100644 index 00000000000..6e27fa7c90c --- /dev/null +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets-listings.sty @@ -0,0 +1,146 @@ +% ---------------------------------------------------------------------------- +% the EXSHEETS-LISTINGS package +% +% Using listings with exsheets +% +% ---------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://bitbucket.org/cgnieder/exsheets/ +% E-Mail: contact@mychemistry.eu +% ---------------------------------------------------------------------------- +% Copyright 2011-2013 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% ---------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% ---------------------------------------------------------------------------- +\RequirePackage{exsheets,listings} +\def\exsheets@listings@date{2013/10/11} +\def\exsheets@listings@version{0.2} +% we need this loaded before expl3 syntax is activated: +\lst@RequireAspects{writefile} +\ProvidesExplPackage{exsheets-listings} + {\exsheets@listings@date} + {\exsheets@listings@version} + {listings in exsheets} + +% ---------------------------------------------------------------------------- +% variables: +\int_new:N \g__exsheets_listings_question_int +\int_new:N \g__exsheets_listings_solution_int + +\tl_new:N \l__exsheets_listings_question_pre_tl +\tl_new:N \l__exsheets_listings_question_post_tl +\tl_new:N \l__exsheets_listings_question_options_tl +\tl_new:N \l__exsheets_listings_question_code_tl +\tl_new:N \l__exsheets_listings_solution_pre_tl +\tl_new:N \l__exsheets_listings_solution_post_tl +\tl_new:N \l__exsheets_listings_solution_options_tl +\tl_new:N \l__exsheets_listings_solution_code_tl +\tl_new:N \l__exsheets_listings_question_points_tl + +% ---------------------------------------------------------------------------- +% listings style for questions and solutions: +\keys_define:nn { exsheets } + { + question / listings .tl_set:N = \l__exsheets_listings_question_code_tl , + solution / listings .tl_set:N = \l__exsheets_listings_solution_code_tl + } + +% ---------------------------------------------------------------------------- +% expansion help: +\cs_new:Npn \__exsheets_question_expandopt:Nnnnn #1#2#3#4#5 + { #1{#2}[#3]{#4}#5 } +\cs_generate_variant:Nn \__exsheets_question_expandopt:Nnnnn { NnVox } + +\cs_new:Npn \__exsheets_question_expand_opt_and_body:Nnnn #1#2#3#4 + { #1{#2}[#3]#4 } +\cs_generate_variant:Nn \__exsheets_question_expand_opt_and_body:Nnnn { NnVx } + +% ---------------------------------------------------------------------------- +% lstquestion environment: +\keys_define:nn { exsheets / listings / question } + { + pre .tl_set:N = \l__exsheets_listings_question_pre_tl , + post .tl_set:N = \l__exsheets_listings_question_post_tl , + options .tl_set:N = \l__exsheets_listings_question_options_tl , + points .tl_set:N = \l__exsheets_listings_question_points_tl , + listings .tl_set:N = \l__exsheets_listings_question_code_tl , + } + +\keys_define:nn { exsheets / listings / solution } + { + pre .tl_set:N = \l__exsheets_listings_solution_pre_tl , + post .tl_set:N = \l__exsheets_listings_solution_post_tl , + options .tl_set:N = \l__exsheets_listings_solution_options_tl , + listings .tl_set:N = \l__exsheets_listings_solution_code_tl , + } + +\cs_new:Npn \exsheets_listings_new_lstenvironment:nnnnnnn #1#2#3#4#5#6#7 + { + \lstnewenvironment{#2}[1][] + { + \keys_set:nn {exsheets/listings/question} {#1,#4,##1} + \int_gincr:N \g__exsheets_listings_question_int + \lst@BeginWriteFile + { \c_job_name_tl - ex \int_use:N\g__exsheets_listings_question_int .lst } + } + { + \lst@EndWriteFile + \__exsheets_question_expandopt:NnVox + \begin {#3} + \l__exsheets_listings_question_options_tl + { \l__exsheets_listings_question_points_tl } + { + \exp_not:V \l__exsheets_listings_question_pre_tl + \exp_not:N \lstinputlisting + [ \exp_not:V \l__exsheets_listings_question_code_tl ] + { \c_job_name_tl - ex \int_use:N\g__exsheets_listings_question_int .lst } + \exp_not:V \l__exsheets_listings_question_post_tl + } + \end {#3} + } + \lstnewenvironment{#5}[1][] + { + \keys_set:nn { exsheets / listings / solution } { #1,#7,##1 } + \int_gincr:N \g__exsheets_listings_solution_int + \lst@BeginWriteFile + { \c_job_name_tl - sol \int_use:N \g__exsheets_listings_solution_int . lst } + } + { + \lst@EndWriteFile + \__exsheets_question_expand_opt_and_body:NnVx + \begin {#6} + \l__exsheets_listings_solution_options_tl + { + \exp_not:V \l__exsheets_listings_solution_pre_tl + \exp_not:N \lstinputlisting + [ \exp_not:V \l__exsheets_listings_solution_code_tl ] + { \c_job_name_tl - sol \int_use:N \g__exsheets_listings_solution_int . lst } + \exp_not:V \l__exsheets_listings_solution_post_tl + } + \end {#6} + } + } + +\NewDocumentCommand \NewLstQuSolPair { O{}mmO{}mmO{} } + { \exsheets_listings_new_lstenvironment:nnnnnnn {#1}{#2}{#3}{#4}{#5}{#6}{#7} } + +\NewLstQuSolPair{lstquestion}{question}{lstsolution}{solution} + +\tex_endinput:D + +HISTORY +2013/09/18 v0.1 - first draft, see http://tex.stackexchange.com/a/133969/5049 +2013/10/11 v0.2 - first official version bundled with ExSheets 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg index 0db292f4be1..19f8ebfc137 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.cfg @@ -22,12 +22,6 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -% The exsheets package consists of the files -% - exsheets.sty, exsheets_headings.def, exsheets_headings.cfg, -% exsheets_tasks.def, exsheets_tasks.cfg, exsheets_configurations.cfg, -% - exsheets_en.tex, exsheets_en.pdf, -% - README -% -------------------------------------------------------------------------- % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- @@ -54,7 +48,7 @@ attach = { main[l,t] number[l,t] (0pt,0pt) } , join = { - number[r,b] title[l,b] (1ex,0pt) ; + number[r,b] title[l,b] (.333em,0pt) ; main[l,b] points[l,t] (1em,0pt) } } @@ -63,7 +57,7 @@ \DeclareInstance { exsheets-heading } { block-rev } { default } { toc-reversed = true , - join = { number[r,B] title[l,B] (1ex,0pt) } , + join = { number[r,B] title[l,B] (.333em,0pt) } , attach = { main[l,vc] number[l,vc] (0pt,0pt) ; @@ -71,6 +65,18 @@ } } +% BLOCK, SUBTITLE: +\DeclareInstance{exsheets-heading}{block-subtitle}{default}{ + join = { + title[r,B]number[l,B](.333em,0pt) ; + title[r,B]subtitle[l,B](1em,0pt) + } , + attach = { + main[l,vc]title[l,vc](0pt,0pt) ; + main[r,vc]points[l,vc](\marginparsep,0pt) + } +} + % BLOCK, POINTS WITH THE TITLE: \DeclareInstance { exsheets-heading } { block-wp } { default } { @@ -78,8 +84,8 @@ points-post-code = ) , join = { - title[r,B] number[l,B] (1ex,0pt) ; - title[r,B] points[l,B] (1ex,0pt) + title[r,B] number[l,B] (.333em,0pt) ; + title[r,B] points[l,B] (.333em,0pt) } , attach = { main[l,vc] title[l,vc] (0pt,0pt) } } @@ -92,8 +98,8 @@ points-post-code = ) , join = { - number[r,B] title[l,B] (1ex,0pt) ; - number[r,B] points[l,B] (1ex,0pt) + number[r,B] title[l,B] (.333em,0pt) ; + number[r,B] points[l,B] (.333em,0pt) } , attach = { main[l,vc] number[l,vc] (0pt,0pt) } } @@ -113,7 +119,7 @@ { points-pre-code = ( , points-post-code = ) , - join = { number[r,vc] points[l,vc] (1ex,0pt) } , + join = { number[r,vc] points[l,vc] (.333em,0pt) } , attach = { main[l,vc] number[l,vc] (0pt,0pt) } } @@ -128,7 +134,7 @@ join = { main[r,vc] number[r,vc] (0pt,0pt) ; - main[r,vc] title[l,vc] (1ex,0pt) + main[r,vc] title[l,vc] (.333em,0pt) } } @@ -141,8 +147,8 @@ join = { main[r,vc] title[r,vc] (0pt,0pt) ; - main[r,vc] number[l,vc] (1ex,0pt) ; - main[r,vc] points[l,vc] (1ex,0pt) + main[r,vc] number[l,vc] (.333em,0pt) ; + main[r,vc] points[l,vc] (.333em,0pt) } } @@ -156,8 +162,8 @@ join = { main[r,vc] number[r,vc] (0pt,0pt) ; - main[r,vc] title[l,vc] (1ex,0pt) ; - main[r,vc] points[l,vc] (1ex,0pt) + main[r,vc] title[l,vc] (.333em,0pt) ; + main[r,vc] points[l,vc] (.333em,0pt) } } @@ -180,7 +186,7 @@ join = { main[r,vc] number[l,vc] (0pt,0pt) ; - main[r,vc] points[l,vc] (1ex,0pt) + main[r,vc] points[l,vc] (.333em,0pt) } } @@ -235,7 +241,7 @@ % CENTERED: \DeclareInstance { exsheets-heading } { centered } { default } { - join = { title[r,B] number[l,B] (1ex,0pt) } , + join = { title[r,B] number[l,B] (.333em,0pt) } , attach = { main[hc,vc] title[hc,vc] (0pt,0pt) ; @@ -250,8 +256,8 @@ points-post-code = ) , join = { - title[r,B] number[l,B] (1ex,0pt) ; - title[r,B] points[l,B] (1ex,0pt) + title[r,B] number[l,B] (.333em,0pt) ; + title[r,B] points[l,B] (.333em,0pt) } , attach = { main[hc,vc] title[hc,vc] (0pt,0pt) } } @@ -263,7 +269,7 @@ number-post-code = \c_space_tl , points-pre-code = ( , points-post-code = ) \c_space_tl , - join = { title[r,b] number[l,b] (1ex,0pt) } , + join = { title[r,b] number[l,b] (.333em,0pt) } , attach = { main[l,vc] title[r,vc] (0pt,0pt) ; @@ -277,7 +283,7 @@ runin = true , attach = { - main[l,vc]number[r,vc](-1ex,0pt) ; + main[l,vc]number[r,vc](-.333em,0pt) ; main[r,vc]points[l,vc](\linewidth+\marginparsep,0pt) } } @@ -285,7 +291,7 @@ % RIGHT-ALIGNED: \DeclareInstance { exsheets-heading } { raggedleft } { default } { - join = { title[r,B] number[l,B] (1ex,0pt) } , + join = { title[r,B] number[l,B] (.333em,0pt) } , attach = { main[r,vc] title[r,vc] (0pt,0pt) ; @@ -298,7 +304,7 @@ { vscale = 2 , title-format = \Large\bfseries\sffamily , - join = { title[r,B] number[l,B] (1ex,0pt) } , + join = { title[r,B] number[l,B] (.333em,0pt) } , attach = { main[l,vc] title[l,vc] (0pt,0pt) ; @@ -317,7 +323,7 @@ title-format = \large\scshape\color{exsheetsred} , number-format = \large\bfseries\color{exsheetsblue} , points-format = \itshape , - join = { number[r,B] title[l,B] (1ex,0pt) } , + join = { number[r,B] title[l,B] (.333em,0pt) } , attach = { main[hc,vc] number[hc,vc] (0pt,0pt) ; @@ -340,10 +346,10 @@ points-post-code = ) , join = { - number[r,B] title[l,B] (1ex,0pt) ; - number[r,B] points[l,B] (1ex,0pt) + number[r,B] title[l,B] (.333em,0pt) ; + number[r,B] points[l,B] (.333em,0pt) } , attach = { main[hc,vc] number[hc,vc] (0pt,0pt) } } -\tex_endinput:D
\ No newline at end of file +\tex_endinput:D diff --git a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def index 637cde2cfd0..4d29d095776 100644 --- a/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def +++ b/Master/texmf-dist/tex/latex/exsheets/exsheets_headings.def @@ -22,12 +22,6 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -% The exsheets package consists of the files -% - exsheets.sty, exsheets_headings.def, exsheets_headings.cfg, -% exsheets_tasks.def, exsheets_tasks.cfg, exsheets_configurations.cfg, -% - exsheets_en.tex, exsheets_en.pdf, -% - README -% -------------------------------------------------------------------------- % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- @@ -42,7 +36,7 @@ \coffin_new:N \l__exsheets_heading_title_coffin \coffin_new:N \l__exsheets_heading_number_coffin \coffin_new:N \l__exsheets_heading_points_coffin -\coffin_new:N \l__exsheets_heading_meta_coffin +\coffin_new:N \l__exsheets_heading_subtitle_coffin % the object variables: \bool_new:N \l__exsheets_heading_runin_bool @@ -60,17 +54,21 @@ \tl_new:N \l__exsheets_heading_title_format_tl \tl_new:N \l__exsheets_heading_title_pre_code_tl +\tl_set:Nn \l__exsheets_heading_title_pre_code_tl { \use:n } \tl_new:N \l__exsheets_heading_title_post_code_tl \tl_new:N \l__exsheets_heading_number_format_tl \tl_new:N \l__exsheets_heading_number_pre_code_tl +\tl_set:Nn \l__exsheets_heading_number_pre_code_tl { \use:n } \tl_new:N \l__exsheets_heading_number_post_code_tl -\tl_new:N \l__exsheets_heading_meta_pre_code_tl -\tl_new:N \l__exsheets_heading_meta_post_code_tl +\tl_new:N \l__exsheets_heading_subtitle_pre_code_tl +\tl_set:Nn \l__exsheets_heading_subtitle_pre_code_tl { \use:n } +\tl_new:N \l__exsheets_heading_subtitle_post_code_tl \tl_new:N \l__exsheets_heading_points_format_tl \tl_new:N \l__exsheets_heading_points_pre_code_tl +\tl_set:Nn \l__exsheets_heading_points_pre_code_tl { \use:n } \tl_new:N \l__exsheets_heading_points_post_code_tl \tl_new:N \l__exsheets_heading_points_post_hook_tl @@ -146,62 +144,63 @@ % #2 = number, % #3 = points % #4 = bonus -\DeclareObjectType { exsheets-heading } { 4 } +% #5 = id +\DeclareObjectType { exsheets-heading } { 5 } % the `default' template interface: -\DeclareTemplateInterface { exsheets-heading } { default } { 4 } +\DeclareTemplateInterface { exsheets-heading } { default } { 5 } { - inline : boolean = false , - runin : boolean = false , - indent-first : boolean = false , - toc-reversed : boolean = false , - vscale : real = 1 , - above : length = 2pt , - below : length = 2pt , - main : tokenlist = , - pre-code : tokenlist = , - post-code : tokenlist = , - title-format : tokenlist = , - title-pre-code : tokenlist = , - title-post-code : tokenlist = , - number-format : tokenlist = , - number-pre-code : tokenlist = , - number-post-code : tokenlist = , - meta-pre-code : tokenlist = , - meta-post-code : tokenlist = , - points-format : tokenlist = , - points-pre-code : tokenlist = , - points-post-code : tokenlist = , - join : tokenlist = , - attach : tokenlist = + inline : boolean = false , + runin : boolean = false , + indent-first : boolean = false , + toc-reversed : boolean = false , + vscale : real = 1 , + above : length = 2pt , + below : length = 2pt , + main : tokenlist = , + pre-code : tokenlist = , + post-code : tokenlist = , + title-format : tokenlist = , + title-pre-code : tokenlist = , + title-post-code : tokenlist = , + number-format : tokenlist = , + number-pre-code : tokenlist = , + number-post-code : tokenlist = , + subtitle-pre-code : tokenlist = , + subtitle-post-code : tokenlist = , + points-format : tokenlist = , + points-pre-code : tokenlist = , + points-post-code : tokenlist = , + join : tokenlist = , + attach : tokenlist = } % the `default' template code: -\DeclareTemplateCode { exsheets-heading } { default } { 4 } +\DeclareTemplateCode { exsheets-heading } { default } { 5 } { - inline = \l__exsheets_heading_inline_bool , - runin = \l__exsheets_heading_runin_bool , - indent-first = \l__exsheets_heading_indent_first_bool , - toc-reversed = \l__exsheets_heading_toc_reversed_bool , - vscale = \l__exsheets_heading_scale_fp , - above = \l__exsheets_heading_above_dim , - below = \l__exsheets_heading_below_dim , - main = \l__exsheets_heading_main_tl , - pre-code = \l__exsheets_heading_pre_code_tl , - post-code = \l__exsheets_heading_post_code_tl , - title-format = \l__exsheets_heading_title_format_tl , - title-pre-code = \l__exsheets_heading_title_pre_code_tl , - title-post-code = \l__exsheets_heading_title_post_code_tl , - number-format = \l__exsheets_heading_number_format_tl , - number-pre-code = \l__exsheets_heading_number_pre_code_tl , - number-post-code = \l__exsheets_heading_number_post_code_tl , - meta-pre-code = \l__exsheets_heading_meta_pre_code_tl , - meta-post-code = \l__exsheets_heading_meta_post_code_tl , - points-format = \l__exsheets_heading_points_format_tl , - points-pre-code = \l__exsheets_heading_points_pre_code_tl , - points-post-code = \l__exsheets_heading_points_post_code_tl , - join = \l__exsheets_heading_joined_coffins_tl , - attach = \l__exsheets_heading_attached_coffins_tl + inline = \l__exsheets_heading_inline_bool , + runin = \l__exsheets_heading_runin_bool , + indent-first = \l__exsheets_heading_indent_first_bool , + toc-reversed = \l__exsheets_heading_toc_reversed_bool , + vscale = \l__exsheets_heading_scale_fp , + above = \l__exsheets_heading_above_dim , + below = \l__exsheets_heading_below_dim , + main = \l__exsheets_heading_main_tl , + pre-code = \l__exsheets_heading_pre_code_tl , + post-code = \l__exsheets_heading_post_code_tl , + title-format = \l__exsheets_heading_title_format_tl , + title-pre-code = \l__exsheets_heading_title_pre_code_tl , + title-post-code = \l__exsheets_heading_title_post_code_tl , + number-format = \l__exsheets_heading_number_format_tl , + number-pre-code = \l__exsheets_heading_number_pre_code_tl , + number-post-code = \l__exsheets_heading_number_post_code_tl , + subtitle-pre-code = \l__exsheets_heading_subtitle_pre_code_tl , + subtitle-post-code = \l__exsheets_heading_subtitle_post_code_tl , + points-format = \l__exsheets_heading_points_format_tl , + points-pre-code = \l__exsheets_heading_points_pre_code_tl , + points-post-code = \l__exsheets_heading_points_post_code_tl , + join = \l__exsheets_heading_joined_coffins_tl , + attach = \l__exsheets_heading_attached_coffins_tl } { \AssignTemplateKeys @@ -247,7 +246,7 @@ \tl_use:N \l__exsheets_heading_title_format_tl \strut \tl_use:N \l__exsheets_heading_title_pre_code_tl - { \tl_use:N \l__exsheets_heading_title_user_format_tl #1 } + { \tl_use:N \l_exsheets_heading_title_user_format_tl #1 } \tl_use:N \l__exsheets_heading_title_post_code_tl } \hcoffin_set:Nn \l__exsheets_heading_number_coffin @@ -257,28 +256,29 @@ { \tl_use:N \l__exsheets_heading_number_format_tl } \strut \tl_use:N \l__exsheets_heading_number_pre_code_tl - { \tl_use:N \l__exsheets_heading_title_user_format_tl #2 } + { \tl_use:N \l_exsheets_heading_title_user_format_tl #2 } \tl_use:N \l__exsheets_heading_number_post_code_tl } - % TODO: if questions are included via \includequestions - % \g__exsheets_questions_current_id_tl doesn't hold the current ID any - % more when the questions are typeset - \hcoffin_set:Nn \l__exsheets_heading_meta_coffin + \hcoffin_set:Nn \l__exsheets_heading_subtitle_coffin { - \prop_get:NoNT \g__exsheets_questions_meta_prop - { \g__exsheets_questions_current_id_tl } - \l__exsheets_questions_meta_tl + \prop_get:NnNT \g__exsheets_questions_subtitle_prop + { #5 } + \l__exsheets_questions_subtitle_tl { - \tl_use:N \l__exsheets_heading_meta_pre_code_tl - \tl_use:N \l__exsheets_questions_meta_tl - \tl_use:N \l__exsheets_heading_meta_post_code_tl + \tl_use:N \l__exsheets_heading_subtitle_pre_code_tl + { + \tl_use:N \l_exsheets_subtitle_format_tl + \tl_use:N \l__exsheets_questions_subtitle_tl + } + \tl_use:N \l__exsheets_heading_subtitle_post_code_tl } } \hcoffin_set:Nn \l__exsheets_heading_points_coffin { \bool_if:NTF \l__exsheets_parse_points_bool { - \bool_if:nF { \fp_compare_p:n { #3 = 0 } && \fp_compare_p:n { #4 = 0 } } + \bool_if:nF + { \fp_compare_p:n { #3 = 0 } && \fp_compare_p:n { #4 = 0 } } { \tl_use:N \l__exsheets_heading_points_format_tl \group_begin: @@ -296,7 +296,8 @@ { \exsheets_print_points:n { #3 } } { \exsheets_parse_points:n { #3 } } } - \bool_if:nT { !\fp_compare_p:n { #3 = 0 } && !\fp_compare_p:n { #4 = 0 } } + \bool_if:nT + { !\fp_compare_p:n { #3 = 0 } && !\fp_compare_p:n { #4 = 0 } } { ~ } \fp_compare:nF { #4 = 0 } { |