最小示例:
\documentclass{scrreprt}
\begin{document}
\begin{figure}
\centering
\begin{tabular}{cc}
\begin{figure}
\begin{tabular}{cc}
0 & 1 \\
2 & 3 \\
\end{tabular}
\caption{table 1}\label{table1}
\end{figure}
&
\begin{figure}
\begin{tabular}{cc}
0 & 1 \\
2 & 3 \\
\end{tabular}
\caption{table 2}
\end{figure}
\end{tabular}
\caption{tables}\label{tables}
\end{figure}
\end{document}
这会产生错误:
! LaTeX Error: Not in outer par mode.
虽然我理解错误的含义,但我不知道如何让我的表格正常工作。有什么想法吗?
请注意:我不能使用其他文档类。
答案1
以下使用该subcaption
包:
\documentclass{scrreprt}
\usepackage{subcaption}
\begin{document}
\begin{table}
\begin{subtable}[t]{.5\linewidth}%
\centering%
\begin{tabular}{cc}
0 & 1 \\
2 & 3 \\
\end{tabular}
\caption{table 1}\label{table1}
\end{subtable}%
\begin{subtable}[t]{.5\linewidth}
\centering
\begin{tabular}{cc}
0 & 1 \\
2 & 3 \\
\end{tabular}
\caption{table 2}
\end{subtable}
\caption{tables}\label{tables}
\end{table}
\end{document}
更新:
对于第二行,只需添加另一对subtable
(s):
\documentclass{scrreprt}
\usepackage{subcaption}
\begin{document}
\begin{table}
\begin{subtable}[t]{.5\linewidth}%
\centering%
\begin{tabular}{cc}
0 & 1 \\
2 & 3 \\
\end{tabular}
\caption{table 1}\label{table1}
\end{subtable}%
\begin{subtable}[t]{.5\linewidth}
\centering
\begin{tabular}{cc}
0 & 1 \\
2 & 3 \\
\end{tabular}
\caption{table 2}
\end{subtable}\par\bigskip
\begin{subtable}[t]{.5\linewidth}%
\centering%
\begin{tabular}{cc}
0 & 1 \\
2 & 3 \\
\end{tabular}
\caption{table 3}
\end{subtable}%
\begin{subtable}[t]{.5\linewidth}
\centering
\begin{tabular}{cc}
0 & 1 \\
2 & 3 \\
\end{tabular}
\caption{table 4}
\end{subtable}
\caption{tables}\label{tables}
\end{table}
\end{document}