![表格/tabularx 环境中的对齐错误](https://linux22.com/image/463289/%E8%A1%A8%E6%A0%BC%2Ftabularx%20%E7%8E%AF%E5%A2%83%E4%B8%AD%E7%9A%84%E5%AF%B9%E9%BD%90%E9%94%99%E8%AF%AF.png)
下面的例子
\documentclass{article}
\usepackage{tabularx}
\usepackage{multirow}
\begin{document}
\begin{table}
\begin{tabularx}{\columnwidth}{|X|X|}
\hline
\multicolumn{3}{|l|}{House Lannister} &
Cersei \\ \cline{2-2}
& Jaime \\ \cline{2-2}
& Tyrion \\
\hline
\end{tabularx}
\end{table}
\end{document}
导致以下错误
l.15 \end{tabularx}
You have given more \span or & marks than there were
in the preamble to the \halign or \valign now in progress.
So I'll assume that you meant to type \cr instead.
它看起来符合预期:
(我知道我应该用
multirow
但是那根本不起作用。)
上面的代码有什么错误?
答案1
答案2
这个代码示例终于成功了。但老实说,我不太明白,压死骆驼的最后一根稻草是什么。
\documentclass{article}
\usepackage{tabularx}
\usepackage{multirow}
\begin{document}
\begin{table}
\begin{tabularx}{\textwidth}{|X|X|}
\hline
\multirow{3}{*}{House Lannister} &
Cersei \\ \cline{2-2}
& Jaime \\ \cline{2-2}
& Tyrion \\
\hline
\end{tabularx}
\end{table}
\end{document}