Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Latex: how to break the line in multirow inside the tabular

I cannot find out how to break the line inside the multirow in tabular. I need to make some table where I have one cell which is two row high, and I have long text in it, but it does not break the line and text is overlapping another cell on the left side.

Any suggestions?

Sample of code:

\begin{center}     \begin{tabular}{|p{1cm}|p{2.5cm}|p{2cm}|p{2cm}|p{2cm}|p{2cm}|}     \hline     \multirow{2}{*}{Long text to break} % HERE IS A PROBLEM         & Thing  & \multicolumn{2}{|c|}{Thing 2} & \multicolumn{2}{|c|}{Thing 3}         \\ \cline{2-6}         & sth 1 & sth 1 & sth 2 & sth 1  & sth 2 \\ \hline \hline \end{tabular} \end{center} 
like image 895
kokosing Avatar asked Oct 21 '10 19:10

kokosing


People also ask

How do you break a line in a table in LaTeX?

\newline works to break a line within a cell in tabularx environment.

How do you break a line in a table?

The line break code allows data to be split into multiple lines. Place the line break code <BR> within the text at the point(s) you want the line to break.

How do I force a line break in LaTeX?

The \linebreak command tells LaTeX to break the current line at the point of the command. With the optional argument, number , you can convert the \linebreak command from a demand to a request. The number must be a number from 0 to 4. The higher the number, the more insistent the request is.

How does one break a line within a paragraph in LaTeX?

The \\ and \newline commands break the line at the point of insertion but do not stretch it. The \linebreak command breaks the line at the point of insertion and stretches the line to make it of the normal width.


1 Answers

p column and \parbox also works:

\usepackage{multirow}  \begin{document} \begin{center} \begin{tabular}{|p{1.5cm}|l|l|l|l|l|}     \hline     \multirow{2}{*}{\parbox{1.5cm}{Long text to break}}     & Thing  & \multicolumn{2}{|c|}{Thing 2} & \multicolumn{2}{|c|}{Thing 3} \\     \cline{2-6}     & sth 1 & sth 1 & sth 2 & sth 1  & sth 2 \\      \hline     \hline \end{tabular} \end{center} \end{document} 

parbox in latex document

like image 78
Tombart Avatar answered Sep 24 '22 14:09

Tombart