# Using floatrow or \FBWidth to prevent captions from wrapping around

I have two tables side by side like so:

\documentclass[11pt,reqno]{amsart}

\usepackage[utf8]{inputenc}
\usepackage{lipsum}
\usepackage{amssymb}
\usepackage{color}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{slashbox}
\usepackage{epstopdf}
\usepackage{floatrow}
\usepackage{newfloat}
\usepackage{blindtext}

\newfloatcommand{capbtabbox}{table}[][\FBwidth]
\DeclareFloatSeparators{mysep}{\hskip6em}

\begin{document}

\begin{table}[!ht]\centering
\fontsize{8}{8}\selectfont
\floatsetup{floatrowsep=mysep}
\begin{floatrow}
\ttabbox[\FBwidth]
{\begin{tabular}{|c|c|c|c|}
\hline
$a$&$b$&$c$&$d$\\
\hline
1&0&1&1\\
\hline
1&1&1&0\\
\hline
1&0&0&0\\
\hline
1&0&0&0\\
\hline
0&0&0&0\\
\hline
1&5&32&6\\
\hline
\end{tabular}}%
{\caption{Very long caption that goes something like this.}\label{label}}
%%
\ttabbox[\FBwidth]
{\begin{tabular}{|c|c|c|c|}
\hline
$a$&$b$&$c$&$d$\\
\hline
1&0&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
\end{tabular}}
{\caption{Another long caption like this}
\label{label2}}
\end{floatrow}
\end{table}%
\end{document}

When displayed, however, the captions wrap around instead of being displayed on one line. Is there a way to use \FBWidth or something else in floatrow to widen the captions?

• Please complete your code to provide a minimal working example (MWE) which we can copy-paste-compile to reproduce the issue. People will find it easier to understand and to help, and so you will be more likely to get useful answers sooner! – cfr Dec 16 '14 at 2:57
• @cfr Sure thing, added! – user67471 Dec 16 '14 at 3:27

You might want something like this, which labels each subtable and then adds a labelled explanation in the main table caption. Clearly, the captions have to be outside the tables if they are going to be wider than those tables. Moreover, they will then need labels to indicate which caption goes with which table. Hence, the table-subtable / caption-subcaption design.

You should also read some of the documentation on table design. Generally, it is recommended to have fewer lines and better spacing. Indeed, most tables do not need any vertical lines at all. Take a look at booktabs for inspiration.

\documentclass[11pt,reqno]{amsart}

\usepackage[utf8]{inputenc}
\usepackage{amssymb}
\usepackage{color}
\usepackage{subcaption}
\DeclareCaptionLabelSeparator{none}{}
\DeclareCaptionSubType*[arabic]{table}
\captionsetup[subtable]{labelformat=simple,labelsep=none}
\captionsetup[table]{labelformat=simple,labelsep=none,justification=centerfirst}

\begin{document}

\begin{table}[!ht]
\centering
\fontsize{8}{8}\selectfont
\begin{subtable}{.25\textwidth}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
$a$&$b$&$c$&$d$\\
\hline
1&0&1&1\\
\hline
1&1&1&0\\
\hline
1&0&0&0\\
\hline
1&0&0&0\\
\hline
0&0&0&0\\
\hline
1&5&32&6\\
\hline
\end{tabular}
\caption{}\label{label}
\end{subtable}
\begin{subtable}{.25\textwidth}
\centering
\begin{tabular}{|c|c|c|c|}
\hline
$a$&$b$&$c$&$d$\\
\hline
1&0&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
\end{tabular}
\caption{}\label{label2}
\end{subtable}
\caption{\mbox{}\\\ref{label} Very long caption that goes something like this.\\\ref{label2} Another long caption like this.}
\end{table}
\end{document}

You can play with the width of the \floatbox (optional argument of \ttabbox) and the value of the float separator. This will require manual adjustment. You also should be aware of a risk of overlapping captions for contiguous tables.

Here is a way to go. For the captions you give, I had to change the document horizontal margins:

\documentclass[11pt,reqno]{amsart}

\usepackage[utf8]{inputenc}
\usepackage{floatrow}
\usepackage[hmargin =20mm, showframe, nomarginpar]{geometry}

\DeclareFloatSeparators{mysep}{\hskip-3em}

\begin{document}

\noindent \begin{table}[!ht]%\centering
\fontsize{8}{8}\selectfont
\floatsetup{floatrowsep=mysep}
\hskip-4em\begin{floatrow}
\ttabbox[5.2\FBwidth]
{\begin{tabular}{|c|c|c|c|}
\hline
$a$&$b$&$c$&$d$\\
\hline
1&0&1&1\\
\hline
1&1&1&0\\
\hline
1&0&0&0\\
\hline
1&0&0&0\\
\hline
0&0&0&0\\
\hline
1&5&32&6\\
\hline
\end{tabular}}%
{\caption{Very long caption that goes something like this.}\label{label}}
%%
\ttabbox[4\FBwidth]
{\begin{tabular}{|c|c|c|c|}
\hline
$a$&$b$&$c$&$d$\\
\hline
1&0&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
1&1&1&1\\
\hline
\end{tabular}}
{\caption{Another long caption like this} \label{label2}}
\end{floatrow}
\end{table}%

\end{document}