-
Notifications
You must be signed in to change notification settings - Fork 1
/
preamble.tex
50 lines (42 loc) · 1.17 KB
/
preamble.tex
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
\usepackage{booktabs}
\usepackage{amsthm}
\usepackage[many]{tcolorbox}
\usepackage{graphicx}
\usetikzlibrary{calc}
\makeatletter
\def\thm@space@setup{%
\thm@preskip=8pt plus 2pt minus 4pt
\thm@postskip=\thm@preskip
}
\makeatother
% Create our general design
\newtcolorbox{customBlockImage}[2][]{
enhanced,
top=10pt,
bottom=10pt,
colframe = white,
width=\textwidth,
boxsep=5pt,
arc=1pt,
outer arc=1pt,
leftupper=1.5cm,
overlay={
\node[anchor=west]
at ([xshift=10pt] $ (interior.north west)!0.5!(interior.south west) $ )
{{\setkeys{Gin}{width=3em,keepaspectratio}\includegraphics{#2}}};},
#1}
% Define the colours to match the CSS
\definecolor{cexercise}{HTML}{A1BE95}
\definecolor{cnote}{HTML}{92AAC7}
\definecolor{cwarning}{HTML}{ED5752}
% Create the new environments for R Markdown
\newenvironment{rmdexercise}
{\begin{customBlockImage}[colback=cexercise]{images/exercise}}
{\end{customBlockImage}}
\newenvironment{rmdnote}
{\begin{customBlockImage}[colback=cnote]{images/note}}
{\end{customBlockImage}}
\newenvironment{rmdwarning}
{\begin{customBlockImage}[colback=cwarning]{images/warning}}
{\end{customBlockImage}}
\urlstyle{tt}