Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple lines in a cell of a table

Tags:

latex

I have a table as shown in this figure:

alt text

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:

alt text

like image 811
Tim Avatar asked Apr 21 '10 22:04

Tim


People also ask

Can you have multiple lines in an Excel cell?

You can put multiple lines in a cell with pressing Alt + Enter keys simultaneously while entering texts. Pressing the Alt + Enter keys simultaneously helps you separate texts with different lines in one cell. With this shortcut key, you can split the cell contents into multiple lines at any position as you need.

How do you enter 3 lines in an Excel cell?

Inserting a line break within a cell After you type each line, just press ALT-ENTER on your keyboard to insert a hard return. (If you're using the Mac version of Excel, it's CTRL-OPTION-ENTER or CTRL-COMMAND-ENTER.)

How do I split a cell in Excel into multiple rows?

Split cellsIn the table, click the cell that you want to split. Click the Layout tab. In the Merge group, click Split Cells. In the Split Cells dialog, select the number of columns and rows that you want and then click OK.


2 Answers

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}
like image 116
Rob Hyndman Avatar answered Sep 24 '22 00:09

Rob Hyndman


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} 
like image 38
Alexey Malistov Avatar answered Sep 24 '22 00:09

Alexey Malistov