forked from C2SM/C2SM_Beamer_Template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbeamertools.sty
150 lines (136 loc) · 6.25 KB
/
beamertools.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
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{beamertools}
[2022/11/01 v0.01 LaTeX package for various beamer convenience functions]
\RequirePackage{xkeyval}
\RequirePackage[export]{adjustbox} % graphicx is also included
\RequirePackage{tikz}
\usetikzlibrary{shapes.arrows}
\RequirePackage[skins]{tcolorbox}
% Draw nice "imply"-like arrows
\newcommand{\beamerarrow}{\tikz{\node[single arrow,scale=0.3,
minimum width=\baselineskip, minimum height=1.8\baselineskip,fill] at (0,0) {};}}
% Display maximized figure on a full frame, keeping aspectratio
\newcommand<>{\plainFrameGraphics}[1]{
% all template changes are local to this group.
\begingroup
\setbeamertemplate{background}{}
\setbeamertemplate{navigation symbols}{}
\begin{frame}<article:0>[plain]
\begin{tikzpicture}[remember picture,overlay]
\node[at=(current page.center)] {
\includegraphics[keepaspectratio,
max height=\paperheight,max width=\paperwidth]{#1}
};
\end{tikzpicture}
\end{frame}
\endgroup
}
% Add a background figure relative to the center of the page
% put any options to \node in the #2 argument like xshift, yshift or opacity
% put any options to \includegraphics in the #3 argument
% Overlay option is passed to \node
\newcommand<>{\bgfig}[3]{
\begin{tikzpicture}[remember picture,overlay]
\node#4[at=(current page.center),#2]{\includegraphics[#3]{#1}};
\end{tikzpicture}
}
% Make blocks with custom background and itemize colors
\define@cmdkey{cblock}[cbl@]{bgcolor}[strucutre.fg]{}
\define@cmdkey{cblock}[cbl@]{itcolor}[strucutre.fg]{}
\newenvironment<>{customblock}[2][]{
\begingroup
\setkeys{cblock}{#1}
\setbeamercolor{block title}{fg=normal text.bg,bg=\cbl@bgcolor}
\setbeamercolor{block body}{parent=normal text,use=block title,bg=block title.bg!20!bg}
\addtobeamertemplate{block begin}{}{
\setbeamercolor{itemize item}{fg=\cbl@itcolor}
\setbeamercolor{itemize subitem}{fg=\cbl@itcolor}
\setbeamercolor{itemize subsubitem}{fg=\cbl@itcolor}
\setbeamercolor{item projected}{bg=\cbl@itcolor}
\setbeamercolor{enumerate item}{fg=\cbl@itcolor}
\setbeamercolor{enumerate subitem}{fg=\cbl@itcolor}
\setbeamercolor{enumerate subsubitem}{fg=\cbl@itcolor}
\setbeamercolor{description item}{fg=\cbl@itcolor}}
\begin{block}#3{#2}}
{\end{block} \endgroup}
% Make colorboxes with custom background and itemize colors
\newenvironment<>{customcolbox}[1]{
\begingroup
\setbeamercolor{boxcolor}{fg=normal text.fg,bg=#1!20!bg}
\setbeamercolor{itemize item}{fg=#1}
\setbeamercolor{itemize subitem}{fg=#1}
\setbeamercolor{itemize subsubitem}{fg=#1}
\setbeamercolor{item projected}{bg=#1}
\setbeamercolor{enumerate item}{fg=#1}
\setbeamercolor{enumerate subitem}{fg=#1}
\setbeamercolor{enumerate subsubitem}{fg=#1}
\setbeamercolor{description item}{fg=#1}
\begin{beamercolorbox}{boxcolor}}
{\end{beamercolorbox} \endgroup}
% simple tcolorbox choosing one color, itmize and bg colors are derived from it
\newenvironment<>{framebox}[2][]{
\begingroup
\setbeamercolor{itemize item}{fg=#2}
\setbeamercolor{itemize subitem}{fg=#2}
\setbeamercolor{itemize subsubitem}{fg=#2}
\setbeamercolor{item projected}{bg=#2}
\setbeamercolor{enumerate item}{fg=#2}
\setbeamercolor{enumerate subitem}{fg=#2}
\setbeamercolor{enumerate subsubitem}{fg=#2}
\begin{tcolorbox}[colback=#2!15!bg, colframe=#2, #1]}
{\end{tcolorbox} \endgroup}
% Some handy new environments
\newenvironment<>{background}[1][]{
\begingroup
\setbeamercolor{itemize item}{fg=Plum3}
\setbeamercolor{itemize subitem}{fg=Plum3}
\setbeamercolor{itemize subsubitem}{fg=Plum3}
\setbeamercolor{item projected}{bg=Plum3}
\setbeamercolor{enumerate item}{fg=Plum3}
\setbeamercolor{enumerate subitem}{fg=Plum3}
\setbeamercolor{enumerate subsubitem}{fg=Plum3}
\begin{tcolorbox}[colback=Plum3!15!bg, boxrule=0.5pt, arc=0pt, outer arc=0pt, left=0pt, right=1pt, top=1pt, bottom=1pt, #1]}
{\end{tcolorbox} \endgroup}
\newenvironment<>{taskproposal}[1][]{
\begingroup
\setbeamercolor{itemize item}{fg=SkyBlue3}
\setbeamercolor{itemize subitem}{fg=SkyBlue3}
\setbeamercolor{itemize subsubitem}{fg=SkyBlue3}
\setbeamercolor{item projected}{bg=SkyBlue3}
\setbeamercolor{enumerate item}{fg=SkyBlue3}
\setbeamercolor{enumerate subitem}{fg=SkyBlue3}
\setbeamercolor{enumerate subsubitem}{fg=SkyBlue3}
\begin{tcolorbox}[colback=SkyBlue3!15!bg, colframe=SkyBlue3, #1]}
{\end{tcolorbox} \endgroup}
\newenvironment<>{priority}[2][]{
\ifthenelse{\equal{#2}{A}}{\colorlet{bgcol}{Chameleon3}}{
\ifthenelse{\equal{#2}{B}}{\colorlet{bgcol}{Orange3}}{
\ifthenelse{\equal{#2}{C}}{\colorlet{bgcol}{ScarletRed3}}{
\ifthenelse{\equal{#2}{D}}{\colorlet{bgcol}{Aluminium6}}{
\colorlet{bgcol}{C2SM_petrol_blue}}}}}
\begingroup
\setbeamercolor{itemize item}{fg=bgcol}
\setbeamercolor{itemize subitem}{fg=bgcol}
\setbeamercolor{itemize subsubitem}{fg=bgcol}
\setbeamercolor{item projected}{bg=bgcol}
\setbeamercolor{enumerate item}{fg=bgcol}
\setbeamercolor{enumerate subitem}{fg=bgcol}
\setbeamercolor{enumerate subsubitem}{fg=bgcol}
\begin{tcolorbox}[colback=bgcol!15!bg, boxrule=0pt, frame empty, arc=0pt, outer arc=0pt, #1]}
{\end{tcolorbox} \endgroup}
\newcommand<>{\smileyframe}[2][]{
\begin{frame}
\begin{tikzpicture}[remember picture, overlay]
\node[opacity=0.4,inner sep=0pt] at (current page.center){
\includegraphics[height=0.9\paperheight]{%
\ifx\relax#1\relax Graphics/smiley_face.jpg \else #1 \fi}};
\end{tikzpicture}
\begin{center}
\Huge\color{C2SM_petrol_blue}\bfseries\sffamily{#2}
\end{center}
\end{frame}
}
\newcommand{\inlinecode}[1]{\tcbox[standard jigsaw,colback=normal text.fg,colframe=normal text.fg,opacityback=0.2,left=0mm,right=0mm,top=0mm,bottom=0mm,boxsep=2pt,boxrule=0.6pt,nobeforeafter,tcbox raise base]{\color{normal text.fg}\texttt{#1}}}
\newenvironment{codeblock}
{\colorlet{framecol}{normal text.fg}\begin{tcolorbox}[standard jigsaw, colback=framecol, colframe=framecol, opacityback=0.07, boxsep=0.5em, left=0pt, right=0pt, bottom=0pt, top=0pt, boxrule=0.5pt]\color{framecol}\scriptsize\begin{semiverbatim}}
{\end{semiverbatim}\end{tcolorbox}}