Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I came from here where this issue was raised but could not find a straightforward solution. I have now side-by-side tables and I want to avoid the errors thrown once floatrow package is added to the preamble. Is there any solution to this issue or, in case not, any alternative to do side-by-side tables without sacrificing the floatrow package?

MWE code:

\documentclass{scrartcl}
%\usepackage{floatrow} % commented out otherwise throws errors (see below)
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\makebox[0pt][c]{\parbox{1\textwidth}{%
    \begin{minipage}[b]{0.5\hsize}\centering
        \begin{tabular}{r|rrrr}
        \toprule
          & \multicolumn{4}{c}{\textbf{Reference}} \\
        \midrule
        \textbf{Predicted}  & H & P & R & Q \\ 
        \midrule
        H &   3 &   0 &   0 &   0 \\ 
        P &   0 &   5 &   0 &   0 \\ 
        R &   0 &   0 &  19 &   1 \\ 
        Q &   0 &   0 &   0 &  25 \\ 
        \bottomrule 
        \end{tabular}
        \caption{SVMr confusion matrix.}
        \label{tab:cmsvm}
        \vskip 1cm
        \begin{tabular}{r|rrrr}
        \toprule
          & \multicolumn{4}{c}{\textbf{Reference}} \\
        \midrule
        \textbf{Predicted}  & H & P & R & Q \\ 
        \midrule
        H &   2 &   0 &   0 &   0 \\ 
        P &   0 &   5 &   0 &   0 \\ 
        R &   1 &   0 &  19 &   0 \\ 
        Q &   0 &   0 &   0 &  26 \\ 
        \bottomrule 
        \end{tabular}
        \caption{RDA confusion matrix.}
        \label{tab:cmrda}
        \vskip 1cm
        \begin{tabular}{r|rrrr}
        \toprule
          & \multicolumn{4}{c}{\textbf{Reference}} \\
        \midrule
        \textbf{Predicted}  & H & P & R & Q \\ 
        \midrule
        H &   3 &   0 &   0 &   0 \\ 
        P &   0 &   4 &   0 &   0 \\ 
        R &   0 &   0 &  19 &   0 \\ 
        Q &   0 &   1 &   0 &  26 \\ 
        \bottomrule 
        \end{tabular}
        \caption{PAM confusion matrix.}
        \label{tab:cmpam}
    \end{minipage}
    \hfil
    \begin{minipage}[b]{0.5\hsize}\centering
        \begin{tabular}{r|rrrr}
        \toprule
          & \multicolumn{4}{c}{\textbf{Reference}} \\
        \midrule
        \textbf{Predicted}  & H & P & R & Q \\ 
        \midrule
        H &   2 &   0 &   0 &   0 \\ 
        P &   0 &   4 &   0 &   0 \\ 
        R &   1 &   0 &  19 &   0 \\ 
        Q &   0 &   1 &   0 &  26 \\
        \bottomrule 
        \end{tabular}
        \caption{PLS-LDA confusion matrix.}
        \label{tab:cmplslda}
        \vskip 1cm
        \begin{tabular}{r|rrrr}
        \toprule
          & \multicolumn{4}{c}{\textbf{Reference}} \\
        \midrule
        \textbf{Predicted}  & H & P & R & Q \\ 
        \midrule
        H &   2 &   0 &   0 &   0 \\ 
        P &   0 &   4 &   0 &   0 \\ 
        R &   1 &   0 &  18 &   1 \\ 
        Q &   0 &   1 &   1 &  25 \\
        \bottomrule 
        \end{tabular}
        \caption{LDA confusion matrix.}
        \label{tab:cmlda}
        \vskip 1cm
         \begin{tabular}{r|rrrr}
        \toprule
          & \multicolumn{4}{c}{\textbf{Reference}} \\
        \midrule
        \textbf{Predicted}  & H & P & R & Q \\ 
        \midrule
        H &   2 &   0 &   0 &   0 \\ 
        P &   0 &   3 &   0 &   0 \\ 
        R &   1 &   0 &  12 &   3 \\ 
        Q &   0 &   2 &   7 &  23 \\ 
        \bottomrule 
        \end{tabular}
        \caption{PLS confusion matrix.}
        \label{tab:cmpls}
    \end{minipage}
    \hfil
}}
\end{table}
\end{document}  

Output:
enter image description here

Error:

Package floatrow Error: Caption(s) lost
share|improve this question

1 Answer 1

up vote 5 down vote accepted

The quickest solution is to use the \RawFloats command (or the rawfloats package option); for other possible solution, see the quote below:

\documentclass{article}
\usepackage{booktabs}
\usepackage{floatrow}

