Files
latex-templates/Slides/slides.cls
2026-02-10 16:54:57 +01:00

208 lines
6.9 KiB
TeX

\ProvidesClass{slides}[27/01/2025 v1]
\PassOptionsToPackage{dvipsnames}{xcolor}
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{naturalnames}{hyperref}
\LoadClass[aspectratio=169,10pt]{beamer}
% speaker notes
% open pdf in dual screen using pympress (https://github.com/Cimbali/pympress)
% \setbeameroption{show notes on second screen=right}
% listings (should be loaded before csquotes)
\RequirePackage{minted}
% language and encoding
\RequirePackage[french]{babel}
\RequirePackage[T1]{fontenc}
\RequirePackage{csquotes}
% biblatex for references on slides
\RequirePackage[backend=biber]{biblatex}
% clean, short citations in footnotes (cf. https://tex.stackexchange.com/a/587604)
\renewbibmacro{in:}{}
% \AtEveryCitekey{\clearfield{journaltitle}}
\AtEveryCitekey{\clearfield{volume}}
\AtEveryCitekey{\clearfield{number}}
% \AtEveryCitekey{\clearfield{booktitle}}
% \AtEveryCitekey{\clearfield{series}}
\AtEveryCitekey{\clearfield{pages}}
\AtEveryCitekey{\clearfield{month}}
\AtEveryCitekey{\clearlist{publisher}}
\AtEveryCitekey{\clearname{editor}}
\AtEveryCitekey{\clearlist{location}}
\AtEveryCitekey{\clearfield{doi}}
\AtEveryCitekey{\clearfield{isbn}}
\AtEveryCitekey{\clearfield{issn}}
\AtEveryCitekey{\clearfield{eprint}}
\AtEveryCitekey{\clearfield{url}}
\AtEveryCitekey{\clearfield{urlyear}}
\AtEveryCitekey{\clearfield{urlmonth}}
\AtEveryCitekey{\clearfield{urlday}}
% include reference number in citations (cf. https://tex.stackexchange.com/a/176295)
\DeclareCiteCommand{\fullcite}
{\usebibmacro{prenote}}
{{\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{labelnumber}}} %
\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}}
{\multicitedelim}
{\usebibmacro{postnote}}
% captions
\RequirePackage{caption}
\captionsetup{font=scriptsize,labelfont=scriptsize}
% beamer theme
\usetheme{moloch}
\RequirePackage{appendixnumberbeamer}
\RequirePackage{fontspec}
\setsansfont[
ItalicFont={Fira Sans Light Italic},
BoldFont={Fira Sans},
BoldItalicFont={Fira Sans Italic}
]{Fira Sans Light}
\setmonofont[BoldFont={Fira Mono Medium}]{Fira Mono}
% \setmonofont{Fantasque Sans Mono}
\AtBeginEnvironment{tabular}{%
\addfontfeature{Numbers={Monospaced}}
}
% https://steeven9.github.io/USI-LaTeX/html/packages_hyperref_babel_xcolor3.html
% Section 3.2 of:
% https://mirror.ibcp.fr/pub/CTAN/macros/latex/contrib/beamer-contrib/themes/moloch/moloch.pdf
\definecolor{ubo}{HTML}{8c3759}
\setbeamercolor{progress bar}{fg=ubo}
\setbeamercolor{title separator}{fg=ubo}
\setbeamercolor{frametitle}{bg=ubo}
% \setbeamercolor{progress bar}{fg=BrickRed}
% \setbeamercolor{title separator}{fg=BrickRed}
% footnote font size
\setbeamerfont{footnote}{size=\tiny}
% frame numbering font size
\setbeamerfont{footline}{size=\footnotesize}
% solid background for blocks
\molochset{block=fill}
% remove section frames
% \molochset{sectionpage=none}
% enable subsection frames
\molochset{subsectionpage=progressbar}
% table of contents
\setbeamertemplate{section in toc}[sections numbered]
\makeatletter
\patchcmd{\beamer@sectionintoc}{\vskip1.5em}{\vskip0.3em}{}{}
\patchcmd{\beamer@subsectionintoc}{\vskip0.75em}{\vskip0.15em}{}{}
\makeatother
% smaller first-level bullet points
\setbeamertemplate{itemize item}{\textbullet}
% smaller bibliography entries
\renewcommand*{\bibfont}{\scriptsize}
% figures uncover animation (cf. https://tex.stackexchange.com/a/354033/95423)
\setbeamercovered{transparent}
\newcommand<>{\uncovergraphics}[2][{}]{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (B) at (4,0)
{\includegraphics[#1]{#2}};
\alt#3{}{%
\fill [draw=none, fill=palette primary.fg, fill opacity=0.9] (B.north west) -- (B.north east) -- (B.south east) -- (B.south west) -- (B.north west) -- cycle;
}
\end{tikzpicture}
}
% fonts and symbols
\RequirePackage{textcomp}
\RequirePackage{emoji}
% circles
\RequirePackage{circledsteps}
\pgfkeys{/csteps/inner color=white}
\pgfkeys{/csteps/fill color=black}
% markers
\RequirePackage{pifont}
\newcommand{\cmark}{{\color{YellowGreen}\ding{51}}}
\newcommand{\xmark}{{\color{BrickRed}\ding{55}}}
\newcommand{\imark}{{\color{Orange}\ding{109}}}
% pills
\newcommand{\DONE}{%
\CircledParamOpts{inner color=black, outer color=LimeGreen, fill color=LimeGreen}{1}{\textbf{DONE}} %
}
\newcommand{\TODO}{%
\CircledParamOpts{inner color=black, outer color=Goldenrod, fill color=Goldenrod}{1}{\textbf{TODO}} %
}
\newcommand{\FIXME}{%
\CircledParamOpts{inner color=white, outer color=Red, fill color=Red}{1}{\textbf{FIXME}} %
}
% custom font size for a slide (cf. https://tex.stackexchange.com/a/401409)
\RequirePackage{environ}
\newcommand{\customframefont}[1]{
\setbeamertemplate{itemize/enumerate body begin}{#1}
\setbeamertemplate{itemize/enumerate subbody begin}{#1}
}
\NewEnviron{framefont}[1]{
\customframefont{#1} % for itemize/enumerate
{#1 % For the text outside itemize/enumerate
\BODY
}
\customframefont{\normalsize}
}
% math
\RequirePackage{amsmath,amssymb,amsfonts}
% resizebox
\RequirePackage{graphicx}
\RequirePackage{subcaption}
% tables
\RequirePackage{tabularx}
\RequirePackage{booktabs}
% various tabular columns with text wrapping
\newcolumntype{L}{>{\arraybackslash}m{\linewidth}}
\newcolumntype{M}{>{\centering\arraybackslash}m{0.33\linewidth}}
\newcolumntype{Y}{>{\centering\arraybackslash}m{0.15\linewidth}}
\newcolumntype{y}{>{\arraybackslash}m{0.15\linewidth}}
% generic horizontally centered column with line breaks
\newcolumntype{Z}{>{\centering\arraybackslash}X}
% vertical centering of text in all tabularx columns
\renewcommand\tabularxcolumn[1]{m{#1}}
% links
\RequirePackage{hyperref}
% redefine title page
% https://tex.stackexchange.com/a/396409
% Section 6.2.3 of:
% https://ctan.math.illinois.edu/macros/latex/contrib/beamer-contrib/themes/moloch/moloch.pdf
\makeatletter
\setbeamertemplate{title page}{
\begin{minipage}[b][\paperheight]{\textwidth}
% \vfill%
\ifx\inserttitle\@empty\else\usebeamertemplate*{title}\fi
\ifx\insertsubtitle\@empty\else\usebeamertemplate*{subtitle}\fi
\vspace{.2cm}
\ifx\insertdate\@empty\else\usebeamertemplate*{date}\fi
\usebeamertemplate*{title separator}
\vspace{-.2cm}
\begin{columns}[]
\column{0.4\linewidth}
\ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi
\column{0.4\linewidth}
% \begin{table}[]
% \begin{flushleft}
% \small
% \begin{tabular}{ll}
% Rapporteur & Blabla \\
% Rapporteur & Blabla
% \end{tabular}
% \end{flushleft}
% \end{table}
\end{columns}
\begin{columns}[b]
\column{0.4\linewidth}
\ifx\insertinstitute\@empty\else\usebeamertemplate*{institute}\fi
\column{0.5\linewidth}
\vspace{-2cm}
\ifx\inserttitlegraphic\@empty\else\inserttitlegraphic\fi
\end{columns}
\vspace*{.2cm}
\end{minipage}
}
\makeatother