summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/beamer-contrib/themes/moloch/beamerouterthememoloch.dtx
blob: a684e4774362abd4b3d8f2a70ba248d08762ae19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
% \iffalse meta-comment -------------------------------------------------------
% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of
% contributors can be found at
%
%     https://github.com/matze/mtheme/graphs/contributors
%
% and the original template was based on the HSRM theme by Benjamin Weiss.
%
% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0
% International License (https://creativecommons.org/licenses/by-sa/4.0/).
%% --------------------------------------------------------------------------- 
%% Copyright 2024 Johan Larsson and contributors
% ------------------------------------------------------------------------- \fi
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerouterthememoloch}[2024-01-15 v0.1.0 Moloch outer theme] % x-release-please-version
%</package>
% \fi
% \CheckSum{0}
% \StopEventually{}
% \iffalse
%<*package>
% ------------------------------------------------------------------------- \fi
%
% \subsection{\themename outer theme}
%
% A |beamer| outer theme dictates the style of the frame elements traditionally
% set outside the body of each slide: the head, footline, and frame title.
%
%
%
% \subsubsection{Package dependencies}
%
%    \begin{macrocode}
\RequirePackage{calc}
\RequirePackage{pgfopts}
%    \end{macrocode}
%
%
%
% \subsubsection{Options}
%
% \begin{macro}{progressbar}
%    Adds a progress bar to the top, bottom, or frametitle of each slide.
%    \begin{macrocode}
\pgfkeys{
  /moloch/outer/progressbar/.cd,
  .is choice,
  none/.code={%
      \setbeamertemplate{headline}[plain]
      \setbeamertemplate{frametitle}[plain]
      \setbeamertemplate{footline}[plain]
    },
  head/.code={\pgfkeys{/moloch/outer/progressbar=none}
      \addtobeamertemplate{headline}{}{%
        \usebeamertemplate*{progress bar in head/foot}
      }
    },
  frametitle/.code={\pgfkeys{/moloch/outer/progressbar=none}
      \addtobeamertemplate{frametitle}{}{%
        \usebeamertemplate*{progress bar in head/foot}
      }
    },
  foot/.code={\pgfkeys{/moloch/outer/progressbar=none}
      \addtobeamertemplate{footline}{}{%
        \usebeamertemplate*{progress bar in head/foot}%
      }
    },
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\moloch@outer@setdefaults}
%    Sets default values for outer theme options.
%    \begin{macrocode}
\newcommand{\moloch@outer@setdefaults}{
  \pgfkeys{/moloch/outer/.cd,
    progressbar=none,
  }
}
%    \end{macrocode}%
% \end{macro}
%
%
%
% \subsubsection{Head and footline}
%
% All good |beamer| presentations should already remove the navigation symbols,
% but \themename removes them automatically (just in case).
%
%    \begin{macrocode}
\setbeamertemplate{navigation symbols}{}
%    \end{macrocode}
%
%
% \begin{macro}{headline}
% \begin{macro}{footline}
%    Templates for the head- and footline at the top and bottom of each frame.
%    \begin{macrocode}
\defbeamertemplate{headline}{plain}{}
\defbeamertemplate{footline}{plain}{%
  \begin{beamercolorbox}[
      leftskip=4pt,%
      rightskip=5pt,%
      wd=\textwidth,%
    ]{footline}%
    \usebeamercolor[fg]{page number in head/foot}%
    \usebeamerfont{page number in head/foot}%
    \usebeamertemplate*{frame footer}%
    \hfill%
    \usebeamertemplate*{page number in head/foot}\vskip4pt%
  \end{beamercolorbox}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
%
% \subsubsection{Frametitle}
%
% \begin{macro}{frametitle}
%    Templates for the frame title, which is optionally underlined with a
%    progress bar.
%    \begin{macrocode}
\newlength{\moloch@frametitle@padding}
\setlength{\moloch@frametitle@padding}{2.2ex}
\newcommand{\moloch@frametitlestrut@start}{%
  \rule{0pt}{\moloch@frametitle@padding + \totalheightof{X}}%
}
\newcommand{\moloch@frametitlestrut@end}{%
  \rule[-\moloch@frametitle@padding]{0pt}{\moloch@frametitle@padding}
}
\defbeamertemplate{frametitle}{plain}{%
  \nointerlineskip%
  \begin{beamercolorbox}[%
      wd=\paperwidth,%
      sep=0pt,%
      leftskip=\moloch@frametitle@padding,%
      rightskip=\the\glueexpr \moloch@frametitle@padding plus 1fill\relax,%
    ]{frametitle}%
    \moloch@frametitlestrut@start%
    \insertframetitle%
    \nolinebreak%
    \moloch@frametitlestrut@end%
  \end{beamercolorbox}%
}
\setbeamertemplate{frametitle continuation}{%
  \usebeamerfont{frametitle}
  \romannumeral \insertcontinuationcount
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{progress bar in head/foot}
%    Template for the progress bar optionally displayed below the frame title
%    on each page. Much of this code is duplicated in the inner theme's
%    template |progress bar in section page|.
%    \begin{macrocode}
\newlength{\moloch@progressinheadfoot}
\newlength{\moloch@progressinheadfoot@linewidth}
\setlength{\moloch@progressinheadfoot@linewidth}{0.4pt}
\setbeamertemplate{progress bar in head/foot}{
  \nointerlineskip
  \pgfmathsetlength{\moloch@progressinheadfoot}{%
    \paperwidth * min(1,\insertframenumber/\inserttotalframenumber)%
  }
  \begin{beamercolorbox}[wd=\paperwidth]{progress bar in head/foot}
    \tikzexternaldisable
    \begin{tikzpicture}
      \fill[bg]
      (0,0)
      rectangle
      (\paperwidth, \moloch@progressinheadfoot@linewidth);
      \fill[fg]
      (0,0)
      rectangle
      (\moloch@progressinheadfoot, \moloch@progressinheadfoot@linewidth);
    \end{tikzpicture}
    \tikzexternalenable
  \end{beamercolorbox}
}
%    \end{macrocode}
% \end{macro}
%
% \subsubsection{Process package options}
%
%    \begin{macrocode}
\moloch@outer@setdefaults
\ProcessPgfPackageOptions{/moloch/outer}
%    \end{macrocode}
%
% \iffalse
%</package>
% \fi
% \Finale
\endinput