-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbeamerthememasterthesis.sty
559 lines (469 loc) · 14.9 KB
/
beamerthememasterthesis.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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
% !TEX TS-program = lualatex
% !TEX encoding = utf-8
% !TEX root = presentation.tex
% !TEX spellcheck = en-US
% !BIB TS-program = biber
% ┌───────────────────────────────────────────────────────────────┐
% │ CONTENTS OF beamerthememasterthesis.sty │
% ├───────────────────────────────────────────────────────────────┘
% │
% ├── DEPENDENCIES
% ├──┐GENERAL
% │ ├── COMMANDS
% │ └── LENGTHS
% ├──┐BEAMER
% │ ├── OTHER THEMES
% │ ├── TRANSPARENCY
% │ ├── NAVIGATION
% │ ├── ITEMS
% │ ├──┐MARGINS
% │ │ ├── HORIZONTAL
% │ │ └── VERTICAL
% │ ├── COLORS
% │ ├── BLOCKS
% │ └── BACKGROUND
% ├──┐CONTENT
% │ ├── ADJUSTIMAGE
% │ ├── COLUMNS
% │ ├── SIUNITX
% │ ├── TABULARRAY
% │ └── NOTES
% ├──┐SINGLE SLIDES
% │ ├── TITLE
% │ ├── OUTLINE
% │ ├── SECTION
% │ ├── PLACEHOLDER
% │ ├── REFERENCES
% │ └── THANK YOU
% │
% └───────────────────────────────────────────────────────────────
% ################################################################ DEPENDENCIES
% add pictures
\RequirePackage{adjustbox}
% language
% must be set before biblatex
\RequirePackage[american]{babel}
% break long urls
% must be set before biblatex
\RequirePackage{xurl}
% bibliography generator
\RequirePackage[backend=biber,ibidtracker=constrict,parentracker=true,sorting=nyt,style=apa]{biblatex}
% faster compilation and bookmark creation
% loads hyperref
\RequirePackage{bookmark}
% customizes quotes
% required by babel
\RequirePackage{csquotes}
% cannot load enumitem with beamer class
%\RequirePackage{enumitem}
% append to existing commands
\RequirePackage{etoolbox}
% custom font
\RequirePackage{fontspec}
% better word spacing and typographic improvements
\RequirePackage{microtype}
% spacing
\RequirePackage{setspace}
% format numbers
\RequirePackage{siunitx}
% better tables
\RequirePackage{tabularray}
% background color in titlepage
\RequirePackage{tikz}
% math font
\RequirePackage{amsmath}
\RequirePackage[math-style=ISO,bold-style=ISO]{unicode-math}
% ################################################################ GENERAL
% ################################ COMMANDS
\providecommand{\multilinecomment}[1]{}
\newcommand{\source}[1]{\caption*{\textbf{Source:} #1}}
\newcommand{\startItem}[1]{\textbf{#1:}}
% constant 0.05\textwidth separator in "columns" environment
\newcommand{\half}{ \column{0.4750\textwidth}} % use 2 times
\newcommand{\third}{ \column{0.3000\textwidth}} % use 3 times
\newcommand{\fourth}{\column{0.2125\textwidth}} % use 4 times
% ################################ LENGTHS
\newlength{\lrmargin}
\setlength{\lrmargin}{5mm}
% appear in slides if not set manually below
\newlength{\figuremaxheight}
\setlength{\figuremaxheight}{0.6\textheight}
% internal block padding
%\newlength{\blockpadding}
%\setlength{\blockpadding}{1mm}
%\onehalfspacing
% ################################################################ BEAMER
% ################################ OTHER THEMES
\usecolortheme{default}
\usefonttheme{structurebold}
\useinnertheme{tcolorbox}
\useoutertheme{default}
% ################################ TRANSPARENCY
% semi transparent overlays with \pause
\setbeamercovered{transparent}
% ################################ NAVIGATION
% hide symbols, must be added outside of the frame environment (e.g. inside group)
\setbeamertemplate{navigation symbols}{}
%\setbeamertemplate{navigation symbols}{\insertslidenavigationsymbol}
% vertical mode
% https://tex.stackexchange.com/a/294670/213962
% hide headline
%\setbeamertemplate{headline}{}
% show page number
%\setbeamertemplate{footline}[page number]
%\setbeamerfont{footline}{parent={normal text},size=\tiny}
% ################################ ITEMS
%setbeamertemplate{itemize items}{>}
%\setbeamertemplate{itemize items}[square]
\setbeamertemplate{itemize item}[circle]
\setbeamertemplate{itemize subitem}[circle]
\setbeamertemplate{itemize subsubitem}[circle]
% for smaller lists
%\setbeamertemplate{itemize/enumerate body begin}{\small}
%\setbeamertemplate{itemize/enumerate subbody begin}{\tiny}
% ################################ MARGINS
% ################ HORIZONTAL
% 10mm left and right for content, not frame titles
\setbeamersize{
text margin left=\lrmargin,
text margin right=\lrmargin
}
% ################ VERTICAL
% frame type t: 5mm top flexible bottom
% https://tex.stackexchange.com/a/659210/213962
\define@key{beamerframe}{t}[true]{% top
\beamer@frametopskip=5mm \relax% plus .5\paperheight
\beamer@framebottomskip=5mm plus 1fill\relax%
\beamer@frametopskipautobreak=\beamer@frametopskip\relax%
\beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
}
% frame type c: vertically align text 50/50, instead of the original 40/60, used for thank you page and pages with big images
\define@key{beamerframe}{c}[true]{% center aligned
\beamer@frametopskip=0mm plus 1fill\relax%
\beamer@framebottomskip=0mm plus 1fill\relax%
\beamer@frametopskipautobreak=0mm plus .5\paperheight\relax%
\beamer@framebottomskipautobreak=0mm plus .5\paperheight\relax%
}
% frame type v: 5mm top and 5mm bottom, used for title page, allow for \vfill
% initial title page
\define@key{beamerframe}{v}[true]{% full vertical space consumption
\beamer@frametopskip=5mm \relax%
\beamer@framebottomskip=5mm \relax%
\beamer@frametopskipautobreak=\beamer@frametopskip\relax%
\beamer@framebottomskipautobreak=\beamer@framebottomskip\relax%
}
% ################################ COLORS
% colors are overriden by variables file
\definecolor{PresentationPrimaryColor}{HTML}{000000}
\definecolor{PresentationSecondaryColor}{HTML}{000000}
% normal text color, default black
\setbeamercolor{normal text}{fg=PresentationSecondaryColor}
% \alert color, default red
\setbeamerfont{alerted text}{series=\bfseries}
%\setbeamercolor{alerted text}{fg=PresentationPrimaryColor}
\setbeamercolor{alerted text}{fg=PresentationSecondaryColor}
% title frame, \itemize and \tableofcontents color, default blue
\setbeamercolor{structure}{fg=PresentationPrimaryColor}
% section titles
%\setbeamercolor{section title}{fg=white}
%\setbeamerfont{section title}{size=\Huge,series=\bfseries}
% frame title
%\setbeamercolor{frametitle}{fg=PresentationPrimaryColor}
%\setbeamercolor{frametitle}{fg=white,bg=PresentationPrimaryColor}
%\setbeamerfont{frametitle}{size=\LARGE}
\addtobeamertemplate{frametitle}{% before
}{% after
%\usebeamercolor[fg]{alerted text}%
\hspace{-\lrmargin}\rule{0.5\paperwidth}{0.5mm}%
\vspace{-0.5\baselineskip}
}
% figures
\setbeamertemplate{caption}[numbered]
\numberwithin{figure}{section}
\numberwithin{table}{section}
\setbeamercolor{caption name}{parent=normal text}
\setbeamerfont{caption name}{series=\bfseries}
% ################################ BLOCKS
% use rounded blocks
%\setbeamertemplate{blocks}[rounded]
% disable gradient in rounded blocks
\pgfdeclareverticalshading[lower.bg,upper.bg]{bmb@transition}{200mm}{
color(0mm)=(upper.bg);
color(2mm)=(upper.bg);
color(4mm)=(upper.bg)
}
% primary color
%\setbeamercolor{block title}{use=structure,fg=white,bg=PresentationPrimaryColor}
%\setbeamercolor{block body}{use=normal text,bg=PresentationSecondaryColor!05}
% secondary color
\setbeamercolor{block title}{fg=PresentationSecondaryColor!05,bg=PresentationSecondaryColor}
\setbeamercolor{block body}{fg=PresentationSecondaryColor,bg=PresentationSecondaryColor!05}
\AtBeginEnvironment{block}{
\setbeamercolor{item projected}{fg=PresentationSecondaryColor!05,bg=PresentationSecondaryColor}
}
% ################################ BACKGROUND
% foreground to background: frame > background > canvas
% used in background
\newcommand{\backgroundImage}[1]{
\begin{tikzpicture}[remember picture, overlay]
\node[
opacity=#1,
anchor=center,
]
(bg) at (current page.south west)
{\adjustimage{width=0.7\paperwidth}{\universityLogoBgPresentation}};
\end{tikzpicture}
}
% set recurring background image for normal slides, otherwise they are white
%\setbeamertemplate{background}{\backgroundImage{0.05}}
% set canvas and background for colorful slides
\newenvironment{canvasColor}{%
\begingroup
% canvas color
\setbeamercolor{background canvas}{bg=PresentationPrimaryColor}
% background image
\setbeamertemplate{background}{\backgroundImage{0.2}}
% frame content
\setbeamercolor{normal text}{fg=white}
\usebeamercolor[fg]{normal text}
}{%
\endgroup
}
% ################################################################ CONTENT
% ################################ ADJUSTIMAGE
\newenvironment{outerImage}{
\begin{figure}[ht]
\centering
}{
\end{figure}
}
\newcommand{\innerImageOne}[2]{
% arguments: 1 image id (no spaces), 2 image name
\adjustimage{width=\textwidth,max height=\figuremaxheight,keepaspectratio}{#1}
%\caption{#2}
%\label{#1}
}
% ################################ COLUMNS
% predefined column environments
\newenvironment{outerColumns}{
\begin{columns}[T]
}{
\end{columns}
}
\newcommand{\innerColumnsTwo}[2]{
\half
#1
\half
#2
}
\newcommand{\innerColumnsThree}[3]{
\third
#1
\third
#2
\third
#3
}
\newcommand{\innerColumnsFour}[4]{
\fourth
#1
\fourth
#2
\fourth
#3
\fourth
#4
}
% ################################ SIUNITX
\sisetup{
group-minimum-digits=4,
mode=match,
propagate-math-font=true,
reset-math-version=false,
reset-text-family=false,
reset-text-series=false,
text-family-to-math=true,
text-series-to-math=true
}
% ################################ TABULARRAY
\newenvironment{outerTable}{
\begin{table}[ht]
\centering
}{
\end{table}
}
\NewTblrEnviron{innerTable}
\SetTblrInner[innerTable]{
baseline=T,
hspan=even,
vspan=even,
stretch=1.1,
rows={font=\small},
row{1}={font=\bfseries},
hline{1,Z}={0.4mm},
hline{2}={0.2mm}
}
% used for matrix with lists inside
%\UseTblrLibrary{varwidth}
% ################################ NOTES
% print notes of current slide
\setbeamercolor{note date}{fg=white}
\setbeamercolor{note title}{bg=white, fg=PresentationPrimaryColor}
\setbeamercolor{note page}{bg=white}
\setbeamerfont{note page}{size=\tiny}
% from beamerouterthemedefault.sty, remove presentation title and subsection, make slide larger (search for .35 and .65)
% https://tex.stackexchange.com/a/159607/213962
\makeatletter
\defbeamertemplate*{note page}{masterthesis}
{%
{%
\usebeamerfont{note title}\usebeamercolor[fg]{note title}%
\ifbeamercolorempty[bg]{note title}{}{%
\insertvrule{.35\paperheight}{note title.bg}%
\vskip-.35\paperheight%
\nointerlineskip%
}%
\vbox{
\hfill\insertslideintonotes{0.35}\hskip-\Gm@rmargin\hskip0pt%
\vskip-0.35\paperheight%
\nointerlineskip
}
\nointerlineskip
\vbox to .35\paperheight{\vskip0.5em
% section
\hbox{\insertsection}
% frame title
\setbox\beamer@tempbox=\hbox{\insertshortframetitle}%
\hbox{\ifdim\wd\beamer@tempbox>1pt{\hskip4pt\raise3pt\hbox{\vrule
width0.4pt height7pt\vrule width 9pt
height0.4pt}}\hskip1pt\hbox{\insertshortframetitle[width=7cm]}\fi%
}%
\vfil}%
}%
\ifbeamercolorempty[bg]{note page}{}{%
\nointerlineskip%
\insertvrule{.65\paperheight}{note page.bg}%
\vskip-.65\paperheight%
}%
\vskip.25em
\nointerlineskip
\insertnote
}
\makeatother
% https://tex.stackexchange.com/a/425060/213962
\addtobeamertemplate{note page}{
\setbeamertemplate{itemize item}[circle]
\setbeamertemplate{itemize subitem}[circle]
\setbeamertemplate{itemize subsubitem}[circle]
\setbeamertemplate{itemize/enumerate body begin}{\tiny}
\setbeamerfont{itemize/enumerate body}{size=\tiny}
\setbeamerfont{itemize/enumerate subbody}{size=\tiny}
\setbeamerfont{itemize/enumerate subsubbody}{size=\tiny}
}{}
% ################################################################ SINGLE SLIDES
% ################################ TITLE
\setbeamertemplate{title page}{
% white logos
\adjustimage{height=16mm}{\universityLogoFgPresentation} \hfill
\adjustimage{height=16mm}{\departmentLogoFgPresentation} \\
% text
\centering
\small
\vfill
\parbox[b]{0.7\textwidth\relax}{\centering\textbf{\Large\thesisTitle}}%
\vfill
\textbf{Supervisor \hfill Candidate} \\
\supervisorName{} \hfill \authorName{} \\
\hfill \authorMatriculation{} \\
\vfill
\graduationDate{} \\% "\\" are needed for centering
}{}
\newcommand{\addTitleSlide}{
\begin{canvasColor}
\setbeamertemplate{navigation symbols}{}
\begin{frame}[v,plain] % noframenumbering
\titlepage
\end{frame}
\end{canvasColor}
}
% ################################ OUTLINE
\newcommand{\addOutlineSlide}{
\begin{frame}[plain]{Outline} % noframenumbering
\tableofcontents
% split toc in two columns
%\begin{columns}
% \half
% \tableofcontents[sections={1-5}]
% \half
% \tableofcontents[sections={6-10}]
%\end{columns}
\end{frame}
}
% ################################ SECTION
% 40-60 with double external margins and single internal margin
\setbeamertemplate{section page}{
%\backgroundColor
\begin{columns}
\column{0.40\textwidth}
\hspace{\lrmargin}
\begin{tikzpicture}[baseline=(char.center)]
\node[
shape=circle,
fill=white,
text=PresentationPrimaryColor,
minimum size=\dimexpr\textwidth-4\lrmargin\relax,
%minimum size=\dimexpr\textwidth-2\lrmargin\relax,
font=\fontsize{65}{65}\bfseries\selectfont,
]
(char)
{\thesection};
\end{tikzpicture}
\column{0.60\textwidth}
\Huge\bfseries\insertsection\\
%\rule[0.5\baselineskip]{\dimexpr\textwidth-\lrmargin\relax}{1mm}
\rule[0.3\baselineskip]{\dimexpr\textwidth-\lrmargin\relax}{1mm}
\end{columns}
}
% dedicate section page
\AtBeginSection{
\begin{canvasColor}
\setbeamertemplate{navigation symbols}{}
\begin{frame}[c,plain] % noframenumbering
\sectionpage
\end{frame}
\end{canvasColor}
}
% ################################ PLACEHOLDER
\newcommand{\addPlaceholderSlide}[1]{
{
\setbeamercolor{frametitle}{fg=orange}
\begin{frame}{This slide is work in progress}
%\color{PresentationPrimaryColor}#1
\large\textbf{#1}
\end{frame}
}
}
\let\todo\addPlaceholderSlide
% ################################ REFERENCES
% hide entry icon
\setbeamertemplate{bibliography item}{}
\newcommand{\addReferencesSlide}{
\section*{References}
% keep it short, so there is no need for allowframebreaks
%\begin{frame}[allowframebreaks]{References}
\begin{frame}{References}
\printbibliography[heading=none]
\end{frame}
}
% ################################ THANK YOU
\newcommand{\addThankYouSlide}{
\begin{canvasColor}
\setbeamertemplate{navigation symbols}{}
\begin{frame}[c,plain]
\centering
\Huge
\bfseries
Thank you
\end{frame}
\end{canvasColor}
}