From 026c602a4aa6f2b6eeca3bcbdd714425e07ad829 Mon Sep 17 00:00:00 2001
From: Frank Fuhlbrück
Date: Wed, 24 Apr 2024 11:31:24 +0200
Subject: v.0.17: fix bugs with embedded+beamer; better documenation

---
 examples/exshexample.tex | 106 +++++++++++++++++++++++++++++------------------
 1 file changed, 65 insertions(+), 41 deletions(-)

(limited to 'examples/exshexample.tex')

diff --git a/examples/exshexample.tex b/examples/exshexample.tex
index bc4d3ec..815b7d5 100644
--- a/examples/exshexample.tex
+++ b/examples/exshexample.tex
@@ -1,7 +1,7 @@
-\long\def\ifbeamer#1#2{#1}
-\ifbeamer{\documentclass{beamer}}{\documentclass{article}}
+\long\def\ifbeamer#1#2{#2}
+\ifbeamer{\documentclass{beamer}}{\documentclass[a5paper]{article}}
 
-%navigation symbols and the title collide if 
+%navigation symbols and the title collide if
 %beamerwithheadline is set
 \ifbeamer{
   \setbeamertemplate{navigation symbols}{}
@@ -9,6 +9,12 @@
 
 %patchenumerate is the deafault
 \usepackage[patchenumerate=true,beamerwithheadline,
+  %when directly messing with page breaks
+  %and the sheet start page actio (as we do below)
+  %using exercisesheets' page numer redefinitions per
+  %sheet do not make much sense
+  patchpagenumbers=false,
+  beamerwithfootline,
   beamercompatibility,
   exercisespath=exercises]%
   {exercisesheets}
@@ -16,6 +22,19 @@
 \usepackage{hyperref}
 \usepackage{xcolor}
 
+\exshset{solutions=true,
+task restate font={\color{black!60}},
+only={1-3,5-},
+}
+
+%solutions may be printed out on paper -> a4
+%exercises are read on (smartphone) screen -> a5
+\ifsolutions{
+  \usepackage[left=1cm,right=1cm,top=1cm,bottom=1.5cm,a4paper]{geometry}
+  }{
+  \usepackage[left=0.7cm,right=0.7cm,top=1cm,bottom=1.5cm]{geometry}
+}
+
 %Usually the person responsible for the entire course:
 \author{Exampleauthor}
 \date{Example term/semester}
@@ -24,21 +43,10 @@
 %Only used for beamer at the moment:
 \exshset{exauthor={Author of exercises}}
 
-\ifbeamer{
-  \exshset{beameruseblocks=false}
-}{
-  \exshset{
-    %default is \clearpage
-    sheet start page action={\pagebreak[3]\hrule},
-    sheet end page action={\vspace{4mm}\hrule\vspace{2cm}},
-  }
-}
+\ifbeamer{\exshset{beameruseblocks=false}}{}
+
 
 
-\exshset{solutions=true,
-task restate font={\color{black!60}},
-only={-}
-}
 
 
 \begin{document}
@@ -46,13 +54,13 @@ only={-}
 %1
 \begin{sheet}[note={Learn how to create nice exercise sheets.},
   date={Novanuar 42, -2022},title={First Sheet}]
-  
+
   \includeexercise*{exshexample-ex1}
   \includeLexercise*{exshexample-ex2}
-  
+
   \begin{exercise}[points={many, many},firstline={Read the manual.}]
   \end{exercise}
-  
+
   \begin{exercise}[points={sum},firstline={After you read the manual:}]
     Play around with this example. You might want to read further manuals like:
     \begin{enumerate}
@@ -72,6 +80,15 @@ only={-}
   \end{exercise}
 \end{sheet}
 
+\begingroup
+\ifbeamer{}{
+  \exshset{
+    %default is \clearpage
+    sheet start page action={\pagebreak[3]\hrule},
+    sheet end page action={\vspace{4mm}\hrule\vspace{2cm}},
+  }
+}
+
 %2
 \begin{sheet}[date={Novanuar 35, -2022}]
   \begin{exercise}[points={many, many},
@@ -103,10 +120,14 @@ only={-}
     firstline={Read the manual.}]
     \begin{solution}
       OK, done.
+      \newpage
+      still done.
     \end{solution}
   \end{exercise}
 \end{sheet}
 
+\endgroup
+
 %4
 \begin{sheet}
   \begin{Lexercise}
@@ -121,21 +142,26 @@ only={-}
     ]],
     subexercises = {[[\label{subex:skiplexOne} first]]},
   \end{Lexercise}
