-
Notifications
You must be signed in to change notification settings - Fork 2
/
beamerouterthemeAAUsidebar.sty
executable file
·303 lines (280 loc) · 11.7 KB
/
beamerouterthemeAAUsidebar.sty
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
% The outer AAU sidebar theme is derived from the outer sidebar theme which has the following
% copyright notice:
% Copyright 2007 by Till Tantau
% This file may be distributed and/or modified under the GNU Public License.
%
% See the file doc/licenses/LICENSE for more details.
% <end of copyright notice>
%
% All the changes are (c) 2010-2014 by Jesper Kjær Nielsen <jkn@es.aau.dk> and are
% provided under the same license. (GPLv3)
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You can find the GNU General Public License at <http://www.gnu.org/licenses/>.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{beamerouterthemeAAUsidebar}[2014/09/13 v1.4.0 The AAU Sidebar Beamer Theme]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Load required packages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{tikz}
\usetikzlibrary{external}
\RequirePackage{calc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Theme options and definitions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%theme options
\newlength{\beamer@width}
\setlength{\beamer@width}{2.2cm}
\DeclareOptionBeamer{width}{\beamer@width=#1}
\DeclareOptionBeamer{left}{\def\beamer@sidebarside{left}}
\DeclareOptionBeamer{right}{\def\beamer@sidebarside{right}}
\DeclareOptionBeamer{hideothersubsections}[]{\beamer@nav@subsectionstyle{show/show/hide}}
\DeclareOptionBeamer{hideallsubsections}[]{\beamer@nav@subsectionstyle{hide}}
\DeclareOptionBeamer{hidetitle}{\def\beamer@hidetitle{true}}
\DeclareOptionBeamer{hideauthor}{\def\beamer@hideauthor{true}}
\DeclareOptionBeamer{hideinstitute}{\def\beamer@hideinst{true}}
\DeclareOptionBeamer{shownavsym}{\def\beamer@shownavsym{true}}
\ExecuteOptionsBeamer{right}
\ProcessOptionsBeamer
%the height of the header is 2.5 times the lineheight of the frame title
\newlength{\beamer@height}
\usebeamerfont{frametitle} %use the frame title font
\setlength{\beamer@height}{2.5\baselineskip}
\reset@font %reset fonts
\def\beamer@lefttext{left} %used for comparison below
%width of vertical bar separating the main text from the sidebar
\newlength{\beamer@barwidth}
\setlength{\beamer@barwidth}{2\beamer@height/15} %the bar width depends on the header height (by a factor of 7.5)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%beamer specific options
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mode<presentation>%refers to the first four modes (beamer,handout,second and trans). That is, to all modes except the article mode
{
\ifbeamercolorempty[fg]{AAUsidebar}{%
%define the aau sidebar color if it is not defined (which may be due to that the AAUsidebar color theme is not loaded)
\setbeamercolor{AAUsidebar}{use={structure,palette sidebar primary},fg=palette sidebar primary.fg,bg=structure.fg}
}{%
%aau header is defined - nothing to do
}
\setbeamersize{sidebar width \beamer@sidebarside=\beamer@width}
\setbeamersize{text margin left=0.5cm,text margin right=0.5cm}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%templates
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %headline
\defbeamertemplate*{headline}{AAUsidebar theme}{%
\AAUheaderbackground%
}
%frame title
\defbeamertemplate*{frametitle}{AAUsidebar theme}{%
\ifx\beamer@sidebarside\beamer@lefttext% sidebar on the left
\hfill%
\fi%
\begin{minipage}[c][\beamer@height][c]{\textwidth-\beamer@height/2}
{\usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\insertframetitle\par}%
{\usebeamercolor[fg]{framesubtitle}\usebeamerfont{framesubtitle}\insertframesubtitle\par}%
\end{minipage}
\ifx\beamer@sidebarside\beamer@righttext% sidebar on the right
\hfill%
\fi%
}
%sidebar
\defbeamertemplate*{sidebar \beamer@sidebarside}{AAUsidebar theme}{%
\AAUsidebarbackground%
\vspace{\beamer@height}%
\vspace{2\baselineskip}\par%
\ifx\beamer@hidetitle\undefined% insert short title
\vspace{-\baselineskip}
\hspace{0.05\beamer@width}%
{%
\usebeamercolor[fg]{title in sidebar}
\usebeamerfont{title in sidebar}%
\insertshorttitle[width={0.9\beamer@width},center,respectlinebreaks]
}%
\hspace{0.05\beamer@width}
\vspace{2\baselineskip}\par%
\fi
\ifx\beamer@hideauthor\undefined% insert short author
\vspace{-\baselineskip}
\hspace{0.05\beamer@width}%
{%
\usebeamercolor[fg]{author in sidebar}
\usebeamerfont{author in sidebar}%
\insertshortauthor[width={0.9\beamer@width},center,respectlinebreaks]
}
\hspace{0.05\beamer@width}
\vspace{\baselineskip}\par%
\fi
\insertverticalnavigation{\beamer@width}%
\strut\vfill%
\ifx\beamer@hideinst\undefined% insert short institute
\vbox{\hspace{0.05\beamer@width}%
{%
\usebeamercolor[fg]{title in sidebar}
\usebeamerfont{subtitle in sidebar}%
\insertshortinstitute[width={0.9\beamer@width},center,respectlinebreaks]
}
\hspace{0.05\beamer@width}%
\vspace*{\baselineskip}
}%
\fi
\ifx\beamer@shownavsym\undefined% insert navigation symbols
%do nothing
\else
%insert the navigation symbols if the sidebar is on the right
\ifx\beamer@sidebarside\beamer@lefttext %sidebar on the left
%do nothing
\else
\vspace*{-2\baselineskip}
\llap{\usebeamertemplate***{navigation symbols}\hskip0.4cm}
\vskip2pt
\fi
\fi
}
% When the sidebar is on the left, the default theme places a logo in the bottom right of the slide (this is NOT the case, when the sidebar is on the right). We remove this logo.
\ifx\beamer@sidebarside\beamer@lefttext %sidebar on the left
\defbeamertemplate*{sidebar right}{AAUsidebar theme}{%
% remove the logo and insert the navigation symbols if option is set
\ifx\beamer@shownavsym\undefined% insert navigation symbols
%do nothing
\else %insert navigation symbols
\vfill%
\llap{\usebeamertemplate***{navigation symbols}\hskip0.4cm}
\vskip2pt
\fi
}
\fi
% current section in the sidebar
\defbeamertemplate*{section in sidebar}{AAUsidebar theme}{%
\vbox{%
\vskip1ex% add some extra space when inserting a new section
\sidebarnavitem{4pt}{section in sidebar}{%
\sidebarcurframe{\insertframenumber}%
\insertsectionhead
}
}
}
% all section in the sidebar but the current
\defbeamertemplate*{section in sidebar shaded}{AAUsidebar theme}{%
\vbox{%
\vskip1ex% add some extra space when inserting a new section
\sidebarnavitem{4pt}{section in sidebar shaded}{\insertsectionhead}
}
}
% current subsection in the sidebar
\defbeamertemplate*{subsection in sidebar}{AAUsidebar theme}{%
\sidebarnavitem{6pt}{subsection in sidebar}{
\sidebarcurframe{\insertframenumber}%
\insertsubsectionhead
}
}
% all subsection in the sidebar but the current
\defbeamertemplate*{subsection in sidebar shaded}{AAUsidebar theme}{%
\sidebarnavitem{6pt}{subsection in sidebar shaded}{\insertsubsectionhead}
}
% current subsubsection in the sidebar
\defbeamertemplate*{subsubsection in sidebar}{AAUsidebar theme}{%
\sidebarnavitem{8pt}{subsubsection in sidebar}{
\sidebarcurframe{\insertframenumber}%
\insertsubsubsectionhead
}
}
% all subsubsection in the sidebar but the current
\defbeamertemplate*{subsubsection in sidebar shaded}{AAUsidebar theme}{%
\sidebarnavitem{8pt}{subsubsection in sidebar shaded}{\insertsubsubsectionhead}
}
\ifx\beamer@shownavsym\undefined% insert navigation symbols
\setbeamertemplate{navigation symbols}{%
%disable navigation symbols
}
\fi
}%end of beamer specific options
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Macros used in the theme
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% the fancy header background
\newcommand{\AAUheaderbackground}[0]{%
\tikzexternaldisable
\begin{tikzpicture}[overlay]
\ifx\beamer@sidebarside\beamer@lefttext% sidebar on the left
\coordinate (UC) at (\paperwidth,0); %upper right corner of the slide
\coordinate (LC) at (0,-\paperheight); %lower left corner of the slide
\coordinate (BS) at (\paperwidth,-\beamer@height); %start coordinate of the bar
\coordinate (BE) at (\beamer@width+\beamer@barwidth/2,-\paperheight); %end coordinate of the bar
\else% sidebar on the right
\coordinate (UC) at (0,0); %upper left corner of the slide
\coordinate (LC) at (\paperwidth,-\paperheight); %lower right corner of the slide
\coordinate (BS) at (0,-\beamer@height); %start coordinate of the bar
\coordinate (BE) at (\paperwidth-\beamer@width-\beamer@barwidth/2,-\paperheight); %end coordinate of the bar
\fi
\coordinate (IS) at (BS -| BE); %intersection
\coordinate (logopos) at ([yshift=\beamer@height/2] IS);%coordinate of the logo
%draw the background of the header, the circle and the logo
{\usebeamercolor{frametitle}%
\usebeamercolor{AAUsidebar}%
\draw[draw=none,fill=frametitle.bg] (UC) rectangle (IS -| LC);
\fill[fill=AAUsidebar.fg] ([yshift=\beamer@height/2] IS) circle (1.15*\beamer@height/2);
\node at (logopos) {\includegraphics[width=0.9\beamer@height]{images/logo_new_circle}};
}
\end{tikzpicture}%
\tikzexternalenable
}
% the fancy background in the sidebar
\newcommand{\AAUsidebarbackground}[0]{%
\tikzexternaldisable
\begin{tikzpicture}[remember picture,overlay]
\ifx\beamer@sidebarside\beamer@lefttext% sidebar on the left
\coordinate (BS) at (\paperwidth,-\beamer@height); %start coordinate of the bar
\coordinate (BE) at (\beamer@width+\beamer@barwidth/2,-\paperheight); %end coordinate of the bar
\else% sidebar on the right
\coordinate (BS) at (-\paperwidth+\beamer@width,-\beamer@height); %start coordinate of the bar
\coordinate (BE) at (-\beamer@barwidth/2,-\paperheight); %end coordinate of the bar
\fi
\coordinate (IS) at (BS -| BE); %intersection
%draw the thick line
{\usebeamercolor{AAUsidebar}%
\draw[color=fg,line width=\beamer@barwidth] (IS) -- (BE);
}
%draw the circle with the total frame number
{\usebeamercolor{palette sidebar primary}%
\usebeamercolor{AAUsidebar}%
\usebeamerfont{subsection in sidebar}%
\node[fill=palette sidebar primary.bg,draw=AAUsidebar.fg,circle,very thick,minimum width=4mm] at ([yshift=2mm] BE) {{\usebeamercolor[fg]{subsection in sidebar}\inserttotalframenumber}};
}
\end{tikzpicture}%
\tikzexternalenable
}
% sidebar navigation item
\newcommand{\sidebarnavitem}[3]{%
\begin{beamercolorbox}[wd=\beamer@width,leftskip=#1,rightskip=1ex plus1fil,vmode]{#2}
\vbox{}% insert a blank line
#3\par%
\vbox{}% insert a blank line
\vskip-1.5ex%
\end{beamercolorbox}
}
% current frame number
\newcommand{\sidebarcurframe}[1]{%
\tikzexternaldisable
\begin{tikzpicture}[remember picture,overlay]
\coordinate (CS) at (0,0.8ex); % coordinate of the current section
\coordinate (CF) at (IS |- CS); % coordinate of the current frame number
{%
\usebeamercolor{palette sidebar primary}%
\usebeamercolor{AAUsidebar}%
% \draw[color=bg,line width=\beamer@barwidth] (IS) -| (CF);
\node[fill=palette sidebar primary.bg,draw=AAUsidebar.fg,circle,minimum width=3.5mm,thick] at (CF) {{\fontsize{4}{5}\selectfont{\usebeamercolor[fg]{subsection in sidebar}#1}}};
}
\end{tikzpicture}%
\tikzexternalenable
}
\mode<all>