-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpresentation.cls
More file actions
240 lines (210 loc) · 7.16 KB
/
presentation.cls
File metadata and controls
240 lines (210 loc) · 7.16 KB
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
%% presentation.tex
%% Copyright 2023 Tom M. Ragonneau
%
% 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 Tom M. Ragonneau.
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{presentation}[2023/01/26 Beamer document class of Tom M. Ragonneau]
\RequirePackage{ifthen}
\newboolean{nogiturl}
\setboolean{nogiturl}{false}
\DeclareOption{nogiturl}{\setboolean{nogiturl}{true}}
\newboolean{nolicense}
\setboolean{nolicense}{false}
\DeclareOption{nolicense}{\setboolean{nolicense}{true}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{beamer}}
\ProcessOptions\relax
\LoadClass[10pt,xcolor=dvipsnames]{beamer}
\RequirePackage[T1]{fontenc}
\RequirePackage[english]{babel}
\RequirePackage{csquotes}
\RequirePackage{ifdraft}
% Manage frame numbering in appendices
\RequirePackage{appendixnumberbeamer}
% Extra tools for LaTeX
\RequirePackage{etoolbox}
% Load theme
\usetheme{metropolis}
\metroset{
titleformat=regular,
numbering=fraction,
progressbar=frametitle,
block=fill,
}
% Fonts
\setsansfont{FiraSans}[
Path=fonts/fira-sans/,
Extension=.otf,
UprightFont=*-Light,
BoldFont=*-Regular,
ItalicFont=*-LightItalic,
BoldItalicFont=*-Italic,
]
\setmonofont{FiraMono}[
Path=fonts/fira-mono/,
Extension=.otf,
UprightFont=*-Regular,
BoldFont=*-Bold,
]
% Reduce margins
\setbeamersize{
text margin left=0.75\beamer@leftmargin,
text margin right=0.75\beamer@rightmargin,
}
% Patch `Overfull \vbox (... too high)' in title page
\RequirePackage{tikz}
\RequirePackage{pgfplots}
\usetikzlibrary{angles,quotes,arrows,arrows.meta}
\usetikzlibrary{positioning}
\usetikzlibrary{patterns}
\def\titlepage{\usebeamertemplate{title page}}
\setbeamertemplate{title graphic}{
\begin{tikzpicture}[overlay,remember picture]
\node[below left=2em and \beamer@rightmargin of current page.north east] {\inserttitlegraphic};
\end{tikzpicture}
}
% Patch `Token not allowed in a PDF string (Unicode)' in appendix
\pdfstringdefDisableCommands{\def\translate#1{#1}}
% Change theme colors
\definecolor{VeniceBlue}{HTML}{2F5675}
\definecolor{RobRoy}{HTML}{DAAD49}
\definecolor{FernGreen}{HTML}{4F7942}
\setbeamercolor{normal text}{fg=VeniceBlue!70!black,bg=black!2}
\setbeamercolor{alerted text}{fg=RobRoy!60!black}
\setbeamercolor{example text}{fg=FernGreen!95!black}
% Change theme templates
\setbeamertemplate{section in toc}[sections numbered]
% Font for mathematics
\usefonttheme{professionalfonts}
% Font for standout frames
\setbeamerfont{standout}{size=\normalsize}
% Customize blocks, alert blocks, and example blocks
\renewcommand{\metropolis@block}[1]{
\par\vskip\medskipamount%
\setlength{\parskip}{0pt}
\ifdefempty{\insertblocktitle}{}{
\ifbeamercolorempty[bg]{block title#1}{%
\begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}}{%
\ifbeamercolorempty[bg]{block title}{%
\begin{beamercolorbox}[rightskip=0pt plus 4em]{block title#1}%
}{%
\begin{beamercolorbox}[
sep=\dimexpr\metropolis@blocksep-\metropolis@blockadjust\relax,
leftskip=\metropolis@blockadjust,
rightskip=\dimexpr\metropolis@blockadjust plus 4em\relax,
]{block title#1}%
}}%
\usebeamerfont*{block title#1}%
\metropolis@strut%
\insertblocktitle%
\metropolis@strut%
\end{beamercolorbox}%
\nointerlineskip%
}%
\ifbeamercolorempty[bg]{block body#1}{%
\begin{beamercolorbox}[vmode]{block body#1}}{
\ifbeamercolorempty[bg]{block body}{%
\begin{beamercolorbox}[vmode]{block body#1}%
}{%
\begin{beamercolorbox}[sep=\metropolis@blocksep, vmode]{block body#1}%
\vspace{-\metropolis@parskip}
}}%
\usebeamerfont{block body#1}%
\setlength{\parskip}{\metropolis@parskip}%
}
% Bibliography
\RequirePackage[
style=ext-authoryear-comp,
articlein=false,
sortcites=false,
maxcitenames=3,
]{biblatex}
\setbeamertemplate{bibliography item}[triangle]
\DeclareNameAlias{author}{family-given}
\setlength{\bibitemsep}{\itemsep}
\setbeamertemplate{frametitle continuation}{}
% Path relative to the main .tex file
\graphicspath{{./images/}}
% Support for license
\RequirePackage[
type={CC},
modifier={by-sa},
version={4.0},
hyperxmp=false,
]{doclicense}
\apptocmd{\doclicenseLongName}{license}{}{}
% Support for mathematics
\RequirePackage{maths}
% Algorithm environment
% \usepackage[section]{algorithm}
% \usepackage{listings}
% \usepackage{algpseudocode,algorithmicx,algcompatible}
% \newcommand{\INPUT}{\textbf{Input}}
% \newcommand{\FOR}{\textbf{For}~}
% \algrenewcommand\algorithmicrequire{\textbf{Input:}}
% \algrenewcommand\algorithmicensure{\textbf{Output:}}
% \algrenewcommand\alglinenumber[1]{\normalsize #1.}
% \newcommand*\Let[2]{\State #1 $=$ #2}
\usepackage[
linesnumberedhidden,ruled,vlined
%linesnumbered
]{algorithm2e}
\resetcounteronoverlays{algocf}
% QR codes
\ifdraft{\PassOptionsToPackage{draft}{qrcode}}{}
\usepackage[nolinks]{qrcode}
\qrset{level=Q,version=3} % Up to 47 alphanumeric characters
% Make QR codes clickable (the document is compiled with XeLaTeX)
\setlength{\XeTeXLinkMargin}{1pt}
\let\oldqrcode\qrcode\relax
\def\qrcode#1{\href{#1}{\XeTeXLinkBox{\oldqrcode{#1}}}}
% The following sets
% - \giturl to the complete url of the git repository
% - \giturlshort to the short url of the git repository
% It assumes that
% - the current project is a (well-formed) git repository, and
% - the command `git' is installed and accessible.
\RequirePackage{trimspaces}
% \newread\giturlstream
% \openin\giturlstream=|"./build_tools/giturl.sh"
% \read\giturlstream to \giturl
% \closein\giturlstream
% \trim@spaces@in\giturl
% \def\setgiturlshort#1://#2/\relax{\def\giturlshort{#2}}
% \expandafter\setgiturlshort\giturl\relax
% Add a license frame at the end of the presentation
\ifthenelse{\boolean{nolicense}}{}{
\AtEndDocument{
\begin{frame}[standout]
This work is licensed under a \doclicenseLongNameRef.
\begin{center}
\upshape\doclicenseImage[imagewidth=0.3\textwidth]
\end{center}
\bigskip
\ifthenelse{\boolean{nogiturl}}{}{
The source code of this presentation is available at
\begin{center}
\normalfont\href{\giturl}{\texttt{\giturlshort}}.
\end{center}
}
It is based on the metropolis Beamer theme, available at
\begin{center}
\normalfont\href{https://github.com/matze/mtheme/}{\texttt{github.com/matze/mtheme}}.
\end{center}
\end{frame}
}
}
\usepackage[bb=dsfontserif]{mathalpha}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{caption}
\captionsetup[figure]{labelformat=empty}
\usepackage[capitalize]{cleveref}