From edfb70faa9f396ebad602fc7adaf6a2c99b138fc Mon Sep 17 00:00:00 2001 From: Frank Fuhlbrück Date: Fri, 2 Sep 2022 17:10:33 +0200 Subject: initial public commit --- exercisesheets.tex | 835 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 835 insertions(+) create mode 100644 exercisesheets.tex (limited to 'exercisesheets.tex') diff --git a/exercisesheets.tex b/exercisesheets.tex new file mode 100644 index 0000000..914650b --- /dev/null +++ b/exercisesheets.tex @@ -0,0 +1,835 @@ +%% exercisesheets.tex +%% Copyright 2008-2022 Sebastian Kuhnert, Frank Fuhlbrück +% +% This work may be distributed and/or modified under the conditions +% of the LaTeX Project Public License, either version 1.3c of this +% license or (at your option) any later version. The latest version +% of this license is in https://www.latex-project.org/lppl.txt and +% version 1.3c or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Frank Fuhlbrück. +% +% This work consists of the files listed in README. + +\documentclass[DIV12,BCOR0mm]{scrartcl} + +\usepackage{arev} +\usepackage[T1]{fontenc} +\usepackage[utf8]{inputenc} +\usepackage[activate]{microtype} +\usepackage{csquotes} +\usepackage{xspace} +\usepackage{xcolor} +\usepackage{calc} +\usepackage{listings} +\lstloadlanguages{TeX} +\lstset{% + language=[LaTeX]TeX, + basicstyle=\ttfamily\color{blue!50!black}, + keywordstyle=\bfseries, + morekeywords={subject}, + identifierstyle=, + texcl, + commentstyle=\itshape, + showstringspaces=false, + breaklines, + breakatwhitespace, + columns=flexible, + escapeinside={(*}{*)}, + mathescape=false, +} + +\usepackage[pdfusetitle,colorlinks]{hyperref} + +\newcommand{\exsh}{\texttt{exercisesheets}\xspace} + +\newcommand{\param}[1]{$\langle${\normalfont\itshape #1\/}$\rangle$} +\newcommand{\opt}[1]{\textcolor{green!50!black}{#1}} +\newcommand{\option}[1]{{\normalfont\texttt{\color{blue!50!black}#1}}} + +\usepackage[english,iso]{isodate} +\title{The \exsh Package} +\author{Sebastian Kuhnert\and Frank Fuhlbrück} +\date{Version 0.12, \printdateTeX{2022/09/02}} + +\begin{document} +\maketitle + +The \exsh package provides a way to typeset exercise sheets as used in +university courses. It evolved from a set of macros an environments that were +finally combined into this package. Starting from Version 0.7, there was an alternative variant designed for use with the beamer class, which is integrated into the main package since version 0.11. Not all combinations of options have been tested with the beamer variant. + + +\subsection*{Licence} +Copyright \textcopyright{} 2008--2022 Sebastian Kuhnert and Frank Fuhlbrück. +Permission is granted to copy, distribute and/or modify this software under the +terms of the \LaTeX{} Project Public Licence, version 1.3c or later. This +package is maintained, the Current Maintainer is +Frank Fuhlbrück +\footnote{\href{mailto:frank@fuhlbrueck.net}{frank@fuhlbrueck.net}}. + + +\section{Related Classes and Packages} + +\subsection{Packages with Similar Functionality} +\begin{itemize} + \item The \texttt{exercise} package offers similar functionality, though the + concept is a bit different: That package provides explicit commands for + sub-exercises while \exsh relies on other means like the \texttt{enumerate} + environment for this. An advantage of the \texttt{exercise} package is that + answers can be delayed. On the other hand \exsh's environment based user + interface is a bit cleaner and you have to care less about package internals. +\end{itemize} + +\subsection{Recommended Additional Packages} +\begin{itemize} + \item The use of \texttt{hyperref} is encouraged. Please use the options + \texttt{pdfusetitle}, \texttt{plainpages=false} and \texttt{pdfpagelabels} for + optimal results. + \item If the \texttt{babel} package is loaded, the appropriate + \option{language=\param{lang}}-option is automatically derived and can be + omitted. + \item The use of \texttt{enumitem} or \texttt{paralist} is recommended. Top + level enumerating lists are then modified to have the form (a), (b), \dots{}, + which is useful in exercise definitions. + \item If the \texttt{varioref} package is used, appropriate label formats are + installed for exercises and sub-exercises. + \item If the \texttt{xcolor} package is loaded, to-do markers generated with + \verb|\TODO| are printed in red. +\end{itemize} + +\subsection{Packages Loaded by \exsh} +\begin{itemize} + \item \texttt{etoolbox} (at least version + 1.7) + \item \texttt{scrlfile} (part of \KOMAScript{}) + \item \texttt{pgfkeys} (part of PGF 2.0) + \item \texttt{ifthen} + \item \texttt{amsmath} (for \verb|\numberwithin|) + \item \texttt{iflualatex} + \item \texttt{refcount} (for \verb|\getrefnumber|) +\end{itemize} + + +\section{Basic Usage} + +\subsection{Package Loading} +The beamer variant is integrated now and automatically activated +if the current document class is beamer. + +\begin{lstlisting} +\usepackage(*\opt{[\param{options}]}*){exercisesheets} +\end{lstlisting} + +The following options are available: +\begin{description} + \item[\option{only=\param{list of ranges}}] When given, only the mentioned + sheets will be included in the output. This is useful to speed up compilation + times for big documents. Some efforts are made that sheet and exercise + numbering remain consistent and references to exercises and enumerated lists + on skipped sheets still work as expected. References to other objects are + broken though (they currently point to the exercise or item containing them). + The \param{list of ranges} is a comma separated list of sheet numbers and + sheet ranges. If a comma is included in the range, it has to be protected with + a pair of braces. The special sheet \enquote{number} \texttt{last} stands for + the last sheet in the document (this may require an additional \LaTeX{} run). + Examples: + \begin{description} + \item[\option{only=3}] Only include the 3rd sheet of the document. + \item[\option{only=\{1,3,5,7\}}] Only include the sheets 1, 3, 5 and 7. + \item[\option{only=last}] Only include the last sheet of the document. + \item[\option{only=\{3-5,8-last\}}] Exclude the sheets 1, 2, 6 and 7. + \item[\option{only=\{-2,5-\}}] Exclude the sheets 3 and 4. + \end{description} + \item[\option{all}] Typeset all sheets (equivalent to \option{only=-}). This is + the default. + \item[\option{solutions\opt{=\param{true/false/oral/nonoral/sample oral/sample nonoral/sample all}}}] By default, + solutions (provided in the \texttt{solution} environment) are not included in + the output. By providing the option \option{solutions=true} (or just + \option{solutions}) this can be changed. Choosing \option{solutions=oral} + shows only solutions for exercises marked \option{oral} (useful for printouts + taken to class). Choosing \option{solutions=nonoral} shows only solutions for + exercises that are not marked \option{oral} (useful for correcting). + If you want to provided sample solutions for your students but only for some + of your exercises you can use the \texttt{sample} key to select those + exercises along with any options starting with sample here. + Note that non-sample exercises are skipped completely (not only their solutions) if you + choose an option starting with sample. + \item[\option{gradingguides\opt{=\param{true/false}}}] + Within \texttt{gradingguide} environments (usually used inside \texttt{solution}) you can + specify e.g. the amount of points to assign for certain solutions. This option + controls whether or not to include this guides in the output (e.g. solutions for + correcting contain them, but sample solutions for students don't). + \item[\option{solutionsby=\param{name/names}}] Use this to give the authors of the + solutions. They are credited at the beginning of each sheet, if the solutions + are included in the output. + \item[\option{language=\param{lang}}] Set the language of the sheet and + exercise heads to \param{lang}. If the \texttt{babel} package is loaded this + is not necessary, as the main document language will be automatically + detected. Currently \option{english}, \option{german} and \option{ngerman} are + supported. Other translations are welcome: Please contact the author. + \item[\option{pointsfloatright}] Use an alternative mechanism to place points for Sub-Exercises. + If this option is used, the points label for a Sub-Exercise is placed at the (right) end of the current line. + It is especially useful if used in a context like \texttt{$\backslash$item$\backslash$points$\{3\}$}. + This option exploits (and partially breaks) RTL-Support. + \item[\option{exercisespath}] Set the (relative) path of the + directory containing exercises to be included via + \verb|\includeexercise|. + \item[\option{patchenumerate}\opt{=\param{true/false}}] Sets + enumerate item labels for the first four levels, starting with + a), b) etc. for the top-level (sub-exercises). Depending on other + loaded packages (\verb|enumitem|, \verb|paralist|) the mechanism + slightly differs. This option is active by default. + + \item[\option{showtodos} / \option{hidetodos}] + \verb|\TODO| markers + are hidden by default, this option switches their behavior. This + option is usually set within \verb|\ifsamplesolutions| or + similar. + \item[\option{beamercompatibility}\opt{=\param{true/false}}] + This options (which only is effective in the non-beamer version) + defines several beamer macros with as trivial + effects as possible, e.g., \verb|\pause| becomes \verb|\relax| + and overlay specifications are mostly ignored. Be careful to use + this option after loading \verb|enumitem| etc. as the enumerate + and itemize environment are defined to swallow overlay + specifications without effect, this also holds for + \verb|\item<1->|. If you load \verb|exercisesheets| before them + use \verb|\exshset| afterwards. + The current list of redefinitions is as + follows: +\begin{lstlisting} + \let\pause\relax + \def\frame{} + \renewcommand{\frame}[1][]{} + \let\endframe\relax + \def\onslide<##1>{} + \def\only<##1>##2{##2} + \def\uncover<##1>##2{##2} + \def\visible<##1>##2{##2} + \def\invisible<##1>##2{##2} + \long\def\alt<##1>##2##3{##2} + \long\def\temporal<##1>##2##3##4{##3} + \let\exsh@origitem\item + \def\exsh@ovrlitem<##1>{\exsh@origitem} + \def\item{\@ifnextchar<\exsh@ovrlitem\exsh@origitem} + \let\exsh@origitemize\itemize + \def\exsh@ovrlitemize[##1]{\exsh@origitemize} + \def\itemize{\@ifnextchar[\exsh@ovrlitemize\exsh@origitemize} + \let\exsh@origenumerate\enumerate + \def\exsh@ovrlenumerate[##1]{\exsh@origenumerate} + \def\enumerate{% + \@ifnextchar[\exsh@ovrlenumerate\exsh@origenumerate} +\end{lstlisting} + +\item[\option{filenameasexercisename}\opt{=\param{true/false}}] +This option (set to false by default) causes +\verb|\includeexercise| to +set the name of an exercise as the filename (without extension). +This has two purposes: If you have nice file names you can +automatically name the exercise. On the other hand this is helpful +during exercise sheet composition because it shows the name of +the corresponding file in the compiled file. +\end{description} + +\subsection{Supplying Meta-Data} + +The following commands are enhanced (or provided) to set the options controlling +the sheet headers (see Section~\ref{sec:sheet}): +\begin{lstlisting} +\subject{(*\param{subject}*)} +\author{(*\param{author}*)} +\date{(*\param{semester}*)} +\end{lstlisting} + +If one of these commands is omitted (and the corresponding option is not used +either), a warning is issued. + +Please do not include a \lstinline|\title| in your document, as \exsh will +automatically generate an appropriate one (this may require an additional +\LaTeX{} run). + +All this information is included in the PDF meta-data if the \texttt{hyperref} +package is loaded with the option \texttt{pdfusetitle}. + +There is also a related option: +\begin{description} + \item[\option{exauthor=\param{list of names}}] If you want to use the + \lstinline|\author| macro for the general author of a course but + there are different authors for individual exercises or all + exercises in general, you can set this key. Currently only + exercisesheets-baemer uses this for the footline, while + \option{author} is used for the headline. +\end{description} + +\subsection{Defining Exercise Sheets} +\label{sec:sheet} +\begin{lstlisting} +\begin{sheet}(*\opt{[\param{options}]}*) + (*\param{sheet contents}*) +\end{sheet} +\end{lstlisting} + +Insert a sheet into the document. This environment can be repeated to combine +several sheets in a single \LaTeX{} file. For each sheet, a new page is started +and an appropriate header is generated. The \param{sheet contents} can be +anything but will usually consist of several \texttt{exercise} environments (see +Section~\ref{sec:exercises-solutions}). + +The following \param{options} are supported: +\begin{description} + \item[\option{date=\param{date}}] Set the date the sheet was/will be issued. This + information is included in the sheet header. By default, this information is + omitted. See also the \option{semester} option. + \item[\option{note=\param{note}}] Include \param{note} in the sheet header. + Useful to inform students when the sheet is due. If you want a note consisting + of more than one line split at a particular position, use + \verb|\protect\linebreak|. + \item[\option{title=\param{title}}] + Directly set the sheet title. When this option is used, different + page numbering conventions are used. This is useful to + typeset exams (combined with the next option). + \item[\option{number within sheet\opt{=\param{true/false}}}] + Deviate from the usual numbering theme and + restart from one for exercises on the sheet. The previous + counter value is restored after the sheet, so you can insert + a special sheet. + \item[\option{author=\param{author}}] Set the author included in the sheet + head. By default, the value passed to \verb|\author| is used. + \item[\option{exauthor=\param{exauthor}}] Only used by the beamer + variant, see above. + \item[\option{subject=\param{subject}}] Set the subject included in the sheet + head. By default, the value passed to \verb|\subject| is used. + \item[\option{semester=\param{semester}}] Set the semester included in the + sheet head. By default, the value passed to \verb|\date| is used. + \item[\option{beamerwithheadline\opt{=\param{true/false}}}] Controls whether a headline with author, subject etc. is shown on beamer slides, similar to the regular sheets. This options is off by default as headlines (and footers) take a considerable amount + off space. + \item[\option{beamerwithfootline\opt{=\param{true/false}}}] + The same for the footer. + \item[\option{beameruseblocks\opt{=\param{true/false}}}] + Controls whether the exercise title is shown inside a + beamer block (\param{true}) or a simple colorbox + (\param{false}, the default). Depending on your style a + block might look fancier, but it usually consume more space. +\end{description} + + +\subsection{Defining Exercises and Solutions} +\label{sec:exercises-solutions} +\begin{lstlisting} +\begin{exercise}(*\opt{[\param{options}]}*) + (*\param{exercise text}*) + \begin{solution}(*\opt{[\param{solution options}]}*) + (*\param{solution text}*) + \end{solution} + \begin{beamersolution}(*\opt{[\param{solution options}]}*) + (*\param{solution text}*) + \end{beamersolution} +\end{exercise} +\end{lstlisting} + +This inserts an exercise into the current document. All +\option{beamersolution}s are ignored, if the +\exsh package with any class but beamer, but using beamer +\exsh also processes +normal solutions by default (set option \option{beamersolution} +to turn this off). + +The following options are +supported: +\begin{description} + \item[\option{name=\param{text}}] Use \param{text} as the name of the exercise. + Useful for exercises that prove a famous theorem. + \item[\option{firstline=\param{text}}] Save some space by text \param{text} + behind the exercise title. + \item[\option{savetasks\opt{=\param{true/false}}}] Saves the main task and each sub task + for later use with \verb|\restatestask[|% + \param{which}], where \param{which} is either \verb|main| + (default) or the number of a sub task. + \item[\option{points=\param{number/oral/sum}}] Assign this + exercise \param{number} points. By default, exercises are + unlabelled. \param{oral} works the same way as the option + \option{oral}. The value \param{sum} displays the sum of all + occurrences of \verb|\points| within the exercise: Ordinary and + bonus points are treated separately. If there are only bonus + points, the option \option{bonus} is automatically triggered. To + undo this, either delete the \verb|.aux| file or explicitly use + \verb|\points[bonus=false]{\param{number}}| for at least one + subexercise. Points can be summed up also during a single pass + by using the Lua interface. + \item[\option{oral}] Label this exercise as \emph{oral}. This supersedes and is + superseded by the option \option{points}. + \item[\option{pointsinfo=\param{text}}] Supply \param{text} as additional + information to be displayed after the points. + \item[\option{optional}] Shortcut for \option{pointsinfo=optional} with + automatic translation and abbreviation (if requested). + \item[\option{bonus}] Change \enquote{points} to \enquote{bonus points} (with + automatic translation and abbreviation). + \item[\option{abbrev}] Use abbreviated labels. + \item[\option{exercisemark=\param{symbol}}] Mark the exercise + with \param{symbol} in the left margin. + \item[\option{difficult}] Shortcut for \option{exercisemark=*}. + \item[\option{solutions\opt{=\param{true/false/oral/nonoral/...}}}] Use this to override the + document (or sheet) default. + \item[\option{sample}] Include this exercise (and its solution) in while compiling + sample solutions. + \item[\option{beamersolution}] For beamer variant only. If this option + is set all normal solutions will not be included and only + \option{beamersolution}s are typeset. + \item[\option{framed}] For beamer variant only, simply ignored + elsewhere. If this option + is set for a normal solution, its content will be put on one or + more frames. Use \verb|\newframe| to start a new frame. This + option is especially helpful if you provide your own definitions + of \verb|\only| etc. for non-beamer compilation. \verb|\newframe| + is already defined as \verb|\relax| in non-beamer \exsh. +\end{description} + +Solutions are only typeset, if the \option{solutions} option is in effect. There +can be multiple solution environments within a single exercise environment; this +is useful if the exercise consists of several sub-exercises. Sub-exercises can +simply be defined with an \texttt{enumerate} or \texttt{compactenum} +environment. + +\section{Utilities} + +\subsection{Loading Excercises From Files} +\begin{lstlisting} +\includeexercise(*\param{file name}*) +\includeexercise*(*\param{file name}*) +\end{lstlisting} + +Both load the exercise from exercisespath/\param{file name}. Note +that the exercise environment must be contained in the file. The +starred version is helpful for faster skipping of unused exercises. +In this case, the file is not opened to search for labels. Whenever +the exercise is not skipped and you use the starred version and also +use labels within the exercise file, \exsh outputs an error. This is +done to ensure that references are not overlooked when the exercise +is actually skipped later. + +\subsection{Including Hints} + +\begin{lstlisting} +\begin{hint}(*\opt{[\param{options}]}*) + (*\param{hint text}*) +\end{hint} +\end{lstlisting} + +\begin{lstlisting} +\begin{hint*}(*\opt{[\param{options}]}*) + (*\param{hint text}*) +\end{hint*} +\end{lstlisting} + +These environments include hints in the exercise definition. The first form +starts a new paragraph, the second one puts the hint in parenthesis. + +\subsection{TODO Markers} + +You can use the following to include a red TODO marker in your document. This is +useful to mark places where work is still in progress. A warning is issued at +each place. TODO markers can also contain an optional description +of the task that needs to be done. If you switch off displaying +TODO markers (s.a.) the warning will be issued nevertheless. + +\begin{lstlisting} +\TODO[what needs to be done] +\end{lstlisting} + +\subsection{Annotating Points for Sub-Exercises} +\begin{lstlisting} +\begin{exercise}[points=sum]%sum produces 4+6 + \begin{enumerate} + \item Part 1 \points{oral} + \item Part 2 \points[optional]{oral} + \item Part 3 \points{4} + \item Part 4 \points[bonus]{6} + \end{enumerate} + Sub-Exercises within continuous text can be annotated like this \points[inplace]{3} without adding space. +\end{exercise} +\end{lstlisting} + +\subsection{Explicitly Stating Tasks} +In principle, \exsh aims to be very lightweight and there is not +much mandatory structure inside exercises. Furthermore, the +\verb|enumi| counter is used for sub-exercise. There are, however, +situations where we want more explicit structure, for instance to +have special font for the main task or the subtasks or to reuse +some of the tasks later. This is especially handy if using the +beamer variant where the origial task and a part of the solution might be on different slides. In the future it might be possible to +use other counters then \verb|enumi|, which is also only possible +if sub-exercises are not simply \verb|\item|s in +\verb|enumerate|. + + +\begin{lstlisting} +\begin{exercise}[points=sum]%sum produces 4+6 + \begin{maintask} + This is the main task. + \end{maintask} + \begin{subtasks} + \subtask{first} + \subtask{second} + \end{subtasks} + \begin{solution}[framed] + We want to show: \restatestask %This is the main task. + \newframe + Out first step is to show: \restatetask[1] %first + \end{solution} +\end{exercise} +\end{lstlisting} + +\subsection{Labels and References within an Exercise} +While the global reference labels set via varioref (if loaded) +are nice for references to subexercises far away, always mentioning +the exercise number seems superfluous. Furthermore, for usage in indices etc. you might want to use the arabic representation instead. This is what the commands \verb|\subexnref| and +\verb|\subexlref| are designed for. However, both of them still +require an ordinary label, which is not allowed in +exercises loaded with \verb|\loadexercise*|. +For this purpose \verb|\inexlabel| can be used which is just a +normal label that is not redefined to produce an error. +Furthermore, we define a counter \verb|subex| (which is +currently just an alias for enumi, but this might change). You can +use this counter (alias) with common commands like +\verb|\arabic| or \verb|\alph|. + +\begin{lstlisting} +\begin{exercise} + \begin{enumerate} + \item \inexlabel{subex:xisseven} Let $x_{\thesubex}=7$. + \item Compute $x_{\subexnref{subex:xisseven}}+3$. + \begin{solution} + From \subexlref{subex:xisseven} %(a) + we know that $x_{\subexnref{subex:xisseven}}$ is $7$ and + thus the sum is $10$. + \end{solution} + \end{enumerate} +\end{exercise} +\end{lstlisting} + + + +\section{Advanced Usage} + +\subsection{Setting Options} + +Options can be given at different places. +\begin{enumerate} + \item As local options to one of the environments. + \item As package options: This is convenient for global options but suffers + from shortcomings in way \LaTeX{} processes options: Macros are expanded and + spaces are stripped. + \item By the independent \verb|\exshset| command. This is especially useful in + the preamble to set options that would be garbled by the \LaTeX{} option + handling routine. It also allows to change an option for the rest of the + current scope. +\end{enumerate} + +Example: Change the solution authors of the following sheets: +\begin{lstlisting} +(*\param{some sheets}*) +\exshset{solutionsby=(*\param{other authors}*)} +(*\param{more sheets}*) +\end{lstlisting} + +\subsection{Changing Strings} + +For some languages, predefined sets of strings are provided and automatically +activated. If your language is not supported or if you want to change (some of) +the used strings, you can do so with the following options: +\begin{description} + \item[\option{strings/sheet=\param{string}}] + \item[\option{strings/sheets=\param{string}}] + \item[\option{strings/solutions=\param{string}}] + \item[\option{strings/solutionsby=\param{string}}] + \item[\option{strings/exercise=\param{string}}] + \item[\option{strings/solution=\param{string}}] + \item[\option{strings/hint=\param{string}}] + \item[\option{strings/oral=\param{string}}] + \item[\option{strings/oral abbrev=\param{string}}] + \item[\option{strings/point=\param{string}}] + \item[\option{strings/points=\param{string}}] + \item[\option{strings/points abbrev=\param{string}}] + \item[\option{strings/bonus point=\param{string}}] + \item[\option{strings/bonus points=\param{string}}] + \item[\option{strings/bonus points abbrev=\param{string}}] + \item[\option{strings/optional=\param{string}}] + \item[\option{strings/optional abbrev=\param{string}}] +\end{description} + +Example: Give an introduction that should only be included in the version with +solutions: + +\begin{lstlisting} +\begin{solution}[strings/solution=Introduction] + (*\param{introduction text}*) +\end{solution} +\end{lstlisting} + + +\subsection{Changing Fonts} + +The package \exsh comes with its own way to change the used fonts. Each font can +be changed in the following way: +\begin{lstlisting} +\exshset{(*\param{font element}=\param{font specification}*)} +\end{lstlisting} +The available \param{font element}s are listed below together with their default +values: +\begin{description} + \item[\option{sheet header font}] The basic font for subject, author, semester, + date, note and solution authors in the sheet headers.\\ + Default: \verb|\normalfont\normalsize| + \item[\option{subject font}] The font for the subject in the sheet header.\\ + Default: \verb|\scshape| + \item[\option{author font}] The font for the author in the sheet header.\\ + Default: \verb|\scshape| + \item[\option{semester font}] The font for the semester in the sheet header.\\ + Default: empty, i.\,e.\ no change. + \item[\option{date font}] The font for the date in the sheet header.\\ + Default: empty, i.\,e.\ no change. + \item[\option{solutionsby font}] The font for the information who has produced + the solutions provided below the sheet title.\\ + Default: \verb|\itshape| + \item[\option{sheet note font}] The font for the note provided below the sheet + title.\\ + Default: \verb|\itshape\bfseries| + \item[\option{sheet title font}] The font for the sheet title itself.\\ + Default: \verb|\Large\bfseries| + \item[\option{exercise title font}] The font for the exercise title.\\ + Default: \verb|\bfseries| + \item[\option{points font}] The font for the number of points in the exercise + head (relative to the exercise title) and for \verb|\points|.\\ + Default: \verb|\itshape| + \item[\option{main task font}] The font for the + \verb|maintask| environment.\\ + Default: empty, i.\,e.\ no change. + \item[\option{subtask font}] The font for each + \verb|\subtask|.\\ + Default: empty, i.\,e.\ no change. + \item[\option{task restate font}] The font used for + \verb|\restatestask|.\\ + Default: \verb|\itshape| + \item[\option{hint font}] The font for hints. \\ + Default: empty, i.\,e.\ no change. + \item[\option{hint title font}] The font for the string \enquote{Hint:}.\\ + Default: \verb|\itshape| + \item[\option{solution font}] The font for solutions.\\ + Default: empty, i.\,e.\ no change. + \item[\option{solution title font}] The font for the string + \enquote{Solution:}\\ + Default: \verb|\bfseries| + \item[\option{grading guide font}] The font for grading guides.\\ + Default: \verb|\itshape| + \item[\option{todo marker font}] The font for the string \enquote{TODO}.\\ + Default: \verb|\ifdef{\color}{\color{red}}{}\bfseries| +\end{description} + +\subsection{Controlling the Spacing and Page Handling} + +The following options allow fine-tuning of the spacing: +\begin{description} + \item[\option{below slide headline skip=\param{dimen}}] The distance between + haedline (if present) and slide content. Only used by beamer + variant, ignored elsewhere.\\ + Default: \texttt{0mm} + \item[\option{above sheet title skip=\param{dimen}}] The distance between + author/date and sheet title.\\ + Default: \texttt{4ex} + \item[\option{above sheet note skip=\param{dimen}}] The distance above the + sheet note.\\ + Default: \texttt{.7ex} + \item[\option{above solutionsby skip=\param{dimen}}] The distance above the + solution author.\\ + Default: \texttt{1ex} + \item[\option{below sheet header skip=\param{dimen}}] The distance below the + sheet header.\\ + Default: \texttt{4ex plus 1ex minus .5ex} + \item[\option{above exercise skip=\param{dimen}}] The distance above + exercises.\\ + Default: \texttt{3ex plus 1ex minus .5ex} + \item[\option{below exercise title skip=\param{dimen}}] The distance below + exercise titles.\\ + Default: \texttt{\textbackslash parskip} + \item[\option{above solution skip=\param{dimen}}] The distance above + solutions.\\ + Default: \texttt{1ex} + \item[\option{above hint skip=\param{dimen}}] The distance above hints.\\ + Default: \texttt{1ex} +\end{description} + +The following two options control the page handling at the beginning and +at the end of each sheet: +\begin{description} + \item[\option{sheet start page action=\param{macro}}] Executed at the beginning + of each sheet.\\ + Default: \texttt{\string\clearpage} + \item[\option{sheet end page action=\param{macro}}] Executed at the end + of each sheet.\\ + Default: \texttt{\string\clearpage} +\end{description} + +\subsection{Special Code for Solutions} +\begin{lstlisting} +\ifsolutions{(*\param{if true}*)}{(*\param{if false}*)} +\iforalsolutions{(*\param{if true}*)}{(*\param{if false}*)} +\ifnonoralsolutions{(*\param{if true}*)}{(*\param{if false}*)} +\end{lstlisting} + +There are also special options for conditionals to be used in the arguments of +the environments defined by this package: +\begin{description} + \item[\option{ifsolutions=\{\param{options if true}\}\{\param{options if + false}\}}] Execute \param{options if true} if solutions are included in + the current document, \param{options if false} otherwise. + \item[\option{iforalsolutions=\{\param{options if true}\}\{\param{options if + false}\}}] Execute \param{options if true} if solutions for oral exercises + are included in the current document, \param{options if false} otherwise. + \item[\option{ifnonoralsolutions=\{\param{options if true}\}\{\param{options if + false}\}}] Execute \param{options if true} if solutions for non-oral + exercises are included in the current document, \param{options if false} + otherwise. + \item[\option{ifsamplesolutions=\{\param{options if true}\}\{\param{options if + false}\}}] Execute \param{options if true} if sample solutions for marked + exercises are included in the current document, \param{options if false} + otherwise. +\end{description} + +Example 1: Only include points for sub-exercises when solutions are typeset: +\begin{lstlisting} +\ifsolutions{}{\renewcommand{\points}[2][]{}} +\end{lstlisting} + +Example 2: Modify the sheet header spacing in the non-solution version: +\begin{lstlisting} +\begin{sheet}[ifsolutions={}{above title skip=2ex}]% usually 4ex + \dots +\end{sheet} +\end{lstlisting} + +\subsection{Using Hooks} +There are several hooks used by \exsh: +\begin{description} + \item[\option{every sheet}] This is used at the beginning of every sheet. + \item[\option{every exercise}] This is used at the beginning of every exercise. + \item[\option{every solution}] This is used at the beginning of every solution. + \item[\option{every hint}] This is used at the beginning of every hint. +\end{description} + +Hooks can be used to influence the behaviour of the respective environments. +Users of \texttt{tikz} should be familiar with the concept. + +\subsection{Control Skipping of Custom Macros in Skipped Exercises} +\begin{description} + \item[\option{custom skip macro=\param{macro}}] +\end{description} + +If an exercise is not printed, some macros like \texttt{\string\label{}} +are processed nevertheless. However, if you define your own macro +using one of these, then this macro will be completely ignored +if the exercise containing it is skipped. This option allows to +define a custom handler for your macros. The most common use +checks for your custom macros with +nested \texttt{\string\ifstrequal}s and then either +executes a custom skipper, replaces your macro with +the standard version or uses \texttt{\string\expandafter} to +deliver the expanded version of your macro to +\texttt{\string\exshskipcontinue}. + +Example: +\begin{lstlisting} +\def\mylabel#1{...} +\def\myitem{...} +\def\myitemtwo{...} +\def\skipmylabel#1{...\exshskipcontinue} +\long\def\customskip#1{ + \ifstrequal{#1}{\mylabel} + {\skipmylabel} + {\ifstrequal{#1}{\myitem} + {\exshskipcontinue\item} + {\ifstrequal{#1}{\myitemtwo} + {\expandafter\exshskipcontinue\myitemtwo} + {\exshskipcontinue} + } + } +} +\exshset{custom skip macro={\customskip}} +\end{lstlisting} + +\section{The Lua Interface} +\label{sec:lua} + +Since version 0.11 there is a Lua interface for the exercise +environment. This interface will offer roughly the same features. +Its main purpose will be allowing to reorder sub-exercises more +easily and to offer more dynamic options for the display of +solutions (one combined solution or single after each sub-% +exercise). %TODO finish + +\begin{lstlisting} +\begin{Lexercise} + --use [[]] if you need \ or escape it in "": "\\" + firstline = [[Assume $\pi=4$.]], + points=10, + name="Pragmatic", + options=[[main task font={\itshape}]], + task = [[ + This is the main task specified via the Lua + interface. + ]], + solution=[[ + This is a solution for the main task. + ]], +\end{Lexercise} +\end{lstlisting} + +\section{Usage Tips} +\label{sec:usage-tips} + +\subsection{Seperate Solution File} +\label{sec:seper-solut-file} + +If you do not want to temporarily comment out the \option{solutions} option in +your main file, say \texttt{exercises.tex}, you can create an additional file +\texttt{solutions.tex} with the following contents: +\begin{lstlisting} +\PassOptionsToPackage{solutions}{exercisesheets} +\input{exercises.tex} +\end{lstlisting} +If you leave out the \option{solutions} option in you main file, running +\texttt{pdflatex exercises.tex} will create \texttt{exercises.pdf} without +solutions and \texttt{pdflatex solutions.tex} will create \texttt{solutions.pdf} +with solutions. + +This also works well in combination with a make file that generates +\texttt{solutions.tex}. + + +\section{Changelog} +\label{sec:changelog} + +\begin{itemize} + \item[v. 0.11:] 2022-02-11 + \begin{itemize} + \item Local references and the subex counter + \item Lua interface (not documented yet, see example and example file) + \item Framed solutions can now be fragile, however this + also require Lua\LaTeX (but not using the Lua Interface). + \item beamer version is now included (no separate package) + \item some bug fixes + \end{itemize} +\end{itemize} + + +\end{document} + +%%% Local Variables: +%%% mode: latex +%%% TeX-master: t +%%% End: + +%%% Local IspellDict: british -- cgit v1.2.3