summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/tuda-ci/tex/tudaexercise.cls')
-rw-r--r--macros/latex/contrib/tuda-ci/tex/tudaexercise.cls128
1 files changed, 65 insertions, 63 deletions
diff --git a/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls b/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls
index 953a1309fb..c6f3f5d977 100644
--- a/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls
+++ b/macros/latex/contrib/tuda-ci/tex/tudaexercise.cls
@@ -1,4 +1,4 @@
-%% This is file `tudaexercise.cls' version 2.03a (2019/11/29),
+%% This is file `tudaexercise.cls' version 2.04 (2019/12/17),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
@@ -26,11 +26,8 @@
%%
%% ============================================================================
%%
-\def\fileversion{2.03a}
-\def\filedate{2019/11/29}
-%%
-\def\fileversion{1.01}
-\def\filedate{2019/09/09}
+\def\fileversion{2.04}
+\def\filedate{2019/12/17}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplClass{tudaexercise}
@@ -57,10 +54,32 @@
\bool_new:N \g_TUDa_geometry_bool
\bool_new:N \g_TUDa_custommargins_bool
+\bool_new:N \l_TUDa_ex_solution_bool
+
+\RequirePackage{environ}
+
+\def\solution{\TUDa_ex_solutionheader:}
+\def\endsolution{}
+
+\cs_new:Nn \TUDa_setup_solution: {
+ \bool_if:NTF \l_TUDa_ex_solution_bool {
+ \def\solution{\TUDa_ex_solutionheader:}
+ \def\endsolution{}
+ }{
+ \RenewEnviron{solution}{
+ \if_false:
+ \BODY
+ \fi:
+ }
+ }
+}
\keys_define:nn {TUDa/exercise} {
- solution .bool_set:N = \l_TUDa_ex_solution_bool,
+ solution .code:n = {
+ \bool_set_eq:Nc \l_TUDa_ex_solution_bool {c_#1_bool}
+ \TUDa_setup_solution:
+ },
solution .initial:n = false,
solution .default:n = true,
compat .bool_gset:N = \g_TUDa_ex_compatibility_bool,
@@ -149,6 +168,7 @@
colorback .initial:n = true,
}
+\RequirePackage{tudarules}
\ProcessKeysOptions{TUDa/pub}
\prop_map_inline:Nn \g_TUDa_clsopts_prop {
@@ -166,13 +186,19 @@
\LoadClass{scrartcl}
+%Has to be loaded here due to headwidth options
+\RequirePackage[draft=false]{scrlayer-scrpage}
+\KOMAoptions {twoside = false}
+
\prop_map_inline:Nn \g_TUDa_unknown_clsopts_prop {
\cs_if_exist:cT {KV@KOMA.scrartcl.cls@#1} {
\tl_if_empty:nTF {#2}
- {\KOMAoptions{#1} }
- {\clist_map_inline:nn {#2} {\KOMAoptions{#1=##1}}}
+ {\KOMAoptions{#1}}
+ {\KOMAoption{#1}{#2}
}
}
+}
+
\renewcommand*\sectionlinesformat[4]{%
\parbox{\linewidth}{
\rule[5\g_TUDa_titlerule_dim]{\linewidth}{\g_TUDa_titlerule_dim}\par\nointerlineskip
@@ -188,9 +214,6 @@
}}
-
-
-\usepackage{tudarules}
\usepackage{tudafonts}
\dim_new:N \g_TUDa_innerMargin_dim
@@ -248,13 +271,9 @@
\dim_new:N \g_TUDa_headheight_dim
\dim_new:N \g_TUDa_headwidth_dim
-
-\dim_gset:Nn \g_TUDa_headheight_dim {1.25\baselineskip +\c_TUDa_largerule_dim +\c_TUDa_rulesep_dim +\c_TUDa_smallrule_dim}
-
+\dim_gset:Nn \g_TUDa_headheight_dim {\c_TUDa_largerule_dim +\c_TUDa_rulesep_dim +\c_TUDa_smallrule_dim}
%%%%%Anfang Randeinstellungen Geometry
-%Has to be loaded here due to headwidth options
-\usepackage[draft=false]{scrlayer-scrpage}
\bool_if:NTF \g_TUDa_geometry_bool {
\RequirePackage[top=\g_TUDa_topMargin_dim, inner=\g_TUDa_innerMargin_dim, outer=\dim_eval:n {\g_TUDa_outerMargin_dim}, bottom=\g_TUDa_bottomMargin_dim, columnsep= \g_TUDa_columnSep_dim, includehead, includefoot, headheight=\g_TUDa_headheight_dim
@@ -263,13 +282,9 @@
\KOMAoptions{headinclude, footinclude, headwidth=text,footwidth=text}
}
-
%%%%%%%%
%Ende Randeinstellungen klassisch
-
-
-
\newcommand*{\institution}[1]{
\def\TUDa@institution{#1}
}
@@ -299,9 +314,6 @@
\addtokomafont{captionlabel}{\accentfont}
\addtokomafont{caption}{\accentfont}
-\KOMAoptions{footsepline=.5\c_TUDa_smallrule_dim}
-\KOMAoptions{headsepline=.5\c_TUDa_smallrule_dim}
-
\box_new:N \g_TUDa_ex_headline_odd_box
\box_new:N \g_TUDa_ex_headline_even_box
\box_new:N \g_TUDa_ex_headline_oneside_box
@@ -358,8 +370,8 @@
\if@twoside
\dim_set:Nn \l_tmpa_dim {
\dim_max:nn
- {\box_ht:N \g_TUDa_ex_headline_odd_box}
- {\box_ht:N \g_TUDa_ex_headline_even_box}
+ {\box_ht:N \g_TUDa_ex_headline_odd_box+\box_dp:N \g_TUDa_ex_headline_odd_box}
+ {\box_ht:N \g_TUDa_ex_headline_even_box+\box_dp:N \g_TUDa_ex_headline_even_box}
}
\else
\dim_set:Nn \l_tmpa_dim {
@@ -367,11 +379,17 @@
+ \box_dp:N \g_TUDa_ex_headline_oneside_box
}
\fi
- \dim_add:Nn \l_tmpa_dim {\box_dp:N \TUDa@headline_box}
- \KOMAoptions{headinclude, headheight=\l_tmpa_dim}
- \global\setlength{\headheight}{\l_tmpa_dim}
- \clist_map_inline:nn {odd, even, oneside} {
- \ModifyLayer[contents={\raisebox{\c_TUDa_rulesep_dim}[0pt][0pt]{\box_use:c {g_TUDa_ex_headline_##1_box}}}]{TUDa.ex.head.##1}
+ \dim_compare:nT {\l_tmpa_dim > \z@}
+ {
+ \dim_add:Nn \l_tmpa_dim {\box_dp:N \TUDa@headline_box +\c_TUDa_rulesep_dim}
+ \KOMAoptions{headinclude, headheight=\l_tmpa_dim,headsepline = .5\c_TUDa_smallrule_dim}
+ \if@twoside
+ \cehead{\box_use:c {g_TUDa_ex_headline_even_box}}
+ \cohead{\box_use:c {g_TUDa_ex_headline_odd_box}}
+ \else
+ \chead{\box_use:c {g_TUDa_ex_headline_oneside_box}}
+ \fi
+ \global\setlength{\headheight}{\l_tmpa_dim}
}
}
@@ -385,29 +403,20 @@
\box_if_exist:NF \TUDa@headline_box {
\TUDa@makeheadrule[color=identbarcolor, width=\sls@headwidth]{TUDa@headline}
}
+\ModifyLayer[
+ background,
+ height=\box_dp:N \TUDa@headline_box,
+ align=tl,
+ voffset=\g_TUDa_topMargin_dim,
+ contents=\raisebox{\depth}{\box_use:N \TUDa@headline_box},
+ ]{plain.TUDa.ex.head.above.line}
\ModifyLayer[
- background,
- mode=picture,
- contents={%\layercontentsmeasure
- \dim_compare:nF {\box_wd:N \TUDa@headline_box=\layerwidth} {
- \TUDa@makeheadrule*[color=identbarcolor, width=\layerwidth]{TUDa@headline}
- }
- \box_use:N \TUDa@headline_box
- },
- addvoffset=-\box_dp:N \TUDa@headline_box
+ background,
+ height=\box_dp:N \TUDa@headline_box,
+ align=tl,
+ voffset=\g_TUDa_topMargin_dim,
+ contents=\raisebox{\depth}{\box_use:N \TUDa@headline_box},
]{TUDa.ex.head.above.line}
- \ModifyLayer[
- background,
-% mode=picture,
- contents={%\layercontentsmeasure
- \dim_compare:nF {\box_wd:N \TUDa@headline_box=\layerwidth} {
- \TUDa@makeheadrule*[color=identbarcolor, width=\layerwidth]{TUDa@headline}
- }
- \box_use:N \TUDa@headline_box
- },
- ]{plain.TUDa.ex.head.above.line}
- \lehead{headmark}%TODO
- \lohead{headmark}%TODO
\ofoot[\pagemark]{\pagemark}
}
@@ -478,9 +487,10 @@
\setparsizes{\z@}{\z@}{\z@\@plus 1fil}\par@updaterelative
\vspace*{-\dim_eval:n {
\headheight
+ -\c_TUDa_largerule_dim -\c_TUDa_rulesep_dim
+\headsep
- +\topskip
- -\dp\strutbox
+ +\ht\strutbox
+ +\p@
}}
\par
\nointerlineskip
@@ -662,7 +672,7 @@ tocnumwidth=\cs_if_exist_use:NF \scr@tso@subsubsection@numwidth {2.3em},%
\cs_undefine:N \subtask
\NewDocumentEnvironment{subtask}{o}{
- \@subtask{#1}
+ \@subtask{\IfNoValueF{#1}{#1}}
}{}
%Solution mechanism
@@ -679,14 +689,6 @@ tocnumwidth=\cs_if_exist_use:NF \scr@tso@subsubsection@numwidth {2.3em},%
]{@solution}
-\def\solution{
-\bool_if:NTF \l_TUDa_ex_solution_bool \TUDa_ex_solutionheader: \iffalse
-}
-
-\def\endsolution{
- \bool_if:NF \l_TUDa_ex_solution_bool \fi
-}
-
\setkomafont{@solution}{\normalfont}
\cs_new:Nn \TUDa_ex_solutionheader: {