# Three tables side by side, want only one caption

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?

-
Do not nest the floating environments. Use the outer float as table, and remove the inner table environment. You can just use tabular to set you tables. –  Werner Apr 3 '14 at 18:46
welcome to tex.sx. Please always post a complete document so people can reproduce the problem. –  David Carlisle Apr 3 '14 at 18:46
as Werner said, and also you don't need the minipages. –  David Carlisle Apr 3 '14 at 18:47

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 a tabular. That's not the case. You're probably after the following:

\documentclass{article}
\usepackage{braket}
\begin{document}

\begin{table}[ht]
\centering
\begin{tabular}[t]{| 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}\hfill%
\begin{tabular}[t]{| 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
\end{tabular}\hfill%
\begin{tabular}[t]{| 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}
\caption{Directions}
\end{table}

\end{document}


You may also be interested in a booktabs implementation:

\documentclass{article}
\usepackage{braket,booktabs}
\begin{document}

\begin{table}[ht]
\centering
\begin{tabular}[t]{c c}
\toprule
State                      & $1$-step      \\ \midrule
$\ket{n, \leftarrow, 0}$   & $\leftarrow$  \\
$\ket{n, \leftarrow, 1}$   & $\rightarrow$ \\
$\ket{n, \rightarrow, 0}$  & $\rightarrow$ \\
$\ket{n, \rightarrow, 1}$  & $\leftarrow$  \\
\bottomrule
\end{tabular}\hfill%
\begin{tabular}[t]{c c}
\toprule
State                     & $2$-step      \\ \midrule
$\ket{n, \leftarrow, \leftarrow, 0}$   & $\leftarrow$  \\
$\ket{n, \leftarrow, \leftarrow, 1}$   & $\rightarrow$ \\
$\ket{n, \leftarrow, \rightarrow, 0}$  & $\rightarrow$ \\
$\ket{n, \leftarrow, \rightarrow, 1}$  & $\leftarrow$  \\
\bottomrule
\end{tabular}\hfill%
\begin{tabular}[t]{c c}
\toprule
State                     & $3$-step \\ \midrule
$\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$  \\
\bottomrule
\end{tabular}
\caption{Directions}
\end{table}

\end{document}


As an aside: You could have placed the entire table into a single tabular as well.

-

In addition to getting rid of the table and minipage "wrappers", you could also use array environments instead of tabular environments. I suggest this because the contents of the tables are all in math mode, and array environments are meant to be used for math material. (tabular environments, in contrast, are meant for tables that contain mostly text.) Being able to dispense with all those $ signs simplifies the look of the code considerably, I think. PS It wasn't clear to me if you want the overall floating environment to be of type figure or table. In the example I've selected figure, but that may not be what you prefer. If you'd rather have the caption list "Table" than "Figure", just change the type of floating environment. \documentclass{article} \usepackage{braket,amsmath} % 'amsmath' for \text macro \begin{document} \begin{figure}[ht]$ % start math mode
\begin{array}[t]{|c | c | c | c |}
\hline
\text{State}  & \text{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{array}
\hspace*{\fill}
\begin{array}[t]{|c | c | c | c |}
\hline
\text{State} & \text{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
\end{array}
\hspace*{\fill}
\begin{array}[t]{|c | c | c | c |}
\hline
\text{State} & \text{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{array}
\$ % end math mode
\caption{Directions}
\end{figure}
\end{document}

-