乳胶:多行问题

Raf*_*fid 4 latex multirow


我正在用mulitrow创建一个表,但是遇到了问题。据我了解,这是多行的形式:

\multirow{count}{alignment}{content}
Run Code Online (Sandbox Code Playgroud)

其中count是要合并的行数,对齐方式是l,c,r或*,content是行的内容。我尝试了以下方法:

\multirow{3}{*}{Framing}
Run Code Online (Sandbox Code Playgroud)

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

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

更新:我认为\ usepackage {multirow}可以解决它,但是我仍然看到问题:首先,我无法进行垂直对齐。其次,我在“框架”单元中遇到了一些奇怪的事情。而不是使“框架”与左侧对齐,我得到了一个包含字母“ l”的虚拟行,然后在两个虚拟行之后得到了“框架”一词!它是这样的:

______________
|     l       |
|             |
|     Framing |
|             |
|             |
|             |
|             |
______________
Run Code Online (Sandbox Code Playgroud)

这是我给那些询问过的人的桌子:

\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*}
Run Code Online (Sandbox Code Playgroud)

问候,
拉菲德

Hen*_*ndy 5

1)您放在\usepackage{multirow}文件的开头了吗?

2)可能有很多好的例子可以效仿。我从未使用过此软件包,但在很短的时间内(几秒钟)便可以通过Google 找到此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*}
Run Code Online (Sandbox Code Playgroud)

关于{l}参数,我认为我最初发布的链接可能是错误的。当我尝试将*替换为l时,LaTeX为我吐出一些错误\multirow。我在测试桌上得到这个:

! 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 \\
Run Code Online (Sandbox Code Playgroud)

找到THIS之后,我认为其中的第二个参数\multirow不是对齐,而是宽度。链接的LyX Wiki表示格式如下:

\multirow{number of rows}{cell width}{cell entry}
Run Code Online (Sandbox Code Playgroud)

我们一直以为{cell width}实际上是{alignment},我认为来自较早版本的链接令人困惑。请参见LyX Wiki上有关间距的注释;您可以在需要时使用以下内容进行出价:

\renewcommand{\multirowsetup}{\centering}
Run Code Online (Sandbox Code Playgroud)

并在需要时替换\centering\raggedleft\raggedright。我仍然认为您会在多行中遇到麻烦。至少我已经证明,放弃它们可以使间距按预期工作。恐怕如何在默认示例中将它们居中?但是也许现在您知道问题出在哪里了?

我想,如果您确实真的希望您可以拆分句子,弄清楚需要多少行,并\multirow根据行数的增加相应地调整参数。尽管您可能还需要嵌套的多行结构:

|                   | 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) |
Run Code Online (Sandbox Code Playgroud)

那有意义吗?第1列将覆盖其部分的所有行,后续的行将覆盖拆分后的注释所需的行数,注释所需的每一行(有些占用3或4)将位于其单独的行上并仅显示要连续。不过,不确定句子间距是否看起来很奇怪。

怒气冲冲。有你的想法。


最后更新:实现此目标的最后一种希望方法可能是使用TikZ表。本质上,您的节点就像“单元”。然后将它们放在一起,使其看起来像一张桌子。也许这是一个可怕的建议,但我向您保证,您将拥有像元间隔等所需的所有灵活性。一些想法: