feat: add customization of bar line width (#42)

Adds the ability to set the line width of the progress bars and title
separator (on the title page) through `progressbar linewidth` and
`titleseparator linewidth`. Closes #41.
This commit is contained in:
Johan Larsson 2025-03-12 15:04:16 +01:00 committed by GitHub
parent 795d202d6d
commit be0d8f23c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 112 additions and 23 deletions

Binary file not shown.

View File

@ -75,7 +75,6 @@
\molochset{titleformat frame=smallcaps} \molochset{titleformat frame=smallcaps}
\begin{frame} \begin{frame}
\frametitle{Small Caps} \frametitle{Small Caps}
This frame uses the \texttt{smallcaps} title format.
\begin{alertblock}{Potential Problems} \begin{alertblock}{Potential Problems}
Be aware that not every font supports small caps. If you use the Computer (or Latin) Modern Sans Serif font, for instance, text in small caps will just be typeset in a normal font. Be aware that not every font supports small caps. If you use the Computer (or Latin) Modern Sans Serif font, for instance, text in small caps will just be typeset in a normal font.
@ -264,6 +263,48 @@
\end{columns} \end{columns}
\end{frame} \end{frame}
\begin{frame}[c]
\frametitle{Progress Bars}
A prominent feature of \themename is the use of progress bars to
visualize the progress of the presentation. \medskip
By default bars are shown on section pages, but this can be toggled
through \texttt{sectionpage=progressbar|simple|none} and also enabled for
subsection pages through \texttt{subsectionpage=progressbar}.\medskip
Finally, you can enable progress bars on frames by setting
\texttt{progressbar=none|head|frametitle|foot} (depending on where
you'd like the bar to be placed).\medskip
\end{frame}
\begin{frame}[c,fragile]
\frametitle{Progress Bar Customization}
You can customize the width of the bars using
\texttt{progressbar linewidth=<length>}.\medskip
On the following pages, we have set
\begin{verbatim}\molochset{
progressbar=frametitle,
progressbar linewidth=1pt
}
\end{verbatim}
to enable progress bars below the frame title and set its width to 1pt.
\end{frame}
\molochset{progressbar=frametitle,progressbar linewidth=1pt}
\begin{frame}[c,fragile]
\frametitle{The Title Page}
There is only very little customization available of the title page at the
time of writing.\medskip
But you can at least modify the line width of the title separator
by setting \texttt{titleseparator linewidth=<length>}
\end{frame}
\begin{frame} \begin{frame}
\frametitle{Math} \frametitle{Math}
\begin{equation*} \begin{equation*}

View File

@ -117,6 +117,29 @@
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% \begin{macro}{titleseparator linewidth}
% Set the width of the line separating the title from the author.
% \begin{macrocode}
\newlength{\moloch@titleseparator@linewidth}
\pgfkeys{
/moloch/inner/.cd,
titleseparatorlinewidth/.code={\setlength{\moloch@titleseparator@linewidth}{#1}},
titleseparatorlinewidth/.default=0.4pt,
}
% \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{titleseparator aliases}
% Allows |titleseparator linewidth| to be used in |\usetheme|.
% \begin{macrocode}
\pgfkeys{
/moloch/inner/.cd,
titleseparator linewidth/.code=\pgfkeysalso{titleseparatorlinewidth=#1},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\moloch@inner@setdefaults} % \begin{macro}{\moloch@inner@setdefaults}
% Set default values for inner theme options. % Set default values for inner theme options.
% \begin{macrocode} % \begin{macrocode}
@ -124,7 +147,8 @@
\pgfkeys{/moloch/inner/.cd, \pgfkeys{/moloch/inner/.cd,
sectionpage=progressbar, sectionpage=progressbar,
subsectionpage=none, subsectionpage=none,
standoutnumbering=none standoutnumbering=none,
titleseparator linewidth=0.4pt,
} }
} }
% \end{macrocode} % \end{macrocode}
@ -205,7 +229,6 @@
\raggedright% \raggedright%
\moloch@titleformat{\inserttitle}% \moloch@titleformat{\inserttitle}%
\par% \par%
\vspace*{0.2em}
} }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
@ -214,26 +237,23 @@
% Set the subtitle on the title page. % Set the subtitle on the title page.
% \begin{macrocode} % \begin{macrocode}
\setbeamertemplate{subtitle}{ \setbeamertemplate{subtitle}{
\vspace*{0.1em} \vspace*{0.3em}
\raggedright% \raggedright%
\moloch@subtitleformat{\insertsubtitle}% \moloch@subtitleformat{\insertsubtitle}%
\par% \par%
\vspace*{0.2em}
} }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% \begin{macro}{title separator} % \begin{macro}{title separator}
% Template to set the title graphic in a zero-height box. (It won't % Template to set the title separator.
% change the position of other elements.)
% \begin{macrocode} % \begin{macrocode}
\newlength{\moloch@titleseparator@linewidth}
\setlength{\moloch@titleseparator@linewidth}{0.4pt}
\setbeamertemplate{title separator}{ \setbeamertemplate{title separator}{
\tikzexternaldisable% \tikzexternaldisable%
\begin{tikzpicture} \begin{tikzpicture}[baseline=(current bounding box.north)]
\mmzUnmemoizable% \mmzUnmemoizable%
\fill[fg] (0,0) rectangle (\textwidth, \moloch@titleseparator@linewidth); \fill[fg] (0,0) rectangle (\textwidth, \moloch@titleseparator@linewidth);
\useasboundingbox (0,0) rectangle (\textwidth,-\moloch@titleseparator@linewidth);
\end{tikzpicture}% \end{tikzpicture}%
\tikzexternalenable% \tikzexternalenable%
\par% \par%
@ -296,7 +316,7 @@
\insertsubsectionhead% \insertsubsectionhead%
\fi \fi
\end{center} \end{center}
\vspace{\baselineskip - 1ex + 0.4pt} \vspace{\baselineskip - 1ex + \moloch@titleseparator@linewidth}
} }
\defbeamertemplate{section page}{progressbar}{ \defbeamertemplate{section page}{progressbar}{
\centering \centering
@ -366,15 +386,12 @@
% |progress bar in head/foot|. % |progress bar in head/foot|.
% %
% \begin{macrocode} % \begin{macrocode}
\newlength{\moloch@progressonsectionpage}
\newlength{\moloch@progressonsectionpage@linewidth}
\setlength{\moloch@progressonsectionpage@linewidth}{0.4pt}
\setbeamertemplate{progress bar in section page}{ \setbeamertemplate{progress bar in section page}{
\pgfmathsetlength{\moloch@progressonsectionpage}{ \pgfmathsetlength{\moloch@progressonsectionpage}{
\textwidth * min(1,\insertframenumber/\inserttotalframenumber) \textwidth * min(1,\insertframenumber/\inserttotalframenumber)
}% }%
\tikzexternaldisable% \tikzexternaldisable%
\begin{tikzpicture} \begin{tikzpicture}[baseline=(current bounding box.north)]
\mmzUnmemoizable% \mmzUnmemoizable%
\fill[bg] \fill[bg]
(0,0) (0,0)
@ -385,6 +402,7 @@
rectangle rectangle
(\moloch@progressonsectionpage, (\moloch@progressonsectionpage,
\moloch@progressonsectionpage@linewidth); \moloch@progressonsectionpage@linewidth);
\useasboundingbox (0,0) rectangle (\textwidth,-\moloch@progressonsectionpage@linewidth);
\end{tikzpicture}% \end{tikzpicture}%
\tikzexternalenable% \tikzexternalenable%
} }

View File

@ -71,12 +71,41 @@
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% \begin{macro}{progressbar linewidth}
% Sets the linewidth of the progress bar for sectionpages and frames.
% \begin{macrocode}
\newlength{\moloch@progressonsectionpage}
\newlength{\moloch@progressonsectionpage@linewidth}
\newlength{\moloch@progressinheadfoot}
\newlength{\moloch@progressinheadfoot@linewidth}
\pgfkeys{
/moloch/outer/.cd,
progressbarlinewidth/.code={
\setlength{\moloch@progressonsectionpage@linewidth}{#1}
\setlength{\moloch@progressinheadfoot@linewidth}{#1}
},
progressbarlinewidth/.default=0.4pt,
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{progressbar aliases}
% Allows |progressbar linewidth| to be used in |\molochset|.
% \begin{macrocode}
\pgfkeys{
/moloch/outer/.cd,
progressbar linewidth/.code=\pgfkeysalso{progressbarlinewidth=#1},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\moloch@outer@setdefaults} % \begin{macro}{\moloch@outer@setdefaults}
% Sets default values for outer theme options. % Sets default values for outer theme options.
% \begin{macrocode} % \begin{macrocode}
\newcommand{\moloch@outer@setdefaults}{ \newcommand{\moloch@outer@setdefaults}{
\pgfkeys{/moloch/outer/.cd, \pgfkeys{/moloch/outer/.cd,
progressbar=none, progressbar=none,
progressbar linewidth=0.4pt,
} }
} }
% \end{macrocode}% % \end{macrocode}%
@ -210,9 +239,6 @@
% on each page. Much of this code is duplicated in the inner theme's % on each page. Much of this code is duplicated in the inner theme's
% template |progress bar in section page|. % template |progress bar in section page|.
% \begin{macrocode} % \begin{macrocode}
\newlength{\moloch@progressinheadfoot}
\newlength{\moloch@progressinheadfoot@linewidth}
\setlength{\moloch@progressinheadfoot@linewidth}{0.4pt}
\setbeamertemplate{progress bar in head/foot}{ \setbeamertemplate{progress bar in head/foot}{
\nointerlineskip% \nointerlineskip%
\pgfmathsetlength{\moloch@progressinheadfoot}{% \pgfmathsetlength{\moloch@progressinheadfoot}{%

View File

@ -392,12 +392,12 @@ Completed box being shipped out [2]
.......\pdfcolorstack 0 push {0.92157 0.50587 0.10588 rg 0.92157 0.50587 0.10588 RG} .......\pdfcolorstack 0 push {0.92157 0.50587 0.10588 rg 0.92157 0.50587 0.10588 RG}
.......\glue(\parskip) 0.0 .......\glue(\parskip) 0.0
.......\glue(\parskip) 0.0 .......\glue(\parskip) 0.0
.......\glue(\baselineskip) 17.6 .......\glue(\baselineskip) 18.0
.......\hbox(0.4+0.0)x241.99265 .......\hbox(0.0+0.79999)x241.99265
........\hbox(0.0+0.0)x0.0 ........\hbox(0.0+0.0)x0.0
........\hbox(0.4+0.0)x241.99265 ........\hbox(0.79999+0.0)x241.99265, shifted 0.79999
.........\glue 0.0 .........\glue 0.0
.........\hbox(0.0+0.0)x0.0 .........\hbox(0.0+0.0)x0.0, shifted -0.4
..........\pdfliteral{q } ..........\pdfliteral{q }
..........\pdfliteral{0.92157 0.50587 0.10588 RG } ..........\pdfliteral{0.92157 0.50587 0.10588 RG }
..........\pdfliteral{0.92157 0.50587 0.10588 rg } ..........\pdfliteral{0.92157 0.50587 0.10588 rg }
@ -405,6 +405,7 @@ Completed box being shipped out [2]
..........\hbox(0.0+0.0)x0.0 ..........\hbox(0.0+0.0)x0.0
...........\pdfliteral{q } ...........\pdfliteral{q }
...........\glue 0.0 ...........\glue 0.0
...........\glue 0.0
...........\pdfliteral{q } ...........\pdfliteral{q }
...........\pdfcolorstack 0 push {0.83824 0.77588 0.71588 rg 0.83824 0.77588 0.71588 RG} ...........\pdfcolorstack 0 push {0.83824 0.77588 0.71588 rg 0.83824 0.77588 0.71588 RG}
...........\pdfliteral{0.0 0.0 m } ...........\pdfliteral{0.0 0.0 m }
@ -433,7 +434,10 @@ Completed box being shipped out [2]
...........\pdfcolorstack 0 pop ...........\pdfcolorstack 0 pop
...........\pdfliteral{Q } ...........\pdfliteral{Q }
...........\glue 0.0 ...........\glue 0.0
...........\glue 0.0
...........\glue 0.0
...........\pdfliteral{Q } ...........\pdfliteral{Q }
...........\glue 0.0
...........\glue 0.0 plus 1.0fil minus 1.0fil ...........\glue 0.0 plus 1.0fil minus 1.0fil
..........\pdfliteral{n } ..........\pdfliteral{n }
..........\pdfliteral{Q } ..........\pdfliteral{Q }
@ -445,7 +449,7 @@ Completed box being shipped out [2]
.......\pdfcolorstack 0 push {0.13725 0.2157 0.23137 rg 0.13725 0.2157 0.23137 RG} .......\pdfcolorstack 0 push {0.13725 0.2157 0.23137 rg 0.13725 0.2157 0.23137 RG}
.......\glue(\parskip) 0.0 .......\glue(\parskip) 0.0
.......\glue(\parskip) 0.0 .......\glue(\parskip) 0.0
.......\glue(\baselineskip) 4.20004 .......\glue(\baselineskip) 3.40005
.......\hbox(9.79996+4.20004)x241.99265, glue set 120.99632fil .......\hbox(9.79996+4.20004)x241.99265, glue set 120.99632fil
........\hbox(0.0+0.0)x0.0 ........\hbox(0.0+0.0)x0.0
........\rule(9.79996+4.20004)x0.0 ........\rule(9.79996+4.20004)x0.0