Debian Codegraph @

texmf-dist/doc/latex/tuda-ci/DEMO-TUDaExercise.tex

raw
1 %% This is file `DEMO-TUDaExercise.tex' version 4.05 (2025-11-13),
2 %% it is part of
3 %% TUDa-CI -- Corporate Design for TU Darmstadt
4 %% ----------------------------------------------------------------------------
5 %%
6 %% Copyright (C) 2018--2025 by Marei Peischl <[email protected]>
7 %%
8 %% ============================================================================
9 %% This work may be distributed and/or modified under the
10 %% conditions of the LaTeX Project Public License, either version 1.3c
11 %% of this license or (at your option) any later version.
12 %% The latest version of this license is in
13 %% http://www.latex-project.org/lppl.txt
14 %% and version 1.3c or later is part of all distributions of LaTeX
15 %% version 2008/05/04 or later.
16 %%
17 %% This work has the LPPL maintenance status `maintained'.
18 %%
19 %% The current maintainer of this work is
20 %% Marei Peischl <[email protected]>
21 %%
22 %% The development repository can be found at
23 %% https://github.com/tudace/tuda_latex_templates
24 %% Please use the issue tracker for feedback!
25 %%
26 %% If you need a compiled version of this document, have a look at
27 %% http://mirror.ctan.org/macros/latex/contrib/tuda-ci/doc
28 %% or at the documentation directory of this package (if installed)
29 %% <path to your LaTeX distribution>/doc/latex/tuda-ci
30 %% ============================================================================
31 %%
32 % !TeX program = lualatex
33 %%
34
35 \documentclass[
36 english,% Main language as global option
37 accentcolor=9c,% Choose accent color: For a list of available colors see the full tudapub documentation
38 points=true, to activate referencing task properties
39 % accept-missing-logos=true,% No error in case logo files are not available
40 % logofile=example-image,% In case logo should be replaced
41 ]{tudaexercise}
42
43 %%%%%%%%%%%%%%%%%%%
44 % Language setup
45 %%%%%%%%%%%%%%%%%%%
46 \usepackage[english]{babel}
47 \usepackage[autostyle]{csquotes}% \enquote, to simplify use of quotation marks
48
49 %%%%%%%%%%%%%%%%%%%
50 % Bibliography
51 %%%%%%%%%%%%%%%%%%%
52 \usepackage{biblatex}
53 \addbibresource{DEMO-TUDaBibliography.bib}% File name of BibTeX database
54
55 %%%%%%%%%%%%%%%%%%%
56 % Document specific setup for demonstration, generally not needed!
57 %%%%%%%%%%%%%%%%%%%
58 \usepackage{booktabs}% Improved horizontal rules for use in tables
59 \renewcommand*{\creditformatsum}[1]{\creditformat{Total: #1}}
60
61 \ConfigureHeadline{
62 headline={title-name-id}
63 }
64
65 \newcommand*{\file}[1]{\texttt{#1}}
66 \newcommand*{\code}[1]{\texttt{#1}}
67 \newcommand*{\pkg}[1]{\textsf{#1}}
68 \newcommand*{\cls}[1]{\textsf{#1}}
69 \newcommand*{\option}[1]{\texttt{#1}}
70 \newcommand*{\environment}[1]{\texttt{#1}}
71 \let\tbs\textbackslash
72 %%%%%%%%%%%%%%%%%%%
73 % End of demo specific setup
74 %%%%%%%%%%%%%%%%%%%
75
76 \title[TUDaExercise]{Tasksheet to practice use of TUDaExercise class}
77 \author{Marei Peischl}
78 \term{Spring 2042}
79 \sheetnumber{5}
80
81 \begin{document}
82
83 \maketitle
84
85 \begin{task}{Title}
86 TUDaExercise does not support the \code{titlepage} option.
87 To save space the setting is enforced to \code{titlepage=false}.
88 The title material supports some additional commands, a full example is shown below:
89
90 \begin{verbatim}
91 \title[Short title to be used in running headers]{Title}
92 \subtitle{Subtitle}
93 \author{Author/Professor}
94 \term{Term}
95 \date{Date}
96 \sheetnumber{Sheetnumber}
97 \end{verbatim}
98
99 All fields but the title may be kept empty.
100 In case no sheetnumber is used the tasks will be numbered starting at 1.
101 \end{task}
102
103 \begin{task}{Coloring}
104 The coloring uses the same mechanisms as the other classes of the TUDa-CI bundle. The options \option{color},
105 \option{accentcolor}, \option{textaccentcolor}, \option{identbarcolor} work as usual \cite[see][]{tuda-ci}. It is also possible to
106 deactivate the colored title block.
107 The option \option{colorback=false} makes it possible to set the toner-saving variant for
108 versions for printing
109 \end{task}
110
111 \begin{task}{Create a task}
112
113 Tasks are defined in \cls{tudaexercise} using the \environment{task} environment. The required argument is used as a title. It may remain empty.
114
115 \begin{verbatim}
116 \begin{task}[<options>]{title}
117 Text describing the task
118 \end{task}
119 \end{verbatim}
120
121 Cross-references between the tasks are possible as usual (\code{\tbs{}label} and \code{\tbs{}ref}).
122
123 \end{task}
124
125
126 \begin{task}{Subtasks}
127 \begin{subtask}[title={Basic structure}]
128 \cls{tudaexercise} provides the \code{subtask} environment to subdivide tasks into subtasks.
129 Currently inly one level is supported.
130 For further subdivision, it is also possible to divide the document into sections using \code{\tbs{}section}.
131
132 \begin{verbatim}
133 \begin{subtask}[title={title},points=5]
134
135 \end{subtask}
136 \end{verbatim}
137
138 In contrast to tasks, subtasks do not require a heading.
139 Therefore, the syntax for the transfer differs from that of the task environment. However, there is a variant to avoid this distinction, see task \ref{task-subtask-syntax}.
140 \end{subtask}
141
142 \begin{subtask}[title={Layout modification of the headings}]
143 From version 3.13, \cls{tudaexercise} also supports switching the layout of subtask headings.
144 There are three option values for the document class:
145 subtask=ruled
146 subtask=plain
147 subtask=runin If very small tasks are set, the break after the title can be prevented . In this case, the user is responsible
148 for ensuring that any necessary visual separation between the title and task text takes place, e.g. by
149 highlighting the title text
150 Ab Version 3.13 unterstützt \cls{tudaexercise} zusätzlich eine Umschaltung bezüglich des Layouts der Subtask-Überschriften. Es existieren drei Optionswerte für die Dokumentenklasse:
151 \begin{description}
152 \item[subtask=ruled] Default setting, the headings are separated from the body text by lines (As shown in this document).
153 \item[subtask=plain] No rules around the headings
154 \item[subtask=runin] If very small tasks are set, the break after the title can be prevented . In this case, the user is responsible
155 for ensuring that any necessary visual separation between the title and task text takes place, e.g. by highlighting the title text.
156 \end{description}
157 \end{subtask}
158 \end{task}
159
160
161 \begin{task}{Headline customization}
162 The mechanism for the headers has been adapted so that its content can be freely selected.
163
164 \begin{verbatim}
165 \ConfigureHeadline{
166 headline={content of the headline}
167 }
168 \end{verbatim}
169
170 There is now a distinction between left and right pages (in case \option{twoside=true}).
171 \begin{verbatim}
172 \ConfigureHeadline{
173 even={content of the header for left pages},
174 odd={content of the header for right pages},
175 oneside={content of the header in single-page mode}
176 }
177 \end{verbatim}
178
179 Settings that affect the same pages overwrite each other.
180
181 \begin{subtask}[title={Custom content for headlines}]
182 The content can be any \LaTeX{} code which will be placed within a box as wide as the text.
183 Content will be typeset left aligned.
184 It is possible to place graphics or tables within this box.
185
186 There are some ready-made elements for the headers that can be placed in the header.
187 \begin{verbatim}
188 \ShortTitle
189 \StudentID
190 \StudentName
191 \end{verbatim}
192 \end{subtask}
193
194 \begin{subtask}[title={Predefined header options}]
195 In addition, the \option{headline} option acceps some pre-defined values which will place the entries entries according to the self-explanatory naming scheme:
196 \option{title-name-id}, \option{title-name}, \option{title}, \option{name-id}, \option{name}
197 \end{subtask}
198
199 \begin{subtask}[title={Enable the header for the title page}]
200 As the header may be used to specify student data, it is possible to use the class option \option{headontitle}. This will enable the header for the title page.
201 \end{subtask}
202 \end{task}
203
204 \begin{task}[solution=true]{Solutions}
205 \cls{tudaexercise} has a mechanism for managing solution proposals within the files.
206 The \environment{solution} environment exists for this purpose.
207 To enable the output of solutions it's possible to use the class option (global)
208
209 \begin{verbatim}
210 \documentclass[...,
211 solution=true,
212 ]{tudaexercise}
213 \end{verbatim}
214 or configure it locally for individual tasks:
215
216 \begin{verbatim}
217 \begin{task}[solution=true]{Heading}
218 Task description
219 \begin{solution}
220 Solution
221 \end{solution}
222 \end{task}
223 \end{verbatim}
224
225 The default setting is solution=false.
226
227 \begin{solution}
228 This is an example for a solution block.
229 \end{solution}
230
231 There also exists a \environment{solution*} environment. Which behaves the same way, but does not automatically add a title to the block.
232 \end{task}
233
234 \begin{task}{Query the \option{solution} setting}
235
236 As of version 3.04, it is also possible to query the solution setting using the following structures:
237
238 \begin{verbatim}
239 \IfSolutionT{<if solution=true>}
240 \IfSolutionF{<if solution=false>}
241 \IfSolutionTF{<if solution=true>}{<if solution=false>}
242 \end{verbatim}
243 In the current setting (solution=false), the above block generates the following output:
244
245 \IfSolutionT{<if solution=true>}
246 \IfSolutionF{<if solution=false>}
247 \IfSolutionTF{<if solution=true>}{<if solution=false>}
248
249 \end{task}
250
251 \begin{task}[credit=10]{Points}
252 Points can be specified using the \option{credit} key.
253
254 using the macro \creditformat option key.
255 The value is placed after the task title within parentheses.
256 This is internally done using the \code{\tbs{}creditformat} command which can be redefined to archieve different formats.
257
258 Alternatively, there is the \option{points} key which, in addition to the specification, also adds the text \code{\tbs{}PointName} or
259 \code{\tbs{PointsName}} depending on whether the value equals 1. The points key therefore only accepts numerical
260 values (from version 3.13 floating point numbers are supported).
261 The decimal separator here is a period.
262 Correction to a comma is possible by redefining \code{\tbs{}pointformat}.
263
264 \begin{subtask}[points=1,title={Example for the using \option{points}}]
265 As older versions of TUDaExercise did not allow option processing for subtask, an additional mechanism is
266 included here.
267 If both a title and specific information are required, the title key is also included here.
268 A check is made to see whether the argument contains an equals sign; if this is the case, it is assumed that options are passed according to the key=value structure.
269 \end{subtask}
270 \end{task}
271
272 \begin{task}[points=auto]{Automatisms for grading tables}
273 \label{task:refPoints}
274
275 At version 3.13 \cls{tudaexercise} received the functionality for automatic grading tables and references to the point data.
276
277 \begin{subtask}[points=3,title={Activate references}]
278 \cls{tudaexercise} has generally deactivated this functionality, but it can be activated via the class option \option{points=true} be switched on.
279
280 The referencing mechanism works in a similar way to the object references in \LaTeX.
281 This makes it necessary to compile the document twice.
282 If \cls{tudaexercise} detects different values between begin and end of the compilation process, a corresponding warning is generated.
283
284 Two macros are available for the reference.
285 One works by calling up the task number, the other via labels:
286
287 \verb+\getPoints{+\thetask\verb+}+\\
288 \verb+\refPoints{task:refPoints}% requires the \label{task:refPoints}, see source code+
289
290 In this case, both macros return the same value: \refPoints{task:refPoints}.
291 As {\tbs{}refPoints} works independently of hte structure of the task numbers, this variant is generally preferable.
292 In addition to references to individual tasks, \verb+\getPointsTotal+ returns the total of all tasks of the last compilation.
293 \end{subtask}
294
295 \begin{subtask}[points=2,title={Summation among subtasks}]
296 The new mechanism also allows automatic calculation of the total points of all subtasks within a task.
297 To enable this mechanism the option \option{points=auto} has to be set.
298 If it's set as a class option, it will be activated for all tasks.
299 If the class option points=auto is set, this is automatically activated for all tasks.
300
301 However, the automatic value can be overwritten by manually entering a value, e.\,g. if a task does not onldy consist of subtasks.
302
303 There is currently no automatic check that the sum of the subtasks matches the total.
304
305 There is another internal variant of the macro \code{\tbs{}creditformat} to allow a distinction between summed values
306 and manually set values.
307
308 \begin{verbatim}
309 \newcommand*{\creditformatsum}[1]{\creditformat{#1}}
310 \end{verbatim}
311
312 By default it is the same but could be overwritten like the following example:
313
314 \begin{verbatim}
315 \renewcommand*{\creditformatsum}[1]{\creditformat{Total: #1}}
316 \end{verbatim}
317 \end{subtask}
318
319 \begin{subtask}[points=3,title={Automatic grading tables}]
320 \cls{tudaexercise} also provides a list of all points with the option of referencing the task values.
321 As the structure of a grading table varies greatly depending on personal preferences, the macro is designed in a very
322 abstract way.
323
324 \begin{verbatim}
325 \mapPoints{<code to be executed for each task>}
326 \end{verbatim}
327
328 \code{\tbs{}mapPoints} iterates over all tasks and allows any code elements as arguments.
329 Within the code, \code{\#1} (Task Number) and \code{\#2} (associated point value) can be used.
330 Tasks with a value of zero are skipped by default.
331
332 For example:
333 \begin{verbatim}
334 \begin{tabular}{@{}lr@{}}
335 \toprule
336 \mapPoints{Task #1&#2 Points\\}
337 \midrule
338 Total&\getPointsTotal{} Points\\
339 \bottomrule
340 \end{tabular}
341 \end{verbatim}
342 creates the following output:\\
343 \begin{tabular}{@{}lr@{}}
344 \toprule
345 \mapPoints{Task #1&#2 Points\\}
346 \midrule
347 Total&\getPointsTotal{} Points\\
348 \bottomrule
349 \end{tabular}
350
351 \end{subtask}
352
353 \begin{subtask}[points=5,title={Detailed grading tables including subtasks}]
354 With version 4.00 there is also the option using \verb+\mapPoints*+.
355 This variant also iterates over subtasks.
356 In addition, the mechanism has been expanded to include a more general variant.
357 This can be used to interact with all tasks.
358 The documentation will be extended!
359 \end{subtask}
360 \end{task}
361
362 \begin{task*}{Uniform syntax for task/subtask}
363 \label{task-subtask-syntax}
364 By default, TUDaExercise distinguishes between task and subtask. This is due to the fact that subtask does
365 not require a title to be specified.
366
367 The need for a uniform syntax was expressed (see \url{https://github.com/tudace/tuda_latex_templates/issues/189}).
368
369 \begin{subtask*}{Starred variants of the task/subtaks environments}
370 The task* and subtask* variants implemented with version 3.0 make this possible:
371
372 \begin{verbatim}
373 \begin{task*}{Task heading}
374 \begin{subtask*}{subtask heading}
375 Description
376 \end{subtask*}
377 \end{task*}
378 \end{verbatim}
379 \end{subtask*}
380
381 \begin{subtask*}{Swapping both variants}
382 The class option \code{match-task-subtask-syntax} allows subtask and subtask* to be swapped. The task* and task environments are identical anyway.
383 \end{subtask*}
384 \end{task*}
385
386
387 \end{document}
388 %% End of file `DEMO-TUDaExercise.tex'.