Placing Two Generic Tables Beside Each Other

I have two tables that are virtually identical and look like so:

\begin{table}[!ht]
\fontsize{8}{8}\selectfont
\caption{caption$.} \label{label} \center{ \begin{tabular}{|c|c|c|c|} \hline$and$&$this$&$is$&$something$\\ \hline 1&1&1&1\\ \hline 1&1&1&1\\ \hline 1&1&1&1\\ \hline 1&1&1&1\\ \end{tabular} } \end{table} \begin{table}[!ht] \fontsize{8}{8}\selectfont \caption{caption$.}
\label{label}
\center{
\begin{tabular}{|c|c|c|c|}
\hline
$and$&$this$&$is$&$something$\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\end{tabular}
}
\end{table}


I know that these tables on their own aren't best practice, but what are the best practices for placing two tables like this, assuming I'm stuck with them, beside each other?

• Welcome to TeX.SX! Dec 5 '14 at 1:26
• You should use the floatrow package, it's designed for that. Dec 5 '14 at 1:30
• \fontsize{8}{8}\selectfont will typically produce uneven line spacing, for almost all fonts you want the baselineskip to be at least a bit bigger than the font size. why not \footnotesize (which is 8pt in most 10pt class options) Dec 5 '14 at 9:05

Here is an illustration of the use of the floatrow package:

    \documentclass[a4paper, 11pt]{article}
\usepackage[utf8]{inputenc}

\usepackage{lipsum}
\usepackage{graphicx}
\usepackage{floatrow}
\DeclareFloatSeparators{mysep}{\hskip4em}

\begin{document}
Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.
\begin{table}[!ht]\centering
\fontsize{8}{8}\selectfont
\floatsetup{floatrowsep=mysep}
\begin{floatrow}
\ttabbox[\FBwidth]
{\begin{tabular}{|c|c|c|c|}
\hline
$and$&$this$&$is$&$something$\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
\end{tabular}}%
{\caption{caption A.}\label{labelA}}
%%
\ttabbox[\FBwidth]
{\begin{tabular}{|c|c|c|c|}
\hline
$and$&$this$&$is$&$something$\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
\end{tabular}}
{\caption{captionB.}
\label{labelB}}
\end{floatrow}
\end{table}%

Some more text some more text some more text some more text some more text some more text some more text.
\end{document}


• This worked perfectly, thanks! Is there a way to prevent the captions from becoming 'compressed' on top of the table though? I'm noticing longer captions wrap around rather than going straight across while centered. Dec 8 '14 at 0:55
• @user67471: I'm not sure I understand your problem. Do you mean captions should remain one-lined, even if they're very long? Dec 8 '14 at 1:28
• Sorry for the late reply Bernard, that was what I meant. Dec 16 '14 at 2:01
• @user67471: I give a solution in your new question. Dec 16 '14 at 12:19

The most basic solution I can think of is to use a single table environment and to place the two tabular environments, along with their respective \caption and \label statements, in separate minipage environments.

\documentclass{article}
\begin{document}

\begin{table}
\footnotesize  % better than "\fontsize{8}{8}\selectfont"
\begin{minipage}{0.48\textwidth}
\centering
\caption{caption1}
\label{label1}
\begin{tabular}{|c|c|c|c|}
\hline
and&this&is&something\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
\end{tabular}
\end{minipage}
\hspace*{\fill}  % note: no blank line between the minipages
\begin{minipage}{0.48\textwidth}
\centering
\caption{caption2}
\label{label2}
\begin{tabular}{|c|c|c|c|}
\hline
and&this&is&something\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
\end{tabular}
\end{minipage}
\end{table}

\end{document}