如何将子标题放在子表下方,并使用“子图”增加子表之间的间隙?

如何将子标题放在子表下方,并使用“子图”增加子表之间的间隙?

使用“subfigure”,如何在表格中创建子表,以便 a) 子标题位于每个子表下方,并且 b) 子表之间存在合理的水平间隙?到目前为止,我只能将子标题放在顶部,并且没有合理的间隙,例如使用以下代码:

\documentclass{article}
\usepackage{subfigure}
\begin{document}
\begin{table}
\centering
\subtable[caption1]
{\begin{tabular}{c c c}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\subtable[caption2]
{\begin{tabular}{c c c}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\caption{caption for whole table}
\end{table}
\end{document}

答案1

您可以使用代码几乎相同的包来代替subfigure现在已经过时并应该被替换的包。我正在修改手册中的示例:subfigsubcaption

\documentclass{article}
\usepackage{subcaption}
\begin{document}

\begin{table}
\begin{subtable}{.5\linewidth}\centering
{\begin{tabular}{ccc}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\caption{A subtable}\label{tab:1a}
\end{subtable}%
\begin{subtable}{.5\linewidth}\centering
{\begin{tabular}{c c c}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\caption{Another subtable}\label{tab:1b}
\end{subtable}
\caption{A table}\label{tab:1}
\end{table}
\end{document}

在此处输入图片描述

别在意这个figure词了。我只是错过了。

相关内容