将表格标记为方程式

将表格标记为方程式

我必须创建如图所示的表格。除了指定名称外,我已完成所有操作(C)(四)到表格。我建议在表格中创建一个附加列并将字母放在那里。但我认为它与图片上的不一样。可能有更正确的方法来做到这一点?

所需表格

\begin{table}[h]

\centering
\begin{tabular}[c]{l*{5}{r}}    
    \hline
Color     & White & Red & Green & Blue & Yellow \\ \hline
Chance \% & 90    & 6   & 1     & 1    & 2      \\
Prize \$  & 0     & 45  & 30    & -15  & -15 \\ \hline

\end{tabular}
\end{table}

and

\begin{table}[h]
    \centering

\begin{tabular}[c]{l*{5}{r}}    
    \hline
    Color     & White & Red & Green & Blue & Yellow \\ \hline
    Chance \% & 90    & 6   & 1     & 1    & 2      \\
    Prize \$  & 0     & 45  & 45    & -10  & -15 \\ \hline

\end{tabular}
\end{table}

答案1

如果你真的希望它像等式一样工作(尽管左边是字母,而不是右边或左边的数字):

\documentclass{article}
\usepackage{environ}
\usepackage{showframe}% MWE only

\newcounter{mytable}
\renewcommand{\themytable}{(\Alph{mytable})}

\makeatletter
\NewEnviron{mytable}[2][c]% same as tabular
{\refstepcounter{mytable}%
 \begin{trivlist}%
   \@beginparpenalty\predisplaypenalty  
   \@endparpenalty\postdisplaypenalty
   \item[]\leavevmode\rlap{\themytable}\hfil
     \begin{tabular}[#1]{#2}\BODY\end{tabular}\hfil
 \end{trivlist}%
}
\makeatother

\begin{document}

Preceeding sentence
\begin{mytable}[c]{l*{5}{r}}    
    \hline
Color     & White & Red & Green & Blue & Yellow \\ \hline
Chance \% & 90    & 6   & 1     & 1    & 2      \\
Prize \$  & 0     & 45  & 30    & -15  & -15 \\ \hline
\end{mytable}
and
\begin{mytable}[c]{l*{5}{r}}    
    \hline
    Color     & White & Red & Green & Blue & Yellow \\ \hline
    Chance \% & 90    & 6   & 1     & 1    & 2      \\
    Prize \$  & 0     & 45  & 45    & -10  & -15 \\ \hline
\end{mytable}
so there.

\end{document}

在此处输入图片描述

相关内容