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/exercises/exshexample-ex1.tex | 7 +- examples/exercises/exshexample-ex2.lua | 7 +- examples/exshexample-embedded.tex | 116 +++++++++++++++++++++++++++++++++ examples/exshexample.tex | 106 ++++++++++++++++++------------ 4 files changed, 192 insertions(+), 44 deletions(-) create mode 100644 examples/exshexample-embedded.tex (limited to 'examples') diff --git a/examples/exercises/exshexample-ex1.tex b/examples/exercises/exshexample-ex1.tex index 2e91246..395aef3 100644 --- a/examples/exercises/exshexample-ex1.tex +++ b/examples/exercises/exshexample-ex1.tex @@ -1,4 +1,9 @@ \begin{exercise} Include an exercise from an external file. + \begin{solution}[framed] + I just did this. + \pause + And this, too. + \end{solution} \end{exercise} - + diff --git a/examples/exercises/exshexample-ex2.lua b/examples/exercises/exshexample-ex2.lua index 1506e26..2301269 100644 --- a/examples/exercises/exshexample-ex2.lua +++ b/examples/exercises/exshexample-ex2.lua @@ -1,4 +1,7 @@ return exercise { - task = [[Include an exercise via the Lua interface.]] + task = [[Include an exercise via the Lua interface.]], + solution=[[ + I think this worked. + ]], } - + diff --git a/examples/exshexample-embedded.tex b/examples/exshexample-embedded.tex new file mode 100644 index 0000000..d9cf557 --- /dev/null +++ b/examples/exshexample-embedded.tex @@ -0,0 +1,116 @@ +\documentclass[aspectratio=169]{beamer} +\usetheme{Berlin} +\usefonttheme{professionalfonts} +\useoutertheme{infolines} +\useinnertheme{rounded} +\setbeamertemplate{itemize items}[circle] +\setbeamertemplate{enumerate items}[circle] +\setbeamertemplate{sections/subsections in toc}[circle] +\setbeamercolor{item projected}{bg=black} +\setbeamercolor{item}{fg=black} +\setbeamertemplate{navigation symbols}{} + +\setbeamertemplate{footline}[frame number] + +\setbeamercolor{block title}{bg=black} +\setbeamercolor{section in toc}{fg=red,bg=white} + +\AtBeginSection[]{ +\begin{frame} +\begin{block}{Overview} +\tableofcontents[sectionstyle=show/shaded,subsectionstyle=hide/hide/hide] +\end{block} +\end{frame} +} + +\AtBeginSubsection[]{ +\begin{frame}[allowframebreaks] +\begin{block}{Overview} +\tableofcontents[sectionstyle=show/hide,subsectionstyle=show/shaded/hide] +\end{block} +\end{frame} +} + + +\author{Example Author} +\title{Embedding Exercises} +\subtitle{a never-ending journey} +\makeatletter +\date{compilation date: \the\year-\two@digits{\the\month}-\two@digits{\the\day}} +\makeatother + + + +\newenvironment<>{stlist}[1][]{% + \setbeamertemplate{enumerate items}{\alph{enumi})} + \setbeamertemplate{enumerate subitem}{\arabic{enumii}.} + \setbeamertemplate{enumerate subsubitem}{\arabic{enumii}.} + \begin{enumerate}[#1] +}{\end{enumerate}} + +%embedded already sets a lot of values, see documentation +%in non-embedded mode, exercisesheets clears beamers headline +%and footline if non of the beamerwith...line arguments are used. +\usepackage[embedded]{exercisesheets} +\makeatletter +\exshset{ + strings/sheet={Missions}, + exercisespath=exercises, + subtask environment=stlist, + task restate font={\color{gray}}, + imp/.style={pointsinfo=important}, + vi/.style={pointsinfo=very important}, +} +\makeatother + +\parindent 0pt +\setlength{\parskip}{\baselineskip} + + + +\begin{document} +\begin{frame} +\maketitle +\end{frame} + +\section{Introduction} + +\begin{frame} + Let me tell you everything \pause\textbf{about embedding exercises}. +\end{frame} + +\section{Examples} + +\subsection{without a sheet environment} + + \begin{frame} + \begin{block}{} + Since our exercises are already in a dedicated subsection,\pause + we do not need an extra sheet environment. + \end{block} + \end{frame} + + \includeexercise*[imp]{exshexample-ex1} + \includeLexercise*[vi]{exshexample-ex2} + +\subsection{with a sheet environment} + +\begin{sheet}[note={The exercises are within a separated sheet + environment.}] + \includeexercise*[imp,solutions]{exshexample-ex1} +\end{sheet} + +\begingroup +\def\sheetfancy[#1]#2{\textcolor{red}{#2}}%nope, nothing happens +\exshset{sheet sectioning cmd=\sheetfancy} + +\begin{sheet}[note={This sheet header looks exactly like the first one, because \texttt{sheet sectioning cmd} is only used for +non-beamer documents.}] + \includeLexercise*[imp,solutions]{exshexample-ex2} +\end{sheet} +\endgroup + + +\end{document} + + 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