![怎样才能在一页上以 3x2 矩阵的形式放置五张表格?](https://linux22.com/image/234406/%E6%80%8E%E6%A0%B7%E6%89%8D%E8%83%BD%E5%9C%A8%E4%B8%80%E9%A1%B5%E4%B8%8A%E4%BB%A5%203x2%20%E7%9F%A9%E9%98%B5%E7%9A%84%E5%BD%A2%E5%BC%8F%E6%94%BE%E7%BD%AE%E4%BA%94%E5%BC%A0%E8%A1%A8%E6%A0%BC%EF%BC%9F.png)
我想将多个代码生成的表格插入到文档中,以便它们显示在一页上。我可能需要使用较小的字体才能使它们全部适合。所有表格都是相同大小,并且已经位于tabular
带有标题和标签的自己的块中。最好的策略是什么?
答案1
您可以将表格放入 minipages 或 parboxes 中,也可以使用包subfig
。请记住,您不能将多个table
环境放在一起,但您可以能将多个tabular
环境(带有标题和标签)放在一个table
环境中。subfig
文档中包含有关这两种技术的信息。
parboxes
下面是使用和的示例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}
答案2
调整表格的大小,使三个表格放在一行中:
\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}