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'd like to insert multiple code-generated tables into a document so that they appear on a single page. I may need to use smaller font to make them all fit. All the tables are of the same size, and are already in their own tabular block with captions and labels. What's the best strategy?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

You can put the tables into minipages or parboxes or use the subfig package. Just remember that you can't put multiple table environments together, but you can put multiple tabular environments (with captions and labels) within a single table environment. The subfig documentation has information about both techniques.

Here's an example using both parboxes and minipages

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{booktabs}
\begin{document}

\begin{table}[htbp]
\centering

\parbox{.45\textwidth}{
\begin{tabular}[t]{lll}

\toprule
A & B & C \\
\midrule
0.096356125 & 0.126535287 & 0.222951743 \\
0.011227006 & 0.154678302 & 0.134139901 \\
0.695793117 & 0.287078523 & 0.077578477 \\
0.325214308 & 0.069604001 & 0.657673026 \\

\bottomrule
\end{tabular}
\caption{ABC}
}\bigskip
\parbox{.45\textwidth}{
\begin{tabular}[t]{lll}

\toprule
D & E & F \\
\midrule
0.692628962 & 0.676885786 & 0.714726267 \\
0.216724956 & 0.514742162 & 0.274775702 \\
0.520019549 & 0.506134903 & 0.293514122 \\
0.186925802 & 0.285319488 & 0.403563324 \\

\bottomrule
\end{tabular}
\caption{DEF}
}\bigskip

\parbox{.45\textwidth}{
\begin{tabular}[t]{lll}

\toprule
G & H & I \\
\midrule
0.037156909 & 0.76115364 & 0.238202162 \\
0.086680665 & 0.028714787 & 0.879055353 \\
0.302193464 & 0.157574379 & 0.948781632 \\
0.503584342 & 0.885553012 & 0.30105766 \\

\bottomrule
\end{tabular}
\caption{GHI}
}\bigskip
\parbox{.45\textwidth}{
\begin{tabular}[t]{lll}

\toprule
J & K & L \\
\midrule
0.652587435 & 0.812241976 & 0.816788302 \\
0.456616676 & 0.320706153 & 0.882116653 \\
0.616582591 & 0.361915305 & 0.772590298 \\
0.78771219 & 0.53200612 & 0.564641396 \\

\bottomrule
\end{tabular}
\caption{JKL}
}
\parbox{.45\textwidth}{
\begin{tabular}[t]{lll}

\toprule
M & N & O \\
\midrule
0.733808918 & 0.699601932 & 0.11500169 \\
0.873043748 & 0.12076117 & 0.682781587 \\
0.918180185 & 0.63535945 & 0.445837393 \\
0.417373347 & 0.731406679 & 0.669593201 \\

\bottomrule
\end{tabular}
\caption{MNO}
}
\parbox{.45\textwidth}{\ }
\end{table}

\begin{table}[htbp]
\centering

\begin{minipage}{.45\textwidth}{
\begin{tabular}[t]{lll}

\toprule
A & B & C \\
\midrule
0.096356125 & 0.126535287 & 0.222951743 \\
0.011227006 & 0.154678302 & 0.134139901 \\
0.695793117 & 0.287078523 & 0.077578477 \\
0.325214308 & 0.069604001 & 0.657673026 \\

\bottomrule
\end{tabular}
\caption{ABC}
}\end{minipage}\bigskip
\begin{minipage}{.45\textwidth}{
\begin{tabular}[t]{lll}

\toprule
D & E & F \\
\midrule
0.692628962 & 0.676885786 & 0.714726267 \\
0.216724956 & 0.514742162 & 0.274775702 \\
0.520019549 & 0.506134903 & 0.293514122 \\
0.186925802 & 0.285319488 & 0.403563324 \\

\bottomrule
\end{tabular}
\caption{DEF}
}\end{minipage}\bigskip

\begin{minipage}{.45\textwidth}{
\begin{tabular}[t]{lll}

\toprule
G & H & I \\
\midrule
0.037156909 & 0.76115364 & 0.238202162 \\
0.086680665 & 0.028714787 & 0.879055353 \\
0.302193464 & 0.157574379 & 0.948781632 \\
0.503584342 & 0.885553012 & 0.30105766 \\

\bottomrule
\end{tabular}
\caption{GHI}
}\end{minipage}\bigskip
\begin{minipage}{.45\textwidth}{
\begin{tabular}[t]{lll}

\toprule
J & K & L \\
\midrule
0.652587435 & 0.812241976 & 0.816788302 \\
0.456616676 & 0.320706153 & 0.882116653 \\
0.616582591 & 0.361915305 & 0.772590298 \\
0.78771219 & 0.53200612 & 0.564641396 \\

\bottomrule
\end{tabular}
\caption{JKL}
}\end{minipage}
\begin{minipage}{.45\textwidth}{
\begin{tabular}[t]{lll}

\toprule
M & N & O \\
\midrule
0.733808918 & 0.699601932 & 0.11500169 \\
0.873043748 & 0.12076117 & 0.682781587 \\
0.918180185 & 0.63535945 & 0.445837393 \\
0.417373347 & 0.731406679 & 0.669593201 \\

\bottomrule
\end{tabular}
\caption{MNO}
}\end{minipage}
\begin{minipage}{.45\textwidth}{\ }\end{minipage}
\end{table}

