在乳胶表格中编写多行的替代方法?

问题描述

在 Latex 中,我知道我们可以使用如下所示的 multirow 命令,

\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

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

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

解决方法

\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

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...