diff options
Diffstat (limited to 'exercisesheets-beamer.sty')
| -rw-r--r-- | exercisesheets-beamer.sty | 89 |
1 files changed, 66 insertions, 23 deletions
diff --git a/exercisesheets-beamer.sty b/exercisesheets-beamer.sty index d1dafab..e901c34 100644 --- a/exercisesheets-beamer.sty +++ b/exercisesheets-beamer.sty @@ -1,5 +1,5 @@ %% exercisesheets-beamer.sty -%% Copyright 2008-2020 Sebastian Kuhnert, Frank Fuhlbrück +%% Copyright 2008-2022 Sebastian Kuhnert, Frank Fuhlbrück % % This work may be distributed and/or modified under the conditions % of the LaTeX Project Public License, either version 1.3c of this @@ -10,7 +10,7 @@ % % This work has the LPPL maintenance status `maintained'. % -% The Current Maintainer of this work is Sebastian Kuhnert. +% The Current Maintainer of this work is Frank Fuhlbrück. % % This work consists of the files listed in README. @@ -18,8 +18,8 @@ %\NeedsTeXFormat{LaTeX2e}[1994/12/01] % don't forget to update the version and date in exercisesheets.tex -\def\exsh@version{0.9-Beamer} -\def\exsh@date{2021/12/07} +\def\exsh@version{0.10-Beamer} +\def\exsh@date{2022/01/12} \ProvidesPackage{exercisesheets-beamer}[\exsh@date\space\exsh@version\space Typesetting of exercise sheets] \message{`Typesetting of exercise sheets' \exsh@version\space <\exsh@date>} @@ -27,7 +27,7 @@ % TODO: fix "above hint skip" -\RequirePackage{etoolbox}[2008/06/28] +\RequirePackage{etoolbox}%[2008/06/28] \RequirePackage{scrlfile} \RequirePackage{environ} @@ -45,10 +45,12 @@ % configuration keys +\newif\ifexsh@patchenumerate\exsh@patchenumeratetrue \newif\ifexsh@solutions \newif\ifexsh@oralsolutions \newif\ifexsh@nonoralsolutions \newif\ifexsh@samplesolutions +\newif\ifexsh@exnumsheet \newif\ifexsh@forcesample %force printing sample sol. of wrong type \newif\ifexsh@beamerwithheadline \newif\ifexsh@beamersolution @@ -76,6 +78,8 @@ } \pgfkeys{/exsh/.is family,/exsh, + patchenumerate/.is if=exsh@patchenumerate, + patchenumerate/.default=true, solutions/.is choice, solutions/true/.code=\exsh@solutionstrue\exsh@oralsolutionstrue\exsh@nonoralsolutionstrue, solutions/oral/.code=\exsh@solutionstrue\exsh@oralsolutionstrue\exsh@nonoralsolutionsfalse, @@ -85,6 +89,8 @@ solutions/sample all/.code=\exsh@solutionstrue\exsh@oralsolutionstrue\exsh@nonoralsolutionstrue\exsh@samplesolutionstrue, solutions/false/.code=\exsh@solutionsfalse\exsh@oralsolutionsfalse\exsh@nonoralsolutionsfalse, solutions/.default=true, + number within sheet/.is if=exsh@exnumsheet, + number within sheet/.default=true, forcesample/.is if=exsh@forcesample, forcesample/.default=true, filenameasexercisename/.is if=exsh@filenameasexercisename, @@ -166,11 +172,18 @@ } \pgfkeys{exsh, + %general package options + patchenumerate/.initial=true, + custom skip macro/.initial=\exsh@skipcustomstuff, + showtodos/.initial={false}, + hidetodos/.style={/exsh/showtodos=false}, + hidetodos/.value forbidden, % additional sheet info title/.initial={}, date/.initial={}, note/.initial={}, exauthor/.initial={\exsh@author}, + number within sheet/.initial={false}, % % additional exercise info name/.initial={}, @@ -199,10 +212,6 @@ optional/.value forbidden, exercisemark/.initial={}, difficult/.style={/exsh/exercisemark=*},difficult/.value forbidden, - custom skip macro/.initial=\exsh@skipcustomstuff, - showtodos/.initial={false}, - hidetodos/.style={/exsh/showtodos=false}, - hidetodos/.value forbidden, % % translatable strings strings/sheet/.initial={}, @@ -503,8 +512,11 @@ \def\thepage{\arabic{part}-\arabic{page}}% }{% \def\thepage{\arabic{page}}% - \setcounter{section}{0}% }% + \ifexsh@exnumsheet + \edef\exsh@exnumstore{\arabic{section}} + \setcounter{section}{0}% + \fi \numdef\exsh@tmp{\value{part}+1}% \exsh@checkrange{\exsh@tmp}% \ifexsh@isinrange @@ -523,6 +535,9 @@ \ifnum\value{page}=1\thispagestyle{empty}\fi \pgfkeysvalueof{/exsh/sheet end page action}% \endgroup + \ifexsh@exnumsheet + \setcounter{section}{\exsh@exnumstore}% + \fi } \listadd{\exsh@enums}{enumerate} \listadd{\exsh@enums}{compactenum} @@ -829,8 +844,18 @@ \setbeamercolor{block body}{bg=bg,fg=fg} \block{}{\pgfkeysvalueof{/exsh/exercise title font}{#2}}\endblock \endgroup - \setbeamertemplate{enumerate items}{\insertenumlabel} - \renewcommand{\insertenumlabel}{\alph{enumi})} + \ifexsh@patchenumerate + \setbeamertemplate{enumerate items}{\insertenumlabel} + \renewcommand{\insertenumlabel}{ + \ifnum\@enumdepth=1 + \alph{enumi}) + \else\ifnum\@enumdepth=2 + \arabic{enumii}. + \else + \roman{enumiii} + \fi\fi + } + \fi }% @@ -870,18 +895,36 @@ \AfterPackage*{varioref}{ \labelformat{section}{\pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}} - \labelformat{enumi}{\arabic{section}.\alph{enumi}} } -\AfterPackage*{paralist}{ - \setdefaultenum{(a)}{(1)}{i.}{A.} -} -\AfterPackage*{enumitem}{ - \setenumerate[1]{label=(\alph*)} - \setenumerate[2]{label=(\arabic*)} - \setenumerate[3]{label=\roman*.} - \setenumerate[4]{label=\Alph.} -} -\def\theHenumi{enumi.\arabic{part}.\arabic{section}.\arabic{enumi}} + +\ifexsh@patchenumerate + \AfterPackage*{varioref}{ + \labelformat{enumi}{\arabic{section}.\alph{enumi}} + } + \AfterPackage*{paralist}{ + \setdefaultenum{(a)}{(1)}{i.}{A.} + } + \AfterPackage*{enumitem}{ + \setenumerate[1]{label=(\alph*)} + \setenumerate[2]{label=(\arabic*)} + \setenumerate[3]{label=\roman*.} + \setenumerate[4]{label=\Alph.} + } + \def\theHenumi{enumi.\arabic{part}.\arabic{section}.\arabic{enumi}} + \AtEndPreamble{% + \@ifpackageloaded{paralist}{}{% + \@ifpackageloaded{enumitem}{}{% + \apptocmd{\enumerate}{ + \ifnum\@enumdepth=1% + \def\labelenumi{(\alph{enumi})} + \def\labelenumii{\arabic{enumii}.} + \def\labelenumiii{\roman{enumiii}.} + \fi + }{}{}% + }% + }% + }% +\fi % reset equation numbering for each exercise \@addtoreset{equation}{section} |