\end{document}
share|improve this answer
    
I thought of minipage, but only found examples for multi-column use, not matrix... What would be minipage usage here? –  Alexy Jan 31 '11 at 4:27
    
@Alexy I added an example. If your tables are small and you can fit 3 in the width of the page, you can adjust the size of the \parbox or minipage accordingly. –  Alan Munn Jan 31 '11 at 5:28
1  
You mean the subfig package. –  TH. Jan 31 '11 at 5:46
add comment

resize the tabulars that three fit in one row:

enter image description here

\documentclass{article}
\usepackage{booktabs,graphicx,blindtext}

\begin{document}

\blindtext

\begin{table}
\centering
\minipage{0.32\textwidth}
\resizebox{\linewidth}{!}{%
\begin{tabular}{lll}\toprule
A & B & C \\\midrule
0.096356125 & 0.126535287 & 0.222951743 \\
0.011227006 & 0.154678302 & 0.134139901 \\
0.695793117 & 0.287078523 & 0.077578477 \\
0.325214308 & 0.069604001 & 0.657673026 \\\bottomrule
\end{tabular}}
\caption{ABC}
\endminipage\hfill%
%
\minipage{0.32\textwidth}
\resizebox{\linewidth}{!}{%
\begin{tabular}{lll}\toprule
A & B & C \\\midrule
0.096356125 & 0.126535287 & 0.222951743 \\
0.011227006 & 0.154678302 & 0.134139901 \\
0.695793117 & 0.287078523 & 0.077578477 \\
0.325214308 & 0.069604001 & 0.657673026 \\\bottomrule
\end{tabular}}
\caption{ABC second}
\endminipage\hfill%
%
\minipage{0.32\textwidth}
\resizebox{\linewidth}{!}{%
\begin{tabular}{lll}\toprule
A & B & C \\\midrule
0.096356125 & 0.126535287 & 0.222951743 \\
0.011227006 & 0.154678302 & 0.134139901 \\
0.695793117 & 0.287078523 & 0.077578477 \\
0.325214308 & 0.069604001 & 0.657673026 \\\bottomrule
\end{tabular}}
\caption{ABC third}
\endminipage

\bigskip
\minipage{0.32\textwidth}
\resizebox{\linewidth}{!}{%
\begin{tabular}{lll}\toprule
A & B & C \\\midrule
0.096356125 & 0.126535287 & 0.222951743 \\
0.011227006 & 0.154678302 & 0.134139901 \\
0.695793117 & 0.287078523 & 0.077578477 \\
0.325214308 & 0.069604001 & 0.657673026 \\\bottomrule
\end{tabular}}
\caption{ABC forth}
\endminipage\space%
%
\minipage{0.32\textwidth}
\resizebox{\linewidth}{!}{%
\begin{tabular}{lll}\toprule
A & B & C \\\midrule
0.096356125 & 0.126535287 & 0.222951743 \\
0.011227006 & 0.154678302 & 0.134139901 \\
0.695793117 & 0.287078523 & 0.077578477 \\
0.325214308 & 0.069604001 & 0.657673026 \\\bottomrule
\end{tabular}}
\caption{ABC fifth}
\endminipage%
\end{table}

\end{document}
share|improve this answer
    
Thanks Herbert, great convenience tip. –  Alexy Feb 1 '11 at 5:59
    
Worryingly, omitting comment sign % in \hfill% above and the subsequent % on a line by itself emits a single column... Why so brittle? –  Alexy Feb 2 '11 at 17:19
    
Otherwise you get an additional space and a new paragraph –  Herbert Feb 2 '11 at 17:40
    
How do we resize the caption accordingly? It won't go into the resizebox... –  Alexy Feb 3 '11 at 19:43
    
it looks ugly (!), when you resize the caption, too! The reader do not want to use magnifiers ... However, put the \resizebox around the minipage –  Herbert Feb 3 '11 at 19:47
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.