24

I'm trying to get three tables side by side using minipage. In spite of my horrific efforts my tables keep stacking on top of each other instead of standing beside what drives me mad. Can anybody spot a mistake here? Cheers

\documentclass[12pt]{article}
\begin{document}

\begin{minipage}[b]{0.33\linewidth}\centering
\begin{tabular}{ | c | c |}
\hline
\textbf{Feat. id} & \textbf{F-Measure} \\ \hline
0 & 0.4286 \\ \hline
17 & 0.3973 \\ \hline
\end{tabular}
\label{tab:singlebest}
\end{minipage}

\begin{minipage}[b]{0.33\linewidth}\centering
\begin{tabular}{ | c | c |}
\hline
\textbf{Feat. id} & \textbf{F-Measure} \\ \hline
25 & 0.4494 \\ \hline
11 & 0.4457 \\ \hline
\end{tabular}
\label{tab:twobest}
\end{minipage}

\begin{minipage}[b]{0.33\linewidth}\centering
\begin{tabular}{ | c | c |}
\hline
\textbf{Feat. id} & \textbf{F-Measure} \\ \hline
18 & 0.4595 \\ \hline
19 & 0.4565 \\ \hline
\end{tabular}
\label{tab:threebest}
\end{minipage}
\end{document}
1

1 Answer 1

32

There are a number of problems here:

  • The open line between the minipages results in a new paragraph. Comment it out or remove it.
  • The label command refers to the previous section or chapter and not the table as intended. Put everything inside a table environment and use \caption command to activate the correct labels.
  • Your tables are too wide for the environments. You can cheat a little bit by putting a wide box inside a zero sized box.

Here is and example:

\begin{table}
\centering
\makebox[0pt][c]{\parbox{1.2\textwidth}{%
    \begin{minipage}[b]{0.32\hsize}\centering
        \begin{tabular}{ | c | c |}
           \hline
           \textbf{Feat. id} & \textbf{F-Measure} \\ \hline
           0 & 0.4286 \\ \hline
           17 & 0.3973 \\ \hline
        \end{tabular}
        \caption{xxx}
        \label{tab:singlebest}
    \end{minipage}
    \hfill
    \begin{minipage}[b]{0.32\hsize}\centering
        \begin{tabular}{ | c | c |}
           \hline
           \textbf{Feat. id} & \textbf{F-Measure} \\ \hline
           25 & 0.4494 \\ \hline
           11 & 0.4457 \\ \hline
        \end{tabular}
        \caption{xxxx}
        \label{tab:twobest}
    \end{minipage}
    \hfill
    \begin{minipage}[b]{0.32\hsize}\centering
        \begin{tabular}{ | c | c |}
           \hline
           \textbf{Feat. id} & \textbf{F-Measure} \\ \hline
           18 & 0.4595 \\ \hline
           19 & 0.4565 \\ \hline
        \end{tabular}
        \caption{xxxx}
        \label{tab:threebest}
    \end{minipage}%
}}
\end{table}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .