3

In latex, I know we can use the multirow command like the following,

\begin{table}[!h]
    \centering
    \begin{tabular}{|c|l|}
        \hline
        \multirow{2}{*}{A}
        & I want to place this sentence in multiple lines, \\
        & but don't want to control the linebreak myself \\
        \hline
    \end{tabular}
\end{table}

enter image description here

I think it is so stupid to control the linebreak myself.

Any other alternative that fits the text width to line width?

user9985127
  • 175
  • 5

1 Answers1

3
\documentclass{article}

\usepackage{tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}

\begin{document}

\begin{table}[htbp]
    \centering
    \begin{tabularx}{\linewidth}{|c|X|}
        \hline
        A
        & I want to place this sentence in multiple lines, but don't want to control the linebreak myself \\
        \hline
    \end{tabularx}
\end{table}

\end{document}

enter image description here