Skip to content

Commit

Permalink
reimplementation of tudaexercise headline mevhanism
Browse files Browse the repository at this point in the history
  • Loading branch information
TeXhackse committed Dec 17, 2019
1 parent 6323092 commit 62df6d0
Showing 1 changed file with 30 additions and 38 deletions.
68 changes: 30 additions & 38 deletions tex/tudaexercise.cls
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@

%Has to be loaded here due to headwidth options
\RequirePackage[draft=false]{scrlayer-scrpage}
\KOMAoptions {twoside = false ,headsepline = .5\c_TUDa_smallrule_dim}
\KOMAoptions {twoside = false}

\prop_map_inline:Nn \g_TUDa_unknown_clsopts_prop {
\cs_if_exist:cT {[email protected]@#1} {
Expand Down Expand Up @@ -241,9 +241,7 @@
\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


Expand All @@ -254,13 +252,9 @@
\KOMAoptions{headinclude, footinclude, headwidth=text,footwidth=text}
}


%%%%%%%%
%Ende Randeinstellungen klassisch




\newcommand*{\institution}[1]{
\def\TUDa@institution{#1}
}
Expand Down Expand Up @@ -346,20 +340,26 @@
\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 {
\box_ht:N \g_TUDa_ex_headline_oneside_box
+ \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}
}
}

Expand All @@ -373,29 +373,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}
}

Expand Down Expand Up @@ -466,9 +457,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
Expand Down

0 comments on commit 62df6d0

Please sign in to comment.