From c89096ef8e175625df39f6bd415a63ada9e46aed Mon Sep 17 00:00:00 2001
From: Frank Fuhlbrück
Date: Fri, 28 Jan 2022 17:36:15 +0100
Subject: higlight beamer specific sections

---
 exercisesheets.sty | 81 +++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 52 insertions(+), 29 deletions(-)

(limited to 'exercisesheets.sty')

diff --git a/exercisesheets.sty b/exercisesheets.sty
index 0192099..847e3d9 100644
--- a/exercisesheets.sty
+++ b/exercisesheets.sty
@@ -45,7 +45,7 @@
 
 % configuration keys
 
-\newif\ifexsh@beamer
+\newif\ifexsh@beamer 
 \@ifclassloaded{beamer}{\exsh@beamertrue}{}
 
 \newif\ifexsh@patchenumerate\exsh@patchenumeratetrue
@@ -57,7 +57,9 @@
 \newif\ifexsh@exnumsheet
 \newif\ifexsh@forcesample %force printing sample sol. of wrong type
 %For beamer only
-\ifexsh@beamer
+%%%%%%%%%%%%%%% BEGIN BEAMER-SPECIFIC: %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\ifexsh@beamer 
 \newif\ifexsh@beamerwithheadline
 \newif\ifexsh@beameruseblocks
 \newif\ifexsh@defersolutiontitle
@@ -83,10 +85,11 @@
   \PackageError{exercisesheets}{
     beamercompatibility used twice}{}%
 \else
-\ifexsh@beamer
+%%%%%%%%%%%%%%% BEGIN BEAMER-SPECIFIC: %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifexsh@beamer 
   %currently we do nothing if beamer is loaded, 
   %but this might change
-\else
+\else%--------- NON-BEAMER: ---------------------------------------
   %TODO:\only<>{A} -> {A} which breaks global effects of A
   \let\pause\relax
   \def\frame{}
@@ -110,6 +113,7 @@
   \def\exsh@ovrlenumerate[##1]{\exsh@origenumerate}
   \def\enumerate{\@ifnextchar[\exsh@ovrlenumerate\exsh@origenumerate}
 \fi
+%%%%%%%%%%%%%%% END BEAMER-SPECIFIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   \exsh@beamercompatdonetrue
 \fi
 }
@@ -158,7 +162,9 @@
   beamercompatibility/.initial={ignore},
   beamercompatibility/.code={\exsh@beamercompatibility}
 }
-\ifexsh@beamer
+
+%%%%%%%%%%%%%%% BEGIN BEAMER-SPECIFIC: %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifexsh@beamer 
 \pgfkeys{exsh,
   beamerwithheadline/.is if=exsh@beamerwithheadline,
   beamerwithheadline/.default=true,
@@ -176,7 +182,7 @@
   defersolutiontitle/.initial={false},
   framed/.initial={false},
 }
-\else
+\else%--------- NON-BEAMER: ---------------------------------------
 \pgfkeys{exsh,
   beamerwithheadline/.default={ignore},
   beamerwithheadline/.initial={ignore},
@@ -189,6 +195,7 @@
   framed/.code={\let\newframe\relax},
 }
 \fi
+%%%%%%%%%%%%%%% END BEAMER-SPECIFIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 % store title data for sheet headers
 \ifundef\subject{% \subject is only provided by KOMA classes
@@ -273,11 +280,6 @@
   difficult/.style={/exsh/exercisemark=*},difficult/.value forbidden,
   savetasks/.initial=false,
 }
