我是 Beamer 的新手。我希望演示文稿中的表格与 Latex 文档中的表格相同。
\begin{center}
\begin{tabular}{cc|c|c|}
\cline{3-4}
& & \multicolumn{2}{|c|}{Condition (Gold standard)}\\
\cline{3-4}
& & True & False \\
\hline
\multicolumn{1}{ |c| }{\multirow{2}{*}{Test outcome}}& \multicolumn{1}{ |c| }{Positive} & True Positive \cellcolor{green} & False Positive\cellcolor{red}\\
\cline{2-4}
\multicolumn{1}{ |c| }{} & \multicolumn{1}{ |c| }{Negative} & False Negative\cellcolor{red} & True Negative \cellcolor{green}\\
\hline
\end{tabular}
\end{center}
这是表格,但多列命令在 Beamer 中不起作用。感谢您的帮助!
答案1
您需要将[table]
选项传递给beamer
(然后将其传递给它xcolor
加载的包)。
\documentclass[table]{beamer}
\usepackage{multirow}
\begin{document}
\begin{frame}
\frametitle{}
\begin{center}
\begin{tabular}{cc|c|c|}
\cline{3-4}
& & \multicolumn{2}{|c|}{Condition (Gold standard)}\\
\cline{3-4}
& & True & False \\
\hline
\multicolumn{1}{ |c| }{\multirow{2}{*}{Test outcome}}&
\multicolumn{1}{ |c| }{Positive} & True Positive \cellcolor{green} &
False Positive\cellcolor{red}\\
\cline{2-4}
\multicolumn{1}{ |c| }{} & \multicolumn{1}{ |c| }{Negative} &
False Negative\cellcolor{red} & True Negative \cellcolor{green}\\
\hline
\end{tabular}
\end{center}\end{frame}
\end{document}