我有一张表,其编码如下:
\begin{tabular}{p{1in} p{3in}}
\makecell[l]{Text in a \\ cell} & \makecell[c]{Text in \\ another cell} \\
\makecell[l]{Another row} & \makecell[c]{Another row}
\end{tabular}
我希望它看起来像这样:
Text i|n aText in |
cell |another cell|
------+-------------
Anothe|rA###her row| (# indicates overlapping characters)
我尝试使用rlap
。这会产生不必要的空间。代码:
\begin{tabular}{p{1in} p{3in}}
\makecell[l]{\rlap{Text in a \\ cell}} & \makecell[c]{\rlap{Text in \\ another cell}} \\
\makecell[l]{\rlap{Another row}} & \makecell[c]{\rlap{Another row}}
\end{tabular}
不良结果:
Text i|n aText in |
cell |another cell|
| |
| |
------+-------------
Anothe|rA###her row|
tabular
使用 LaTeX、环境和这可能吗makecell
?
答案1
有点难以理解你在做什么(甚至更难理解为什么...)但仅仅使用它\mbox
来防止换行就能奏效吗?
\documentclass{article}
\usepackage{array}
\begin{document}
\begin{tabular}{>{\raggedright\arraybackslash}p{0.20in}>{\centering\arraybackslash}p{1in}}
\mbox{Text in a}\linebreak cell & Text in\linebreak another cell \\
\mbox{Another row} & Another row\\
\end{tabular}
\end{document}
我不确定这是否是您想要的,因为显然我必须使列比代码中的列窄得多才能实现这样的结果。