Insert Tables and Set whose Style in LaTeX beamer

Oct. 21, 2023

Inserting tables in LaTeX beamer class is similar to that in LaTeX article class:

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
\documentclass{beamer}
\usepackage{xcolor}
\newcommand\myfcolorbox[1]{\fcolorbox{black}{#1}{\phantom{\tiny{color}}} \textbf{#1}\quad}

\begin{document}
\begin{frame}
	\begin{columns}
		\begin{column}{0.25\textwidth}
			This is an introduction to xcolor package basic color names.
		\end{column}
		
		\begin{column}{0.75\textwidth}
			\begin{table}
				\caption{xcolor package basic color names.}
				\begin{tabular}{|l|l|l|}
					\hline
					\myfcolorbox{black} & \myfcolorbox{darkgray} & \myfcolorbox{lime} \\
					\hline
					\myfcolorbox{pink} & \myfcolorbox{violet} & \myfcolorbox{blue} \\
					\hline
					\myfcolorbox{gray} & \myfcolorbox{magenta} & \myfcolorbox{purple} \\
					\hline
					\myfcolorbox{white} & \myfcolorbox{brown} & \myfcolorbox{green} \\
					\hline
					\myfcolorbox{olive} & \myfcolorbox{red} & \myfcolorbox{yellow} \\ 
					\hline
					\myfcolorbox{cyan} & \myfcolorbox{lightgray} & \myfcolorbox{orange} \\
					\hline
					\myfcolorbox{teal}& & \\
					\hline 
				\end{tabular}
			\end{table}
		\end{column}
	\end{columns}
\end{frame}

\end{document}

png-2

And like inserting figures in LaTeX beamer [1], we could add:

1
\setbeamertemplate{caption}[numbered]

in the preamble area to specify to show table number:

png-1


References

[1] Insert Figures and Set whose Style in LaTeX beamer - What a starry night~.

[2] Beamer Table - Full guide with examples.