\begin{document}
\begin{table}
\RawFloats
\centering
\makebox[0pt][c]{\parbox{1\textwidth}{%
    \begin{minipage}[b]{0.5\hsize}\centering
        \begin{tabular}{r|rrrr}
        \toprule
          & \multicolumn{4}{c}{\textbf{Reference}} \\
        \midrule
        \textbf{Predicted}  & H & P & R & Q \\ 
        \midrule
        H &   3 &   0 &   0 &   0 \\ 
        P &   0 &   5 &   0 &   0 \\ 
        R &   0 &   0 &  19 &   1 \\ 
        Q &   0 &   0 &   0 &  25 \\ 
        \bottomrule 
        \end{tabular}
        \caption{SVMr confusion matrix.}
        \label{tab:cmsvm}
        \vskip 1cm
        \begin{tabular}{r|rrrr}
        \toprule
          & \multicolumn{4}{c}{\textbf{Reference}} \\
        \midrule
        \textbf{Predicted}  & H & P & R & Q \\ 
        \midrule
        H &   2 &   0 &   0 &   0 \\ 
        P &   0 &   5 &   0 &   0 \\ 
        R &   1 &   0 &  19 &   0 \\ 
        Q &   0 &   0 &   0 &  26 \\ 
        \bottomrule 
        \end{tabular}
        \caption{RDA confusion matrix.}
        \label{tab:cmrda}
        \vskip 1cm
        \begin{tabular}{r|rrrr}
        \toprule
          & \multicolumn{4}{c}{\textbf{Reference}} \\
        \midrule
        \textbf{Predicted}  & H & P & R & Q \\ 
        \midrule
        H &   3 &   0 &   0 &   0 \\ 
        P &   0 &   4 &   0 &   0 \\ 
        R &   0 &   0 &  19 &   0 \\ 
        Q &   0 &   1 &   0 &  26 \\ 
        \bottomrule 
        \end{tabular}
        \caption{PAM confusion matrix.}
        \label{tab:cmpam}
    \end{minipage}
    \hfil
    \begin{minipage}[b]{0.5\hsize}\centering
        \begin{tabular}{r|rrrr}
        \toprule
          & \multicolumn{4}{c}{\textbf{Reference}} \\
        \midrule
        \textbf{Predicted}  & H & P & R & Q \\ 
        \midrule
        H &   2 &   0 &   0 &   0 \\ 
        P &   0 &   4 &   0 &   0 \\ 
        R &   1 &   0 &  19 &   0 \\ 
        Q &   0 &   1 &   0 &  26 \\
        \bottomrule 
        \end{tabular}
        \caption{PLS-LDA confusion matrix.}
        \label{tab:cmplslda}
        \vskip 1cm
        \begin{tabular}{r|rrrr}
        \toprule
          & \multicolumn{4}{c}{\textbf{Reference}} \\
        \midrule
        \textbf{Predicted}  & H & P & R & Q \\ 
        \midrule
        H &   2 &   0 &   0 &   0 \\ 
        P &   0 &   4 &   0 &   0 \\ 
        R &   1 &   0 &  18 &   1 \\ 
        Q &   0 &   1 &   1 &  25 \\
        \bottomrule 
        \end{tabular}
        \caption{LDA confusion matrix.}
        \label{tab:cmlda}
        \vskip 1cm
         \begin{tabular}{r|rrrr}
        \toprule
          & \multicolumn{4}{c}{\textbf{Reference}} \\
        \midrule
        \textbf{Predicted}  & H & P & R & Q \\ 
        \midrule
        H &   2 &   0 &   0 &   0 \\ 
        P &   0 &   3 &   0 &   0 \\ 
        R &   1 &   0 &  12 &   3 \\ 
        Q &   0 &   2 &   7 &  23 \\ 
        \bottomrule 
        \end{tabular}
        \caption{PLS confusion matrix.}
        \label{tab:cmpls}
    \end{minipage}
    \hfil
}}
\end{table}
\end{document}

The phenomenon is explained, and solutions are provided, on page 14 of the floatrow package documentation:

The next example. If you put beside floats by following way:

...
\begin{figure}
\begin{minipage}{0.45\textwidth}
\centering ...
\caption{The figure caption, disappeared, ...}
\end{minipage}\hfill
\begin{minipage}{0.45\textwidth}
\captionof{table}{The table caption ...}}
\centering ...
\end{minipage}
\end{figure}

you’ll get error message about lost caption. Here you may: 1) to put table contents inside \ttabbox resp. the figure contents inside \ffigbox; then both floats put inside floatrow environment, and, since there is mixed row (it includes floats of different types, and also with different caption position), put the \killfloatstyle command before “foreign” float \ttabbox, and \CenterFloatBoxes command before floatrow environment (see section 2.3.1 about mixed rows); or 2) to restore the standard LaTeX behavior, using command \RawFloats or package option rawfloats (section 2.4).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.