我需要将 1 个表格向右对齐,将 2 个表格向左对齐,我想要实现的布局如下:
\begin{figure}
\centering
\subfloat[]{%
\begin{tabular}[b]{cc}
\hline
0 & 1\\
\hline
2 & 1\\
3 & 1\\
4 & 2\\
5 & 3\\
4 & 8\\
\hline
\end{tabular}%
} \qquad
\subfloat[]{%
\begin{tabular}[b]{ccc}
\hline
1 & 2 & 3\\
3 & 7 & 4\\
4 & 5 & 4\\
\hline
\end{tabular}%
\begin{tabular}[b]{ccc}
\hline
1 & 2 & 3\\
3 & 7 & 4\\
4 & 5 & 4\\
\hline
\end{tabular}%
}~
\end{figure}
特德。
答案1
两种变体的解决方案,两个和三个子浮点数
\documentclass{article}
\usepackage{subfig}
\begin{document}
\begin{table}
\minipage[b]{0.49\linewidth}
\centering
\subfloat[]{%
\begin{tabular}[b]{cc}\hline
0 & 1\\\hline
2 & 1\\
3 & 1\\
4 & 2\\
5 & 3\\
4 & 8\\\hline
\end{tabular}}%
\quad
\subfloat[]{%
\begin{tabular}[b]{@{}c@{}}%
\begin{tabular}{ccc} \hline
1 & 2 & 3\\
3 & 7 & 4\\
4 & 5 & 4\\\hline
\end{tabular}\\[5ex]
\begin{tabular}[b]{ccc} \hline
1 & 2 & 3\\
3 & 7 & 4\\
4 & 5 & 4
\end{tabular}\\\hline
\end{tabular}}%
\caption{the one for all}
\endminipage\hfill
\minipage[b]{0.49\linewidth}
\centering
\subfloat[]{%
\begin{tabular}[b]{cc}\hline
0 & 1\\\hline
2 & 1\\
3 & 1\\
4 & 2\\
5 & 3\\
4 & 8\\\hline
\end{tabular}}%
\quad
\begin{tabular}[b]{c}%
\subfloat[]{%
\begin{tabular}{ccc} \hline
1 & 2 & 3\\
3 & 7 & 4\\
4 & 5 & 4\\\hline
\end{tabular}}\\[5ex]
\subfloat[]{%
\begin{tabular}[b]{ccc} \hline
1 & 2 & 3\\
3 & 7 & 4\\
4 & 5 & 4\\\hline
\end{tabular}}%
\end{tabular}%
\caption{the one for all}
\endminipage
\end{table}
\end{document}
答案2
在表格中使用表格:
\documentclass{article}
\usepackage{subfig}
\begin{document}
\begin{table}
\centering
\subfloat[]{%
\begin{tabular}[b]{c}
\begin{tabular}[b]{cc}
\hline
0 & 1\\
\hline
2 & 1\\
3 & 1\\
4 & 2\\
5 & 3\\
4 & 8\\
\hline
\end{tabular}%
\end{tabular}%
}
\quad
\subfloat[]{%
\begin{tabular}[b]{c}%
\begin{tabular}{ccc}
\hline
1 & 2 & 3\\
3 & 7 & 4\\
4 & 5 & 4\\
\hline
\end{tabular}
\\\\%
\begin{tabular}[b]{ccc}
\hline
1 & 2 & 3\\
3 & 7 & 4\\
4 & 5 & 4\\
\hline
\end{tabular}%
\\
\end{tabular}%
}%
\end{table}
\end{document}
请注意,父表格和底部表格都有一个[b]
参数。左侧表格也必须放置在父表格内,才能与子浮动标签获得相同的间距。
/编辑:删除{ }
内部tabular
s。
结果:
无左父表格:
带有左父表格:
可以通过在父表格中替换{c}
来删除添加的边距。{@{}c@{}}