I have three tables and I want to use one caption under them. I tried the following but then nothing prints except the caption –
\begin{figure}[!h]
\begin{table}[h]
\centering
\begin{minipage}[t]{0.3\linewidth}
\begin{tabular}[t]{|c | c | c | c |}
\hline
State & $1$-step \\ \hline
$\ket{n, \leftarrow, 0}$ & $\leftarrow$ \\
$\ket{n, \leftarrow, 1}$ & $\rightarrow$ \\
$\ket{n, \rightarrow, 0}$ & $\rightarrow$ \\
$\ket{n, \rightarrow, 1}$ & $\leftarrow$ \\
\hline
\end{tabular}
\end{minipage}
\begin{minipage}[t]{0.3\linewidth}
\begin{tabular}[t]{|c | c | c | c |}
\hline
State & $2$-step \\ \hline
$\ket{n, \leftarrow, \leftarrow, 0}$ & $\leftarrow$ \\
$\ket{n, \leftarrow, \leftarrow, 1}$ & $\rightarrow$ \\
$\ket{n, \leftarrow, \rightarrow, 0}$ & $\rightarrow$ \\
$\ket{n, \leftarrow, \rightarrow, 1}$ & $\leftarrow$ \\ \hline
\hline
\end{tabular}
\end{minipage}
\begin{minipage}[t]{0.3\linewidth}
\begin{tabular}[t]{|c | c | c | c |}
\hline
State & $3$-step \\ \hline
$\ket{n, \leftarrow, \leftarrow, \leftarrow, 0}$ & $\leftarrow$ \\
$\ket{n, \leftarrow, \leftarrow, \leftarrow, 1}$ & $\rightarrow$ \\
$\ket{n, \leftarrow, \leftarrow, \rightarrow, 0}$ & $\rightarrow$ \\
$\ket{n, \leftarrow, \leftarrow, \rightarrow, 1}$ & $\leftarrow$ \\
\hline
\end{tabular}
\end{minipage}
\end{table}
\caption{Directions}
\end{figure}
If I remove the figure and begin{figure}, end{figure}, and caption{} tags, the tables show but there is no caption. So how can I get the tables to show with the caption?
Best Answer
You can't really nest floating environments (it doesn't make sense logically). That's the main problem, and may stem from the fact that you think you need a
table
environment in order to place atabular
. That's not the case. You're probably after the following:You may also be interested in a
booktabs
implementation:As an aside: You could have placed the entire table into a single
tabular
as well.