2010-11-16 78 views
3


我正在用mulitrow创建一个表格,但我遇到了问题。据我明白了,这是多行的形式:乳胶:Multirow问题

\multirow{count}{alignment}{content} 

其中计数的行合并的数量,取向要么L,C,R,或*和含量的含量行。我试过以下内容:

\multirow{3}{*}{Framing} 

但我遇到了问题。我没有在单元格中看到“Framing”这个词,而是看到“3 * Framing”,它表明\ multirow元素不起作用。任何想法?

另外,如何能够垂直对齐单元格中的文本?

更新: 我以为\ usepackage {multirow}会解决它,但我仍然看到问题: 首先,我不能做垂直对齐。第二,我用“框架”单元得到了一些奇怪的东西。我没有将“框架”对齐到左边,而是得到一个包含字母“l”的虚拟行,然后在两个虚拟行之后,我得到“框架”一词!它是这样的:

______________ 
|  l  | 
|    | 
|  Framing | 
|    | 
|    | 
|    | 
|    | 
______________ 

这是我的表对于那些谁问它:

\begin{table*}\tiny 
    \centering 
    \begin{tabular}{|c|c|c|c|c|p{2in}|} 
     \hline 

     Rule & Factor & Best Value & \Delta_t & \Delta_{do} & Comments \\ 

     \hline 

     % Diagonal Dominance Rule 
     \multirow{3}{*}{Diagonal Dominance} & 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. 
              & 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 
              & 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 

     % Framing Rule 
     \multirow{4}{l}{Framing} & Left Distance & 0 & ${Frame Width}*5\%$ & ${Frame Width}*25\%$ & The distance between the 
     left side of the frame covering the object and the left or the right side of the intended frame, whichever closer. \\ 
           & Right Distance & 0 & ${Frame Width}*5\%$ & ${Frame Width}*25\%$ & The distance between the 
     right side of the frame covering the object and the left or the right side of the intended frame, whichever closer. \\ 
           & Top Distance & 0 & ${Frame Height}*5\%$ & ${Frame Height}*25\%$ & The distance between the 
     top side of the frame covering the object and the upper or the lower side of the intended frame, whichever closer. \\ 
           & Bottom Distance & 0 & ${Frame Height}*5\%$ & ${Frame Height}*25\%$ & The distance between the 
     bottom side of the frame covering the object and the upper or the lower side of the intended frame, whichever closer. \\ 

     \hline 
    \end{tabular} 
    \caption{The factors of each rule and their parameters.} 
    \label{table:factors} 
\end{table*} 

问候,
Rafid

+1

如何写出好问题:请写下“我收到错误”,请告诉我们*您收到哪个*错误。 – Heinzi 2010-11-16 20:37:23

+0

在您引用的陈述后面解释:“我没有看到单元格中的”成帧“这个词,而是看到”3 * Framing“,这表明\ multirow元素不起作用。”对不起,可能这里的“错误”这个词是不准确的。没有编译错误,只是输出错误。如果你喜欢,可以称之为“问题”。 – Rafid 2010-11-16 20:40:08

+1

啊,好的,谢谢澄清。 – Heinzi 2010-11-16 20:43:16

回答

4

1)您是否在文档的开头放置了\usepackage{multirow}

2)这里可能有很好的例子。我从来没有使用过这个软件包,但在很短的时间内(通过谷歌就能找到这个PAGE)。下面的例子能帮助你吗?


更新:看到你实际的表后,我讨厌这样说,但觉得你的间距毛刺是由于溢出的“意见”一栏为多行。我截断了您的意见,并得到这个(列1现在是垂直居中根据需要):

