【问题标题】:Multiple lines in a cell of a table表格单元格中的多行
【发布时间】:2010-04-21 22:36:43
【问题描述】:

我有一张如下图所示的表格:

表格的 LaTeX 代码是:

\begin{table}  
\begin{tabular}{ | c | c | }  
  \hline  
  \includegraphics[scale=0.45]{../0_1.eps} & 1.10 2.20 3.30 4.40 \\  
  \hline   
\end{tabular}  
\end{table}

我想让四个数字出现在第二个单元格内的不同行中,以减小其宽度。我想知道怎么做?


编辑:

我试过\换行符,

\includegraphics[scale=0.45]{../0_1.eps} & 1.10 \linebreak 2.20 \linebreak 3.30 \linebreak 4.40 \\

但结果与之前相同,即没有 \linebreak。


编辑:

我刚刚尝试了 Rob 的建议。但结果并不紧凑,因为我的意图是减小表格的大小。见下图:

【问题讨论】:

  • 你用什么应用来预览这些东西?这很整洁。

标签: latex


【解决方案1】:

尝试使用带有 \par 的 p 列来指示换行符。

\begin{table}  
\begin{tabular}{ | c | p{2cm} | }  
  \hline  
  \includegraphics[scale=0.45]{../0_1.eps} & 1.10\par 2.20\par 3.30\par 4.40 \\  
  \hline   
\end{tabular}  
\end{table}

【讨论】:

  • 谢谢,罗伯!但这并没有改变。
  • 我忘记使用 p{2cm}。但是现在我有了它,结果并不紧凑,因为我的目的是减小表格的大小。
  • 所以减少 \parskip。在 table 环境中,设置 \parskip=0cm,它会去掉那些垂直空间。
【解决方案2】:

试试

\begin{table}   
\def\baselinestretch {}\selectfont %
% \baselineskip = 14.4pt\relax %% Uncomment this if the result is not compact.
\begin{tabular}{ | c | p{2cm} | }   
  \hline   
  $\vcenter{\hbox{\includegraphics[scale=0.45]{../0_1.eps}}$ & 
    $\vcenter{\strut 1.10\par 2.20\par 3.30\par 4.40\strut}$ \\   
  \hline    
\end{tabular}   
\end{table} 

【讨论】:

    【解决方案3】:

    您可以在最后一个单元格中使用数学模式:${1.10 \atop 2.20 } \atop {3.30 \atop 4.40}$

    那会很漂亮而且很小...

    如果您想要更大,请参阅。 Typesetting fraction terms to be larger in an equation.

    【讨论】:

      【解决方案4】:

      我会考虑使用 multirow 包。跨越多个列/行的详细信息是here

      【讨论】:

        【解决方案5】:

        \换行符?有时在表格中对我有用,有时对我无效。

        【讨论】:

        • 我只是使用表格设置了一个表格和一个带有 book 类和 miktex 的表格环境,\linebreak 为我工作。 :P 它还在 debian 上与 texlive 交叉编译。
        【解决方案6】:

        Minipage 可以做到这一点。

        \begin{minipage}{3in}
        % escape the weirdness of tabular with your own mini page
        1.10 \\ 2.20 \\ 3.30 \\ 4.40
        \end{minipage}
        

        您可能还希望在第一行和最后一行使用\strut,以防止它与任何表格边框相邻。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2012-11-10
          • 1970-01-01
          • 2013-02-27
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-12-03
          • 1970-01-01
          相关资源
          最近更新 更多