beamerouterthemeneo.dtx 7.64 KB
Newer Older
Ross Churchley's avatar
Ross Churchley committed
1
% \iffalse meta-comment -------------------------------------------------------
Bernhard Heinloth's avatar
Bernhard Heinloth committed
2
3
4
% i4neo template 2017 by Bernhard Heinloth
% based on the metropolis template by Matthias Vogelgesang et al.
%     https://github.com/matze/mtheme/
Ross Churchley's avatar
Ross Churchley committed
5
6
7
8
9
10
11
12
% 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/).
% ------------------------------------------------------------------------- \fi
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
Bernhard Heinloth's avatar
Bernhard Heinloth committed
13
\ProvidesPackage{beamerouterthemeneo}[2017/10/01 i4neo outer theme]
Ross Churchley's avatar
Ross Churchley committed
14
15
16
17
18
19
20
%</package>
% \fi
% \CheckSum{0}
% \StopEventually{}
% \iffalse
%<*package>
% ------------------------------------------------------------------------- \fi
21
%
22
% \subsection{\themename outer theme}
Ross Churchley's avatar
Ross Churchley committed
23
24
25
26
%
% 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.
%
Ross Churchley's avatar
Ross Churchley committed
27
28
29
30
%
%
% \subsubsection{Package dependencies}
%
31
%    \begin{macrocode}
32
\RequirePackage{etoolbox}
33
34
35
36
\RequirePackage{calc}
\RequirePackage{pgfopts}
%    \end{macrocode}
%
Ross Churchley's avatar
Ross Churchley committed
37
38
%
%
39
% \subsubsection{Options}
40
%
Bernhard Heinloth's avatar
Bernhard Heinloth committed
41
42
43
44
45
46
47
48
49
50
51
52
53
% \begin{macro}{icon}
%    Adds an icon to the frametitle on each slide.
%    \begin{macrocode}
\pgfkeys{
  /neo/outer/frametitle icon/.cd,
    .is choice,
    none/.code=\setbeamertemplate{frametitle icon}[none],
    i4/.code=\setbeamertemplate{frametitle icon}[i4],
    fau/.code=\setbeamertemplate{frametitle icon}[fau],
}
%    \end{macrocode}
% \end{macro}
%
54
% \begin{macro}{numbering}
Ross Churchley's avatar
Ross Churchley committed
55
%    Adds slide numbers to the bottom right of each slide.
56
%    \begin{macrocode}
57
\pgfkeys{
Bernhard Heinloth's avatar
Bernhard Heinloth committed
58
  /neo/outer/numbering/.cd,
59
60
61
62
63
    .is choice,
    none/.code=\setbeamertemplate{frame numbering}[none],
    counter/.code=\setbeamertemplate{frame numbering}[counter],
    fraction/.code=\setbeamertemplate{frame numbering}[fraction],
}
64
%    \end{macrocode}
65
66
67
% \end{macro}
%
% \begin{macro}{progressbar}
Ross Churchley's avatar
Ross Churchley committed
68
%    Adds a progress bar to the top, bottom, or frametitle of each slide.
69
70
%    \begin{macrocode}
\pgfkeys{
Bernhard Heinloth's avatar
Bernhard Heinloth committed
71
  /neo/outer/progressbar/.cd,
72
    .is choice,
Ross Churchley's avatar
Fix #46    
Ross Churchley committed
73
74
75
76
77
    none/.code={%
      \setbeamertemplate{headline}[plain]
      \setbeamertemplate{frametitle}[plain]
      \setbeamertemplate{footline}[plain]
    },
Bernhard Heinloth's avatar
Bernhard Heinloth committed
78
    head/.code={\pgfkeys{/neo/outer/progressbar=none}
79
80
81
      \addtobeamertemplate{headline}{}{%
        \usebeamertemplate*{progress bar in head/foot}
      }
Ross Churchley's avatar
Fix #46    
Ross Churchley committed
82
    },
Bernhard Heinloth's avatar
Bernhard Heinloth committed
83
    frametitle/.code={\pgfkeys{/neo/outer/progressbar=none}
84
85
86
      \addtobeamertemplate{frametitle}{}{%
        \usebeamertemplate*{progress bar in head/foot}
      }
Ross Churchley's avatar
Fix #46    
Ross Churchley committed
87
    },
Bernhard Heinloth's avatar
Bernhard Heinloth committed
88
    foot/.code={\pgfkeys{/neo/outer/progressbar=none}
89
90
91
      \addtobeamertemplate{footline}{}{%
        \usebeamertemplate*{progress bar in head/foot}%
      }
Ross Churchley's avatar
Fix #46    
Ross Churchley committed
92
    },
93
94
95
96
}
%    \end{macrocode}
% \end{macro}
%
Bernhard Heinloth's avatar
Bernhard Heinloth committed
97
% \begin{macro}{\neo@outer@setdefaults}
Ross Churchley's avatar
Ross Churchley committed
98
%    Sets default values for outer theme options.
99
%    \begin{macrocode}
Bernhard Heinloth's avatar
Bernhard Heinloth committed
100
101
\newcommand{\neo@outer@setdefaults}{
  \pgfkeys{/neo/outer/.cd,
Bernhard Heinloth's avatar
Bernhard Heinloth committed
102
    frametitle icon=none,
103
    numbering=counter,
Bernhard Heinloth's avatar
Bernhard Heinloth committed
104
    progressbar=none,
105
106
107
108
109
  }
}
%    \end{macrocode}%
% \end{macro}
%
110
111
%
%
112
% \subsubsection{Head and footline}
Ross Churchley's avatar
Ross Churchley committed
113
114
%
% All good |beamer| presentations should already remove the navigation symbols,
115
% but \themename removes them automatically (just in case).
Ross Churchley's avatar
Ross Churchley committed
116
117
118
119
120
%
%    \begin{macrocode}
\setbeamertemplate{navigation symbols}{}
%    \end{macrocode}
%
Bernhard Heinloth's avatar
Bernhard Heinloth committed
121
122
123
124
125
126
127
% \begin{macro}{frametitle icon}
%    Templates for the icon on the right of the frame title.
%    \begin{macrocode}
\defbeamertemplate{frametitle icon}{none}{}
\defbeamertemplate{frametitle icon}{i4}{ \hfill\raisebox{-.25\height}{\includegraphics[height=1.2em]{images/logo-i4-white}}}
\defbeamertemplate{frametitle icon}{fau}{ \hfill\raisebox{-.25\height}{\includegraphics[height=1.2em]{images/logo-fau-white}}}
%    \end{macrocode}
Bernhard Heinloth's avatar
Bernhard Heinloth committed
128
% \end{macro}
Bernhard Heinloth's avatar
Bernhard Heinloth committed
129
%
Ross Churchley's avatar
Ross Churchley committed
130
131
132
% \begin{macro}{frame numbering}
%    Templates for the frame number. Can be omitted, shown or displayed as a
%    fraction of the total frames.
133
%    \begin{macrocode}
davidcorteso's avatar
davidcorteso committed
134
135
136
137
\defbeamertemplate{frame footer}{none}{}
\defbeamertemplate{frame footer}{custom}[1]{ #1 }
%    \end{macrocode}
%
138
%    Add strut to ensure that frame numbers don't jump
davidcorteso's avatar
davidcorteso committed
139
%    \begin{macrocode}
140
\newcommand{\neo@framenumberingstrut}{\vphantom{0123456789}}
Ross Churchley's avatar
Fix #46    
Ross Churchley committed
141
\defbeamertemplate{frame numbering}{none}{}
142
\defbeamertemplate{frame numbering}{counter}{\neo@framenumberingstrut\insertframenumber}
143
\defbeamertemplate{frame numbering}{fraction}{
144
  \neo@framenumberingstrut\insertframenumber/\inserttotalframenumber
145
146
}
%    \end{macrocode}
Ross Churchley's avatar
Ross Churchley committed
147
% \end{macro}
148
%
Ross Churchley's avatar
Ross Churchley committed
149
150
151
% \begin{macro}{headline}
% \begin{macro}{footline}
%    Templates for the head- and footline at the top and bottom of each frame.
Ross Churchley's avatar
Ross Churchley committed
152
%    \begin{macrocode}
Ross Churchley's avatar
Fix #46    
Ross Churchley committed
153
154
155
156
\defbeamertemplate{headline}{plain}{}
\defbeamertemplate{footline}{plain}{%
  \begin{beamercolorbox}[wd=\textwidth, sep=3ex]{footline}%
    \usebeamerfont{page number in head/foot}%
davidcorteso's avatar
davidcorteso committed
157
158
    \usebeamertemplate*{frame footer}
    \hfill%
Ross Churchley's avatar
Fix #46    
Ross Churchley committed
159
    \usebeamertemplate*{frame numbering}
Ross Churchley's avatar
Ross Churchley committed
160
161
162
  \end{beamercolorbox}%
}
%    \end{macrocode}
Ross Churchley's avatar
Ross Churchley committed
163
164
% \end{macro}
% \end{macro}
Ross Churchley's avatar
Ross Churchley committed
165
166
167
%
%
%
168
169
% \subsubsection{Frametitle}
%
170
% \begin{macro}{frametitle}
Ross Churchley's avatar
Ross Churchley committed
171
172
%    Templates for the frame title, which is optionally underlined with a
%    progress bar.
173
%    \begin{macrocode}
Bernhard Heinloth's avatar
Bernhard Heinloth committed
174
175
176
177
\newlength{\neo@frametitle@padding}
\setlength{\neo@frametitle@padding}{2.2ex}
\newcommand{\neo@frametitlestrut@start}{
  \rule{0pt}{\neo@frametitle@padding +%
Benjamin Weiss's avatar
Benjamin Weiss committed
178
    \totalheightof{%
Bernhard Heinloth's avatar
Bernhard Heinloth committed
179
      \ifcsdef{neo@frametitleformat}{\neo@frametitleformat X}{X}%
Benjamin Weiss's avatar
Benjamin Weiss committed
180
181
182
    }%
  }%
}
Bernhard Heinloth's avatar
Bernhard Heinloth committed
183
184
\newcommand{\neo@frametitlestrut@end}{
  \rule[-\neo@frametitle@padding]{0pt}{\neo@frametitle@padding}
185
}
186
\defbeamertemplate{frametitle}{plain}{%
187
  \nointerlineskip%
188
  \begin{beamercolorbox}[%
189
      wd=\paperwidth,%
Benjamin Weiss's avatar
Benjamin Weiss committed
190
      sep=0pt,%
Bernhard Heinloth's avatar
Bernhard Heinloth committed
191
192
      leftskip=\neo@frametitle@padding,%
      rightskip=\neo@frametitle@padding,%
193
    ]{frametitle}%
Bernhard Heinloth's avatar
Bernhard Heinloth committed
194
  \neo@frametitlestrut@start%
195
  \insertframetitle%
Bernhard Heinloth's avatar
Bernhard Heinloth committed
196
  \usebeamertemplate*{frametitle icon}%
197
  \nolinebreak%
Bernhard Heinloth's avatar
Bernhard Heinloth committed
198
  \neo@frametitlestrut@end%
199
200
  \end{beamercolorbox}%
}
201
202
203
204
\setbeamertemplate{frametitle continuation}{%
  \usebeamerfont{frametitle}
  \romannumeral \insertcontinuationcount
}
205
206
207
208
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{progress bar in head/foot}
Ross Churchley's avatar
Ross Churchley committed
209
210
211
%    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|.
212
%    \begin{macrocode}
Bernhard Heinloth's avatar
Bernhard Heinloth committed
213
214
\newlength{\neo@progressinheadfoot}
\newlength{\neo@progressinheadfoot@linewidth}
Bernhard Heinloth's avatar
Bernhard Heinloth committed
215
\setlength{\neo@progressinheadfoot@linewidth}{0.8pt}
216
\setbeamertemplate{progress bar in head/foot}{
217
  \nointerlineskip
Bernhard Heinloth's avatar
Bernhard Heinloth committed
218
  \setlength{\neo@progressinheadfoot}{%
219
220
    \paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
  }%
Ross Churchley's avatar
Fix #46    
Ross Churchley committed
221
  \begin{beamercolorbox}[wd=\paperwidth]{progress bar in head/foot}
222
    \tikzexternaldisable%
223
    \begin{tikzpicture}
Bernhard Heinloth's avatar
Bernhard Heinloth committed
224
225
      \fill[bg] (0,0) rectangle (\paperwidth, \neo@progressinheadfoot@linewidth);
      \fill[fg] (0,0) rectangle (\neo@progressinheadfoot, \neo@progressinheadfoot@linewidth);
226
    \end{tikzpicture}%
227
    \tikzexternalenable%
228
229
230
231
232
  \end{beamercolorbox}
}
%    \end{macrocode}
% \end{macro}
%
Ross Churchley's avatar
Ross Churchley committed
233
234
%
%
Ross Churchley's avatar
Ross Churchley committed
235
% \begin{macro}{appendix}
236
237
238
239
%    Removes page numbering and per-slide progress bars when |\appendix| is
%    called. This makes it easier to include additional ``backup slides'' at
%    the end of the presentation, especially in conjunction with the package
%    |appendixnumberbeamer|.
Ross Churchley's avatar
Ross Churchley committed
240
241
242
243
%    \begin{macrocode}
\AtBeginDocument{%
  \apptocmd{\appendix}{%
    \pgfkeys{%
Bernhard Heinloth's avatar
Bernhard Heinloth committed
244
      /neo/outer/.cd,
Ross Churchley's avatar
Ross Churchley committed
245
246
247
248
249
250
      numbering=none,
      progressbar=none}
    }{}{}
}
%    \end{macrocode}
% \end{macro}
Ross Churchley's avatar
Ross Churchley committed
251
% \subsubsection{Process package options}
252
%
253
%    \begin{macrocode}
Bernhard Heinloth's avatar
Bernhard Heinloth committed
254
255
\neo@outer@setdefaults
\ProcessPgfPackageOptions{/neo/outer}
256
%    \end{macrocode}
257
%
Ross Churchley's avatar
Ross Churchley committed
258
259
260
261
262
% \iffalse
%</package>
% \fi
% \Finale
\endinput