Two tables side by side in one LaTeX column

The question is similar to this: How do I display content in two columns in LaTeX? but about placing two tables side by side.

I have two small tables that look like this:

\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 a one-column document, and these tables are very narrow, so I would like to display them side by side (with separate headers) installed one below the other with a lot of unused space.

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

Any ideas?

EDIT
Ok, I did something like this:

 \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 always uses as much space as needed, regardless of the size of the mini-disk I would set. For example, if I have 80 mm for a mini-disk, the label will be limited to these 80 mm, but the table will be wider.

If I have two tables, and one table is slightly wider, it will not be next to the first table, but under it.

Is there a way to limit the table to the specified width? Or make them appear one next to the other? Or maybe how to change the font size for only one of the tables?

+6
layout latex
source share
3 answers

Use two mini-folders or two table environments in the same table environment (but then you have to do something with labels if you need them).

+5
source share

The reason your second table goes below the first table, and not next to it, is because of the space between the two mini-folders. You must have instructions directly below the other, otherwise the latex will treat it as the final string. It took me about a week to figure this out for my own tables.

 \end{minipage} \begin{minipage}[b]{80mm} 

Instead:

 \end{minipage} \begin{minipage}[b]{80mm} 
+9
source share

Use subfig package as follows:

 \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 vertically aligning the tables when they have a different number of rows, as in this example. Note also that the tables have their inscriptions above them, and the numbers below them. A great caption package can help you change this if you want.

Finally, you should take a look at the booktabs package for a professional set of table types. He asks you to avoid vertical lines and use horizontal lines instead. The result is usually much better, IMHO.

+3
source share

All Articles