3

在乳胶中,我知道我们可以使用如下的多行命令,

\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}

在此处输入图像描述

我认为自己控制换行符太愚蠢了。

任何其他适合文本宽度到线宽的替代方案?

4

1 回答 1

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}

在此处输入图像描述

于 2021-02-12T09:53:03.343 回答