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

kokosing picture kokosing · Oct 21, 2010 · Viewed 83k times · Source

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}

Answer

Tombart picture Tombart · Mar 27, 2012

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