-
Notifications
You must be signed in to change notification settings - Fork 1
/
WeSTpresentation.cls
422 lines (361 loc) · 13.8 KB
/
WeSTpresentation.cls
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
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{WeSTpresentation}[2020/07/30 v1.1 WeSTpresentation]
% ==============================================================================
% Document Class
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{beamer}}
\ProcessOptions\relax
\LoadClass[
12pt, % Do not put to much stuff on a slide. Decrease this if you must.
compress, % Show all frames of a section in a single row if a navbar exists
]{beamer}
% ==============================================================================
% Packages
\newcommand*\RequireOptionsPackage[2][]{
\PassOptionsToPackage{#1}{#2}
\RequirePackage{#2}
}
\RequirePackage{ifluatex}
\ifluatex
% Lua(La)TeX
% Language typesetting.
\RequirePackage{polyglossia}
% Font selection.
\RequirePackage{fontspec}
\setsansfont{TeX Gyre Heros} % Sans-serif
% Unicode support for math. Load after other math/font packages.
\RequirePackage{unicode-math}
% Patches a few math packages to work correctly with LuaLaTeX.
\RequirePackage{lualatex-math}
\fi
% Micro-typographic extensions.
\RequirePackage{microtype}
% Various useful tools for mathematical typesetting.
\RequirePackage{mathtools}
% Quotations.
\RequirePackage{csquotes}
% Tables
%\usepackage{booktabs}
\RequirePackage{tabu}
% Pseudocode
\RequireOptionsPackage[
noend % Omits end statements in algorithms
]{algpseudocode}
% Source Code Listings
\RequirePackage{listings}
% Bibliography.
\RequireOptionsPackage[
backend = biber, % use biber as backend
style = authoryear-comp,
maxbibnames = 10, % max number of names in bibliography
maxcitenames = 2, % max number of names in text cite
uniquelist = minyear, % only add more authors if year is not unique
labeldateparts = true,
uniquename = init,
giveninits = true, % abbreviate first name of authors
doi = false, % do not show doi
isbn = false, % do not show isbn
eprint = false, % do not show eprint
urldate = long, % format of urldate field
]{biblatex}
\RequirePackage{silence, lmodern}
% Filter warnings issued by biblatex starting with "Patching footnotes failed"
% see https://tex.stackexchange.com/a/202994/75225
\WarningFilter{biblatex}{Patching footnotes failed}
% ==============================================================================
% Theme
% Disable navigation symbols in the bottom left.
\beamertemplatenavigationsymbolsempty
% No double space after end of sentences.
\frenchspacing
% Show navigational bar on the top with little circles for each slide.
% (We redefine the relevant themes later, but we need this theme for spacing.)
\useoutertheme[
subsection = false, % Do not leave a separate line to name subsections.
footline = authorinstitute, % Show author and institute in a footline.
]{miniframes}
% Number items in the outline.
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]
% Use circles as itemize list items.
\setbeamertemplate{itemize items}[circle]
% Fonts ------------------------------------------------------------------------
\usefonttheme{professionalfonts} % Do not do some math font replacements.
\setbeamerfont{title}{series = \bfseries} % Make title of titlepage bold.
\setbeamerfont{subtitle}{series = {}} % Make subtitle of titlepage normal.
\setbeamerfont{frametitle}{series = \bfseries} % Make titles of slides bold.
\setbeamerfont{footline}{size = \tiny} % Font size of footline.
\setbeamerfont{author in head/foot}{parent = footline}
\setbeamerfont{date in head/foot}{parent = footline}
\setbeamerfont{framenumber in head/foot}{parent = footline, series = \bfseries} % Make framenumber bold.
% Colors -----------------------------------------------------------------------
\definecolor{WeSTblue}{HTML}{0C3875}
\definecolor{WeSTorange}{HTML}{FFAE00}
\definecolor{WeSTred}{HTML}{DD4814}
\definecolor{WeSTgray}{HTML}{D9D9D9}
\usecolortheme[named = WeSTblue]{structure} % General theme color.
\setbeamercolor{mini frame}{fg=WeSTblue} % Color of bullets in navigation bar
\setbeamercolor{lower separation line head}{bg = WeSTorange}
\setbeamercolor{lower separation line head 2}{bg = WeSTgray}
\setbeamercolor{footline}{fg = black, bg = WeSTgray} % Colors of footline.
\setbeamercolor{author in head/foot}{parent = footline}
\setbeamercolor{date in head/foot}{parent = footline}
\setbeamercolor{framenumber in head/foot}{parent = footline, fg = white, bg = WeSTorange} % Accentuate framenumber by color.
\setbeamercolor{alerted text}{fg = WeSTred} % Color of alerted text.
\setbeamercolor{section in toc}{fg = WeSTblue} % Color of outline numbers.
\setbeamercolor{subsection in toc}{fg = WeSTblue} % Color of outline numbers.
\setbeamercolor{block title}{fg = WeSTblue} % Color of block titles.
% \setbeamercolor{block title example}{fg = WeSTblue} % Color of block titles of examples.
\hypersetup{
colorlinks, % Colorize links.
urlcolor = WeSTblue, % Color for extern url links.
linkcolor = WeSTblue, % Color for intern links like "Section 2".
citecolor = WeSTblue, % Color for links in citations.
}
% Normal Frame -----------------------------------------------------------------
% Headline.
\let\WeSTheadline\relax
\defbeamertemplate{headline}{WeSTnormal}{%
\hbox{%
\begin{beamercolorbox}[wd = .83\paperwidth, ht = .4cm]{section in head/foot}
\ifundef{\WeSTheadline}{%
\insertnavigation{.83\paperwidth}\vskip2pt%
}{%
\vspace{.18cm}%
\hspace{1em}\WeSTheadline%
}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd = .165\paperwidth, ht = .4cm, right]{section in head/foot}%
\vspace{.05cm}%
\includegraphics[height = .4cm]{logo_west_small}%
\end{beamercolorbox}%
}%
\begin{beamercolorbox}[colsep=.7pt]{lower separation line head}%
\end{beamercolorbox}%
\begin{beamercolorbox}[colsep=.7pt]{lower separation line head 2}%
\end{beamercolorbox}%
}
% Footline.
\newcommand*\WeSTfootlineLeft{\insertshortauthor}
\newcommand*\WeSTfootlineCenter{\insertshortdate}
\defbeamertemplate{footline}{WeSTnormal}{%
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd = .40\paperwidth, ht = 2.25ex, dp = 1ex, left]{author in head/foot}%
\hspace{1em}\usebeamerfont{author in head/font}\WeSTfootlineLeft
\end{beamercolorbox}%
\begin{beamercolorbox}[wd = .20\paperwidth, ht = 2.25ex, dp = 1ex, center]{date in head/foot}%
\usebeamerfont{date in head/font}\WeSTfootlineCenter
\end{beamercolorbox}%
\begin{beamercolorbox}[wd = .23\paperwidth, ht = 2.25ex, dp = 1ex, right]{author in head/foot}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd = .17\paperwidth, ht = 2.25ex, dp = 1ex, center]{framenumber in head/foot}%
\usebeamerfont{framenumber in head/foot}\insertframenumber
\end{beamercolorbox}%
}%
\vskip0pt%
}
% Define normal frame style.
\BeforeBeginEnvironment{frame}{%
\setbeamertemplate{headline}[WeSTnormal]%
\setbeamertemplate{footline}[WeSTnormal]
\setbeamertemplate{frametitle}[default]
}
% Fancy Frame ------------------------------------------------------------------
% This frame style is used for title and section pages.
% Headline.
\defbeamertemplate{headline}{WeSTfancy}{%
\includegraphics[width = \paperwidth]{bg}
}
% Footline.
\defbeamertemplate{footline}{WeSTfancy}{%
\vspace{-1.7cm}
{\begin{center}\includegraphics[width = 0.33\paperwidth]{logo_west}\end{center}}%
\vspace{-.2cm}
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd = \paperwidth, ht = 2.25ex, dp = 1ex, right]{footline}%
\end{beamercolorbox}%
}%
\vskip0pt%
}
% Frame Title.
\defbeamertemplate{frametitle}{WeSTfancy}{%
\vspace{2.3cm} % Move title down to account for fancy headline.
\setbeamertemplate{frametitle}[default][center] % Center title.
\usebeamertemplate***{frametitle}
}
% Define fancy frame style.
\define@key{beamerframe}{WeSTfancy}[true]{%
\setbeamertemplate{headline}[WeSTfancy]%
\setbeamertemplate{footline}[WeSTfancy]%
\setbeamertemplate{frametitle}[WeSTfancy]
}
% Title Page -------------------------------------------------------------------
\setbeamertemplate{title page}{%
\vspace{-.3cm}
\vbox{}
\vfill
\begingroup
\centering
\begin{beamercolorbox}[sep=8pt,center]{title}
\usebeamerfont{title}\inserttitle\par%
\ifx\insertsubtitle\@empty%
\else%
\vskip0.25em%
{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
\fi%
\end{beamercolorbox}%
\vskip.8em\par
\begin{beamercolorbox}[sep=3pt,center]{author}
\usebeamerfont{author}\insertauthor
\end{beamercolorbox}
\begin{beamercolorbox}[sep=3pt,center]{institute}
\usebeamerfont{institute}\insertinstitute
\end{beamercolorbox}
\begin{beamercolorbox}[sep=6pt,center]{date}
\usebeamerfont{date}\insertdate
\end{beamercolorbox}\vskip0.3em
{\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par}
\endgroup
\vfill
}
% Subsection page --------------------------------------------------------------
\setbeamertemplate{subsection page}{%
\begingroup
\centering
{\usebeamerfont{subsection name}\usebeamercolor[fg]{subsection name}\subsectionname~\insertsectionnumber.\insertsubsectionnumber}
\vskip1em\par
\begin{beamercolorbox}[sep=8pt,center]{part title}
\usebeamerfont{subsection title}\insertsubsection\par
\end{beamercolorbox}
\endgroup
}
% Bibliography -----------------------------------------------------------------
% Last names before first names: http://tex.stackexchange.com/q/113573
\DeclareNameAlias{sortname}{family-given}
\DeclareNameAlias{default}{family-given}
% Author lastnames in small caps, but only in bibliography not in the citation.
% Note: last-first renamed to family-given to reflect updated BibLaTeX
% terminology.
\AtBeginBibliography{
\renewcommand\mkbibnamelast[1]{\textsc{#1}}
}
% Decrease bibliography font size.
\def\bibfont{\small}
% Vertical space between bibliography entries.
\setlength\bibitemsep{0.8em}
% Indent after first line on bibliography entries
\setlength\bibhang{1em}
% Have URLs for specific entries.
% see http://tex.stackexchange.com/a/152971/75225
\DeclareBibliographyCategory{needsurl}
\newcommand{\entryneedsurl}[1]{\addtocategory{needsurl}{#1}}
\renewbibmacro*{url+urldate}{%
\ifcategory{needsurl}{
\printfield{url}%
\iffieldundef{urlyear}
{}
{\setunit*{\addspace}%
\printurldate}}
{}}
% Navigation Bar ---------------------------------------------------------------
% Fixes the navigation bar so that it also works without subsections.
% see http://tex.stackexchange.com/a/215948
\pretocmd\sectionentry{%
\let\ifhadanonsubsecn\@secondoftwo
}{}{\@error{unable to patch \string\sectionentry}{}}
%\patchcmd\slideentry{%
% \ifnum#2>0%
%}{%
% \ifnum2>0%
%}{}{\@error{unable to patch \string\slideentry}{}}
\patchcmd\slideentry{%
\beamer@xpos=#3\relax%
\beamer@ypos=#2\relax%
}{%
\ifnum#2=0\relax
\let\ifhadanonsubsecn\@firstoftwo
\fi
\beamer@xpos=#3\relax
\beamer@ypos=#2\relax
\ifhadanonsubsecn{%
\advance \beamer@ypos by1\relax
}{}%
}{}{\@error{unable to patch \string#1}}%
\patchcmd\fakeslideentry{%
\beamer@xpos=#3\relax%
\beamer@ypos=#2\relax%
}{%
\ifnum#2=0\relax
\let\ifhadanonsubsecn\@firstoftwo
\fi
\beamer@xpos=#3\relax
\beamer@ypos=#2\relax
\ifhadanonsubsecn{%
\advance \beamer@ypos by1\relax
}{}%
}{}{\PackageError{patchbeamernav}{unable to patch \string#1}}%
\@addtoreset{subsectionslide}{section}
% Adds commands to exclude certain slides from the navigation bar.
% see http://tex.stackexchange.com/a/45038/75225
\makeatletter
\let\beamer@writeslidentry@miniframeson=\beamer@writeslidentry
\def\beamer@writeslidentry@miniframesoff{%
\expandafter\beamer@ifempty\expandafter{\beamer@framestartpage}{}% does not happen normally
{%else
% removed \addtocontents commands
\clearpage\beamer@notesactions%
}
}
\newcommand*{\miniframeson}{\let\beamer@writeslidentry=\beamer@writeslidentry@miniframeson}
\newcommand*{\miniframesoff}{\let\beamer@writeslidentry=\beamer@writeslidentry@miniframesoff}
\makeatother
% Algorithms -------------------------------------------------------------------
% Make line numbers gray and remove ugly colon (:) behind them
\algrenewcommand{\alglinenumber}[1]{%
\color{WeSTgray}\tiny#1%
}
% Make comments gray
\algrenewcomment[1]{%
\hfill\textcolor{WeSTblue}{\(\triangleright\) #1}%
}
% Add single line comment
% http://tex.stackexchange.com/a/74885/75225
\algnewcommand{\LineComment}[1]{%
\State \textcolor{WeSTblue}{\(\triangleright\) #1}%
}
% Style for keywords
% http://tex.stackexchange.com/a/274708/75225
\newcommand*\AlgKeyword[1]{\textbf{#1}}
\algrenewcommand\algorithmicend{\AlgKeyword{end}}
\algrenewcommand\algorithmicdo{\AlgKeyword{do}}
\algrenewcommand\algorithmicwhile{\AlgKeyword{while}}
\algrenewcommand\algorithmicfor{\AlgKeyword{for}}
\algrenewcommand\algorithmicforall{\AlgKeyword{for all}}
\algrenewcommand\algorithmicloop{\AlgKeyword{loop}}
\algrenewcommand\algorithmicrepeat{\AlgKeyword{repeat}}
\algrenewcommand\algorithmicuntil{\AlgKeyword{until}}
\algrenewcommand\algorithmicprocedure{\AlgKeyword{procedure}}
\algrenewcommand\algorithmicfunction{\AlgKeyword{function}}
\algrenewcommand\algorithmicif{\AlgKeyword{if}}
\algrenewcommand\algorithmicthen{\AlgKeyword{then}}
\algrenewcommand\algorithmicelse{\AlgKeyword{else}}
\algrenewcommand\algorithmicrequire{\AlgKeyword{Input:}} % change "Require" to "Input"
\algrenewcommand\algorithmicensure{\AlgKeyword{Output:}} % change "Ensure" to "Output"
\algrenewcommand\algorithmicreturn{\AlgKeyword{return}}
% Style for identifiers
\newcommand*\AlgIdentifier[1]{#1}
% Listings ---------------------------------------------------------------------
\lstset{
numbers = left,
breaklines = false,
mathescape,
showspaces = false,
showstringspaces = false,
basicstyle = \footnotesize\ttfamily,
numberstyle = \tiny\color{WeSTgray},
commentstyle = \color{WeSTblue},
keywordstyle = \color{WeSTred},
stringstyle = \color{WeSTorange},
numbersep = 1em,
}