table 中的文本和边框线之间没有 space 且边框未对齐

No space between the text and the border line in a table and misalignment in the border

我在 LaTeX 中创建了以下 table:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{graphicx}

\begin{document}

\begin{table}
  \centering
  \begin{tabular}{c||cccc||cccc||} 
    & \multicolumn{4}{c}{Group1} & \multicolumn{4}{c}{Group2} \ \cline{2-9}
    & \rotatebox{90}{Column First} & \rotatebox{90}{Column Second} & \rotatebox{90}{Column Third} & \rotatebox{90}{Column Fourth} & \rotatebox{90}{Column Fifth} & \rotatebox{90}{Column Sixth} & \rotatebox{90}{Column Seventh} & \rotatebox{90}{Column Eighth} \ \hline \hline
    Row 1 & 1 & 2 & 3 & 4 & 5\% & 6\% & 7\% & 8\% \
    Row 2 & 9 & 10 & 11 & 12 & 13\% & 14\% & 15\% & 16\% \ 
  \end{tabular}
\end{table}

\end{document}

但是,如蓝色箭头所示,文字和边框线之间没有space,上边框几乎贴在“七”字上。有什么方法可以在那里创建一些 space 吗?

关于 table 边框还有一个问题。我不明白为什么左右边框(用红色箭头表示)不在同一高度,而右边的较短。有没有办法解决这个问题并使它们的高度相等?

  • 除了“第 2 组”之外没有双线,因为您使用 c 作为多列的参数,表示“绘制没有线条的单元格”。如果要绘制线条,请使用 c||

  • 要在“第七栏”上方获得更多space,您可以手动添加\space或类似的


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{graphicx}

\begin{document}

\begin{table}
  \centering
  \begin{tabular}{c||cccc||cccc||} 
    & \multicolumn{4}{c}{Group1} & \multicolumn{4}{c||}{Group2} \ \cline{2-9}
    & \rotatebox{90}{Column First} & \rotatebox{90}{Column Second} & \rotatebox{90}{Column Third} & \rotatebox{90}{Column Fourth} & \rotatebox{90}{Column Fifth} & \rotatebox{90}{Column Sixth} & \rotatebox{90}{Column Seventh\space} & \rotatebox{90}{Column Eighth} \ \hline \hline
    Row 1 & 1 & 2 & 3 & 4 & 5\% & 6\% & 7\% & 8\% \
    Row 2 & 9 & 10 & 11 & 12 & 13\% & 14\% & 15\% & 16\% \ 
  \end{tabular}
\end{table}

\end{document}