-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbeamerthemeunihel.sty
360 lines (314 loc) · 11.6 KB
/
beamerthemeunihel.sty
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
% Leo Leppänen, 2019-05-11
% version 1.2.0
\mode<presentation>
\RequirePackage{xcolor} % \colorlet depends on xcolor
\RequirePackage{etoolbox} % Needed for switching between frame layouts
\RequirePackage{tikz}
\RequirePackage[overload]{textcase} % Better uppercasing for titles
% Funding
\newcommand{\funding}[2][]{%
\def\fundingIcon{#1}
\def\funding{#2}
}
% Define the official university colours, one for each faculty
% These are all given a name so they can be easily used in presentations
% The colour "fac" is defined as the current faculty's colour,
% depending on the faculty options
% The official "silver" to be used in the university logo
\definecolor{uh silver}{RGB}{140,140,140}
% Faculty of Arts
\definecolor{fac arts}{RGB}{58,117,196}
% Faculty of Science
\definecolor{fac sci}{RGB}{252,163,17}
% Faculty of Vetinary Medicine
\definecolor{fac vet}{RGB}{0,158,96}
% Faculty of Behavioural Sciences
\definecolor{fac behav}{RGB}{252,209,22}
% Faculty of Theology
\definecolor{fac theo}{RGB}{146,88,200}
% Faculty of Law
\definecolor{fac law}{RGB}{140,0,50}
% Faculty of Social Sciences
\definecolor{fac soc}{RGB}{229,5,58}
% Faculty of Agriculture and Forestry
\definecolor{fac agri}{RGB}{0,176,140}
% Faculty of Medicine
\definecolor{fac med}{RGB}{0,163,154}
% Faculty of Pharmacy
\definecolor{fac pharm}{RGB}{0,189,157}
% Faculty of Biological and Environmental Sciences
\definecolor{fac bio}{RGB}{91,191,33}
% Swedish School of Social Sciences
\definecolor{fac sockom}{RGB}{230,51,117}
\definecolor{background}{RGB}{244,244,244}
% Different flames (logos)
\def\flamefile{images/uh-general-trim.png}
\colorlet{fac}{uh silver}
\DeclareOptionBeamer{general}{
\def\flamefile{images/uh-general-trim.png}
}
\DeclareOptionBeamer{agri}{
\def\flamefile{images/uh-agri-trim.png}
\colorlet{fac}{fac agri}
}
\DeclareOptionBeamer{arts}{
\def\flamefile{images/uh-arts-trim.png}
\colorlet{fac}{fac arts}
}
\DeclareOptionBeamer{behav}{
\def\flamefile{images/uh-behav-trim.png}
\colorlet{fac}{fac behav}
}
\DeclareOptionBeamer{bio}{
\def\flamefile{images/uh-bio-trim.png}
\colorlet{fac}{fac bio}
}
\DeclareOptionBeamer{law}{
\def\flamefile{images/uh-law-trim.png}
\colorlet{fac}{fac law}
}
\DeclareOptionBeamer{med}{
\def\flamefile{images/uh-med-trim.png}
\colorlet{fac}{fac med}
}
\DeclareOptionBeamer{pharm}{
\def\flamefile{images/uh-pharm-trim.png}
\colorlet{fac}{fac pharm}
}
\DeclareOptionBeamer{sci}{
\def\flamefile{images/uh-sci-trim.png}
\colorlet{fac}{fac sci}
}
\DeclareOptionBeamer{soc}{
\def\flamefile{images/uh-soc-trim.png}
\colorlet{fac}{fac soc}
}
\DeclareOptionBeamer{sockom}{
\def\flamefile{images/uh-sockom-trim.png}
\colorlet{fac}{fac sockom}
}
\DeclareOptionBeamer{theo}{
\def\flamefile{images/uh-theo-trim.png}
\colorlet{fac}{fac theo}
}
\DeclareOptionBeamer{vet}{
\def\flamefile{images/uh-vet-trim.png}
\colorlet{fac}{fac vet}
}
\ProcessOptionsBeamer
% All fonts should be black
\setbeamercolor{normal text}{bg=white,fg=black}
\setbeamercolor{structure}{fg=black}
% Pull in frame title line spacing
\setbeamerfont{frametitle}{size=\linespread{0.8}\Large}
% Disable navigation
\setbeamertemplate{navigation symbols}{}
% Circles for first two levels of itemized lists
% and a dash for the third.
\setbeamertemplate{itemize item}[circle]
\setbeamertemplate{itemize subitem}[circle]
\defbeamertemplate{itemize subsubitem}{dash}{-}
\setbeamertemplate{itemize subsubitem}[dash]
% Grey slide background
% This is created by a big filled tikz node
% Its colour is defined by the colour "background"
% It's called "grey background", so you can position things relative to it
% using that name
% There's a problem with positioning relative to the box:
% the background is rendered *after* the slide content, so
% you can't refer to the box itself on the slide.
% Instead, we define the node for positioning at the start of
% each frame, then draw the coloured box on the background template.
\def\@drawinvisiblebgbox{%
% The invisible background box, for positioning
\tikz[remember picture, overlay] %
\node (grey background) [text width=0.931\paperwidth, text height=0.803\paperheight,
anchor=north, yshift=-10pt, opacity=0]
at (current page.north) {};%
}
% We have nothing else in the headline
% We draw the invisible box there. If you change the headline,
% include the \@drawinvisiblebgbox command
\setbeamertemplate{headline}{%
\@drawinvisiblebgbox{}%
}
\setbeamertemplate{background canvas}{%
% The visible grey box, positioned relative to the invisible one
\tikz[remember picture, overlay] %
\fill[fill=background] (grey background.north east) rectangle (grey background.south west);%
}
% Empty version
% Just don't draw the grey box: the invisible one is still there for positioning
\defbeamertemplate{background canvas}{plain}{}
%% Renew the command that inserts an image of the slide into the notes
% This is needed so we define the shape "grey background"
% The background canvas is not drawn when doing this, so otherwise
% the shape is not drawn, so anything positioned relative to it goes wild
\renewcommand{\insertslideintonotes}[1]{{%
\tikz[remember picture, overlay] {%
\pgflowlevel{\pgftransformscale{#1}}
\node (grey background) [text width=0.931\paperwidth, text height=0.803\paperheight, fill=background] at (current page.center) {};
}%
\begin{pgfpicture}{0cm}{0cm}{#1\paperwidth}{#1\paperheight}
\begin{pgflowlevelscope}{\pgftransformscale{#1}}%
\color{normal text.bg}
\pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\paperheight}}
%\pgfusepath{fill}
\color{normal text.fg}
{\pgftransformshift{\pgfpoint{\beamer@origlmargin}{\footheight}}\pgftext[left,bottom]{\copy\beamer@frameboxcopy}}
\end{pgflowlevelscope}
\end{pgfpicture}%
}}
% Flame, as used in normal slides
% Declare a PGF image to reduce file size and processing times
\pgfdeclareimage[width=2.05cm]{normal flame}{\flamefile}
\newcommand{\flame}{\pgfuseimage{normal flame}}
% Flame, as used in the title slide
\pgfdeclareimage[width=3.21cm]{title flame}{\flamefile}
\newcommand{\titleflame}{\pgfuseimage{title flame}}
% Template for the title page
\setbeamertemplate{title page}{
\@drawinvisiblebgbox{}%
% Place the flame in the top left corner
\tikz[overlay, remember picture]
\node[outer sep=0cm, inner sep=0cm, anchor=north west, xshift=0.3cm, yshift=-0.325cm]
at (current page.north west)
{\titleflame};
\vspace{2.6cm}
\vfil
\begin{center}
\textbf{\Large{\MakeUppercase \inserttitle}}\\
\vspace{.3cm}
\textbf{\large{\MakeUppercase \insertsubtitle}}\\
\vspace{.3cm}
\footnotesize{\insertauthor}
\vspace{.3cm}
\end{center}
\vfill
\ifx%
\fundingIcon \undefined %
\else %
\IfFileExists{\fundingIcon}%
{\includegraphics[width=1.5cm]{\fundingIcon}}%
{}%
\fi
\ifx
\funding @empty@ %
\else %
\hfill\tiny{\parbox[b]{0.45\textwidth}{\noindent\funding{}}} %
\fi
\vspace{0.2cm}
}
\newif\if@hideframenums
\@hideframenumsfalse
\newcommand{\hideframenums}{\@hideframenumstrue}
\newcommand{\showframenums}{\@hideframenumsfalse}
% Template for the footer, present on all pages
\defbeamertemplate{footline}{normal}{
\begin{beamercolorbox}[leftskip=.3cm,rightskip=.3cm]{author in head/foot}%
\vspace*{0.1cm}%
\parbox[b]{3.5cm}{\parindent = 0pt
\textbf{HELSINGIN YLIOPISTO} \vspace*{0.05cm}\newline%
\textbf{HELSINGFORS UNIVERSITET} \vspace*{0.05cm}\newline%
\textbf{UNIVERSITY OF HELSINKI}
}%
\insertshortinstitute \hfill \insertshortauthor \hfill \insertdate \hfill \if@hideframenums\relax\else\insertframenumber{}/\inserttotalframenumber\fi%
\par
\vspace*{0.1cm}
\end{beamercolorbox}
}
% Template for an empty footer, can be selected for handouts
\defbeamertemplate{footline}{plain}{
\begin{beamercolorbox}[leftskip=.3cm,rightskip=.3cm]{author in head/foot}%
\end{beamercolorbox}
}
\setbeamertemplate{footline}[normal]
% Template for the non-title frames' header
% Default as the template named "default" so that we can easily switch
% between this and other templates
\usepackage{textcase,regexpatch}
\defbeamertemplate{frametitle}{uhdefault}{%
% Place the flame at the top left corner of the grey box
\tikz[overlay, remember picture]
\node[outer sep=0cm, inner sep=0cm, anchor=north west] at (grey background.north west)
{\flame};%
\makeatletter %from https://tex.stackexchange.com/a/149238
\regexpatchcmd{\insertframetitle}
{(\c{usebeamertemplate}.*)\c{fi}}
{\c{NoCaseChange}\cB\{\1\cE\}\c{fi}}
{}{}%
\makeatother%
\vskip 0.5cm%
\hspace*{45pt}%
\begin{beamercolorbox}[dp=0.3cm, wd=\dimexpr\paperwidth - 3.6cm\relax]{frametitle}
\textbf{\Large{\MakeTextUppercase{\insertframetitle}}}%
\end{beamercolorbox}%
\ifx\insertframesubtitle\@empty\else%
\par%
\hspace*{45pt}%
\begin{beamercolorbox}[dp=0.2cm, wd=\dimexpr\paperwidth - 3.6cm\relax]{framesubtitle}
\textit{\large\insertframesubtitle}
\end{beamercolorbox}%
\fi%
\par
}
\setbeamertemplate{frametitle}[uhdefault]
% Flame, small version
\pgfdeclareimage[width=45pt]{small flame}{\flamefile}
\newcommand{\smallflame}{\pgfuseimage{small flame}}
% Define another beamer template for the title, so
% that we can select a version with a smaller flame
% to give us more space.
% Use key "smalltitle" to select for a frame
\defbeamertemplate{frametitle}{smalltitle}{%
% Place the flame at the top left corner of the grey box
\tikz[overlay, remember picture]
\node[outer sep=0cm, inner sep=0cm, anchor=north west] at (grey background.north west)
{\smallflame};%
\makeatletter %from https://tex.stackexchange.com/a/149238
\regexpatchcmd{\insertframetitle}%
{(\c{usebeamertemplate}.*)\c{fi}}
{\c{NoCaseChange}\cB\{\1\cE\}\c{fi}}
{}{}%
\makeatother%
\vskip 0.17cm%
\hspace*{30pt}%
\begin{beamercolorbox}[dp=0.3cm, wd=\dimexpr\paperwidth - 3.1cm\relax]{frametitle}
\textbf{\Large{\MakeTextUppercase{\insertframetitle}}}%
\end{beamercolorbox}%
\ifx\insertframesubtitle\@empty\else%
\par\hspace*{30pt}%
\begin{beamercolorbox}[dp=0.2cm, wd=\dimexpr\paperwidth - 3.1cm\relax]{framesubtitle}
\textit{\large\insertframesubtitle}
\end{beamercolorbox}%
\fi%
\par
}
% By default, use the default UH title for every frame
\BeforeBeginEnvironment{frame}{%
\setbeamertemplate{frametitle}[uhdefault]%
}
% Define the frame key to select the smalltitle version
\makeatletter
\define@key{beamerframe}{smalltitle}[true]{%
\setbeamertemplate{frametitle}[smalltitle]%
}
\makeatother
% Adjust footnote position
\addtobeamertemplate{footnote}{}{\vspace{2ex}}
% Minor adjustments to bibliography
\setbeamertemplate{bibliography item}{\insertbiblabel} %or theenumiv
\setbeamerfont{bibliography item}{size=\scriptsize} % or tiny or footnotesize
\setbeamerfont{bibliography entry author}{size=\scriptsize}
\setbeamerfont{bibliography entry title}{size=\scriptsize}
\setbeamerfont{bibliography entry location}{size=\scriptsize}
\setbeamerfont{bibliography entry address}{size=\scriptsize}
\setbeamerfont{bibliography entry note}{size=\scriptsize}
% Set blocks to use the faculty's colour in the title
\setbeamercolor{block title}{use=structure,fg=white,bg=fac}
\setbeamercolor{block title example}{parent=normal,fg=white,bg=fac}
\setbeamercolor{block body}{use=structure,fg=black,bg=white}
\setbeamercolor{block body example}{parent=normal,fg=black,bg=white}
\setbeamerfont{block title}{size=\footnotesize}
\mode
<all>