-%beamer specific options
-\ifexsh@beamer
-\pgfkeys{exsh,
-}
-\fi
 \pgfkeys{exsh,
   %
   % translatable strings
@@ -419,7 +421,8 @@
 % allow further keys to be set
 \def\exshset#1{\pgfkeys{exsh,#1}}
 
-\ifexsh@beamer
+%%%%%%%%%%%%%%% BEGIN BEAMER-ONLY: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifexsh@beamer 
 \define@key{beamerframe}{t}[true]{% top
   \beamer@frametopskip=-2pt\relax%
   \beamer@framebottomskip=0pt plus 1fill\relax%
@@ -427,6 +430,7 @@
   \beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
 }
 \fi
+%%%%%%%%%%%%%%% END BEAMER-ONLY %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 % automatic language selection
 \AfterEndPreamble{%
@@ -634,11 +638,15 @@
 \listadd{\exsh@nonenums}{asparablank}
 \listadd{\exsh@nonenums}{inparablank}
 \listadd{\exsh@nonenums}{list}
-\ifexsh@beamer
+
+%%%%%%%%%%%%%%% BEGIN BEAMER-SPECIFIC: %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifexsh@beamer 
   \let\exsh@hyper@itemtrue\relax
-\else
+\else%--------- NON-BEAMER: ---------------------------------------
   \def\exsh@hyper@itemtrue{\@hyper@itemtrue}
 \fi
+%%%%%%%%%%%%%%% END BEAMER-SPECIFIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 \long\def\exsh@skipstuff#1{%
   \ifstrequal{#1}{\begin}{\exsh@skipstuff@begin}{%
     \ifstrequal{#1}{\end}{\exsh@skipstuff@end}{%
@@ -728,7 +736,8 @@
 \exsh@skipstuff
 }
 
-\ifexsh@beamer
+%%%%%%%%%%%%%%% BEGIN BEAMER-SPECIFIC: %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifexsh@beamer 
 \def\exsh@sheethead{%
   \pgfkeysgetvalue{/exsh/title}{\exsh@tmp}%
   \ifexsh@solutions
@@ -771,7 +780,7 @@
 %   \stepcounter{page}%
   \end{frame}
 }
-\else
+\else%--------- NON-BEAMER: ---------------------------------------
 \def\exsh@sheethead{%
   \pgfkeysgetvalue{/exsh/title}{\exsh@tmp}%
   \ifexsh@solutions
@@ -819,6 +828,7 @@
   \stepcounter{page}%
 }
 \fi
+%%%%%%%%%%%%%%% END BEAMER-SPECIFIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \ifdef{\othersectionslevelsformat}{%
   \renewcommand{\othersectionlevelsformat}[1]{%
@@ -964,11 +974,12 @@
       }%
     }%
   \fi
-  \ifexsh@beamer\clearpage\fi
+  \ifexsh@beamer\clearpage\fi%%%% <<<<<BEAMER ONLY%%%%%%%%%%%%%%%%%
 }
 \newcommand{\exsh@label}[2]{#1{#2}\leavevmode\ignorespaces}
 
-\ifexsh@beamer
+%%%%%%%%%%%%%%% BEGIN BEAMER-SPECIFIC: %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifexsh@beamer 
 \newcommand{\exsh@startsection}[2][]{%
    \newpage
 %   \begin{block}{}
@@ -1000,7 +1011,7 @@
     }
   \fi
 }%
-\else
+\else%--------- NON-BEAMER: ---------------------------------------
 \newcommand{\exsh@startsection}[2][]{%
   \@startsection{section}{1}{\z@}%
   {\pgfkeysvalueof{/exsh/above exercise skip}}%
@@ -1009,7 +1020,7 @@
   [#1]{#2}%
 }%
 \fi
-
+%%%%%%%%%%%%%%% END BEAMER-SPECIFIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \exshset{includeoverride/.style={}}
 \def\includeexercise{%
@@ -1152,11 +1163,14 @@
 }
 
 
-\ifexsh@beamer
+%%%%%%%%%%%%%%% BEGIN BEAMER-SPECIFIC: %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifexsh@beamer 
   \let\exsh@postsolutionclear\clearpage
-\else
+\else%--------- NON-BEAMER: ---------------------------------------
   \let\exsh@postsolutionclear\par
 \fi
+%%%%%%%%%%%%%%% END BEAMER-SPECIFIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 \providecommand{\solution}{}
 \renewenvironment{solution}[1][]{%
   \pgfkeys{exsh,every solution,#1,solution font}%
@@ -1193,7 +1207,8 @@
 }
 
 
-\ifexsh@beamer
+%%%%%%%%%%%%%%% BEGIN BEAMER-SPECIFIC: %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifexsh@beamer 
 \def\exsh@solutiontitle#1{
   \ifbool{exsh@beameruseblocks}{%
     \begin{alertblock}{}%
@@ -1235,13 +1250,16 @@
 \exsh@processframes#1\newframe\newframe
 }
 
-\else
+\else%--------- NON-BEAMER: ---------------------------------------
 %this command is only usefule for exercisesheets-beamer to place
 %the deferred title within a new frame 
 \newcommand{\solutiontitle}[1][]{}
 \fi
+%%%%%%%%%%%%%%% END BEAMER-SPECIFIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 
-\ifexsh@beamer
+%%%%%%%%%%%%%%% BEGIN BEAMER-SPECIFIC: %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifexsh@beamer 
 \def\exsh@startsolution{%
   \ifnum\@enumdepth=0
     \clearpage
@@ -1261,7 +1279,7 @@
   }%
   \ifbool{exsh@framed}{\Collect@Body\exsh@collectedframe}{}%
 }%
-\else
+\else%--------- NON-BEAMER: ---------------------------------------
 \def\exsh@startsolution{\@afterindentfalse
   \vskip\pgfkeysvalueof{/exsh/above solution skip}\relax%
   {\parindent \z@
@@ -1270,6 +1288,7 @@
   \@afterheading
 }%
 \fi
+%%%%%%%%%%%%%%% END BEAMER-SPECIFIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \long\def\exsh@skipsolution#1{%
   \ifstrequal{#1}{\end}{\exsh@endsolution}{\exsh@skipsolution}%
@@ -1285,7 +1304,8 @@
   }%
 }
 
-\ifexsh@beamer
+%%%%%%%%%%%%%%% BEGIN BEAMER-SPECIFIC: %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifexsh@beamer 
 \newenvironment<>{beamersolution}[1][]{%
   \pgfkeys{exsh,every solution,#1,solution font}%
   \ifthenelse{\equal{oral}{\pgfkeysvalueof{/exsh/points}}}{%
@@ -1315,10 +1335,11 @@
     \ifbool{exsh@nonoralsolutions}{\clearpage}{}%
   }%
 }
-\else
+\else%--------- NON-BEAMER: ---------------------------------------
 %the regular version of exercisesheets.sty skips all beamer solutions
 \newenvironment{beamersolution}[1][]{\exsh@skipsolution}{}%
 \fi
+%%%%%%%%%%%%%%% END BEAMER-SPECIFIC %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \newcommand{\points}[2][]{%
   \ifthenelse{\equal{}{#2}}{}{\exshset{points=#2}}%
@@ -1456,7 +1477,8 @@
 }
 
 
-\ifexsh@beamer
+%%%%%%%%%%%%%%% BEGIN BEAMER-ONLY: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\ifexsh@beamer 
 \setbeamertemplate{headline}{%
 % \leavevmode%
   \ifbool{exsh@beamerwithheadline}{%
@@ -1497,6 +1519,7 @@
   \vskip0pt%
 }
 \fi
+%%%%%%%%%%%%%%% END BEAMER-ONLY %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \ifluatex
   \let\exsh@dlua\directlua
-- 
cgit v1.2.3

