Debian Codegraph @

texmf-dist/source/latex/exesheet/exesheet.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2020-2025 by Antoine Missier <[email protected]>
4 % ----------------------------------------------------------------------
5 %
6 % This file may be distributed and/or modified under the
7 % conditions of the LaTeX Project Public License, either version 1.3
8 % of this license or (at your option) any later version.
9 % The latest version of this license is in:
10 %
11 % http://www.latex-project.org/lppl.txt
12 %
13 % and version 1.3 or later is part of all distributions of LaTeX
14 % version 2005/12/01 or later.
15 %
16 % \fi
17 %
18 % \iffalse
19 %<*driver>
20 \ProvidesFile{exesheet.dtx}
21 %</driver>
22 %<class|package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
23 %<class>\ProvidesClass{exesheet}
24 %<package>\ProvidesPackage{exesheet}
25 %<*class|package>
26 [2025/05/04 v2.9 Typesetting exercise or exam sheets]
27 %</class|package>
28 %<*driver>
29 \documentclass{ltxdoc}
30
31 \usepackage{hypdoc} % to avoid a bug
32 % uncomment the following lines when not using the ltxdoc class
33 %\AtBeginDocument{\MakeShortVerb{\|}}
34 %\providecommand\marg[1]{{\ttfamily\{}\meta{#1}{\ttfamily\}}}
35 %\providecommand\oarg[1]{{\ttfamily[}\meta{#1}{\ttfamily]}}
36
37 \usepackage[exetoc=false,marginwidth=unset,display=notes]{exesheet}
38 \usepackage{schooldocs}
39 \usepackage[utf8]{inputenc}
40 \usepackage[T1]{fontenc}
41 \usepackage[english]{babel}
42 \usepackage{lmodern}
43 \usepackage{fixcmex}
44 \usepackage{multicol}
45 \usepackage{hyperref}
46 \usepackage{sectsty}
47 \usepackage{pstricks}
48 \usepackage{array}
49 \usepackage[pifont]{spacingtricks}
50 %
51 \psset{unit=1cm}
52 \geometry{textwidth=355pt,textheight=600pt,vmarginratio=1:1,hmarginratio=3:2}
53 % very close from the default geometry used by ltxdoc.
54 % The following instruction provides the same margin width
55 % as with display=notes without altering the margin ratio
56 \leftnotemarginwidth{0.65}
57 \newcommand{\ds}{\displaystyle}
58 \newcommand{\bs}{\textbackslash}
59 \definecolor{darkbrown}{rgb}{0.5,0.1,0.1}
60 \allsectionsfont{\sffamily\color{darkbrown}}
61 \renewcommand{\labelexercisestyle}{\rmfamily\color{black}}
62 \renewcommand{\labelsubpartstyle}{\rmfamily\color{black}}
63 \renewcommand{\annexstyle}{\rmfamily\color{black}\MakeUppercase}
64 \renewcommand{\correctionstyle}{\rmfamily\color{correctioncolor}}
65 \renewcommand{\titlestyle}{\LARGE\sffamily\bfseries}
66 %
67 \DisableCrossrefs
68 %\CodelineIndex
69 %\RecordChanges
70 \title{The \textsf{exesheet} class and package}
71 \subject{Antoine Missier \\
72 \texttt{[email protected]}}
73 \date{\filedate, \fileversion}
74 \hypersetup{%
75 colorlinks,
76 linkcolor=blue,
77 citecolor=red,
78 pdftitle={exesheet},
79 pdfsubject={LaTeX class and package},
80 pdfauthor={Antoine Missier}
81 }
82
83 \begin{document}
84 \DocInput{exesheet.dtx}
85 \end{document}
86 %</driver>
87 % \fi
88 %
89 % \changes{v0.0}{2010/09/01}{Initial personal version}
90 % \changes{v0.9}{2020/01/02}{Initial documentation in French}
91 % \changes{v1.0}{2020/07/22}{Initial public version with documentation in English}
92 % \changes{v1.1}{2021/08/30}{
93 % - macro tablenum (also used by siunitx) is replaced by tablenum1,
94 % - small modifications due to changes in the tasks package}
95 %
96 % \changes{v1.2}{2021/09/18}{
97 % - bug correction in the tablenum1 and tablenuma macros,
98 % - using the translations package for internationalization}
99 %
100 % \changes{v1.3}{2021/11/15}{
101 % - bad spacing in the exe macro and bug correction in the starred version of this macro}
102 %
103 % \changes{v2.0}{2022/12/28}{
104 % - options 'toc' and 'setlist' with kvoptions (instead of notoc and nosetlist),
105 % - introducing the 'output' key instead of the old commands questionsonly, answersonly,
106 % - introducing the 'display' key instead of the old commands displaypts, displaypoints,
107 % displaynotes,
108 % - introducing the 'margin' and 'noteragged' keys, to set how the notes are displayed,
109 % - introducing the 'correct' key}
110 % \changes{v2.0}{2023/01/02}{
111 % - documentation update,
112 % - new option 'checkpts'}
113 % \changes{v2.0}{2023/01/09}{
114 % - new option 'marginwidth',
115 % - modifying hmarginratio from 5:1 to 3:1 when 'display=notes',
116 % - correct management of two-sided mode documents}
117 % \changes{v2.0}{2023/01/16}{
118 % - \enskip between titles and their optional argument,
119 % - simplifying the macros markingstyle and notestyle,
120 % - use of the ragged2e package,
121 % - code revision and simplification,
122 % - documentation update}
123 %
124 % \changes{v2.1}{2023/07/30}{
125 % - new starred environments tablenuma* and tablitem*}
126 % \changes{v2.1}{2023/08/24}{
127 % - English corrections in the documentation}
128 %
129 % \changes{v2.2}{2023/09/02}{
130 % - correction of a color bug in the answer macro and the answers* environment
131 % - additional remark about the use of answers environments}
132 % \changes{v2.2}{2023/09/04}{
133 % - new commands, labelenumone and labelenuma, allowing for global changes to
134 % tasks environments
135 % - the answerspace option is set to false when answers are displayed}
136 %
137 % \changes{v2.3}{2023/10/24}{
138 % - new implementation of marking scheme checking:
139 % checking is done in points or totalpoints instead of exercise command,
140 % - correct ref macro for tablenuma using ref option in tasks,
141 % available since 2020/08/19
142 % - new commands question* and answer* for executing code when
143 % questions are displayed but not answers, or the contrary
144 % - using basic languages (with lower case first letter) instead of aliases
145 % in translations commands}
146 %
147 % \changes{v2.4}{2023/10/28}{
148 % - a small mistake in the documentation about the example of the tablenuma environment
149 % is now corrected
150 % - other small changes in the documentation
151 % - lack of percent symbols at end of lines in the exe@check macro causes an unwanted
152 % space in points macro}
153 %
154 % \changes{v2.5}{2023/12/30}{
155 % - gsetlength and gaddtolength unnecessary
156 % - deprecated commands -> old commands
157 % - comparison with other packages
158 % - modifying introduction}
159 %
160 % \changes{v2.6}{2024/02/03}{
161 % - error message when using colsenum or colsitem without loading multicol
162 % - changes in the comparison with other packages}
163 %
164 % \changes{v2.7}{2024/02/13}{
165 % - an expl3 update prevents the correction color in tasks environment -> fixed
166 % - new command enumfont
167 % - babel-french option 'StandardLists=true' works now if french
168 % is passed in documentclass
169 % - completion of the comparison with other packages}
170 %
171 % \changes{v2.8}{2024/12/22}{
172 % - improvements in answers environment
173 % - starred environments tablenuma* and tablitem* no longer supported
174 % - character table and checksum removed from dtx file (useless)}
175 %
176 % \changes{v2.9}{2025}{
177 % - improvements in answerspace command
178 % - new way of resetting the exercise and part counters in answers environments
179 % - annex with source code of the examples
180 % - including exam-n in the comparison subsection in place of hideanswer}
181 %
182 % \GetFileInfo{exesheet.dtx}
183 %
184 % \maketitle
185 % \enlargethispage{1ex}
186 % \tableofcontents
187 %
188 % \section{Introduction}
189 %
190 % The \textsf{exesheet} \emph{package} is designed for typesetting exercise or exam sheets.
191 % Additionally, the \textsf{exesheet} \emph{class} loads the
192 % \textsf{schooldocs} package~\cite{SCHOOL}.
193 % The latter makes adjustments to margins and titles, and defines various layout styles
194 % with specific headers and footers suitable for exercise sheets, among other uses.
195 % Refer to the documentation of the \textsf{schooldocs} package for more details.
196 % The \textsf{exesheet} \emph{class} is build upon the \textsf{article} class
197 % and forwards any unknown options to it.
198 %
199 % There are many other packages dedicated to exercise sheets.
200 % In section \ref{comparison} we provide an overview of some of their functionalities.
201 % Most of them suggest encapsulating each exercise within an environment.
202 % In contrast, \textsf{exesheet} starts each exercise with |\exercise|,
203 % which functions similarly to a subsection (with the same features)
204 % and is suitable for documents that primarily consist of exercises.
205 % The package also offers alternative ways to introduce exercises,
206 % which are more appropriate for shorter exercises.
207 %
208 % The \textsf{exesheet} package provides specific settings
209 % for enumeration lists, which are
210 % suitable for numbering questions or answers within an exercise.
211 %
212 % For all exercises within the sheet, you can display only the questions,
213 % only the answers, or both, all while preserving their placement as they appear
214 % in the source file. This choice allows for great flexibility:
215 % you can create a correct version for all exercises collectively,
216 % or individual corrections per exercise,
217 % per part (subpart of exercise), per question, per sub-question.
218 %
219 % The ability to hide questions or answers is found in many packages,
220 % but the main interest of \textsf{exesheet} is to be able to display or not
221 % a detailed scoring guide, along with correction instructions.
222 % This is very useful for grading papers with multiple graders.
223 % Furthermore \textsf{exesheet} can check the consistency of the scale.
224 %
225 % Many settings can be customized, and various options are available
226 % to manage the output document.
227 % These options rely on the key-val mechanism: \texttt{key=value}.
228 % These options can be applied when calling the class or the package, \eg
229 % \begin{center}
230 % |\documentclass[a4paper,11pt,output=answers,display=pts]{exesheet}|
231 % \end{center}
232 % or later using the command |\exesheetset|\marg{options}.
233 % In the example above, \texttt{a4paper,11pt} are options
234 % that are passed to the underlying \textsf{article} class.
235 %
236 % \medskip
237 % \emph{In the current document, a frame is utilized to emphasize output
238 % examples. Their source code is presented in an \hyperlink{source}{annex}
239 % after the \hyperlink{ref}{references}.}
240 %
241 % \section{Titles}
242 %
243 % \subsection{The \texttt{\bs exercise} command}
244 %
245 % \DescribeMacro{\exercise}
246 % The |\exercise|\oarg{opt} command initiates an exercise with the title
247 % \textbf{\exercisename}, typeset as a document
248 % subsection, followed by automatic numbering,
249 % unique to the entire document.
250 % The optional parameter \meta{opt} is utilized to include additional text
251 % on the same title line, such as specifying a subject or a marking scheme.
252 % Thus, using |\exercise[(to begin)]| results in:
253 %
254 % \exercise[(to begin)]
255 % \psframe(-0.25,1.3)(12.75,-0.3)
256 % Try this first command; easy!
257 %
258 % \bigskip
259 % To bring optional text closer to the exercise number,
260 % you can employ |\unskip| which removes any preceding space.
261 % Take a look at the following example, achieved with
262 % |\exercise[\unskip*** (difficult)]|:
263 % \exercise[\unskip*** (difficult)]
264 % \psframe(-0.25,1.3)(12.75,-0.3)
265 % Calculate $1+1$.
266 %
267 % \bigskip
268 % \DescribeMacro{\exercisename}
269 % The word ``\exercisename'' is automatically translated into various languages
270 % \footnote{Currently, translation is integrated into the package
271 % for the following languages: French, German, Spanish, Italian, and Portuguese.}
272 % depending on the language that is loaded (via \textsf{babel} or \textsf{polyglossia}).
273 % You can alter it by modifying |\exercisename|.
274 % A better approach is to use macros from the \mbox{\textsf{translations}}
275 % package by Clemens Niederberger~\cite{TRAN} (which allows language switching),
276 % \eg |\DeclareTranslation{swedish}{exesheet-exercise}{\"Ovning}}|.
277 %
278 % \smallskip
279 % \DescribeMacro{\labelexercise}
280 % This command combines |\exercisename| with the exercise number and
281 % can be redefined. For instance, if you want to include a period after the exercise number,
282 % you can redefine it as follows:\\
283 % |\renewcommand{\labelexercise}{\exercisename~\theexercise.}|
284 %
285 % \smallskip
286 % \DescribeMacro{\theexercise}
287 % If you wish to alter only the numbering style, you can redefine
288 % |\theexercise| which is based on the |exercise| counter.
289 %
290 % \smallskip
291 % \DescribeMacro{\labelexercisestyle}
292 % This macro, which is initially empty, enables the definition of a specific style
293 % for exercise titles. In this document, we have set the following in the preamble:
294 % |\renewcommand{\labelexercisestyle}{\rmfamily\color{black}}|
295 % \footnote{In this document, real section and subsection titles have been highlighted by
296 % modifying their color and font (sans serif) using the
297 % \texttt{\bs allsectionsfont} macro from the \textsf{sectsty} package~\cite{SECT}.}.
298 %
299 % \medskip
300 % \DescribeMacro{\exercise*}
301 % The starred version |\exercise*|\oarg{opt}\marg{label}
302 % permits the selection of an alternative \meta{label} for a specific exercise
303 % while omitting the numbering. For instance:
304 % |\exercise*[(Fermat's theorem)]{Problem}| results in:
305 %
306 % \exercise*[(Fermat's theorem)]{Problem}
307 % \psframe(-0.25,1.3)(12.75,-0.7)
308 % Prove that there are no positive integers $x, y, z$ such that $x^n+y^n=z^n$
309 % for any integer $n$ greater than 2.
310 %
311 % \subsection{The \texttt{\bs subpart} command}
312 % \DescribeMacro{\subpart}
313 % An exercise may consist of multiple parts, which can be created using
314 % the |\subpart|\oarg{opt} command.
315 % The part title is typeset similar to a sub-subsection.
316 %
317 % \exercise
318 % \subpart[(preliminary)]
319 % \psframe(-0.25,1.95)(12.75,-1.85)
320 % To begin, prepare your cup of tea.
321 % \subpart
322 % Now you are ready to proceed with the current exercise.
323 %
324 % \bigskip
325 % \pagebreak
326 % The following macros allow customization in the same manner as for |\exercise|.
327 %
328 % \medskip
329 % \DescribeMacro{\thesubpart}
330 % By default, subpart numbering employs letters : A, B, C, and so on.
331 % This numbering style can be modified using the |\thesubpart| command,
332 % which relies on the |subpart| counter.
333 % For example, you can redefine it as follows:
334 % |\renewcommand\thesubpart{\arabic{subpart}}|.
335 %
336 % \smallskip
337 % \DescribeMacro{\subpartname} \DescribeMacro{\labelsubpart}
338 % \DescribeMacro{\labelsubpartstyle}
339 % The |\subpart| command
340 % utilizes |\subpartname| (with automatic translation in several languages
341 % according to the chosen language), as well as
342 % |\labelsubpart| and |\labelsubpartstyle|, all of which can be modified.
343 %
344 % \medskip
345 % \DescribeMacro{\subpart*}
346 % Similar to |\exercise*|, the starred version |\subpart*|\oarg{opt}\marg{label}
347 % permits an alternative \meta{label} and omits the numbering. For instance,
348 % you can use |\subpart*{First part}|.
349 %
350 % \subsection{The \texttt{\bs annex} command}
351 % \DescribeMacro{\annex}
352 % The |\annex|\oarg{opt} command composes the title \textbf{ANNEX}
353 % in uppercase letters, centered, using the subsection style,
354 % with an optional parameter that will be added on the same line.
355 %
356 % \vspace{-\baselineskip}
357 % \noindent\psframe(-0.25,-0.3)(12.75,-1.3)
358 % \annex[(to be returned)]
359 %
360 % \bigskip
361 % \DescribeMacro{\annexname}
362 % The term ``\annexname'' is automatically translated into several languages
363 % (depending on the chosen language).
364 % It can be extended to additional languages or altered by redefining |\annexname|
365 % or by utilizing macros from the \textsf{translations} package~\cite{TRAN}.
366 %
367 % \smallskip
368 % \DescribeMacro{\annexstyle}
369 % The style of the annex title is determined by the |\annexstyle| macro,
370 % which is defined as follows: |\newcommand\annexstyle{\MakeUppercase}|.
371 % This command may be redefined according to your preferences.
372 %
373 % \subsection{Titles in the table of contents} \label{toc}
374 % \DescribeMacro{[exetoc=\meta{bool}]}
375 % By default, the titles \textbf{\exercisename}, \textbf{\subpartname}
376 % and \textbf{\annexname} are included in the table of contents, if there is any,
377 % or in the PDF file's summary when the \textsf{hyperref} package is utilized.
378 % To prevent this, you can set the package option \texttt{exetoc=false}
379 % (with the default being \texttt{true}).
380 % However, note that optional title arguments will always be ignored
381 % in the table of contents.
382 %
383 % \subsection{Short exercises: the \texttt{\bs exe} command}
384 % \DescribeMacro{\exe}
385 % The |\exe| command initiates an exercise with the abbreviation \textbf{\exname}.\@
386 % followed by the exercise number. This is achieved without
387 % utilizing sectioning commands, and the exercise content begins on the same
388 % line. An exercise begins a new paragraph without any indentation.
389 %
390 % \exe This is a brief exercise that can encompass several
391 % paragraphs or questions.
392 %
393 % \noindent\psframe(-0.25,1.4)(12.75,-1.2)
394 % \indent Here for example a new paragraph begins.
395 % \exe This is another concise exercise.
396 %
397 % \bigskip
398 % \DescribeMacro{\exname} \DescribeMacro{\exlabel} \DescribeMacro{\exsepmark}
399 % The abbreviation \textbf{\exname} can be modified by
400 % redefining |\exname| or with macros from the \textsf{translations} package~\cite{TRAN}.
401 % The |\exlabel| macro combines |\exname| with a period then the exercise number
402 % (given by the same \texttt{exercise} counter),
403 % while |\exsepmark| typesets a long dash.
404 % These characteristics can be altered by redefining these commands.
405 %
406 % \medskip
407 % \DescribeMacro{\exe*}
408 % The starred version doesn't display a separator, as demonstrated below:
409 %
410 % \vspace{-\baselineskip}
411 % \noindent\psframe(-0.25,-0.35)(12.75,-1.1)
412 % \exe* Another short exercise without a separator.
413 %
414 % \section{Enumerations and lists}
415 %
416 % \subsection{List settings} \label{setlist}
417 % \DescribeEnv{enumerate} \DescribeMacro{\item}
418 % Enumeration lists are used to represent questions and sub-questions
419 % within exercises. To provide clear emphasis,
420 % labels are typeset in bold.
421 % Additionally, these labels are aligned to the left, positioned
422 % at the start of the line
423 % without indentation, and the vertical spacing between items
424 % is increased compared to standard \LaTeX{} lists.
425 % These formatting adjustments are achieved using the |\setlist| command,
426 % a feature from the \textsf{enumitem} package by Javier Bezos~\cite{ENUM}.
427 %
428 % \vspace{-\baselineskip}
429 % \noindent\psframe(-0.25,-0.35)(12.75,-3.9)
430 % \exercise
431 % \begin{enumerate}
432 % \item First question
433 % \begin{enumerate}
434 % \item First sub-question
435 % \item Second sub-question
436 % \end{enumerate}
437 % \item Second question
438 % \end{enumerate}
439 %
440 % \smallskip
441 % The \texttt{enumerate} environment takes an optional parameter,
442 % that allows, among others things,
443 % the typesetting of alternative list labels. For instance, typing
444 % |\begin{enumerate}[label=\alph*),font=\itshape\normalfont]|
445 % will produce the labels ``\emph{a)}, \emph{b)}, \emph{c)}\ldots''.
446 % There are many other options available
447 % (see the \textsf{enumitem}~\cite{ENUM} package documentation)
448 % \footnote{Labels can also be modified using a ``shortlabel'' argument,
449 % \eg \texttt{\bs begin\{enumerate\}[A.]},
450 % or globally through the redefinition of \texttt{\bs labelenumi}
451 % or \texttt{\bs labelenumii} commands.}.
452 % Label font formatting can be changed globally using
453 % |\setlist[enumerate]{font=...}|
454 % (called \emph{after} |\begin{document}|).
455 %
456 % Lists created with the \texttt{itemize} environment retain their default
457 % configuration
458 % \footnote{However, the \texttt{french} option of the \textsf{babel} package
459 % changes the appearance of \texttt{itemize} lists and employs long dashes
460 % as labels for each list level.
461 % This can cause issues when mathematical content follows the dash
462 % symbol, as it might be mistaken for the minus sign.
463 % Thus, with the option \texttt{setlist=true}, the default \LaTeX{}
464 % \texttt{itemize} list style is
465 % reinstated with \texttt{\bs frenchsetup\{StandardLists=true\}}.}.
466 % ^^A The \texttt{\bs frenchsetup} command can also achieve other settings.}.
467 %
468 % \medskip
469 % \DescribeMacro{[setlist=\meta{bool}]}
470 % The package option |setlist=false| prevents changes to enumeration lists
471 % and reverts to the default \LaTeX{} settings
472 % (the default value is \texttt{true}).
473 %
474 % \subsection{List of exercises : the \texttt{exenumerate} environment}
475 % \DescribeEnv{exenumerate}
476 % When an exercise sheet consists of short, independent questions,
477 % it might be unreasonable to display the full title \textbf{\exercisename}
478 % for each one.
479 % In addition to the previously mentioned |\exe| command,
480 % we offer an even more streamlined solution using the |exenumerate| environment.
481 % This environment is essentially an enumeration list with increased spacing
482 % between items, compared to the \texttt{enumerate} environment.
483 % Here is an example (the main list uses the \texttt{exenumerate} environment,
484 % while the sub-list is created using the standard \texttt{enumerate} environment):
485 %
486 % \vspace{-\baselineskip}
487 % \noindent\psframe(-0.25,-0.3)(12.75,-6)
488 % \begin{exenumerate}
489 % \item Translate the following sentences in English:
490 % \begin{enumerate}
491 % \item Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
492 % \item Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.
493 % \end{enumerate}
494 % \item Translate the following sentence in German:
495 % \par Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna,
496 % vitae ornare odio metus a mi.
497 % \item Translate the following sentence in French:
498 % Cum sociis natoque penatibus
499 % et magnis dis parturient montes, nascetur ridiculus mus.
500 % \end{exenumerate}
501 %
502 % \smallskip
503 % The \texttt{exenumerate} environment (also based on the
504 % \textsf{enumitem}~\cite{ENUM} package) accepts an optional parameter,
505 % similar to the \texttt{enumerate} environment.
506 %
507 % \subsection{Items aligned by row: \texttt{tablenum1}, \texttt{tablenuma},
508 % \texttt{tablitem}}
509 % \DescribeEnv{tablenum1}
510 % \DescribeEnv{tablenuma}
511 % \DescribeEnv{tablitem}
512 % These three environments are employed to typeset brief questions (\texttt{tablenum1}),
513 % sub-questions (\texttt{tablenuma}) or \texttt{itemize} lists (\texttt{tablitem})
514 % on the same line. They share the same syntax:
515 % |\begin{tablenum1}|\oarg{opt}|(|\meta{cols}|)|.
516 % The \meta{cols} parameter denotes the number of columns utilized by the environment.
517 % It must be enclosed \emph{in parentheses}.
518 % This parameter can be omitted, in which case its default value is 2.
519 % Similar to conventional lists, each item is initiated with the |\item| command.
520 %
521 % \smallskip
522 % Internally we have utilized the
523 % |\NewTasksEnvironment| macro from the \textsf{tasks} package by
524 % Clemens Niederberger~\cite{TASK}.
525 % The usage of the optional argument \meta{opt} is
526 % explained in the documentation of this package.
527 % For example, similar to the \mbox{\textsf{enumitem}} package~\cite{ENUM},
528 % |label=\arabic*)| produces an Arabic numbering
529 % followed by a closing parenthesis.
530 % Additionally there are numerous possibilities for arranging items in original ways.
531 % For instance, the |\item*| command allows you to
532 % specify the number of columns the item is supposed to span.
533 % In the subsequent example,
534 % the five |\item| commands are sequentially positioned between
535 % |\begin{tablenum1}(3)| and |\end{tablenum1}|.
536 % Notice that numbering occurs line by line in this context.
537 %
538 % \exercise
539 % \psframe(-0.25,1.3)(12.75,-2.7)
540 % Calculate the derivative of the following functions:
541 % \begin{tablenum1}(3)
542 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
543 % \item $\ds g(x) = \ln \left(\frac{1-x}{1+x^2}\right)$,
544 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$,
545 % \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
546 % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
547 % \end{tablenum1}
548 %
549 % \smallskip
550 % For \texttt{tablenuma}, labels are letters, a, b, c, \ldots, enclosed in parentheses.
551 %
552 % \DescribeMacro{\labelenumone}\DescribeMacro{\labelenuma}
553 % You can change the labels by redefining the macros |\labelenumone|
554 % (for \texttt{tablenum1}) and |\labelenuma| (for \texttt{tablenuma}),
555 % using the \texttt{task} counter:
556 % \eg |\renewcommand\labelenuma{\Alph{task}.}| yields the labels
557 % \textbf{A.}, \textbf{B.}, etc.
558 %
559 % \smallskip
560 % \DescribeMacro{\enumfont}
561 % With the default option \texttt{setlist=true},
562 % the font of all enumeration labels may be changed by redefining |\enumfont|
563 % (|\bfseries| by default).
564 % If the \textsf{exesheet} package is invoked with the option \texttt{setlist=false},
565 % labels within \texttt{tablenum1} and \texttt{tablenuma} environments
566 % will be presented with indentation, and in normal font rather than bold.
567 % You can change the label formatting globally with the command |\settask|, \eg
568 % |\settask{label-format=\itshape}|.
569 % You can also completely redefine the environments using |\RenewTasksEnvironment|.
570 % When \texttt{setlist=true}, place these commands \emph{after} |\begin{document}|.
571 %
572 % \medskip
573 % When you intend to utilize \texttt{tablenuma} (or \texttt{tablitem})
574 % immediately after inserting the |\item| command
575 % within an \texttt{enumerate} environment,
576 % a vertical misplacement may occur as shown below:
577 % \begin{enumerate}
578 % \item
579 % \begin{tablenuma}(3)
580 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$
581 % \item $\ds g(x) = \ln \left(\frac{1-x}{1+x^2}\right)$,
582 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$.
583 % \end{tablenuma}
584 % \end{enumerate}
585 % To adjust the vertical alignment, include
586 % |\mbox{}\vspace|\marg{height} just after |\item| and before invoking |\begin{tablenuma}|
587 % (or |\begin{tablitem}|), where \meta{height} can be a positive or negative length.
588 % Here we used |\vspace{-5.4ex}|.
589 %
590 % \noindent\psframe(-0.25,0.15)(12.75,-1.05)
591 % \psline[linewidth=0.1pt,linecolor=green,linestyle=dashed](0,-0.56)(12,-0.56)
592 % \begin{enumerate}
593 % \item \mbox{}\vspace{-5.4ex}
594 % \begin{tablenuma}(3)
595 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$
596 % \item $\ds g(x) = \ln \left(\frac{1-x}{1+x^2}\right)$,
597 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$.
598 % \end{tablenuma}
599 % \end{enumerate}
600 %
601 % \subsection{Items aligned by column: \texttt{colsenum}, \texttt{colsitem}}
602 % \DescribeEnv{colsenum}
603 % To achieve numbering of items by column, we provide the
604 % \texttt{colsenum} environment:
605 % |\begin{colsenum}|\oarg{opt}\marg{cols}.
606 % The mandatory parameter is the number of columns,
607 % and the optional parameter will be passed to the underlying
608 % \texttt{enumerate} environment,
609 % allowing you to change the numbering type (\eg a, A, etc.), among other possibilities.
610 % \emph{To use this environment, you need to load the
611 % \textsf{multicol} package in the preamble.}
612 % Here's an example with |\begin{colsenum}{3}|:
613 %
614 % \exercise
615 % \psframe(-0.25,1.3)(12.75,-2.7)
616 % Calculate the derivative of the following functions:
617 % \begin{colsenum}{3}
618 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
619 % \item $\ds g(x) = \ln \left(\frac{1-x}{1+x^2}\right)$,
620 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$,
621 % \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
622 % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
623 % \end{colsenum}
624 %
625 % \medskip
626 % \DescribeEnv{colsenum*}
627 % It may be observed that, on each line, items are not necessarily properly
628 % aligned, which can result in ungraceful effects.
629 % On the other hand, the \texttt{colsenum} environment doesn't attempt to align columns
630 % from the bottom by adjusting the vertical spacing between items.
631 % If you desire this alignment
632 % (which is the default behavior in \textsf{multicol}), you can use the
633 % \texttt{colsenum*} environment (with the same syntax as \texttt{colsenum}).
634 % Here's what we obtain with \texttt{colsenum*}:
635 %
636 % \exercise
637 % \psframe(-0.25,1.3)(12.75,-2.67)
638 % Calculate the derivative of the following functions:
639 % \begin{colsenum*}{3}
640 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
641 % \item $\ds g(x) = \ln \left(\frac{1-x}{1+x^2}\right)$,
642 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$,
643 % \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
644 % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
645 % \end{colsenum*}
646 %
647 % \medskip
648 % We can observe that these alignments are not as elegant as those
649 % achieved through row numbering. However, column numbering
650 % might still be more suitable when dealing with numerous items of varying heights,
651 % and especially when the number of items can differ from column to column.
652 % Additionally, a benefit of \texttt{colsenum} is that the label selection
653 % is automatic, based on the list level (and the language),
654 % unlike \texttt{tablenum1} or \texttt{tablenuma}.
655 %
656 % \bigskip
657 % \DescribeEnv{colsitem}
658 % \DescribeEnv{colsitem*}
659 % For \texttt{itemize} lists, the \texttt{colsitem} environment
660 % generates items aligned by column, unlike the line-by-line alignment of
661 % \texttt{tablitem}. It follows the same syntax as \texttt{colsenum}:
662 % |\begin{colsitem}|\oarg{opt}\marg{cols}. The optional parameter,
663 % passed to the underlying \texttt{itemize} environment,
664 % allow to change the item label (bullet by default).
665 % Furthermore, just like \texttt{colsenum*}, the \texttt{colsitem*} environment
666 % produces column alignment from the bottom.
667 % \emph{The \textsf{multicol} package is also required and must be loaded in the preamble.}
668 %
669 % \section{Questions and solutions}
670 %
671 % \subsection{Environments \texttt{questions} and \texttt{answers}}
672 % \label{output}
673 %
674 % \DescribeEnv{questions} \DescribeEnv{answers}
675 % The \textsf{exesheet} package offers two environments,
676 % \texttt{questions} and \texttt{answers},
677 % which allow you to optionally show or hide questions and answers within exercises.
678 %
679 % \bigskip
680 % \DescribeMacro{[output=\meta{opt}]}
681 % The output is governed by the \texttt{output} key option which recognizes three
682 % values: \texttt{questions}, \texttt{answers}, and \texttt{both}.
683 % The \texttt{questions} value shows only questions without answers,
684 % \texttt{answers} displays answers without questions, and
685 % \texttt{both} (the default option) displays both questions and answers.
686 %
687 % \bigskip
688 % \DescribeMacro{\correctionstyle} \DescribeMacro{correctioncolor}
689 % In the default case where both questions and answers are displayed,
690 % the answers are typeset using the |\correctionstyle| style,
691 % which utilizes the color \texttt{correctioncolor}.
692 % You can modify this color using the |\definecolor| macro
693 % \footnote{The \texttt{\bs definecolor} command is provided by the \textsf{xcolor} package
694 % developed by Uwe Kern, which is automatically loaded by \textsf{exesheet}.}.
695 % By default, |\definecolor{correctioncolor}{rgb}{0,0.2,0.6}| is used,
696 % resulting in a kind of dark blue.
697 %
698 % \medskip
699 % \DescribeMacro{\correctionname}
700 % Furthermore, when using \texttt{output=both}
701 % the title \textbf{\correctionname} is displayed at the beginning
702 % of \texttt{answers} environments.
703 % This title is defined by the |\correctionname| macro,
704 % with translation available in several languages, and it can also be modified.
705 % For instance you might prefer ``Solution''
706 % over ``\correctionname''.
707 % The style defined by |\correctionstyle| will be applied to the title
708 % as well as the entire environment.
709 % Here's an example to illustrate this:
710 %
711 % \pagebreak
712 % \noindent\psframe(-0.25,-0.25)(12.75,-7.1)
713 % \exercise
714 % \begin{questions}
715 % \begin{enumerate}
716 % \item Is the \textsf{exesheet} package useful ?
717 % \item Aren't there any other packages that deal with exercises ?
718 % \end{enumerate}
719 % \end{questions}
720 % \begin{answers}
721 % \begin{enumerate}
722 % \item The \textsf{exesheet} package is useful for teachers.
723 % \item There are numerous other packages that handle exercises and
724 % provide the capability to create questions and solutions separately.
725 % For instance the
726 % \textsf{exercise} package by Paul Pichaureau, \textsf{exercises} by Roger Jud,
727 % \textsf{exsheets} (now superseded by \textsf{xsim}) by Clemens Niederberger,
728 % \textsf{exframe} by Niklas Beisert,
729 % \textsf{exam} by Philip Hirschhorn,
730 % \textsf{answers} by Mike Piff and Joseph Wright,
731 % \textsf{probsoln} by Nicola Talbot,
732 % \textsf{eqexam} by D. P. Story\ldots
733 % They are briefly presented in section \ref{comparison}.
734 % \end{enumerate}
735 % \end{answers}
736 %
737 % \medskip
738 % When only answers are displayed, the text color remains black and
739 % the word ``\correctionname'' is not displayed.
740 %
741 % \subsection{More about \texttt{answers} environments}
742 % Internally, we have utilized the |\comment| and |\endcomment| macros
743 % from the \mbox{\textsf{versions}} package by Uwe Lück~\cite{VERS}.
744 % Several other packages also enable selective management of code portions.
745 % Notably, the \textsf{verbatim} package by Rainer Schöpf,
746 % \textsf{comment} by Victor Eijkhout,
747 % \textsf{version} by Donald Arseneau and Stephen Bellantoni,
748 % \textsf{optional} by Donald Arseneau
749 % and \textsf{codesection} by Matthias Pospiech.
750 % Moreover, the \textsf{versions} package~\cite{VERS} offers
751 % the |\excludeversion|\marg{env} and
752 % |\includeversion|\marg{env} macros which allow for the exclusion or inclusion of
753 % any environment \meta{env}. These ``optional'' environments
754 % can be nested
755 % \footnote{The \textsf{codesection} package also supports
756 % such nesting, including within the preamble, as well as the \textsf{optional} package,
757 % but the latter manages only short sections of optional code.}.
758 %
759 % However the \texttt{questions} and \texttt{answers} environments
760 % serve a broader purpose beyond merely displaying or hiding text.
761 % You can choose to have a single answers environment
762 % for the entire sheet, or alternatively, have separate answers environments
763 % for each exercise, exercise part, question, or sub-question.
764 % The format in which the title \textbf{\correctionname} should appear
765 % in the output, and its placement in the table of contents
766 % or PDF file summary, depends on the nesting level of the environment.
767 % In fact, the rendering of the \textbf{\correctionname} title and its corresponding
768 % table of contents level will be automatically calculated by the environment.
769 %
770 % \medskip
771 % \DescribeEnv{answers\oarg{level}}
772 % However, users might wish to adjust the title's level themselves.
773 % To achieve this, you can manually set the level of the title ``\correctionname''
774 % using an optional \meta{level} argument which is defined as follows:
775 % 1 for section-level titles,
776 % 2 for subsections (akin to \textbf{\exercisename}),
777 % 3 for sub-subsections (similar to \textbf{\partname}),
778 % other numbers for lower levels
779 % (which won't appear in the table of contents or in the PDF file’s summary).
780 %
781 % \medskip
782 % \DescribeMacro{answers*}
783 % The starred version \texttt{answers*} doesn't display the
784 % \textbf{\correctionname} title.
785 %
786 % \subsection{Commands \texttt{\bs question}, \texttt{\bs answer} and
787 % \texttt{\bs answerspace}}
788 % \label{answerspace}
789 % \DescribeMacro{\question}\DescribeMacro{\answer}
790 % Instead of using \texttt{questions} and \texttt{answers} environments,
791 % we can also employ the simpler |\question|\marg{ques} and |\answer|\marg{ans} macros.
792 % The visibility of \meta{ques} and \meta{ans} content is
793 % regulated by the same previous \texttt{output=\meta{opt}} key option.
794 % This approach might be more fitting when
795 % you wish to display answers immediately after each question item.
796 % The title ``\correctionname'' won't appear at the start
797 % of each answer with the |\answer| macro.
798 % The answers are also formatted using |\correctionstyle|
799 % if \texttt{output=both}.
800 % However these commands do not support \texttt{verbatim} text within them,
801 % unlike the \texttt{questions} and \texttt{answers} environments.
802 %
803 % \DescribeMacro{\question*}\DescribeMacro{\answer*}
804 % When a code must be executed only when questions are displayed but not
805 % answers, or the contrary, you have the starred versions \eg |\question*{\pagebreak}|.
806 %
807 % \bigskip
808 % \DescribeMacro{\answerspace}
809 % Some teachers are accustomed to providing their students with documents
810 % where questions are typeset, leaving blank spaces instead of answers.
811 % This layout allows students to fill in their responses on the paper.
812 % Thanks to a suggestion from Maxime Chupin,
813 % we achieve this with the |\answerspace|\marg{height} macro,
814 % in which the parameter \meta{height} is a valid length,
815 % \eg |\answerspace{3cm}|.
816 %
817 % \medskip
818 % \DescribeMacro{[answerspace=\meta{bool}]}
819 % The blank spaces introduced by |\answerspace| can be displayed
820 % or hidden, controlled by the
821 % \texttt{answerspace} option key, which can be set to either
822 % \texttt{true} or \texttt{false} (the default).
823 % The \texttt{answerspace} key option has no effect (equivalent to \texttt{false})
824 % when the answers are displayed (\texttt{output=answers} or \texttt{both}).
825 % Of course the |\answerspace| macro is not meant to be used within \texttt{answers}
826 % environments.
827 %
828 % \section{Marking scheme commands}
829 %
830 % The \textsf{exesheet} package provides several commands to display a marking
831 % scheme, with optional comments and explanations about answers in the margins.
832 %
833 % \subsection{The \texttt{\bs points} command}\label{points}
834 % \DescribeMacro{\points}
835 % The |\points|\marg{pts} command displays the number of points awarded for an exercise.
836 % It is intended to be included in the optional argument of the
837 % |\exercise| command
838 % \footnote{However using \texttt{\bs points} in the optional argument of
839 % \texttt{\bs exercise} is not compatible with
840 % the \textsf{memoir} class, as the \textsf{memoir} class redefines section commands.}.
841 % In the following example, we used
842 % |\exercise[\points{5}]|:
843 % \exercise[\points{5}]
844 % \psframe(-0.25,1.3)(12.75,-0.35)
845 % Try to read this document to the end without drinking tea and you get five points.
846 %
847 % \bigskip
848 % When only the answers are displayed in an exercise, the |\points| macro doesn't
849 % show the points.
850 % Further, we provide another macro, which displays points
851 % in \texttt{questions} like here, and differently in \texttt{answers} environments
852 % (see section \ref{totalpoints}).
853 %
854 % \bigskip
855 % \DescribeMacro{\pointsname} \DescribeMacro{\pointname}
856 % The term ``\pointsname'' (or ``\pointname'' in the singular
857 % if \meta{pts} is less than 2) is appended and
858 % is automatically translated into several languages
859 % (and can also be modified).
860 %
861 % \smallskip
862 % \DescribeMacro{\pointsstyle} \DescribeMacro{pointscolor}
863 % You can adjust the |\points| command's style through |\pointsstyle|.
864 % The color setting (red by default) is managed by |pointscolor| using |\definecolor|,
865 % for example you can declare: |\definecolor{pointscolor}{named}{blue}|.
866 %
867 % \subsection{The \texttt{\bs pts} command} \label{pts}
868 % \DescribeMacro{\pts}
869 % When exercises are typeset using the |\exe| macro
870 % or as a list with the \texttt{exenumerate} environment,
871 % the marking scheme can be shown in the margin, aligned with the line where
872 % the |\pts|\marg{num} command is placed (typically the first line of the exercise).
873 % The \meta{num} parameter represents the number of points assigned to the exercise.
874 % Here's an example with |\exe\pts{3}... \exe\pts{1.5}...|
875 %
876 % \leftnotemarginwidth{0.4}
877 % \vspace{-\baselineskip}
878 % \noindent\psframe(-2.0,-0.25)(12.75,-1.95)
879 % \exe \pts{3} The first short exercise with a marking scheme.
880 % \exe \pts{1.5} The second one.
881 %
882 % \leftnotemarginwidth{0.65}
883 % \bigskip
884 % \DescribeMacro{\ptsname} \DescribeMacro{\ptname}
885 % \DescribeMacro{ptscolor} \DescribeMacro{\ptsstyle}
886 % The abbreviation ``\ptsname'' (or ``\ptname''
887 % when the number of points is less than 2)
888 % is added automatically using |\ptsname| or |\ptname| macros
889 % (translated in several languages
890 % if \textsf{babel} or \textsf{polyglossia} is loaded).
891 % The point's display color is defined by \texttt{ptscolor}, changeable via
892 % |\definecolor| (red by default).
893 % The display style is determined by |\ptsstyle|, which among other things,
894 % adds parenthesis around.
895 %
896 % \bigskip
897 % \DescribeMacro{[display=\meta{opt}]}
898 % The marking scheme visibility is controlled by the
899 % \texttt{display} option key.
900 % The default option is |display=none|, keeping the marking scheme hidden.
901 % To reveal the marking scheme, use |display=pts|.
902 % More details are available in section \ref{margin}.
903 %
904 % \medskip
905 % \DescribeMacro{[marginpos=\meta{opt}]}
906 % The positioning of the scale is determined by the |marginpos| option key,
907 % typically \texttt{left} or \texttt{right}.
908 % The default value is \texttt{left}
909 % even though \LaTeX{} positions marginal notes on the right side by default.
910 % This option has no impact when |display=none|.
911 %
912 % For a two-sided document, the default behavior is to place text in the outer margin,
913 % which is wider than the inner margin (that contains the binding).
914 % The outer margin is positioned on the right side on odd pages and on the left side
915 % on even pages. Therefore, the \texttt{marginpos} option can also take the
916 % values \texttt{inner} or \texttt{outer}.
917 % If you specify \texttt{left} or \texttt{right} when the \texttt{twoside}
918 % mode is activated,
919 % this value will be converted to \texttt{outer}, accompanied by a warning message.
920 %
921 % \medskip
922 % With the \texttt{twoside} mode, marginal notes might occasionally
923 % appear on the wrong side of a page.
924 % This is a known \LaTeX{} bug, and the solution involves using
925 % the \textsf{mparhack} package by Tom Sgouros and Stefan Ulrich~\cite{MPAR}
926 % (which \textsf{exesheet} automatically includes
927 % for documents in two-side mode) and \emph{running \LaTeX{} twice}.
928 % If necessary, a warning message will prompt you to perform the re-run.
929 %
930 % \subsection{Commands \texttt{\bs totalexe}, \texttt{\bs note*} and \texttt{\bs note}}
931 %
932 % \label{note}
933 % For a more comprehensive marking scheme, the following commands are available.
934 %
935 % \medskip
936 % \DescribeMacro{\totalexe}
937 % The |\totalexe|\marg{num} macro displays the total number of points of an exercise.
938 % By default, it appears inside an oval box, with the addition of the word
939 % ``\ptsname'' (or ``\ptname'') in bold red.
940 % In the following example, the exercise title has been generated
941 % using |\exercise[\totalexe{4}]|.
942 %
943 % \medskip
944 % \DescribeMacro{\note*}
945 % For each answer or solution in the correct version, the
946 % |\note*|\marg{num} command indicates the number of points allocated to that question.
947 % The appearance slightly varies compared to |\pts|:
948 % by default the number is displayed in bold without the ``\ptsname'' or ``\ptname'' suffix,
949 % and without parenthesis.
950 % In the following example, for answer 3,
951 % we employed |\note*{1.5}|, placed right after |\item|.
952 %
953 % \medskip
954 % \DescribeMacro{\note}
955 % The |\note|\marg{comment} macro is utilized to provide additional information
956 % regarding the marking scheme and to explain how points are assigned.
957 % In the \meta{comment} argument you can use |\\| to create a line break
958 % or even |\\[|\meta{height}|]| to adjust the line spacing by \meta{height}.
959 %
960 % \DescribeMacro{\note\oarg{num}}
961 % Placing |\note*|\marg{num}|\note|\marg{comment}
962 % at the beginning of an answer is often practical.
963 % In such cases \LaTeX{} will align the margin
964 % notes vertically, which leads to a warning like:
965 % \texttt{LaTeX Warning: Marginpar on page \ldots\@ moved.}
966 % However, this warning is not an issue, as \LaTeX{} can usually handle the arrangement
967 % of these marginal notes, stacking them one below the other.
968 % Nonetheless, to prevent unnecessary warnings, you can combine both commands into a
969 % single one by specifying the number of points as an optional argument
970 % of the |\note| command:
971 % |\note|\oarg{num}\marg{comment}.
972 %
973 % The first comment in the following example is obtained using (immediately after |\item|)
974 % |\note[1]{0.5 for the anti-derivative\\0.5 for simplifying}|.
975 %
976 % \leftnotemarginwidth{0.55}
977 % \exercise[\totalexe{4}] \label{totalexe}
978 % \begin{questions}
979 % \psframe(-3.5,1.3)(12.75,-14)
980 % For each subsequent question, determine whether the statement is true or false.
981 % Provide a thorough justification for your answer.
982 % \begin{tablenum1}
983 % \item $\ds \int_{0}^{\sqrt{3}}\frac{1}{x+\sqrt{3}} \,\mathrm{d}x = \ln 2$,
984 % \item $\ds \int_{2}^{\mathrm{e}} \frac{1}{x\ln x} \,\mathrm{d}x = -\ln 2$,
985 % \item* The function $F$, defined on $\mathbf{R}$ by
986 % $F(x) = \ds \int_{0}^{x}\frac{1}{t^2+t+1}\,\mathrm{d} t$, is increasing on $\mathbf{R}$.
987 % \end{tablenum1}
988 % \end{questions}
989 %
990 % \begin{answers}
991 % \begin{enumerate}
992 % \item \note[1]{0.5 for the anti-derivative\\0.5 for simplifying}
993 % We calculate:
994 % \[ \int_{0}^{\sqrt{3}}\frac{1}{x+\sqrt{3}}\,\mathrm{d}x
995 % = \bigg[ \ln\left(x+\sqrt{3}\right) \bigg]_0^{\sqrt{3}}
996 % = \ln\left(2\sqrt{3}\right)-\ln \sqrt{3}
997 % = \ln\left(\frac{2 \sqrt{3}}{\sqrt{3}}\right)
998 % =\ln 2.
999 % \]
1000 % \textbf{TRUE}.
1001 %
1002 % \item \note[1.5]{1 for the anti-derivative \\0.5 for the final value \\[2ex]
1003 % Other method: $\frac{1}{x \ln x} >0$ on $[2, \mathrm{e}]$
1004 % whereas $-\ln2<0$
1005 % }
1006 % We have $\ds\frac{1}{x \ln x}= \frac{\frac{1}{x}}{\ln x}= \frac{u'(x)}{u(x)}$
1007 % with $u(x)=\ln x$, which is positive on $[2, \mathrm{e}]$. Hence
1008 %
1009 % \[ \int_{2}^{\mathrm{e}}\frac{1}{x \ln x}\,\mathrm{d}x
1010 % = \Big[ \ln(\ln x) \Big]_2^\mathrm{e}
1011 % = \ln(\ln \mathrm{e})-\ln(\ln2)= \ln1 -\ln(\ln2)=-\ln(\ln2).
1012 % \]
1013 % \textbf{FALSE}.
1014 %
1015 % \item \note*{1.5}
1016 % The function $F$, defined on $\mathbf{R}$ by
1017 % \[ F(x)= \int_{0}^{x}\frac{1}{t^2+t+1}\, \mathrm{d}t, \]
1018 % is derivable on $\mathbf{R}$ and its derivative is such that
1019 % $F'(x)=\frac{1}{x^2+x+1}$.
1020 % \note{0.5 for $F'$\\1 for the sign of $F'$ and conclusion}
1021 % The denominator is a quadratic polynomial, always positive because its discriminant is
1022 % $\Delta=-3 <0$.
1023 % Thus $F$ is increasing on $\mathbf{R}$. \\
1024 % \textbf{TRUE}.
1025 % \end{enumerate}
1026 % \end{answers}
1027 % In the comment for answer 2, a larger vertical space is created with
1028 % the optional argument |\\[2ex]| for line break.
1029 % The last comment, which isn't positioned next to the points number,
1030 % was produced by placing the following on the first line after the formula:
1031 % |\note{0.5 for $F'$\\1 for the sign of $F'$ and conclusion}|.
1032 % \leftnotemarginwidth{0.65}
1033 %
1034 % \vspace{-1ex}
1035 % \DescribeMacro{markingcolor} \DescribeMacro{\markingstyle} \DescribeMacro{\ptsboxlength}
1036 % The color and style for displaying points in |\totalexe| and |\note*|
1037 % can be customized using \texttt{markingcolor} and |\markingstyle|, respectively.
1038 % The oval box produced by |\totalexe| is created using the |\ovalbox| command
1039 % from the \textsf{fancybox} package by Timothy Van Zandt~\cite{FBOX},
1040 % with corner arcs set by |\cornersize{1}|.
1041 % The box's length is determined by
1042 % |\ptsboxlength|, and not by the box's content, to ensure uniformity across exercises.
1043 %
1044 % \medskip
1045 % \DescribeMacro{notecolor} \DescribeMacro{\notestyle}
1046 % By default, comment notes are typeset in a dark green color
1047 % defined by |\definecolor{notecolor}{rgb}{0.0,0.4,0.0}|.
1048 % The style of comments is determined by the |\notestyle| macro.
1049 %
1050 % \subsection{Margin notes options} \label{margin}
1051 %
1052 % \DescribeMacro{[display=\meta{opt}]}
1053 % The \texttt{display} key option governs the presentation of the marking scheme:
1054 % as discussed previously (subsection \ref{pts}),
1055 % \texttt{display=none} shows nothing. When using \texttt{display=pts}
1056 % the numbers provided as arguments to |\pts|, |\totalexe|, |\note*|
1057 % or as optional arguments of |\note|\oarg{num}\texttt{\{...\}} will be exhibited.
1058 % The final option is \texttt{display=notes} which reveals the complete marginal
1059 % notes, containing points and comments (the mandatory argument of |\note|),
1060 % as illustrated in the previous example.
1061 %
1062 % \medskip
1063 % \DescribeMacro{[marginpos=\meta{opt}]}
1064 % As previously mentioned in subsection \ref{pts}, the side on which
1065 % to position the scale is determined by the \texttt{marginpos} key option,
1066 % with possible values of \texttt{left} and \texttt{right}
1067 % (or \texttt{inner} and \texttt{outer} if the document is in \texttt{twoside} mode).
1068 %
1069 % \medskip
1070 % \DescribeMacro{[marginwidth=\meta{opt}]}
1071 % The margin layout is governed by the \texttt{marginwidth} key option,
1072 % which can take one of the following values:
1073 % \texttt{standard}, \texttt{expand}, or \texttt{unset}.
1074 %
1075 % This option has no effect when \texttt{display=none}.
1076 % In this case, both the left and right margins have the same width,
1077 % except in a two-sided document where the ratio between the left and right
1078 % margins is 2:3.
1079 % Otherwise the \texttt{marginwidth} key option behaves as follows:
1080 % \begin{description}
1081 % \item[\texttt{standard}]
1082 % The left margin is widened, and the
1083 % right margin is reduced, with a ratio of 3:2 (or 2:3 if \texttt{marginpos=right}).
1084 % The text body is shifted without changing its width.
1085 % The margin paragraph width remains relatively short
1086 % (depends on page geometry).
1087 % This option is not ideal for lengthy comments.
1088 %
1089 % \item[\texttt{expand}] (default value)\enskip
1090 % The behavior is the same as with the
1091 % \texttt{standard} value when \texttt{display=pts}. However, when \texttt{display=notes},
1092 % the margin expands with a ratio of 3:1 (or 1:3) and the width of margin paragraphs
1093 % increases.
1094 %
1095 % \item[\texttt{unset}] This option is provided for cases where the previous settings
1096 % are not suitable.
1097 % No adjustments are made to the margin width. Instead, you can define
1098 % your own settings using the convenient |\geometry| macro
1099 % from the \textsf{geometry} package by Hideo Umeki~\cite{GEOM}.
1100 % For instance, you can place the following in the preamble:
1101 % |\geometry{hmarginratio=2:1,marginparwidth=2.5cm}|.
1102 %
1103 % If \texttt{marginpos=right}, you need to invert the ratio, \eg 1:2 instead of 2:1.
1104 % If \texttt{marginwidth} is not set to \texttt{unset},
1105 % such a command will have no effect.
1106 % \end{description}
1107 %
1108 % Margin settings are applicable to the entire document
1109 % and need to be configured in the preamble.
1110 %
1111 % \medskip
1112 % \DescribeMacro{[noteragged=\meta{opt}]}
1113 % The package option \texttt{noteragged} controls the text alignment within the margins
1114 % for the mandatory argument of |\note|.
1115 % It offers the following values:
1116 % \texttt{left}, \texttt{right}, \texttt{center}, \texttt{justify} or \texttt{twoside}.
1117 % The default value is \texttt{noteragged=left}, resulting in right-aligned text,
1118 % which is common for text in the left margin.
1119 % When \texttt{noteragged=right}, the text is left-aligned.
1120 % Using \texttt{justify} makes the text justified, aligning with
1121 % \LaTeX's default behavior for marginal notes.
1122 % Finally \texttt{noteragged=twoside} aligns text to the left on odd pages
1123 % and to the right on even pages in a two-sided document.
1124 % It has no effect otherwise (the default \texttt{noteragged=left} is used
1125 % and a warning message appears in the terminal).
1126 %
1127 % When \texttt{display} is not set to \texttt{notes}, the \texttt{noteragged} option
1128 % has no impact, as it specifically applies to text within the mandatory argument
1129 % of |\note|.
1130 %
1131 % \subsection{The \texttt{\bs totalpoints} command} \label{totalpoints}
1132 %
1133 % \DescribeMacro{\totalpoints}
1134 % The |\totalpoints|\marg{num} macro serves as a replacement for
1135 % |\points| when using a comprehensive marking scheme.
1136 % When the scale is not displayed,
1137 % it functions similarly to |\points| (visible in questions but not in answers),
1138 % and when the scale is shown,
1139 % it's akin to |\totalexe|.
1140 % For instance, in exercise \ref{totalexe}, we could have used |\totalpoints|
1141 % instead of |\totalexe|. Thus,
1142 % if the detailed marking scheme is not displayed, the total points would be presented
1143 % similarly to exercise \ref{points}.
1144 %
1145 % \subsection{Marking scheme consistency checking}\label{scale}
1146 %
1147 % \DescribeMacro{[checkpts=\meta{bool}]}
1148 % The marking scheme can be checked out
1149 % \footnote{Thanks to Denis Bitouzé for his suggestion about this feature.}
1150 % using the key-val option \texttt{checkpts=true} (or just \texttt{checkpts});
1151 % the default value is \texttt{false}.
1152 %
1153 % \medskip
1154 % For each exercise, the cumulative points allocated to each question (via |\pts|, |\note*|
1155 % or |\note[ ]| are compared to the exercise's total specified in
1156 % |\points|, |\totalexe| or |\totalpoints|.
1157 % A warning message will be displayed in the shell to indicate whether
1158 % the scale is valid
1159 % for the exercise or not. For example:
1160 % \begin{center}
1161 % \texttt{Package exesheet warning: Exercise 3: Sum of points is 4.5pt instead of 5pt.}
1162 % \end{center}
1163 % Both comma notation (\eg 4,5) and decimal point format (\eg 4.5)
1164 % may be accepted, depending on your chosen language.
1165 % The control is made at the beginning of the subsequent exercise,
1166 % inside the |\points|, |\totalexe| or |\totalpoints| macros.
1167 % No deep checking will be processed at this level if no points are displayed
1168 % for the questions inside the exercise (with \texttt{display=none} option).
1169 %
1170 % \medskip
1171 % \DescribeMacro{\totalsheet}
1172 % At the end of the document, the last exercise is checked,
1173 % followed by a global examination of the entire sheet.
1174 % This last task requires knowledge of the total points for the sheet, which must be given
1175 % by the |\totalsheet|\marg{points} macro in the preamble;
1176 % otherwise, a warning message will be displayed.
1177 % If subtotals have been assigned to exercises and \emph{displayed}, the overall comparison
1178 % is made between the sum of these subtotals and the total points recorded
1179 % using |\totalsheet|.
1180 % If not, the evaluation encompasses the sum of points for each individual question.
1181 % A subsequent warning message indicates the outcome of this last verification.
1182 % Finally, a message indicates whether all scale controls have been successfully
1183 % passed or not.
1184 %
1185 % \section{Options and comparison with other packages}
1186 %
1187 % \subsection{Summary of available options}\label{options}
1188 %
1189 % Here we provide a summary table of the available options. Details on their usage
1190 % can be found in the respective sections.
1191 % The default value is displayed in bold.
1192 %
1193 % \begin{center} \ttfamily
1194 % \setlength{\extrarowheight}{1pt}
1195 % \begin{tabular}{llc}
1196 % \hline
1197 % \textsf{Key} & \textsf{Possible values} & \textsf{See section} \\
1198 % \hline
1199 % exetoc & \textbf{true}, false & \ref{toc} \\
1200 % setlist & \textbf{true}, false & \ref{setlist} \\
1201 % output & questions, answers, \textbf{both} & \ref{output} \\
1202 % answerspace & true, \textbf{false} & \ref{answerspace}\\
1203 % display & \textbf{none}, pts, notes & \ref{pts}, \ref{margin} \\
1204 % marginpos & \textbf{left} (inner), right (\textbf{outer}) & \ref{pts}, \ref{margin} \\
1205 % marginwidth & standard, \textbf{expand}, unset & \ref{margin} \\
1206 % noteragged & \textbf{left}, right, center, justify, twoside & \ref{margin} \\
1207 % checkpts & true, \textbf{false} & \ref{scale} \\
1208 % correct & true, \textbf{false}, conditional & \hyperlink{correct}{see below} \\
1209 % \hline
1210 % \end{tabular}
1211 % \end{center}
1212 %
1213 % When an invalid key is provided, an error is generated. However,
1214 % an unrecognized value only triggers a warning message:
1215 % \centeredline{\texttt{Value ... is not supported by ... option
1216 % on input line \ldots}}
1217 % For each option, you can set them through the class or package invocation, \eg
1218 % |\usepackage[output=answers,display=notes,noteragged=right]{exesheet}|
1219 %
1220 % \bigskip
1221 % \DescribeMacro{\exesheetset}
1222 % You can also use the |\exesheetset|\{list of \meta{key}=\meta{value}\}
1223 % command.
1224 % Note that some options, \texttt{output}, \texttt{answerspace}, \texttt{display},
1225 % and \texttt{noteragged},
1226 % can be changed dynamically, even within the document,
1227 % while the others are applicable in the preamble exclusively.
1228 % Dynamic options are processed with each call, whereas the others are processed once,
1229 % at the beginning of the document.
1230 % \hypertarget{correct}{}
1231 %
1232 % \bigskip
1233 % \DescribeMacro{[correct=\meta{opt}]}
1234 % A special option, \texttt{correct}, can be employed when using the \textsf{exesheet}
1235 % \emph{class} or in conjunction with the \textsf{schooldocs} package.
1236 % This option adds ``\correctname'' (or its translation)
1237 % to the document title and headers.
1238 % Possible values are: \texttt{true}, \texttt{false} (by default) or \texttt{conditional}.
1239 % Using \texttt{correct=conditional}, it behaves as \texttt{true}
1240 % when answers are displayed and \texttt{false} when they're not.
1241 %
1242 % \subsection{Alternative commands}
1243 %
1244 % Prior to version 2.0, we used specialized commands to configure
1245 % output and display options.
1246 % We have now implemented \emph{key=value} options.
1247 % Although the latter are more user-friendly,
1248 % one may prefer the old commands, so they are still supported,
1249 % but will trigger a warning message. These commands are presented below.
1250 %
1251 % However, the previous options \texttt{nosetlist} and \texttt{notoc}
1252 % are no longer supported.
1253 %
1254 % \bigskip
1255 % \DescribeMacro{\questionsonly} \DescribeMacro{\answersonly}
1256 % The command |\questionslonly| is equivalent to setting \texttt{output=questions}
1257 % and |\answersonly| means \texttt{output=answers}.
1258 %
1259 % \DescribeMacro{\displaypts} \DescribeMacro{\displaypoints}
1260 % The commands |\displaypts| and |\displaypoints|
1261 % are equivalent to setting \texttt{display=pts}.
1262 %
1263 % \pagebreak
1264 % \DescribeMacro{\displaynotes}\DescribeMacro{\displaynotesright}
1265 % |\displaynotes| means \texttt{display=notes},
1266 % and |\displaynotesright| corresponds to
1267 % \texttt{display=notes,marginpos=right}.
1268 % These two commands have an optional argument |\displaynotes|\marg{ragged}
1269 % where \meta{ragged} is an alignment command to work inside margin notes.
1270 % By default it is |\RaggedLeft| with |\displaynotes| and |RaggedRight|
1271 % \footnote{These commands come from the \textsf{ragged2e} package
1272 % by Martin Schröder~\cite{RAGG}.}
1273 % with |\displaynotesright|.
1274 %
1275 % \subsection{Comparison with other packages}\label{comparison}
1276 %
1277 % In this section, we will provide an overview of the functionalities (at he time version 2.7
1278 % of this package was published, February 13, 2024)
1279 % of various packages or classes found in the `Exercise' or `Exam' sections
1280 % of the CTAN archives
1281 % (Comprehensive \TeX\ Archive Network).
1282 % Considering the substantial number of packages in these sections,
1283 % some omissions may have been unintentionally made.
1284 % Those excluded are those with documentation not in English
1285 % or primarily dedicated to producing multiple-choice questions
1286 % or random question generation.
1287 % We have focused here on typesetting functionalities and not on managing exercise
1288 % databases as there are specialized packages or external softwares for that.
1289 %
1290 % The following table is not a result of tests but presents a summary of information
1291 % collected from the documentation of these packages.
1292 %
1293 % \begin{multicols}{2}
1294 % \begin{flushleft}
1295 % \begin{enumerate}[label=\Alph*., font=\normalfont, noitemsep]
1296 % \item \textsf{exercise}, Paul Pichaureau~\cite{EXER}
1297 % \item \textsf{exercises}, Roger Jud~\cite{EXES}
1298 % \item \textsf{xsim}, Clemens Niederberger~\cite{XSIM}
1299 % \item \textsf{exframe}, Niklas Beisert~\cite{EXFR}
1300 % \item \textsf{exam}, Philip Hirschhorn~\cite{EXAM}
1301 % \item \textsf{answers}, Mike Piff and Joseph Wright~\cite{ANSW}
1302 % \item \textsf{probsoln}, Nicola L.C.\@ Talbot~\cite{PROB}
1303 % \item \textsf{exsol}, Walter Daems~\cite{EXSO}
1304 % \item \textsf{exercisepoints}, Henning Kerstan~\cite{EXEP}
1305 % \item \textsf{worksheet}, Benjamin Zöllner~\cite{WORK}
1306 % \item \textsf{exam-n}, Norman Gray~\cite{EXAN}
1307 % \item \textsf{eqexam}, D. P. Story~\cite{EQEX}
1308 % \item \textsf{cesenaexam}, Alex Pacini~\cite{CESE}
1309 % \item \textsf{esami}, Grazia Messineo, Salvatore Vassallo~\cite{ESAMI}
1310 % \item \textsf{randexam}, Jianrui Lyu~\cite{RAND}
1311 % ^^A\item \textsf{hideanswer}, Yukoh Kusakabe~\cite{HIDE}
1312 % \item \textsf{exam-n}, Norman Gray~\cite{EXAMN}
1313 % \item \textsf{mathexam}, Jan Hlavacek~\cite{MATH}
1314 % \item \textsf{exesheet}, Antoine Missier
1315 % \end{enumerate}
1316 % \end{flushleft}
1317 % \end{multicols}
1318 %
1319 % \newcommand\X{\ding{56}}
1320 % \setlength{\extrarowheight}{2pt}\noindent
1321 % {\small
1322 % \begin{tabular}{@{\hspace{2pt}}l@{\hspace{5pt}}|%
1323 % *{18}{@{\hspace{1.8pt}}c@{\hspace{2pt}}|}}
1324 % \hline
1325 % Functionality &A&B&C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R \\
1326 % \hline
1327 % Optional text for exercise titles &\X&&\X&\X&\X&&&&\X&&&&\X&&&&&\X \\
1328 % Subparts of exercises &\X&&&\X&\X&&&&\X&&\X&\X&\X&\X&\X&&&\X \\
1329 % Annex title or appendix &&&&&&&&&&&&&&&\X&&&\X \\
1330 % Exercise titles in TOC of PDF files &\X&&&&&&&&&&&&&&&&&\X \\
1331 % Short labels for exercises &\X&&\X&\X&&&&&&&&&&&&&&\X \\
1332 % Hiding questions or answers* &\X&*&\X&\X&*&\X&\X&\X&&&*&\X&&\X&*&*&&\X \\
1333 % Different placements for answers &\X&&&&&&&&&&\X&\X&&&&&&\X \\
1334 % Change answers placement in output &\X&&&\X&&\X&&\X&&&&\X&&&&&& \\
1335 % Blank spacing in place of answers &&\X&\X&&\X&&&&&&&\X&&\X&\X&&\X&\X \\
1336 % Marking scheme commands &&\X&\X&\X&\X&&&&\X&\X&\X&\X&&\X&\X&\X&&\X \\
1337 % Various positions of points &&&&\X&\X&&&&&&&\X&&\X&&&&\X \\
1338 % Marking scheme calculation/checking &&\X&\X&\X&\X&&&&\X&&\X&\X&&&\X&&&\X \\
1339 % Detailed notes for scoring guide &&&&&&&&&&&&&&&&&&\X \\
1340 % \hline
1341 % \end{tabular}
1342 % }
1343 % \medskip
1344 %
1345 % \StopEventually{}
1346 %
1347 % \section{Implementation}
1348 %
1349 % \subsection{Options and required packages}
1350 % The \texttt{exesheet} class is build upon the \texttt{article} class
1351 % and transfers all its unknown options to it. The use of
1352 % |\ProcessKeyvalOptions*| is unnecessary within the class
1353 % as it will be managed by the package.
1354 % \begin{macrocode}
1355 %<*class>
1356 \RequirePackage{kvoptions}
1357 \DeclareBoolOption[true]{exetoc}
1358 \DeclareBoolOption[true]{setlist}
1359 \DeclareStringOption[both]{output}
1360 \DeclareStringOption[none]{display}
1361 \DeclareBoolOption[false]{answerspace}
1362 \DeclareStringOption[left]{marginpos}
1363 \DeclareStringOption[expand]{marginwidth}
1364 \DeclareStringOption[left]{noteragged}
1365 \DeclareBoolOption[false]{checkpts}
1366 \DeclareStringOption[false]{correct}
1367 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
1368 \ProcessOptions \relax
1369 \LoadClass{article}
1370 \RequirePackage{exesheet}
1371 \RequirePackage{schooldocs}
1372 %</class>
1373 % \end{macrocode}
1374 %
1375 % Options are defined using the \textsf{kvoptions} package.
1376 % String options are managed through distinct processing macros
1377 % that are implemented in their respective sections.
1378 % For options whose effects cannot be dynamically altered
1379 % and must be configured in the preamble, they are processed once,
1380 % at |\begin{document}|.
1381 % The other options are executed when this package is loaded
1382 % (at the end of the package, as |\exs@process...|
1383 % commands are not recognized at the outset).
1384 %
1385 % A distinct case is to mention with \texttt{setlist} when utilized in conjunction with
1386 % \textsf{babel-french}.
1387 % In this instance, this option is processed immediately
1388 % (further clarification follows below).
1389 %
1390 % \begin{macrocode}
1391 %<*package>
1392 \@ifclassloaded{exesheet}{}{
1393 \RequirePackage{kvoptions}
1394 \DeclareBoolOption[true]{exetoc}
1395 \DeclareBoolOption[true]{setlist}
1396 \DeclareStringOption[both]{output}
1397 \DeclareStringOption[none]{display}
1398 \DeclareBoolOption[false]{answerspace}
1399 \DeclareStringOption[left]{marginpos}
1400 \DeclareStringOption[expand]{marginwidth}
1401 \DeclareStringOption[left]{noteragged}
1402 \DeclareBoolOption[false]{checkpts}
1403 \DeclareStringOption[false]{correct}
1404 }
1405
1406 \ProcessKeyvalOptions*
1407
1408 \PackageInfo{exesheet}{The options `notoc' and `nosetlist'
1409 \MessageBreak are no longer supported\@gobble}
1410 % \@gobble suppresses the line number here
1411
1412 \def\exs@process@dynoptions{
1413 \exs@process@output
1414 \exs@process@display
1415 \exs@process@noteragged
1416 } % answerspace do not need a special process macro
1417
1418 \AtEndOfPackage{\exs@process@dynoptions}
1419 \AtBeginDocument{
1420 \newif\ifexesheet@multicol
1421 \@ifpackageloaded{multicol}{
1422 \exesheet@multicoltrue}{\exesheet@multicolfalse}
1423 % configuring the rule color within answers environments
1424 \exs@process@setlist
1425 \exs@process@marginpos
1426 \exs@process@marginwidth
1427 \exs@process@checkpts
1428 \exs@process@correct
1429 \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{setlist}
1430 \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{marginpos}
1431 \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{marginwidth}
1432 \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{checkpts}
1433 \DisableKeyvalOption[action=warning,package=exesheet]{exesheet}{correct}
1434 }
1435
1436 % \end{macrocode}
1437 % \begin{macro}{\exesheetset}
1438 % The |\exesheetset| macro can accept key-val options and
1439 % can be utilized anywhere in the document to adjust certain settings.
1440 % However, it won't affect non dynamic options if called outside the preamble.
1441 % In such cases a warning message occur due to the use of |\DisableKeyValOption|.
1442 % \begin{macrocode}
1443 \def\exesheetset#1{\setkeys{exesheet}{#1}\exs@process@dynoptions}
1444
1445 % \end{macrocode}
1446 % \end{macro}
1447 %
1448 % The following old macros (used before version 2.0) provide an alternative
1449 % to keyval options.
1450 % They are kept for compatibility reasons.
1451 % \begin{macrocode}
1452 \newcommand{\questionsonly}{
1453 \PackageWarning{exesheet}{Old command \string\questionsonly\space
1454 is used. \MessageBreak
1455 It can be replaced by the option `output=questions'}
1456 \renewcommand\exesheet@output{questions}
1457 \exs@process@output
1458 }
1459 \newcommand{\answersonly}{
1460 \PackageWarning{exesheet}{Old command \string\answersonly\space
1461 is used. \MessageBreak
1462 It can be replaced by the option `output=answers'}
1463 \renewcommand\exesheet@output{answers}
1464 \exs@process@output
1465 }
1466 \newcommand{\displaypts}{%
1467 \PackageWarning{exesheet}{Old command \string\displaypts\space
1468 is used. \MessageBreak
1469 It can be replaced by the option `display=pts'}
1470 \renewcommand\exesheet@display{pts}
1471 \exs@process@display
1472 }
1473 \newcommand{\displaypoints}{%
1474 \PackageWarning{exesheet}{Old command \string\displaypoints\space
1475 is used. \MessageBreak
1476 It can be replaced by the option `display=pts'}
1477 \renewcommand\exesheet@display{pts}
1478 \exs@process@display
1479 }
1480 \newcommand*{\displaynotes}[1][\RaggedLeft]{%
1481 \PackageWarning{exesheet}{Old command \string\displaynotes\space
1482 is used. \MessageBreak
1483 It can be replaced by the option `display=notes'}
1484 \renewcommand\exesheet@display{notes}
1485 \exs@process@display
1486 \renewcommand{\noteragged}{#1}
1487 }
1488 \newcommand*{\displaynotesright}[1][\RaggedRight]{%
1489 \PackageWarning{exesheet}{Old command \string\displaynotesright
1490 \space is used. \MessageBreak
1491 It can be replaced by the options `display=notes, margin=right'}
1492 \renewcommand\exesheet@display{notes}
1493 \exs@process@display
1494 \renewcommand\exesheet@margin{right}
1495 \renewcommand{\noteragged}{#1}
1496 }
1497
1498 % \end{macrocode}
1499 %
1500 % Now, we load several packages.
1501 % If the \textsf{geometry} package is already loaded, it will not be reloaded
1502 % to prevent an option clash.
1503 % The \texttt{shortlabel} option in the \textsf{enumitem} package~\cite{ENUM}
1504 % allows the use of labels similar to
1505 % the \textsf{enumerate} package such as 1., a), A., and so on.
1506 % The \textsf{mparhack} package by Tom Sgouros and Stefan Ulrich~\cite{MPAR}
1507 % is loaded exclusively for documents in \texttt{twoside} mode.
1508 % \begin{macrocode}
1509 \RequirePackage{ifthen}
1510 \@ifpackageloaded{geometry}{}{\RequirePackage{geometry}}
1511 \RequirePackage{xcolor}
1512 \RequirePackage[shortlabels]{enumitem}
1513 \RequirePackage{tasks}[2020/08/19]
1514 \RequirePackage{versions}
1515 \RequirePackage{fancybox}
1516 \RequirePackage{translations}
1517 \RequirePackage{ragged2e}
1518 \ifthenelse{\boolean{@twoside}}{\RequirePackage{mparhack}}{}
1519
1520 % \end{macrocode}
1521 %
1522 % \subsection{Internationalization}
1523 % Here we define keywords along with their translations in French, German, Spanish
1524 % Italian, Portuguese. We achieve this using macros from the \textsf{translations}
1525 % package by Clemens Niederberger~\cite{TRAN}.
1526 % This package automatically detects the language being used,
1527 % as loaded by \textsf{babel} or \textsf{polyglossia}.
1528 %
1529 % \begin{macrocode}
1530 \DeclareTranslationFallback{exesheet-exercise}{Exercise}
1531 \DeclareTranslationFallback{exesheet-subpart}{Part}
1532 \DeclareTranslationFallback{exesheet-annex}{Annex}
1533 \DeclareTranslationFallback{exesheet-ex}{Ex}
1534 \DeclareTranslationFallback{exesheet-points}{points}
1535 \DeclareTranslationFallback{exesheet-point}{point}
1536 \DeclareTranslationFallback{exesheet-correction}{Correction}
1537 \DeclareTranslationFallback{exesheet-pts}{pts}
1538 \DeclareTranslationFallback{exesheet-pt}{pt}
1539
1540 \DeclareTranslation{english}{exesheet-exercise}{Exercise}
1541 \DeclareTranslation{english}{exesheet-subpart}{Part}
1542 \DeclareTranslation{english}{exesheet-annex}{Annex}
1543 \DeclareTranslation{english}{exesheet-ex}{Ex}
1544 \DeclareTranslation{english}{exesheet-points}{points}
1545 \DeclareTranslation{english}{exesheet-point}{point}
1546 \DeclareTranslation{english}{exesheet-correction}{Correction}
1547 \DeclareTranslation{english}{exesheet-pts}{pts}
1548 \DeclareTranslation{english}{exesheet-pt}{pt}
1549
1550 \DeclareTranslation{french}{exesheet-exercise}{Exercice}
1551 \DeclareTranslation{french}{exesheet-subpart}{Partie}
1552 \DeclareTranslation{french}{exesheet-annex}{Annexe}
1553 \DeclareTranslation{french}{exesheet-ex}{Ex}
1554 \DeclareTranslation{french}{exesheet-points}{points}
1555 \DeclareTranslation{french}{exesheet-point}{point}
1556 \DeclareTranslation{french}{exesheet-correction}{Correction}
1557 \DeclareTranslation{french}{exesheet-pts}{pts}
1558 \DeclareTranslation{french}{exesheet-pt}{pt}
1559
1560 \DeclareTranslation{german}{exesheet-exercise}{\"Ubung}
1561 \DeclareTranslation{german}{exesheet-subpart}{Teil}
1562 \DeclareTranslation{german}{exesheet-annex}{Anhang}
1563 \DeclareTranslation{german}{exesheet-ex}{\"Ub}
1564 \DeclareTranslation{german}{exesheet-points}{Punkte}
1565 \DeclareTranslation{german}{exesheet-point}{Punkt}
1566 \DeclareTranslation{german}{exesheet-correction}{Verbesserung}
1567 \DeclareTranslation{german}{exesheet-pts}{P.}
1568 \DeclareTranslation{german}{exesheet-pt}{P.}
1569
1570 \DeclareTranslation{spanish}{exesheet-exercise}{Ejercicio}
1571 \DeclareTranslation{spanish}{exesheet-subpart}{Parte}
1572 \DeclareTranslation{spanish}{exesheet-annex}{Anexo}
1573 \DeclareTranslation{spanish}{exesheet-ex}{Ej}
1574 \DeclareTranslation{spanish}{exesheet-points}{puntos}
1575 \DeclareTranslation{spanish}{exesheet-point}{punto}
1576 \DeclareTranslation{spanish}{exesheet-correction}{Correcci\'on}
1577 \DeclareTranslation{spanish}{exesheet-pts}{ptos}
1578 \DeclareTranslation{spanish}{exesheet-pt}{pto}
1579
1580 \DeclareTranslation{italian}{exesheet-exercise}{Esercizio}
1581 \DeclareTranslation{italian}{exesheet-subpart}{Parte}
1582 \DeclareTranslation{italian}{exesheet-annex}{Annesso}
1583 \DeclareTranslation{italian}{exesheet-ex}{Es}
1584 \DeclareTranslation{italian}{exesheet-points}{punti}
1585 \DeclareTranslation{italian}{exesheet-point}{punto}
1586 \DeclareTranslation{italian}{exesheet-correction}{Correzione}
1587 \DeclareTranslation{italian}{exesheet-pts}{pti}
1588 \DeclareTranslation{italian}{exesheet-pt}{pt}
1589
1590 \DeclareTranslation{portuges}{exesheet-exercise}{Exerc\'icio}
1591 \DeclareTranslation{portuges}{exesheet-subpart}{Parte}
1592 \DeclareTranslation{portuges}{exesheet-annex}{Anexo}
1593 \DeclareTranslation{portuges}{exesheet-ex}{Ex}
1594 \DeclareTranslation{portuges}{exesheet-points}{pontos}
1595 \DeclareTranslation{portuges}{exesheet-point}{ponto}
1596 \DeclareTranslation{portuges}{exesheet-correction}{Corre\c c\~ao}
1597 \DeclareTranslation{portuges}{exesheet-pts}{pts}
1598 \DeclareTranslation{portuges}{exesheet-pt}{pt}
1599
1600 \newcommand*\exercisename{\GetTranslation{exesheet-exercise}}
1601 \newcommand*\subpartname{\GetTranslation{exesheet-subpart}}
1602 \newcommand*\annexname{\GetTranslation{exesheet-annex}}
1603 \newcommand*\exname{\GetTranslation{exesheet-ex}}
1604 \newcommand*\pointsname{\GetTranslation{exesheet-points}}
1605 \newcommand*\pointname{\GetTranslation{exesheet-point}}
1606 \newcommand*\correctionname{\GetTranslation{exesheet-correction}}
1607 \newcommand*\ptsname{\GetTranslation{exesheet-pts}}
1608 \newcommand*\ptname{\GetTranslation{exesheet-pt}}
1609
1610 % \end{macrocode}
1611 %
1612 % \subsection{Titles}
1613 %
1614 % The \texttt{exercise} counter assigns numbers to exercises throughout
1615 % the entire document, regardless of sections.
1616 % To reset the counter manually, simply use |\setcounter{exercise}{0}|.
1617 % For an automatic reset at each new section,
1618 % include the following code in the preamble \\
1619 % |\makeatletter \@addtoreset{exercise}{section} \makeatother|.
1620 %
1621 % The parts counter (\texttt{subpart}) depends on the \texttt{exercise} counter
1622 % and is reset with each new exercise.
1623 %
1624 % The commands |\labelexercisestyle| and |\labelsubpartstyle|
1625 % are initially empty, but they allow you to customize the styling. For example:\\
1626 % |\renewcommand\labelexercisestyle{\sffamily}|.
1627 %
1628 % The |\exe@label| macro, which needs the |exe@check| counter, will be used
1629 % inside warning messages about the marking scheme (see section \ref{MSoptions}).
1630 %
1631 % By default, the table of contents includes both exercises and parts titles,
1632 % as controlled by the boolean |\ifexesheet@exetoc|.
1633 % To only display exercise titles in the table of contents while omitting parts,
1634 % include the following code in the preamble: |\setcounter{tocdepth}{2}|.
1635 %
1636 % \begin{macro}{\exercise}
1637 % \begin{macrocode}
1638 \newcounter{exercise}
1639 \newcounter{exe@check}
1640
1641 \newcommand{\labelexercise}{\exercisename\space \theexercise}
1642 \newcommand{\labelexercisestyle}{}
1643 \newcommand*{\@exercise}[1][]{%
1644 \refstepcounter{exercise}
1645 \subsection*{\labelexercisestyle\labelexercise\enskip #1}
1646 \ifexesheet@exetoc
1647 \addcontentsline{toc}{subsection}{\labelexercise}
1648 \fi
1649 \ifexesheet@checkpts
1650 \setcounter{exe@check}{\value{exercise}}
1651 \def\exe@label{\exercisename\space\theexe@check}
1652 \fi
1653 }
1654 \newcommand*{\@@exercise}[2][]{%
1655 \subsection*{\labelexercisestyle #2\enskip #1}
1656 \setcounter{subpart}{0} % resets the parts counter
1657 \ifexesheet@exetoc
1658 \addcontentsline{toc}{subsection}{#2}
1659 \fi
1660 \ifexesheet@checkpts \def\exe@label{#2} \fi
1661 }
1662 \newcommand{\exercise}{\@ifstar{\@@exercise}{\@exercise}}
1663
1664 % \end{macrocode}
1665 % \end{macro}
1666 % \begin{macro}{\subpart}
1667 % \begin{macrocode}
1668 \newcounter{subpart}[exercise] %
1669 \renewcommand{\thesubpart}{\Alph{subpart}}
1670
1671 \newcommand{\labelsubpart}{\subpartname~\thesubpart}
1672 \newcommand{\labelsubpartstyle}{}
1673 \newcommand*{\@subpart}[1][]{%
1674 \refstepcounter{subpart}%
1675 \subsubsection*{\labelsubpartstyle\labelsubpart\enskip #1}
1676 \ifexesheet@exetoc
1677 \addcontentsline{toc}{subsubsection}{\labelsubpart}
1678 \fi
1679 }
1680 \newcommand*{\@@subpart}[2][]{%
1681 \subsubsection*{\labelsubpartstyle #2\enskip #1}
1682 \ifexesheet@exetoc
1683 \addcontentsline{toc}{subsubsection}{#2}
1684 \fi
1685 }
1686 \newcommand{\subpart}{\@ifstar{\@@subpart}{\@subpart}}
1687
1688 % \end{macrocode}
1689 % \end{macro}
1690 % \begin{macro}{\annex}
1691 % \begin{macrocode}
1692 \newcommand{\annexstyle}{\MakeUppercase}
1693 \newcommand*{\annex}[1][]{%
1694 \subsection*{\mbox{}\hfill\annexstyle{\annexname} #1\hfill\mbox{}}
1695 \ifexesheet@exetoc
1696 \addcontentsline{toc}{subsection}{\annexname}
1697 \fi
1698 }
1699
1700 % \end{macrocode}
1701 % \end{macro}
1702 % \begin{macro}{\exe}
1703 % \begin{macrocode}
1704 \newcommand{\exlabel}{\exname.~\theexercise}
1705 \newcommand{\exsepmark}{---}
1706 \newcommand{\@exe}{\bigskip\refstepcounter{exercise}
1707 \ifexesheet@checkpts
1708 \setcounter{exe@check}{\value{exercise}}
1709 \def\exe@label{\exname\space\theexe@check}
1710 \fi
1711 \par\noindent\textbf{\exlabel~\exsepmark}~}
1712 \newcommand{\@@exe}{\bigskip\refstepcounter{exercise}
1713 \ifexesheet@checkpts
1714 \setcounter{exe@check}{\value{exercise}}
1715 \def\exe@label{\exname\space\theexe@check}
1716 \fi
1717 \par\noindent\textbf{\exlabel}~}
1718 \newcommand{\exe}{\@ifstar{\@@exe}{\@exe}}
1719
1720 % \end{macrocode}
1721 % \end{macro}
1722 %
1723 % \subsection{Enumerations and lists}
1724 %
1725 % \begin{macro}{\exenumerate}
1726 % The |\setlist| command is part of the \textsf{enumitem} package
1727 % (|\setenumerate| is deprecated). By default, |itemsep=1ex| is set for first-level
1728 % lists, and |leftmargin=1.5em| is used to align labels with the start of lines.
1729 % \begin{macrocode}
1730 \newcommand\enumfont{\bfseries}
1731
1732 \newenvironment{exenumerate}[1][]{%
1733 \setlist[enumerate]{font=\enumfont}
1734 \setlist[enumerate,1]{leftmargin=1.5em,
1735 itemsep=3ex plus 1ex minus 1ex,topsep=3ex plus 1ex minus 1ex}
1736 \setlist[enumerate,3]{noitemsep,nolistsep}
1737 \setlist[itemize]{noitemsep,nolistsep}
1738 \begin{enumerate}[#1]
1739 }{\end{enumerate}}
1740
1741 % \end{macrocode}
1742 % \end{macro}
1743 % When using the \textsf{babel-french} package,
1744 % \texttt{itemize} lists are altered to use the same dash label for each list level.
1745 % These modifications are undone here to revert to the default
1746 % \LaTeX\ \texttt{itemize} lists, including labels and spaces.
1747 % This setting is done by the |\frenchsetup| command, which should be invoked within
1748 % the |\AtBeginDocument| command or immediately, depending on whether
1749 % \textsf{exesheet} is loaded before or after \textsf{babel}.
1750 % \begin{macrocode}
1751 \ifexesheet@setlist
1752 \@ifundefined{frenchsetup}{}{\frenchsetup{StandardLists=true}}
1753 % must be executed here (and not at begin doc) if loaded after babel
1754 \fi
1755
1756 \newcommand\labelenumone{\arabic{task}.}
1757 \newcommand\labelenuma{(\alph{task})}
1758 \newcommand\refenuma{\alph{task}}
1759
1760 \def\exs@process@setlist{% must be executed at begin document
1761 \ifexesheet@setlist
1762 \@ifundefined{frenchsetup}{}{\frenchsetup{StandardLists=true}}
1763 % executed at begin doc if loaded before babel
1764 \setlist[enumerate]{font=\enumfont}
1765 \setlist[enumerate,1]{topsep=1.5ex plus 1ex minus 1ex,
1766 leftmargin=1.5em}
1767 \fi
1768 % \end{macrocode}
1769
1770 % \DescribeEnv{tablenum1} \DescribeEnv{tablenuma}
1771 % The |\NewTasksEnvironment| command is part of the \textsf{tasks} package~\cite{TASK}.
1772 % It enables the definition of the environments \texttt{tablenum1},
1773 % \texttt{tablenuma} and \texttt{tablitem}.
1774 % Horizontal spacing is adjusted to ensure proper alignment with
1775 % items in other \texttt{enumerate} (or \texttt{itemize}) environments.
1776 % \begin{macrocode}
1777 \ifexesheet@setlist
1778 \settasks{label-format=\enumfont}
1779 \NewTasksEnvironment[label=\labelenumone,
1780 column-sep=1em,label-align=right,
1781 item-indent=1.5em,label-width=1em,label-offset=0.5em,
1782 after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
1783 \NewTasksEnvironment[label=\labelenuma,ref=\refenuma,
1784 column-sep=1em,label-align=right,
1785 item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
1786 after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
1787 \else
1788 \NewTasksEnvironment[label=\labelenumone,
1789 column-sep=1em,label-align=right,
1790 label-width=1em,label-offset=0.5em,
1791 after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
1792 \NewTasksEnvironment[label=\labelenuma,ref=\refenuma,
1793 column-sep=1em,label-align=right,
1794 item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
1795 after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
1796 \fi
1797 } % end of macro \exs@process@setlist
1798
1799 \PackageInfo{exesheet}{The environment `tablenum' is deprecated
1800 \MessageBreak and has been replaced by `tablenum1'\@gobble}
1801 % \@gobble suppresses the line number here
1802
1803 % \end{macrocode}
1804 % \DescribeEnv{tablitem}
1805 % \begin{macrocode}
1806 \NewTasksEnvironment[label=\labelitemi,
1807 label-align=right,
1808 item-indent=2.5em,label-offset=0.5em,
1809 after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablitem}[\item](2)
1810
1811 % \end{macrocode}
1812 % \DescribeEnv{colsenum}\DescribeEnv{colsenum*}
1813 % For items aligned by columns, we provide the \texttt{colsemnum} and \texttt{colsenum*}
1814 % environments. The \textsf{multicol} package is required and an error message
1815 % is produced if it has not been loaded.
1816 % |\multicolsep| is the amount of space that should be added above or below the
1817 % environment.
1818 % \begin{macrocode}
1819 \newenvironment{colsenum*}[2][]{%
1820 \ifexesheet@multicol \else
1821 \PackageError{exesheet}{The environments colsenum and colsenum*
1822 \MessageBreak need the multicol package}{
1823 Add \string\usepackage{multicol}\space in the preamble.}
1824 \fi
1825 \setlength{\multicolsep}{2ex}
1826 \begin{multicols}{#2} % #2 = number of columns
1827 \begin{enumerate}[#1] % #1 = options of enumerate
1828 }{
1829 \end{enumerate}
1830 \end{multicols}
1831 }
1832
1833 \newenvironment{colsenum}[2][]{%
1834 \raggedcolumns % default is \flushcolumns
1835 \begin{colsenum*}[#1]{#2}
1836 }{
1837 \end{colsenum*}
1838 }
1839
1840 % \end{macrocode}
1841 % \DescribeEnv{colsitem}\DescribeEnv{colsitem*}
1842 % The corresponding environments for itemize lists.
1843 % \begin{macrocode}
1844 \newenvironment{colsitem*}[2][]{%
1845 \ifexesheet@multicol \else
1846 \PackageError{exesheet}{The environments colsitem and colsitem*
1847 \MessageBreak need the multicol package}{
1848 Add \string\usepackage{multicol}\space in the preamble.}
1849 \fi
1850 \setlength{\multicolsep}{2ex}
1851 \begin{multicols}{#2} % #2 = number of columns
1852 \begin{itemize}[#1] % #1 = options of itemize
1853 }{
1854 \end{itemize}
1855 \end{multicols}
1856 }
1857
1858 \newenvironment{colsitem}[2][]{%
1859 \raggedcolumns % default is \flushcolumns
1860 \begin{colsitem*}[#1]{#2}
1861 }{
1862 \end{colsitem*}
1863 }
1864
1865 % \end{macrocode}
1866 %
1867 % \subsection{Questions and answers}
1868 %
1869 % \begin{macro}{\exs@process@output}
1870 % The booleans |exesheet@questions| and |exesheet@answers|
1871 % governs the visibility of their corresponding environments.
1872 % These booleans are configured through the \texttt{output} key option within the
1873 % |\exs@process@output| macro.
1874 % \begin{macrocode}
1875 \newboolean{exesheet@questions}\setboolean{exesheet@questions}{true}
1876 \newboolean{exesheet@answers}\setboolean{exesheet@answers}{true}
1877
1878 \def\exs@process@output{
1879 \ifthenelse{\equal{\exesheet@output}{questions}}{
1880 \setboolean{exesheet@questions}{true}
1881 \setboolean{exesheet@answers}{false}
1882 }{% else if
1883 \ifthenelse{\equal{\exesheet@output}{answers}}{
1884 \setboolean{exesheet@questions}{false}
1885 \setboolean{exesheet@answers}{true}
1886 \exesheet@answerspacefalse
1887 }{% else if
1888 \ifthenelse{\equal{\exesheet@output}{both}}{
1889 \setboolean{exesheet@questions}{true}
1890 \setboolean{exesheet@answers}{true}
1891 \exesheet@answerspacefalse
1892 }{% else
1893 \PackageWarning{exesheet}{Value `\exesheet@output'
1894 is not supported by `output' option}
1895 }}}
1896 }
1897
1898 % \end{macrocode}
1899 % \end{macro}
1900 %
1901 % \begin{environment}{questions}
1902 % We utilize the \textsf{versions} package developed by Uwe Lück~\cite{VERS},
1903 % which introduces the macros |\comment| and |\endcomment|.
1904 % These macros facilitate conditional displays, a technique also employed
1905 % in the \textsf{verbatim} and \textsf{version} packages.
1906 % Additionally, the notable \textsf{codesection} package offers the capability
1907 % to enclose optional code between |\BeginCodeSection|\marg{skip}
1908 % and |\EndCodeSection|\marg{skip} macros,
1909 % both in the text body and the preamble.
1910 % However, these macros cannot be used within an environment
1911 % as we have done here with |\comment| and |\endcomment|.
1912 % Several of our tests use the \LaTeX{} syntax |\ifthenelse{\bolean{...}}|
1913 % since |\comment| and |\endcomment| can sometimes interfere
1914 % with the \TeX\ structure |\if| \ldots |\else| \ldots |\fi|.
1915 %
1916 % The two counters |exe@ini| and |subpart@ini| are employed in
1917 % the subsequent |\set@toclevel| macro.
1918 % \begin{macrocode}
1919 \newcounter{exe@ini}
1920 \newcounter{subpart@ini}
1921
1922 \newenvironment{questions}{
1923 \ifthenelse{\boolean{exesheet@questions}}{%
1924 \setcounter{exe@ini}{\value{exercise}}
1925 \setcounter{subpart@ini}{\value{subpart}}
1926 }{\comment}
1927 }{\ifthenelse{\boolean{exesheet@questions}}{}{\endcomment}}
1928
1929 % \end{macrocode}
1930 % \end{environment}
1931 % \begin{environment}{answers}
1932 % The internal macro |\set@toclevel| calculates the title level (counter |toc@level|)
1933 % to ensure correct typesetting of ``\correctionname'' at the start of an
1934 % \texttt{answers} environment, when \texttt{questions} and \texttt{answers} are
1935 % displayed together. It involves comparing the \texttt{exercise} and \texttt{subpart}
1936 % counters with their values at the time of the \texttt{questions} environment call.
1937 % The |\@enumdepth| counter indicates the
1938 % current \texttt{enumerate} list level (with 0 indicating outside of any list).
1939 % The optional parameter of the \texttt{answers} environment permits
1940 % the explicit specification of this title level.
1941 % \begin{macrocode}
1942 \newcounter{@toclevel}
1943 \newcommand{\set@toclevel}[1][]{
1944 \ifthenelse{\equal{#1}{}}{
1945 \ifthenelse{\(\value{exercise} > \value{exe@ini}\)
1946 \and \(\value{exe@ini} > 0 \)}{
1947 \setcounter{@toclevel}{1}
1948 }{% else
1949 \ifthenelse{\equal{\the\@enumdepth}{0}}{
1950 % we're not in an enumerate environment
1951 \ifthenelse{\(\value{subpart} > \value{subpart@ini}\)
1952 \or \(\value{subpart} = 0\)}{
1953 \setcounter{@toclevel}{2}
1954 }{\setcounter{@toclevel}{3}}
1955 }{\setcounter{@toclevel}{4}}}
1956 }{\setcounter{@toclevel}{#1}}}
1957
1958 % \end{macrocode}
1959 % The internal macro |\typeset@correctionname|,
1960 % displays the term ``\correctionname'' at the appropriate level.
1961 % \begin{macrocode}
1962 \definecolor{correctioncolor}{rgb}{0,0.2,0.6} % kind of dark blue
1963 \newcommand{\correctionstyle}{\color{correctioncolor}}
1964
1965 \newcommand{\typeset@correctionname}{
1966 \ifthenelse{\value{@toclevel} = 1}{
1967 \section*{\correctionstyle\correctionname}
1968 \ifexesheet@exetoc
1969 \addcontentsline{toc}{section}{\correctionname}
1970 \fi
1971 \setcounter{exercise}{\value{exe@ini}}
1972 }{% else if
1973 \ifthenelse{\value{@toclevel} = 2}{%
1974 \subsection*{\correctionstyle\correctionname}
1975 \ifexesheet@exetoc
1976 \addcontentsline{toc}{subsection}{\correctionname}
1977 \fi
1978 \setcounter{subpart}{\value{subpart@ini}}
1979 }{% else if
1980 \ifthenelse{\value{@toclevel} = 3}{%
1981 \subsubsection*{\correctionstyle\correctionname}
1982 \ifexesheet@exetoc
1983 \addcontentsline{toc}{subsubsection}{\correctionname}
1984 \fi
1985 }{% else
1986 \par\textbf{\correctionstyle\correctionname}\par
1987 }}}
1988 }
1989
1990 % \end{macrocode}
1991 % Then we proceed to define the \texttt{answers} environment.
1992 % It seems that the \textsf{tasks} package resets the color to black,
1993 % therefore the |\color{correctioncolor}| options in |\settasks|.
1994 % \begin{macrocode}
1995 \newenvironment{answers}[1][]{% #1 is the optional level
1996 \ifthenelse{\boolean{exesheet@answers}}{%
1997 \ifthenelse{\boolean{exesheet@questions}}{%
1998 \set@toclevel[#1]%
1999 \typeset@correctionname%
2000 \correctionstyle%
2001 \ifexesheet@setlist
2002 \settasks{
2003 label-format = \color{correctioncolor}\enumfont,
2004 item-format = \color{correctioncolor}
2005 }%
2006 \else
2007 \settasks{
2008 label-format = \color{correctioncolor},
2009 item-format = \color{correctioncolor}
2010 }%
2011 \fi%
2012 \ifexesheet@multicol
2013 \renewcommand{\columnseprulecolor}{%
2014 \color{correctioncolor}}
2015 \fi%
2016 }{}%
2017 }{\comment}
2018 }{\ifthenelse{\boolean{exesheet@answers}}{%
2019 \setcounter{exe@ini}{0}
2020 \setcounter{subpart@ini}{0}
2021 }{\endcomment}}
2022
2023 \newenvironment{answers*}{
2024 \ifthenelse{\boolean{exesheet@answers}}{\correctionstyle}{\comment}
2025 }{\ifthenelse{\boolean{exesheet@answers}}{}{\endcomment}}
2026
2027 % \end{macrocode}
2028 % When placing |\correctionstyle| before |\subsubsection|
2029 % in the \texttt{answers} environment (as in the case of |\typeset@correctionname|),
2030 % the preceding vertical space may become too wide.
2031 % \end{environment}
2032 %
2033 % \DescribeMacro{\question}\DescribeMacro{\question*}
2034 % \begin{macrocode}
2035 \newcommand{\@question}[1]{\ifexesheet@questions #1\fi}
2036 \newcommand{\@@question}[1]{%
2037 \ifexesheet@questions\ifexesheet@answers \else #1\fi\fi}
2038 \newcommand{\question}{\@ifstar{\@@question}{\@question}}
2039
2040 % \end{macrocode}
2041 %
2042 % \DescribeMacro{\answer}\DescribeMacro{\answer*}
2043 % \begin{macrocode}
2044 \newcommand{\@answer}[1]{%
2045 \ifexesheet@answers%
2046 \ifexesheet@questions {\correctionstyle #1}\else #1\fi
2047 \fi
2048 }
2049 \newcommand{\@@answer}[1]{%
2050 \ifexesheet@answers\ifexesheet@questions \else #1\fi\fi}
2051 \newcommand{\answer}{\@ifstar{\@@answer}{\@answer}}
2052
2053 % \end{macrocode}
2054 %
2055 % \begin{macro}{\answerspace}
2056 % The |\answerspace| macro leaves blank space to allow students for writing
2057 % their answers on the provided paper following a suggestion by Maxime Chupin.
2058 % The blank space can expand across a page break.
2059 % \begin{macrocode}
2060 \newcommand\answerspace[1]{
2061 \ifexesheet@answerspace \mbox{}\par\vspace*{#1} \fi}
2062
2063 % \end{macrocode}
2064 % \end{macro}
2065 %
2066 % \begin{macro}{\exs@process@correct}
2067 % The \texttt{correct} option needs the \textsf{schooldocs} package.
2068 % It triggers the |\correct| macro of \textsf{schooldocs} which
2069 % adds the content of |\correctname| in the title of the document.
2070 % Here the option \texttt{conditional} triggers |\correct| only if
2071 % \texttt{output=answers} or \texttt{both}.
2072 % \begin{macrocode}
2073 \def\exs@process@correct{
2074 \ifthenelse{\equal{\exesheet@correct}{false}}{% do nothing
2075 }{% else
2076 \@ifpackageloaded{schooldocs}{
2077 \ifthenelse{\equal{\exesheet@correct}{true}}{
2078 \correct
2079 }{% else
2080 \ifthenelse{\equal{\exesheet@correct}{conditional}}{
2081 \ifexesheet@answers \correct \fi
2082 }{}}
2083 }{
2084 \PackageWarningNoLine{exesheet}{The `correct' option requires
2085 \MessageBreak
2086 the `schooldocs' package to be loaded}
2087 }}
2088 }
2089
2090 % \end{macrocode}
2091 % \end{macro}
2092 %
2093 %
2094 % \subsection{Marking scheme options processing} \label{MSoptions}
2095 %
2096 % The options \texttt{display}, \texttt{marginpos}, \texttt{marginwidth}
2097 % and \texttt{noteragged} are handled using the following internal commands.
2098 %
2099 % \medskip
2100 % The \texttt{display} key option determines the value of the booleans
2101 % |exesheet@pts| and |exesheet@notes|.
2102 % The |exesheet@pts| boolean controls the display of the content of |\pts|
2103 % and optional arguments of |\note|,
2104 % while the |exesheet@notes| boolean controls mandatory arguments of |\note|.
2105 %
2106 % \begin{macro}{\exs@process@display}
2107 % \begin{macrocode}
2108 \newboolean{exesheet@pts}
2109 \newboolean{exesheet@notes}
2110
2111 \def\exs@process@display{
2112 \ifthenelse{\equal{\exesheet@display}{pts}}{
2113 \setboolean{exesheet@pts}{true}
2114 \setboolean{exesheet@notes}{false}
2115 }{% else if
2116 \ifthenelse{\equal{\exesheet@display}{notes}}{
2117 \setboolean{exesheet@pts}{true}
2118 \setboolean{exesheet@notes}{true}
2119 }{% else if
2120 \ifthenelse{\equal{\exesheet@display}{none}}{
2121 \setboolean{exesheet@pts}{false}
2122 \setboolean{exesheet@notes}{false}
2123 }{% else
2124 \PackageWarning{exesheet}{Value `\exesheet@display'
2125 is not supported by `display' option}
2126 }}}
2127 }
2128
2129 % \end{macrocode}
2130 % \end{macro}
2131 % \begin{macro}{\exs@process@marginpos}
2132 % The \texttt{marginpos} key option takes the values \texttt{left} (the default value)
2133 % or \texttt{right} (or \texttt{inner} and \texttt{outer}).
2134 % In practice, \texttt{inner} is equivalent to \texttt{left},
2135 % but in two-sided mode, the values \texttt{left} or \texttt{right}
2136 % are converted to \texttt{outer} (which is then the default value for two-sided mode).
2137 % \begin{macrocode}
2138 \newboolean{exesheet@leftmargin}
2139
2140 \def\exs@process@marginpos{
2141 \ifthenelse{\equal{\exesheet@marginpos}{left}}{
2142 \if@twoside%
2143 \PackageWarningNoLine{exesheet}{The default `marginpos'
2144 option \MessageBreak
2145 for two-sided documents is `outer'.\MessageBreak
2146 To change the side, use `inner'}
2147 \def\exesheet@marginpos{outer}
2148 \setboolean{exesheet@leftmargin}{false}
2149 \normalmarginpar
2150 \else% default
2151 \setboolean{exesheet@leftmargin}{true}
2152 \reversemarginpar
2153 \fi
2154 }{% else if
2155 \ifthenelse{\equal{\exesheet@marginpos}{right}}{
2156 \if@twoside%
2157 \PackageWarningNoLine{exesheet}{The default `marginpos'
2158 option \MessageBreak
2159 for two-sided documents is `outer'.\MessageBreak
2160 To change the side, use `inner'}
2161 \def\exesheet@marginpos{outer}
2162 \fi
2163 \setboolean{exesheet@leftmargin}{false}
2164 \normalmarginpar
2165 }{% else if
2166 \ifthenelse{\equal{\exesheet@marginpos}{inner}}{
2167 \setboolean{exesheet@leftmargin}{true}
2168 \reversemarginpar
2169 }{% else if
2170 \ifthenelse{\equal{\exesheet@marginpos}{outer}}{
2171 \setboolean{exesheet@leftmargin}{false}
2172 \normalmarginpar
2173 }{% else
2174 \PackageWarningNoLine{exesheet}{The value `\exesheet@marginpos'
2175 is not supported by the `marginpos' option}
2176 }}}}
2177 }
2178
2179 % \end{macrocode}
2180 % \end{macro}
2181 % \begin{macro}{\exs@process@marginwidth}
2182 % The \texttt{marginwidth} option adjusts the ratio between left and right margins
2183 % based on what needs to be displayed in the margin (points only or full notes)
2184 % \footnote{To ensure the accurate effect on the margin ratio, this option is processed
2185 % at the beginning of the document, after other commands
2186 % that could potentially alter the page geometry.}.
2187 %
2188 % When \texttt{display=notes}, the additional length of \texttt{1\,in} corresponds to
2189 % the default free space to the left of |\oddsidemargin|.
2190 %
2191 % The macros |\standardmarginwidthfactor| and |\largemarginwidthfactor|
2192 % represent the ratios between the total margin width and |\marginparwidth|.
2193 %
2194 % \begin{macrocode}
2195 \def\standardmarginwidthfactor{0.6}
2196 \def\largemarginwidthfactor{0.8}
2197
2198 \newcommand*{\leftnotemarginwidth}[1]{
2199 \setlength{\marginparwidth}{\oddsidemargin}
2200 \addtolength{\marginparwidth}{1in}
2201 \addtolength{\marginparwidth}{-\marginparsep}
2202 \setlength{\marginparwidth}{#1\marginparwidth}
2203 }
2204
2205 \newcommand*\rightnotemarginwidth[1]{
2206 \setlength{\marginparwidth}{\paperwidth}
2207 \addtolength{\marginparwidth}{-\textwidth}
2208 \addtolength{\marginparwidth}{-\oddsidemargin}
2209 \addtolength{\marginparwidth}{-\marginparsep}
2210 \addtolength{\marginparwidth}{-1in}
2211 \setlength{\marginparwidth}{#1\marginparwidth}
2212 }
2213
2214 \def\exesheet@smallmargins{
2215 \geometry{hmarginratio=1:1}
2216 \leftnotemarginwidth{\standardmarginwidthfactor}
2217 }
2218 \def\exesheet@standardmargins{
2219 \ifexesheet@leftmargin
2220 \geometry{hmarginratio=3:2}
2221 \leftnotemarginwidth{\standardmarginwidthfactor}
2222 \else
2223 \geometry{hmarginratio=2:3}
2224 \rightnotemarginwidth{\standardmarginwidthfactor}
2225 \fi
2226 }
2227 \def\exesheet@largemargins{
2228 \ifexesheet@leftmargin
2229 \geometry{hmarginratio=3:1}
2230 \leftnotemarginwidth{\largemarginwidthfactor}
2231 \else
2232 \geometry{hmarginratio=1:3}
2233 \rightnotemarginwidth{\largemarginwidthfactor}
2234 \fi
2235 }
2236
2237 \def\exs@process@marginwidth{
2238 \ifthenelse{\equal{\exesheet@marginwidth}{standard}}{
2239 \ifthenelse{\equal{\exesheet@display}{none}}{
2240 \if@twoside
2241 \exesheet@standardmargins
2242 \else
2243 \exesheet@smallmargins
2244 \fi
2245 }{% else display=pts or display=notes
2246 \exesheet@standardmargins
2247 }
2248 }{% else if
2249 \ifthenelse{\equal{\exesheet@marginwidth}{expand}}{
2250 \ifthenelse{\equal{\exesheet@display}{none}}{
2251 \if@twoside
2252 \exesheet@standardmargins
2253 \else
2254 \exesheet@smallmargins
2255 \fi
2256 }{% else if
2257 \ifthenelse{\equal{\exesheet@display}{pts}}{
2258 \exesheet@standardmargins
2259 }{% else display=notes
2260 \exesheet@largemargins
2261 }}
2262 }{% else if
2263 \ifthenelse{\equal{\exesheet@marginwidth}{unset}}{
2264 % do nothing
2265 }{% else
2266 \PackageWarningNoLine{exesheet}{The value `\exesheet@marginwidth'
2267 is not supported by the `marginwidth' option}
2268 }}}
2269 }
2270
2271 % \end{macrocode}
2272 % \end{macro}
2273 % For a two-sided document, the \textsf{geometry} package does not correctly set
2274 % the default width of the margin paragraph; it's too wide.
2275 % Therefore, we provide an explicit setting here, which is
2276 % useful when \texttt{marginwidth=unset}. Otherwise, the setting is
2277 % handled by the \texttt{marginwidth} key option.
2278 %
2279 % \begin{macrocode}
2280 \if@twoside \rightnotemarginwidth{0.5} \fi
2281
2282 % \end{macrocode}
2283 % \begin{macro}{\exs@process@noteragged}
2284 % The noteragged option can take one of the following values:
2285 % \texttt{left}, \texttt{right}, \texttt{center}, \texttt{justify} or \texttt{twoside}.
2286 % When working with a two-sided document, |\marginpar| can be used
2287 % with an optional parameter to distinguish left from right contents.
2288 % In this context, we employ |\noteraggedleft| and |\noteraggedright|
2289 % instead of |\noteragged|.
2290 % The \textsf{ragged2e} package by Martin Schröder~\cite{RAGG} offers the commands
2291 % |\RaggedLeft|, |\RaggedRight|, |\Centering|, and |\justifying|.
2292 % These commands yield better results compared to the standard
2293 % |\raggedleft|, |\raggedright| and |\centering| commands.
2294 % Margin paragraphs are justified by default in \LaTeX.
2295 % \begin{macrocode}
2296 \newcommand{\noteragged}{}
2297 \newcommand{\noteraggedleft}{}
2298 \newcommand{\noteraggedright}{}
2299
2300 \def\exs@process@noteragged{
2301 \ifthenelse{\equal{\exesheet@noteragged}{left}}{
2302 \if@twoside
2303 \renewcommand{\noteraggedleft}{\RaggedLeft}
2304 \renewcommand{\noteraggedright}{\RaggedLeft}
2305 \else
2306 \renewcommand{\noteragged}{\RaggedLeft}
2307 \fi
2308 }{% else if
2309 \ifthenelse{\equal{\exesheet@noteragged}{right}}{
2310 \if@twoside
2311 \renewcommand{\noteraggedleft}{\RaggedRight}
2312 \renewcommand{\noteraggedright}{\RaggedRight}
2313 \else
2314 \renewcommand{\noteragged}{\RaggedRight}
2315 \fi
2316 }{% else if
2317 \ifthenelse{\equal{\exesheet@noteragged}{center}}{
2318 \if@twoside
2319 \renewcommand{\noteraggedleft}{\Centering}
2320 \renewcommand{\noteraggedright}{\Centering}
2321 \else
2322 \renewcommand{\noteragged}{\Centering}
2323 \fi
2324 }{% else if
2325 \ifthenelse{\equal{\exesheet@noteragged}{justify}}{
2326 \renewcommand{\noteraggedleft}{\justifying} % equiv to nothing
2327 \renewcommand{\noteraggedright}{\justifying}
2328 \renewcommand{\noteragged}{\justifying}
2329 % justify is the default LaTeX setting
2330 }{% else if
2331 \ifthenelse{\equal{\exesheet@noteragged}{twoside}}{
2332 \if@twoside
2333 \renewcommand{\noteraggedleft}{\RaggedLeft}
2334 \renewcommand{\noteraggedright}{\RaggedRight}
2335 \else
2336 \PackageWarning{exesheet}{Invalid option `noteragged=twoside'
2337 when the document \MessageBreak is not in two-side mode}
2338 \fi
2339 }{% else
2340 \PackageWarning{exesheet}{The value `\exesheet@noteragged'
2341 is not supported by the `noteragged' option}
2342 }}}}}
2343 }
2344
2345 % \end{macrocode}
2346 % \end{macro}
2347 %
2348 % \begin{macro}{\exs@process@checkpts}
2349 % The scale control option relies on calculations with \emph{lengths},
2350 % which need to have a \emph{global} scope.
2351 %
2352 % For questions, assigned points will be added in |\sum@pts|,
2353 % while for exercises, points accumulate in |\sum@exe|.
2354 % These lengths are compared against |\exe@total| and |\sheet@total|.
2355 % The |\exe@check| macro validates the calculations of the previous exercise
2356 % when triggered by |\points|, |\totalexe| or |\totalpoints| macros.
2357 % Percent symbols at end of lines are necessary to prevent unwanted spaces.
2358 % |\exe@check| is also invoked within |\exs@process@checkpts| at the document's end
2359 % for a final check on the last exercise.
2360 % \begin{macrocode}
2361 \newlength{\sheet@total}
2362 \newlength{\sum@exe}
2363 \newlength{\exe@total}
2364 \newlength{\sum@pts}
2365 \def\exe@currentlabel{none}
2366 \newboolean{scale@valid}
2367
2368 \def\exe@check{%
2369 \ifthenelse{\lengthtest{\sum@pts = 0pt}}{%
2370 % do not check, no points or first exercise begins
2371 \ifthenelse{\equal{\exe@currentlabel}{none}}{}{%
2372 \PackageWarningNoLine{exesheet}{\exe@currentlabel:
2373 \the\exe@total}}%
2374 }{%
2375 \ifthenelse{\lengthtest{\exe@total = \sum@pts}}{%
2376 \PackageWarningNoLine{exesheet}{\exe@currentlabel:
2377 Sum of points \the\exe@total\space is valid}%
2378 }{%
2379 \PackageWarningNoLine{exesheet}{\exe@currentlabel:
2380 Sum of points is \the\sum@pts\space
2381 instead of \the\exe@total}%
2382 \setboolean{scale@valid}{false}%
2383 }%
2384 }%
2385 }
2386
2387 \def\exs@process@checkpts{
2388 \ifexesheet@checkpts
2389 \ifthenelse{\lengthtest{\sheet@total = 0pt}}{
2390 \PackageWarningNoLine{exesheet}{Option checkpts is true,
2391 \MessageBreak
2392 but \string\totalsheet\space is missing
2393 in the preamble. \MessageBreak
2394 See documentation}
2395 }{}
2396 \global\sum@exe=0pt
2397 \global\exe@total=0pt
2398 \global\sum@pts=0pt
2399 \setboolean{scale@valid}{true}
2400 \AtEndDocument{% final checking (global)
2401 \ifthenelse{\equal{\exe@currentlabel}{none}}{
2402 \ifthenelse{\lengthtest{\sum@pts = 0pt}}{
2403 \PackageWarningNoLine{exesheet}{checkpts:
2404 No points displayed}
2405 }{
2406 \ifthenelse{\lengthtest{\sheet@total = \sum@pts}}{
2407 \PackageWarningNoLine{exesheet}{Total:
2408 Sum of points \the\sheet@total\space is valid}
2409 }{
2410 \PackageWarningNoLine{exesheet}{Total:
2411 Sum of points is \the\sum@pts\space
2412 instead of \the\sheet@total}
2413 }}
2414 }{% last exercise and final checking
2415 \exe@check
2416 \ifthenelse{\lengthtest{\sum@exe} = 0pt}{
2417 \PackageWarningNoLine{exesheet}{checkpts:
2418 No points displayed}
2419 }{
2420 \ifthenelse{\lengthtest{\sheet@total = \sum@exe}}{
2421 \PackageWarningNoLine{exesheet}{Total:
2422 Sum of points \the\sheet@total\space is valid}
2423 }{
2424 \PackageWarningNoLine{exesheet}{Total:
2425 Sum of points is \the\sum@exe\space
2426 instead of \the\sheet@total}
2427 \setboolean{scale@valid}{false}
2428 }
2429 \ifthenelse{\boolean{scale@valid}}{
2430 \PackageWarningNoLine{exesheet}{
2431 Marking scheme checked without errors}
2432 }{
2433 \PackageWarningNoLine{exesheet}{
2434 Marking scheme checked with ERRORS! See above}
2435 }
2436 }
2437 }
2438 }
2439 \fi
2440 }
2441
2442 % \end{macrocode}
2443 %
2444 % \subsection{Marking scheme commands}
2445 %
2446 % The |\check@points| macro, used by |\points| and |\totalexe|, triggers
2447 % the marking scheme control (with |\exe@check| defined above) and
2448 % sets label and lengths for the next exercise.
2449 % \begin{macrocode}
2450 \newcommand*{\check@points}[1]{%
2451 \ifexesheet@checkpts%
2452 \exe@check% checks the previous exercise
2453 \gdef\exe@currentlabel{\exe@label}% for the upcoming exercise
2454 \global\sum@pts=0pt%
2455 \global\exe@total=#1pt%
2456 \global\advance\sum@exe by #1pt%
2457 \fi%
2458 }
2459
2460 % \end{macrocode}
2461 %
2462 % \begin{macro}{\points}
2463 % \begin{macrocode}
2464 \definecolor{pointscolor}{named}{red}
2465 \newcommand{\pointsstyle}{%
2466 \small\mdseries\sffamily\color{pointscolor}\fbox}
2467 \newcommand*{\points}[1]{%
2468 \ifthenelse{\boolean{exesheet@questions}}{\hfill
2469 \pointsstyle{#1~%
2470 \ifthenelse{\lengthtest{#1pt < 2pt}}{\pointname}{\pointsname}}%
2471 \check@points{#1}%
2472 }{}
2473 }
2474
2475 % \end{macrocode}
2476 % \end{macro}
2477 % To prevent spaces between the |\fbox| and its inner text,
2478 % percent symbols are necessary.
2479 % The test |#1 < 2| doesn't work with decimal numbers without |\lengthtest|,
2480 % but it works with lengths.
2481 % \end{macro}
2482 % \begin{macro}{\pts}
2483 % \begin{macrocode}
2484 \definecolor{ptscolor}{named}{red}
2485 \newcommand{\ptsstyle}[1]{%
2486 \footnotesize\centering\sffamily\color{ptscolor} (#1)}
2487 \newcommand*{\ptsmark}[1]{%
2488 \ifthenelse{\lengthtest{#1pt < 2pt}}{#1 \ptname}{#1 \ptsname}}
2489 \newcommand*{\pts}[1]{%
2490 \ifexesheet@pts%
2491 \mbox{}%
2492 \marginpar{\hspace{0pt}\ptsstyle{\ptsmark{#1}}}%
2493 \ifexesheet@checkpts%
2494 \global\advance\sum@pts by #1pt%
2495 \fi%
2496 \fi%
2497 \ignorespaces
2498 }
2499
2500 % \end{macrocode}
2501 % \end{macro}
2502 % \begin{macro}{\totalexe}
2503 % In the subsequent macros that utilize
2504 % |\marginpar|, the presence of percent symbols and |\ignorespaces| is essential
2505 % to prevent the occurrence of expanded blank spaces in the text (or the margin),
2506 % where these macros are incorporated.
2507 % \begin{macrocode}
2508 \definecolor{markingcolor}{named}{red}
2509 \newcommand{\markingstyle}[1]{\footnotesize\sffamily%
2510 \centering\color{markingcolor}\textbf{#1}}
2511 % inner arguments enable the implementation of boxed styles
2512 \newlength{\ptsboxlength}
2513 \setlength{\ptsboxlength}{3.1em}
2514 \cornersize{1}
2515 \newcommand*{\totalexe}[1]{%
2516 \ifexesheet@pts%
2517 \mbox{}%
2518 \marginpar{\hspace{0pt}\markingstyle{\ovalbox{%
2519 \makebox[\ptsboxlength]{\ptsmark{#1}}}}}%
2520 \check@points{#1}%
2521 \fi%
2522 \ignorespaces
2523 }
2524
2525 % \end{macrocode}
2526 % \end{macro}
2527 % \begin{macro}{\totalsheet}
2528 % \begin{macrocode}
2529 \newcommand*{\totalsheet}[1]{
2530 \global\sheet@total=#1pt
2531 }
2532
2533 % \end{macrocode}
2534 % \end{macro}
2535 %
2536 % \begin{macro}{\note}
2537 % The booleans \texttt{exesheet@pts} and \texttt{exesheet@notes} control
2538 % the display of marginal notes. If \texttt{exesheet@pts} is set to \texttt{false},
2539 % \DescribeMacro{\note*}
2540 % \texttt{exesheet@notes} will be ignored.
2541 % |\noindent| is required when using |\justifying| from the \textsf{ragged2e}
2542 % package~\cite{RAGG}.
2543 % Within the |\note@marginpar| macro, enclosing |\markingstyle| in double braces
2544 % helps prevent unintended formatting within the mandatory argument of |\note|.
2545 % A vicious error occurs when using an |\if| \ldots |\fi| structure
2546 % instead of |\ifthenelse| inside |\note@marginpar|
2547 % (but only if |@twoside| is \texttt{true}).
2548 % \begin{macrocode}
2549 \definecolor{notecolor}{rgb}{0.0, 0.4, 0.0} % kind of dark green
2550 \newcommand{\notestyle}[1]{\footnotesize\sffamily\color{notecolor} #1}
2551 \newcommand{\note@marginpar}[1]{%
2552 \if@twoside%
2553 \marginpar[\noteraggedleft #1]{\noteraggedright #1}%
2554 \else%
2555 \marginpar{\noteragged #1}%
2556 \fi%
2557 }
2558 \newcommand{\@note}[2][]{%
2559 \ifexesheet@pts%
2560 \mbox{}%
2561 \note@marginpar{%
2562 \ifthenelse{\equal{#1}{}}{}{{%
2563 \noindent\hspace{0pt}\markingstyle{#1}\\}}%
2564 \ifthenelse{\boolean{exesheet@notes}}{%
2565 \noindent\hspace{0pt}\notestyle #2%
2566 }{}%
2567 }%
2568 \ifexesheet@checkpts%
2569 \ifthenelse{\equal{#1}{}}{}{%
2570 \global\advance\sum@pts by #1pt%
2571 }%
2572 \fi%
2573 \fi%
2574 \ignorespaces
2575 }
2576 \newcommand{\@@note}[1]{%
2577 \ifexesheet@pts%
2578 \mbox{}%
2579 \marginpar{\noindent\hspace{0pt}\markingstyle{#1}}%
2580 \ifexesheet@checkpts%
2581 \global\advance\sum@pts by #1pt%
2582 \fi%
2583 \fi%
2584 \ignorespaces
2585 }
2586 \newcommand{\note}{\@ifstar{\@@note}{\@note}}
2587
2588 % \end{macrocode}
2589 % \end{macro}
2590 % \begin{macro}{\totalpoints}
2591 % \begin{macrocode}
2592 \newcommand{\totalpoints}{%
2593 \ifthenelse{\boolean{exesheet@pts}}{\totalexe}{\points}}
2594
2595 %</package>
2596 % \end{macrocode}
2597 % \end{macro}
2598 %
2599 % \hypertarget{ref}{}
2600 % \begin{thebibliography}{27}
2601 % % \begin{raggedright}
2602 % \bibitem{SCHOOL} \emph{The \textsf{schooldocs} package}, Antoine Missier,
2603 % CTAN, v1.6 2025/01/15.
2604 % \bibitem{GEOM} \emph{The \textsf{geometry} package},
2605 % Hideo Umeki, CTAN, v5.9 2020/01/02.
2606 % \bibitem{ENUM} \emph{Customizing lists with the \textsf{enumitem} package},
2607 % Javier Bezos, CTAN, v3.9 2019/06/20.
2608 % \bibitem{TASK} \emph{\textsf{tasks} -- lists with columns filled horizontally},
2609 % Clemens Niederberger. CTAN, v1.4a, 2022/01/08.
2610 % \bibitem{VERS} \emph{The \textsf{versions} package -- Omit passages optionally
2611 % under \LaTeX}, Uwe Lück, CTAN, v0.55 2005/04/28.
2612 % \bibitem{FBOX} \emph{Documentation for \texttt{fancybox.sty}:
2613 % Box tips and tricks for \LaTeX}, Timothy Van Zandt, CTAN, v1.4 2010/05/15.
2614 % \bibitem{TRAN} \emph{\textsf{translations} -- Internationalization of \LaTeXe\ Packages},
2615 % Clemens Niederberger, CTAN, v1.12 2022/02/05.
2616 % \bibitem{RAGG} \emph{The \textsf{ragged2e-}package}, Martin Schröder,
2617 % CTAN, v3.6 2023/06/22.
2618 % \bibitem{MPAR} \emph{\texttt{mparhack.sty}}, Tom Sgouros, Stefan Ulrich,
2619 % CTAN, v1.5 2021/05/02.
2620 % \bibitem{SECT} \emph{The \textsf{sectsty} package}, Rowland McDonnell,
2621 % CTAN, v2.0.2 2002/02/25.
2622 % \bibitem{EXER} \emph{\texttt{exercise.sty} : a package to typeset exercises},
2623 % Paul Pichaureau, CTAN, v1.6 2014/10/21.
2624 % \bibitem{EXES} \emph{The \textsf{exercises} package}, Roger Jud,
2625 % CTAN, v1.1 2000/05/17.
2626 % \bibitem{XSIM} \emph{\textsf{xsim} -- eXercise Sheets IMproved --
2627 % the official successor of the \textsf{exsheets} package}, Clemens Niederberger,
2628 % CTAN, v0.21 2022/02/12.
2629 % \bibitem{EXFR} \emph{The \textsf{exframe} package}, Niklas Beisert,
2630 % CTAN, v3.4 2020/02/24.
2631 % \bibitem{EXAM} \emph{Using the \textsf{exam} document class}, Philip Hirschhorn,
2632 % CTAN, v2.704 2023/07/09.
2633 % \bibitem{ANSW} \emph{\textsf{answers} Production of solution sheets in \LaTeXe},
2634 % Mike Piff and Joseph Wright, CTAN, 2.16 2014/08/24.
2635 % \bibitem{PROB} \emph{The \textsf{probsoln v3.05}: creating problem sheets
2636 % optionally with solutions}, Nicola L.C.\@ Talbot, CTAN 2017/07/10.
2637 % \bibitem{EXSO} \emph{The \textsf{ExSol} package}, Walter Daems,
2638 % CTAN, 1.4 2018/10/23.
2639 % \bibitem{EXEP} \emph{The \textsf{exercisepoints} Package}, Henning Kerstan,
2640 % CTAN, v1.2.3 2019/01/03.
2641 % \bibitem{WORK} \emph{\textsf{worksheet}}, Benjamin Zöllner, CTAN, v1.1 2018/08/17.
2642 % \bibitem{EXAN} \emph{\textsf{exam-n}: exam papers}, Norman Gray, CTAN, v1.4.0 2022/10/10.
2643 % \bibitem{EQEX} \emph{The \textsf{eqexam} Package -- part of the
2644 % Acro\TeX\ eDucation Bundle},
2645 % D. P. Story, CTAN, 5.2 2021/02/26.
2646 % \bibitem{CESE} \emph{\textsf{cesenaexam} — class file to typeset exams}, Alex Pacini,
2647 % CTAN, v2.0 2017/08/03.
2648 % \bibitem{ESAMI} \emph{Package \textsf{esami}}, Grazia Messineo, Salvatore Vassallo,
2649 % CTAN, v2.8 2023/07/21.
2650 % \bibitem{RAND} \emph{Teh \textsf{randexam} class for \LaTeX}, Jianrui Lyu,
2651 % CTAN, 2024D, 2024/02/03.
2652 % \bibitem{EXAMN} \emph{\textsf{exam-n}: exam papers}, Norman Gray, CTAN, v1.4.0 2022/10/10.
2653 % \bibitem{MATH} \emph{The \textsf{mathexam} Package}, Jan Hlavacek, CTAN, v1.00 2007/07/30.
2654 % \end{raggedright}
2655 % \end{thebibliography}
2656 %
2657 % \newpage
2658 % \hypertarget{source}{}
2659 % \renewcommand\annexstyle{\sffamily\color{darkbrown}\MakeUppercase}
2660 % \annex[\unskip: source code of the examples]
2661 %
2662 % This annex presents the source code of all the examples provided in the main document.
2663 %
2664 % The title is obtained with |\annex[\unskip: source code of the examples]|
2665 % \setcounter{exercise}{0}
2666 % \begin{multicols}{2}
2667 % \begin{verbatim}
2668 % \exercise[(to begin)]
2669 % Try this first command; easy!
2670 % \end{verbatim}
2671 % \exercise[(to begin)]
2672 % Try this first command; easy!
2673 % \columnbreak
2674 % \begin{verbatim}
2675 % \exercise[\unskip*** (difficult)]
2676 % Calculate $1+1$.
2677 % \end{verbatim}
2678 % \exercise[\unskip*** (difficult)]
2679 % Calculate $1+1$.
2680 % \end{multicols}
2681 %
2682 % \seprule
2683 % \begin{verbatim}
2684 % \exercise*[(Fermat's theorem)]{Problem}
2685 % Prove that there are no positive integers $x, y, z$ such that
2686 % $x^n+y^n=z^n$ for any integer $n$ greater than 2.
2687 % \end{verbatim}
2688 % \exercise*[(Fermat's theorem)]{Problem}
2689 % Prove that there are no positive integers $x, y, z$ such that
2690 % $x^n+y^n=z^n$ for any integer $n$ greater than 2.
2691 %
2692 % \seprule
2693 % \begin{verbatim}
2694 % \exercise
2695 % \subpart[(preliminary)]
2696 % To begin, prepare your cup of tea.
2697 % \subpart
2698 % Now you are ready to proceed with the current exercise.
2699 % \end{verbatim}
2700 % \exercise
2701 % \subpart[(preliminary)]
2702 % To begin, prepare your cup of tea.
2703 % \subpart
2704 % Now you are ready to proceed with the current exercise.
2705 %
2706 % \seprule
2707 % \begin{verbatim}
2708 % \exe This is a brief exercise that can encompass several paragraphs
2709 % or questions.
2710 %
2711 % Here for example a new paragraph begins.
2712 % \exe This is another concise exercise.
2713 %
2714 % \exe* Another short exercise without a separator.
2715 % \end{verbatim}
2716 %
2717 % \exe This is a brief exercise that can encompass several
2718 % paragraphs or questions.
2719 %
2720 % Here for example a new paragraph begins.
2721 % \exe This is another concise exercise.
2722 %
2723 % \exe* Another short exercise without a separator.
2724 %
2725 % \seprule
2726 % \begin{verbatim}
2727 % \exercise
2728 % \begin{enumerate}
2729 % \item First question
2730 % \begin{enumerate}
2731 % \item First sub-question
2732 % \item Second sub-question
2733 % \end{enumerate}
2734 % \item Second question
2735 % \end{enumerate}
2736 % \end{verbatim}
2737 %
2738 % \begin{multicols}{2}
2739 % \exercise
2740 % \begin{enumerate}
2741 % \item First question
2742 % \begin{enumerate}
2743 % \item First sub-question
2744 % \item Second sub-question
2745 % \end{enumerate}
2746 % \item Second question
2747 % \end{enumerate}
2748 %
2749 % \setlist[enumerate]{font=\normalfont} ^^A local inside this multicols environment
2750 % \setlist[enumerate,1]{leftmargin=2.5em}
2751 % \setcounter{exercise}{6}
2752 %
2753 % \exercise[\normalfont(\texttt{setlist=false})]
2754 % \begin{enumerate}
2755 % \item First question
2756 % \begin{enumerate}
2757 % \item First sub-question
2758 % \item Second sub-question
2759 % \end{enumerate}
2760 % \item Second question
2761 % \end{enumerate}
2762 % \end{multicols}
2763 %
2764 % \seprule
2765 % \begin{verbatim}
2766 % \begin{exenumerate}
2767 % \item Translate the following sentences in English:
2768 % \begin{enumerate}
2769 % \item Nam dui ligula, fringilla a, euismod sodales, sollicitudin
2770 % vel, wisi.
2771 % \item Nam lacus libero, pretium at, lobortis vitae, ultricies et,
2772 % tellus.
2773 % \end{enumerate}
2774 % \item Translate the following sentence in German:
2775 % \par Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet
2776 % magna, vitae ornare odio metus a mi.
2777 % \item Translate the following sentence in French:
2778 % Cum sociis natoque penatibus
2779 % et magnis dis parturient montes, nascetur ridiculus mus.
2780 % \end{exenumerate}
2781 % \end{verbatim}
2782 %
2783 % \begin{exenumerate}
2784 % \item Translate the following sentences in English:
2785 % \begin{enumerate}
2786 % \item Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi.
2787 % \item Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.
2788 % \end{enumerate}
2789 % \item Translate the following sentence in German:
2790 % \par Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna,
2791 % vitae ornare odio metus a mi.
2792 % \item Translate the following sentence in French:
2793 % Cum sociis natoque penatibus
2794 % et magnis dis parturient montes, nascetur ridiculus mus.
2795 % \end{exenumerate}
2796 %
2797 % \seprule
2798 % \begin{verbatim}
2799 % \exercise
2800 % Calculate the derivative of the following functions:
2801 % \begin{tablenum1}(3)
2802 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
2803 % \item $\ds g(x) = \ln \left(\frac{1-x}{1+x^2}\right)$,
2804 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$,
2805 % \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
2806 % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
2807 % \end{tablenum1}
2808 % \end{verbatim}
2809 %
2810 % \exercise
2811 % Calculate the derivative of the following functions:
2812 % \begin{tablenum1}(3)
2813 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
2814 % \item $\ds g(x) = \ln \left(\frac{1-x}{1+x^2}\right)$,
2815 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$,
2816 % \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
2817 % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
2818 % \end{tablenum1}
2819 %
2820 % {
2821 % \settasks{label-format=\normalfont}
2822 % \RenewTasksEnvironment[label=\labelenumone,
2823 % column-sep=1em,label-align=right,
2824 % item-indent=2.5em,label-width=1em,label-offset=0.5em,
2825 % after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenum1}[\item](2)
2826 % \RenewTasksEnvironment[label=\labelenuma,ref=\refenuma,
2827 % column-sep=1em,label-align=right,
2828 % item-indent=2.15em,label-width=1.6em,label-offset=0.5em,
2829 % after-item-skip=0.5ex plus 0.5ex minus 0.5ex]{tablenuma}[\item](2)
2830 % \setcounter{exercise}{7}
2831 % \exercise[\normalfont(with \texttt{setlist=false})]
2832 % Calculate the derivative of the following functions:
2833 % \begin{tablenum1}(3)
2834 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
2835 % \item $\ds g(x) = \ln \left( \frac{1-x}{1+x^2}\right)$,
2836 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$,
2837 % \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
2838 % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
2839 % \end{tablenum1}
2840 % }
2841 %
2842 % \seprule
2843 % \begin{verbatim}
2844 % \begin{enumerate}
2845 % \item \mbox{}\vspace{-5.7ex}
2846 % \begin{tablenuma}(3)
2847 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
2848 % \item $\ds g(x) = \ln \left( \frac{1-x}{1+x^2}\right)$,
2849 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$.
2850 % \end{tablenuma}
2851 % \end{enumerate}
2852 % \end{verbatim}
2853 %
2854 % \begin{enumerate}
2855 % \item \mbox{}\vspace{-5.7ex}
2856 % \begin{tablenuma}(3)
2857 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
2858 % \item $\ds g(x) = \ln \left( \frac{1-x}{1+x^2}\right)$,
2859 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$.
2860 % \end{tablenuma}
2861 % \end{enumerate}
2862 %
2863 % \seprule
2864 % \begin{verbatim}
2865 % \exercise
2866 % Calculate the derivative of the following functions:
2867 % \begin{colsenum}{3}
2868 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
2869 % \item $\ds g(x) = \ln \left(\frac{1-x}{1+x^2}\right)$,
2870 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$,
2871 % \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
2872 % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
2873 % \end{colsenum}
2874 % \end{verbatim}
2875 %
2876 % \exercise
2877 % Calculate the derivative of the following functions:
2878 % \begin{colsenum}{3}
2879 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
2880 % \item $\ds g(x) = \ln \left(\frac{1-x}{1+x^2}\right)$,
2881 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$,
2882 % \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
2883 % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
2884 % \end{colsenum}
2885 %
2886 % \exercise[\normalfont(the same with \texttt{colsenum*})]
2887 % Calculate the derivative of the following functions:
2888 % \begin{colsenum*}{3}
2889 % \item $\ds f(x) = \frac{1-x^2}{\mathrm{e}^x +\mathrm{e}^{-x}}$,
2890 % \item $\ds g(x) = \ln \left(\frac{1-x}{1+x^2}\right)$,
2891 % \item $\ds h(x) = \int_{0}^{1}\mathrm{e}^{xy}\, \mathrm{d}y$,
2892 % \item $\ds k(x) = \sum_{i=1}^{\infty}\frac{1}{x^i}$,
2893 % \item $\ds l(x) = \int_{\frac{1}{x}}^{x}\frac{1}{\ln t}\, \mathrm{d}t$.
2894 % \end{colsenum*}
2895 %
2896 % \seprule
2897 % \begin{verbatim}
2898 % \exercise
2899 % \begin{questions}
2900 % \begin{enumerate}
2901 % \item Is the \textsf{exesheet} package useful ?
2902 % \item Aren't there any other packages that deal with exercises ?
2903 % \end{enumerate}
2904 % \end{questions}
2905 % \begin{answers}
2906 % \begin{enumerate}
2907 % \item The \textsf{exesheet} package is useful for teachers.
2908 % \item There are numerous other packages that handle exercises and
2909 % provide the capability to create questions and solutions separately.
2910 % For instance the \textsf{exercise} package by Paul Pichaureau,
2911 % \textsf{exercises} by Roger Jud,
2912 % \textsf{exsheets} (now superseded by \textsf{xsim})
2913 % by Clemens Niederberger,
2914 % \textsf{exframe} by Niklas Beisert,
2915 % \textsf{exam} by Philip Hirschhorn,
2916 % \textsf{answers} by Mike Piff and Joseph Wright,
2917 % \textsf{probsoln} by Nicola Talbot,
2918 % \textsf{eqexam} by D. P. Story\ldots
2919 % They are briefly presented in section 6.3.
2920 % \end{enumerate}
2921 % \end{answers}
2922 % \end{verbatim}
2923 %
2924 % \exercise
2925 % \begin{questions}
2926 % \begin{enumerate}
2927 % \item Is the \textsf{exesheet} package useful ?
2928 % \item Aren't there any other packages that deal with exercises ?
2929 % \end{enumerate}
2930 % \end{questions}
2931 % \begin{answers}
2932 % \begin{enumerate}
2933 % \item The \textsf{exesheet} package is useful for teachers.
2934 % \item There are numerous other packages that handle exercises and
2935 % provide the capability to create questions and solutions separately.
2936 % For instance the \textsf{exercise} package by Paul Pichaureau,
2937 % \textsf{exercises} by Roger Jud,
2938 % \textsf{exsheets} (now superseded by \textsf{xsim})
2939 % by Clemens Niederberger,
2940 % \textsf{exframe} by Niklas Beisert,
2941 % \textsf{exam} by Philip Hirschhorn,
2942 % \textsf{answers} by Mike Piff and Joseph Wright,
2943 % \textsf{probsoln} by Nicola Talbot,
2944 % \textsf{eqexam} by D. P. Story\ldots
2945 % They are briefly presented in section 6.3.
2946 % \end{enumerate}
2947 % \end{answers}
2948 %
2949 % \seprule
2950 % \begin{verbatim}
2951 % \exercise[\points{5}]
2952 % Try to read this document to the end without drinking tea and you get five
2953 % points.
2954 % \end{verbatim}
2955 %
2956 % \exercise[\points{5}]
2957 % Try to read this document to the end without drinking tea and you get five points.
2958 %
2959 % \seprule
2960 % \begin{verbatim}
2961 % \exe \pts{3} The first short exercise with a marking scheme.
2962 % \exe \pts{1.5} The second one.
2963 % \end{verbatim}
2964 %
2965 % \exe \pts{3} The first short exercise with a marking scheme.
2966 % \exe \pts{1.5} The second one.
2967 %
2968 % \seprule
2969 % \begin{verbatim}
2970 % \newcommand{\ds}{\displaystyle}
2971 % \exercise[\totalexe{4}]
2972 % \begin{questions}
2973 % For each subsequent question, determine whether the statement is true or
2974 % false. Provide a thorough justification for your answer.
2975 % \begin{tablenum1}
2976 % \item $\ds\int_{0}^{\sqrt{3}}\frac{1}{x+\sqrt{3}}\,\mathrm{d}x=\ln2$,
2977 % \item $\ds\int_{2}^{\mathrm{e}}\frac{1}{x\ln x}\,\mathrm{d}x=-\ln2$,
2978 % \item* The function $F$, defined on $\mathbf{R}$ by
2979 % $F(x) = \ds\int_{0}^{x}\frac{1}{t^2+t+1}\,\mathrm{d} t$,
2980 % is increasing on $\mathbf{R}$.
2981 % \end{tablenum1}
2982 % \end{questions}
2983 %
2984 % \begin{answers}
2985 % \begin{enumerate}
2986 % \item \note[1]{0.5 for the anti-derivative\\0.5 for simplifying}
2987 % We calculate:
2988 % \[ \int_{0}^{\sqrt{3}}\frac{1}{x+\sqrt{3}}\,\mathrm{d}x
2989 % = \bigg[ \ln\left(x+\sqrt{3}\right) \bigg]_0^{\sqrt{3}}
2990 % = \ln\left(2\sqrt{3}\right)-\ln \sqrt{3}
2991 % = \ln\left(\frac{2 \sqrt{3}}{\sqrt{3}}\right)
2992 % =\ln 2.
2993 % \]
2994 % \textbf{TRUE}.
2995 %
2996 % \item \note[1.5]{1 for the anti-derivative\\
2997 % 0.5 for the final value\\[2ex]
2998 % Other method: $\frac{1}{x \ln x} >0$ on $[2, \mathrm{e}]$
2999 % whereas $-\ln2<0$
3000 % }
3001 % We have $\ds\frac{1}{x \ln x}=\frac{\frac{1}{x}}{\ln x}
3002 % =\frac{u'(x)}{u(x)}$
3003 % with $u(x)=\ln x$, which is positive on $[2, \mathrm{e}]$. Hence
3004 %
3005 % \[ \int_{2}^{\mathrm{e}}\frac{1}{x \ln x}\,\mathrm{d}x
3006 % = \Big[ \ln(\ln x) \Big]_2^\mathrm{e}
3007 % = \ln(\ln \mathrm{e})-\ln(\ln2)= \ln1 -\ln(\ln2)=-\ln(\ln2).
3008 % \]
3009 % \textbf{FALSE}.
3010 %
3011 % \item \note*{1.5}
3012 % The function $F$, defined on $\mathbf{R}$ by
3013 % \[ F(x)= \int_{0}^{x}\frac{1}{t^2+t+1}\, \mathrm{d}t, \]
3014 % is derivable on $\mathbf{R}$ and its derivative is such that
3015 % $F'(x)=\frac{1}{x^2+x+1}$.
3016 % \note{0.5 for $F'$\\1 for the sign of $F'$ and conclusion}
3017 % The denominator is a quadratic polynomial, always positive
3018 % because its discriminant is $\Delta=-3 <0$.
3019 % Thus $F$ is increasing on $\mathbf{R}$. \\
3020 % \textbf{TRUE}.
3021 % \end{enumerate}
3022 % \end{answers}
3023 % \end{verbatim}
3024 %
3025 % \exercise[\totalexe{4}]
3026 % \begin{questions}
3027 % For each subsequent question, determine whether the statement is true or
3028 % false. Provide a thorough justification for your answer.
3029 % \begin{tablenum1}
3030 % \item $\ds\int_{0}^{\sqrt{3}}\frac{1}{x+\sqrt{3}}\,\mathrm{d}x=\ln2$,
3031 % \item $\ds\int_{2}^{\mathrm{e}}\frac{1}{x\ln x}\,\mathrm{d}x=-\ln2$,
3032 % \item* The function $F$, defined on $\mathbf{R}$ by
3033 % $F(x) = \ds\int_{0}^{x}\frac{1}{t^2+t+1}\,\mathrm{d} t$,
3034 % is increasing on $\mathbf{R}$.
3035 % \end{tablenum1}
3036 % \end{questions}
3037 %
3038 % \begin{answers}
3039 % \begin{enumerate}
3040 % \item \note[1]{0.5 for the anti-derivative\\0.5 for simplifying}
3041 % We calculate:
3042 % \[ \int_{0}^{\sqrt{3}}\frac{1}{x+\sqrt{3}}\,\mathrm{d}x
3043 % = \bigg[ \ln\left(x+\sqrt{3}\right) \bigg]_0^{\sqrt{3}}
3044 % = \ln\left(2\sqrt{3}\right)-\ln \sqrt{3}
3045 % = \ln\left(\frac{2 \sqrt{3}}{\sqrt{3}}\right)
3046 % =\ln 2.
3047 % \]
3048 % \textbf{TRUE}.
3049 %
3050 % \item \note[1.5]{1 for the anti-derivative\\0.5 for the final value\\[2ex]
3051 % Other method: $\frac{1}{x \ln x} >0$ on $[2, \mathrm{e}]$
3052 % whereas $-\ln2<0$
3053 % }
3054 % We have $\ds\frac{1}{x \ln x}=\frac{\frac{1}{x}}{\ln x}=\frac{u'(x)}{u(x)}$
3055 % with $u(x)=\ln x$, which is positive on $[2, \mathrm{e}]$. Hence
3056 %
3057 % \[ \int_{2}^{\mathrm{e}}\frac{1}{x \ln x}\,\mathrm{d}x
3058 % = \Big[ \ln(\ln x) \Big]_2^\mathrm{e}
3059 % = \ln(\ln \mathrm{e})-\ln(\ln2)= \ln1 -\ln(\ln2)=-\ln(\ln2).
3060 % \]
3061 % \textbf{FALSE}.
3062 %
3063 % \item \note*{1.5}
3064 % The function $F$, defined on $\mathbf{R}$ by
3065 % \[ F(x)= \int_{0}^{x}\frac{1}{t^2+t+1}\, \mathrm{d}t, \]
3066 % is derivable on $\mathbf{R}$ and its derivative is such that
3067 % $F'(x)=\frac{1}{x^2+x+1}$.
3068 % \note{0.5 for $F'$\\1 for the sign of $F'$ and conclusion}
3069 % The denominator is a quadratic polynomial, always positive because its
3070 % discriminant is $\Delta=-3 <0$.
3071 % Thus $F$ is increasing on $\mathbf{R}$. \\
3072 % \textbf{TRUE}.
3073 % \end{enumerate}
3074 % \end{answers}
3075 % \Finale
3076 \endinput