-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbeamerthemecbflec.sty
138 lines (126 loc) · 5.63 KB
/
beamerthemecbflec.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
% a color-blind friendly simple beamer theme for lecture slides
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cbflec}[2023/03/14 color-blind friendly lecture slides]
\RequirePackage{tikz}
\RequirePackage[none]{hyphenat}
\RequirePackage{ifthen}
% color-blind friendly colors based on Wong (2011) [https://www.nature.com/articles/nmeth.1618]
\definecolor{blue}{RGB}{0,114,178}
\definecolor{red}{RGB}{213,94,0}
\definecolor{yellow}{RGB}{240,228,66}
\definecolor{green}{RGB}{0,158,115}
\definecolor{purple}{RGB}{204,121,167}
\definecolor{orange}{RGB}{230,159,0}
% setting colors
\setbeamercolor{background canvas}{bg=white}
\setbeamercolor{normal text}{fg=black}
\setbeamercolor{section in toc}{fg=black}
\setbeamercolor{frametitle}{fg=blue}
\setbeamercolor{framesubtitle}{fg=blue}
\setbeamercolor{itemize item}{fg=blue}
\setbeamercolor{itemize subitem}{fg=blue}
\setbeamercolor{itemize subsubitem}{fg=blue}
\setbeamercolor{enumerate item}{fg=black}
\setbeamercolor{enumerate subitem}{fg=black}
\setbeamercolor{enumerate subsubitem}{fg=black}
\setbeamercolor{alerted text}{fg=red}
\setbeamercolor{description item}{fg=red}
\setbeamercolor{block title}{fg=black, bg=orange!75}
\setbeamercolor{block body}{bg=orange!25}
\setbeamercolor{block title example}{fg=black, bg=teal!75}
\setbeamercolor{block body example}{bg=teal!25}
% style
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamertemplate{footline}[frame number]
\setbeamertemplate{navigation symbols}{} % disable navigation
\setbeamertemplate{caption}{\insertcaption} % disable "Figure:" and "Table:" in the captions
\setbeamertemplate{caption label separator}{}
\setbeamertemplate{title page}{}
\setbeamertemplate{frame title}{series=\bfseries}
\defbeamertemplate{description item}{align left}{\insertdescriptionitem\hfill}
\setbeamertemplate{description item}[align left]
\newcommand{\pw}{\the\paperwidth}
\newcommand{\ph}{\the\paperheight}
% declaring transition frame background color options
\newcommand{\tfcolor}{blue}
\newcommand{\tftextcolor}{white}
\DeclareOption{blue}{
\renewcommand{\tfcolor}{blue}
\renewcommand{\tftextcolor}{white}
}
\DeclareOption{yellow}{
\renewcommand{\tfcolor}{yellow}
\renewcommand{\tftextcolor}{black}
}
\DeclareOption*{\PackageError{cbflec}{Unknown ‘\CurrentOption’}{Pass either blue or yellow}}
% declaring itemize item marker shapes
\newcommand{\ishape}{circle}
\DeclareOption{circle}{
\renewcommand{\ishape}{circle}
}
\DeclareOption{square}{
\renewcommand{\ishape}{square}
}
\DeclareOption{triangle}{
\renewcommand{\ishape}{triangle}
}
\DeclareOption*{\PackageError{cbflec}{Unknown ‘\CurrentOption’}{Pass either circle, square, or triangle}}
\ExecuteOptions{blue, circle}
\ProcessOptions\relax
% style of itemize item markers
\setbeamertemplate{itemize item}[\ishape]
\setbeamertemplate{itemize subitem}[\ishape]
\setbeamertemplate{itemize subsubitem}[\ishape]
% title page background
\setbeamertemplate{background}{
\begin{tikzpicture}
% set up the entire slide as the canvas
\useasboundingbox (0,0) rectangle (\pw,\ph);
\ifnum\thepage=1\relax
% title page
% draw the fills
\fill[color=blue] (0,\ph*0.5) rectangle (\pw,\ph);
% draw the actual text on the title page
\node[anchor=south, align=center, text width=\pw - 10pt, execute at begin node=\setlength{\baselineskip}{6ex}] at (\pw*0.5,\ph*0.5) {\color{white}\Huge\textbf{\inserttitle}};
\node[anchor=north east, align=center, text width=\pw - 10pt] at (\pw - 5pt,\ph*0.5) {\color{black}\large\insertsubtitle};
\makeatletter
\ifthenelse{\NOT\equal{\beamer@shortauthor}{}}{
\node[anchor=north, align=center, execute at begin node=\setlength{\baselineskip}{10pt}] at (\pw/2,\ph/3) {\color{black}\LARGE\insertauthor};
\node[anchor=north, align=center] at (\pw/2,\ph/3 - 7ex) {\color{black}\normalsize\insertinstitute};
\node[anchor=north, align=center] at (\pw/2,\ph/3 - 12ex) {\color{black}\normalsize\insertdate};
}{
\ifthenelse{\NOT\equal{\beamer@shortinstitute}{}}{
\node[anchor=north, align=center] at (\pw/2,\ph/3) {\color{black}\normalsize\insertinstitute};
\node[anchor=north, align=center] at (\pw/2,\ph/3 - 7ex) {\color{black}\normalsize\insertdate};
}{
\node[anchor=north, align=center] at (\pw/2,\ph/3) {\color{black}\normalsize\insertdate};
}
}
\makeatother
\else
\fi
\end{tikzpicture}
}
% Transition frame that contains the subsection title with additional text (possibly questions)
\newenvironment{tframe}
{ \hypersetup{linkcolor=\tftextcolor}
\setbeamercolor{background canvas}{bg=\tfcolor}
\setbeamercolor{normal text}{fg=\tftextcolor}
\usebeamercolor[fg]{normal text}
\begin{frame}[plain]
\Huge\insertsubsection\\\vspace{2ex}\Large
}{
\end{frame}
\hypersetup{linkcolor=red}
}
% Subsection frame that contains the subsection title only
% Uncomment the following lines if you prefer the subsection page frame over the transition frame (see below)
% \AtBeginSubsection{\frame[plain]{\subsectionpage}}
% \setbeamertemplate{subsection page}{
% \begin{tikzpicture}
% % set up the entire slide as the canvas
% \useasboundingbox (0,0) rectangle (\pw,\ph);
% \fill[color=blue] (-1,0) rectangle (\pw,\ph);
% \node[anchor=south, align=center, text width = \pw - 10pt, execute at begin node=\setlength{\baselineskip}{5ex}] at (\pw/2-1cm,\ph/2) {\color{white}\Huge\textbf{\insertsubsection}};
% \end{tikzpicture}
% }