diff options
| author | Frank Fuhlbrück | 2019-02-11 14:29:48 +0100 |
|---|---|---|
| committer | Frank Fuhlbrück | 2019-02-11 14:29:48 +0100 |
| commit | f631c2775b7dbc3df0f4e5a8157f1e7874f66eff (patch) | |
| tree | 7f4d73728202f1054e09c77f91a85abccf760a1d /exercisesheets.sty | |
| parent | d37de423d8f280b26acac10c8141df9c4e2a730d (diff) | |
| download | exercisesheets-f631c2775b7dbc3df0f4e5a8157f1e7874f66eff.tar.gz exercisesheets-f631c2775b7dbc3df0f4e5a8157f1e7874f66eff.tar.bz2 exercisesheets-f631c2775b7dbc3df0f4e5a8157f1e7874f66eff.zip | |
custom page handling(instead of fixed \clearpage), custom skipping
Diffstat (limited to 'exercisesheets.sty')
| -rw-r--r-- | exercisesheets.sty | 60 |
1 files changed, 54 insertions, 6 deletions
diff --git a/exercisesheets.sty b/exercisesheets.sty index 7e6bac8..7038d00 100644 --- a/exercisesheets.sty +++ b/exercisesheets.sty @@ -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.5k} -\def\exsh@date{2017/12/11} +\def\exsh@version{0.6} +\def\exsh@date{2019/2/11} \ProvidesPackage{exercisesheets}[\exsh@date\space\exsh@version\space Typesetting of exercise sheets] \message{`Typesetting of exercise sheets' \exsh@version\space <\exsh@date>} @@ -48,6 +48,8 @@ \newif\ifexsh@oralsolutions \newif\ifexsh@nonoralsolutions \newif\ifexsh@samplesolutions +\newif\ifexsh@forcesample %force printing sample sol. of wrong type +\newif\ifexsh@gradingguides \newif\ifexsh@inplace \newif\ifexsh@sample \newif\ifexsh@hide%currently only set via sample in exercise env. @@ -65,6 +67,10 @@ solutions/sample all/.code=\exsh@solutionstrue\exsh@oralsolutionstrue\exsh@nonoralsolutionstrue\exsh@samplesolutionstrue, solutions/false/.code=\exsh@solutionsfalse\exsh@oralsolutionsfalse\exsh@nonoralsolutionsfalse, solutions/.default=true, + forcesample/.is if=exsh@forcesample, + forcesample/.default=true, + gradingguides/.is if=exsh@gradingguides, + gradingguides/.default=true, only/.initial={-}, all/.style={/exsh/only={-}},all/.value forbidden, solutionsby/.code={\def\exsh@solutionsby{#1}},solutionsby/.value required, @@ -126,6 +132,7 @@ % % additional exercise info name/.initial={}, + forcesample/.initial={false}, firstline/.initial={}, points/.initial={}, oral/.style={/exsh/points=oral},oral/.value forbidden, @@ -145,12 +152,14 @@ optional/.value forbidden, exercisemark/.initial={}, difficult/.style={/exsh/exercisemark=*},difficult/.value forbidden, + custom skip macro/.initial=\exsh@skipcustomstuff, % % translatable strings strings/sheet/.initial={}, strings/sheets/.initial={}, strings/solutions/.initial={}, strings/solutionsby/.initial={}, + strings/gradingguide/.initial={}, strings/exercise/.initial={}, strings/solution/.initial={}, strings/idea/.initial={}, @@ -174,6 +183,7 @@ \exsh@deforprovide{/exsh/strings/sheets} {\"Ubungsbl\"atter}% \exsh@deforprovide{/exsh/strings/solutions} {L\"osungsvorschl\"age}% \exsh@deforprovide{/exsh/strings/solutionsby} {L\"osungen von}% + \exsh@deforprovide{/exsh/strings/gradingguide}{Bepunktung}% \exsh@deforprovide{/exsh/strings/exercise} {Aufgabe}% \exsh@deforprovide{/exsh/strings/solution} {L\"osung}% \exsh@deforprovide{/exsh/strings/idea} {L\"osungsidee}% @@ -196,6 +206,7 @@ \exsh@deforprovide{/exsh/strings/sheets} {Exercise Sheets}% \exsh@deforprovide{/exsh/strings/solutions} {Suggested Solutions}% \exsh@deforprovide{/exsh/strings/solutionsby} {Solutions by}% + \exsh@deforprovide{/exsh/strings/gradingguide}{Grading guideline}% \exsh@deforprovide{/exsh/strings/exercise} {Exercise}% \exsh@deforprovide{/exsh/strings/solution} {Solution}% \exsh@deforprovide{/exsh/strings/idea} {Idea for solution}% @@ -243,6 +254,7 @@ hint title font/.initial=\itshape, solution font/.initial={}, solution title font/.initial=\bfseries, + grading guide font/.initial=\itshape, todo marker font/.initial=\ifdef{\color}{\color{red}}{}\bfseries, % % skip values @@ -255,6 +267,10 @@ above solution skip/.initial={1ex}, above hint skip/.initial={1ex}, % + % page handling + sheet start page action/.initial={\clearpage}, + sheet end page action/.initial={\clearpage}, + % % conditionals ifsolutions/.code 2 args={\ifsolutions{\pgfkeysalso{#1}}{\pgfkeysalso{#2}}}, iforalsolutions/.code 2 args={\iforalsolutions{\pgfkeysalso{#1}}{\pgfkeysalso{#2}}}, @@ -427,9 +443,9 @@ } \newcounter{sheetid}% only used to disambiguate hyperref labels \newenvironment{sheet}[1][]{% - \clearpage - \stepcounter{sheetid}% \pgfkeys{exsh,every sheet,#1}% + \pgfkeysvalueof{/exsh/sheet start page action}% + \stepcounter{sheetid}% \ifthenelse{\equal{}{\pgfkeysvalueof{/exsh/title}}}{% \numdef\exsh@tmp{\value{part}+1}% \edef\exsh@temp{\expandonce{\pgfkeysvalueof{/exsh/strings/sheet}}\noexpand~\exsh@tmp}% @@ -455,7 +471,7 @@ \par \begingroup \ifnum\value{page}=1\thispagestyle{empty}\fi - \clearpage + \pgfkeysvalueof{/exsh/sheet end page action}% \endgroup } \listadd{\exsh@enums}{enumerate} @@ -481,8 +497,10 @@ \ifstrequal{#1}{\exsh@skipstuff@endfile}{\currfile@pop\exsh@skipstuff}{% \ifstrequal{#1}{\setcounter}{\expandafter\exsh@skipstuff\setcounter}{% \ifstrequal{#1}{\item}{\ifdef{\@enumctr}{\@hyper@itemtrue\refstepcounter{\@enumctr}}{}}{}% - \exsh@skipstuff}}}}}}% + \pgfkeysvalueof{/exsh/custom skip macro}{#1}}}}}}}% } +\let\exshskipcontinue\exsh@skipstuff +\long\def\exsh@skipcustomstuff#1{\exshskipcontinue} \def\exsh@skipstuff@end#1{% \expandafter\ifstrequal\expandafter{\exsh@skipwhat}{#1}{% \expandafter\end\expandafter{\exsh@skipwhat}% @@ -741,6 +759,11 @@ \let\next\exsh@skipsolution }% }% + \ifbool{exsh@forcesample}{% + \ifbool{exsh@samplesolutions}{% + \let\next\exsh@startsolution + }{}% + }{}% \next }{% \ifthenelse{\equal{oral}{\pgfkeysvalueof{/exsh/points}}}{% @@ -817,6 +840,31 @@ \ignorespaces } +\newenvironment{gradingguide}[1][]{% + \pgfkeys{exsh,#1,grading guide font}% + \ifbool{exsh@gradingguides}{% + \let\next\exsh@startguide + }{% + \let\next\exsh@skipguide + }% + \next +}{} + +\def\exsh@startguide{\@afterindentfalse + \linebreak + {\parindent \z@ + \pgfkeysvalueof{/exsh/strings/gradingguide}: }\nobreak% + \@afterheading +}% + +\long\def\exsh@skipguide#1{% + \ifstrequal{#1}{\end}{\exsh@endguide}{\exsh@skipguide}% +} +\def\exsh@endguide#1{% + \ifstrequal{#1}{gradingguide}{\end{gradingguide}}{\exsh@skipguide}% +} + + \ifluatex% \ifdefined\luatextextdir \def\exsh@putatend#1{% |
