summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/urcls/URrules.sty
blob: b677d6074873076248ee92fa7fc6291911ba90e2 (plain)
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
%% 
%%  This is file `URrules.sty' version 2.0 (2017/04/05),
%%	it is part of
%%  urcls -- Corporate Design for the University of Regensburg
%% ----------------------------------------------------------------------------
%%
%%  Copyright (C) 2016--2017 by Marei Peischl <TeX@mareipeischl.de>
%%
%% ----------------------------------------------------------------------------
%%  License information
%% ----------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% 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.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainer of this work is Marei Peischl.
%%
%% ============================================================================
%%
%%  Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz
%%  in der Version 1.3c, verteilt und/oder verändert werden. Die aktuelle
%%  Version dieser Lizenz ist http://www.latex-project.org/lppl.txt und
%%  Version 1.3c oder neuer ist Teil aller LaTeX-Distributionen ab 2005/12/01. 
%%  Dieses Werk hat den LPPL-Verwaltungs-Status "maintained". 
%%  Die Verwaltung liegt aktuell bei der Autorin, Marei Peischl.
%%
%% ----------------------------------------------------------------------------
%%  End of license information
%% ----------------------------------------------------------------------------
%%

\NeedsTeXFormat{LaTeX2e}
\def\fileversion{2.0}
\def\filedate{2017/04/05}

\RequirePackage{expl3}
\ProvidesExplPackage{URrules}{\filedate}{\fileversion}{Creation of colored bars for urcls-bundle}
   
\RequirePackage{URoptions}

\ExplSyntaxOn


\Define@specialopt@Module

\int_new:N \g_UR@dep_int
\int_new:N \l_UR@temp_int

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Optionen zum aktivieren einzelner Farben

\int_zero:N \l_UR@temp_int
\prop_new:N \g_UR@DepNumKeys_prop


\clist_map_inline:Nn \g_UR@dep_clist {
	\int_incr:N \l_UR@temp_int
	\UR_Define@BoolKey [dep\int_use:N \l_UR@temp_int] {#1}
	\prop_put:Nnx \g_UR@DepNumKeys_prop	{#1} {\int_use:N \l_UR@temp_int}
}

%Sammelaktivierung: all=alle Farben, faculties=alle 11 Fakultäten
\UR_new@BoolOpt{all}
\UR_new@BoolOpt{faculties}

\UR_Define@Key:n {
	logo .code:n = {\def\UR@opt@logo{#1}},
	colors .code:n = {\UR_Set@Key:n {#1}}
}

\UR_new@BoolOpt{beamer}%beamerspezifische Definitionen

%Tonersparender Briefkopf oder draft
\UR_new@BoolOpt{intern}
\UR_new@BoolOpt[intern]{draft}
\UR_Define@ComplementaryKey[intern]{final}

\UR_new@BoolOpt{origlayout}%Linien mit demselben Spacing, wie die Titelseitenlayouts

\UR_Define@Key:n {
	all .code:n = {\clist_map_inline:nn 
		{lov,ffg,asz,rw,ww,kt,pkgg,pps,slk,bvm,mat,ph,chp,med,ub,zsk,eur,zhw,rul,zfw,spo,rz}
		{\bool_gset_true:c {g_UR@dep\prop_item:Nn \g_UR@DepNumKeys_prop {##1}_bool}}
	},
	faculties .code:n = {\clist_map_inline:nn 
		{rw,ww,kt,pkgg,pps,slk,bvm,mat,ph,chp,med}
		{\bool_gset_true:c {g_UR@dep\prop_item:Nn \g_UR@DepNumKeys_prop {##1}_bool}}
	}
}


\Module@Process@SpecialOptions
\exp_args:Nx \ProcessKeysOptions { \@currname.\@currext }



\int_set:Nn \l_UR@temp_int {1}
\int_while_do:nn {\l_UR@temp_int<\clist_count:N \g_UR@dep_clist} {%
	\bool_if:cT{g_UR@dep\int_use:N\l_UR@temp_int _bool}{\int_gincr:N \g_UR@dep_int
		}
	\int_incr:N \l_UR@temp_int
}


\RequirePackage{tikz}
\RequirePackage{URcolors}

%Längen
%%%Skalierung des Logos & Titelblocks
%%halber Radius der Kugel
\expandafter\ifx\csname UR@title@halfradius\endcsname\relax
\newlength{\UR@title@halfradius}
\setlength{\UR@title@halfradius}{\dimexpr\paperwidth/42\relax}
\fi

\box_new:N \UR@titlelogo@box
\cs_if_exist:NTF \UR@opt@logo
	{\exp_args:Nx \tl_if_eq:nnTF {\UR@opt@logo} {fsimphy}
		{\hbox_set:Nn \UR@titlelogo@box {\includegraphics[width=12\UR@title@halfradius]{FSIlogotext}}}
		{\hbox_set:Nn \UR@titlelogo@box {\includegraphics[width=12\UR@title@halfradius]{\UR@opt@logo}}}
	}
	{\bool_if:NTF \g_UR@intern_bool
		{\hbox_set:Nn \UR@titlelogo@box {\includegraphics[width=12\UR@title@halfradius]{urlogotextintern}}}
		{\hbox_set:Nn \UR@titlelogo@box {\includegraphics[width=12\UR@title@halfradius]{urlogotext}}}
	}
%		\bool_if:cTF {g_UR@dep23_bool}
%		{\hbox_set:Nn \UR@titlelogo@box {\includegraphics[width=12\UR@title@halfradius]{FSIlogotext}}}
%		{\bool_if:NTF \g_UR@intern_bool
%			{\hbox_set:Nn \UR@titlelogo@box {\includegraphics[width=12\UR@title@halfradius]{urlogotextintern}}}
%			{\hbox_set:Nn \UR@titlelogo@box {\includegraphics[width=12\UR@title@halfradius]{urlogotext}}}
%		}
%	}
	



%Style für die Logos
\tikzset{UR@logo/.style={inner~sep=0pt, anchor=north~west, outer~sep=0pt},
	UR@linewidth/.style={line~width=.4pt}
	}


%Warning bei fehlender Farboptionenangabe
\int_compare:nT {\g_UR@dep_int = 0}{
	\msg_new:nnn {URrules.sty} {nocolor} {You~didn't~specify~a~color~option.~The~usually~colored~area~is~set~empty.}
	\msg_warning:nn {URrules.sty} {nocolor}
}

%Definition der Längen für die Konstruktion der Boxen & Linien
\dim_new:N \l_UR@linelength_dim
\dim_new:N \l_UR@linewidth_dim
\dim_new:N \l_UR@colorlength_dim
\int_new:N \l_UR@color_int

%Definition von \UR@create@linebox*[Dicke]<Länge>{csname}
\NewDocumentCommand\UR@create@linebox{sO{3pt}D<>{\paperwidth-10\UR@title@halfradius}m}{
	\dim_set:Nn \l_UR@linewidth_dim {#2}
	\dim_set:Nn \l_UR@linelength_dim {#3}
	\dim_set:Nn \l_UR@linelength_dim {.5\l_UR@linelength_dim}
	\box_new:c {#4}
	\if_bool:N \g_UR@intern_bool
			\hbox_gset:cn {#4}{
				\begin{tikzpicture}[UR@linewidth]
				\IfBooleanTF{#1}
					{\useasboundingbox (0,0) rectangle (-\dimexpr 10\UR@title@halfradius-1in-\hoffset-\oddsidemargin\relax,-\l_UR@linewidth_dim);}
					{\useasboundingbox (0,0) rectangle (2\l_UR@linelength_dim,-\l_UR@linewidth_dim);}
				\fill[UR@reingrau](0,0)rectangle(\l_UR@linelength_dim,-\l_UR@linewidth_dim);
				\draw[UR@reingrau](\l_UR@linelength_dim,\dimexpr-\l_UR@linewidth_dim+.5\pgflinewidth\relax)--(\dimexpr2\l_UR@linelength_dim-.5\pgflinewidth\relax,\dimexpr-\l_UR@linewidth_dim+.5\pgflinewidth\relax)--(\dimexpr2\l_UR@linelength_dim-.5\pgflinewidth\relax,-.5\pgflinewidth)--(\l_UR@linelength_dim,-.5\pgflinewidth);
				\end{tikzpicture}
				}
	\else:
		\int_zero:N \l_UR@color_int
		\int_set:Nn \l_UR@temp_int {1}
		\hbox_gset:cn {#4}
		{
			\begin{tikzpicture}[baseline=(current~bounding~box.center)]
			\IfBooleanTF{#1}
				{\useasboundingbox (0,0) rectangle (-\dimexpr 10\UR@title@halfradius-1in-\hoffset-\oddsidemargin\relax,-\l_UR@linewidth_dim);}
				{\useasboundingbox (0,0) rectangle (2\l_UR@linelength_dim,-\l_UR@linewidth_dim);}
			\fill[UR@reingrau](0,0)rectangle+(\l_UR@linelength_dim,-\l_UR@linewidth_dim);
			\coordinate(grauerstreifen) at (\l_UR@linelength_dim,-\l_UR@linewidth_dim);
			\int_compare:nF {\g_UR@dep_int = 0}
			{
				\dim_set:Nn \l_UR@colorlength_dim {\l_UR@linelength_dim/\g_UR@dep_int}
				\int_while_do:nn {\l_UR@temp_int<24}{%
					\exp_after:wN \if_bool:N \cs:w g_UR@dep\int_use:N\l_UR@temp_int _bool\cs_end:
						\fill[UR@color@\int_use:N \l_UR@temp_int](grauerstreifen)++(\l_UR@color_int\l_UR@colorlength_dim,0)rectangle+(\l_UR@colorlength_dim,\l_UR@linewidth_dim);
						\int_incr:N \l_UR@color_int
					\fi:
					\int_incr:N \l_UR@temp_int
				}
			}
			\end{tikzpicture}%
		}
	\fi:
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Definition von \UR@create@colorlinebox[Dicke]<Länge>{csname}
\NewDocumentCommand\UR@create@colorlinebox{O{3pt}D<>{\paperwidth-10\UR@title@halfradius}m}{
	\dim_set:Nn \l_UR@linewidth_dim {#1}
	\dim_set:Nn \l_UR@linelength_dim {#2}
	\box_new:c {#3}
	\if_bool:N \g_UR@intern_bool
	\hbox_gset:cn {#3}
	{
		\begin{tikzpicture}[UR@linewidth]
		\useasboundingbox[clip] (0,0) rectangle (\l_UR@linelength_dim,-\l_UR@linewidth_dim);
		\draw(.5\pgflinewidth,.5\pgflinewidth) rectangle (\dimexpr\l_UR@linelength_dim-.5\pgflinewidth,\dimexpr-\l_UR@linewidth_dim+.5\pgflinewidth\relax);
		\end{tikzpicture}
	}
	\else:
	\int_compare:nF {\g_UR@dep_int = 0}{\dim_set:Nn \l_UR@colorlength_dim {\l_UR@linelength_dim/\g_UR@dep_int}
	\int_zero:N \l_UR@color_int
	\int_set:Nn \l_UR@temp_int {1}
	\hbox_gset:cn {#3}
	{
		\begin{tikzpicture}
		\useasboundingbox (0,0) rectangle (\l_UR@linelength_dim,-\l_UR@linewidth_dim);
		\int_while_do:nn {\l_UR@temp_int<24}{%
			\exp_after:wN \if_bool:N \cs:w g_UR@dep\int_use:N\l_UR@temp_int _bool\cs_end:
			\path[fill=UR@color@\int_use:N \l_UR@temp_int](\l_UR@color_int\l_UR@colorlength_dim,0)rectangle++(\l_UR@colorlength_dim,-\l_UR@linewidth_dim);
			\int_incr:N \l_UR@color_int
			\fi:
			\int_incr:N \l_UR@temp_int
		}
		\end{tikzpicture}%
	}
	}
	\fi:
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Definition von \UR@create@titlebox{csname}
\NewDocumentCommand\UR@create@titlebox{m}{
	\dim_set:Nn \l_UR@linelength_dim {(\paperwidth-10\UR@title@halfradius)/2}
%	\int_compare:nT {\g_UR@dep_int != 0}{\dim_set:Nn \l_UR@colorlength_dim {\l_UR@linelength_dim/\g_UR@dep_int}}
	\box_new:c {#1}
\if_bool:N \g_UR@intern_bool
			\hbox_gset:cn {#1} 
	{
			%schwarz weißer Kopf für interne Verwendung
			\begin{tikzpicture}[UR@linewidth]
			\useasboundingbox (0,0) rectangle (\paperwidth,-7\UR@title@halfradius);
			\draw(10\UR@title@halfradius,-\UR@title@halfradius)--++(0,-2\UR@title@halfradius)--++(.98\l_UR@linelength_dim,0)++(.02\l_UR@linelength_dim,2\UR@title@halfradius)--++(0,-2\UR@title@halfradius)--++(\l_UR@linelength_dim,0);
			\draw(3\UR@title@halfradius,-1\UR@title@halfradius)node[UR@logo]{\usebox\UR@titlelogo@box};%\pgfuseimage{titlelogo}};
			\end{tikzpicture}
	}
\else:
		\int_zero:N \l_UR@color_int
		\int_set:Nn \l_UR@temp_int {1}
		\hbox_gset:cn {#1} 
		{
%		%Farbiger Kopf
			\begin{tikzpicture}
			\useasboundingbox (0,0) rectangle (\paperwidth,-7\UR@title@halfradius);
			\path[fill=UR@reingrau](10\UR@title@halfradius,0)rectangle++(\l_UR@linelength_dim,-3\UR@title@halfradius);
			\coordinate(grauerstreifen) at (10\UR@title@halfradius+\l_UR@linelength_dim,-3\UR@title@halfradius);
			\node[UR@logo] at (3\UR@title@halfradius,-\UR@title@halfradius) {\usebox\UR@titlelogo@box};%\pgfuseimage{titlelogo}};
			\int_compare:nF {\g_UR@dep_int = 0}
%			{\UR@nocolorwarn}
			{
				\dim_set:Nn \l_UR@colorlength_dim {\l_UR@linelength_dim/\g_UR@dep_int}
				\int_while_do:nn {\l_UR@temp_int<24}
				{
					\exp_after:wN \if_bool:N \cs:w g_UR@dep\int_use:N\l_UR@temp_int _bool\cs_end:
						\path[fill=UR@color@\int_use:N \l_UR@temp_int](grauerstreifen)++(\l_UR@color_int\l_UR@colorlength_dim,0)rectangle+(\l_UR@colorlength_dim,3\UR@title@halfradius);
						\int_incr:N \l_UR@color_int
					\fi:
				\int_incr:N \l_UR@temp_int
				}
			}
			\end{tikzpicture}
		}
\fi:
	}

%\URrule{department clist}{width}{height}
\NewDocumentCommand\URrule{mmm}{
	\bool_if:NTF \g_UR@intern_bool {
		\textcolor{UR@reingrau}{\rule{#2}{#3}}
	}{
	\begin{tikzpicture}
	\coordinate(nextpos) at (0,0);
	\clist_map_inline:nn {#1} {
		\prop_get:NnN \g_UR@DepNumKeys_prop {##1} \l_tmpa_tl
		\path[fill=UR@color@\csname l_tmpa_tl\endcsname](nextpos)rectangle++({#2/\clist_count:n {#1}},#3)++(0,-#3)coordinate(nextpos);
	}
	\end{tikzpicture}
	}
}


\ExplSyntaxOff


\endinput