【问题标题】:An alternative to write multirow in latex's tabular?在乳胶表格中编写多行的替代方法?
【发布时间】:2021-02-12 07:38:55
【问题描述】:
在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}
我觉得自己控制换行太傻了。
任何其他适合文本宽度到线宽的替代方案?
【问题讨论】:
标签:
latex
tabular
multirow
【解决方案1】:
\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}