[Tex/LaTex] tabular + table results in “Not in outer par mode”

tables

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

This is the document:

\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}

What does this mean?

Best Answer

i suspect that you like to obtain the following result:

enter image description here

correct code for above table is:

\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}

addendum: from your comments follows, that you like to have two parallel tables:

enter image description here

for this i suggest to use the tabularx table environment for outer table:

\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}