如何正确对齐表格下方的标题?

如何正确对齐表格下方的标题?
\documentclass{beamer}
\usetheme{Warsaw}
\usecolortheme{beaver}
\usepackage{color}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{multirow,array}
\usepackage{tikz}
\usetikzlibrary{calc,external,automata,trees,positioning,shadows,arrows,shapes.geometric}
\usepackage{xcolor}
\usepackage{nicefrac}
\usepackage{mathrsfs}

\begin{document}
\pagestyle{plain}
\maketitle

\begin{frame}{}
\begin{itemize}

\item :
        \begin{center}
        \begin{table}
                \setlength{\extrarowheight}{2pt}        
                \parbox{.45\linewidth}{

                        \begin{tabular}{cc|c|c|}
                                & \multicolumn{1}{c}{} & \multicolumn{1}{c}{$i$}  & \multicolumn{1}{c}{$g$} \\\cline{3-4}
                                \multirow{2}*{}  & $I$ & $1$ & $0$ \\\cline{3-4}
                                & $G$ & $1$ & $0$ \\\cline{3-4}
                        \end{tabular}
                        \caption{$\theta$}
                }
                \setlength{\extrarowheight}{2pt}
                \parbox{.45\linewidth}{

                        \begin{tabular}{cc|c|c|}
                                & \multicolumn{1}{c}{} & \multicolumn{1}{c}{$i$}  & \multicolumn{1}{c}{$g$} \\\cline{3-4}
                                \multirow{2}*{}  & $I$ & $p$ & $1-p$ \\\cline{3-4}
                                & $G$ & $1-p$ & $p$ \\\cline{3-4}
                        \end{tabular}
                        \caption{$1-\theta$}
                }


                 \end{table}
            \end{center}

\vspace*{2mm}

\end{itemize}
\end{frame}

\end{document}

在此处输入图片描述

答案1

请注意,tablefigure环境在文档中没有实际用例beamer:您要展示的表格和图形几乎肯定应该不浮动跨框架。因此,只需大大简化您的代码;下面显示的代码可能是一个很好的起点。如果您只是必须创建看起来像标题的东西,只需根据需要使用颜色和粗体即可。

在此处输入图片描述

\documentclass{beamer}
\usetheme{Warsaw}
\usecolortheme{beaver}
%%\usepackage{color} %  don't load this package as you're also loading 'xcolor'
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,bm}
\usepackage{graphicx,array}
\usepackage{tikz}
\usetikzlibrary{calc,external,automata,trees,
   positioning,shadows,arrows,shapes.geometric}
\usepackage{xcolor}
\usepackage{nicefrac}
\usepackage{mathrsfs}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\newcommand\mystrut{{}^{\strut}}
\begin{document}

\begin{frame}{Two tables}
\setlength{\extrarowheight}{2pt}

\begin{minipage}{.5\linewidth}
\LARGE
\centering
$\begin{array}{c|c|c|}
\mc{} & \mc{i}  & \mc{g} \\ \cline{2-3}
I & 1 & 0 \\ \cline{2-3}
G & 1 & 0 \\ \cline{2-3}
\mc{} & \multicolumn{2}{c}{\color{blue}\bm{\theta}\mystrut} 
\end{array}$
\end{minipage}%
\begin{minipage}{.5\linewidth}
\LARGE
\centering
$\begin{array}{c|c|c|}
\mc{} & \mc{i} & \mc{g} \\ \cline{2-3}
I & p   & 1-p \\ \cline{2-3}
G & 1-p & p   \\ \cline{2-3}
\mc{} & \multicolumn{2}{c}{\color{blue}\bm{1-\theta}\mystrut}
\end{array}$
\end{minipage}

\end{frame}
\end{document}

答案2

为了将物品并排放置,我建议使用 beamers 列机制。

请注意,您不需要colorgraphicxxcolor使用 beamer

\documentclass{beamer}
\usetheme{Warsaw}
\usecolortheme{beaver}
%\usepackage{color}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
%\usepackage{graphicx}
\usepackage{multirow,array}
\usepackage{tikz}
\usetikzlibrary{calc,external,automata,trees,positioning,shadows,arrows,shapes.geometric}
%\usepackage{xcolor}
\usepackage{nicefrac}
\usepackage{mathrsfs}

\setbeamertemplate{footline}[page number]

\begin{document}
%\pagestyle{plain}


\maketitle

\begin{frame}{}
\begin{itemize}
    \item :
    \begin{columns}[totalwidth=.9\textwidth]
        \begin{column}{.4\textwidth}
            \begin{table}
                \begin{tabular}{c|c|c|}
                    \multicolumn{1}{c}{} & \multicolumn{1}{c}{$i$} & \multicolumn{1}{c}{$g$} \\\cline{2-3}
                    $I$ & $1$ & $0$ \\\cline{2-3}
                    $G$ & $1$ & $0$ \\\cline{2-3}
        \end{tabular}
        \caption{$\theta$}
       \end{table}
        \end{column}
        \begin{column}{.4\textwidth}
            \begin{table}
                \begin{tabular}{c|c|c|}
                    \multicolumn{1}{c}{} & \multicolumn{1}{c}{$i$} & \multicolumn{1}{c}{$g$} \\\cline{2-3}
                    $I$ & $p$ & $1-p$ \\\cline{2-3}
                    $G$ & $1-p$ & $p$ \\\cline{2-3}
        \end{tabular}
        \caption{$1-\theta$}
       \end{table}
        \end{column}        
    \end{columns}
\end{itemize}
\end{frame}

\end{document}

相关内容