329 lines
11 KiB
TeX
329 lines
11 KiB
TeX
\ProvidesClass{packages/slides}[2025/01/27 v1]
|
|
|
|
\PassOptionsToPackage{dvipsnames, table}{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}
|
|
\setmintedinline{breaklines, breakanywhere, breakanywheresymbolpre={}}
|
|
|
|
% language and encoding
|
|
\RequirePackage[french]{babel}
|
|
\RequirePackage{packages/lab-common}
|
|
|
|
% 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}
|
|
% do not prepend "Figure X:" in captions
|
|
\captionsetup[figure]{labelformat=empty}
|
|
|
|
% beamer theme
|
|
\usetheme{moloch}
|
|
\RequirePackage{appendixnumberbeamer}
|
|
\RequirePackage{fontspec}
|
|
\setsansfont[
|
|
Extension=.otf,
|
|
UprightFont=*-Regular,
|
|
ItalicFont=*-Italic,
|
|
BoldFont=*-SemiBold,
|
|
BoldItalicFont=*-SemiBoldItalic
|
|
]{IBMPlexSans}
|
|
\setmonofont[
|
|
Extension=.otf,
|
|
UprightFont=*-Regular,
|
|
ItalicFont=*-Italic,
|
|
BoldFont=*-SemiBold,
|
|
BoldItalicFont=*-SemiBoldItalic
|
|
]{IBMPlexMono}
|
|
% \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}{5e548e}
|
|
\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}
|
|
% footer bar: author | short title, section and dots | frame count
|
|
% Set the short names with \author[short]{...} and \title[short]{...}.
|
|
\setbeamerfont{footline}{size=\fontsize{6}{7.5}\selectfont}
|
|
\setbeamercolor{footline}{
|
|
use=normal text,
|
|
fg=normal text.fg!80!normal text.bg,
|
|
bg=ubo!10!normal text.bg
|
|
}
|
|
\setbeamercolor{footline frame count}{fg=white, bg=ubo}
|
|
% The left inset matches the frame title. The depth centres the capitals.
|
|
\newcommand*{\slides@footinset}{7.7pt}
|
|
\newcommand*{\slides@footheight}{7.6pt}
|
|
\newcommand*{\slides@footdepth}{3.4pt}
|
|
\newcommand*{\slides@footmaxdots}{20}
|
|
% Count the frames of each section as they are typeset. The totals come from
|
|
% the aux file, so the dots are complete from the second compilation onwards.
|
|
% The template runs several times per frame, hence the comparison with the
|
|
% previous frame. It also runs for plain frames, such as section pages, which
|
|
% have no footer and do not count. \part and \appendix restart the section numbers.
|
|
\newcount\slides@footframe
|
|
\gdef\slides@footlastsection{}
|
|
\gdef\slides@footlastframe{}
|
|
\newcommand*{\slides@sectionframes}[2]{\global\@namedef{slides@frames@#1}{#2}}
|
|
\newcommand*{\slides@footcount}{%
|
|
\ifbeamer@plainframe\else\slides@footcountframe\fi
|
|
}
|
|
\newcommand*{\slides@footcountframe}{%
|
|
\edef\slides@footcurrent{\the\c@part-\the\c@section}%
|
|
\ifx\slides@footcurrent\slides@footlastsection\else
|
|
\global\let\slides@footlastsection\slides@footcurrent
|
|
\global\slides@footframe=0\relax
|
|
\gdef\slides@footlastframe{}%
|
|
\fi
|
|
\edef\slides@footcurrent{\the\c@framenumber}%
|
|
\ifx\slides@footcurrent\slides@footlastframe\else
|
|
\global\let\slides@footlastframe\slides@footcurrent
|
|
\global\advance\slides@footframe by 1\relax
|
|
\if@filesw
|
|
\immediate\write\@auxout{\string\slides@sectionframes
|
|
{\slides@footlastsection}{\the\slides@footframe}}%
|
|
\fi
|
|
\fi
|
|
}
|
|
% Dots for the frames of the section, with a count when there are too many.
|
|
\newcommand*{\slides@footdots}{%
|
|
\edef\slides@foottotal{%
|
|
\ifcsname slides@frames@\slides@footlastsection\endcsname
|
|
\csname slides@frames@\slides@footlastsection\endcsname
|
|
\else
|
|
\the\slides@footframe
|
|
\fi
|
|
}%
|
|
\ifnum\slides@foottotal>\slides@footmaxdots\relax
|
|
\the\slides@footframe/\slides@foottotal
|
|
\else
|
|
\tikzexternaldisable
|
|
\begin{tikzpicture}[baseline=-1.55pt, x=4.4pt]
|
|
\mmzUnmemoizable
|
|
\foreach \slides@dot in {1,...,\slides@foottotal}{
|
|
\ifnum\slides@dot=\slides@footframe\relax
|
|
\fill (\slides@dot,0) circle[radius=1.5pt];
|
|
\else
|
|
\draw[line width=.35pt] (\slides@dot,0) circle[radius=1.3pt];
|
|
\fi
|
|
}
|
|
\end{tikzpicture}%
|
|
\tikzexternalenable
|
|
\fi
|
|
}
|
|
% Typeset #2, scaled down if it is wider than #1.
|
|
\newsavebox{\slides@footbox}
|
|
\newcommand*{\slides@footfit}[2]{%
|
|
\sbox{\slides@footbox}{#2}%
|
|
\ifdim\wd\slides@footbox>#1\relax
|
|
\resizebox{#1}{!}{\usebox{\slides@footbox}}%
|
|
\else
|
|
\usebox{\slides@footbox}%
|
|
\fi
|
|
}
|
|
% A long author block is too tall for the bar: leave it out and warn once.
|
|
\newif\ifslides@footauthorwarned
|
|
\newcommand*{\slides@footauthor}{%
|
|
\sbox{\slides@footbox}{\insertshortauthor}%
|
|
\ifdim\dimexpr\ht\slides@footbox+\dp\slides@footbox\relax>1.5\baselineskip
|
|
\ifslides@footauthorwarned\else
|
|
\global\slides@footauthorwarnedtrue
|
|
\ClassWarningNoLine{slides}{The author is too tall for the footer.
|
|
Set a short name with \string\author[short]{...}}%
|
|
\fi
|
|
\else
|
|
\slides@footfit{\dimexpr.19\paperwidth-2\dimexpr\slides@footinset\relax\relax}
|
|
{\insertshortauthor}%
|
|
\fi
|
|
}
|
|
\newcommand*{\slides@footmiddle}{%
|
|
\insertshorttitle
|
|
\ifnum\c@section>0\relax
|
|
\enspace\textbullet\enspace\insertsectionhead\enspace\slides@footdots
|
|
\fi
|
|
}
|
|
% One rule for the whole bar: adjacent boxes can leave a seam in PDF viewers.
|
|
\setbeamertemplate{footline}{%
|
|
\slides@footcount
|
|
\usebeamerfont{footline}%
|
|
\hbox to\paperwidth{%
|
|
\vrule width0pt height\dimexpr\slides@footheight+3pt\relax % clear footnotes
|
|
\rlap{%
|
|
\usebeamercolor[bg]{footline}%
|
|
\vrule width\paperwidth height\slides@footheight depth\slides@footdepth
|
|
}%
|
|
\usebeamercolor[fg]{footline}%
|
|
\hbox to.19\paperwidth{\hskip\slides@footinset\slides@footauthor\hss}%
|
|
\hbox to.62\paperwidth{%
|
|
\hss\slides@footfit{.62\paperwidth}{\slides@footmiddle}\hss
|
|
}%
|
|
\hskip.11\paperwidth
|
|
\hbox to.08\paperwidth{%
|
|
\usebeamercolor[bg]{footline frame count}%
|
|
\rlap{\vrule width.08\paperwidth height\slides@footheight depth\slides@footdepth}%
|
|
\usebeamercolor[fg]{footline frame count}%
|
|
\hss\insertframenumber\,/\,\inserttotalframenumber\hss
|
|
}%
|
|
}%
|
|
}
|
|
% denser title bar. The bottom margin starts at the baseline and the top margin
|
|
% starts above the capitals, so the bottom one is larger to centre the text.
|
|
\setbeamerfont{frametitle}{size=\fontsize{11}{13}\selectfont}
|
|
\molochset{
|
|
frametitle margin top=5.5pt,
|
|
frametitle margin bottom=7pt
|
|
}
|
|
% 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}{}
|
|
{\ClassWarning{slides}{Could not tighten section spacing in the table of contents}}
|
|
\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=bg, 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{emoji}
|
|
% custom font size for a slide (cf. https://tex.stackexchange.com/a/401409)
|
|
\newcommand{\customframefont}[1]{
|
|
\setbeamertemplate{itemize/enumerate body begin}{#1}
|
|
\setbeamertemplate{itemize/enumerate subbody begin}{#1}
|
|
}
|
|
\NewDocumentEnvironment{framefont}{m +b}{
|
|
\customframefont{#1} % for itemize/enumerate
|
|
{#1 % For the text outside itemize/enumerate
|
|
#2
|
|
}
|
|
\customframefont{\normalsize}
|
|
}{}
|
|
% tikz
|
|
\usetikzlibrary{arrows.meta}
|
|
% math
|
|
\RequirePackage{amsmath,amssymb}
|
|
% resizebox
|
|
\RequirePackage{graphicx}
|
|
\RequirePackage{packages/slides-partners}
|
|
\RequirePackage{subcaption}
|
|
% tables
|
|
\RequirePackage{array}
|
|
\RequirePackage{tabularx}
|
|
\RequirePackage{booktabs}
|
|
% avoid spacing between rules and row background
|
|
\setlength{\abovetopsep}{0pt}
|
|
\setlength{\belowrulesep}{0pt}
|
|
\setlength{\aboverulesep}{0pt}
|
|
\setlength{\belowbottomsep}{0pt}
|
|
% vertical row padding
|
|
\renewcommand{\arraystretch}{1.5} % scales vertical row spacing
|
|
% vertical centering of text in all tabularx columns
|
|
\renewcommand\tabularxcolumn[1]{m{#1}}
|
|
% alternate row color
|
|
\definecolor{rowgray}{gray}{0.94}
|
|
% links
|
|
\RequirePackage{hyperref}
|
|
\hypersetup{
|
|
colorlinks,
|
|
anchorcolor=ubo,
|
|
citecolor=ubo,
|
|
linkcolor=,
|
|
urlcolor=ubo
|
|
}
|
|
|
|
% 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}{
|
|
% Use the theme's margins rather than a full-paper-height box, which placed
|
|
% the footer almost on the page edge. Stretch only the space above the footer.
|
|
% If the content is too tall, shrink the top space so the footer keeps its
|
|
% bottom margin and the title moves up instead.
|
|
\begin{minipage}[t][\dimexpr\paperheight-2\beamer@leftmargin\relax][s]{\textwidth}
|
|
\vspace*{\dimexpr .04\paperheight\relax minus 1fill}
|
|
\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}
|
|
\ifx\beamer@shortauthor\@empty\else\usebeamertemplate*{author}\fi
|
|
\vfill
|
|
\begin{columns}[b,onlytextwidth]
|
|
\column{0.52\linewidth}
|
|
\ifx\insertinstitute\@empty\else\usebeamertemplate*{institute}\fi
|
|
\column{0.44\linewidth}
|
|
\insertpartnerlogos
|
|
\end{columns}
|
|
\vspace*{0pt}
|
|
\end{minipage}
|
|
}
|
|
\makeatother
|