diff options
| author | Frank Fuhlbrück | 2021-10-06 12:23:21 +0200 |
|---|---|---|
| committer | Frank Fuhlbrück | 2021-10-06 12:23:21 +0200 |
| commit | f3fecd9f8ba9c426544015305b24a11a2e8d9ec5 (patch) | |
| tree | f6707abdd9d2b00cbfd3e9feaadf1a6a9138fd49 | |
| parent | a27b39f67c8c7ccdd3e9470e4c510f9395da252f (diff) | |
| download | exercisesheets-f3fecd9f8ba9c426544015305b24a11a2e8d9ec5.tar.gz exercisesheets-f3fecd9f8ba9c426544015305b24a11a2e8d9ec5.tar.bz2 exercisesheets-f3fecd9f8ba9c426544015305b24a11a2e8d9ec5.zip | |
Option for enabling beamer headers
| -rw-r--r-- | exercisesheets-beamer.sty | 46 | ||||
| -rw-r--r-- | exercisesheets.sty | 80 |
2 files changed, 99 insertions, 27 deletions
diff --git a/exercisesheets-beamer.sty b/exercisesheets-beamer.sty index 4a2d64b..2508e89 100644 --- a/exercisesheets-beamer.sty +++ b/exercisesheets-beamer.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.7-Beamer} -\def\exsh@date{2020/10/14} +\def\exsh@version{0.8-Beamer} +\def\exsh@date{2021/10/06} \ProvidesPackage{exercisesheets-beamer}[\exsh@date\space\exsh@version\space Typesetting of exercise sheets] \message{`Typesetting of exercise sheets' \exsh@version\space <\exsh@date>} @@ -50,6 +50,7 @@ \newif\ifexsh@nonoralsolutions \newif\ifexsh@samplesolutions \newif\ifexsh@forcesample %force printing sample sol. of wrong type +\newif\ifexsh@beamerwithheadline \newif\ifexsh@beamersolution \newif\ifexsh@defersolutiontitle \newif\ifexsh@framed @@ -76,6 +77,8 @@ forcesample/.default=true, filenameasexercisename/.is if=exsh@filenameasexercisename, filenameasexercisename/.default=true, + beamerwithheadline/.is if=exsh@beamerwithheadline, + beamerwithheadline/.default=true, beamersolution/.is if=exsh@beamersolution, beamersolution/.default=true, defersolutiontitle/.is if=exsh@defersolutiontitle, @@ -156,6 +159,7 @@ name/.initial={}, forcesample/.initial={false}, beamersolution/.initial={false}, + beamerwithheadline/.initial={false}, defersolutiontitle/.initial={false}, framed/.initial={false}, firstline/.initial={}, @@ -1095,24 +1099,26 @@ \setbeamertemplate{headline}{% % \leavevmode% - \begin{beamercolorbox}[wd=\paperwidth,vmode]{frametitle} - \vspace{0.4em} - \leavevmode - \begingroup - \footnotesize% - \hspace*{2ex}{\pgfkeysvalueof{/exsh/subject font}% - \pgfkeysvalueof{/exsh/subject}} \hfill% - {\pgfkeysvalueof{/exsh/semester font}% - \pgfkeysvalueof{/exsh/semester}}\hspace{2ex}\hfil% - \vspace{1mm}\linebreak% - \hspace*{2ex}{\pgfkeysvalueof{/exsh/author font}\exsh@author}% - \hfill{\pgfkeysvalueof{/exsh/date font}% - \pgfkeysvalueof{/exsh/date}}% - \hspace{2ex}\hfil%\vspace{-1em} - \endgroup - \vspace{0.4em} - \end{beamercolorbox}% - \vspace{3mm} + \ifbool{exsh@beamerwithheadline}{% + \begin{beamercolorbox}[wd=\paperwidth,vmode]{frametitle} + \vspace{0.4em} + \leavevmode + \begingroup + \footnotesize% + \hspace*{2ex}{\pgfkeysvalueof{/exsh/subject font}% + \pgfkeysvalueof{/exsh/subject}} \hfill% + {\pgfkeysvalueof{/exsh/semester font}% + \pgfkeysvalueof{/exsh/semester}}\hspace{2ex}\hfil% + \vspace{1mm}\linebreak% + \hspace*{2ex}{\pgfkeysvalueof{/exsh/author font}\exsh@author}% + \hfill{\pgfkeysvalueof{/exsh/date font}% + \pgfkeysvalueof{/exsh/date}}% + \hspace{2ex}\hfil%\vspace{-1em} + \endgroup + \vspace{0.4em} + \end{beamercolorbox}% + \vspace{3mm} + }{}% } \addtobeamertemplate{frametitle}{\vspace{-3mm}}{} diff --git a/exercisesheets.sty b/exercisesheets.sty index 47c0896..c066a94 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.7} -\def\exsh@date{2020/10/11} +\def\exsh@version{0.8} +\def\exsh@date{2021/10/06} \ProvidesPackage{exercisesheets}[\exsh@date\space\exsh@version\space Typesetting of exercise sheets] \message{`Typesetting of exercise sheets' \exsh@version\space <\exsh@date>} @@ -56,6 +56,7 @@ \newif\ifexsh@pointsfloatright \newif\ifexsh@bonus \newif\ifexsh@abbrev +\newif\ifexsh@filenameasexercisename \pgfkeys{/exsh/.is family,/exsh, solutions/.is choice, @@ -73,24 +74,32 @@ gradingguides/.default=true, only/.initial={-}, all/.style={/exsh/only={-}},all/.value forbidden, - solutionsby/.code={\def\exsh@solutionsby{#1}},solutionsby/.value required, + solutionsby/.code={\def\exsh@solutionsby{#1}}, + solutionsby/.value required, + exercisespath/.code={\def\exsh@exercisespath{#1}}, + exercisespath/.value required, bonus/.is if=exsh@bonus, bonus/.default=true, inplace/.is if=exsh@inplace, inplace/.default=true, sample/.is if=exsh@sample, sample/.default=true, + filenameasexercisename/.is if=exsh@filenameasexercisename, + filenameasexercisename/.default=true, pointsfloatright/.is if=exsh@pointsfloatright, pointsfloatright/.default=true, abbrev/.is if=exsh@abbrev, abbrev/.default=true, %options from exercisesheets-beamer are ignored + beamerwithheadline/.default={ignore}, + beamerwithheadline/.initial={ignore}, beamersolution/.default={ignore}, beamersolution/.initial={ignore}, defersolutiontitle/.default={ignore}, defersolutiontitle/.initial={ignore}, framed/.default={ignore}, framed/.initial={ignore}, + framed/.code={\let\newframe\relax}, } % store title data for sheet headers @@ -150,6 +159,7 @@ oral/.style={/exsh/points=oral},oral/.value forbidden, inplace/.initial={false}, sample/.initial={false}, + filenameasexercisename/.initial={false}, pointsfloatright/.initial={false}, bonus/.initial={false}, nobonus/.style={/exsh/bonus=false},nobonus/.value forbidden, @@ -504,12 +514,13 @@ \long\def\exsh@skipstuff#1{% \ifstrequal{#1}{\begin}{\exsh@skipstuff@begin}{% \ifstrequal{#1}{\end}{\exsh@skipstuff@end}{% + \ifstrequal{#1}{\includeexercise}{\exsh@skipstuff@incex}{% \ifstrequal{#1}{\label}{\exsh@skipstuff@label}{% \ifstrequal{#1}{\input}{\exsh@skipstuff@input}{% \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}}{}}{}% - \pgfkeysvalueof{/exsh/custom skip macro}{#1}}}}}}}% + \pgfkeysvalueof{/exsh/custom skip macro}{#1}}}}}}}}% } \let\exshskipcontinue\exsh@skipstuff \long\def\exsh@skipcustomstuff#1{\exshskipcontinue} @@ -528,7 +539,7 @@ \ifthenelse{\equal{\jobname}{\currfilebase}}{}{% \ifcsdef{exsh@autolabel@\currfilebase}{}{% \csdef{exsh@autolabel@\currfilebase}{}% - \label{ex:\currfilebase}}}% + \exsh@autolabel{ex:\currfilebase}}}% }{}% \ifinlist{#1}{\exsh@enums}{% \exsh@skipstuff@beginenum @@ -574,6 +585,21 @@ \expandafter\exsh@skipstuff\exsh@inputfilecontent\exsh@skipstuff@endfile } +\def\exsh@skipstuff@incex{% + \@ifstar\exsh@skipstuff@incex@@\exsh@skipstuff@incex@% +} + +\newcommand{\exsh@skipstuff@incex@}[2][]{% +\exsh@skipstuff\input{% + \ifdefvoid{\exsh@exercisespath}{}{\exsh@exercisespath/}#2}% +} + +\newcommand{\exsh@skipstuff@incex@@}[2][]{% +\refstepcounter{section} +\exsh@autolabel{ex:#2} +\exsh@skipstuff +} + \def\exsh@sheethead{% \pgfkeysgetvalue{/exsh/title}{\exsh@tmp}% \ifexsh@solutions @@ -628,9 +654,14 @@ {\csname the#1\endcsname\autodot\enskip}}% }{} +%Do nout use \let here as \label may change before its use +\def\exsh@autolabel{\label} + \newenvironment*{exercise}[1][]{% % TODO: \edef is not safe with luatex and umlauts, only fixed for "oral" for now - \pgfkeys{exsh,every exercise,#1}% + % TODO: check whether the TODO above is still relevant + %\edef seams to work fine with lualatex from TeXLive 2020 + \pgfkeys{exsh,every exercise,#1,includeoverride}% \ifthenelse{\equal{}{\pgfkeysvalueof{/exsh/points}}}{% \def\exsh@points{}% \def\exsh@shortpoints{}% @@ -709,7 +740,7 @@ \ifthenelse{\equal{\jobname}{\currfilebase}}{}{% \ifcsdef{exsh@autolabel@\currfilebase}{}{% \csdef{exsh@autolabel@\currfilebase}{}% - \label{ex:\currfilebase}}}% + \exsh@autolabel{ex:\currfilebase}}}% % Use \leavevmode to ensure proper distances above environments that start % with a new \par. Make sure that a \label does not mess up the layout. \@ifnextchar\label{\exsh@label}{\leavevmode\ignorespaces}% @@ -724,6 +755,41 @@ [#1]{#2}% }% + +\exshset{includeoverride/.style={}} +\def\includeexercise{% + \@ifstar\exsh@includeexercise@\exsh@includeexercise% +} + +\newcommand{\exsh@includeexercise}[2][]{% +\ifbool{exsh@filenameasexercisename}{% + \exshset{includeoverride/.style={name={#2},#1}}% +}{% + \exshset{includeoverride/.style={#1}}% +}% +\input{\ifdefvoid{\exsh@exercisespath}{}{\exsh@exercisespath/}#2} +\exshset{includeoverride/.style={}} +} + +\newcommand{\exsh@includeexercise@}[2][]{% +\ifbool{exsh@filenameasexercisename}{% + \exshset{includeoverride/.style={name={#2},#1}}% +}{% + \exshset{includeoverride/.style={#1}}% +}% +\begingroup +%auto labelling is still allowed, but other labels are forbidden +%here we may use \let as the definition is close to its use +\let\exsh@autolabel\label +\def\label##1{% + \PackageError{exercisesheets}{\string\label{##1}\space + inside \string\includeexercise*}{}% +} +\input{\ifdefvoid{\exsh@exercisespath}{}{\exsh@exercisespath/}#2} +\endgroup +\exshset{includeoverride/.style={}} +} + \AfterPackage*{varioref}{ \labelformat{section}{\pgfkeysvalueof{/exsh/strings/exercise}~\arabic{section}} \labelformat{enumi}{\arabic{section}.\alph{enumi}} |
