表格中的文本被“拉伸”

表格中的文本被“拉伸”

我有一个小问题,但我不知道如何解决它。下面的两个表格显示了我的论文中出现的表格:

在此处输入图片描述

如您所见,“Each”和“successive”之间的空格太多了。但是,当我尝试使用 MWE 复制该问题时,问题确实不是出现:

在此处输入图片描述

是什么原因导致单词被拉伸?我在主论文文档中加载了其他包,但我认为它们与这个问题无关。

我的 MWE 如下:

\documentclass{article}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\Centering\arraybackslash}p{#1}}
\begin{document}
\begin{table}[htbp]
\centering
\renewcommand\arraystretch{1.2}
\begin{threeparttable}
\caption{Course Load of a Representative EBE student}
\label{table:eng}
\begin{tabular}{@{}p{0.20\textwidth}*{3}{L{\dimexpr0.25\textwidth-2\tabcolsep\relax}}@{}}
\toprule
& \multicolumn{3}{c}{\bfseries Cumulative Number of Prescribed Credits}
\\
\cmidrule(l){2-4}
& BSc (Eng)& ASPECT & BSc (Geomatics) \\
\midrule
First-year & \multicolumn{1}{c}{144 -- 148} & \multicolumn{1}{c}{104 -- 116} &       \multicolumn{1}{c}{142 -- 144} \\
Each successive \hbox{two-year} period\tnote{1} & \multicolumn{1}{c}{264 -- 294} &    \multicolumn{1}{c}{232 -- 248} & \multicolumn{1}{c}{296 -- 330} \\
\bottomrule
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}

答案1

前三列设置为对齐,没有连字符。如果您\small在 MWE 中将字体大小更改为,您会发现同样的拉伸。因此,文档中表格的磅值可能比 MWE 中的要小。

L使用您定义的新列类型将第一列(或前三列)更改为右侧不规则,IE

\begin{tabular}{@{}L{0.20\textwidth}*{3}{L{\dimexpr0.25\textwidth-2\tabcolsep\relax}}@{}}

代替

\begin{tabular}{@{}p{0.20\textwidth}*{3}{L{\dimexpr0.25\textwidth-2\tabcolsep\relax}}@{}}

我认为,对于这种类型的表格,右对齐更好。只有当您有一列包含大量文本时,您才可以考虑将其设置为对齐,但这样您通常必须强制手动连字符。当然,LaRiFaRi 的建议microtype很好,但无法解决这个特定问题。

在居中列的定义中,您使用了\Centering大写字母C,将其更改为\centering。如果将最后一列更改为列C,则最后三列中的列名将很好地对齐。完成 MWE:

\documentclass{article}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} % < - changed
\begin{document}
\begin{table}[htbp]
\centering
\renewcommand\arraystretch{1.2}
\begin{threeparttable}
\small                     % < - to demonstrate stratching if justified first column
\caption{Course Load of a Representative EBE student}
\label{table:eng}
\begin{tabular}{@{}L{0.20\textwidth}*{3}{C{\dimexpr0.25\textwidth-2\tabcolsep\relax}}@{}}
% Change the column type to L and C
\toprule
& \multicolumn{3}{c}{\bfseries Cumulative Number of Prescribed Credits}
\\
\cmidrule(l){2-4}
& BSc (Eng)& ASPECT & BSc (Geomatics) \\
\midrule
First-year & \multicolumn{1}{c}{144 -- 148} & \multicolumn{1}{c}{104 -- 116} &       \multicolumn{1}{c}{142 -- 144} \\
Each successive \hbox{two-year} period\tnote{1} & \multicolumn{1}{c}{264 -- 294} &    \multicolumn{1}{c}{232 -- 248} & \multicolumn{1}{c}{296 -- 330} \\
\bottomrule
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}

MWE 示例

相关内容