乳胶中的多列导致列间距错误 [英] Wrong column spacing due to multicolumn in latex

查看:86
本文介绍了乳胶中的多列导致列间距错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下面的LaTeX表中,由于最后一行中的\ multicolumn单元格较长,因此第三列的间距太大.谁能想到让LaTeX在各列之间均匀分配所需的额外间距的方法吗?

in the LaTeX table below, the third column gets too way much spacing due to the long \multicolumn cell in the last line. Can anyone think of a way of getting LaTeX to distribute the additional spacing needed evenly across columns?

\documentclass[11pt]{article}
\usepackage{booktabs}

\begin{document}
\begin{table}[htbp]
\centering
\begin{tabular}{lrrr}
\toprule
 & ICE-GB & ICE-SING & ICE-EA \\ 
 \midrule
NP & 619 & 595 & 496 \\ 
\textbf{Arithmetic mean}& \textbf{1.36} & \textbf{1.33} & \textbf{1.22} \\ 
SD&0.73 & 0.71 & 0.53 \\ 
Variation coefficient& 0.54 & 0.52 & 0.44 \\ 
\midrule
Kruskal Wallis rank sum test&\multicolumn{3}{l}{$H = 16.3941, df = 2, p= 0.0002755123$} \\ 
\bottomrule
\end{tabular}
\end{table}
\end{document}

谢谢!

推荐答案

多余的宽度\multicolumn最终将多余的分配给最后一列.您可以通过使用固定宽度的\multicolumn-即使用p{<len>}列来避免这种情况,或者对于列的均匀分布,对于非\multicolumn列也可以使用固定宽度的列:

Excess width \multicolumns end up assigning the excess to the last column. You can avoid this by either using a fixed-width \multicolumn - that is, use a p{<len>} column, or for even spreading of columns use a fixed-width column for the non-\multicolumn columns:

\documentclass[11pt]{article}
\usepackage{booktabs,array}

\begin{document}
\noindent
\begin{tabular}{l*{3}{>{\raggedleft\arraybackslash}p{5em}}}
  \toprule
  & ICE-GB & ICE-SING & ICE-EA \\ 
  \midrule
  NP & 619 & 595 & 496 \\
  \textbf{Arithmetic mean}     & \textbf{1.36} & \textbf{1.33} & \textbf{1.22} \\ 
  SD                           & 0.73          & 0.71          & 0.53 \\ 
  Variation coefficient        & 0.54          & 0.52          & 0.44 \\ 
  \midrule
  Kruskal Wallis rank sum test & \multicolumn{3}{r}{$H = 16.3941, df = 2, p= 0.0002755123$} \\ 
  \bottomrule
\end{tabular}
\end{document}

在上面的示例中,最后三列的宽度分别为5em\raggedleft(类似于r列规范).

In the above example, the last three columns each have width 5em, and are \raggedleft (similar to an r-column specification).

这篇关于乳胶中的多列导致列间距错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