你好,我正在尝试制作这个乳胶表,但是我在表格第二行的分数上遇到了问题,即缺失}
或忘记了$
\begin{table}[h]
\centering
\begin{tabular}{c|c|p{5cm}}
Metric & Equation & Description \\
\hline
Negative Sentiment & ${NB}_1$ where S= $S_{-1}$ & Absolute number of negative statements about a brand \\ \hline
Negative Sentiment Ratio & $\frac{X}{$${NB}_1$$}$ & negative comments compared to the total number of statements on the Brand. \\ \hline
Positive Sentiment & ${NB}_1$ where S= $S_1$ & Absolute number of Positive statements about a brand \\ \hline
Neutral Sentiment & ${NB}_1$ where S= $S_0$ & Absolute number of Neutral statements about a brand \\ \hline
\end{tabular}
\caption{Caption}
\label{tab:my_label}
\end{table}
答案1
数学表达式应该包含在一组美元中,因此
$S = S_{-1}$
代替
S = $S_{-1}$
和
$\frac{X}{{NB}_1}$
代替
$\frac{X}{$${NB}_1$$}$
双倍美元$$
会造成额外的混乱,因为它试图将 LaTeX 发送到显示数学中。
我强烈怀疑你想要NB
直立,你可以用\mathrm{NB}
这个。(如果不是,并且它表示一个符号,那么\mathit{NB}
将是合适的。)
样式良好的表格应避免垂直线,也不要有太多水平线。请参阅booktabs
包裹进行讨论。我在下面提供了建议的样式,也使用包m
中的垂直居中类型列array
而不是p
。
\documentclass{article}
\usepackage{booktabs,amsmath,array}
\begin{document}
\begin{table}
\centering
\begin{tabular}{ccm{5cm}}
\toprule
Metric
& Equation
&\multicolumn{1}{c}{Description} \\
\midrule
Negative Sentiment
& $\mathrm{NB}_1$ where $S = S_{-1}$
& Absolute number of negative statements about a brand \\
\addlinespace
Negative Sentiment Ratio
& $\dfrac{X}{\mathrm{NB}_1}$
& Negative comments compared to the total number of statements on
the Brand. \\
\addlinespace
Positive Sentiment
& $\mathrm{NB}_1$ where $S = S_1$
& Absolute number of Positive statements about a brand \\
\addlinespace
Neutral Sentiment
& $\mathrm{NB}_1$ where $S = S_0$
& Absolute number of Neutral statements about a brand \\
\bottomrule
\end{tabular}
\caption{Caption}
\label{tab:my_label}
\end{table}
\end{document}