如何使用多行、多列减少行高

如何使用多行、多列减少行高

以下代码生成的表格的行高大于所需行高。我已经定义了新列(用于为列着色)。有什么想法可以缩小行高吗?

\documentclass{article}


\usepackage{booktabs, multicol, multirow}
\usepackage[table]{xcolor}

\usepackage{graphicx}

\usepackage{bigstrut}
\usepackage{caption}


\newcommand{\mc}[2]{\multicolumn{#1}{c}{#2}}
\definecolor{Gray}{gray}{0.85}
\definecolor{LightCyan}{rgb}{0.88,1,1}

\newcolumntype{a}{>{\columncolor{Gray}}c}
\newcolumntype{b}{>{\columncolor{white}}c}

\begin{document}





% Table generated by Excel2LaTeX from sheet 'Sheet2'
\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \hspace*{-2.5cm}\begin{tabular}{|r|b|a|b|a|b|a|b|a|}
    \hline
          & \multicolumn{8}{c|}{\textbf{Low Measurement Error Area Euclidean Distance Asymmetry Rankings }} \bigstrut\\
\cline{2-9}          & \multicolumn{1}{c}{\textbf{Unscaled }} & \multicolumn{1}{c}{\textbf{Unscaled }} & \multicolumn{1}{c}{\textbf{Scaled}} & \multicolumn{1}{c}{\textbf{Scaled }} & \multicolumn{1}{c}{\textbf{Unscaled }} & \multicolumn{1}{c}{\textbf{Unscaled }} & \multicolumn{1}{c}{\textbf{Scaled }} & \textbf{Scaled } \bigstrut[t]\\
          & \multicolumn{1}{c}{\textit{\textbf{DA(cent)}}} & \multicolumn{1}{c}{\textit{\textbf{Mean DA}}} & \multicolumn{1}{c}{\textit{\textbf{ DA(cent)}}} & \multicolumn{1}{c}{\textit{\textbf{Mean DA}}} & \multicolumn{1}{c}{\textit{\textbf{FA(cent)}}} & \multicolumn{1}{c}{\textit{\textbf{Mean FA}}} & \multicolumn{1}{c}{\textit{\textbf{FA(cent)}}} & \textit{\textbf{Mean FA}} \bigstrut[b]\\
\cline{2-9}     \multicolumn{1}{|c|}{\parbox[t]{4mm}{\multirow{16}[48]{*}{\rotatebox[origin=c]{90}{\textbf{Fly Number}}}}} & 9     & 9     & 9     & 7     & 9     & 7     & 9     & 7 \bigstrut[t]\\
    \multicolumn{1}{|c|}{} & 23    & 19    & 23    & 9     & 23    & 22    & 23    & 22 \\
    \multicolumn{1}{|c|}{} & 19    & 7     & 19    & 19    & 19    & 9     & 19    & 14 \\
    \multicolumn{1}{|c|}{} & 2     & 23    & 2     & 2     & 2     & 19    & 2     & 9 \\
    \multicolumn{1}{|c|}{} & 7     & 2     & 7     & 16    & 7     & 14    & 7     & 13 \\
    \multicolumn{1}{|c|}{} & 12    & 16    & 12    & 15    & 13    & 23    & 13    & 19 \\
    \multicolumn{1}{|c|}{} & 16    & 15    & 16    & 23    & 12    & 12    & 12    & 12 \\
    \multicolumn{1}{|c|}{} & 15    & 1     & 15    & 1     & 16    & 13    & 16    & 10 \\
    \multicolumn{1}{|c|}{} & 8     & 8     & 8     & 3     & 15    & 20    & 15    & 24 \\
    \multicolumn{1}{|c|}{} & 24    & 4     & 24    & 13    & 11    & 10    & 11    & 23 \\
    \multicolumn{1}{|c|}{} & 1     & 12    & 1     & 21    & 8     & 24    & 8     & 5 \\
    \multicolumn{1}{|c|}{} & 18    & 6     & 18    & 6     & 20    & 21    & 20    & 18 \\
    \multicolumn{1}{|c|}{} & 6     & 24    & 6     & 4     & 17    & 2     & 17    & 20 \\
    \multicolumn{1}{|c|}{} & 4     & 3     & 4     & 8     & 21    & 5     & 21    & 3 \\
    \multicolumn{1}{|c|}{} & 22    & 18    & 22    & 10    & 24    & 18    & 24    & 21 \\
    \multicolumn{1}{|c|}{} & 10    & 13    & 10    & 12    & 3     & 16    & 5     & 16 \\
    \multicolumn{1}{|c|}{} & 14    & 21    & 14    & 24    & 5     & 1     & 3     & 2 \\
    \multicolumn{1}{|c|}{} & 5     & 10    & 3     & 18    & 1     & 3     & 1     & 1 \\
    \multicolumn{1}{|c|}{} & 3     & 17    & 5     & 17    & 14    & 11    & 14    & 11 \\
    \multicolumn{1}{|c|}{} & 21    & 14    & 21    & 20    & 10    & 6     & 10    & 17 \\
    \multicolumn{1}{|c|}{} & 17    & 22    & 17    & 14    & 22    & 8     & 22    & 8 \\
    \multicolumn{1}{|c|}{} & 20    & 20    & 20    & 11    & 18    & 17    & 18    & 6 \\
    \multicolumn{1}{|c|}{} & 11    & 11    & 11    & 22    & 6     & 15    & 6     & 15 \\
    \multicolumn{1}{|c|}{} & 13    & 5     & 13    & 5     & 4     & 4     & 4     & 4 \bigstrut[b]\\
    \hline
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}

\end{document}

答案1

我不确定我是否会推荐它,但我认为你要求的是

\begin{table}[htbp]
\renewcommand\arraystretch{.8}

这使得桌子占用的垂直空间更少。

不相关,但对于数字列来说,使用r而不是c使数字排列更正常,或者使用来自dcolumnsiunitx包的数字对齐列之一。

相关内容