-  \begin{exercise}[points={many, many},savetasks,
+  \begin{exercise}[points={many, many},%savetasks,
     main task font={\tiny},subtask font={\itshape}
   ]
     \begin{maintask}
-      \label{ex:skipex} This exercise will be skipped
+      \label{ex:skipex} This exercise will be skipped.
+      Furt
     \end{maintask}
-%     \begin{subtasks}
-%       \item {first \label{subex:skipexOne}}
-%       \subtask{second}
-%     \end{subtasks}
+    \begin{subtasks}
+      \item {first \label{subex:skipexOneOne}} This is an \string\item\space inside a subtasks environment. If
+      \verb|subtask environment| is set to enumerate/itemize etc.,
+      this works with some caveats (font settings for substaks are not used).
+      \subtask{second}
+    \end{subtasks}
     \begin{enumerate}
+      \setcounter{enumi}{2}
       \subtask {first \label{subex:skipexOne}}
+      This is a \string\subtask{} without the susbtasks
+      environment, which is unsupported and a bad example!
       \item {\label{subex:skipexTwo}} {12345}
     \end{enumerate}
-
   \end{exercise}
 \end{sheet}
 
@@ -143,37 +169,35 @@ only={-}
 \begin{sheet}[date={Novanuar 21, -2022}]
   \begin{exercise}[points={many, many},
     firstline={Read the manual.}]
-    Observe how a sheet with title restarts the exercise numbering.
     \begin{solution}[framed]
       OK, done (again).
       \newframe
-      Otherwise, I wouldn't know  \textbackslash newframe now which 
+      Otherwise, I wouldn't know  \textbackslash newframe now which
       does not exist in beamer.
     \end{solution}
   \end{exercise}
-  
-  Loading varioref enables you to refer to sub-exercises, like 
+
+  Loading varioref enables you to refer to sub-exercises, like
   this: Did you do \ref{subex:man2}? It is the subexercise
   \subexnref{subex:man2} and has label \subexlref{subex:man2}.
 
-  
+
   \begin{exercise}[points={many, many},
   firstline={Play around with the options.}]
-  Observe how a sheet with title restarts the exercise numbering.
+    Some exercise, there are far too few.
     \begin{solution}[defersolutiontitle]
       \begin{frame}
         This is a dual-use solution with explicit
         beamer frames (and no framed).
         \solutiontitle
-        Note, that we can freely place the title, because of 
+        Note, that we can freely place the title, because of
         defersolutiontitle.
       \end{frame}
     \end{solution}
   \end{exercise}
-  
+
   \begin{exercise}[points={many, many},beamersolution,
   firstline={Play around with the options.}]
-  Observe how a sheet with title restarts the exercise numbering.
     \begin{solution}
       This solution is only shown if using the non-beamer version, because the option beamersolution was used. Otherwise both
       solutions would be shown. You can set
@@ -183,14 +207,14 @@ only={-}
     \begin{beamersolution}[defersolutiontitle]
       \begin{frame}[t]
       \solutiontitle
-      This beamersolution is only shown if using the beamer 
+      This beamersolution is only shown if using the beamer
       version.
       \end{frame}
     \end{beamersolution}
   \end{exercise}
-  
 
-  
+
+
   \begin{exercise}[points={many, many},savetasks,
     main task font={\tiny},subtask font={\itshape}
   ]
@@ -208,7 +232,7 @@ only={-}
     \restatetask
     Yeah, but what about the subtasks? I forgot the \restatetask[1] and the \restatetask[2] one. Or did I?
   \end{exercise}
-  
+
   \begin{Lexercise}
     --use [[]] if you need \ or escape it: "\\"
     firstline = [[Assume $\pi=4$.]],
@@ -239,7 +263,7 @@ only={-}
     firstline = "Assume $e=3$.",
     points="sum",
     task  = [[
-      This exercise has some subexercises. The Lua interface 
+      This exercise has some subexercises. The Lua interface
       computes point sums in a single pass.
     ]],
     subexercises = {
@@ -255,7 +279,7 @@ only={-}
       }
     }
   \end{Lexercise}
-  
+
 \end{sheet}
 
 \end{document}
-- 
cgit v1.2.3

