From 46a4f49e8bb95798c2d6f3b69a1b96128d95cb8b Mon Sep 17 00:00:00 2001 From: Johan Larsson <13087841+jolars@users.noreply.github.com> Date: Tue, 9 Jul 2024 20:36:16 +0200 Subject: [PATCH] feat: support title format modifications (#18) * chore: add "to" * docs: small change to example * docs: provide longest label in description * feat: reinstitute support for titleformat settings Fixes #17. Setting this up on the user side via beamer templates turned out to be too much of a hassle for users. It seems that the implementation here works better out of the box compared to what was originally the case in the metropolis theme, and we don't have to rely on patching commands as the previous implementation did, so this seems like a reasonable feature to add back support for. --- doc/moloch.tex | 56 ++++++++- examples/demo/demo.tex | 75 ++++++++++- src/beamerfontthememoloch.dtx | 185 ++++++++++++++++++++++++++++ src/beamerinnerthememoloch.dtx | 8 +- src/beamerouterthememoloch.dtx | 31 ++++- src/beamerthememoloch.dtx | 53 ++++++++ testfiles/support/molochexample.tex | 33 +++++ testfiles/test.tlg | 98 +++++---------- 8 files changed, 454 insertions(+), 85 deletions(-) diff --git a/doc/moloch.tex b/doc/moloch.tex index a9eb326..116e113 100644 --- a/doc/moloch.tex +++ b/doc/moloch.tex @@ -58,7 +58,7 @@ xrightmargin=0em, aboveskip=1em, belowskip=1em, - morekeywords={usetheme,institute,maketitle,% + morekeywords={usetheme,institute,maketitle,@moloch@titleformat,% plain,setbeamercolor,molochset,setsansfont,setmonofont}, } \lstMakeShortInline| @@ -166,10 +166,10 @@ The following code shows a minimal example of a Beamer presentation using \begin{lstlisting} \documentclass{beamer} \usetheme{moloch} -\title{A minimal example} +\title{A Minimal Example} \date{\today} \author{Johan Larsson} -\institute{Centre for Modern Beamer Themes} +\institute{Some University} \begin{document} \maketitle \section{First Section} @@ -187,6 +187,7 @@ The following code shows a minimal example of a Beamer presentation using \begin{itemize} \item |tikz| \item |pgfopts| + \item |etoolbox| \item |calc| \end{itemize} \end{multicols} @@ -224,6 +225,27 @@ The list of options is structured as shown in the following example. A short description of the option. } + +\subsubsection{Main theme} + +\DescribeOption{titleformat}% +{regular, smallcaps, allsmallcaps, allcaps} +{regular}{ + Changes the format of titles, subtitles, section titles, frame titles, and + the text on ``standout'' frames. The available options produce + Regular, \textsc{SmallCaps}, \textsc{\MakeLowercase{AllSmallCaps}}, or + \MakeUppercase{AllCaps} titles. Note that these commands do not + affect math and numbers, so may not work as you expect if your titles + contain these. +} + +\DescribeOption{titleformat plain}% +{regular, smallcaps, allsmallcaps, allcaps}% +{regular}{ + Changes the format of ``standout'' frames (see |titleformat|, above). +} + + \subsubsection{Inner theme} \DescribeOption{sectionpage}{none, simple, progressbar}{progressbar}{ @@ -270,6 +292,20 @@ The list of options is structured as shown in the following example. of the reverse. } + +\subsubsection{Font theme} + +\DescribeMacro{titleformat title} +\DescribeMacro{titleformat subtitle} +\DescribeMacro{titleformat section} +\DescribeOption{titleformat frame}% +{regular, smallcaps, allsmallcaps, allcaps}% +{regular}{ + Individually controls the format of titles, subtitles, section titles, and + frame titles (see |titleformat|, above). +} + + \subsection{Color Customization} The included \themename color theme is used by default, but its colors can be @@ -321,6 +357,18 @@ single sentence or image. To use it, add the key |standout| to the frame: \section{Known Issues} +\subsection{Title Formats} + +Be aware that not every font supports small caps, so the |smallcaps| or +|allsmallcaps| options may not work for all fonts. +In particular, the Computer Modern sans-serif typeface, which is used +by default when \themename is compiled with pdf\LaTeX, does not have a +small-caps variant. + +Note that title format options |allsmallcaps| and |allcaps| do not +affect the sizes of numerals, punctuation, and math symbol, and are +probably best avoided if your titles contain these characters. + \subsection{Interactions with other color themes} \themename can be used along with any other Beamer color theme, such as @@ -412,7 +460,7 @@ solution for Org mode users, using |org-set-property|. \subsection{Standout frames with Pandoc} -With Pandoc versions prior 1.17.2 it was not possible to create standout frames +With Pandoc versions prior to 1.17.2 it was not possible to create standout frames because Pandoc only supported a specific list of frame attributes thus ignoring additional attributes such as |{.standout}|. diff --git a/examples/demo/demo.tex b/examples/demo/demo.tex index b67fa04..875ed85 100644 --- a/examples/demo/demo.tex +++ b/examples/demo/demo.tex @@ -12,7 +12,7 @@ \usepackage{booktabs} \usepackage[scale=2]{ccicons} -\usepackage{lmodern} +\usepackage[semibold,light]{FiraSans} \usepackage{xspace} @@ -38,8 +38,9 @@ \begin{frame}[fragile]{Moloch} The \themename theme is a Beamer theme with minimal visual noise. It is a fork of the - \href{https://github.com/matze/mtheme}{metropolis theme} by Matthias Vogelgesang, which in turn was inspired by - by the \href{https://github.com/hsrmbeamertheme/hsrmbeamertheme}{hsrm theme} by Benjamin Weiss. \medskip + \href{https://github.com/matze/mtheme}{metropolis theme} by Matthias Vogelgesang, which in + turn was inspired by by the \href{https://github.com/hsrmbeamertheme/hsrmbeamertheme}{hsrm + theme} by Benjamin Weiss. \medskip Enable the theme by calling \begin{verbatim}\documentclass{beamer} @@ -48,9 +49,70 @@ \begin{frame}[fragile]{Sections} Sections group slides of the same topic by introducing a section page between them. A progress bar is shown which indicates how far along in the presentation you are. - \begin{verbatim}\section{Elements}\end{verbatim} + \begin{verbatim}\section{Title Formats}\end{verbatim} \end{frame} +\section{Title Formats} + +\begin{frame}[fragile]{Moloch Title Formats} + \themename supports four different title formats: + \begin{itemize} + \item \texttt{regular} (Regular) + \item \texttt{smallcaps} (\textsc{Small Caps}) + \item \texttt{allsmallcaps} (\textsc{all small caps}) + \item \texttt{allcaps} (ALL CAPS) + \end{itemize} + + They can either be set globally for every frame or used locally just for the current frame + and onwards by using + \begin{verbatim}\molochset{titleformat frame=