开发者

Multiple lines in a cell of a table

开发者 https://www.devze.com 2022-12-27 13:25 出处:网络
I have a table as shown in this figure: The LaTeX code for the table is: \\begin{table} \\begin{tabular}{ | c | c | }

I have a table as shown in this figure:

Multiple lines in a cell of a table

The LaTeX code for the table is:

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

I would like to make the four numbers appear in different lines inside the second cell, in order to reduce its width. I wonder how to do it?


EDIT:

I tried \linebreak,

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

But the result is the same as before i.e. without \linebreak.


EDIT:

I just tried what Rob suggested. But the result is not compact, because my intention is to reduce the size of the table. See the figure below:

Multiple lines in a cell of a table


Try using a p column with \par to indicate line breaks.

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


Try

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


You can use mathmode in the last cell: ${1.10 \atop 2.20 } \atop {3.30 \atop 4.40}$.

That will be nice and small...

If you want it bigger, cf. Typesetting fraction terms to be larger in an equation.


I would look into using the multirow package. Details on spanning multiple columns/rows are here.


\linebreak ? sometimes works for me in tables and sometimes doesn't.


Minipage might accomplish this.

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

You may also want a \strut on the first and last lines, to prevent it abutting any tabular borders.

0

精彩评论

暂无评论...
验证码 换一张
取 消