单行表格*条目的缩进与两行条目不同

单行表格*条目的缩进与两行条目不同

例子:

    \begin{tabular*}{1\textwidth}{p{2.3cm} p{14.4cm}}
& I This line is short and doesn't have the indent \\[3pt]
& I This line is too long and has the unfortunate indent. Lorem ipsum dolor sit amet, consectetur adipiscing elit... \\[3pt]
& I This line is short and doesn't have the indent \\[3pt]
& I This line is too long and has the unfortunate indent. Lorem ipsum dolor sit amet, consectetur adipiscing elit... \\[6pt]
    \end{tabular*}

结果:

在此处输入图片描述

如您所见,第一行和第三行的 T 位于第二行和第四行的 T 的左侧。如何使这些 T 对齐?

答案1

短行和“长”行之间的单词间空白量不同的原因是,p列类型对段落内容执行了完全对齐;根据可用的换行点,这可能导致 TeX 稍微缩小或扩大单词间的空白。

如果您不想这样,您需要关闭完全对齐,例如通过替换p{...}>{\raggedright\arraybackslash}p{...}

在此处输入图片描述

\documentclass{article} % or some other suitable document class
\usepackage{array}      % for '\newcolumntype' macro
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}
\usepackage{booktabs}   % for '\addlinespace' macro
\usepackage{showframe}  % add frame lines around text block

\begin{document}
\noindent
\begin{tabular*}{1\textwidth}{@{\extracolsep{\fill}} P{3.5cm} P{7.5cm} @{}}
& I This line is short and doesn't have the indent \\ \addlinespace
& I This line is too long and has the unfortunate indent. Lorem ipsum dolor sit amet, consectetur adipiscing elit... \\ \addlinespace
& I This line is short and doesn't have the indent \\ \addlinespace
& I This line is too long and has the unfortunate indent. Lorem ipsum dolor sit amet, consectetur adipiscing elit... 
\end{tabular*}
\end{document}

相关内容