aboutsummaryrefslogtreecommitdiff
path: root/exercisesheets.sty
diff options
context:
space:
mode:
authorFrank Fuhlbrück2022-01-12 18:17:14 +0100
committerFrank Fuhlbrück2022-01-12 18:17:14 +0100
commit55041ec46666f0f40366c4c4b4ff68e7bf97eead (patch)
tree46e12c0975cd5072749fc66ddfc1d0fffacd8fa6 /exercisesheets.sty
parent61c4c1776a667a4952e8f9817d545c55e50b8009 (diff)
downloadexercisesheets-55041ec46666f0f40366c4c4b4ff68e7bf97eead.tar.gz
exercisesheets-55041ec46666f0f40366c4c4b4ff68e7bf97eead.tar.bz2
exercisesheets-55041ec46666f0f40366c4c4b4ff68e7bf97eead.zip
v 0.10 - make some special behavior optional
Diffstat (limited to 'exercisesheets.sty')
-rw-r--r--exercisesheets.sty73
1 files changed, 53 insertions, 20 deletions
diff --git a/exercisesheets.sty b/exercisesheets.sty
index 6af4ca1..2d8298d 100644
--- a/exercisesheets.sty
+++ b/exercisesheets.sty
@@ -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}
-\def\exsh@date{2021/12/07}
+\def\exsh@version{0.10}
+\def\exsh@date{2022/01/12}
\ProvidesPackage{exercisesheets}[\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{pgfkeys}
@@ -44,10 +44,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@gradingguides
\newif\ifexsh@inplace
@@ -92,6 +94,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,
@@ -101,6 +105,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,
gradingguides/.is if=exsh@gradingguides,
@@ -183,11 +189,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={},
@@ -212,10 +225,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={},
@@ -516,8 +525,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
@@ -536,6 +548,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}
@@ -879,18 +894,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}