-
Notifications
You must be signed in to change notification settings - Fork 82
/
beamerthemeExecushares.sty
215 lines (189 loc) · 8.37 KB
/
beamerthemeExecushares.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
% the various libraries we will be using
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[none]{hyphenat}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\newif\ifbeamer@pixelitem
\beamer@pixelitemtrue
\DeclareOptionBeamer{nopixelitem}{\beamer@pixelitemfalse}
\ProcessOptionsBeamer
% define colours
% taken from pickton on Adobe Kuler:
% https://kuler.adobe.com/Some-Kind-Of-Execushares-color-theme-3837185/
\definecolor{ExecusharesRed}{RGB}{230,37,52}
\definecolor{ExecusharesBlack}{RGB}{43,40,40}
\definecolor{ExecusharesBlue}{RGB}{22,190,207}
\definecolor{ExecusharesWhite}{RGB}{255,255,243}
\definecolor{ExecusharesGrey}{RGB}{107,110,108}
% use Adobe's Source Pro fonts:
% Source Serif Pro: https://github.com/adobe-fonts/source-serif-pro
% Source Sans Pro: https://github.com/adobe-fonts/source-sans-pro
% Source Code Pro: https://github.com/adobe-fonts/source-code-pro
\setmainfont{Source Serif Pro}
\setsansfont{Source Sans Pro}
\setmonofont{Source Code Pro}
% To use with pdflatex,
% comment the fontspec package at the top
%\usepackage{sourceserifpro}
%\usepackage{sourcesanspro}
%\usepackage{sourcecodepro}
% set colours
\setbeamercolor{itemize item}{fg=ExecusharesBlue}
\setbeamercolor{enumerate item}{fg=ExecusharesBlue}
\setbeamercolor{alerted text}{fg=ExecusharesBlue}
\setbeamercolor{section in toc}{fg=ExecusharesBlack}
% set fonts
\setbeamerfont{itemize/enumerate body}{size=\large}
\setbeamerfont{itemize/enumerate subbody}{size=\normalsize}
\setbeamerfont{itemize/enumerate subsubbody}{size=\small}
\ifbeamer@pixelitem
% make the itemize bullets pixelated >
\setbeamertemplate{itemize item}{
\tikz{
\draw[fill=ExecusharesBlue,draw=none] (0, 0) rectangle(0.1, 0.1);
\draw[fill=ExecusharesBlue,draw=none] (0.1, 0.1) rectangle(0.2, 0.2);
\draw[fill=ExecusharesBlue,draw=none] (0, 0.2) rectangle(0.1, 0.3);
}
}
% make the subitems also pixelated >, but a little smaller and red
\setbeamertemplate{itemize subitem}{
\tikz{
\draw[fill=ExecusharesRed,draw=none] (0, 0) rectangle(0.075, 0.075);
\draw[fill=ExecusharesRed,draw=none] (0.075, 0.075) rectangle(0.15, 0.15);
\draw[fill=ExecusharesRed,draw=none] (0, 0.15) rectangle(0.075, 0.225);
}
}
\fi
% disable navigation
\setbeamertemplate{navigation symbols}{}
% custom draw the title page above
\setbeamertemplate{title page}{}
% again, manually draw the frame title above
\setbeamertemplate{frametitle}{}
% disable "Figure:" in the captions
\setbeamertemplate{caption}{\tiny\insertcaption}
\setbeamertemplate{caption label separator}{}
% since I don't know a better way to do this, these are all switches
% doing `\setcounter{showProgressBar}{0}` will turn the progress bar off (I turn it off for Appendix slides)
% etc
\newcounter{showProgressBar}
\setcounter{showProgressBar}{1}
\newcounter{showSlideNumbers}
\setcounter{showSlideNumbers}{1}
\newcounter{showSlideTotal}
\setcounter{showSlideTotal}{1}
% Set beginning of backup slides
% This lets you having the slides counter ending with the "thank you" slide and avoiding the annoying question "why is the thank you at slide 38/41?"
\newcommand{\backupbegin}{
\newcounter{finalframe}
\setcounter{finalframe}{\value{framenumber}}
}
\newcommand{\backupend}{
\setcounter{framenumber}{\value{finalframe}}
}
% use \makeatletter for our progress bar definitions
% progress bar idea from http://tex.stackexchange.com/a/59749/44221
% slightly adapted for visual purposes here
\makeatletter
\newcount\progressbar@tmpcounta% auxiliary counter
\newcount\progressbar@tmpcountb% auxiliary counter
\newdimen\progressbar@pbwidth %progressbar width
\newdimen\progressbar@tmpdim % auxiliary dimension
\newdimen\slidewidth % auxiliary dimension
\newdimen\slideheight % auxiliary dimension
% make the progress bar go across the screen
%\progressbar@pbwidth=12.8cm
\progressbar@pbwidth=\the\paperwidth
\slidewidth=\the\paperwidth
\slideheight=\the\paperheight
% use tikz to draw everything
% it may not be the best, but it's easy to work with
% and looks good
% TODO: base title slide and contents slide on something other than slide numbers :/
\setbeamertemplate{background}{
% deal with progress bar stuff
% (calculate where it should go)
\progressbar@tmpcounta=\insertframenumber
\progressbar@tmpcountb=\inserttotalframenumber
\progressbar@tmpdim=\progressbar@pbwidth
\divide\progressbar@tmpdim by 100
\multiply\progressbar@tmpdim by \progressbar@tmpcounta
\divide\progressbar@tmpdim by \progressbar@tmpcountb
\multiply\progressbar@tmpdim by 100
\begin{tikzpicture}
% set up the entire slide as the canvas
\useasboundingbox (0,0) rectangle(\the\paperwidth,\the\paperheight);
% the background
\fill[color=ExecusharesWhite] (0,0) rectangle(\the\paperwidth,\the\paperheight);
% separate the drawing based on if we're the first (title) slide or not
\ifnum\thepage=1\relax
% the title page
% draw the fills
\fill[color=ExecusharesRed] (0, 4cm) rectangle(\slidewidth,\slideheight);
% draw the actual text
\node[anchor=south,text width=\slidewidth-1cm,inner xsep=0.5cm] at (0.5\slidewidth,4cm) {\color{ExecusharesWhite}\Huge\textbf{\inserttitle}};
\node[anchor=north east,text width=\slidewidth-1cm,align=right] at (\slidewidth-0.4cm,4cm) {\color{ExecusharesBlack}\tiny\insertsubtitle};
\node[above] at(0.5\slidewidth,2.3cm) {\color{ExecusharesBlack}\tiny by};
\node at (0.5\slidewidth,2cm) {\color{ExecusharesBlack}\LARGE\insertauthor};
% add the date in the corner
\node[anchor=south east] at(\slidewidth,0cm) {\color{ExecusharesGrey}\tiny\insertdate};
\else
% NOT the title page
% title bar
\fill[color=ExecusharesRed] (0, \slideheight-1cm) rectangle(\slidewidth,\slideheight);
% swap the comment on these to add section titles to slide titles
%\node[anchor=north,text width=11.8cm,inner xsep=0.5cm,inner ysep=0.25cm] at (6.4cm,9.6cm) {\color{ExecusharesWhite}\Large\textbf{\insertsectionhead: \insertframetitle}};
\node[anchor=north,text width=\slidewidth-1cm,inner xsep=0.5cm,inner ysep=0.25cm] at (0.5\slidewidth,\slideheight) {\color{ExecusharesWhite}\huge\textbf{\insertframetitle}};
% if we're showing a progress bar, show it
% (I disable the progress bar and slide numbers for the "Appendix" slides)
\ifnum \value{showProgressBar}>0\relax%
% the the progress bar icon in the middle of the screen
\draw[fill=ExecusharesGrey,draw=none] (0cm,0cm) rectangle(\slidewidth,0.25cm);
\draw[fill=ExecusharesRed,draw=none] (0cm,0cm) rectangle(\progressbar@tmpdim,0.25cm);
% bottom information
\node[anchor=south west] at(0cm,0.25cm) {\color{ExecusharesGrey}\tiny\vphantom{lp}\insertsection};
% if slide numbers are active
\ifnum \value{showSlideNumbers}>0\relax%
% if slide totals are active
\ifnum \value{showSlideTotal}>0\relax%
% draw both slide number and slide total
\node[anchor=south east] at(\slidewidth,0.25cm) {\color{ExecusharesGrey}\tiny\insertframenumber/\inserttotalframenumber};
\else
% slide totals aren't active, don't draw them
\node[anchor=south east] at(\slidewidth,0.25cm) {\color{ExecusharesGrey}\tiny\insertframenumber};
\fi
\fi
% don't show the progress bar?
\else
% section title in the bottom left
\node[anchor=south west] at(0cm,0cm) {\color{ExecusharesGrey}\tiny\vphantom{lp}\insertsection};
% if we're showing slide numbers
\ifnum \value{showSlideNumbers}>0\relax%
% if slide totals are active
\ifnum \value{showSlideTotal}>0\relax%
% draw both slide number and slide total
\node[anchor=south east] at(\slidewidth,0cm) {\color{ExecusharesGrey}\tiny\insertframenumber/\inserttotalframenumber};
\else
% slide totals aren't active, don't draw them
\node[anchor=south east] at(\slidewidth,0cm) {\color{ExecusharesGrey}\tiny\insertframenumber};
\fi
\fi
\fi
\fi
\end{tikzpicture}
}
\makeatother
% add section titles
\AtBeginSection{\frame{\sectionpage}}
\setbeamertemplate{section page}
{
\begin{tikzpicture}
% set up the entire slide as the canvas
\useasboundingbox (0,0) rectangle(\slidewidth,\slideheight);
%\fill[color=ExecusharesWhite] (0,0) rectangle(\the\paperwidth,\the\paperheight);
\fill[color=ExecusharesWhite] (-1cm, 2cm) rectangle (\slidewidth, \slideheight+0.1cm);
\fill[color=ExecusharesRed] (-1cm, 0.5\slideheight-1cm) rectangle(\slidewidth, 0.5\slideheight+1cm);
\node[text width=\the\paperwidth-1cm,align=center] at (0.4\slidewidth, 0.5\slideheight) {\color{ExecusharesWhite}\Huge\textbf{\insertsection}};
\end{tikzpicture}
}