尝试创建表时出现太多错误

尝试创建表时出现太多错误
\begin{table}[h]
\begin{tabular}{ c c}
\hline
 Hypothesis & Belief & Plausibility \\ \hline
 Null & 0 & 0 \\
 Red & 0.2 & 0.6 \\ 
 Green & 0.15 & 0.6 \\ 
 Blue & 0.15 & 0.55 \\
 Red or Green & 0.45 & 0.85 \\
 Blue or Red & 0.4 & 0.85 \\
 Green or Blue & 0.4 & 0.8 \\
 Red or Green or Blue & 1 & 1 \\ 
 \caption{Belief and Plausibility using mass function}
 \end{tabular}
 \end{table}

我想创建一个三列表格,但我一直收到以下错误

! Misplaced \noalign.\hline ->\noalign{\ifnum 0=`}\fi \penalty \@M
\futurelet \@let@token \LT@@h... \hline

! Misplaced \omit.\multispan ->\omit\@multispan H

! Extra alignment tab has been changed to \cr.<template> \endtemplate
H

! Extra alignment tab has been changed to \cr.<recently read>
\endtemplate Hypothesis & Belief &

! Extra alignment tab has been changed to \cr.<recently read>
\endtemplate Null & 0 &

! Extra alignment tab has been changed to \cr.<recently read>
\endtemplate Red & 0.2 &

! Extra alignment tab has been changed to \cr.<recently read>
\endtemplate Green & 0.15 &

! Extra alignment tab has been changed to \cr.<recently read>
\endtemplate Blue & 0.15 &

! Extra alignment tab has been changed to \cr.<recently read>
\endtemplate Red or Green & 0.45 &

! Extra alignment tab has been changed to \cr.<recently read>
\endtemplate Blue or Red & 0.4 &

答案1

您的“c”太少。再加一个就行了。

\documentclass{article}
\begin{document}
        \begin{table}
        \begin{tabular}{c c c} % Added one more 'c' to match # of columns
        \hline
         Hypothesis & Belief & Plausibility \\ \hline
         Null & 0 & 0 \\
         Red & 0.2 & 0.6 \\ 
         Green & 0.15 & 0.6 \\ 
         Blue & 0.15 & 0.55 \\
         Red or Green & 0.45 & 0.85 \\
         Blue or Red & 0.4 & 0.85 \\
         Green or Blue & 0.4 & 0.8 \\
         Red or Green or Blue & 1 & 1 
         \end{tabular}
         \caption{Belief and Plausibility using mass function} % Moved caption out from tabular to table
         \end{table}
\end{document}

相关内容