LaTeX Error: Not in outer par mode.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.10 \bgroup
这是文档:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\begin{document}
\begin{center}
\begin{tabular}{ c c }
\begin{table}
\bgroup
\def\arraystretch{1.2}
\begin{tabular}{ c c | c | c | }
& & \multicolumn{2}{c|}{P2} \\
& & $a_1$ & $a_2$ \\
\hline
\multirow{2}{*}{P1} & $a_1$ & 0, 0 & 0, 0 \\
& $a_2$ & 0, 0 & 0, 0 \\
\hline
\end{tabular}
\egroup
\caption{Title}
\end{table}
&
Other text
\end{tabular}
\end{center}
\end{document}
这是什么意思?
答案1
我怀疑您想获得以下结果:
上表的正确代码是:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ c c }
\begin{tabular}{ c c | c | c | }
& & \multicolumn{2}{c|}{P2} \\
& & $a_1$ & $a_2$ \\
\hline
\multirow{2}{*}{P1}
& $a_1$ & 0,0 & 0,0 \\
& $a_2$ & 0,0 & 0,0 \\
\hline
\end{tabular}
&
Other text
\end{tabular}
\caption{Title}
\end{table}
\end{document}
附录: 从您的评论可以看出,您喜欢有两个平行的表格:
为此,我建议使用tabularx
外部表的表环境:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\begin{table}
\centering
\begin{tabularx}{\linewidth}{ C C }
\begin{tabular}{ c c | c | c | }
& & \multicolumn{2}{c|}{P2} \\
& & $a_1$ & $a_2$ \\
\hline
\multirow{2}{*}{P1}
& $a_1$ & 0,0 & 0,0 \\
& $a_2$ & 0,0 & 0,0 \\
\hline
\end{tabular}
\caption{Title of the first table}
\label{tab:1}
&
\begin{tabular}{ c c | c | c | }
& & \multicolumn{2}{c|}{P2} \\
& & $a_1$ & $a_2$ \\
\hline
\multirow{2}{*}{P1}
& $a_1$ & 0,0 & 0,0 \\
& $a_2$ & 0,0 & 0,0 \\
\hline
\end{tabular}
\caption{Title of the second table}
\label{tab:2}
\end{tabularx}
\end{table}
\end{document}