1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
%% This is file `tudarules.sty' version 2.09 (2020/03/09),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
%%
%% Copyright (C) 2018--2020 by Marei Peischl <marei@peitex.de>
%%
%% ============================================================================
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainers of this work are
%% Marei Peischl <tuda-ci@peitex.de>
%% Markus Lazanowski <latex@ce.tu-darmstadt.de>
%%
%% The development respository can be found at
%% https://github.com/tudace/tuda_latex_templates
%% Please use the issue tracker for feedback!
%%
%% ============================================================================
%%
\def\fileversion{2.09}
\def\filedate{2020/03/09}
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{expl3}
\ProvidesExplPackage{tudarules}{\filedate}{\fileversion}{Creation of colored bars for tuda-ci bundle}
\RequirePackage{l3keys2e}
\seq_if_exist:NF \l_TUDa_tmpa_seq {\seq_new:N \l_TUDa_tmpa_seq}
\tl_if_exist:NF \l_TUDa_tmpa_tk {\tl_new:N \l_TUDa_tmpa_tl}
\cs_new:Nn \TUDa_rules_set_values:n {
\seq_set_split:Nnn \l_TUDa_tmpa_seq {|} {#1}
\int_step_inline:nnnn {1} {1} {4} {
\tl_set:Nn \l_TUDa_tmpa_tl {c_TUDa_
\clist_item:nn {largerule, rulesep, smallrule, logoheight} {##1}
_dim}
\dim_if_exist:cF {\l_TUDa_tmpa_tl} {\dim_new:c {\l_TUDa_tmpa_tl}}
\dim_gset:cn {\l_TUDa_tmpa_tl} {\seq_item:Nn \l_TUDa_tmpa_seq {##1}}
}
}
\keys_define:nn {TUDa/rules} {
color .tl_gset:N = \g_TUDa_rules_color_tl,
blackrule .meta:n = {color=black},
paper .choice:,
paper/dl .code:n = { \TUDa_rules_set_values:n { 3.5mm | 1.4mm | 1.2pt | 17 mm | 0.6pt| 10mm | 14mm}},
paper/a6 .code:n = { \TUDa_rules_set_values:n { 3 mm | 1.4mm | 1.2pt | 16.5mm | 0.6pt| 10mm | 15mm}},
paper/a5 .code:n = { \TUDa_rules_set_values:n { 3.3mm | 1.4mm | 1.2pt | 19 mm | 0.6pt| 12mm | 16mm}},
paper/a4 .code:n = { \TUDa_rules_set_values:n { 4 mm | 1.4mm | 1.2pt | 22 mm | 0.6pt| 15mm | 20mm}},
paper/a3 .code:n = { \TUDa_rules_set_values:n { 4.5mm | 1.4mm | 1.2pt | 24.5mm | 0.6pt| 15mm | 20mm}},
paper/a2 .code:n = { \TUDa_rules_set_values:n { 8 mm | 2.5mm | 2.2pt | 44.5mm | 1.1pt| 30mm | 35mm}},
paper/a1 .code:n = { \TUDa_rules_set_values:n { 10 mm | 3.0mm | 2.8pt | 55.5mm | 1.4pt| 30mm | 35mm}},
paper/a0 .code:n = { \TUDa_rules_set_values:n { 16 mm | 5.2mm | 4.8pt | 80 mm | 2.4pt| 30mm | 35mm}},
paper/slide .code:n = { \TUDa_rules_set_values:n { 2mm | .7mm | .6pt | 11 mm | .3pt| 7.5mm | 10mm}},
paper/beamer .meta:n = {paper= slide},
paper/leaflet .meta:n = {paper=a5},
color .tl_gset:N = \g_TUDarules_default_color_tl,
color .initial:n = black,
mode .tl_gset:N = \g_TUDarules_default_mode_tl,
mode .initial:n = box
}
\ProcessKeysOptions{TUDa/rules}
\RequirePackage{tudacolors}
\RequirePackage{xparse}
%Switch between TikZ and box mode
\bool_new:N \g_TUDa_rule_TikZmode_bool
\keys_define:nn {TUDa/rules} {
width .dim_gset:N = \l_TUDa_headrule_width_dim,
color .tl_gset:N = \l_TUDa_headrule_color_tl,
mode .choice:,
mode / box .code:n = \bool_gset_false:N \g_TUDa_rule_TikZmode_bool,
mode / tikz .code:n = \bool_gset_true:N \g_TUDa_rule_TikZmode_bool,
mode / TikZ .code:n = \bool_gset_true:N \g_TUDa_rule_TikZmode_bool,
}
\NewDocumentCommand{\TUDa@makeheadrule}{som}{
\keys_set:nn {TUDa/rules} {
%TODO maybe package options for default
width=\textwidth,
}
\exp_args:Nnx \keys_set:nn {TUDa/rules} {
mode= \g_TUDarules_default_mode_tl,
color= \g_TUDarules_default_color_tl
}
\IfNoValueF {#2} {\keys_set:nn {TUDa/rules}{#2}}
\box_if_exist:cF {#3_box} {\box_new:c {#3_box}}
\bool_if:NTF \g_TUDa_rule_TikZmode_bool {
\hbox_gset:cn {#3_box} {
\begin{tikzpicture}
\fill[\l_TUDa_headrule_color_tl](0,\c_TUDa_rulesep_dim)rectangle++(\l_TUDa_headrule_width_dim,\c_TUDa_largerule_dim);
\fill(0,0)rectangle(\l_TUDa_headrule_width_dim,-\c_TUDa_smallrule_dim);
\end{tikzpicture}
}
}{
\hbox_gset:cn {#3_box} {
\parbox[t]{\l_TUDa_headrule_width_dim}{
\setlength{\baselineskip}{\z@}
\null\par\nointerlineskip
\textcolor{\l_TUDa_headrule_color_tl}{\rule{\linewidth}{\c_TUDa_largerule_dim}}
\vspace{\c_TUDa_rulesep_dim}\par\nointerlineskip
\rule{\linewidth}{\c_TUDa_smallrule_dim}
}
}
}
\IfBooleanTF {#1}
\cs_set:cpn \cs_new:cpn {#3} {\box_use:c {#3_box}}
}
\NewDocumentCommand{\TUDa@makefootrule}{om}{
\keys_set:nn {TUDa/rules} {
width= \textwidth
}
\IfNoValueF {#1} {\keys_set:nn {TUDa/rules}{#1}}
\box_new:c {#2_box}
\hbox_gset:cn {#2_box} {
\raisebox{-\height}{\rule{\l_TUDa_headrule_width_dim}{.5\c_TUDa_smallrule_dim}}
}
\cs_new:cpn {#2} {\box_use:c {#2_box}}
}
%DL | 3.5mm | 1.4mm | 1.2pt | 17 mm | 0.6pt| 10mm | 14mm |
%A6 | 3 mm | 1.4mm | 1.2pt | 16.5mm | 0.6pt| 10mm | 15mm |
%A5 | 3.3mm | 1.4mm | 1.2pt | 19 mm | 0.6pt| 12mm | 16mm |
%A4 | 4 mm | 1.4mm | 1.2pt | 22 mm | 0.6pt| 15mm | 20mm |
%A3 | 4.5mm | 1.4mm | 1.2pt | 24.5mm | 0.6pt| 15mm | 20mm |
%A2 | 8 mm | 2.5mm | 2.2pt | 44.5mm | 1.1pt| 30mm | 35mm |
%A1 | 10 mm | 3.0mm | 2.8pt | 55.5mm | 1.4pt| 30mm | 35mm |
%A0 | 16 mm | 5.2mm | 4.8pt | 80 mm | 2.4pt| 30mm | 35mm |
%punched a4 = inner, bottom=20mm top outer =15mm
\endinput
|