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 have the following code to layout two tables side by side:

\begin{minipage}{0.3\textwidth}
\begin{tabular}{c | c | c | c | c | c | c}
F & D & E & G & P & A & L\\
\hline
C & H & I & I & U & G & F\\
\hline
G & Z & G & A & F & Z & U\\
\hline
F & R & \textbf{H} & \textbf{A} & \textbf{U} & \textbf{S} & Z\\
\hline
R & P & L & I & N & F & H\\
\hline
L & U & G & I & A & C & T\\
\hline
A & B & D & N & E & R & Z\\
\end{tabular}

\end{minipage}

\begin{minipage}{0.3\textwidth}
\begin{tabular}{c | c | c | c | c | c | c}
F & D & E & G & P & A & L\\
\hline
C & H & I & I & U & G & F\\
\hline
G & Z & G & A & F & Z & U\\
\hline
F & R & \textbf{H} & \textbf{A} & \textbf{U} & \textbf{S} & Z\\
\hline
R & P & L & I & N & F & H\\
\hline
L & U & G & I & A & C & T\\
\hline
A & B & D & N & E & R & Z\\
\end{tabular}

\end{minipage}

But it doesn't work. The tables are one below the other. What am I doing wrong?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

What you are doing wrong is the new line between the minipages. That makes for a new paragraph. Remove it and make them a little wider (your tables are wider than .3\textwidth so they will overlap. This is what the code would look like:

\documentclass{article}
\begin{document}
  \begin{minipage}{0.4\textwidth}
    \begin{tabular}{c | c | c | c | c | c | c}
      F & D & E & G & P & A & L\\
      \hline
      C & H & I & I & U & G & F\\
      \hline
      G & Z & G & A & F & Z & U\\
      \hline
      F & R & \textbf{H} & \textbf{A} & \textbf{U} & \textbf{S} & Z\\
      \hline
      R & P & L & I & N & F & H\\
      \hline
      L & U & G & I & A & C & T\\
      \hline
      A & B & D & N & E & R & Z\\
    \end{tabular}
  \end{minipage}\qquad
  \begin{minipage}{0.4\textwidth}
    \begin{tabular}{c | c | c | c | c | c | c}
      F & D & E & G & P & A & L\\
      \hline
      C & H & I & I & U & G & F\\
      \hline
      G & Z & G & A & F & Z & U\\
      \hline
      F & R & \textbf{H} & \textbf{A} & \textbf{U} & \textbf{S} & Z\\
      \hline
      R & P & L & I & N & F & H\\
      \hline
      L & U & G & I & A & C & T\\
      \hline
      A & B & D & N & E & R & Z\\
    \end{tabular}
  \end{minipage}
\end{document}

The \qquad is added for some extra spacing. The result looks like this:

Tables in minipages side by side

share|improve this answer
1  
On the other hand, the two minipage environments are superfluous. –  egreg Nov 23 '11 at 10:45
    
yes, there is no problem in just placing the two tabulars side by side without the minipages. Then you wouldn't have to 'guess' the width of the tabulars either. –  Roelof Spijker Nov 23 '11 at 10:59
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.