我有一个文档,它使用 longtable 包以及 \multicolumn 来使某些单元格跨越多列。这似乎工作得很好:
\documentclass[10pt]{report}
\usepackage{longtable}
\usepackage{tabu}
\usepackage[letterpaper, top=0.5in, right=0.75in, bottom=0.5in, left=0.75in]{geometry}
\begin{document}
\begin{longtabu}{ X[2,l] X[3,l] X[1,l] X[5,l] }
\multicolumn{3}{ l }{\large{\textbf{Task}}} & \\
\textbf{Date} & \textbf{Employee} & \textbf{Hours} & \textbf{Notes} \\
\endhead
\end{longtabu}
\end{document}
然而,随后我尝试实现一个不同的表,这次我得到了来自 pdflatex 的错误:
\documentclass[10pt]{report}
\usepackage{longtable}
\usepackage{tabu}
\usepackage[letterpaper, top=0.5in, right=0.75in, bottom=0.5in, left=0.75in]{geometry}
\begin{document}
\begin{longtabu}{ X[4,l] X[2,r] X[1,c] X[2,r] X[1,c] }
\textbf{Description} &
\multicolumn{2}{c}{\textbf{Current}} & \\
\multicolumn{2}{c}{\textbf{Cumulative}} \\
\hline
\endhead
\end{longtabu}
\end{document}
我调整了两个表以尝试确定错误来源,结果似乎来自跨度的列数。例如,在工作表中,如果我更改\multicolumn{3}{l}{ ... }
为\multicolumn{2}{l}{ ... } & Foo
,则会出现相同的错误。我完全不明白为什么会这样。
以下是 pdflatex 的相关输出:
! Dimension too large.
<recently read> \tabucolX
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<recently read> \tabucolX
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
\LT@max@sel #1#2->{\ifdim #2=\wd \tw@
#1\else \number \c@LT@chunks \fi }{\th...
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
\LT@max@sel #1#2->{\ifdim #2=\wd \tw@
#1\else \number \c@LT@chunks \fi }{\th...
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
\LT@max@sel #1#2->{\ifdim #2=\wd \tw@
#1\else \number \c@LT@chunks \fi }{\th...
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<to be read again>
\relax
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<to be read again>
\relax
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<to be read again>
\relax
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<to be read again>
=
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<to be read again>
=
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<to be read again>
=
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<recently read> \tabucolX
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<recently read> \tabucolX
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
\LT@max@sel #1#2->{\ifdim #2=\wd \tw@
#1\else \number \c@LT@chunks \fi }{\th...
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
\LT@max@sel #1#2->{\ifdim #2=\wd \tw@
#1\else \number \c@LT@chunks \fi }{\th...
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
\LT@max@sel #1#2->{\ifdim #2=\wd \tw@
#1\else \number \c@LT@chunks \fi }{\th...
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<to be read again>
\relax
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<to be read again>
\relax
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<to be read again>
\relax
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<to be read again>
=
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<to be read again>
=
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
! Dimension too large.
<to be read again>
=
l.23 \end{longtabu}
I can't work with sizes bigger than about 19 feet.
Continue and I'll use the largest value I can.
Package longtable Warning: Column widths have changed
(longtable) in table 1 on input line 23.
Package longtable Warning: Table widths have changed. Rerun LaTeX.
答案1
最好(在任何对齐方式中)不要有列总是跨越。
\documentclass[10pt]{report}
\usepackage{longtable}
\usepackage{tabu}
\usepackage[letterpaper, top=0.5in, right=0.75in, bottom=0.5in, left=0.75in]{geometry}
\begin{document}
\begin{longtabu}{ X[4,l] X[2,r] X[1,c] X[2,r] X[1,c] }
\textbf{Description} &
\multicolumn{2}{c}{\textbf{Current}} & \\
\multicolumn{2}{c}{\textbf{Cumulative}} \\
\hline
a&b&c&d&e
\endhead
\end{longtabu}
\end{document}
运行无错误。