下面的例子
\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}