\begin{table*}\tiny 
    \centering 
    \begin{tabular}{|c|c|c|c|c|p{3cm}|} 
    \hline 
    Rule & Factor & Best Value & \Delta_t & \Delta_{do} & Comments \\ 
    \hline 

    % Diagonal Dominance Rule 
    \multirow{3}{*}{Diagonal Dominance} & Line Angle & 45 & 15 & 30 & The angle between... \\ 
             & Line Distance & 0 & 0.25 & 1 & The distance, in... \\ 
             & Corner Distances & 0 & 0.1 & 0.7 & The distance, in... \\ 
    \hline 

    % Framing Rule 
    \multirow{4}{*}{Framing} & Left Distance & 0 & ${Frame Width}*5\%$ & ${Frame Width}*25\%$ & The distance... \\ 
          & Right Distance & 0 & ${Frame Width}*5\%$ & ${Frame Width}*25\%$ & The distance... \\ 
          & Top Distance & 0 & ${Frame Height}*5\%$ & ${Frame Height}*25\%$ & The distance... \\ 
          & Bottom Distance & 0 & ${Frame Height}*5\%$ & ${Frame Height}*25\%$ & The distance... \\ 
    \hline 
    \end{tabular} 

    \caption{The factors of each rule and their parameters.} 
    \label{table:factors} 

\end{table*} 

关于{1}的说法,我觉得我原本张贴的链接可能是错误的。当我尝试用l替换\multirow参数时,LaTeX为我吐出一些错误。我得到这个在测试表:

! Missing number, treated as zero. 
<to be read again> 
        l 
l.12 \multirow{4}{l}{Batch} 
          & MM & Min-Min \\ 
! Illegal unit of measure (pt inserted). 
<to be read again> 
        l 
l.12 \multirow{4}{l}{Batch} 
          & MM & Min-Min \\ 

找到THIS之后,我觉得在\multirow第二个参数是不是对齐但对于一个宽度。该LyX的维基链接表示,格式是像这样:

\multirow{number of rows}{cell width}{cell entry} 

我们已经假设{单元格的宽度}在实际工作中{}对齐,我认为从早期的链接,使这混乱。请参阅LyX维基有关间距的说明;您可以使用需要的地方,使其听从你的命令如下:

\renewcommand{\multirowsetup}{\centering} 

而且随着\raggedleft\raggedright更换\centering需要的地方。我仍然认为你会在多条线路上遇到麻烦。我至少已经证明,放弃它们可以使间距按需要工作......恐怕,如何强制它们以默认的例子为中心。但也许现在你知道问题出在哪里了?

我想如果你真的真的希望你能分开你的句子,找出需要多少行,并相应地调整你的参数以增加行数。虽然你也可能需要一个嵌套的多行结构:

|     | item 1, 2 rows | comment 1 line 1    | 
| multirow, 4 rows |    | comment 1 line 2 (spill over) | 
|     | item 2, 2 rows | comment 2 line 1    | 
|     |    | comment 2 line 2 (spill over) | 

这有道理吗?第1列将跨越其部分的所有行,随后的行将跨越分割注释所需的行数,并且注释所需的每一行(有些占用3或4)将位于它们自己的单独行上并且仅出现连续。不知道句子间距是否会看起来很奇怪。

Nu ra。有你的想法。


最后更新:最后一个希望的方式去,这可能是与TikZ表。本质上,你的节点就像“单元”。然后把它们放在一起,让它看起来像一张桌子。也许是一个可怕的建议,但我向你保证,你将拥有所有灵活性,你需要与单元格间距等。一些想法:

+0

是的,它似乎是\ usepackage的一个问题。我现在使用它,它似乎工作正常,但我仍然无法设法得到垂直对齐。我给它一些尝试,并会看到。 – Rafid 2010-11-16 21:02:01

+0

你能用示例表更新你的问题,所以我可以尝试你究竟是什么?这可能会帮助我们所有人。很难找出问题,只有那个'\ multirow {3} {*} {Framing}行 – Hendy 2010-11-16 21:20:28

+0

好的,我用整个表格更新了这个问题。 – Rafid 2010-11-16 21:26:10

2

野生猜想:你得到“未定义控制sequence:multirow“,因为你缺少一个\ usepackage {multirow}?

2

是的,你需要multirow包。编辑问题后

\usepackage{multirow} 
\begin{document} 
\begin{table} 
\centering 
\begin{tabular}{l||c|r} 
Header 1 & Header 2 & Header 3 \\ 
\multirow{2}{*}{Hello} & stuff & stuff \\ 
& Body 2 & Body 3 
\end{tabular} 
\end{table} 
\end{document} 

编辑:我有两个错误:

  1. \multirow{4}{l}{Framing}。我改为\multirow{4}{*}{Framing}

  2. Delta_t改为$Delta_t$

否则,一切似乎都很好。你也可以问问tex.stackexchange.com