4


mulitrow でテーブルを作成していますが、問題が発生しています。私が理解している限り、これは複数行の形式です。

\multirow{count}{alignment}{content}

ここで、count はマージする行数、alignment は l、c、r、または * のいずれか、content は行のコンテンツです。私は次のことを試しました:

\multirow{3}{*}{Framing}

しかし、私は問題を抱えています。セルに「Framing」という単語が表示されるのではなく、\multirow 要素が機能していないことを示す「3*Framing」が表示されます。何か案が?

また、セル内のテキストを垂直方向に揃えるにはどうすればよいですか?

更新: \usepackage{multirow} で解決できると思いましたが、まだ問題があります。まず、垂直方向の配置を作成できません。第二に、「フレーミング」セルで奇妙なことが起こります。「Framing」を左に揃える代わりに、文字「l」を含む 1 つの仮想行を取得し、2 つの仮想行の後に「Framing」という単語を取得します!! それは次のようなものです:

______________
|     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*}

よろしく、
ラフィド

4

3 に答える 3

5

1) 文書の先頭に入れ\usepackage{multirow}ましたか?

2) 従うべき良い例がおそらくそこにあります。このパッケージを使用したことはありませんが、短時間 (数秒) でこのページを Google 経由で見つけることができました。その例に沿って従うことはあなたを助けますか?


更新:実際のテーブルを見た後、言いたくないのですが、スペースの不具合は、「コメント」列が複数行にあふれているためだと思います。私はあなたのコメントを切り捨てて、これを得ました (列 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*}

{l} 引数については、最初に投稿したリンクがおそらく間違っていると思います。\multirow引数の * を l に置き換えようとすると、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を見つけた後、 の 2 番目の引数\multirowは配置ではなく幅であると思います。リンクされたLyX wikiは、フォーマットが次のようになっていると言います:

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

{cell width} は実際には {alignment} であると想定してきましたが、以前のリンクが混乱を招いていると思います。間隔については、LyX wiki の注を参照してください。入札を行うために必要な場合は、次を使用できます。

\renewcommand{\multirowsetup}{\centering}

\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) |

それは理にかなっていますか?列 1 はそのセクションのすべての行にまたがり、後続の行は分割されたコメントに必要な行数にまたがり、コメントに必要な各行 (3 または 4 を占めるものもあります) は、それぞれ別の行に表示されます。次回に続く。ただし、文の間隔が奇妙に見えるかどうかはわかりません。

とりとめのない。あなたの思考の糧があります。


最後の更新:これに関する最後の希望の方法は、TikZ テーブルを使用することです。基本的に、ノードは「細胞」のようなものです。あとは、それらを組み合わせて、テーブルのように見せるだけです。恐ろしい提案かもしれませんが、セルの間隔などで必要なすべての柔軟性が得られることを保証します。いくつかのアイデア:

于 2010-11-16T20:43:39.300 に答える
3

ワイルドな推測:プリアンブルにundefined control sequence: multirowa が欠けているため、取得していますか?\usepackage{multirow}

于 2010-11-16T20:39:43.230 に答える
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}

質問への編集後の編集: 2 つのエラーが発生しました:

  1. \multirow{4}{l}{Framing}. に変更しました\multirow{4}{*}{Framing}

  2. Delta_tに変わりました$Delta_t$

そうでなければ、すべて問題ないようです。tex.stackexchange.comにも問い合わせてください。

于 2010-11-16T20:40:33.810 に答える