views:

68

answers:

2

The question is similar to this one: http://stackoverflow.com/questions/1491717/how-to-display-a-content-in-two-column-layout-in-latex but about placing two tables side by side.

I have two small tables looking like that:

\begin{table}[t]
\begin{tabular}{|c|l||r|r||r|r|}
%content goes here
\end{tabular}
\caption{some caption} 
\end{table}

\begin{table}[t]
\begin{tabular}{|c|l||r|r||r|r|}
%content goes here
\end{tabular}
\caption{some caption for second table} 
\end{table}

I have one-column document and these tables are really narrow, so I would like to display them side by side (with separate captions) insted of one under another with a lot of unused, white space.

I tried to do it with this \multicols but it seems that floats (tables here) cannot be placed inside of it.

Any ideas?

EDIT
OK, I've done something like that:

\begin{table}[h]
\begin{minipage}[b]{80mm}
\begin{tabular}{|c|l||r|r||r|r|}
%//first table goes here
\end{tabular}
    \caption{some caption for first table} 
\end{minipage}

\begin{minipage}[b]{80mm}
\begin{tabular}{|c|l||r|r||r|r|}
%//second table goes here
\end{tabular}
    \caption{some caption for second table} 
\end{minipage}

 \end{table}

But the table is always using as much space, as it needs, no matter what size of minipage I would set. For example, if I have 80 mm for minipage, the caption will be limited to these 80 mm but the table will be wider.

If I have two tables, and one table is just a little bit too wide, it would not apper next to first table, but underneath.

Is there any way to limit the table to specified width? Or to force them to appear one next to another? Or maybe how to change the font size just for one of the tables?

+2  A: 

Use two minipages or two tabular environments in the same table environment (but then you'll have to do something about the captions if you need them).

lhf
Thanks, I created two minipages. But still I have some problems. I've edited my question.
Gacek
A: 

Use the subfig package like this:

\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[bf,small,tableposition=top]{caption}
\usepackage{subfig}
\begin{document}

\begin{table}
\centering
\subfloat[First table.]{%
\begin{tabular}{|c|l||r|r||r|r|}
a & b & c & d & e & f \\
a & b & c & d & e & f \\
\end{tabular}}%
\qquad\qquad% --- set horizontal distance between tables here
\subfloat[Second table.]{%
\begin{tabular}{|c|l||r|r||r|r|}
a & b & c & d & e & f \\
a & b & c & d & e & f \\
a & b & c & d & e & f \\
a & b & c & d & e & f \\
\end{tabular}}
\end{table}

\end{document}

This will take care of vertical alignment of the tables when they have a different number of rows like in this example. Notice also that tables have their captions above them, while figures have their caption below them. The excellent caption package can help you change that if you want.

Finally, you should take a look at the booktabs package for professional quality typesetting of tables. It asks you to avoid vertical lines and instead use horizontal lines. The result is normally much better, IMHO.

Martin Geisler
Nice, but there is one problem - I need to use custom style (from IEEE) and when I use subfloats, it destroys this custom style and uses default ones for tables.
Gacek