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'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}
share|improve this question
    
Similar question: Problem with side-by-side tables. –  Martin Scharrer Mar 30 '11 at 8:01
add comment

1 Answer

up vote 13 down vote accepted

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 commands will refere to the previous section or chaper and not the table as intended. Put everyting inside a table environment and use \caption commands to activate the correct labels.
  • Your tables are to 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}
share|improve this answer
1  
Thank you a lot. You saved my thesis. –  matcheek Mar 31 '11 at 10:50
add comment

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.