1
\documentclass{article}
\usepackage{multirow}

\begin{document}

\begin{table}[htbp]
\centering
\begin{tabular}{ccccp{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}}
\hline
 & A & B & C  \\
 & & &  &\\
 \hline
\multirow{2}{*}{This is a really long sentence sentence sentence} & 0 & 6 & 230 \\
& 1 & 5 & 195  \\ \hline
\end{tabular}
\label{table2}
\end{table}


\end{document}

Is there a way to make the cell containing "This is a really long sentence sentence sentence" into 2 lines? enter image description here

1
  • Use a paradox` \multirow{2}{*}{\parbox{4cm}{This is a really long sentence sentence sentence}} & 0 & 6 & 230 \\ `
    – user2478
    Commented Aug 20, 2018 at 5:35

1 Answer 1

2

You can define your own command and give it width and the text \breakText{5cm}{text}, like so :

Output

\documentclass{article}
\usepackage{multirow}

\newcommand{\breakText}[2]{%
  \noindent \parbox{#1}{%
    #2
  }%
}
\begin{document}

  \begin{table}[htbp]
    \centering
    \begin{tabular}{ccccp{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}}
      \hline
      & A & B & C  \\
      & & &  &\\
      \hline
      \multirow{2}{*}{\breakText{5cm}{This is a really long sentence sentence sentence}} & 0 & 6 & 230 \\
      & 1 & 5 & 195  \\ \hline
    \end{tabular}
    \label{table2}
  \end{table}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .