summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tuda-ci/tex/beamerthemeTUDa-mecheng.sty
blob: 9286867413db81c70a4a82ff4813a9d18b8a5d5d (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
305
306
307
308
%% This is file `beamerthemeTUDa-mecheng.sty' version 3.20 (2021/10/12),
%% it is part of
%% TUDa-CI -- Corporate Design for TU Darmstadt
%% ----------------------------------------------------------------------------
%%
%%  Copyright (C) 2018--2021 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{3.20}
\def\filedate{2021/10/12}
\RequirePackage{expl3}
\ProvidesExplPackage{beamerthemeTUDa-mecheng}{\filedate}{\fileversion}{specific tudabeamer configuration for the department of mechanical engineering}


\tl_if_empty:NT \g_ptxcd_departmentlogo_tl {
	\keys_set:nn {ptxcd/beamer}{departmentlogofile=tuda_maschinenbau_logo_rgb}
} 


\mode<presentation>


% Setup Arrow
\RequirePackage{pgf}

\cs_new:Nn \__ptxcd_mecheng_arrow:N {
	\begin{pgfpicture}
		\pgfsetcolor{TUDa-Arrow}
		\pgfsetrectcap
		\pgfsetlinewidth{2\c_ptxcd_smallrule_dim}
		\pgfpathmoveto{\pgfpointorigin}
		\pgfpathlineto{\pgfpointpolar{174}{.05#1}}
		\pgfpathlineto{\pgfpointpolar{186}{.05#1}}
		\pgfpathclose
		\pgfusepath{fill}
		\pgfpathmoveto{\pgfpoint{-.04#1}{0}}
		\pgfpathlineto{\pgfpoint{-#1}{0}}
		\pgfusepath{stroke}
	\end{pgfpicture}
}

\NewDocumentCommand{\MechEngArrow}{sm}{
	\IfBooleanT{#1}{\begingroup\colorlet{TUDa-Arrow}{.}}
	\dim_set:Nn \l_tmpa_dim {#2}\__ptxcd_mecheng_arrow:N \l_tmpa_dim
	\IfBooleanT{#1}{\endgroup}
}

%adjustments for colortheme
\ExplSyntaxOff
\setbeamercolor*{Primary1}{fg=TUDa-Primary1, bg=TUDa-Primary2}
\setbeamercolor*{Primary2}{fg=TUDa-Primary2, bg=TUDa-Primary1}

\setbeamercolor*{footer info}{fg=black!50}
\setbeamercolor*{department in head/foot}{parent=footer info}
\setbeamercolor*{institute in head/foot}{parent=footer info}
\setbeamercolor*{title in head/foot}{parent=footer info}
\setbeamercolor*{author in head/foot}{parent=footer info}
\setbeamercolor*{date in head/foot}{parent=footer info}
\setbeamercolor{footline}{use=Primary2,fg=Primary2.fg}
\setbeamercolor*{title}{parent=normal~text}

\setbeamercolor*{departmentlogo}{parent=normal text}
\setbeamercolor*{logo}{parent=normal text}

\ExplSyntaxOn

%innertheme adjustments
\defbeamertemplate*{title~ page}{TUDa-mecheng}[1][]
{	
	\nointerlineskip
	\vspace{\dimexpr.5\c_ptxcd_logoheight_dim-\ht\strutbox+
	\box_dp:N \ptxcd_beamer_headrule_box + \box_ht:N \ptxcd_beamer_headrule_box
	}
	\hbox_set:Nn \l__ptxcd_titlehead_box {
		\parbox{\__ptxcd_beamer_linewidth:}{%
			\begin{beamercolorbox}[
				wd=\linewidth,
				]{title}
				\raggedright
				\usebeamerfont{title}
				\hbox_set:Nn \l__ptxcd_frametitle_box {
					\parbox[c]{\dimexpr\linewidth-\box_wd:N \g__ptxcd_logo_box-1em\relax}{
						\raggedright{}
						\inserttitle
						\par
					}
				}
				\dim_compare:nT {\box_ht:N \l__ptxcd_frametitle_box > \baselineskip} {\raisebox{\dimexpr-\height+.5\c_ptxcd_logoheight_dim}}
				{\box_use:N \l__ptxcd_frametitle_box}
				\hspace{\fill}
				\raisebox{\dimexpr-.5\height+.5\ht\strutbox-.5\dp\strutbox\relax}{\box_use:N \g__ptxcd_logo_box}\hspace*{\dimexpr-\beamer@rightmargin+\g__ptxcd_beamer_logosep_dim}
				\ifx\insertsubtitle\@empty
				\else
				\par\vspace{\c_ptxcd_largerule_dim}
				\parbox[t]{\dimexpr\linewidth- \box_wd:N \g__ptxcd_logo_box\relax}{
					\usebeamerfont{subtitle}\insertsubtitle
				}
				\fi
			\bool_if:NT \g_ptxcd_authorontitle_bool {
				\par
					\parbox[t]{\dimexpr\linewidth-2ex\relax}{
						\ifx\insertauthor\@empty
						\else
						\usebeamercolor[fg]{author}\usebeamerfont{author}\insertauthor\par
						\fi
						\ifx\insertauthor\@empty
						\else
						\usebeamercolor[fg]{institute}\usebeamerfont{institute}\insertinstitute
						\fi
					}
			}
			\end{beamercolorbox}
		}
	}
	\box_use:N \l__ptxcd_titlehead_box
	\par\skip_vertical:n {\textheight-\box_ht:N\l__ptxcd_titlehead_box-\box_dp:N \l__ptxcd_titlehead_box+.5\c_ptxcd_smallrule_dim}
	\begin{beamercolorbox}[
		rightskip=.07\linewidth,%place image left of arrow tip
		ht=\c_ptxcd_smallrule_dim,%dp=1mm,
		wd=\dimexpr\textwidth]{footline}
		\setbeamertemplate{departmentlogo}[TUDa-mecheng][width=\dimexpr2\linewidth/11\relax]
		\insertdepartmentlogo
		\hfill
		\bool_if:NF \g_ptxcd_authorontitle_bool {
			\begingroup
			\usebeamerfont{footline}
			\bool_set_false:N \l_ptxcd_tmpa_bool
			\clist_map_variable:nNn {department, institute, author,date} \l_tmpa_tl {
				\tl_if_empty:cF {beamer@short\l_tmpa_tl} {
					\bool_if:NTF \l_ptxcd_tmpa_bool
						{\space|\space}
						{\bool_set_true:N \l_ptxcd_tmpa_bool}
					\use:c {insert\l_tmpa_tl}
				}
			}
			\endgroup
		\quad
		}
		\insertlogo
		\par\nointerlineskip\skip_vertical:n {2\c_ptxcd_smallrule_dim}
		\MechEngArrow*{\linewidth}
	\end{beamercolorbox}
}


\defbeamertemplate{background}{TUDa-mecheng-title}{
	\dim_set:Nn	\l__ptxcd_titlegraphic_ht_dim {\paperheight}
	\dim_set:Nn	\l__ptxcd_titlegraphic_wd_dim {\paperwidth}
	\let\height\paperheight
	\let\width\paperwidth
	\inserttitlegraphic
}


\renewcommand*{\maketitle}{
	\begingroup
	\setbeamertemplate{background}[TUDa-mecheng-title]
	\ifbeamer@inframe\titlepage\else\frame[plain]{\titlepage}\fi
	\endgroup
}

\newcommand*{\insertdepartmentlogo}{\usebeamertemplate*{departmentlogo}}

\defbeamertemplate*{departmentlogo}{TUDa-mecheng}[1][height=1.7\baselineskip]{
	\str_set:Nx \l_tmpa_str {\str_range:Nnn \beamer@thc@fg {1} {-4}}
		\file_if_exist:nTF {\g_ptxcd_departmentlogo_tl-\l_tmpa_str.pdf} {
			\includegraphics[#1]{\g_ptxcd_departmentlogo_tl-\l_tmpa_str}
		} {
			\includegraphics[#1]{\g_ptxcd_departmentlogo_tl}
		}
}

\defbeamertemplate*{footline}{TUDa-mecheng}
{
	\begin{beamercolorbox}[
		wd=\linewidth,
		leftskip=\beamer@leftmargin,rightskip=\beamer@rightmargin,
		]{footline}
		\MechEngArrow*{\linewidth}
		\par\skip_vertical:n {.5\g__ptxcd_beamer_logosep_dim}
		\makebox[\linewidth][s]{
			\insertdepartmentlogo
			\hfill
			\bool_set_false:N \l_ptxcd_tmpa_bool
			\clist_map_variable:nNn {department, institute, author,title} \l_tmpa_tl {
				\tl_if_empty:cF {beamer@short\l_tmpa_tl} {
					\bool_if:NTF \l_ptxcd_tmpa_bool
					{\space|\space}
					{\bool_set_true:N \l_ptxcd_tmpa_bool}
					\usebeamercolor[fg]{\l_tmpa_tl\space in\space head/foot}\usebeamerfont{\l_tmpa_tl\space in\space head/foot}
					\use:c {insertshort\l_tmpa_tl}
				}
			}\quad
			\tl_if_empty:cF {beamer@shortdate} {
				\usebeamercolor{date~ in~ head/foot}\usebeamerfont{date~ in~ head/foot}
				\insertshortdate\quad
			}
			\usebeamerfont{framenumber}
			\makebox[.05\linewidth][l]{
				\quad\llap{\insertframenumber}
			}
		}
		\skip_vertical:n {\g__ptxcd_beamer_logosep_dim}
	\end{beamercolorbox}
}

\defbeamertemplate{frametitle}{TUDa-mecheng.logo}{%
	\nointerlineskip%
	\begin{beamercolorbox}[
		sep=\g__ptxcd_beamer_logosep_dim,
		wd=\__ptxcd_beamer_linewidth:,
		rightskip=-\g__ptxcd_beamer_logosep_dim,
		leftskip=\dimexpr-\g__ptxcd_beamer_logosep_dim\relax,
		]{frametitle}
		\hbox_set:Nn \l__ptxcd_frametitle_box {
			\parbox[t]
			{\dimexpr\linewidth- \box_wd:N \g__ptxcd_logo_box-1em\relax\relax}{%
				\usebeamerfont{frametitle}\strut\insertframetitle
				\ifx\insertframesubtitle\@empty
				\else
				\par
				\usebeamercolor[fg]{framesubtitle}
				\usebeamerfont{framesubtitle}
				\insertframesubtitle
				\fi
		}}
		\leavevmode
		\bool_if:NTF \g_ptxcd_centerframetitle_bool
		{\raisebox{\dimexpr-.5\height+.5\depth}}
		{\use:n}
		{\box_use:N \l__ptxcd_frametitle_box}
		\hfill%
		\raisebox{\dimexpr-.5\height+.5\depth}
		{\box_use:N \g__ptxcd_logo_box}
	\end{beamercolorbox}%
	\nointerlineskip
	\begin{beamercolorbox}[
		sep=\g__ptxcd_beamer_logosep_dim,
		wd=\__ptxcd_beamer_linewidth:,
		rightskip=-\g__ptxcd_beamer_logosep_dim,
		leftskip=\dimexpr-\g__ptxcd_beamer_logosep_dim\relax,
		ht=\c_ptxcd_smallrule_dim.
		dp=0
		]{smallrule}
	\end{beamercolorbox}
}

\cs_set:Nn \__ptxcd_reset_framebgcolor: {
	\setbeamercolor{normal~text}{fg=black,bg=}
	\usebeamercolor[fg]{normal~text}
	\setbeamercolor{footline}{use=Primary2,fg=Primary2.fg}
	\setbeamercolor{footer~info}{fg=black!50}
	\cs_gset_eq:cN {beamer@thcbg@normal~text} \__ptxcd_save_background_canvas:
	\cs_undefine:N \__ptxcd_save_background_canvas:
	\cs_if_exist:NT \__ptxcd_save_department_textaccentcolor:
		{\cs_set_eq:cN {\string\color@textaccentcolor} \__ptxcd_save_department_textaccentcolor:}
	\cs_undefine:N \__ptxcd_save_department_textaccentcolor:
	\__ptxcd_setup_frametitle_color:
}

\cs_set:Nn \__ptxcd_set_framebgcolor:n {
	
	\str_case:nnTF {#1} {
		{Primary1} {\tl_set:Nn \l_tmpa_tl {Primary2}}
		{Primary2} {\tl_set:Nn \l_tmpa_tl {Primary1}}
	}{
		\exp_args:Nnx \setbeamercolor{frametitle}{use=\l_tmpa_tl,fg=\l_tmpa_tl.fg,bg=}
		\exp_args:Nnx \setbeamercolor{normal~text}{use=\l_tmpa_tl,fg=\l_tmpa_tl.fg,bg=\l_tmpa_tl.bg}
		\exp_args:Nnx \setbeamercolor{footer~info}{use=\l_tmpa_tl,fg=\l_tmpa_tl.fg}
		\exp_args:Nnx \setbeamercolor{footline}{use=\l_tmpa_tl,fg=\l_tmpa_tl.fg}
		\cs_set_eq:Nc \__ptxcd_save_department_textaccentcolor: {\string\color@textaccentcolor}
		\colorlet{textaccentcolor}{TUDa-\l_tmpa_tl}
	}{
		\cs_if_exist:cTF {\string\color@#1}
		{\setbeamercolor{normal~text}{bg=#1}}
		{\setbeamercolor{normal~text}{bg=TUDa-#1}}
	}
	\usebeamercolor[fg]{normal~text}
}

\setbeamertemplate{headline}[TUDa.simple]

%font adjustments
\setbeamerfont{subtitle}{size=\normalsize,series=\mdseries}

\mode<all>

\endinput