2010-11-16 77 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