20
0

Re-vendor the theme from the trantor fork

Syncs with the stack now open upstream as pull requests: the progress bar
extracted into a shared command, \subsectionpage, \appendix, the dark
title band, and the metropolis-style dividers.

Two local changes are reapplied on top, as before: the licence notice in
the header, and font selection left to the document so this template can
use OpenSans and RobotoMono.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-14 10:16:13 -07:00
parent f902435f3c
commit b2504541e5

View File

@@ -13,12 +13,8 @@
\RequirePackage{tikz} \RequirePackage{tikz}
\RequirePackage{pifont} \RequirePackage{pifont}
% -- Fonts. Upstream sets Libertinus here and loads lum-euler for maths. % -- Fonts. Upstream sets Libertinus and loads lum-euler; both are left to the
% Both are left to the document instead: this template ships OpenSans and % document, which must \setsansfont, \setmonofont and load a maths font.
% RobotoMono, and lum-euler is not packaged in Debian's TeX Live. The document
% is expected to \setsansfont, \setmonofont and load a Unicode maths font
% before using anything below. \headerfont is what the theme uses for titles
% and other display text; redefine it if you want titles in a second face.
\renewcommand{\familydefault}{\sfdefault} \renewcommand{\familydefault}{\sfdefault}
\linespread{1.18} \linespread{1.18}
\providecommand\headerfont{\sffamily} \providecommand\headerfont{\sffamily}
@@ -34,17 +30,15 @@
\setlength\belowdisplayshortskip{5pt plus 2pt minus 1pt}% \setlength\belowdisplayshortskip{5pt plus 2pt minus 1pt}%
} }
% -- Palette. Four colours drive everything the theme draws. Override any of % -- Colours. Set your own accent anywhere in the preamble with, e.g.,
% them in the preamble, before or after loading trantor: % \definecolor{accent}{HTML}{BF1238}
% % \definecolor{TrantorDark}{HTML}{23373B}
% \definecolor{accent}{HTML}{BF1238} % Four colour palette:
% \colorlet{TrantorDark}{makopurple1} % 1. accent progress bars, title rule
% % 2. TrantorDark headings, section dividers, standout panels, frame numbers
% accent progress bars and emphasis % 3. TrantorLight text set against TrantorDark
% TrantorDark header band, section dividers, standout panels, frame numbers % 4. TrantorMuted affiliation, footline, arxiv. Lightest grey that still meets
% TrantorLight text on dark, and anything that has to read against it % WCAG AA contrast (4.5:1) on white (~4.54:1).
% TrantorMuted affiliations, footlines, arxiv tags. This is the lightest grey
% that still meets WCAG AA contrast (4.5:1) on white (~4.54:1).
\providecolor{accent}{HTML}{2A7AE2} \providecolor{accent}{HTML}{2A7AE2}
\providecolor{TrantorDark}{HTML}{000000} \providecolor{TrantorDark}{HTML}{000000}
\providecolor{TrantorLight}{HTML}{FFFFFF} \providecolor{TrantorLight}{HTML}{FFFFFF}
@@ -55,11 +49,8 @@
\AddToHook{begindocument}{\colorlet{structure}{TrantorDark}} \AddToHook{begindocument}{\colorlet{structure}{TrantorDark}}
% -- Header bar carrying the frame title (hidden on plain pages). % -- Header bar carrying the frame title (hidden on plain pages).
% The band is a rule of height (header height - headsep) with depth headsep, so % headsep is what pads under the title; the height key alone only pads above.
% headsep is the only thing that puts space under the title. geometry owns it.
\geometry{headsep=10pt} \geometry{headsep=10pt}
\AddToHook{begindocument}{% \AddToHook{begindocument}{%
\EditInstance{header}{std}{ \EditInstance{header}{std}{
background-color = TrantorDark, background-color = TrantorDark,
@@ -105,28 +96,21 @@
\href{https://arxiv.org/abs/#1}{{\headerfont\scriptsize\color{TrantorMuted}arXiv:#1}}% \href{https://arxiv.org/abs/#1}{{\headerfont\scriptsize\color{TrantorMuted}arXiv:#1}}%
} }
% -- \appendix, which ltx-talk does not provide. Frames after it keep counting % -- \appendix: frames after it are numbered among themselves and left out of
% but are left out of the total, so the denominator is the last frame of the % the total. The count travels through the aux file, so it settles on the
% talk proper. This is what appendixnumberbeamer does for beamer. The count is % second run.
% carried through the aux file, so it settles on the second run.
\newif\iftrantorAppendix \newif\iftrantorAppendix
\trantorAppendixfalse \trantorAppendixfalse
\newcommand\trantorMainFrames{\@totalframes} \newcommand\trantorMainFrames{\@totalframes}
% Appendix frames are numbered among themselves, as appendixnumberbeamer does,
% but by subtracting an offset rather than resetting the counter. The class
% records a property per frame keyed on that counter, so resetting it collides
% with ltx-talk's own frame.<n> labels and breaks \ref to a frame. Properly
% this belongs in the class, which could renumber and relabel together.
\NewDocumentCommand \appendix { } {% \NewDocumentCommand \appendix { } {%
\global\trantorAppendixtrue \global\trantorAppendixtrue
\protected@write\@auxout{}{% \protected@write\@auxout{}{%
\string\gdef\string\trantorMainFrames{\the\value{frame}}}% \string\gdef\string\trantorMainFrames{\the\value{frame}}}%
} }
% Numerator and denominator for the frame counter and the progress bars. These % Count registers, not macros: pgfmath expands while parsing, and a macro
% are count registers rather than macros because pgfmath expands its argument % carrying a conditional loops.
% while parsing, and a macro carrying a conditional sends it into a loop.
\newcount\trantor@n \newcount\trantor@n
\newcount\trantor@d \newcount\trantor@d
@@ -140,10 +124,11 @@
\fi \fi
} }
\newcommand\trantorFrameNumber{\trantor@setcounts\the\trantor@n} % Fraction of the way through the talk, shared by the footer bar and
\newcommand\trantorTotalFrames{\trantor@setcounts\the\trantor@d} % \trantorProgressBar. The zero test must stay outside pgfmath, which
% evaluates both arms of a ternary.
\newcommand\trantor@setratio{% \newcommand\trantor@setratio{%
\trantor@setcounts
\ifnum\trantor@d>0 \ifnum\trantor@d>0
\pgfmathsetmacro{\trantorratio}{min(\the\trantor@n / \the\trantor@d, 1)}% \pgfmathsetmacro{\trantorratio}{min(\the\trantor@n / \the\trantor@d, 1)}%
\else \else
@@ -151,6 +136,21 @@
\fi \fi
} }
% \trantorProgressBar{<width>}: a rule of the given width, filled to the
% current position and grey the rest of the way.
\newlength\trantor@barwidth
\newlength\trantor@barfill
\NewDocumentCommand \trantorProgressBar { m } {%
\setlength\trantor@barwidth{#1}%
\trantor@setratio
% dimen = <factor><dimen>, so \trantorratio scales the width
\setlength\trantor@barfill{\trantorratio\trantor@barwidth}%
\textcolor{TrantorAccent}{\rule{\trantor@barfill}{0.6pt}}%
\textcolor{TrantorDark!20}{%
\rule{\dimexpr\trantor@barwidth-\trantor@barfill\relax}{0.6pt}}%
}
% -- Bottom progress bar + frame counter (hidden on plain pages). % -- Bottom progress bar + frame counter (hidden on plain pages).
\newif\iftrantorPlainPage \newif\iftrantorPlainPage
\trantorPlainPagefalse \trantorPlainPagefalse
@@ -159,22 +159,20 @@
\iftrantorPlainPage\else \iftrantorPlainPage\else
\trantorArtifactBegin \trantorArtifactBegin
\begin{tikzpicture}[remember picture, overlay] \begin{tikzpicture}[remember picture, overlay]
\trantor@setcounts
\trantor@setratio \trantor@setratio
\fill[TrantorAccent] \fill[TrantorAccent]
(current page.south west) (current page.south west)
rectangle rectangle
([xshift=\trantorratio\paperwidth, yshift=1pt] current page.south west); ([xshift=\trantorratio\paperwidth, yshift=1pt] current page.south west);
\node[anchor=south east, inner sep=5pt, font=\scriptsize, text=TrantorDark] \node[anchor=south east, inner sep=5pt, font=\tiny, text=TrantorDark]
at (current page.south east) at (current page.south east) {\the\trantor@n\,/\,\the\trantor@d};
{\the\trantor@n\,/\,\the\trantor@d};
\end{tikzpicture}% \end{tikzpicture}%
\trantorArtifactEnd \trantorArtifactEnd
\fi \fi
\global\trantorPlainPagefalse \global\trantorPlainPagefalse
} }
% -- Remember the current section title, and dim the others in the mini-TOC. % -- Remember the section and subsection titles, for the dividers.
\ExplSyntaxOn \ExplSyntaxOn
\tl_new:N \g__trantor_section_tl \tl_new:N \g__trantor_section_tl
@@ -187,8 +185,8 @@
\cs_new_protected:Npn \__trantor_print_section: { \tl_use:N \g__trantor_section_tl } \cs_new_protected:Npn \__trantor_print_section: { \tl_use:N \g__trantor_section_tl }
\cs_set_eq:NN \trantorSectionTitle \__trantor_print_section: \cs_set_eq:NN \trantorSectionTitle \__trantor_print_section:
% Likewise the subsection, for \subsectionpage. Cleared at each new section so % Likewise the subsection, for \subsectionpage. Cleared when a new section
% that a stale subsection title cannot leak into the next one. % starts so a stale title cannot leak into the next one.
\tl_new:N \g__trantor_subsection_tl \tl_new:N \g__trantor_subsection_tl
\AddToHook{section/begin}{ \tl_gclear:N \g__trantor_subsection_tl } \AddToHook{section/begin}{ \tl_gclear:N \g__trantor_subsection_tl }
@@ -209,29 +207,9 @@
{ \cs_if_exist:NT \tag_suspend:n { \tag_suspend:n { trantor } } } { \cs_if_exist:NT \tag_suspend:n { \tag_suspend:n { trantor } } }
\cs_new_protected:Npn \trantorArtifactEnd \cs_new_protected:Npn \trantorArtifactEnd
{ \cs_if_exist:NT \tag_resume:n { \tag_resume:n { trantor } } } { \cs_if_exist:NT \tag_resume:n { \tag_resume:n { trantor } } }
% Soften the dimming of inactive TOC entries on the section page (0.2 -> 0.7).
% ltx-talk exposes no key for this yet, so we override the class-private
% \__talk_toc_dest:w. Revisit if a supported interface appears or the internal
% changes.
\cs_set_protected:Npn \__talk_toc_dest:w #1 . #2 . #3 . #4 . #5 \q_stop #6
{
\bool_lazy_or:nnTF
{
\bool_lazy_and_p:nn
{ \int_compare_p:nNn { \value { section } } = {#2} }
{ \int_compare_p:nNn { \value { subsection } } = 0 }
}
{
\bool_lazy_and_p:nn
{ \int_compare_p:nNn { \value { section } } = {#2} }
{ \int_compare_p:nNn { \value { subsection } } = {#3} }
}
{#6}
{ \opacity_begin:n { 0.7 } #6 \opacity_end: }
}
\ExplSyntaxOff \ExplSyntaxOff
% -- Title page. Drop a logo.png next to your slides, or redefine \titlelogo. % -- Title page. Drop a logo.png next to your slides, or redefine \titlelogo.
\newcommand{\titlelogo}{% \newcommand{\titlelogo}{%
\IfFileExists{logo.png} \IfFileExists{logo.png}
@@ -277,52 +255,9 @@
\end{frame}% \end{frame}%
} }
% -- Divider pages, following metropolis: on the ordinary light background, a % -- A full-bleed dark panel with the given body centred in a minipage of the
% block set in the middle of the slide holding the section title over a % given width.
% progress bar, and for a subsection the subsection title beneath that. The \NewDocumentCommand \trantor@panel { m +m } {%
% bar is the same progress the footer bar shows, drawn at half width. The
% footer bar and frame number stay, so these are not plain pages in the sense
% the shipout hook means.
\newlength\trantor@barwidth
\newlength\trantor@barfill
% \trantorProgressBar{<width>}: filled to the current position, grey after.
\NewDocumentCommand \trantorProgressBar { m } {%
\setlength\trantor@barwidth{#1}%
\trantor@setcounts
\trantor@setratio
\setlength\trantor@barfill{\trantorratio\trantor@barwidth}%
\textcolor{TrantorDark}{\rule{\trantor@barfill}{0.6pt}}%
\textcolor{TrantorDark!20}{%
\rule{\dimexpr\trantor@barwidth-\trantor@barfill\relax}{0.6pt}}%
}
\NewDocumentCommand \trantor@divider { m } {%
\begin{frame}{}%
\thispagestyle{plain}%
\vfill
\centering
\begin{minipage}{0.52\linewidth}%
\raggedright
{\headerfont\Large\bfseries\trantorSectionTitle\par}%
\vspace{0.4em}%
\trantorProgressBar{\linewidth}%
\IfBlankF{#1}{%
\par\vspace{0.8em}%
{\headerfont\large\bfseries #1\par}%
}%
\end{minipage}%
\par
\vfill
\end{frame}%
}
\NewDocumentCommand \sectionpage { } { \trantor@divider {} }
\NewDocumentCommand \subsectionpage { } { \trantor@divider {\trantorSubsectionTitle} }
% \standout{...}: a full frame with the same dark panel as \sectionpage,
% and the given text centred on it.
\NewDocumentCommand \standout { +m } {%
\global\trantorPlainPagetrue \global\trantorPlainPagetrue
\begin{frame}{}% \begin{frame}{}%
\thispagestyle{plain}% \thispagestyle{plain}%
@@ -335,14 +270,47 @@
(\dimexpr\paperwidth-\Gm@lmargin\relax, -\paperheight); (\dimexpr\paperwidth-\Gm@lmargin\relax, -\paperheight);
\node[text=TrantorLight, anchor=center, inner sep=0pt] \node[text=TrantorLight, anchor=center, inner sep=0pt]
at (0.5\linewidth, -0.5\textheight) {% at (0.5\linewidth, -0.5\textheight) {%
\begin{minipage}{0.8\linewidth} \begin{minipage}{#1}
\centering \centering
\headerfont\LARGE\bfseries #2
#1
\end{minipage}% \end{minipage}%
}; };
\end{tikzpicture}% \end{tikzpicture}%
\end{frame}% \end{frame}%
} }
% -- Divider pages: the section title over a progress bar, set on the ordinary
% light background. Not plain pages: the footer bar and frame number stay.
\NewDocumentCommand \trantor@divider { +m } {%
\begin{frame}{}%
\thispagestyle{plain}%
\vfill
\centering
\begin{minipage}{0.52\linewidth}%
\raggedright
{\headerfont\Large\bfseries\trantorSectionTitle\par}%
\vspace{0.4em}%
\trantorProgressBar{\linewidth}%
#1%
\end{minipage}%
\par
\vfill
\end{frame}%
}
\NewDocumentCommand \sectionpage { } { \trantor@divider{} }
% The subsection divider is the same, naming the subsection under the bar.
\NewDocumentCommand \subsectionpage { } {%
\trantor@divider{%
\par\vspace{0.8em}%
{\headerfont\large\bfseries\trantorSubsectionTitle\par}%
}%
}
% \standout{...}: a full-bleed dark panel with the given text centred on it.
\NewDocumentCommand \standout { +m } {%
\trantor@panel{0.8\linewidth}{\headerfont\LARGE\bfseries #1}%
}
\makeatother \makeatother