LaTeX Colorful Box: \colorbox, \fcolorbox, and tcolorbox environment

Aug. 11, 2024

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
\documentclass[varwidth]{standalone}
\standaloneconfig{border=2em}

\usepackage{xcolor}
\usepackage[most]{tcolorbox}

\begin{document}

\colorbox{yellow}{yellow box}

\fcolorbox{black}{green}{green box with black border}

\begin{tcolorbox}[colback=red!20,
                  colframe=black,
                  width=7cm,
                  arc=1mm, auto outer arc]
red box with black round border
\end{tcolorbox}

\begin{tcolorbox}[enhanced jigsaw,
                  colback=blue!50,% background
                  colframe=black,% border color
                  drop shadow={black!50!gray!80},
                  boxrule=1pt, % border width
                  width=10cm,
                  arc=1mm, auto outer arc]
blue box with black-shadow round border
\end{tcolorbox}

\end{document}

png-1


References