| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 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 |
% ============================================================================ |
| 27 |
% |
| 28 |
% \fi |
| 29 |
% |
| 30 |
% \iffalse% no documentation on this |
| 31 |
% \iffalse^^A Preparation for real docstrip documentation |
| 32 |
%<*driver> |
| 33 |
\ProvidesFile{tudaexercise.dtx}[2025-11-13 v4.05 Exercise sheets and exams using TU Darmstadt's Corporate Desing (TUDa-CI)] |
| 34 |
\typeout{***********************************************************} |
| 35 |
\typeout{No documentation included in this file! Please see tuda-ci.pdf for more information and DEMO-TUDaExercise.tex/.pdf for an example of use.} |
| 36 |
\typeout{***********************************************************} |
| 37 |
\stop |
| 38 |
%</driver> |
| 39 |
%<*class&initialization> |
| 40 |
%<@@=ptxcd> |
| 41 |
\NeedsTeXFormat{LaTeX2e}[2020/10/01] |
| 42 |
\ProvidesExplClass{tudaexercise}{2025-11-13}{4.05}{Exercise sheets and exams using TU Darmstadt's Corporate Desing (TUDa-CI)} |
| 43 |
%</class&initialization> |
| 44 |
%<*driver>^^A Preparation for real docstrip documentation |
| 45 |
\providecommand*{\TUDaDocDTXfiles}{tudaexercise.dtx} |
| 46 |
\input{tuda-ci.dtx} |
| 47 |
%</driver> |
| 48 |
% \fi |
| 49 |
% |
| 50 |
% \changes{v4.00}{2025-01-26}{Converted to DTX file} |
| 51 |
% |
| 52 |
% \DoNotIndex{\newcommand,\newenvironment} |
| 53 |
% |
| 54 |
% |
| 55 |
% \maketitle |
| 56 |
% |
| 57 |
% |
| 58 |
% |
| 59 |
% \DescribeEnv{solution} |
| 60 |
% |
| 61 |
% |
| 62 |
% \DescribeMacro{\sectionlinesformat} |
| 63 |
% |
| 64 |
% |
| 65 |
% \DescribeMacro{\institution} |
| 66 |
% |
| 67 |
% |
| 68 |
% \DescribeMacro{\titlepagestyle} |
| 69 |
% |
| 70 |
% |
| 71 |
% \DescribeMacro{\titleimage} |
| 72 |
% |
| 73 |
% |
| 74 |
% \DescribeMacro{\author} |
| 75 |
% |
| 76 |
% |
| 77 |
% \DescribeMacro{\title} |
| 78 |
% |
| 79 |
% |
| 80 |
% \DescribeMacro{\sheetnumber} |
| 81 |
% |
| 82 |
% |
| 83 |
% \DescribeMacro{\term} |
| 84 |
% |
| 85 |
% |
| 86 |
% \DescribeMacro{\sheetsep} |
| 87 |
% |
| 88 |
% |
| 89 |
% \DescribeMacro{\tasksep} |
| 90 |
% |
| 91 |
% |
| 92 |
% \DescribeMacro{\solutionsep} |
| 93 |
% |
| 94 |
% |
| 95 |
% \DescribeMacro{\StudentNamesep} |
| 96 |
% |
| 97 |
% |
| 98 |
% \DescribeMacro{\StudentIDname} |
| 99 |
% |
| 100 |
% |
| 101 |
% \DescribeMacro{\StudentIDsep} |
| 102 |
% |
| 103 |
% |
| 104 |
% \DescribeMacro{\creditformat} |
| 105 |
% |
| 106 |
% |
| 107 |
% \DescribeMacro{\creditformatsum} |
| 108 |
% |
| 109 |
% |
| 110 |
% \DescribeMacro{\pointformat} |
| 111 |
% |
| 112 |
% |
| 113 |
% \DescribeMacro{\PointsName} |
| 114 |
% |
| 115 |
% |
| 116 |
% \DescribeMacro{\thetask} |
| 117 |
% |
| 118 |
% |
| 119 |
% \DescribeMacro{\taskformat} |
| 120 |
% |
| 121 |
% |
| 122 |
% \DescribeEnv{task} |
| 123 |
% |
| 124 |
% |
| 125 |
% \DescribeMacro{\thesubtask} |
| 126 |
% |
| 127 |
% |
| 128 |
% \DescribeMacro{\subtaskformat} |
| 129 |
% |
| 130 |
% |
| 131 |
% \DescribeEnv{subtask} |
| 132 |
% |
| 133 |
% |
| 134 |
% \MaybeStop{} |
| 135 |
% |
| 136 |
% \section{Implementation} |
| 137 |
% |
| 138 |
% \iffalse |
| 139 |
%<*initialization> |
| 140 |
% \fi |
| 141 |
% |
| 142 |
% \begin{macrocode} |
| 143 |
\msg_new:nnnn {tudaexercise} {outdated-koma-script} { |
| 144 |
Your~KOMA-Script~is~outdated.\\ |
| 145 |
To~use~the~feature~'#1'~you~will~be~required~to~update. |
| 146 |
} { |
| 147 |
Please~do~not~use~this~feature~or~update~your~TeX~distribution.\\ |
| 148 |
The~feature~requires~KOMA-Script~v#2~or~newer. |
| 149 |
} |
| 150 |
\str_const:Nn \c_@@_base_str {exercise} |
| 151 |
\prop_new:N \g_ptxcd_clsopts_prop |
| 152 |
\prop_new:N \g_ptxcd_unknown_clsopts_prop |
| 153 |
\prop_gput:Nnn \g_ptxcd_clsopts_prop {captions} {nooneline} |
| 154 |
\prop_gput:Nnn \g_ptxcd_clsopts_prop {parskip} {half-} |
| 155 |
\prop_new:N \g_@@_points_collector_prop |
| 156 |
\prop_new:N \g_@@_subtask_points_collector_prop |
| 157 |
\prop_new:N \g_@@_property_collector_prop |
| 158 |
\bool_new:N \l_@@_points_auto_bool |
| 159 |
\bool_new:N \g_@@_points_bool |
| 160 |
\prop_new:N \g_@@_loaded_points_prop |
| 161 |
\fp_new:N \g_@@_points_total_fp |
| 162 |
\int_new:N \g_ptxcd_paper_int |
| 163 |
\bool_new:N \g_ptxcd_geometry_bool |
| 164 |
\bool_new:N \g_ptxcd_custommargins_bool |
| 165 |
\bool_new:N \l_@@_solution_bool |
| 166 |
\bool_new:N \g_ptxcd_smalltitle_bool |
| 167 |
\str_new:N \g_ptxcd_department_str |
| 168 |
\tl_new:N \g_ptxcd_tmp_tl |
| 169 |
\int_new:N \g_ptxcd_tmp_int |
| 170 |
\tl_new:N \l_ptxcd_tmp_tl |
| 171 |
\clist_map_inline:nn {section,subsection,subsubsection,task,subtask,@solution} { |
| 172 |
\bool_new:c {g_@@_ruled_#1_bool} |
| 173 |
\bool_gset_true:c {g_@@_ruled_#1_bool} |
| 174 |
} |
| 175 |
\bool_new:N \g_@@_runin_subtask_bool |
| 176 |
% \end{macrocode} |
| 177 |
% \begin{documentation} |
| 178 |
% \DescribeEnv{solution} |
| 179 |
% |
| 180 |
% \end{documentation} |
| 181 |
% \begin{environment}{solution} |
| 182 |
% \begin{macrocode} |
| 183 |
\newenvironment{solution}{}{} |
| 184 |
% \end{macrocode} |
| 185 |
% \end{environment} |
| 186 |
% \end{implementation} |
| 187 |
% |
| 188 |
% \begin{documentation} |
| 189 |
% \DescribeEnv{solution*} |
| 190 |
% |
| 191 |
% \end{documentation} |
| 192 |
% \begin{environment}{solution*} |
| 193 |
% \begin{macrocode} |
| 194 |
\newenvironment{solution*}{}{} |
| 195 |
% \end{macrocode} |
| 196 |
% \end{environment} |
| 197 |
% \end{implementation} |
| 198 |
% \changes{v4.00}{2025-01-26}{Remove obsolete use of environ} |
| 199 |
% \begin{macrocode} |
| 200 |
\cs_new:Nn \_@@_setup_solution: { |
| 201 |
\bool_if:NTF \l_@@_solution_bool { |
| 202 |
\def\solution{\_@@_solutionheader:} |
| 203 |
\def\endsolution{} |
| 204 |
\expandafter\def\csname solution*\endcsname{\ignorespaces} |
| 205 |
\expandafter\let\csname endsolution*\endcsname\endsolution |
| 206 |
}{ |
| 207 |
\RenewDocumentEnvironment{solution}{+b}{}{} |
| 208 |
\RenewDocumentEnvironment{solution*}{+b}{}{} |
| 209 |
} |
| 210 |
} |
| 211 |
\_@@_setup_solution: |
| 212 |
\prg_new_conditional:Nnn \_@@_if_solution: {T,F,TF} { |
| 213 |
\bool_if:NTF \l_@@_solution_bool |
| 214 |
{\prg_return_true:} |
| 215 |
{\prg_return_false:} |
| 216 |
} |
| 217 |
\let\IfSolutionT \_@@_if_solution:T |
| 218 |
\let\IfSolutionF \_@@_if_solution:F |
| 219 |
\let\IfSolutionTF \_@@_if_solution:TF |
| 220 |
% \end{macrocode} |
| 221 |
% Message Declaration for option processing |
| 222 |
% \begin{macrocode} |
| 223 |
\msg_new:nnn{tudaexercise} {titlepage-option-disabled} { |
| 224 |
You~set~the~titlepage~option~to~#1.\\ |
| 225 |
This option is not supported by tudaexercise.cls.\\ |
| 226 |
The~KOMA-Script~option~titlepage~is~forced~to~"false". |
| 227 |
} |
| 228 |
% \end{macrocode} |
| 229 |
% \changes{v4.00}{2025-01-26}{add bookmarksnumbered option and enable by default} |
| 230 |
% The options have to be passed before the package options to allow being changed by the user. |
| 231 |
% \begin{macrocode} |
| 232 |
\PassOptionsToPackage{pdfusetitle,bookmarksnumbered=true}{hyperref} |
| 233 |
\keys_define:nn {ptxcd/exercise} { |
| 234 |
% \end{macrocode} |
| 235 |
% |
| 236 |
% \begin{macrocode} |
| 237 |
bookmarksnumbered .code:n = \PassOptionsToPackage{bookmarksnumbered=#1}{hyperref}, |
| 238 |
compat .bool_gset:N = \g_@@_compatibility_bool, |
| 239 |
compat .initial:n = false, |
| 240 |
compatilibity .meta:n = {compat=#1}, |
| 241 |
compatibility .default:n = true, |
| 242 |
credit .tl_set:N = \l_@@_credit_tl, |
| 243 |
credit .initial:n =, |
| 244 |
headontitle .bool_gset:N = \g_ptxcd_headontitle_bool, |
| 245 |
headontitle .initial:n = false, |
| 246 |
headontitle .default:n =true, |
| 247 |
titlepage .code:n = {\msg_warning:nnn {tudapub} {titlepage-option-disabled} {#1}}, |
| 248 |
match-task-subtask-syntax .bool_gset:N = \g_ptxcd_match_task_subtask_bool, |
| 249 |
match-task-subtask-syntax .initial:n = false, |
| 250 |
match-task-subtask-syntax .default:n = true, |
| 251 |
solution .code:n = { |
| 252 |
\bool_set_eq:Nc \l_@@_solution_bool {c_#1_bool} |
| 253 |
\_@@_setup_solution: |
| 254 |
}, |
| 255 |
solution .default:n = true, |
| 256 |
unknown .code:n = {\prop_gput:NVn \g_ptxcd_unknown_clsopts_prop \l_keys_key_tl {#1}}, |
| 257 |
points .choice:, |
| 258 |
points / true .code:n = \bool_set_false:N \l_@@_points_auto_bool\bool_gset_true:N \g_@@_points_bool, |
| 259 |
points /false .code:n = \bool_set_false:N \l_@@_points_auto_bool\bool_gset_false:N \g_@@_points_bool, |
| 260 |
points / auto .code:n = \bool_set_true:N \l_@@_points_auto_bool\bool_gset_true:N \g_@@_points_bool, |
| 261 |
points .initial:n = false, |
| 262 |
subtask .choice:, |
| 263 |
subtask / ruled .code:n = |
| 264 |
\bool_gset_true:N \g_@@_ruled_subtask_bool |
| 265 |
\bool_gset_false:N \g_@@_runin_subtask_bool, |
| 266 |
subtask / runin .code:n = |
| 267 |
\bool_gset_false:N \g_@@_ruled_subtask_bool |
| 268 |
\bool_gset_true:N \g_@@_runin_subtask_bool, |
| 269 |
subtask / plain .code:n = |
| 270 |
\bool_gset_false:N \g_@@_ruled_subtask_bool |
| 271 |
\bool_gset_false:N \g_@@_runin_subtask_bool, |
| 272 |
%</initialization> |
| 273 |
% ^AA} |
| 274 |
%<*center> |
| 275 |
\ProcessKeyOptions[ptxcd/exercise] |
| 276 |
\prop_map_inline:Nn \g_ptxcd_clsopts_prop { |
| 277 |
\tl_if_empty:nTF {#2} |
| 278 |
{\PassOptionsToClass {#1} {scrartcl}} |
| 279 |
{ |
| 280 |
\clist_map_inline:nn {#2} {\PassOptionsToClass {#1=##1} {scrartcl}} |
| 281 |
} |
| 282 |
} |
| 283 |
\bool_new:N \l_@@_subtask_fallback_bool |
| 284 |
\fp_new:N \l_@@_task_points_fp |
| 285 |
\fp_new:N \g_@@_ex_collected_points_fp |
| 286 |
\tl_new:N \l_@@_task_credit_tl |
| 287 |
\keys_define:nn {ptxcd/task}{ |
| 288 |
points .choice:, |
| 289 |
points / auto .code:n = |
| 290 |
\bool_set_true:N \l_@@_points_auto_bool, |
| 291 |
points / unknown .code:n = \fp_set:Nn \l_@@_task_points_fp {#1} |
| 292 |
\bool_set_false:N \l_@@_points_auto_bool, |
| 293 |
credit .code:n = \tl_set:Nn \l_@@_task_credit_tl {#1} |
| 294 |
\bool_set_false:N \l_@@_points_auto_bool, |
| 295 |
solution .meta:nn ={ptxcd/exercise}{solution=#1}, |
| 296 |
} |
| 297 |
\fp_new:N \l_@@_subtask_points_fp |
| 298 |
\keys_define:nn {ptxcd/subtask} { |
| 299 |
credit .tl_set:N = \l_@@_subtask_credit_tl, |
| 300 |
credit .initial:n =, |
| 301 |
points .code:n = \fp_set:Nn \l_@@_subtask_points_fp {#1} |
| 302 |
\bool_set_false:N \l_@@_points_auto_bool, |
| 303 |
title .tl_set:N = \l_@@_title_tl, |
| 304 |
title .initial:n =, |
| 305 |
unknown .code:n = { |
| 306 |
\bool_set_true:N \l_@@_subtask_fallback_bool |
| 307 |
\tl_clear:N \l_@@_subtask_credit_tl |
| 308 |
\fp_zero:N \l_@@_subtask_points_fp |
| 309 |
}, |
| 310 |
} |
| 311 |
\keys_define:nn {ptxcd/exercise/headline} { |
| 312 |
headline .code:n = { |
| 313 |
\if@twoside |
| 314 |
\keys_set:nn {ptxcd/exercise/headline} {odd=#1,even=#1} |
| 315 |
\else |
| 316 |
\keys_set:nn {ptxcd/exercise/headline} {oneside=#1} |
| 317 |
\fi |
| 318 |
}, |
| 319 |
} |
| 320 |
\clist_map_inline:nn {odd, even, oneside} { |
| 321 |
\tl_new:c {g_@@_headline_#1_tl} |
| 322 |
\box_new:c {g_@@_headline_#1_box} |
| 323 |
\keys_define:nn {ptxcd/exercise/headline} { |
| 324 |
#1 .choice:, |
| 325 |
#1 / title-name-id .meta:n = { |
| 326 |
#1 = { |
| 327 |
\g_ptxcd_shorttitle_tl\par |
| 328 |
\StudentName\StudentID |
| 329 |
} |
| 330 |
}, |
| 331 |
#1 / title-name .meta:n = { |
| 332 |
#1 = { |
| 333 |
\g_ptxcd_shorttitle_tl\par |
| 334 |
\smallskip |
| 335 |
\StudentName |
| 336 |
} |
| 337 |
}, |
| 338 |
#1 / title .meta:n = {#1 = {\g_ptxcd_shorttitle_tl}}, |
| 339 |
#1 / name-id .meta:n = {#1 = {\StudentName\StudentID}}, |
| 340 |
#1 / name .meta:n = {#1 = {\StudentName}}, |
| 341 |
#1 / unknown .code:n = \tl_gset:cn {g_@@_headline_#1_tl} {##1} |
| 342 |
} |
| 343 |
} |
| 344 |
% \end{macrocode} |
| 345 |
% Load tudasize clo file if available |
| 346 |
% \begin{macrocode} |
| 347 |
\file_if_exist:nT {tudasize\prop_item:Nn \g_ptxcd_clsopts_prop {fontsize}.clo} |
| 348 |
{\providecommand*{\@fontsizefilebase}{tudasize}} |
| 349 |
\LoadClass{scrartcl} |
| 350 |
\bool_if:NT \g_@@_points_bool { |
| 351 |
\cs_if_exist:NF \AddtoDoHook{ |
| 352 |
\msg_error:nnnn {tudaexercise} {outdated-koma-script} {points=true/auto} {3.27} |
| 353 |
\keys_set:nn {ptxcd/exercise} {points=false} |
| 354 |
} |
| 355 |
} |
| 356 |
\RequirePackage{tudarules} |
| 357 |
% \end{macrocode} |
| 358 |
% Has to be loaded here due to headwidth options |
| 359 |
% \begin{macrocode} |
| 360 |
\RequirePackage[draft=false]{scrlayer-scrpage} |
| 361 |
\KOMAoptions {twoside = false} |
| 362 |
\prop_map_inline:Nn \g_ptxcd_unknown_clsopts_prop { |
| 363 |
\cs_if_exist:cT {[email protected]@#1} { |
| 364 |
\tl_if_empty:nTF {#2} |
| 365 |
{\KOMAoptions{#1}} |
| 366 |
{\KOMAoption{#1}{#2} |
| 367 |
} |
| 368 |
} |
| 369 |
} |
| 370 |
% \end{macrocode} |
| 371 |
% \begin{implementation} |
| 372 |
% \begin{macro}{\sectionlinesformat} |
| 373 |
% \begin{macrocode} |
| 374 |
\renewcommand*\sectionlinesformat[4]{% |
| 375 |
\parbox{\linewidth}{ |
| 376 |
\bool_if:cT {g_@@_ruled_#1_bool} { |
| 377 |
\rule[5\g_ptxcd_titlerule_dim]{\linewidth}{\g_ptxcd_titlerule_dim}\par\nointerlineskip |
| 378 |
} |
| 379 |
\@hangfrom{% |
| 380 |
\hskip #2#3}{ |
| 381 |
\tl_if_eq:nnT {#1} {task} { |
| 382 |
\exp_args:No \tl_if_empty:nF {#4} |
| 383 |
{:~} |
| 384 |
\bool_if:NT \l_@@_points_auto_bool { |
| 385 |
\exp_args:NNx \prop_get:NnN \g_@@_loaded_points_prop {\thetask} \l_ptxcd_tmp_tl |
| 386 |
\quark_if_no_value:NF \l_ptxcd_tmp_tl { |
| 387 |
\fp_set:Nn \l_@@_task_points_fp {\l_ptxcd_tmp_tl} |
| 388 |
} |
| 389 |
} |
| 390 |
} |
| 391 |
#4 |
| 392 |
\tl_if_in:nnT {#1} {task} { |
| 393 |
\tl_if_empty:cTF{l_@@_#1_credit_tl} |
| 394 |
{\pointformat{\fp_to_decimal:c {l_@@_#1_points_fp}}} |
| 395 |
{\creditformat{\tl_use:c {l_@@_#1_credit_tl}}} |
| 396 |
} |
| 397 |
\rule[-\dp\strutbox]{0pt}{\dp\strutbox}\par}\nointerlineskip |
| 398 |
\skip_vertical:n {\ptxcd_titlerule_sep: -\dp\strutbox} |
| 399 |
\bool_if:cT {g_@@_ruled_#1_bool} |
| 400 |
{\smash{\rule{\linewidth}{\g_ptxcd_titlerule_dim}}} |
| 401 |
} |
| 402 |
} |
| 403 |
\RequirePackage{tudafonts} |
| 404 |
% \end{macrocode} |
| 405 |
% \iffalse |
| 406 |
%</center> |
| 407 |
%<*body> |
| 408 |
% \fi |
| 409 |
% \end{macro} |
| 410 |
% \end{implementation} |
| 411 |
% |
| 412 |
% \begin{documentation} |
| 413 |
% \DescribeMacro{\institution} |
| 414 |
% |
| 415 |
%^^A TODO Rename and deprecate variable names |
| 416 |
% \end{documentation} |
| 417 |
% \begin{implementation} |
| 418 |
% \begin{macro}{\institution} |
| 419 |
% \begin{macrocode} |
| 420 |
\newcommand*{\institution}[1]{ |
| 421 |
\def\ptxcd_institution{#1} |
| 422 |
} |
| 423 |
% \end{macrocode} |
| 424 |
% \end{macro} |
| 425 |
% \end{implementation} |
| 426 |
% |
| 427 |
% \begin{documentation} |
| 428 |
% \DescribeMacro{\ptxcd_datename} |
| 429 |
% |
| 430 |
% \end{documentation} |
| 431 |
% \begin{implementation} |
| 432 |
% \begin{macro}{\ptxcd_datename} |
| 433 |
% \begin{macrocode} |
| 434 |
\gdef\ptxcd_datename{Datum} |
| 435 |
% \end{macrocode} |
| 436 |
% \end{macro} |
| 437 |
% \end{implementation} |
| 438 |
% |
| 439 |
% \begin{documentation} |
| 440 |
% \DescribeMacro{\ptxcd_dateseparator} |
| 441 |
% |
| 442 |
% \end{documentation} |
| 443 |
% \begin{implementation} |
| 444 |
% \begin{macro}{\ptxcd_dateseparator} |
| 445 |
% \begin{macrocode} |
| 446 |
\gdef\ptxcd_dateseparator{:~} |
| 447 |
% \end{macrocode} |
| 448 |
% \end{macro} |
| 449 |
% \end{implementation} |
| 450 |
% |
| 451 |
% \begin{macrocode} |
| 452 |
\setkomafont{disposition}{\sffamily\bfseries} |
| 453 |
\cs_new:Nn \ptxcd_titlerule_sep: {\the\dp\strutbox} |
| 454 |
\RequirePackage{tudacolors} |
| 455 |
\setkomafont{pageheadfoot}{\sffamily\small} |
| 456 |
\setkomafont{pagenumber}{} |
| 457 |
\addtokomafont{captionlabel}{\sffamily} |
| 458 |
\addtokomafont{caption}{\sffamily} |
| 459 |
\cs_new:Nn \_@@_preamble_ConfigureHeadline:n { |
| 460 |
\tl_if_empty:nF {#1} {\keys_set:nn {ptxcd/exercise/headline} {#1}} |
| 461 |
} |
| 462 |
\cs_new:Nn \ptxcd_ConfigureHeadline:n { |
| 463 |
\_@@_preamble_ConfigureHeadline:n {#1} |
| 464 |
\ptxcd_update_headline_boxes: |
| 465 |
\_@@_adjust_headheight: |
| 466 |
} |
| 467 |
\NewDocumentCommand{\ConfigureHeadline}{m}{\_@@_preamble_ConfigureHeadline:n {#1}} |
| 468 |
\bool_if:NT \g_@@_compatibility_bool { |
| 469 |
\cs_new:Npn \_@@_env_to_tl_aux:w #1 \q_stop { \tl_gset:Nn \g_@@_headline_oneside_tl {#1} } |
| 470 |
\NewDocumentEnvironment{examheader}{+b}{}{ |
| 471 |
\tl_gset:Nn \g_@@_headline_oneside_tl {#1} |
| 472 |
\tl_gset:Nn \g_@@_headline_odd_tl {#1} |
| 473 |
\tl_gset:Nn \g_@@_headline_even_tl {#1} |
| 474 |
\ptxcd_ConfigureHeadline:n {} |
| 475 |
} |
| 476 |
\newcommand*{\examheaderdefault}{\par\StudentName\StudentID} |
| 477 |
} |
| 478 |
\cs_new:Nn \ptxcd_update_headline_boxes: { |
| 479 |
\clist_map_inline:nn {even, odd, oneside} |
| 480 |
{ |
| 481 |
\tl_if_empty:cF {g_@@_headline_##1_tl} { |
| 482 |
\vbox_gset:cn {g_@@_headline_##1_box} { |
| 483 |
\begin{minipage}[b]{\textwidth} |
| 484 |
\usekomafont{pagehead} |
| 485 |
\raggedright |
| 486 |
\leavevmode\rule{\z@}{\dimexpr\ht\strutbox+\c_ptxcd_rulesep_dim} |
| 487 |
\ignorespaces |
| 488 |
\use:c {g_@@_headline_##1_tl}\ignorespaces\strut |
| 489 |
\par\vspace{\z@} |
| 490 |
\end{minipage} |
| 491 |
} |
| 492 |
} |
| 493 |
} |
| 494 |
} |
| 495 |
\cs_new:Nn \_@@_adjust_headheight: { |
| 496 |
\if@twoside |
| 497 |
\dim_set:Nn \l_tmpa_dim { |
| 498 |
\dim_max:nn |
| 499 |
{\box_ht:N \g_@@_headline_odd_box+\box_dp:N \g_@@_headline_odd_box} |
| 500 |
{\box_ht:N \g_@@_headline_even_box+\box_dp:N \g_@@_headline_even_box} |
| 501 |
} |
| 502 |
\else |
| 503 |
\dim_set:Nn \l_tmpa_dim { |
| 504 |
\box_ht:N \g_@@_headline_oneside_box |
| 505 |
+ \box_dp:N \g_@@_headline_oneside_box |
| 506 |
} |
| 507 |
\fi |
| 508 |
\dim_compare:nT {\l_tmpa_dim > \z@} |
| 509 |
{ |
| 510 |
\dim_add:Nn \l_tmpa_dim {\box_dp:N \ptxcd_headrule_box +\c_ptxcd_rulesep_dim} |
| 511 |
\KOMAoptions{headinclude, headheight=\l_tmpa_dim,headsepline = .5\c_ptxcd_smallrule_dim} |
| 512 |
\if@twoside |
| 513 |
\cehead{\box_use:c {g_@@_headline_even_box}} |
| 514 |
\cohead{\box_use:c {g_@@_headline_odd_box}} |
| 515 |
\else |
| 516 |
\chead{\box_use:c {g_@@_headline_oneside_box}} |
| 517 |
\fi |
| 518 |
\global\setlength{\headheight}{\l_tmpa_dim} |
| 519 |
} |
| 520 |
} |
| 521 |
\newpairofpagestyles{TUDa.exercise}{ |
| 522 |
\KOMAoptions{plainfootsepline,headtopline,plainheadtopline} |
| 523 |
\KOMAoptions { |
| 524 |
headwidth=text, |
| 525 |
footwidth=text |
| 526 |
} |
| 527 |
\setkomafont{pagehead}{} |
| 528 |
\box_if_exist:NF \ptxcd_headrule_box { |
| 529 |
\ptxcd_makeheadrule[color=identbarcolor, width=\sls@headwidth]{ptxcd_headrule} |
| 530 |
} |
| 531 |
\ModifyLayer[ |
| 532 |
background, |
| 533 |
height=\box_dp:N \ptxcd_headrule_box, |
| 534 |
align=tl, |
| 535 |
voffset=\g_ptxcd_topMargin_dim, |
| 536 |
contents=\raisebox{\depth}{\box_use:N \ptxcd_headrule_box}, |
| 537 |
]{plain.TUDa.exercise.head.above.line} |
| 538 |
\ModifyLayer[ |
| 539 |
background, |
| 540 |
height=\box_dp:N \ptxcd_headrule_box, |
| 541 |
align=tl, |
| 542 |
voffset=\g_ptxcd_topMargin_dim, |
| 543 |
contents=\raisebox{\depth}{\box_use:N \ptxcd_headrule_box}, |
| 544 |
]{TUDa.exercise.head.above.line} |
| 545 |
\ofoot[\pagemark]{\pagemark} |
| 546 |
\ModifyLayer[addvoffset=\c_ptxcd_rulesep_dim]{TUDa.exercise.foot.even} |
| 547 |
\ModifyLayer[addvoffset=\c_ptxcd_rulesep_dim]{TUDa.exercise.foot.odd} |
| 548 |
\ModifyLayer[addvoffset=\c_ptxcd_rulesep_dim]{TUDa.exercise.foot.oneside} |
| 549 |
\ModifyLayer[addvoffset=\c_ptxcd_rulesep_dim]{plain.TUDa.exercise.foot.even} |
| 550 |
\ModifyLayer[addvoffset=\c_ptxcd_rulesep_dim]{plain.TUDa.exercise.foot.odd} |
| 551 |
\ModifyLayer[addvoffset=\c_ptxcd_rulesep_dim]{plain.TUDa.exercise.foot.oneside} |
| 552 |
} |
| 553 |
\DeclarePageStyleAlias{TUDa}{TUDa.exercise} |
| 554 |
\DeclarePageStyleAlias{plain.TUDa}{plain.TUDa.exercise} |
| 555 |
% \end{macrocode} |
| 556 |
% \begin{implementation} |
| 557 |
% \begin{macrocode} |
| 558 |
\renewcommand{\titlepagestyle}{plain.TUDa} |
| 559 |
\pagestyle{TUDa} |
| 560 |
% \end{macrocode} |
| 561 |
% |
| 562 |
% \begin{macrocode} |
| 563 |
\seq_new:N \g_ptxcd_author_seq |
| 564 |
% \end{macrocode} |
| 565 |
% \begin{documentation} |
| 566 |
% \DescribeMacro{\author} |
| 567 |
% |
| 568 |
% \end{documentation} |
| 569 |
% \begin{implementation} |
| 570 |
% \begin{macro}{\author} |
| 571 |
% \begin{macrocode} |
| 572 |
\renewcommand*\author[1]{ |
| 573 |
\seq_gset_split:Nnn \g_ptxcd_author_seq {\and} {#1} |
| 574 |
} |
| 575 |
% \end{macrocode} |
| 576 |
% \end{macro} |
| 577 |
% \end{implementation} |
| 578 |
% |
| 579 |
% \begin{macrocode} |
| 580 |
\msg_new:nnn{tudapub} {unknown-language} { |
| 581 |
You~selected~an~unknown~language~#1.\\ |
| 582 |
The~Variable~#2~does~not~have~a~predefined~value.\\ |
| 583 |
Ensure~to~redefine~#2~to~match~your~language.\\ |
| 584 |
Otherwise~the~ngerman~vaue~#3~will~be~used. |
| 585 |
} |
| 586 |
\cs_new:Nn \ptxcd_define_captionFallback:Nn { |
| 587 |
\providecommand*#1{ |
| 588 |
\msg_warning:nnxxx{tudapub} {unknown-language} |
| 589 |
{\languagename} {\exp_not:N #1} {#2} |
| 590 |
\def#1{#2} |
| 591 |
} |
| 592 |
} |
| 593 |
\cs_new:Nn \ptxcd_declare_caption:Nnnn { |
| 594 |
\ptxcd_define_captionFallback:Nn #1 {#2} |
| 595 |
\defcaptionname{ngerman, german}{#1}{#2} |
| 596 |
\defcaptionname{english, USenglish, american}{#1}{#3} |
| 597 |
\defcaptionname{UKenglish, british}{#1}{#4} |
| 598 |
} |
| 599 |
\cs_new:Nn \ptxcd_declare_caption:Nnn { |
| 600 |
\ptxcd_declare_caption:Nnnn #1 {#2} {#3} {#3} |
| 601 |
} |
| 602 |
\ptxcd_declare_caption:Nnn \authorandname {und} {and} |
| 603 |
% \end{macrocode} |
| 604 |
% \begin{documentation} |
| 605 |
% \DescribeMacro{\@author} |
| 606 |
% |
| 607 |
% \end{documentation} |
| 608 |
% \begin{implementation} |
| 609 |
% \begin{macro}{\@author} |
| 610 |
% \begin{macrocode} |
| 611 |
\renewcommand*{\@author}{ |
| 612 |
\seq_use:Nnnn \g_ptxcd_author_seq {~\authorandname{}~} {,~} {~\&~} |
| 613 |
} |
| 614 |
\tl_new:N \g_ptxcd_shorttitle_tl |
| 615 |
% \end{macrocode} |
| 616 |
% \end{macro} |
| 617 |
% \end{implementation} |
| 618 |
% |
| 619 |
% \begin{documentation} |
| 620 |
% \DescribeMacro{\title} |
| 621 |
% |
| 622 |
% \end{documentation} |
| 623 |
% \begin{implementation} |
| 624 |
% \begin{macro}{\title} |
| 625 |
% \begin{macrocode} |
| 626 |
\RenewDocumentCommand{\title}{om}{ |
| 627 |
\IfNoValueTF{#1}{ |
| 628 |
\tl_gset:Nn \g_ptxcd_shorttitle_tl {#2} |
| 629 |
}{ |
| 630 |
\tl_gset:Nn \g_ptxcd_shorttitle_tl {#1} |
| 631 |
} |
| 632 |
\def\@title{#2} |
| 633 |
} |
| 634 |
% \end{macrocode} |
| 635 |
% \end{macro} |
| 636 |
% \end{implementation} |
| 637 |
% |
| 638 |
% Define \subsubtitle for compatibility |
| 639 |
% \begin{macrocode} |
| 640 |
\newcommand*{\subsubtitle}[1]{ |
| 641 |
\def\@subsubtitle{#1} |
| 642 |
} |
| 643 |
\subsubtitle{} |
| 644 |
% \end{macrocode} |
| 645 |
% \begin{documentation} |
| 646 |
% \DescribeMacro{\ptxcd_title@footnote} |
| 647 |
% |
| 648 |
% \end{documentation} |
| 649 |
% \begin{implementation} |
| 650 |
% \begin{macro}{\ptxcd_title@footnote} |
| 651 |
% \begin{macrocode} |
| 652 |
\newcommand*{\ptxcd_title@footnote}[2][1]{ |
| 653 |
\textsuperscript{\@fnsymbol{#1}}#2 |
| 654 |
} |
| 655 |
% \end{macrocode} |
| 656 |
% \end{macro} |
| 657 |
% \end{implementation} |
| 658 |
% |
| 659 |
% \begin{documentation} |
| 660 |
% \DescribeMacro{\@maketitle} |
| 661 |
% |
| 662 |
% \end{documentation} |
| 663 |
% \begin{implementation} |
| 664 |
% \begin{macro}{\@maketitle} |
| 665 |
% \begin{macrocode} |
| 666 |
\renewcommand*{\@maketitle}{% |
| 667 |
\global\@topnum=\z@ |
| 668 |
\setparsizes{\z@}{\z@}{\z@\@plus 1fil}\par@updaterelative |
| 669 |
\vspace*{-\dim_eval:n { |
| 670 |
\headheight |
| 671 |
-\c_ptxcd_largerule_dim -\c_ptxcd_rulesep_dim |
| 672 |
+\headsep |
| 673 |
+\ht\strutbox |
| 674 |
+\p@ |
| 675 |
}} |
| 676 |
\par |
| 677 |
\nointerlineskip |
| 678 |
\begingroup |
| 679 |
\setlength{\fboxsep}{\z@} |
| 680 |
\bool_if:NT \g_ptxcd_colorback_bool {\colorbox{accentcolor}}{\parbox[t]{\linewidth}{ |
| 681 |
\rule{0pt}{\bool_if:NTF \g_ptxcd_smalltitle_bool {.25} {.5}\c_ptxcd_logoheight_dim} |
| 682 |
\par\nointerlineskip |
| 683 |
\raisebox{-\height}{% |
| 684 |
\begin{minipage}[t]{\dimexpr\linewidth-\_@@_logowidth:-1ex} |
| 685 |
\bool_if:NT \g_ptxcd_colorback_bool {\begin{addmargin}{3mm}} |
| 686 |
\raggedright |
| 687 |
\bool_if:NT \g_ptxcd_colorback_bool {\color{textonaccentcolor}} |
| 688 |
\tl_if_empty:NF \@titlehead {\usekomafont{titlehead}{\@titlehead\par}} |
| 689 |
\leavevmode\usekomafont{title}% |
| 690 |
{\usekomafont{title}\bool_if:NTF \g_ptxcd_smalltitle_bool {\LARGE} {\huge} {\@title\par}}% |
| 691 |
\vskip 1em |
| 692 |
\bool_if:NF \g_@@_compatibility_bool |
| 693 |
{ |
| 694 |
{\ifx\@subtitle\@empty\else\usekomafont{subtitle}\@subtitle\par\fi}% |
| 695 |
\gdef\@subtitle{} |
| 696 |
\vskip .5em |
| 697 |
} |
| 698 |
{ |
| 699 |
\xdef\@author {\@author} |
| 700 |
\ifx\@author\@empty\else\usekomafont{author}\@author\par\fi |
| 701 |
} |
| 702 |
\vskip .5em |
| 703 |
\bool_if:NTF \g_ptxcd_colorback_bool {\end{addmargin}} {\par} |
| 704 |
\end{minipage}} |
| 705 |
\tl_if_empty:NF \g_ptxcd_logofile_tl { |
| 706 |
\hfill\raisebox{\dim_eval:n { |
| 707 |
\bool_if:NTF \g_ptxcd_colorback_bool |
| 708 |
{-\height} |
| 709 |
{-.9\c_ptxcd_logoheight_dim} |
| 710 |
}} |
| 711 |
[0pt] |
| 712 |
[\dim_eval:n { |
| 713 |
\bool_if:NTF \g_ptxcd_smalltitle_bool |
| 714 |
{\bool_if:NTF \g_ptxcd_colorback_bool {1.15}{1}} |
| 715 |
{\bool_if:NTF \g_ptxcd_colorback_bool {1.5}{1.3} |
| 716 |
}\c_ptxcd_logoheight_dim}] |
| 717 |
{\makebox[\_@@_logowidth:][l]{\_@@_insert_logo:}} |
| 718 |
} |
| 719 |
\par\medskip |
| 720 |
}} |
| 721 |
\par |
| 722 |
\nointerlineskip |
| 723 |
\rule{\linewidth}{\g_ptxcd_titlerule_dim} |
| 724 |
% \end{macrocode} |
| 725 |
% subtitle fields if not compat |
| 726 |
% \begin{macrocode} |
| 727 |
\exp_args:Nf \tl_if_empty:nF {\g_ptxcd_ex_sheetnum_tl\@date\g_ptxcd_ex_term_tl\use:c {@subsubtitle}\@subtitle}{ |
| 728 |
\par\nointerlineskip |
| 729 |
\bool_if:NT \g_ptxcd_colorback_bool {\colorbox{accentcolor}}{ |
| 730 |
\parbox{\linewidth}{ |
| 731 |
\begin{minipage}{\linewidth} |
| 732 |
\bool_if:NT \g_ptxcd_colorback_bool { |
| 733 |
\color{textonaccentcolor} |
| 734 |
\begin{addmargin}{3mm} |
| 735 |
} |
| 736 |
\null\par |
| 737 |
\def\ptxcd_nextsep{} |
| 738 |
\clist_map_inline:nn {@subtitle, @subsubtitle, g_ptxcd_ex_term_tl, @date} { |
| 739 |
\tl_if_empty:cF {##1} {\ptxcd_nextsep\use:c {##1}\def\ptxcd_nextsep{\\}} |
| 740 |
} |
| 741 |
\tl_if_empty:NF \g_ptxcd_ex_sheetnum_tl {\ptxcd_nextsep\sheetname\sheetsep\g_ptxcd_ex_sheetnum_tl} |
| 742 |
\bool_if:NT \g_ptxcd_colorback_bool {\end{addmargin}} |
| 743 |
\end{minipage} |
| 744 |
\vspace*{\dp\strutbox} |
| 745 |
}}\par\nointerlineskip |
| 746 |
\rule{\linewidth}{\g_ptxcd_titlerule_dim} |
| 747 |
} |
| 748 |
\par |
| 749 |
\bool_if:NT \g_ptxcd_headontitle_bool { |
| 750 |
\if@twoside |
| 751 |
\box_use:N \g_@@_headline_odd_box |
| 752 |
\else |
| 753 |
\box_use:N \g_@@_headline_oneside_box |
| 754 |
\fi |
| 755 |
\par |
| 756 |
\rule{\linewidth}{\g_ptxcd_titlerule_dim} |
| 757 |
\par |
| 758 |
} |
| 759 |
\endgroup |
| 760 |
\vskip 2em |
| 761 |
\ConfigureHeadline{} |
| 762 |
}% |
| 763 |
\setkomafont{subtitle}{\bfseries} |
| 764 |
\setkomafont{author}{} |
| 765 |
\setkomafont{date}{} |
| 766 |
\newkomafont{sheetnumber}{\usekomafont{date}} |
| 767 |
\newkomafont{term}{\usekomafont{date}} |
| 768 |
\date{} |
| 769 |
\tl_new:N \g_ptxcd_ex_sheetnum_tl |
| 770 |
% \end{macrocode} |
| 771 |
% \end{macro} |
| 772 |
% \end{implementation} |
| 773 |
% |
| 774 |
% \begin{documentation} |
| 775 |
% \DescribeMacro{\sheetnumber} |
| 776 |
% |
| 777 |
% \end{documentation} |
| 778 |
% \begin{implementation} |
| 779 |
% \begin{macro}{\sheetnumber} |
| 780 |
% \begin{macrocode} |
| 781 |
\newcommand*{\sheetnumber}[1]{\tl_gset:Nn \g_ptxcd_ex_sheetnum_tl {#1}} |
| 782 |
% \end{macrocode} |
| 783 |
% \end{macro} |
| 784 |
% \end{implementation} |
| 785 |
% |
| 786 |
% \begin{macrocode} |
| 787 |
\sheetnumber{} |
| 788 |
\tl_new:N \g_ptxcd_ex_term_tl |
| 789 |
% \end{macrocode} |
| 790 |
% \begin{documentation} |
| 791 |
% \DescribeMacro{\term} |
| 792 |
% |
| 793 |
% \end{documentation} |
| 794 |
% \begin{implementation} |
| 795 |
% \begin{macro}{\term} |
| 796 |
% \begin{macrocode} |
| 797 |
\newcommand*{\term}[1]{\tl_gset:Nn \g_ptxcd_ex_term_tl {#1}} |
| 798 |
% \end{macrocode} |
| 799 |
% \end{macro} |
| 800 |
% \end{implementation} |
| 801 |
% |
| 802 |
% \begin{macrocode} |
| 803 |
\term{} |
| 804 |
% \end{macrocode} |
| 805 |
% Logos |
| 806 |
% \begin{macrocode} |
| 807 |
\RequirePackage{graphicx} |
| 808 |
% \end{macrocode} |
| 809 |
% %hyperref |
| 810 |
% \begin{macrocode} |
| 811 |
\RequirePackage{hyperref} |
| 812 |
\hypersetup{hidelinks, unicode} |
| 813 |
\providecaptionname{ngerman, german}{\sheetname}{Übungsblatt} |
| 814 |
\providecaptionname{english, american, british}{\sheetname}{Sheet} |
| 815 |
% \end{macrocode} |
| 816 |
% \begin{documentation} |
| 817 |
% \DescribeMacro{\sheetsep} |
| 818 |
% |
| 819 |
% \end{documentation} |
| 820 |
% \begin{implementation} |
| 821 |
% \begin{macro}{\sheetsep} |
| 822 |
% \begin{macrocode} |
| 823 |
\newcommand*{\sheetsep}{~} |
| 824 |
% \end{macrocode} |
| 825 |
% \end{macro} |
| 826 |
% \end{implementation} |
| 827 |
% |
| 828 |
% \begin{macrocode} |
| 829 |
\providecaptionname{ngerman, german}{\taskname}{Aufgabe} |
| 830 |
\providecaptionname{english, american, british}{\taskname}{Task} |
| 831 |
% \end{macrocode} |
| 832 |
% \begin{documentation} |
| 833 |
% \DescribeMacro{\tasksep} |
| 834 |
% |
| 835 |
% \end{documentation} |
| 836 |
% \begin{implementation} |
| 837 |
% \begin{macro}{\tasksep} |
| 838 |
% \begin{macrocode} |
| 839 |
\newcommand*{\tasksep}{~}%TODO |
| 840 |
% \end{macrocode} |
| 841 |
% \end{macro} |
| 842 |
% \end{implementation} |
| 843 |
% |
| 844 |
% \begin{macrocode} |
| 845 |
\providecaptionname{ngerman, german}{\solutionname}{Lösungsvorschlag} |
| 846 |
\providecaptionname{english, american, british}{\solutionname}{Solution} |
| 847 |
% \end{macrocode} |
| 848 |
% \begin{documentation} |
| 849 |
% \DescribeMacro{\solutionsep} |
| 850 |
% |
| 851 |
% \end{documentation} |
| 852 |
% \begin{implementation} |
| 853 |
% \begin{macro}{\solutionsep} |
| 854 |
% \begin{macrocode} |
| 855 |
\newcommand*{\solutionsep}{:~} |
| 856 |
% \end{macrocode} |
| 857 |
% \end{macro} |
| 858 |
% \end{implementation} |
| 859 |
% |
| 860 |
% \begin{macrocode} |
| 861 |
\providecaptionname{ngerman, german}{\StudentNamename}{Nachname,~Vorname} |
| 862 |
\providecaptionname{english, american, british}{\StudentNamename}{Last Name,~ First Name} |
| 863 |
% \end{macrocode} |
| 864 |
% \begin{documentation} |
| 865 |
% \DescribeMacro{\StudentNamesep} |
| 866 |
% |
| 867 |
% \end{documentation} |
| 868 |
% \begin{implementation} |
| 869 |
% \begin{macro}{\StudentNamesep} |
| 870 |
% \begin{macrocode} |
| 871 |
\newcommand*{\StudentNamesep}{:~} |
| 872 |
% \end{macrocode} |
| 873 |
% \end{macro} |
| 874 |
% \end{implementation} |
| 875 |
% |
| 876 |
% \begin{documentation} |
| 877 |
% \DescribeMacro{\StudentIDname} |
| 878 |
% |
| 879 |
% \end{documentation} |
| 880 |
% \begin{implementation} |
| 881 |
% \begin{macro}{\StudentIDname} |
| 882 |
% \begin{macrocode} |
| 883 |
\providecommand{\StudentIDname}{Matrikelnummer} |
| 884 |
% \end{macrocode} |
| 885 |
% \end{macro} |
| 886 |
% \end{implementation} |
| 887 |
% |
| 888 |
% \begin{macrocode} |
| 889 |
\providecaptionname{ngerman, german}{\StudentIDname}{Matrikelnummer} |
| 890 |
\providecaptionname{english, american, british}{\StudentIDname}{Enrollment ID} |
| 891 |
% \end{macrocode} |
| 892 |
% \begin{documentation} |
| 893 |
% \DescribeMacro{\StudentIDsep} |
| 894 |
% |
| 895 |
% \end{documentation} |
| 896 |
% \begin{implementation} |
| 897 |
% \begin{macro}{\StudentIDsep} |
| 898 |
% \begin{macrocode} |
| 899 |
\newcommand*{\StudentIDsep}{:~} |
| 900 |
% \end{macrocode} |
| 901 |
% \end{macro} |
| 902 |
% \end{implementation} |
| 903 |
% |
| 904 |
% \begin{documentation} |
| 905 |
% \DescribeMacro{\creditformat} |
| 906 |
% |
| 907 |
% \end{documentation} |
| 908 |
% \begin{implementation} |
| 909 |
% \begin{macro}{\creditformat} |
| 910 |
% \begin{macrocode} |
| 911 |
\providecommand{\creditformat}[1]{\space(#1)} |
| 912 |
% \end{macrocode} |
| 913 |
% \end{macro} |
| 914 |
% \end{implementation} |
| 915 |
% |
| 916 |
% \begin{documentation} |
| 917 |
% \DescribeMacro{\creditformatsum} |
| 918 |
% |
| 919 |
% \end{documentation} |
| 920 |
% \begin{implementation} |
| 921 |
% \begin{macro}{\creditformatsum} |
| 922 |
% \begin{macrocode} |
| 923 |
\providecommand{\creditformatsum}[1]{\creditformat{#1}} |
| 924 |
% \end{macrocode} |
| 925 |
% \end{macro} |
| 926 |
% \end{implementation} |
| 927 |
% |
| 928 |
% \begin{documentation} |
| 929 |
% \DescribeMacro{\pointformat} |
| 930 |
% |
| 931 |
% \end{documentation} |
| 932 |
% \begin{implementation} |
| 933 |
% \begin{macro}{\pointformat} |
| 934 |
% \begin{macrocode} |
| 935 |
\newcommand*{\pointformat}[1]{ |
| 936 |
\fp_compare:nF {#1 = 0} { |
| 937 |
\bool_if:NTF \l_@@_points_auto_bool |
| 938 |
\creditformatsum |
| 939 |
\creditformat |
| 940 |
{ |
| 941 |
\fp_to_decimal:n {#1}\space |
| 942 |
\fp_compare:nTF {#1=1} |
| 943 |
\PointName |
| 944 |
\PointsName |
| 945 |
} |
| 946 |
} |
| 947 |
} |
| 948 |
% \end{macrocode} |
| 949 |
% \end{macro} |
| 950 |
% \end{implementation} |
| 951 |
% |
| 952 |
% \begin{macrocode} |
| 953 |
\providecaptionname{ngerman, german}{\PointName}{Punkt} |
| 954 |
\providecaptionname{english, american, british}{\PointName}{Point} |
| 955 |
% \end{macrocode} |
| 956 |
% \begin{documentation} |
| 957 |
% \DescribeMacro{\PointsName} |
| 958 |
% |
| 959 |
% \end{documentation} |
| 960 |
% \begin{implementation} |
| 961 |
% \begin{macro}{\PointsName} |
| 962 |
% \begin{macrocode} |
| 963 |
\providecommand{\PointsName}{Punkte} |
| 964 |
% \end{macrocode} |
| 965 |
% \end{macro} |
| 966 |
% \end{implementation} |
| 967 |
% |
| 968 |
% \begin{macrocode} |
| 969 |
\providecaptionname{ngerman, german}{\PointsName}{Punkte} |
| 970 |
\providecaptionname{english, american, british}{\PointsName}{Points} |
| 971 |
% \end{macrocode} |
| 972 |
% Has to be initialized after captionnames have been defined |
| 973 |
% \begin{macrocode} |
| 974 |
\AtBeginDocument{ |
| 975 |
\ptxcd_update_headline_boxes: |
| 976 |
\_@@_adjust_headheight: |
| 977 |
\global\let\ConfigureHeadline\ptxcd_ConfigureHeadline:n |
| 978 |
} |
| 979 |
% \end{macrocode} |
| 980 |
% task environment |
| 981 |
% \begin{macrocode} |
| 982 |
\DeclareSectionCommand[% |
| 983 |
style=section,% |
| 984 |
level=2,% |
| 985 |
indent=\z@,% |
| 986 |
beforeskip=\cs_if_exist_use:NF \scr@subsection@beforeskip {-3.25ex\@plus -1ex \@minus -.2ex},% |
| 987 |
afterskip=\cs_if_exist_use:NF \scr@subsection@afterskip {1.5ex \@plus .2ex},% |
| 988 |
tocstyle=section,% |
| 989 |
tocindent=\cs_if_exist_use:NF \scr@tso@subsection@indent {1.5em},% |
| 990 |
tocnumwidth=\cs_if_exist_use:NF \scr@tso@subsection@numwidth {2.3em},% |
| 991 |
]{task} |
| 992 |
% \end{macrocode} |
| 993 |
% \begin{documentation} |
| 994 |
% \DescribeMacro{\thetask} |
| 995 |
% |
| 996 |
% \end{documentation} |
| 997 |
% \begin{implementation} |
| 998 |
% \begin{macro}{\thetask} |
| 999 |
% \begin{macrocode} |
| 1000 |
\renewcommand*{\thetask}{ |
| 1001 |
\g_ptxcd_ex_sheetnum_tl\tl_if_empty:NF \g_ptxcd_ex_sheetnum_tl{.} |
| 1002 |
\arabic{task} |
| 1003 |
} |
| 1004 |
% \end{macrocode} |
| 1005 |
% \end{macro} |
| 1006 |
% \end{implementation} |
| 1007 |
% |
| 1008 |
% \begin{documentation} |
| 1009 |
% \DescribeMacro{\taskformat} |
| 1010 |
% |
| 1011 |
% \end{documentation} |
| 1012 |
% \begin{implementation} |
| 1013 |
% \begin{macro}{\taskformat} |
| 1014 |
% \begin{macrocode} |
| 1015 |
\newcommand*{\tasklabel}{\thetask} |
| 1016 |
\renewcommand*{\taskformat}{\taskname\tasksep\tasklabel{}} |
| 1017 |
% \end{macrocode} |
| 1018 |
% \end{macro} |
| 1019 |
% \end{implementation} |
| 1020 |
% |
| 1021 |
% \begin{macrocode} |
| 1022 |
\let\@task\task |
| 1023 |
\cs_undefine:N \task |
| 1024 |
% \end{macrocode} |
| 1025 |
% \begin{documentation} |
| 1026 |
% \DescribeEnv{task} |
| 1027 |
% |
| 1028 |
% \end{documentation} |
| 1029 |
% \begin{environment}{task} |
| 1030 |
% \begin{macrocode} |
| 1031 |
\NewDocumentEnvironment{task}{om}{ |
| 1032 |
\IfNoValueF{#1}{\keys_set:nn {ptxcd/task}{#1}} |
| 1033 |
\@task{#2} |
| 1034 |
\edef\@currenttasklabel{\tasklabel} |
| 1035 |
}{ |
| 1036 |
\_@@_save_task_properties:nnnn {} {\thetask} {#2} { |
| 1037 |
\bool_if:NTF \l_@@_points_auto_bool { |
| 1038 |
\fp_to_decimal:N \g_@@_ex_collected_points_fp |
| 1039 |
}{ |
| 1040 |
\fp_to_decimal:N \l_@@_task_points_fp |
| 1041 |
} |
| 1042 |
} |
| 1043 |
\fp_gzero:N \g_@@_ex_collected_points_fp |
| 1044 |
} |
| 1045 |
% \end{macrocode} |
| 1046 |
% \changes{v4.00}{2025-01-26}{Write task properties diractly per task/subtask} |
| 1047 |
% \begin{macrocode} |
| 1048 |
\cs_new:Nn \_@@_save_task_properties:nnnn { |
| 1049 |
\iow_now:Ne \@auxout { |
| 1050 |
\exp_not:N \ptxcd@TaskProperties {#1} {#2} { |
| 1051 |
\tl_if_empty:cF {l_@@_#1credit_tl} {credit=\tl_to_str:v {l_ptxcd_#1credit_tl},} |
| 1052 |
\tl_if_blank:nF {#3} {title={\tl_to_str:n {#3}},} |
| 1053 |
} {#4} |
| 1054 |
} |
| 1055 |
\prop_gput:cee {g_@@_#1points_collector_prop} |
| 1056 |
{#2} {#4} |
| 1057 |
} |
| 1058 |
\cs_generate_variant:Nn \_@@_save_task_properties:nnnn {nnon} |
| 1059 |
% \end{macrocode} |
| 1060 |
% |
| 1061 |
% \begin{macrocode} |
| 1062 |
\iffalse |
| 1063 |
\newcommand*{\addsubtasktocentry}[4]{ |
| 1064 |
\show\subtaskentry |
| 1065 |
%% {Dateierweiterung }{Ebene }{Gliederungsnummer }{Eintrag } |
| 1066 |
%\IfArgIsEmpty {#3}{\addcontentsline {#1}{#2}{\protect \nonumberline #4}}{\addcontentsline {#1}{#2}{\protect \numberline {#3}#4}} |
| 1067 |
\tocbasic@addxcontentsline{#1}{#2}{#3}{#4} |
| 1068 |
\iow_now:Ne \@auxout { |
| 1069 |
\exp_not:N \ptxcd@TaskProperties {\the\c@task} {\the\c@subtask} {\tl_to_str:n {#2}} { |
| 1070 |
\bool_if:NTF \l_@@_points_auto_bool { |
| 1071 |
\fp_to_decimal:N \l_@@_task_points_fp |
| 1072 |
}{ |
| 1073 |
\fp_to_decimal:N \g_@@_ex_collected_points_fp |
| 1074 |
} |
| 1075 |
} |
| 1076 |
} |
| 1077 |
} |
| 1078 |
\fi |
| 1079 |
|
| 1080 |
%\ptxcd@TaskProperties {}{5.10}{Einheitliche Syntax für Task/Subtask}{0} |
| 1081 |
\newcommand*\ptxcd@TaskProperties [4]{ |
| 1082 |
\prop_gput:cnn {g_@@_#1points_collector_prop} |
| 1083 |
{#2} {#4} |
| 1084 |
\clist_map_inline:nn {#3} { |
| 1085 |
\prop_gput_from_keyval:Nn \g_@@_property_collector_prop { |
| 1086 |
#2-##1 |
| 1087 |
} |
| 1088 |
} |
| 1089 |
\prop_gput:Nnn \g_@@_property_collector_prop {#2-points} {#4} |
| 1090 |
} |
| 1091 |
% \end{macrocode} |
| 1092 |
% \end{environment} |
| 1093 |
% \end{implementation} |
| 1094 |
% |
| 1095 |
% \begin{macrocode} |
| 1096 |
\cs_set_eq:cN {task*} \task |
| 1097 |
\cs_set_eq:cN {endtask*} \endtask |
| 1098 |
% \end{macrocode} |
| 1099 |
% subtasks |
| 1100 |
% \begin{macrocode} |
| 1101 |
\DeclareSectionCommand[% |
| 1102 |
style=section,% |
| 1103 |
level=3,% |
| 1104 |
indent=\z@,% |
| 1105 |
beforeskip=\cs_if_exist_use:NF \scr@subsubsection@beforeskip {-3.25ex\@plus -1ex \@minus -.2ex},% |
| 1106 |
afterskip=\cs_if_exist_use:NF \scr@subsubsection@afterskip {1.5ex \@plus .2ex},% |
| 1107 |
tocstyle=subsection,% |
| 1108 |
tocindent=\cs_if_exist_use:NF \scr@tso@subsubsection@indent {1.5em},% |
| 1109 |
tocnumwidth=\cs_if_exist_use:NF \scr@tso@subsubsection@numwidth {2.3em},% |
| 1110 |
counterwithin=task,% |
| 1111 |
]{subtask} |
| 1112 |
\bool_if:NT \g_@@_runin_subtask_bool { |
| 1113 |
\RedeclareSectionCommand[runin=true]{subtask} |
| 1114 |
} |
| 1115 |
% \end{macrocode} |
| 1116 |
% \begin{documentation} |
| 1117 |
% \DescribeMacro{\thesubtask} |
| 1118 |
% |
| 1119 |
% \end{documentation} |
| 1120 |
% \begin{implementation} |
| 1121 |
% \begin{macro}{\thesubtask} |
| 1122 |
% \begin{macrocode} |
| 1123 |
\renewcommand*{\thesubtask}{\alph{subtask})} |
| 1124 |
% \end{macrocode} |
| 1125 |
% \end{macro} |
| 1126 |
% \end{implementation} |
| 1127 |
% |
| 1128 |
% \begin{documentation} |
| 1129 |
% \DescribeMacro{\subtaskformat} |
| 1130 |
% |
| 1131 |
% \end{documentation} |
| 1132 |
% \begin{implementation} |
| 1133 |
% \begin{macro}{\subtaskformat} |
| 1134 |
% \begin{macrocode} |
| 1135 |
\newcommand*{\subtasklabel}{\thetask\thesubtask} |
| 1136 |
\renewcommand*{\subtaskformat}{\subtasklabel\enskip} |
| 1137 |
% \end{macrocode} |
| 1138 |
% \end{macro} |
| 1139 |
% \end{implementation} |
| 1140 |
% |
| 1141 |
% \begin{macrocode} |
| 1142 |
\setkomafont{subtask}{\mdseries\normalsize} |
| 1143 |
\let\@subtask\subtask |
| 1144 |
\cs_undefine:N \subtask |
| 1145 |
% \end{macrocode} |
| 1146 |
% \begin{documentation} |
| 1147 |
% \DescribeEnv{subtask} |
| 1148 |
% |
| 1149 |
% \end{documentation} |
| 1150 |
% \begin{environment}{subtask} |
| 1151 |
% \begin{macrocode} |
| 1152 |
\NewDocumentEnvironment{subtask}{o}{ |
| 1153 |
\begingroup |
| 1154 |
\tl_if_in:nnTF {#1} {=} { |
| 1155 |
\keys_set:nn {ptxcd/subtask} {#1} |
| 1156 |
} { |
| 1157 |
\keys_set:nn {ptxcd/subtask} {title={#1}} |
| 1158 |
} |
| 1159 |
\bool_if:NTF \l_@@_subtask_fallback_bool { |
| 1160 |
\@subtask{\IfNoValueF{#1}{#1}} |
| 1161 |
}{ |
| 1162 |
\@subtask{\l_@@_title_tl} |
| 1163 |
} |
| 1164 |
\edef\@currenttasklabel{\subtasklabel} |
| 1165 |
\_@@_save_task_properties:nnon {subtask_} {\@currenttasklabel} |
| 1166 |
{\l_@@_title_tl} {\fp_to_decimal:N \l_@@_subtask_points_fp} |
| 1167 |
\bool_if:NT \g_@@_runin_subtask_bool \strut |
| 1168 |
\tl_gset_eq:NN \g_tmpa_tl \@currentlabel |
| 1169 |
\endgroup |
| 1170 |
\edef\@currentcounter{subtask} |
| 1171 |
\protected@edef\@currentlabel{\p@subtask\thesubtask} |
| 1172 |
}{} |
| 1173 |
% \end{macrocode} |
| 1174 |
% \end{environment} |
| 1175 |
% \end{implementation} |
| 1176 |
% |
| 1177 |
% \begin{documentation} |
| 1178 |
% \DescribeEnv{subtask*} |
| 1179 |
% |
| 1180 |
% \end{documentation} |
| 1181 |
% \begin{environment}{subtask*} |
| 1182 |
% \begin{macrocode} |
| 1183 |
\NewDocumentEnvironment{subtask*}{om}{ |
| 1184 |
\begingroup |
| 1185 |
\IfNoValueF{#1}{\keys_set:nn {ptxcd/subtask}{#1}} |
| 1186 |
\@subtask{#2} |
| 1187 |
\tl_gset_eq:NN \g_tmpa_tl \@currentlabel |
| 1188 |
\endgroup |
| 1189 |
\tl_set_eq:NN \@currentlabel \g_tmpa_tl |
| 1190 |
}{} |
| 1191 |
% Solution mechanism |
| 1192 |
% |
| 1193 |
\DeclareSectionCommand[% |
| 1194 |
style=section,% |
| 1195 |
level=3,% |
| 1196 |
indent=\z@,% |
| 1197 |
beforeskip=\cs_if_exist_use:NF \scr@subsubsection@beforeskip {-3.25ex\@plus -1ex \@minus -.2ex},% |
| 1198 |
afterskip=\cs_if_exist_use:NF \scr@subsubsection@afterskip {1.5ex \@plus .2ex},% |
| 1199 |
tocstyle=subsection,% |
| 1200 |
tocindent=\cs_if_exist_use:NF \scr@tso@subsubsection@indent {1.5em},% |
| 1201 |
tocnumwidth=\cs_if_exist_use:NF \scr@tso@subsubsection@numwidth {2.3em},% |
| 1202 |
]{@solution} |
| 1203 |
\setkomafont{@solution}{\normalfont} |
| 1204 |
\cs_new:Nn \_@@_solutionheader: { |
| 1205 |
\@solution*{\solutionname\solutionsep} |
| 1206 |
\if@newlist\global\@newlistfalse\fi |
| 1207 |
} |
| 1208 |
% \end{macrocode} |
| 1209 |
% \end{environment} |
| 1210 |
% \end{implementation} |
| 1211 |
% |
| 1212 |
% \begin{macrocode} |
| 1213 |
\box_new:N \g_ptxcd_NumberForm_box |
| 1214 |
\hbox_gset:Nn \g_ptxcd_NumberForm_box { |
| 1215 |
\rule{\fboxrule}{1ex} |
| 1216 |
\rule{1em}{\fboxrule} |
| 1217 |
\rule{\fboxrule}{1ex} |
| 1218 |
\, |
| 1219 |
} |
| 1220 |
% \end{macrocode} |
| 1221 |
% \begin{documentation} |
| 1222 |
% \DescribeMacro{\ptxcd_StudentID} |
| 1223 |
% |
| 1224 |
% \end{documentation} |
| 1225 |
% \begin{implementation} |
| 1226 |
% \begin{macro}{\ptxcd_StudentID} |
| 1227 |
% \begin{macrocode} |
| 1228 |
\newcommand*\ptxcd_StudentID[1][7]{ |
| 1229 |
\StudentIDname\StudentIDsep\prg_replicate:nn {#1} {\box_use:N \g_ptxcd_NumberForm_box} |
| 1230 |
} |
| 1231 |
% \end{macrocode} |
| 1232 |
% \end{macro} |
| 1233 |
% \end{implementation} |
| 1234 |
% |
| 1235 |
% \begin{macrocode} |
| 1236 |
\let\StudentID\ptxcd_StudentID |
| 1237 |
% \end{macrocode} |
| 1238 |
% \begin{documentation} |
| 1239 |
% \DescribeMacro{\ptxcd_StudentName} |
| 1240 |
% |
| 1241 |
% \end{documentation} |
| 1242 |
% \begin{implementation} |
| 1243 |
% \begin{macro}{\ptxcd_StudentName} |
| 1244 |
% \begin{macrocode} |
| 1245 |
\newcommand*\ptxcd_StudentName{ |
| 1246 |
\StudentNamename\StudentNamesep\hrulefill\qquad |
| 1247 |
} |
| 1248 |
% \end{macrocode} |
| 1249 |
% \end{macro} |
| 1250 |
% \end{implementation} |
| 1251 |
% |
| 1252 |
% \begin{macrocode} |
| 1253 |
\let\StudentName\ptxcd_StudentName |
| 1254 |
\let\ShortTitle\g_ptxcd_shorttitle_tl |
| 1255 |
% \end{macrocode} |
| 1256 |
% Compatibility Features |
| 1257 |
% |
| 1258 |
% \begin{macrocode} |
| 1259 |
\bool_if:NT \g_@@_compatibility_bool { |
| 1260 |
\cs_set_eq:NN \c@subsection \c@task |
| 1261 |
\cs_set_eq:NN \subsection \task |
| 1262 |
\cs_set_eq:NN \c@subsubsection \c@subtask |
| 1263 |
\cs_set_eq:NN \subsubsection \subtask |
| 1264 |
\cs_set_eq:NN \thetask \thesubsection |
| 1265 |
\cs_set_eq:NN \thesubtask \thesubsection |
| 1266 |
} |
| 1267 |
\file_if_exist_input:n {\g_@@_config_prefix_tl\g_ptxcd_department_str.cfg} |
| 1268 |
\ptxcd_makeheadrule[color=identbarcolor, width=\textwidth]{ptxcd_headrule} |
| 1269 |
% \end{macrocode} |
| 1270 |
% Point referencing |
| 1271 |
% \begin{macrocode} |
| 1272 |
\cs_if_exist:NTF \AddtoDoHook { |
| 1273 |
\AddtoDoHook{heading/preinit/subtask}{ |
| 1274 |
\bool_if:NT \g_@@_points_bool { |
| 1275 |
\fp_gadd:Nn \g_@@_ex_collected_points_fp {\l_@@_subtask_points_fp} |
| 1276 |
} |
| 1277 |
} |
| 1278 |
\AddtoDoHook{heading/preinit/task}{ |
| 1279 |
\fp_gzero:N \g_@@_ex_collected_points_fp |
| 1280 |
} |
| 1281 |
} { |
| 1282 |
\msg_warning:nnnn {tudaexercise} {outdated-koma-script} {point~references} {3.27} |
| 1283 |
} |
| 1284 |
\msg_new:nnn {tudaexercise} {points-differ} { |
| 1285 |
Value~of~points~changed~for~at~least~one~task.\\ |
| 1286 |
Please~rerun~LaTeX~to~get~correct~references~and~calculations. |
| 1287 |
} |
| 1288 |
\msg_new:nnn {tudaexercise} {empty-point-mapping} { |
| 1289 |
I~could~not~find~references~for~points~in~the~aux~file.\\ |
| 1290 |
Please~rerun~LaTeX~to~get~correct~references~and~calculations. |
| 1291 |
} |
| 1292 |
\msg_new:nnn {tudaexercise} {point-referencing-disabled} { |
| 1293 |
You~try~to~use~#1.\\ |
| 1294 |
This~function~is~only~available~with~points=true~or~points=auto.\\ |
| 1295 |
Please~activate~referencing~to~use~it. |
| 1296 |
} |
| 1297 |
\bool_if:NTF \g_@@_points_bool { |
| 1298 |
\BeforeClosingMainAux{ |
| 1299 |
\tl_clear:N \l_tmpa_tl |
| 1300 |
\tl_clear:N \l_tmpb_tl |
| 1301 |
\fp_zero:N \l_tmpa_fp |
| 1302 |
\prop_map_inline:Nn \g_@@_points_collector_prop { |
| 1303 |
\tl_put_right:Nn \l_tmpa_tl {#1=#2,} |
| 1304 |
\fp_add:Nn \l_tmpa_fp {#2} |
| 1305 |
} |
| 1306 |
\prop_map_inline:Nn \g_@@_subtask_points_collector_prop { |
| 1307 |
\tl_put_right:Nn \l_tmpa_tl {#1=#2,} |
| 1308 |
} |
| 1309 |
\prop_map_inline:Nn \g_@@_loaded_points_prop { |
| 1310 |
\tl_put_right:Nn \l_tmpb_tl {#1=#2,} |
| 1311 |
} |
| 1312 |
\tl_if_eq:NNF \l_tmpa_tl \l_tmpb_tl { |
| 1313 |
\msg_warning:nn {tudaexercise} {points-differ} |
| 1314 |
} |
| 1315 |
\iow_now:Nx \@auxout{ |
| 1316 |
\exp_not:N \ptxcd@LoadPoints[\the\c@task][\fp_use:N \l_tmpa_fp]{\l_tmpa_tl} |
| 1317 |
} |
| 1318 |
} |
| 1319 |
\cs_new:Nn \_@@_getPoints:n { |
| 1320 |
\prop_if_in:NnTF \g_@@_loaded_points_prop {#1} |
| 1321 |
{\prop_item:Nn \g_@@_loaded_points_prop {#1}} |
| 1322 |
{\nfss@text{\reset@font\bfseries??}} |
| 1323 |
} |
| 1324 |
\cs_generate_variant:Nn \_@@_getPoints:n {x} |
| 1325 |
\newcommand{\getPoints}[1]{\_@@_getPoints:x {#1}} |
| 1326 |
\newcommand{\refPoints}[1]{ |
| 1327 |
\edef\x{#1} |
| 1328 |
\cs_if_exist:cTF {r@\x} { |
| 1329 |
\str_if_in:cnTF {r@\x} {subtask} { |
| 1330 |
\tl_set_eq:Nc \l_tmpa_tl {r@\x} |
| 1331 |
\getPoints{\tl_item:Nn \l_tmpa_tl {2}\tl_item:Nn \l_tmpa_tl {1}} |
| 1332 |
} { |
| 1333 |
\getPoints{\tl_head:v {r@\x}} |
| 1334 |
} |
| 1335 |
}{ |
| 1336 |
\nfss@text{\reset@font\bfseries??} |
| 1337 |
} |
| 1338 |
} |
| 1339 |
\newcommand{\getPointsTotal}{ |
| 1340 |
\fp_use:N \g_@@_points_total_fp |
| 1341 |
} |
| 1342 |
% \end{macrocode} |
| 1343 |
% \DescribeMacro{\getTaskProperty}\oarg{Task Number}{title/credit/points} |
| 1344 |
% Suggested in PR \# 316 \url{https://github.com/tudace/tuda_latex_templates/pull/316} |
| 1345 |
% \changes{v4.00}{2025-01-26}{Add Interface to access task title} |
| 1346 |
% \begin{macrocode} |
| 1347 |
\NewDocumentCommand{\getTaskProperty}{O{\@currenttasklabel}m}{ |
| 1348 |
\exp_args:Ne \tl_show:n {#1-#2} |
| 1349 |
\prop_if_in:NnTF \g_@@_property_collector_prop {#1-#2} |
| 1350 |
{\prop_item:Nn \g_@@_property_collector_prop {#1-#2}} |
| 1351 |
{{\nfss@text{\reset@font\bfseries??}}} |
| 1352 |
} |
| 1353 |
|
| 1354 |
\NewDocumentCommand{\mapPoints}{sO{1}m}{ |
| 1355 |
\mapTasks[skip-zero-points=true,\IfBooleanF{#1}{subtask=false},start-task=#2]{#3}{#3} |
| 1356 |
} |
| 1357 |
% \end{macrocode} |
| 1358 |
% \changes{v4.00}{2025-01-26}{Add mapping Mechanismus including subtasks based on Pull-request 316} |
| 1359 |
% \begin{Syntax} |
| 1360 |
% \_@@_point_mapping_aux:nnn \marg{task/subtask} \marg{start value} \marg{action to do before continuing the loop} |
| 1361 |
% \end{Syntax} |
| 1362 |
% \begin{macrocode} |
| 1363 |
\cs_new:Nn \_@@_point_mapping_aux:nnn { |
| 1364 |
\bool_set_true:c {l_@@_#1_bool} |
| 1365 |
\cs_set:ce {_@@_cached_#1_counter:} {\int_eval:n {\value{#1}}} |
| 1366 |
\setcounter{#1}{#2} |
| 1367 |
\bool_while_do:cn {l_@@_#1_bool} { |
| 1368 |
\prop_get:NeNTF \g_@@_loaded_points_prop {\use:c {#1label}} \l_tmpa_tl { |
| 1369 |
% \end{macrocode} |
| 1370 |
% mechanism to skip item if it doesn't have points |
| 1371 |
% \begin{macrocode} |
| 1372 |
\bool_if:NT \l_@@_skip_zero_points_bool |
| 1373 |
{\fp_compare:nF {\l_tmpa_tl = 0}} |
| 1374 |
\use:n |
| 1375 |
{ |
| 1376 |
\tl_build_put_right:Ne \l_ptxcd_tmp_tl { |
| 1377 |
\exp_not:c {_@@_map_points_#1:nn} {\use:c {#1label}} {\l_tmpa_tl} |
| 1378 |
} |
| 1379 |
} |
| 1380 |
#3 |
| 1381 |
\stepcounter{#1} |
| 1382 |
} {\bool_set_false:c {l_@@_#1_bool}} |
| 1383 |
} |
| 1384 |
\setcounter{#1}{\use:c {_@@_cached_#1_counter:}} |
| 1385 |
} |
| 1386 |
% \end{macrocode} |
| 1387 |
% \changes{v4.00}{2025-01-26}{Add generic mechanism to iterate over tasks} |
| 1388 |
% \begin{macrocode} |
| 1389 |
\keys_define:nn {ptxcd/task-mapping} { |
| 1390 |
task .bool_set:N = \l_@@_task_bool, |
| 1391 |
task .initial:n = false, |
| 1392 |
subtask .bool_set:N = \l_@@_subtask_bool, |
| 1393 |
subtask .initial:n = false, |
| 1394 |
skip-zero-points .bool_set:N = \l_@@_skip_zero_points_bool, |
| 1395 |
skip-zero-points .initial:n = false, |
| 1396 |
start-task .int_set:N = \l_@@_start_task_int, |
| 1397 |
start-task .initial:n = 1, |
| 1398 |
} |
| 1399 |
|
| 1400 |
\NewDocumentCommand{\mapTasks}{O{}+m+m}{ |
| 1401 |
\cs_gset:Ne \_@@_restore_task_counters: { |
| 1402 |
\exp_not:N \setcounter{task}{\the\value{task}} |
| 1403 |
\exp_not:N \setcounter{subtask}{\the\value{subtask}} |
| 1404 |
} |
| 1405 |
\group_begin: |
| 1406 |
\keys_set:ne {ptxcd/task-mapping} { |
| 1407 |
task = true, |
| 1408 |
subtask=true, |
| 1409 |
#1 |
| 1410 |
} |
| 1411 |
\cs_gset:Nn \_@@_map_points_task:nn {#2} |
| 1412 |
\cs_gset:Nn \_@@_map_points_subtask:nn {#3} |
| 1413 |
|
| 1414 |
\prop_if_empty:NTF \g_@@_loaded_points_prop { |
| 1415 |
\msg_warning:nn {tudaexercise} {empty-point-mapping} |
| 1416 |
\tl_set:Nn \l_ptxcd_tmp_tl {\_@@_map_points_task:nn {?task?} {?points?}} |
| 1417 |
} { |
| 1418 |
\tl_build_begin:N \l_ptxcd_tmp_tl |
| 1419 |
\exp_args:Nne \use:n { |
| 1420 |
\bool_if:NTF \l_@@_task_bool \use:n \use_ii:nn |
| 1421 |
{\_@@_point_mapping_aux:nnn {task} {\int_use:N \l_@@_start_task_int}} |
| 1422 |
}{ |
| 1423 |
\bool_if:NT \l_@@_subtask_bool { |
| 1424 |
\exp_not:n { |
| 1425 |
\bool_set_true:N \l_@@_subtask_bool |
| 1426 |
\_@@_point_mapping_aux:nnn {subtask} {1} {} |
| 1427 |
} |
| 1428 |
} |
| 1429 |
} |
| 1430 |
\tl_build_end:N \l_ptxcd_tmp_tl |
| 1431 |
} |
| 1432 |
\cs_gset_eq:NN \g_ptxcd_tmp_tl \l_ptxcd_tmp_tl |
| 1433 |
\exp_last_unbraced:No |
| 1434 |
\group_end: |
| 1435 |
\g_ptxcd_tmp_tl |
| 1436 |
% \end{macrocode} |
| 1437 |
% check if between tabular rows to use \noalign |
| 1438 |
% \begin{macrocode} |
| 1439 |
\ifhmode\else\ifvoid\@arstrutbox\else\noalign\fi\fi |
| 1440 |
{\_@@_restore_task_counters:} |
| 1441 |
} |
| 1442 |
} { |
| 1443 |
\newcommand{\getPoints}[1]{ |
| 1444 |
\msg_error:nnn {tudaexercise} {point-referencing-disabled} {\getPoints} |
| 1445 |
} |
| 1446 |
\newcommand{\refPoints}[1]{ |
| 1447 |
\msg_error:nnn {tudaexercise} {point-referencing-disabled} {\refPoints} |
| 1448 |
} |
| 1449 |
\newcommand{\getPointsTotal}[1]{ |
| 1450 |
\msg_error:nnn {tudaexercise} {point-referencing-disabled} {\getPointsTotal} |
| 1451 |
} |
| 1452 |
\NewDocumentCommand{\mapPoints}{som} { |
| 1453 |
\msg_error:nnn {tudaexercise} {point-referencing-disabled} {\mapPoints} |
| 1454 |
} |
| 1455 |
\NewDocumentCommand{\getTaskProperty}{om}{ |
| 1456 |
\msg_error:nnn {tudaexercise} {point-referencing-disabled} {\getTaskProperty} |
| 1457 |
} |
| 1458 |
} |
| 1459 |
% \end{macrocode} |
| 1460 |
% \begin{documentation} |
| 1461 |
% \DescribeMacro{\ptxcd@LoadPoints} |
| 1462 |
% |
| 1463 |
% \end{documentation} |
| 1464 |
% \begin{implementation} |
| 1465 |
% \begin{macro}{\ptxcd@LoadPoints} |
| 1466 |
% \begin{macrocode} |
| 1467 |
\int_new:N \g_@@_max_task_int |
| 1468 |
\NewDocumentCommand{\ptxcd@LoadPoints}{oO{0}m}{ |
| 1469 |
\IfNoValueF{#1}{\int_gset:Nn \g_@@_max_task_int {#1}} |
| 1470 |
\prop_gset_from_keyval:Nn \g_@@_loaded_points_prop { |
| 1471 |
#3 |
| 1472 |
} |
| 1473 |
\fp_gset:Nn \g_@@_points_total_fp {#2} |
| 1474 |
} |
| 1475 |
% \end{macrocode} |
| 1476 |
% \end{macro} |
| 1477 |
% \end{implementation} |
| 1478 |
% |
| 1479 |
% \begin{macrocode} |
| 1480 |
\endinput |
| 1481 |
% \end{macrocode} |
| 1482 |
|
| 1483 |
% |
| 1484 |
% \iffalse |
| 1485 |
%</body> |
| 1486 |
% \fi |
| 1487 |
% \Finale |
| 1488 |
% \fi^^A No documentation on this |
| 1489 |
\endinput |