Examples from LaTeX tcolorbox
Package
May. 12, 2025 • Updated May. 13, 2025
Here are some examples from the manual of LaTeX tcolorbox
package1.
Example 1
p. 377
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\tcbset{fonttitle=\scriptsize}
\tcboxmath[colback=LightBlue!25!white,colframe=blue]{ a^2 = 16 }
\quad\Rightarrow\quad
\tcboxmath[colback=Salmon!25!white,colframe=red,title=Implication]
{a = 4 ~\vee~ a=-4.}
\end{equation}
\end{document}
Example 2
p. 377
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{amsmath}
\begin{document}
\tcbset{myformula/.style={colback=yellow!10!white,
colframe=red!50!black,
every box/.style={highlight math style={colback=LightBlue!50!white,colframe=Navy}}
}}
\begin{align}
\tcbhighmath{\sum\limits_{n=1}^{\infty} \frac{1}{n}} &= \infty.\\
\int x^2 ~\text{d}x &= \frac13 x^3 + c.
\end{align}
\begin{tcolorbox}[ams align,myformula]
\tcbhighmath{\sum\limits_{n=1}^{\infty} \frac{1}{n}} &= \infty.\\
\int x^2 ~\text{d}x &= \frac13 x^3 + c.
\end{tcolorbox}
\end{document}
Example 3
p. 378
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
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{amsmath}
\usepackage{empheq}
\begin{document}
\begin{empheq}[box=\tcbhighmath]{align}
a &= \sin(z)\\
E &= mc^2 + \int_a^b x\, dx
\end{empheq}
\tcbset{highlight math style={enhanced,
colframe=red!60!black,
colback=yellow!50!white,
arc=4pt,
boxrule=1pt,
drop fuzzy shadow}}
\begin{empheq}[box=\tcbhighmath]{align}
a &= \sin(z)\\
E &= mc^2 + \int_a^b x\, dx
\end{empheq}
\end{document}
Example 4
pp. 106-107.
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
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[svgnames]{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{amsmath}
\usepackage{lipsum}
\tcbuselibrary{skins,breakable}
\begin{document}
\tcbset{colframe=red!75!black,
fonttitle=\bfseries,
colback=red!5!white,
every box/.style={enhanced,
watermark text=\thetcblayer,
before=\par\smallskip,
after=\par\smallskip},
every box on layer 2/.append style={colback=yellow!10!white,
drop fuzzy shadow}}
\begin{tcolorbox}[enhanced jigsaw,breakable,title=Layer 1 Box]
Here comes a footnote\footnote{Footnote from layer 1 box}.
\lipsum[2][1-4]
\begin{tcolorbox}[title=Layer 2 Box]
abc\footnote{The footnote of abc}
\end{tcolorbox}
\begin{tcolorbox}[title=Another Box,ams equation]
\tcbhighmath{\sum\limits_{n=1}^{\infty} \frac{1}{n}} = \infty.
\end{tcolorbox}
Some text\footnote{Footnote from some text}.
\begin{tcolorbox}[title=Yet Another Box]
\tcboxfit[height=2cm]{\lipsum[1]}
My text.
\begin{tcolorbox}
Another lipsum text\footnote{A lipsum text}. \lipsum[3]
\begin{tcolorbox}[title=Layer 4,colframe=blue,colback=white]
Layer 4\footnote{Layer 4 footnote}
\end{tcolorbox}
The End\footnote{Last footnote}.
\end{tcolorbox}
\end{tcolorbox}
\end{tcolorbox}
\end{document}
References