| 1 |
%% exercisesheets.tex |
| 2 |
%% Copyright 2008-2024 Sebastian Kuhnert, Frank Fuhlbrück |
| 3 |
% |
| 4 |
% This work may be distributed and/or modified under the conditions |
| 5 |
% of the LaTeX Project Public License, either version 1.3c of this |
| 6 |
% license or (at your option) any later version. The latest version |
| 7 |
% of this license is in https://www.latex-project.org/lppl.txt and |
| 8 |
% version 1.3c or later is part of all distributions of LaTeX |
| 9 |
% version 2005/12/01 or later. |
| 10 |
% |
| 11 |
% This work has the LPPL maintenance status `maintained'. |
| 12 |
% |
| 13 |
% The Current Maintainer of this work is Frank Fuhlbrück. |
| 14 |
% |
| 15 |
% This work consists of the files listed in README. |
| 16 |
|
| 17 |
\documentclass[DIV12,BCOR0mm]{scrartcl} |
| 18 |
|
| 19 |
\usepackage{arev} |
| 20 |
\usepackage[T1]{fontenc} |
| 21 |
\usepackage[utf8]{inputenc} |
| 22 |
\usepackage[activate]{microtype} |
| 23 |
\usepackage{csquotes} |
| 24 |
\usepackage{xspace} |
| 25 |
\usepackage{xcolor} |
| 26 |
\usepackage{calc} |
| 27 |
\usepackage{listings} |
| 28 |
\lstloadlanguages{TeX} |
| 29 |
\lstset{% |
| 30 |
language=[LaTeX]TeX, |
| 31 |
basicstyle=\ttfamily\color{blue!50!black}, |
| 32 |
texcs={def,let,renewcommand,long,begin,end,usepackage,ifdef}, |
| 33 |
texcsstyle=\color{blue!60!gray}, |
| 34 |
keywordstyle=\bfseries, |
| 35 |
keywords={ |
| 36 |
beamersolution, |
| 37 |
exshset, |
| 38 |
exercise, |
| 39 |
hint, |
| 40 |
includeexercise, |
| 41 |
inexlabel, |
| 42 |
ifnonoralsolutions, |
| 43 |
iforalsolutions, |
| 44 |
ifsamplesolutions, |
| 45 |
ifsolutions, |
| 46 |
Lexercise, |
| 47 |
loadexercise, |
| 48 |
maintask, |
| 49 |
newframe, |
| 50 |
points, |
| 51 |
restatetask, |
| 52 |
restatetaskbeamer, |
| 53 |
sheet, |
| 54 |
solution, |
| 55 |
subexnref, |
| 56 |
subexlref, |
| 57 |
subtask, |
| 58 |
subtasks, |
| 59 |
TODO, |
| 60 |
}, |
| 61 |
keywordstyle=[2]\optionstyle, |
| 62 |
keywords=[2]{ |
| 63 |
bonus, |
| 64 |
firstline, |
| 65 |
framed, |
| 66 |
inplace, |
| 67 |
name, |
| 68 |
only, |
| 69 |
optional, |
| 70 |
options, |
| 71 |
oral, |
| 72 |
strings, |
| 73 |
solutionsby, |
| 74 |
}, |
| 75 |
identifierstyle=,%{}\color{red!60!gray}, |
| 76 |
texcl, |
| 77 |
commentstyle=\itshape, |
| 78 |
showstringspaces=false, |
| 79 |
breaklines, |
| 80 |
breakatwhitespace, |
| 81 |
columns=flexible, |
| 82 |
escapeinside={(*}{*)}, |
| 83 |
mathescape=false, |
| 84 |
} |
| 85 |
|
| 86 |
\usepackage[pdfusetitle,colorlinks]{hyperref} |
| 87 |
|
| 88 |
\newcommand{\exsh}{\texttt{exercisesheets}\xspace} |
| 89 |
|
| 90 |
\newcommand{\param}[1]{$\langle${\normalfont\itshape #1\/}$\rangle$} |
| 91 |
\newcommand{\maybe}[1]{\textcolor{green!50!black}{#1}} |
| 92 |
\newcommand{\mand}[1]{\textcolor{blue!50!black}{#1}} |
| 93 |
\newcommand{\codestyle}{\normalfont\ttfamily\color{blue!50!black}} |
| 94 |
\newcommand{\optionstyle}{\normalfont\ttfamily\color{red!50!black}} |
| 95 |
\newcommand{\option}[1]{{\optionstyle #1}} |
| 96 |
\newcommand{\optitem}[1][]{\item[{\codestyle #1}]} |
| 97 |
\newcommand{\vers}[1]{{\normalfont\ttfamily\color{black!90} #1}} |
| 98 |
\newcommand{\versitem}[1][]{\item[v. \vers{#1}]} |
| 99 |
\newcommand{\filename}[1]{{\normalfont\ttfamily\color{magenta!80!black}#1}} |
| 100 |
\newcommand{\binary}[1]{{\normalfont\ttfamily\color{yellow!50!black}#1}} |
| 101 |
\newcommand{\luadisp}[1]{{\normalfont\ttfamily\color{cyan!50!black}#1}} |
| 102 |
|
| 103 |
\usepackage[english,iso]{isodate} |
| 104 |
\title{The \exsh Package} |
| 105 |
\author{Sebastian Kuhnert\and Frank Fuhlbrück} |
| 106 |
\date{Version 0.17, \printdateTeX{2024/04/23}} |
| 107 |
|
| 108 |
\begin{document} |
| 109 |
\maketitle |
| 110 |
|
| 111 |
The \exsh package provides a way to typeset exercise sheets as used in university courses and school classes. It evolved from a set of macros an environments that were finally combined into this package. Starting from Version \vers{0.7}, there was an alternative variant designed for use with the beamer class, which is integrated into the main package since version \vers{0.11}. Not all combinations of options have been tested with the beamer variant. From version \vers{0.16} on, there is an embedded mode that allows using exercise in lecture notes etc. without requiring page breaks. Since the package includes a loading mechanism for exercises in external files, the same exercises can be reused in different contexts. |
| 112 |
|
| 113 |
|
| 114 |
\subsection*{Licence} |
| 115 |
Copyright \textcopyright{} 2008--2024 Sebastian Kuhnert and Frank Fuhlbrück. |
| 116 |
Permission is granted to copy, distribute and/or modify this software under the |
| 117 |
terms of the \LaTeX{} Project Public Licence, version 1.3c or later. This |
| 118 |
package is maintained, the Current Maintainer is |
| 119 |
Frank Fuhlbrück |
| 120 |
\footnote{\href{mailto:[email protected]}{[email protected]}}. |
| 121 |
|
| 122 |
|
| 123 |
\section{Reading this Document} |
| 124 |
|
| 125 |
\begin{itemize} |
| 126 |
\item All macros and environments defined by this package are |
| 127 |
printed in bold like this: \lstinline|\points| and |
| 128 |
\lstinline|\begin{sheet}\end{sheet}|. |
| 129 |
\item Key-value style options with a mandatory argument are |
| 130 |
printed like this: {\codestyle \option{only}=\param{list of ranges}}, while optional (usually boolean) arguments |
| 131 |
look like this: {\codestyle \option{embedded}\maybe{=\param{true/false}}}. |
| 132 |
\end{itemize} |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
\section{Related Classes and Packages} |
| 138 |
|
| 139 |
\subsection{Packages with Similar Functionality} |
| 140 |
\begin{itemize} |
| 141 |
\item The \texttt{exercise} package offers similar functionality, though the |
| 142 |
concept is a bit different: That package provides explicit commands for |
| 143 |
sub-exercises while \exsh (in its standard setting) |
| 144 |
relies on other means like the \texttt{enumerate} |
| 145 |
environment for this. An advantage of the \texttt{exercise} package is that |
| 146 |
answers can be delayed. On the other hand \exsh's environment based user |
| 147 |
interface is a bit cleaner and you have to care less about package internals. |
| 148 |
\item The \texttt{xsim} (and its predecessor \texttt{exsheets}) package also offers a similar set of features for the average user. It also has a mechanism for hiding certain exercises and solutions that works a bit differently than the mechanism of |
| 149 |
this package. There is (to my knowledge) no explicit beamer support. |
| 150 |
\end{itemize} |
| 151 |
|
| 152 |
\subsection{Recommended Additional Packages} |
| 153 |
\begin{itemize} |
| 154 |
\item The use of \texttt{hyperref} is encouraged. Please use the options |
| 155 |
\texttt{pdfusetitle}, \texttt{plainpages=false} and \texttt{pdfpagelabels} for |
| 156 |
optimal results. |
| 157 |
\item If the \texttt{babel} package is loaded, the appropriate |
| 158 |
\option{language=\param{lang}}-option is automatically derived and can be |
| 159 |
omitted. |
| 160 |
\item The use of \texttt{enumitem} or \texttt{paralist} is recommended. Top |
| 161 |
level enumerating lists are then modified to have the form (a), (b), \dots{}, |
| 162 |
which is useful in exercise definitions (you can override this). |
| 163 |
\item If the \texttt{varioref} package is used, appropriate label formats are |
| 164 |
installed for exercises and sub-exercises. |
| 165 |
\item If the \texttt{xcolor} package is loaded, to-do markers generated with |
| 166 |
\lstinline|\TODO| are printed in red. |
| 167 |
\end{itemize} |
| 168 |
|
| 169 |
\subsection{Packages Loaded by \exsh} |
| 170 |
\begin{itemize} |
| 171 |
\item \texttt{etoolbox} (at least version |
| 172 |
1.7) |
| 173 |
\item \texttt{scrlfile} (part of \KOMAScript{}) |
| 174 |
\item \texttt{pgfkeys} (part of PGF 2.0) |
| 175 |
\item \texttt{ifthen} |
| 176 |
\item \texttt{amsmath} (for \lstinline|\numberwithin|) |
| 177 |
\item \texttt{iflualatex} |
| 178 |
\item \texttt{refcount} (for \lstinline|\getrefnumber|) |
| 179 |
\end{itemize} |
| 180 |
|
| 181 |
|
| 182 |
\section{Basic Usage} |
| 183 |
|
| 184 |
\subsection{Package Loading} |
| 185 |
The beamer variant is integrated now and automatically activated |
| 186 |
if the current document class is beamer. |
| 187 |
|
| 188 |
\begin{lstlisting} |
| 189 |
\usepackage(*\maybe{[\param{options}]}*){exercisesheets} |
| 190 |
\end{lstlisting} |
| 191 |
|
| 192 |
The following options are available: |
| 193 |
\begin{description} |
| 194 |
\optitem[{\option{only}=\mand{\param{list of ranges}}}] When given, only the mentioned |
| 195 |
sheets will be included in the output. This is useful to speed up compilation |
| 196 |
times for big documents. Some efforts are made that sheet and exercise |
| 197 |
numbering remain consistent and references to exercises and enumerated lists |
| 198 |
on skipped sheets still work as expected. References to other objects are |
| 199 |
broken though (they currently point to the exercise or item containing them). |
| 200 |
The \param{list of ranges} is a comma separated list of sheet numbers and |
| 201 |
sheet ranges. If a comma is included in the range, it has to be protected with |
| 202 |
a pair of braces. The special sheet \enquote{number} \texttt{last} stands for |
| 203 |
the last sheet in the document (this may require an additional \LaTeX{} run). |
| 204 |
Examples: |
| 205 |
\begin{description} |
| 206 |
\optitem[{\option{only}=3}] Only include the 3rd sheet of the document. |
| 207 |
\optitem[{\option{only}=\{1,3,5,7\}}] Only include the sheets 1, 3, 5 and 7. |
| 208 |
\optitem[{\option{only}=last}] Only include the last sheet of the document. |
| 209 |
\optitem[{\option{only}=\{3-5,8-last\}}] Exclude the sheets 1, 2, 6 and 7. |
| 210 |
\optitem[{\option{only}=\{-2,5-\}}] Exclude the sheets 3 and 4. |
| 211 |
\end{description} |
| 212 |
\optitem[{\option{all}}] Typeset all sheets (equivalent to \option{only=-}). This is |
| 213 |
the default. |
| 214 |
\optitem[{\option{solutions\maybe{=\param{true/false/oral/nonoral/sample oral/sample nonoral/sample all}}}}] By default, |
| 215 |
solutions (provided in the \texttt{solution} environment) are not included in |
| 216 |
the output. By providing the option \option{solutions=true} (or just |
| 217 |
\option{solutions}) this can be changed. Choosing \option{solutions=oral} |
| 218 |
shows only solutions for exercises marked \option{oral} (useful for printouts |
| 219 |
taken to class). Choosing \option{solutions=nonoral} shows only solutions for |
| 220 |
exercises that are not marked \option{oral} (useful for correcting). |
| 221 |
If you want to provided sample solutions for your students but only for some |
| 222 |
of your exercises you can use the \texttt{sample} key to select those |
| 223 |
exercises along with any options starting with sample here. |
| 224 |
Note that non-sample exercises are skipped completely (not only their solutions) if you |
| 225 |
choose an option starting with sample. |
| 226 |
\optitem[{\option{gradingguides\maybe{=\param{true/false}}}}] |
| 227 |
Within \texttt{gradingguide} environments (usually used inside \texttt{solution}) you can |
| 228 |
specify e.g. the amount of points to assign for certain solutions. This option |
| 229 |
controls whether or not to include this guides in the output (e.g. solutions for |
| 230 |
correcting contain them, but sample solutions for students don't). |
| 231 |
\optitem[{\option{solutionsby}=\mand{\param{name/names}}}] Use this to give the authors of the |
| 232 |
solutions. They are credited at the beginning of each sheet, if the solutions |
| 233 |
are included in the output. |
| 234 |
\optitem[{\option{language}=\mand{\param{lang}}}] Set the language of the sheet and |
| 235 |
exercise heads to \param{lang}. If the \texttt{babel} package is loaded this |
| 236 |
is not necessary, as the main document language will be automatically |
| 237 |
detected. Currently \option{english}, \option{german} and \option{ngerman} are |
| 238 |
supported. Other translations are welcome: Please contact the author. |
| 239 |
\optitem[{\option{pointsfloatright}}] Use an alternative mechanism to place points for Sub-Exercises. |
| 240 |
If this option is used, the points label for a Sub-Exercise is placed at the (right) end of the current line. |
| 241 |
It is especially useful if used in a context like \texttt{$\backslash$item$\backslash$points$\{3\}$}. |
| 242 |
This option exploits (and partially breaks) RTL-Support. |
| 243 |
\optitem[{\option{exercisespath}}] Set the (relative) path of the |
| 244 |
directory containing exercises to be included via |
| 245 |
\lstinline|\includeexercise|. |
| 246 |
\optitem[{\option{patchenumerate}\maybe{=\param{true/false}}}] Sets |
| 247 |
enumerate item labels for the first four levels, starting with |
| 248 |
a), b) etc. for the top-level (sub-exercises). Depending on other |
| 249 |
loaded packages (\lstinline|enumitem|, \lstinline|paralist|) the mechanism |
| 250 |
slightly differs. This option is active by default. |
| 251 |
\optitem[{\option{settitle}\maybe{=\param{true/false}}}] If set to true |
| 252 |
(which is the default), |
| 253 |
the document \lstinline|\title| will be automatically set to the value |
| 254 |
of \option{strings/sheets} and the value of \option{strings/solutions} will be |
| 255 |
appended if \option{solutions} is not \lstinline|false|. |
| 256 |
\optitem[{\option{patchpagenumbers}\maybe{=\param{true/false}}}] If true |
| 257 |
(default), pages will be numbered within sheets and page numbers |
| 258 |
get a prefix of the form ``{\codestyle\param{sheet number}-}''. |
| 259 |
\optitem[{\option{usestartsection}\maybe{=\param{true/false}}}] If true |
| 260 |
(default), the command \lstinline|\@startsection| is used to create |
| 261 |
the header of any exercise as a section, which (among other |
| 262 |
things) adds an entry to the TOC (if existent) at level 1 |
| 263 |
(usually corresponding to \lstinline|\section|). |
| 264 |
\optitem[{\option{embedded}\maybe{=\param{true/false}}}] Default: false. |
| 265 |
Embedded mode allows for exercise ``sheets'' which do not |
| 266 |
interfere with a surrounding document. More explicitly, it does |
| 267 |
not interfere with \lstinline|secnumdepth|, defines special counters |
| 268 |
\lstinline|exshsheet| and \lstinline|exshexercise| to use them for |
| 269 |
\option{sheet counter} and \option{exercise counter}, |
| 270 |
respectively and sets all of \option{patchenumerate}, |
| 271 |
\option{settitle}, \option{patchpagenumbers} and |
| 272 |
\option{usestartsection} to \lstinline|false|. |
| 273 |
An internally defined macro which basically does no extra |
| 274 |
formatting or adding anything to the TOC is used as |
| 275 |
\option{sheet sectioning cmd} instead of the usual \lstinline|\part|. |
| 276 |
Finally, |
| 277 |
the \option{sheet start page action} and the |
| 278 |
\option{sheet end page action} are both set to \lstinline|\relax|. |
| 279 |
If you want to override any of this, do it after setting |
| 280 |
\option{embedded} to \lstinline|true|. |
| 281 |
\item{\option{minskips\maybe{=\param{true/false}}}} Default: false. |
| 282 |
If true, the values of |
| 283 |
\option{above sheet title skip}, |
| 284 |
\option{below sheet header skip}, |
| 285 |
\option{above first exercise skip} and |
| 286 |
\option{below exercise title skip} are all set to 0pt. |
| 287 |
\optitem[{\option{showtodos} / \option{hidetodos}}] |
| 288 |
\lstinline|\TODO| markers |
| 289 |
are hidden by default, this option switches their behavior. This |
| 290 |
option is usually set within \lstinline|\ifsamplesolutions| or |
| 291 |
similar. |
| 292 |
\optitem[{\option{beamercompatibility}\maybe{=\param{true/false}}}] |
| 293 |
This option (which only is effective in the non-beamer version) |
| 294 |
defines several beamer macros with as trivial |
| 295 |
effects as possible, e.g., \lstinline|\pause| becomes \lstinline|\relax| |
| 296 |
and overlay specifications are mostly ignored. Be careful to use |
| 297 |
this option after loading \lstinline|enumitem| etc. as the enumerate |
| 298 |
and itemize environment are defined to swallow overlay |
| 299 |
specifications without effect, this also holds for |
| 300 |
\lstinline|\item<1->|. If you load \lstinline|exercisesheets| before them |
| 301 |
use \lstinline|\exshset| afterwards. |
| 302 |
The current list of redefinitions is as |
| 303 |
follows: |
| 304 |
\begin{lstlisting} |
| 305 |
\let\pause\relax |
| 306 |
\def\frame{} |
| 307 |
\renewcommand{\frame}[1][]{} |
| 308 |
\let\endframe\relax |
| 309 |
\def\onslide<##1>{} |
| 310 |
\def\only<##1>##2{##2} |
| 311 |
\def\uncover<##1>##2{##2} |
| 312 |
\def\visible<##1>##2{##2} |
| 313 |
\def\invisible<##1>##2{##2} |
| 314 |
\long\def\alt<##1>##2##3{##2} |
| 315 |
\long\def\temporal<##1>##2##3##4{##3} |
| 316 |
\let\exsh@origitem\item |
| 317 |
\def\exsh@ovrlitem<##1>{\exsh@origitem} |
| 318 |
\def\item{\@ifnextchar<\exsh@ovrlitem\exsh@origitem} |
| 319 |
\let\exsh@origitemize\itemize |
| 320 |
\def\exsh@ovrlitemize[##1]{\exsh@origitemize} |
| 321 |
\def\itemize{\@ifnextchar[\exsh@ovrlitemize\exsh@origitemize} |
| 322 |
\let\exsh@origenumerate\enumerate |
| 323 |
\def\exsh@ovrlenumerate[##1]{\exsh@origenumerate} |
| 324 |
\def\enumerate{% |
| 325 |
\@ifnextchar[\exsh@ovrlenumerate\exsh@origenumerate} |
| 326 |
\end{lstlisting} |
| 327 |
|
| 328 |
\optitem[{\option{filenameasexercisename}\maybe{=\param{true/false}}}] |
| 329 |
This option (set to false by default) causes |
| 330 |
\lstinline|\includeexercise| to |
| 331 |
set the name of an exercise as the filename (without extension). |
| 332 |
This has two purposes: If you have nice file names you can |
| 333 |
automatically name the exercise. On the other hand this is helpful |
| 334 |
during exercise sheet composition because it shows the name of |
| 335 |
the corresponding file in the compiled file. |
| 336 |
\end{description} |
| 337 |
|
| 338 |
\subsection{Supplying Meta-Data} |
| 339 |
|
| 340 |
The following commands are enhanced (or provided) to set the options controlling |
| 341 |
the sheet headers (see Section~\ref{sec:sheet}): |
| 342 |
\begin{lstlisting} |
| 343 |
\subject{(*\param{subject}*)} |
| 344 |
\author{(*\param{author}*)} |
| 345 |
\date{(*\param{semester}*)} |
| 346 |
\end{lstlisting} |
| 347 |
|
| 348 |
If one of these commands is omitted (and the corresponding option is not used |
| 349 |
either), a warning is issued. |
| 350 |
|
| 351 |
Please do not include a \lstinline|\title| in your document, as \exsh will |
| 352 |
automatically generate an appropriate one (this may require an additional |
| 353 |
\LaTeX{} run). If you want to set the title yourself, set the |
| 354 |
option \option{settitle} to \lstinline|false|. |
| 355 |
|
| 356 |
All this information is included in the PDF meta-data if the \texttt{hyperref} |
| 357 |
package is loaded with the option \texttt{pdfusetitle}. |
| 358 |
|
| 359 |
There is also a related option: |
| 360 |
\begin{description} |
| 361 |
\optitem[{\option{exauthor}=\mand{\param{list of names}}}] If you want to use the |
| 362 |
\lstinline|\author| macro for the general author of a course but |
| 363 |
there are different authors for individual exercises or all |
| 364 |
exercises in general, you can set this key. Currently only |
| 365 |
exercisesheets-baemer uses this for the footline, while |
| 366 |
\option{author} is used for the headline. |
| 367 |
\end{description} |
| 368 |
|
| 369 |
\subsection{Defining Exercise Sheets} |
| 370 |
\label{sec:sheet} |
| 371 |
\begin{lstlisting} |
| 372 |
\begin{sheet}(*\maybe{[\param{options}]}*) |
| 373 |
(*\param{sheet contents}*) |
| 374 |
\end{sheet} |
| 375 |
\end{lstlisting} |
| 376 |
|
| 377 |
Insert a sheet into the document. This environment can be repeated to combine |
| 378 |
several sheets in a single \LaTeX{} file. For each sheet, a new page is started |
| 379 |
and an appropriate header is generated. The \param{sheet contents} can be |
| 380 |
anything but will usually consist of several \texttt{exercise} environments (see |
| 381 |
Section~\ref{sec:exercises-solutions}). |
| 382 |
|
| 383 |
The following \param{options} are supported: |
| 384 |
\begin{description} |
| 385 |
\optitem[{\option{date}=\mand{\param{date}}}] Set the date the sheet was/will be issued. This |
| 386 |
information is included in the sheet header. By default, this information is |
| 387 |
omitted. See also the \option{semester} option. |
| 388 |
\optitem[{\option{note}=\mand{\param{note}}}] Include \param{note} in the sheet header. |
| 389 |
Useful to inform students when the sheet is due. If you want a note consisting |
| 390 |
of more than one line split at a particular position, use |
| 391 |
\lstinline|\protect\linebreak|. |
| 392 |
\optitem[{\option{title}=\mand{\param{title}}}] |
| 393 |
Directly set the sheet title. When this option is used, different |
| 394 |
page numbering conventions are used. This is useful to |
| 395 |
typeset exams (combined with the next option). |
| 396 |
\optitem[{\option{number within sheet\maybe{=\param{true/false}}}}] |
| 397 |
Deviate from the usual numbering theme and |
| 398 |
restart from one for exercises on the sheet. The previous |
| 399 |
counter value is restored after the sheet, so you can insert |
| 400 |
a special sheet. |
| 401 |
\optitem[{\option{author}=\mand{\param{author}}}] Set the author included in the sheet |
| 402 |
head. By default, the value passed to \lstinline|\author| is used. |
| 403 |
\optitem[{\option{exauthor}=\mand{\param{exauthor}}}] Only used by the beamer |
| 404 |
variant, see above. |
| 405 |
\optitem[{\option{subject}=\mand{\param{subject}}}] Set the subject included in the sheet |
| 406 |
head. By default, the value passed to \lstinline|\subject| is used. |
| 407 |
\optitem[{\option{semester}=\mand{\param{semester}}}] Set the semester included in the |
| 408 |
sheet head. By default, the value passed to \lstinline|\date| is used. |
| 409 |
\optitem[{\option{beamerwithheadline\maybe{=\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 |
| 410 |
off space. If you specify the embedded option the current default headers and footers will be used if you omit this option. Otherwise omitting it will imply an empty headline. |
| 411 |
\optitem[{\option{beamerwithfootline\maybe{=\param{true/false}}}}] |
| 412 |
The same for the footer. |
| 413 |
\optitem[{\option{beameruseblocks\maybe{=\param{true/false}}}}] |
| 414 |
Controls whether the exercise title is shown inside a |
| 415 |
beamer block (\param{true}) or a simple colorbox |
| 416 |
(\param{false}, the default). Depending on your style a |
| 417 |
block might look fancier, but it usually consume more space. |
| 418 |
\end{description} |
| 419 |
|
| 420 |
|
| 421 |
\subsection{Defining Exercises and Solutions} |
| 422 |
\label{sec:exercises-solutions} |
| 423 |
\begin{lstlisting} |
| 424 |
\begin{exercise}(*\maybe{[\param{options}]}*) |
| 425 |
(*\param{exercise text}*) |
| 426 |
\begin{solution}(*\maybe{[\param{solution options}]}*) |
| 427 |
(*\param{solution text}*) |
| 428 |
\end{solution} |
| 429 |
\begin{beamersolution}(*\maybe{[\param{solution options}]}*) |
| 430 |
(*\param{solution text}*) |
| 431 |
\end{beamersolution} |
| 432 |
\end{exercise} |
| 433 |
\end{lstlisting} |
| 434 |
|
| 435 |
This inserts an exercise into the current document. All |
| 436 |
\lstinline|beamersolution|s are ignored, if the |
| 437 |
\exsh package with any class but beamer, but using beamer |
| 438 |
\exsh also processes |
| 439 |
normal solutions by default (set option \option{beamersolution} |
| 440 |
to turn this off). |
| 441 |
|
| 442 |
The following options are |
| 443 |
supported: |
| 444 |
\begin{description} |
| 445 |
\optitem[{\option{name}=\mand{\param{text}}}] Use \param{text} as the name of the exercise. |
| 446 |
Useful for exercises that prove a famous theorem. |
| 447 |
\optitem[{\option{firstline}=\mand{\param{text}}}] Save some space by text \param{text} |
| 448 |
behind the exercise title. |
| 449 |
\optitem[{\option{savetasks\maybe{=\param{true/false}}}}] Saves the main task and each sub task |
| 450 |
for later use with \lstinline|\restatetask[|% |
| 451 |
\param{which}], where \param{which} is either \lstinline|main| |
| 452 |
(default) or the number of a sub task. |
| 453 |
\optitem[{\option{points}=\mand{\param{number/oral/sum}}}] Assign this |
| 454 |
exercise \param{number} points. By default, exercises are |
| 455 |
unlabelled. \param{oral} works the same way as the option |
| 456 |
\option{oral}. The value \param{sum} displays the sum of all |
| 457 |
occurrences of \lstinline|\points| within the exercise: Ordinary and |
| 458 |
bonus points are treated separately. If there are only bonus |
| 459 |
points, the option \option{bonus} is automatically triggered. To |
| 460 |
undo this, either delete the \filename{.aux} file or explicitly use |
| 461 |
\lstinline|\points[bonus=false]{\param{number}}| for at least one |
| 462 |
subexercise. Points can be summed up also during a single pass |
| 463 |
by using the Lua interface. |
| 464 |
\optitem[{\option{oral}}] Label this exercise as \emph{oral}. This supersedes and is |
| 465 |
superseded by the option \option{points}. |
| 466 |
\optitem[{\option{pointsinfo}=\mand{\param{text}}}] Supply \param{text} as additional |
| 467 |
information to be displayed after the points. |
| 468 |
\optitem[{\option{optional}}] Shortcut for \option{pointsinfo=optional} with |
| 469 |
automatic translation and abbreviation (if requested). |
| 470 |
\optitem[{\option{bonus}}] Change \enquote{points} to \enquote{bonus points} (with |
| 471 |
automatic translation and abbreviation). |
| 472 |
\optitem[{\option{abbrev}}] Use abbreviated labels. |
| 473 |
\optitem[{\option{exercisemark}=\mand{\param{symbol}}}] Mark the exercise |
| 474 |
with \param{symbol} in the left margin. |
| 475 |
\optitem[{\option{difficult}}] Shortcut for \option{exercisemark=*}. |
| 476 |
\optitem[{\option{solutions\maybe{=\param{true/false/oral/nonoral/...}}}}] Use this to override the |
| 477 |
document (or sheet) default. |
| 478 |
\optitem[{\option{sample}}] Include this exercise (and its solution) in while compiling |
| 479 |
sample solutions. |
| 480 |
\optitem[{\option{beamersolution}}] For beamer variant only. If this option |
| 481 |
is set all normal solutions will not be included and only |
| 482 |
\lstinline|beamersolution|s are typeset. |
| 483 |
\optitem[{\option{framed}}] For beamer variant only, simply ignored |
| 484 |
elsewhere. If this option |
| 485 |
is set for a normal solution, its content will be put on one or |
| 486 |
more frames. Use \lstinline|\newframe| to start a new frame. This |
| 487 |
option is especially helpful if you provide your own definitions |
| 488 |
of \lstinline|\only| etc. and/or use the \option{beamercompatibility}. |
| 489 |
for non-beamer compilation. \lstinline|\newframe| |
| 490 |
is already defined as \lstinline|\relax| in non-beamer \exsh, |
| 491 |
even without invoking \option{beamercompatibility}. |
| 492 |
\optitem[{\option{fragile}}] For beamer variant only and only |
| 493 |
used combined with framed, simply ignored elsewhere. Frames are |
| 494 |
declared as \texttt{fragile} und parsing of \lstinline|\newframe| |
| 495 |
etc. is done via Lua\LaTeX. Thus Lua\LaTeX is required |
| 496 |
(and this requires font setup via fontspec etc.), but |
| 497 |
you do not have to use any Lua code yourself. Mostly useful |
| 498 |
for listings and other verbatim stuff within solutions. |
| 499 |
\end{description} |
| 500 |
|
| 501 |
Solutions are only typeset, if the \option{solutions} option is in effect. There |
| 502 |
can be multiple solution environments within a single exercise environment; this |
| 503 |
is useful if the exercise consists of several sub-exercises. Sub-exercises can |
| 504 |
simply be defined with an \texttt{enumerate} or \texttt{compactenum} |
| 505 |
environment. |
| 506 |
|
| 507 |
\section{Utilities} |
| 508 |
|
| 509 |
\subsection{Loading Excercises From Files} |
| 510 |
\begin{lstlisting} |
| 511 |
\includeexercise(*\param{file name}*) |
| 512 |
\includeexercise*(*\param{file name}*) |
| 513 |
\end{lstlisting} |
| 514 |
|
| 515 |
Both load the exercise from exercisespath/\param{file name}. Note |
| 516 |
that the exercise environment must be contained in the file. The |
| 517 |
starred version is helpful for faster skipping of unused exercises. |
| 518 |
In this case, the file is not opened to search for labels. Whenever |
| 519 |
the exercise is not skipped and you use the starred version and also |
| 520 |
use labels within the exercise file, \exsh outputs an error. This is |
| 521 |
done to ensure that references are not overlooked when the exercise |
| 522 |
is actually skipped later. |
| 523 |
|
| 524 |
\subsection{Including Hints} |
| 525 |
|
| 526 |
\begin{lstlisting} |
| 527 |
\begin{hint}(*\maybe{[\param{options}]}*) |
| 528 |
(*\param{hint text}*) |
| 529 |
\end{hint} |
| 530 |
\end{lstlisting} |
| 531 |
|
| 532 |
\begin{lstlisting} |
| 533 |
\begin{hint*}(*\maybe{[\param{options}]}*) |
| 534 |
(*\param{hint text}*) |
| 535 |
\end{hint*} |
| 536 |
\end{lstlisting} |
| 537 |
|
| 538 |
These environments include hints in the exercise definition. The first form |
| 539 |
starts a new paragraph, the second one puts the hint in parenthesis. |
| 540 |
|
| 541 |
\subsection{TODO Markers} |
| 542 |
|
| 543 |
You can use the following to include a red TODO marker in your document. This is |
| 544 |
useful to mark places where work is still in progress. A warning is issued at |
| 545 |
each place. TODO markers can also contain an optional description |
| 546 |
of the task that needs to be done. If you switch off displaying |
| 547 |
TODO markers (s.a.) the warning will be issued nevertheless. |
| 548 |
|
| 549 |
\begin{lstlisting} |
| 550 |
\TODO[what needs to be done] |
| 551 |
\end{lstlisting} |
| 552 |
|
| 553 |
\subsection{Annotating Points for Sub-Exercises} |
| 554 |
\begin{lstlisting} |
| 555 |
\begin{exercise}[(*\option{points}*)=sum]%sum produces 4+6 |
| 556 |
\begin{enumerate} |
| 557 |
\item Part 1 \points{oral} |
| 558 |
\item Part 2 \points[optional]{oral} |
| 559 |
\item Part 3 \points{4} |
| 560 |
\item Part 4 \points[bonus]{6} |
| 561 |
\end{enumerate} |
| 562 |
Sub-Exercises within continuous text can be annotated like this \points[inplace]{3} without adding space. |
| 563 |
\end{exercise} |
| 564 |
\end{lstlisting} |
| 565 |
|
| 566 |
\subsection{Explicitly Stating Tasks} |
| 567 |
In principle, \exsh aims to be very lightweight and there is not |
| 568 |
much mandatory structure inside exercises. Furthermore, the |
| 569 |
\lstinline|enumi| counter is used for sub-exercise. There are, however, |
| 570 |
situations where we want more explicit structure, for instance to |
| 571 |
have special font for the main task or the subtasks or to reuse |
| 572 |
some of the tasks later. This is especially handy if using the |
| 573 |
beamer variant where the original task and a part of the solution might be on different slides. In the future it might be possible to |
| 574 |
use other counters then \lstinline|enumi|, which is also only possible |
| 575 |
if sub-exercises are not simply \lstinline|\item|s in |
| 576 |
\lstinline|enumerate|. If you want to reuse the main or any subtasks |
| 577 |
you may use \lstinline|\restatetask| or \lstinline|\restatetaskbeamer| |
| 578 |
(this shows noting if not compiled with beamer). There is also |
| 579 |
a starred version (\lstinline|\restatetask*| / |
| 580 |
\lstinline|\restatetaskbeamer*|) for each of them, which adds a newline. |
| 581 |
All four have an optional argument that allows to restate |
| 582 |
a subtask instead of the main task. This argument is either |
| 583 |
\lstinline|main|, a number of a \textbf{previous} subtask or |
| 584 |
\lstinline|cur| for the current subtask. Using \option{headerrestate} |
| 585 |
for your solution will automatically restate the current |
| 586 |
task within the beamer solution header (does noting without |
| 587 |
beamer). |
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
\begin{lstlisting} |
| 592 |
\begin{exercise}[(*\option{points}*)=oral] |
| 593 |
\begin{maintask} |
| 594 |
A and B are true. |
| 595 |
\end{maintask} |
| 596 |
\begin{subtasks} |
| 597 |
\subtask{A is true} |
| 598 |
\begin{solution}[framed] |
| 599 |
We want to show: \restatetask %A and B are true. |
| 600 |
\newframe |
| 601 |
Out first step is to show: \restatetask[cur] %A is true |
| 602 |
\end{solution} |
| 603 |
\subtask{If A is true, B is true.} |
| 604 |
\begin{solution}[framed] |
| 605 |
Obvious (i.e.: homework). |
| 606 |
\end{solution} |
| 607 |
\subtask{B is true} |
| 608 |
\begin{solution}[framed] |
| 609 |
We already know: \restatetask[1] and |
| 610 |
\restatetask[2], therefore B is also true. |
| 611 |
\end{solution} |
| 612 |
\end{subtasks} |
| 613 |
\end{exercise} |
| 614 |
\end{lstlisting} |
| 615 |
|
| 616 |
\subsection{Labels and References within an Exercise} |
| 617 |
While the global reference labels set via varioref (if loaded) |
| 618 |
are nice for references to subexercises far away, always mentioning |
| 619 |
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 \lstinline|\subexnref| and |
| 620 |
\lstinline|\subexlref| are designed for. However, both of them still |
| 621 |
require an ordinary label, which is not allowed in |
| 622 |
exercises loaded with \lstinline|\loadexercise*|. |
| 623 |
For this purpose \lstinline|\inexlabel| can be used which is just a |
| 624 |
normal label that is not redefined to produce an error. |
| 625 |
Furthermore, we define a counter \lstinline|subex| (which is |
| 626 |
currently just an alias for enumi, but this might change). You can |
| 627 |
use this counter (alias) with common commands like |
| 628 |
\lstinline|\arabic| or \lstinline|\alph|. |
| 629 |
|
| 630 |
\begin{lstlisting} |
| 631 |
\begin{exercise} |
| 632 |
\begin{enumerate} |
| 633 |
\item \inexlabel{subex:xisseven} Let $x_{\thesubex}=7$. |
| 634 |
\item Compute $x_{\subexnref{subex:xisseven}}+3$. |
| 635 |
\begin{solution} |
| 636 |
From \subexlref{subex:xisseven} %(a) |
| 637 |
we know that $x_{\subexnref{subex:xisseven}}$ is $7$ and |
| 638 |
thus the sum is $10$. |
| 639 |
\end{solution} |
| 640 |
\end{enumerate} |
| 641 |
\end{exercise} |
| 642 |
\end{lstlisting} |
| 643 |
|
| 644 |
|
| 645 |
|
| 646 |
\section{Advanced Usage} |
| 647 |
|
| 648 |
\subsection{Setting Options} |
| 649 |
|
| 650 |
Options can be given at different places. |
| 651 |
\begin{enumerate} |
| 652 |
\item As local options to one of the environments. |
| 653 |
\item As package options: This is convenient for global options but suffers |
| 654 |
from shortcomings in way \LaTeX{} processes options: Macros are expanded and |
| 655 |
spaces are stripped. |
| 656 |
\item By the independent \lstinline|\exshset| command. This is especially useful in |
| 657 |
the preamble to set options that would be garbled by the \LaTeX{} option |
| 658 |
handling routine. It also allows to change an option for the rest of the |
| 659 |
current scope. |
| 660 |
\end{enumerate} |
| 661 |
|
| 662 |
Example: Change the solution authors of the following sheets: |
| 663 |
\begin{lstlisting} |
| 664 |
(*\param{some sheets}*) |
| 665 |
\exshset{solutionsby=(*\param{other authors}*)} |
| 666 |
(*\param{more sheets}*) |
| 667 |
\end{lstlisting} |
| 668 |
|
| 669 |
\subsection{Changing Strings} |
| 670 |
|
| 671 |
For some languages, predefined sets of strings are provided and automatically |
| 672 |
activated. If your language is not supported or if you want to change (some of) |
| 673 |
the used strings, you can do so with the following options: |
| 674 |
\begin{description} |
| 675 |
\optitem[{\option{strings/sheet}=\mand{\param{string}}}] |
| 676 |
\optitem[{\option{strings/sheets}=\mand{\param{string}}}] |
| 677 |
\optitem[{\option{strings/solutions}=\mand{\param{string}}}] |
| 678 |
\optitem[{\option{strings/solutionsby}=\mand{\param{string}}}] |
| 679 |
\optitem[{\option{strings/exercise}=\mand{\param{string}}}] |
| 680 |
\optitem[{\option{strings/solution}=\mand{\param{string}}}] |
| 681 |
\optitem[{\option{strings/hint}=\mand{\param{string}}}] |
| 682 |
\optitem[{\option{strings/oral}=\mand{\param{string}}}] |
| 683 |
\optitem[{\option{strings/oral abbrev}=\mand{\param{string}}}] |
| 684 |
\optitem[{\option{strings/point}=\mand{\param{string}}}] |
| 685 |
\optitem[{\option{strings/points}=\mand{\param{string}}}] |
| 686 |
\optitem[{\option{strings/points abbrev}=\mand{\param{string}}}] |
| 687 |
\optitem[{\option{strings/bonus point}=\mand{\param{string}}}] |
| 688 |
\optitem[{\option{strings/bonus points}=\mand{\param{string}}}] |
| 689 |
\optitem[{\option{strings/bonus points abbrev}=\mand{\param{string}}}] |
| 690 |
\optitem[{\option{strings/optional}=\mand{\param{string}}}] |
| 691 |
\optitem[{\option{strings/optional abbrev}=\mand{\param{string}}}] |
| 692 |
\end{description} |
| 693 |
|
| 694 |
Example: Give an introduction that should only be included in the version with |
| 695 |
solutions: |
| 696 |
|
| 697 |
\begin{lstlisting} |
| 698 |
\begin{solution}[(*\option{strings/solution}*)=Introduction] |
| 699 |
(*\param{introduction text}*) |
| 700 |
\end{solution} |
| 701 |
\end{lstlisting} |
| 702 |
|
| 703 |
|
| 704 |
\subsection{Changing Fonts} |
| 705 |
|
| 706 |
The package \exsh comes with its own way to change the used fonts. Each font can |
| 707 |
be changed in the following way: |
| 708 |
\begin{lstlisting} |
| 709 |
\exshset{(*\param{font element}=\param{font specification}*)} |
| 710 |
\end{lstlisting} |
| 711 |
The available \param{font element}s are listed below together with their default |
| 712 |
values: |
| 713 |
\begin{description} |
| 714 |
\optitem[{\option{sheet header font}}] The basic font for subject, author, semester, |
| 715 |
date, note and solution authors in the sheet headers.\\ |
| 716 |
Default: \lstinline|\normalfont\normalsize| |
| 717 |
\optitem[{\option{subject font}}] The font for the subject in the sheet header.\\ |
| 718 |
Default: \lstinline|\scshape| |
| 719 |
\optitem[{\option{author font}}] The font for the author in the sheet header.\\ |
| 720 |
Default: \lstinline|\scshape| |
| 721 |
\optitem[{\option{semester font}}] The font for the semester in the sheet header.\\ |
| 722 |
Default: empty, i.\,e.\ no change. |
| 723 |
\optitem[{\option{date font}}] The font for the date in the sheet header.\\ |
| 724 |
Default: empty, i.\,e.\ no change. |
| 725 |
\optitem[{\option{solutionsby font}}] The font for the information who has produced |
| 726 |
the solutions provided below the sheet title.\\ |
| 727 |
Default: \lstinline|\itshape| |
| 728 |
\optitem[{\option{sheet note font}}] The font for the note provided below the sheet |
| 729 |
title.\\ |
| 730 |
Default: \lstinline|\itshape\bfseries| |
| 731 |
\optitem[{\option{sheet title font}}] The font for the sheet title itself.\\ |
| 732 |
Default: \lstinline|\Large\bfseries| |
| 733 |
\optitem[{\option{exercise title font}}] The font for the exercise title.\\ |
| 734 |
Default: \lstinline|\bfseries| |
| 735 |
\optitem[{\option{points font}}] The font for the number of points in the exercise |
| 736 |
head (relative to the exercise title) and for \lstinline|\points|.\\ |
| 737 |
Default: \lstinline|\itshape| |
| 738 |
\optitem[{\option{main task font}}] The font for the |
| 739 |
\lstinline|maintask| environment.\\ |
| 740 |
Default: empty, i.\,e.\ no change. |
| 741 |
\optitem[{\option{subtask font}}] The font for each |
| 742 |
\lstinline|\subtask|.\\ |
| 743 |
Default: empty, i.\,e.\ no change. |
| 744 |
\optitem[{\option{task restate font}}] The font used for |
| 745 |
\lstinline|\restatetask|.\\ |
| 746 |
Default: \lstinline|\itshape| |
| 747 |
\optitem[{\option{hint font}}] The font for hints. \\ |
| 748 |
Default: empty, i.\,e.\ no change. |
| 749 |
\optitem[{\option{hint title font}}] The font for the string \enquote{Hint:}.\\ |
| 750 |
Default: \lstinline|\itshape| |
| 751 |
\optitem[{\option{solution font}}] The font for solutions.\\ |
| 752 |
Default: empty, i.\,e.\ no change. |
| 753 |
\optitem[{\option{solution title font}}] The font for the string |
| 754 |
\enquote{Solution:}\\ |
| 755 |
Default: \lstinline|\bfseries| |
| 756 |
\optitem[{\option{grading guide font}}] The font for grading guides.\\ |
| 757 |
Default: \lstinline|\itshape| |
| 758 |
\optitem[{\option{todo marker font}}] The font for the string \enquote{TODO}.\\ |
| 759 |
Default: \lstinline|\ifdef{\color}{\color{red}}{}\bfseries| |
| 760 |
\end{description} |
| 761 |
|
| 762 |
\subsection{Controlling the Spacing, Page Handling and Separations between Elements} |
| 763 |
|
| 764 |
The following options allow fine-tuning of the spacing: |
| 765 |
\begin{description} |
| 766 |
\optitem[{\option{below slide headline skip}=\mand{\param{dimen}}}] The distance between |
| 767 |
haedline (if present) and slide content. Only used by beamer |
| 768 |
variant, ignored elsewhere.\\ |
| 769 |
Default: \texttt{0mm} |
| 770 |
\optitem[{\option{above sheet title skip}=\mand{\param{dimen}}}] The distance between |
| 771 |
author/date and sheet title.\\ |
| 772 |
Default: \texttt{4ex} |
| 773 |
\optitem[{\option{above sheet note skip}=\mand{\param{dimen}}}] The distance above the |
| 774 |
sheet note.\\ |
| 775 |
Default: \texttt{.7ex} |
| 776 |
\optitem[{\option{above solutionsby skip}=\mand{\param{dimen}}}] The distance above the |
| 777 |
solution author.\\ |
| 778 |
Default: \texttt{1ex} |
| 779 |
\optitem[{\option{below sheet header skip}=\mand{\param{dimen}}}] The distance below the |
| 780 |
sheet header.\\ |
| 781 |
Default: \texttt{4ex plus 1ex minus .5ex} |
| 782 |
\optitem[{\option{above exercise skip}=\mand{\param{dimen}}}] The distance above |
| 783 |
exercises.\\ |
| 784 |
Default: \texttt{3ex plus 1ex minus .5ex} |
| 785 |
\optitem[{\option{below exercise title skip}=\mand{\param{dimen}}}] The distance below |
| 786 |
exercise titles.\\ |
| 787 |
Default: \texttt{\textbackslash parskip} |
| 788 |
\optitem[{\option{above solution skip}=\mand{\param{dimen}}}] The distance above |
| 789 |
solutions.\\ |
| 790 |
Default: \texttt{1ex} |
| 791 |
\optitem[{\option{above hint skip}=\mand{\param{dimen}}}] The distance above hints.\\ |
| 792 |
Default: \texttt{1ex} |
| 793 |
\end{description} |
| 794 |
|
| 795 |
The following two options control the page handling at the beginning and |
| 796 |
at the end of each sheet: |
| 797 |
\begin{description} |
| 798 |
\optitem[{\option{sheet start page action}=\mand{\param{macro}}}] Executed at the beginning |
| 799 |
of each sheet.\\ |
| 800 |
Default: \lstinline|\clearpage| |
| 801 |
\optitem[{\option{sheet end page action}=\mand{\param{macro}}}] Executed at the end |
| 802 |
of each sheet.\\ |
| 803 |
Default: \lstinline|\clearpage| |
| 804 |
\end{description} |
| 805 |
|
| 806 |
The following option controls what follows after the string |
| 807 |
\option{strings/solution} within a solution header. Using this, you can disable a solution header completely or, for instance, add |
| 808 |
a horizontal bar below each solution title. |
| 809 |
\begin{description} |
| 810 |
\optitem[{\option{solution title separator}=\mand{\param{content}}}] Inserted directly after \option{strings/solution} in a solution title:\\ |
| 811 |
Default: \lstinline|:\par| |
| 812 |
\end{description} |
| 813 |
|
| 814 |
\subsection{Controlling the Sectioning (beta)} |
| 815 |
|
| 816 |
By default, exercises are sections and sheets are parts. They use |
| 817 |
the respective counters and commands. This is impractical, if you |
| 818 |
want to include exercise ``sheets'' as, e.g., a subsection within |
| 819 |
a section of a book or article. While the page handling options |
| 820 |
already allow to dismiss page breaks, sectioning commands might |
| 821 |
still break your layout or structure. Since version \vers{0.15} you |
| 822 |
can use your own counters and commands to start sheets and |
| 823 |
(to a certain degree) exercises. Exercises are currently still |
| 824 |
started by \lstinline|\@startsection| with the counter set to |
| 825 |
\option{exercise counter}, but the level set to 1 (e.g. section). |
| 826 |
This will likely change with one of the next versions, but needs |
| 827 |
some testing. Thus, if you use any of these options, watch for |
| 828 |
undesired consequences and report them via gitlab if possible. |
| 829 |
|
| 830 |
\begin{description} |
| 831 |
\optitem[{\option{sheet sectioning cmd}=\mand{\param{macro}}}] This macro is |
| 832 |
called only in one place in the following way: |
| 833 |
\lstinline|\macro[short title]{long title}|, so it |
| 834 |
must take one argument in [brackets] and one normal argument.\\ |
| 835 |
Default: \lstinline|\part| |
| 836 |
\optitem[{\option{sheet counter}=\mand{\param{counter}}}] This counter will be |
| 837 |
incremented wit every sheet. There was always an internal counter |
| 838 |
\lstinline|sheetid| used to distinguish sheets for hyperref even if |
| 839 |
\lstinline|part|s value changed. Do not use this counter here, as it will have strange effects (incremented twice).\\ |
| 840 |
Default: \lstinline|part| |
| 841 |
\optitem[{\option{exercise counter}=\mand{\param{counter}}}] This counter will |
| 842 |
be incremented wit every exercise (usually within each sheet). |
| 843 |
Default: \lstinline|section| |
| 844 |
\end{description} |
| 845 |
|
| 846 |
\subsection{Special Code for Solutions} |
| 847 |
\begin{lstlisting} |
| 848 |
\ifsolutions{(*\param{if true}*)}{(*\param{if false}*)} |
| 849 |
\iforalsolutions{(*\param{if true}*)}{(*\param{if false}*)} |
| 850 |
\ifnonoralsolutions{(*\param{if true}*)}{(*\param{if false}*)} |
| 851 |
\ifsamplesolutions{(*\param{if true}*)}{(*\param{if false}*)} |
| 852 |
\end{lstlisting} |
| 853 |
|
| 854 |
There are also special options for conditionals to be used in the arguments of |
| 855 |
the environments defined by this package: |
| 856 |
\begin{description} |
| 857 |
\item[\option{ifsolutions=\{\param{options if true}\}\{\param{options if |
| 858 |
false}\}}] Execute \param{options if true} if solutions are included in |
| 859 |
the current document, \param{options if false} otherwise. |
| 860 |
\item[\option{iforalsolutions=\{\param{options if true}\}\{\param{options if |
| 861 |
false}\}}] Execute \param{options if true} if solutions for oral exercises |
| 862 |
are included in the current document, \param{options if false} otherwise. |
| 863 |
\item[\option{ifnonoralsolutions=\{\param{options if true}\}\{\param{options if |
| 864 |
false}\}}] Execute \param{options if true} if solutions for non-oral |
| 865 |
exercises are included in the current document, \param{options if false} |
| 866 |
otherwise. |
| 867 |
\item[\option{ifsamplesolutions=\{\param{options if true}\}\{\param{options if |
| 868 |
false}\}}] Execute \param{options if true} if sample solutions for marked |
| 869 |
exercises are included in the current document, \param{options if false} |
| 870 |
otherwise. |
| 871 |
\end{description} |
| 872 |
|
| 873 |
Example 1: Only include points for sub-exercises when solutions are typeset: |
| 874 |
\begin{lstlisting} |
| 875 |
\ifsolutions{}{\renewcommand{\points}[2][]{}} |
| 876 |
\end{lstlisting} |
| 877 |
|
| 878 |
Example 2: Modify the sheet header spacing in the non-solution version: |
| 879 |
\begin{lstlisting} |
| 880 |
\begin{sheet}[(*\option{ifsolutions}*)={}{(*\option{above title skip}*)=2ex}]% usually 4ex |
| 881 |
\dots |
| 882 |
\end{sheet} |
| 883 |
\end{lstlisting} |
| 884 |
|
| 885 |
\subsection{Using Hooks} |
| 886 |
There are several hooks used by \exsh: |
| 887 |
\begin{description} |
| 888 |
\optitem[{\option{every sheet}}] This is used at the beginning of every sheet. |
| 889 |
\optitem[{\option{every exercise}}] This is used at the beginning of every exercise. |
| 890 |
\optitem[{\option{every solution}}] This is used at the beginning of every solution. |
| 891 |
\optitem[{\option{every hint}}] This is used at the beginning of every hint. |
| 892 |
\end{description} |
| 893 |
|
| 894 |
Hooks can be used to influence the behaviour of the respective environments. |
| 895 |
Users of \texttt{tikz} should be familiar with the concept. |
| 896 |
|
| 897 |
\subsection{Control Skipping of Custom Macros in Skipped Exercises} |
| 898 |
\begin{description} |
| 899 |
\optitem[{\option{custom skip macro}=\mand{\param{macro}}}] |
| 900 |
\end{description} |
| 901 |
|
| 902 |
If an exercise is not printed, some macros like \lstinline|\label{}| |
| 903 |
are processed nevertheless. However, if you define your own macro |
| 904 |
using one of these, then this macro will be completely ignored |
| 905 |
if the exercise containing it is skipped. This option allows to |
| 906 |
define a custom handler for your macros. The most common use |
| 907 |
checks for your custom macros with |
| 908 |
nested \lstinline|\ifstrequal|s and then either |
| 909 |
executes a custom skipper, replaces your macro with |
| 910 |
the standard version or uses \lstinline|\expandafter| to |
| 911 |
deliver the expanded version of your macro to |
| 912 |
\lstinline|\exshskipcontinue|. |
| 913 |
|
| 914 |
Example: |
| 915 |
\begin{lstlisting} |
| 916 |
\def\mylabel#1{...} |
| 917 |
\def\myitem{...} |
| 918 |
\def\myitemtwo{...} |
| 919 |
\def\skipmylabel#1{...\exshskipcontinue} |
| 920 |
\long\def\customskip#1{ |
| 921 |
\ifstrequal{#1}{\mylabel} |
| 922 |
{\skipmylabel} |
| 923 |
{\ifstrequal{#1}{\myitem} |
| 924 |
{\exshskipcontinue\item} |
| 925 |
{\ifstrequal{#1}{\myitemtwo} |
| 926 |
{\expandafter\exshskipcontinue\myitemtwo} |
| 927 |
{\exshskipcontinue} |
| 928 |
} |
| 929 |
} |
| 930 |
} |
| 931 |
\exshset{custom skip macro={\customskip}} |
| 932 |
\end{lstlisting} |
| 933 |
|
| 934 |
\section{The Lua Interface} |
| 935 |
\label{sec:lua} |
| 936 |
|
| 937 |
Since version \vers{0.11} there is a Lua interface for the exercise |
| 938 |
environment. This interface will offer roughly the same features. |
| 939 |
Its main purpose will be allowing to reorder sub-exercises more |
| 940 |
easily and to offer more dynamic options for the display of |
| 941 |
solutions (one combined solution or single after each sub-% |
| 942 |
exercise). %TODO finish |
| 943 |
|
| 944 |
\begin{lstlisting} |
| 945 |
\begin{Lexercise} |
| 946 |
--use [[]] if you need \ or escape it in "": "\\" |
| 947 |
firstline = [[Assume $\pi=4$.]], |
| 948 |
points=10, |
| 949 |
name="Pragmatic", |
| 950 |
options=[[main task font={\itshape}]], |
| 951 |
task = [[ |
| 952 |
This is the main task specified via the Lua |
| 953 |
interface. |
| 954 |
]], |
| 955 |
solution=[[ |
| 956 |
This is a solution for the main task. |
| 957 |
]], |
| 958 |
\end{Lexercise} |
| 959 |
\end{lstlisting} |
| 960 |
|
| 961 |
\section{Usage Tips} |
| 962 |
\label{sec:usage-tips} |
| 963 |
|
| 964 |
\subsection{Seperate Solution File} |
| 965 |
\label{sec:seper-solut-file} |
| 966 |
|
| 967 |
If you do not want to temporarily comment out the \option{solutions} option in |
| 968 |
your main file, say \texttt{exercises.tex}, you can create an additional file |
| 969 |
\texttt{solutions.tex} with the following contents: |
| 970 |
\begin{lstlisting} |
| 971 |
\PassOptionsToPackage{solutions}{exercisesheets} |
| 972 |
\input{exercises.tex} |
| 973 |
\end{lstlisting} |
| 974 |
If you leave out the \option{solutions} option in you main file, running |
| 975 |
\texttt{pdflatex exercises.tex} will create \texttt{exercises.pdf} without |
| 976 |
solutions and \texttt{pdflatex solutions.tex} will create \texttt{solutions.pdf} |
| 977 |
with solutions. |
| 978 |
|
| 979 |
This also works well in combination with a makefile that generates |
| 980 |
\texttt{solutions.tex} as a temporary file. |
| 981 |
|
| 982 |
\subsection{Compatibilty with make4ht and tex4ebook} |
| 983 |
Since version \vers{0.15} this package can be used with make4ht and tex4ebook in non-beamer mode. Some code for the sheet and exercise header already provides a similar alignment as when producing PDF files. If your goal is an exercise (or solution) document within a single HTML file that looks as similar to the PDF as possible, consider \url{https://tex.stackexchange.com/questions/605478/}, \url{https://tex.stackexchange.com/questions/662445} and \url{https://tex.stackexchange.com/questions/630992}. |
| 984 |
|
| 985 |
\section{Changelog} |
| 986 |
\label{sec:changelog} |
| 987 |
|
| 988 |
\begin{itemize} |
| 989 |
\versitem[0.17:] 2024-04-23 |
| 990 |
\begin{itemize} |
| 991 |
\item Make embedded mode work better with beamer. This |
| 992 |
includes not overriding headlines and footlines and |
| 993 |
incrementing the frame counter for non-frames. |
| 994 |
\item issue an explicit warning if \string\subtask is outside of a subtasks environment |
| 995 |
\item clearify documentation and use consistent styling |
| 996 |
\item additional example for embedding exercises |
| 997 |
\end{itemize} |
| 998 |
\versitem[0.16:] 2024-03-07 |
| 999 |
\begin{itemize} |
| 1000 |
\item Embedded mode and most of the additional options it |
| 1001 |
automatically sets. |
| 1002 |
\end{itemize} |
| 1003 |
\versitem[0.15.1:] 2023-12-14 |
| 1004 |
\begin{itemize} |
| 1005 |
\item bugfix: beamer support was broken in \vers{0.15} due to |
| 1006 |
a missing macro. |
| 1007 |
\end{itemize} |
| 1008 |
\versitem[0.15:] 2023-11-30 |
| 1009 |
\begin{itemize} |
| 1010 |
\item new option \option{solution title separator} |
| 1011 |
(initially set to\lstinline|:\par|). Among other things, this |
| 1012 |
allows for solutions without any caption or header by |
| 1013 |
setting \option{solution title separator},~ |
| 1014 |
\option{solution title font} as well as |
| 1015 |
\option{strings/solution} to \lstinline|\relax|. |
| 1016 |
\item initial support for \binary{make4ht} and |
| 1017 |
\binary{tex4ebook} by avoiding certain behavior when these |
| 1018 |
modes are used. Note that both are incompatible with beamer |
| 1019 |
mode. |
| 1020 |
\item initial decoupling of exercise and sheet from |
| 1021 |
sections and parts using the new options (defaults in |
| 1022 |
parenthesis) \option{sheet sectioning cmd} (\lstinline|\part|), |
| 1023 |
\option{sheet counter} (\lstinline|part|) and |
| 1024 |
\option{exercise counter} (\lstinline|section|). |
| 1025 |
\end{itemize} |
| 1026 |
\versitem[0.14:] 2023-02-06 |
| 1027 |
\begin{itemize} |
| 1028 |
\item new option \option{headerrestate} to restate |
| 1029 |
the current (if in subexercise) or main task within |
| 1030 |
a solutions header |
| 1031 |
\item bugfix: \lstinline|\restatetask| etc. give meaningful error if \option{savetasks} is not set. |
| 1032 |
\end{itemize} |
| 1033 |
\versitem[0.13.1:] 2022-11-22 |
| 1034 |
\begin{itemize} |
| 1035 |
\item bugfix: \lstinline|\detokenize| filenames when |
| 1036 |
\option{filenameasexercisename} is active as otherwise, |
| 1037 |
e.g., underscores would not be allowed in filenames. |
| 1038 |
\end{itemize} |
| 1039 |
\versitem[0.12.2:] 2022-10-20 |
| 1040 |
\versitem[0.13:] 2022-11-07 |
| 1041 |
\begin{itemize} |
| 1042 |
\item bugfix: \lstinline|\begingroup| and \lstinline|\endgroup| |
| 1043 |
within \lstinline|\subtask| now contain everything up to the |
| 1044 |
next \lstinline|\subtask|. |
| 1045 |
\item \lstinline|\restatetask| has now a starred version that |
| 1046 |
adds a newline and beamer versions for both the |
| 1047 |
regular and the starred version. Furthermore, there |
| 1048 |
is an argument \option{cur} to restate the current |
| 1049 |
subtask (the one just given before). This is only |
| 1050 |
defined within the aforementioned group, i.e., |
| 1051 |
throws an error after \lstinline|\end{subtasks}|. |
| 1052 |
\end{itemize} |
| 1053 |
\versitem[0.12.2:] 2022-10-20 |
| 1054 |
\begin{itemize} |
| 1055 |
\item bugfix: \luadisp{dofile} with |
| 1056 |
\luadisp{kpse.find\_file} |
| 1057 |
\item docs: document option \option{fragile} |
| 1058 |
\end{itemize} |
| 1059 |
\versitem[0.12.1:] 2022-10-19 |
| 1060 |
\begin{itemize} |
| 1061 |
\item bugfix for \lstinline|\begin{enumerate}[<+->]| |
| 1062 |
\end{itemize} |
| 1063 |
\versitem[0.12:] 2022-09-02 |
| 1064 |
\begin{itemize} |
| 1065 |
\item new option \option{beamerwithfootline} |
| 1066 |
\end{itemize} |
| 1067 |
\versitem[0.11:] 2022-02-11 |
| 1068 |
\begin{itemize} |
| 1069 |
\item Local references and the subex counter |
| 1070 |
\item Lua interface (not documented yet, see example and example file) |
| 1071 |
\item Framed solutions can now be fragile, however this |
| 1072 |
also requires Lua\LaTeX (but not using the Lua Interface). |
| 1073 |
\item beamer version is now included (no separate package) |
| 1074 |
\item some bug fixes |
| 1075 |
\end{itemize} |
| 1076 |
\end{itemize} |
| 1077 |
|
| 1078 |
|
| 1079 |
\end{document} |
| 1080 |
|
| 1081 |
%%% Local Variables: |
| 1082 |
%%% mode: latex |
| 1083 |
%%% TeX-master: t |
| 1084 |
%%% End: |
| 1085 |
|
| 1086 |
%%% Local IspellDict: british |