# Multiples tables side by side

I'm trying to put 8 tables 4 in one line and the other 4 below them, but for some reason it doesn't result as I want.

I want the tables in the following order

J3 J2 J1 J0 K3 K2 K1 K0

and each one with its caption

but I get

J3 J3caption K3 K3caption J2 J2caption K2 K2caption ...

\begin{center}
\begin{table}[!htb]
\begin{minipage}{.24\linewidth}
\scalebox{0.5}{
\begin{tabular}{c|cccc}
%J3 table%
\end{tabular}
\selectfont\textit{Tabla J3}
\begin{tabular}{c|cccc}
%K3 table%
\end{tabular}
\selectfont\textit{Tabla K3}
\end{minipage}

\begin{minipage}{.24\linewidth}
\scalebox{0.5}{
\begin{tabular}{c|cccc}
%J2 table%
\end{tabular}
\selectfont\textit{Tabla J2}
\begin{tabular}{c|cccc}
%K2 table%
\end{tabular}
\selectfont\textit{Tabla K2}
}
\end{minipage}

\begin{minipage}{.24\linewidth}
\scalebox{0.5}{
\begin{tabular}{c|cccc}
%J1 table%
\end{tabular}
\selectfont\textit{Tabla J1}
\begin{tabular}{c|cccc}
%K1 table%
\end{tabular}
\selectfont\textit{Tabla K1}
}
\end{minipage}

\begin{minipage}{.24\linewidth}
\scalebox{0.5}{
\begin{tabular}{c|cccc}
%J0 table%
\end{tabular}
\selectfont\textit{Tabla J0}
\begin{tabular}{c|cccc}
%K0 table%
\end{tabular}
\selectfont\textit{Tabla K0}
}
\end{minipage}
\end{table}
\end{center}


There must be some little detail that I'm missing. As I'm new to LaTeX, I don't know how to fix it.

An empty line represents a paragraph break, which will necessarily stack things vertically (on top of one another) rather than horizontally (next to one another). Here's an alternative view on it, using the supcaption package:

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

\begin{table}[!htb]
\subcaptionbox{J3}[.25\linewidth]{%
\begin{tabular}{|c|}
J3
\end{tabular}}%
\subcaptionbox{J2}[.25\linewidth]{%
\begin{tabular}{|c|}
J2
\end{tabular}}%
\subcaptionbox{J1}[.25\linewidth]{%
\begin{tabular}{|c|}
J1
\end{tabular}}%
\subcaptionbox{J0}[.25\linewidth]{%
\begin{tabular}{|c|}
J0
\end{tabular}}%

\bigskip

\subcaptionbox{K3}[.25\linewidth]{%
\begin{tabular}{|c|}
K3
\end{tabular}}%
\subcaptionbox{K2}[.25\linewidth]{%
\begin{tabular}{|c|}
K2
\end{tabular}}%
\subcaptionbox{K1}[.25\linewidth]{%
\begin{tabular}{|c|}
K1
\end{tabular}}%
\subcaptionbox{K0}[.25\linewidth]{%
\begin{tabular}{|c|}
K0
\end{tabular}}%

\caption{A set of 8 tables.}
\end{table}

\end{document}


The interface \subcaptionbox{<sub-caption>}[<width>]{<stuff>} (minimalized) sets <stuff> in a box of width <width> that has a numbered sub-caption <sup-caption>. If you don't want a numbered sub-caption, use \subcaptionbox*.

• thanks, that works great, but I have a question, whats the function of the % at the end of some lines? – JoseMiguel May 21 '14 at 17:28
• – Werner May 21 '14 at 17:28