![Latex 表格缺失数字错误](https://linux22.com/image/432711/Latex%20%E8%A1%A8%E6%A0%BC%E7%BC%BA%E5%A4%B1%E6%95%B0%E5%AD%97%E9%94%99%E8%AF%AF.png)
我试图在 Miktex 中制作与上述格式相同的表格,但我一直收到错误,例如缺失数字被视为零。表格应该有一些空块,但我不知道这是否导致了问题。
\begin{align}
\begin{tabular}{ |p{3cm}||p{3cm}|p{3cm}|p{3cm}|p{3cm}|p{3cm}|p{3cm}| }
\hline
Test was& &1 & 2 & 3 & ... & N\\
\hline
\multirow{2}{performed} & a_i & + & + $ - & ... & +\\
& b_i & + & - & - & ...$ + \\
\hline
\multirow{2}{not performed} & a'_i & ? & ? & ? $ ... & ?\\
& b'_i & ? & ? & ? $ ... & ?\\
\hline
\end{tabular}
\end{align}
答案1
我猜想以下内容至少在某种程度上接近预期的输出:
\documentclass{article}
\usepackage{multirow,array}
\begin{document}
\begin{tabular}{|l||>{$}c<{$}|c|c|c|c|c|} \hline
Test was & & 1 & 2 & 3 & ... & N \\ \hline
\multirow{2}{*}{performed} & a_i & + & + & - & ... & + \\
& b_i & + & - & - & ... & + \\ \hline
\multirow{2}{*}{not performed} & a'_i & ? & ? & ? & ... & ? \\
& b'_i & ? & ? & ? & ... & ? \\ \hline
\end{tabular}
\end{document}
答案2
使用array
和w{c}{<width>}
列类型:
\documentclass{article}
\usepackage{array, multirow}
\begin{document}
\[
\setlength\extrarowheight{2pt}
\begin{array}{ |p{7em}||*{6}{w{c}{2em}|} }
\hline
Test was & & 1 & 2 & 3 & \dots & N \\
\hline
\multirow{2}{=}{performed}
& a_i & + & + & - & \dots & + \\
& b_i & + & - & - & \dots & + \\
\hline
\multirow{2}{=}{not performed}
& a'_i & ? & ? & ? & \dots & ? \\
& b'_i & ? & ? & ? & \dots & ? \\
\hline
\end{array}
\]
\end{document}