我想在两栏的论文中插入一个长表格。我首先尝试了“tabular”,但问题是它没有将表格划分到各个页面。然后这篇文章中的人建议我使用 xtab:
我尝试了一下,但不幸的是,在将星号添加到工作 xtabular 表后出现了这个错误:
./composition-body.tex:392: Missing number, treated as zero.
<to be read again>
|
l.392 \hline
我不明白这个错误,尤其是删除星号会消除错误。在网上搜索了一番后,我认为它可能需要宽度,所以我{5in}
在后面添加了\begin{xtabular*}
。这解决了编译问题,但 LaTeX 仍然试图将表格插入列中,如以下两张图片所示:
如果您想阅读,以下是 LaTeX 代码:
\tablecaption{The factors the camera solver depends on to evaluate the rules.}
\tablehead{\hline \textbf{Factor} & \textbf{Best Value} & \textbf{$\Delta_t$} & \textbf{$\Delta_{do}$} & \textbf{Explanation} \\}
\begin{xtabular*}{5in}{|c|c|c|c|p{3in}|}
\hline
%%% ----- Rule of Thirds (Corners) -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Rule of Thirds (Corners)} \\
\hline
Horizontal Distance to Corner & 0 & HD/20 & HD & The horizontal distance between the centre of mass of the object and the closest corner. \\
\hline
Vertical Distance to Corner & 0 & HD/20 & HD & The vertical distance between the centre of mass of the object and the closest corner. \\
\hline
%%% ----- Rule of Thirds (Lines) -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Rule of Thirds (Lines)} \\
\hline
Line Angle & 45 & 15 & 30 & The angle between the prominent line of the object and the diagonal lines \\ % TODO: What object? Make sure it is clear.
\hline
Line Distance & 0 & 0.25 & 1 & The distance, in screen coordinates, from the prominent line of the object to the diagonal lines. \\ % TODO: Need to define screen coordinates
\hline
Corner Distances & 0 & 0.1 & 0.7 & The distance, in screen coordinates, from the end of the prominent line of the object to the corners of the screen. \\
\hline
%%% ----- Diagonal Dominance -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Diagonal Dominance} \\
\hline
Line Angle & 45 & 15 & 30 & The angle between the prominent line of the object and the diagonal lines \\ % TODO: What object? Make sure it is clear.
\hline
Line Distance & 0 & 0.25 & 1 & The distance, in screen coordinates, from the prominent line of the object to the diagonal lines. \\ % TODO: Need to define screen coordinates
\hline
Corner Distances & 0 & 0.1 & 0.7 & The distance, in screen coordinates, from the end of the prominent line of the object to the corners of the screen. \\
\hline
%%% ----- Visual Balance -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Visual Balance} \\
\hline
Horizontal Center & 0 & 0.1 & 0.5 & The horizontal component of the centre of mass of all the objects of the rule. \\ % TODO: What does "objects" mean here? It should be well explained.
\hline
Vertical Center & 0 & 0.1 & 0.5 & The vertical component of the centre of mass of all the objects of the rule. \\ % TODO: What does "objects" mean here? It should be well explained.
\hline
%%% ----- Boundary Rule -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Boundardy Rule} \\
\hline
Left Outside & 0 & 5\% BW & 25\% BW & The width of the part of the object which is beyond the left border of the boundary specified by the rule. \\
\hline
Right Outside & 0 & 5\% BW & 25\% BW & The width of the part of the object which is beyond the right border of the boundary specified by the rule. \\
\hline
Top Outside & 0 & 5\% BH & 25\% BH & The height of the part of the object which is beyond the upper border of the boundary specified by the rule. \\
\hline
Bottom Outside & 0 & 5\% BH & 25\% BH & The height of the part of the object which is beyond the lower border of the boundary specified by the rule. \\
\hline
%%% ----- Framing Rule -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Framing Rule} \\
\hline
Left Delta & 0 & 5\% FW & 25\% FW & The distance between the left of the object's frame and the left of the frame specified by the rule. \\
\hline
Right Delta & 0 & 5\% FW & 25\% FW & The distance between the right of the object's frame and the right of the frame specified by the rule. \\
\hline
Top Delta & 0 & 5\% FH & 25\% FH & The distance between the top of the object's frame and the top of the frame specified by the rule. \\
\hline
Bottom Delta & 0 & 5\% FH & 25\% FH & The distance between the bottom of the object's frame and the bottom of the frame specified by the rule. \\
\hline
%%% ----- Visibility Rule -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Visibility Rule (Full Visibility)} \\
\hline
Visibility & 100 & 5 & 50 & The percentage of the visible part of the object. \\
\hline
%%% ----- Visibility Rule -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Visibility Rule (No Visibility)} \\
\hline
Visibility & 0 & 5 & 50 & The percentage of the visible part of the object. \\
\hline
%%% ----- Position Rule -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Position Rule} \\
\hline
Horizontal Distance & 0 & 0.01 & 0.25 & The horizontal distance between the centre of mass of the object and the position specified by the rule. \\
\hline
Vertical Distance & 0 & 0.01 & 0.25 & The vertical distance between the centre of mass of the object and the position specified by the rule. \\
\hline
%%% ----- Size Rule -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Size Rule} \\
\hline
Beyond Minimum Width & 0 & 5\% AOW & 25\% FW & The amount the width of the object is beyond the minimum width. \\
\hline
Beyond Minimum Height & 0 & 5\% AOH & 25\% FH & The amount the height of the object is beyond the minimum height. \\
\hline
Beyond Maximum Width & 0 & 5\% AOW & 25\% FW & The amount the width of the object is beyond the maximum width. \\
\hline
Beyond Maximum Height & 0 & 5\% AOH & 25\% FH & The amount the height of the object is beyond the maximum height. \\
\hline
\label{table:factors}
\end{xtabular*}
答案1
到目前为止,我理解xtab
该xtabular*
版本的源代码只是tabular*
内部使用,即它允许您明确设置表格宽度。当未指定宽度时,这会导致错误。它显然不会使表格跨越两列,正如手册中提到的那样!
我的建议是:
将其放回顶部浮动\begin{figure*}[t]
,使其出现在下一页的顶部(或者底部)。如果表格仍然长于一页,请手动将其拆分为两个浮动。我认为对于论文来说,这种努力是可以接受的,并且能给你最好的结果。对于较长文档中的多页(3+)表格,我会采取不同的做法。
答案2
在双栏文档中使用xtabular
,只需编译一次又一次。xtab
需要编译多次才能确定表格的合适高度。
tabular*
在 LaTeX 中,以及/中的xtabular*
/都不太好用。您必须添加等来填充列。例如: supertabular*
xtab
supertabular
@{\extracolsep{\fill}}
\documentclass[twocolumn]{article}
\usepackage{xtab}
\begin{document}
\begin{xtabular*}{\columnwidth}{@{\extracolsep{\fill}}|*{5}{p{1.2cm}|}}
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
a & b & c & d & e \\
\end{xtabular*}
\end{document}
但是它不适合你的表格,因为表格本身就包含太多的内容。所以你最好不要xtabular*
在这么窄的列中使用。这里有一个更好的解决方案:
\documentclass{article}
\usepackage{xtab,colortbl}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash\hspace{0pt}}p{#1}}
\usepackage{multicol}
\usepackage{lipsum}
\begin{document}
\begin{multicols}{2}
\lipsum[1-2]
\end{multicols}
\tablecaption{The factors the camera solver depends on to evaluate the rules.}
\tablehead{\hline \textbf{Factor} & \textbf{Best Value} & \textbf{$\Delta_t$} & \textbf{$\Delta_{do}$} & \textbf{Explanation} \\}
\begin{xtabular*}{\textwidth}{|@{\extracolsep{\fill}}*{4}{C{0.5in}}p{1.8in}|}
\hline
%%% ----- Rule of Thirds (Corners) -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Rule of Thirds (Corners)} \\
\hline
Horizontal Distance to Corner & 0 & HD/20 & HD & The horizontal distance between the centre of mass of the object and the closest corner. \\
\hline
Vertical Distance to Corner & 0 & HD/20 & HD & The vertical distance between the centre of mass of the object and the closest corner. \\
\hline
%%% ----- Rule of Thirds (Lines) -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Rule of Thirds (Lines)} \\
\hline
Line Angle & 45 & 15 & 30 & The angle between the prominent line of the object and the diagonal lines \\ % TODO: What object? Make sure it is clear.
\hline
Line Distance & 0 & 0.25 & 1 & The distance, in screen coordinates, from the prominent line of the object to the diagonal lines. \\ % TODO: Need to define screen coordinates
\hline
Corner Distances & 0 & 0.1 & 0.7 & The distance, in screen coordinates, from the end of the prominent line of the object to the corners of the screen. \\
\hline
%%% ----- Diagonal Dominance -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Diagonal Dominance} \\
\hline
Line Angle & 45 & 15 & 30 & The angle between the prominent line of the object and the diagonal lines \\ % TODO: What object? Make sure it is clear.
\hline
Line Distance & 0 & 0.25 & 1 & The distance, in screen coordinates, from the prominent line of the object to the diagonal lines. \\ % TODO: Need to define screen coordinates
\hline
Corner Distances & 0 & 0.1 & 0.7 & The distance, in screen coordinates, from the end of the prominent line of the object to the corners of the screen. \\
\hline
%%% ----- Visual Balance -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Visual Balance} \\
\hline
Horizontal Center & 0 & 0.1 & 0.5 & The horizontal component of the centre of mass of all the objects of the rule. \\ % TODO: What does "objects" mean here? It should be well explained.
\hline
Vertical Center & 0 & 0.1 & 0.5 & The vertical component of the centre of mass of all the objects of the rule. \\ % TODO: What does "objects" mean here? It should be well explained.
\hline
%%% ----- Boundary Rule -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Boundardy Rule} \\
\hline
Left Outside & 0 & 5\% BW & 25\% BW & The width of the part of the object which is beyond the left border of the boundary specified by the rule. \\
\hline
Right Outside & 0 & 5\% BW & 25\% BW & The width of the part of the object which is beyond the right border of the boundary specified by the rule. \\
\hline
Top Outside & 0 & 5\% BH & 25\% BH & The height of the part of the object which is beyond the upper border of the boundary specified by the rule. \\
\hline
Bottom Outside & 0 & 5\% BH & 25\% BH & The height of the part of the object which is beyond the lower border of the boundary specified by the rule. \\
\hline
%%% ----- Framing Rule -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Framing Rule} \\
\hline
Left Delta & 0 & 5\% FW & 25\% FW & The distance between the left of the object's frame and the left of the frame specified by the rule. \\
\hline
Right Delta & 0 & 5\% FW & 25\% FW & The distance between the right of the object's frame and the right of the frame specified by the rule. \\
\hline
Top Delta & 0 & 5\% FH & 25\% FH & The distance between the top of the object's frame and the top of the frame specified by the rule. \\
\hline
Bottom Delta & 0 & 5\% FH & 25\% FH & The distance between the bottom of the object's frame and the bottom of the frame specified by the rule. \\
\hline
%%% ----- Visibility Rule -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Visibility Rule (Full Visibility)} \\
\hline
Visibility & 100 & 5 & 50 & The percentage of the visible part of the object. \\
\hline
%%% ----- Visibility Rule -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Visibility Rule (No Visibility)} \\
\hline
Visibility & 0 & 5 & 50 & The percentage of the visible part of the object. \\
\hline
%%% ----- Position Rule -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Position Rule} \\
\hline
Horizontal Distance & 0 & 0.01 & 0.25 & The horizontal distance between the centre of mass of the object and the position specified by the rule. \\
\hline
Vertical Distance & 0 & 0.01 & 0.25 & The vertical distance between the centre of mass of the object and the position specified by the rule. \\
\hline
%%% ----- Size Rule -----
\multicolumn{5}{|>{\columncolor[gray]{.8}}l|}{Size Rule} \\
\hline
Beyond Minimum Width & 0 & 5\% AOW & 25\% FW & The amount the width of the object is beyond the minimum width. \\
\hline
Beyond Minimum Height & 0 & 5\% AOH & 25\% FH & The amount the height of the object is beyond the minimum height. \\
\hline
Beyond Maximum Width & 0 & 5\% AOW & 25\% FW & The amount the width of the object is beyond the maximum width. \\
\hline
Beyond Maximum Height & 0 & 5\% AOH & 25\% FH & The amount the height of the object is beyond the maximum height. \\
\hline
\label{table:factors}
\end{xtabular*}
\begin{multicols}{2}
\lipsum[3-4]
\end{multicols}
\end{document}