彩色表格中列之间的额外间隙

彩色表格中列之间的额外间隙

再次使用表格。我想为表格中的几行着色并使用 colortbl 包。一切正常。现在我想在第一列和第二列之间添加额外的间隙,以使表格更清晰。我以@{\hspace{20pt}}在表格前言中添加的方式进行操作。工作正常,添加了我想要的内容。但是!它还会在表格的彩色条纹中添加间隙。

如何添加间隙但仍然保持颜色行完整?

(实际颜色已被改变以使其更加直观)

梅威瑟:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{euler, beton}
\usepackage{booktabs}
\usepackage{array}
\usepackage{color, colortbl}
\usepackage{multirow}
%============================================================
\definecolor{LightCyan}{rgb}{0.88,1,1}
\begin{document}
\begin{tabular}{@{}r@{\hspace{20pt}}*{3}{l@{\enspace}l}l@{\enspace}l@{\enspace}lp{1cm}>{\centering\arraybackslash}p{1cm}}
\toprule
\multirow{3}{*}{\#}&\multicolumn{6}{c}{\small Results}&\multicolumn{3}{c}{Scores}& \multirow{3}{*}{\parbox{1.2cm}{All Diff\textsuperscript{nt}?}}&\multirow{3}{*}{\parbox{1.5cm}{Draws}}\\
\cmidrule(r){2-7}
\cmidrule(lr){8-10}
&\multicolumn{2}{c}{1}&\multicolumn{2}{c}{2}&\multicolumn{2}{c}{3}&\multirow{2}{*}{A}&\multirow{2}{*}{B}&\multirow{2}{*}{C}\\ 
\cmidrule(r){2-3}
\cmidrule(lr){4-5}
\cmidrule(lr){6-7}
&A&B&B&C&C&A\\
\midrule
1  &    0  &    2  &    0 & 2 & 0 & 2 & 2 & 2 & 2 & No &    - \\
2  &    0  &    2  &    0 & 2 & 1 & 1 & 1 & 2 & 3 & Yes &   1 \\
3  &    0  &    2  &    1 & 1 & 0 & 2 & 2 & 3 & 1 & Yes &   1 \\
4  &    1  &    1  &    0 & 2 & 0 & 2 & 3 & 1 & 2 & Yes &   1 \\
5  &    0  &    2  &    0 & 2 & 2 & 0 & 0 & 2 & 4 & Yes &   0 \\
6  &    0  &    2  &    2 & 0 & 0 & 2 & 2 & 4 & 0 & Yes &   0 \\
7  &    2  &    0  &    0 & 2 & 0 & 2 & 4 & 0 & 2 & Yes &   0 \\\rowcolor{LightCyan}
8  &    0  &    2  &    1 & 1 & 1 & 1 & 1 & 3 & 2 & Yes &   2 \\\rowcolor{LightCyan}
9  &    1  &    1  &    0 & 2 & 1 & 1 & 2 & 1 & 3 & Yes &   2 \\\rowcolor{LightCyan}
10 &    1  &    1  &    1 & 1 & 0 & 2 & 3 & 2 & 1 & Yes &   2 \\
11 &    0  &    2  &    2 & 0 & 2 & 0 & 0 & 4 & 2 & Yes &   0 \\
12 &    2  &    0  &    2 & 0 & 0 & 2 & 4 & 2 & 0 & Yes &   0 \\
13 &    2  &    0  &    0 & 2 & 2 & 0 & 2 & 0 & 4 & Yes &   0 \\
14 &    1  &    1  &    1 & 1 & 1 & 1 & 2 & 2 & 2 & No &- \\
15 &    2  &    0  &    2 & 0 & 2 & 0 & 2 & 2 & 2 & No &- \\\rowcolor{LightCyan}
16 &    2  &    0  &    1 & 1 & 1 & 1 & 3 & 1 & 2 & Yes &   2 \\\rowcolor{LightCyan}
17 &    1  &    1  &    2 & 0 & 1 & 1 & 2 & 3 & 1 & Yes &   2 \\\rowcolor{LightCyan}
18 &    1  &    1  &    1 & 1 & 2 & 0 & 1 & 2 & 3 & Yes &   2 \\
19 &    1  &    1  &    2 & 0 & 2 & 0 & 1 & 3 & 2 & Yes &   1 \\
20 &    2  &    0  &    1 & 1 & 2 & 0 & 2 & 1 & 3 & Yes &   1 \\
21 &    2  &    0  &    2 & 0 & 1 & 1 & 3 & 2 & 1 & Yes &   1 \\
22 &    0  &    2  &    1 & 1 & 2 & 0 & 0 & 3 & 3 & No &1 \\
23 &    0  &    2  &    2 & 0 & 1 & 1 & 1 & 4 & 1 & No &1 \\
24 &    1  &    1  &    0 & 2 & 2 & 0 & 1 & 1 & 4 & No &1 \\
25 &    1  &    1  &    2 & 0 & 0 & 2 & 3 & 3 & 0 & No &1 \\
26 &    2  &    0  &    0 & 2 & 1 & 1 & 3 & 0 & 3 & No &1 \\
27 &    2  &    0  &    1 & 1 & 0 & 2 & 4 & 1 & 1 & No &1 \\
\bottomrule
\end{tabular}

\end{document}

在此处输入图片描述

答案1

您可以简单地在第一列和第二列之间添加一个空列 – 不要忘记移动 \cmidrules:

\documentclass{article}
\usepackage[utf8]{inputenc}
%\usepackage{euler, beton}
\usepackage{booktabs}
\usepackage{array}
\usepackage{color, colortbl}
\usepackage{multirow}
%============================================================
\definecolor{LightCyan}{rgb}{0.88,1,1}
\begin{document}
%\begin{tabular}{@{}r@{\hspace{20pt}}*{3}{l@{\enspace}l}l@{\enspace}l@{\enspace}lp{1cm}>{\centering\arraybackslash}p{1cm}}
\begin{tabular}{@{}rc*{3}{l@{\enspace}l}l@{\enspace}l@{\enspace}lp{1cm}>{\centering\arraybackslash}p{1cm}}
\toprule
\multirow{3}{*}{\#}& & \multicolumn{6}{c}{\small Results}&\multicolumn{3}{c}{Scores}& \multirow{3}{*}{\parbox{1.2cm}{All Diff\textsuperscript{nt}?}}&\multirow{3}{*}{\parbox{1.5cm}{Draws}}\\
\cmidrule(r){3-8}
\cmidrule(lr){9-11}
 & &\multicolumn{2}{c}{1}&\multicolumn{2}{c}{2}&\multicolumn{2}{c}{3}&\multirow{2}{*}{A}&\multirow{2}{*}{B}&\multirow{2}{*}{C}\\
\cmidrule(r){3-4}
\cmidrule(lr){5-6}
\cmidrule(lr){7-8}
& & A&B&B&C&C&A\\
\midrule
1 & & 0 & 2 & 0 & 2 & 0 & 2 & 2 & 2 & 2 & No & - \\
2 & & 0 & 2 & 0 & 2 & 1 & 1 & 1 & 2 & 3 & Yes & 1 \\
3 & & 0 & 2 & 1 & 1 & 0 & 2 & 2 & 3 & 1 & Yes & 1 \\
4 & & 1 & 1 & 0 & 2 & 0 & 2 & 3 & 1 & 2 & Yes & 1 \\
5 & & 0 & 2 & 0 & 2 & 2 & 0 & 0 & 2 & 4 & Yes & 0 \\
6 & & 0 & 2 & 2 & 0 & 0 & 2 & 2 & 4 & 0 & Yes & 0 \\
7 & & 2 & 0 & 0 & 2 & 0 & 2 & 4 & 0 & 2 & Yes & 0 \\\rowcolor{LightCyan}
8 & & 0 & 2 & 1 & 1 & 1 & 1 & 1 & 3 & 2 & Yes & 2 \\\rowcolor{LightCyan}
9 & & 1 & 1 & 0 & 2 & 1 & 1 & 2 & 1 & 3 & Yes & 2 \\\rowcolor{LightCyan}
10 & & 1 & 1 & 1 & 1 & 0 & 2 & 3 & 2 & 1 & Yes & 2 \\
11 & & 0 & 2 & 2 & 0 & 2 & 0 & 0 & 4 & 2 & Yes & 0 \\
12 & & 2 & 0 & 2 & 0 & 0 & 2 & 4 & 2 & 0 & Yes & 0 \\
13 & & 2 & 0 & 0 & 2 & 2 & 0 & 2 & 0 & 4 & Yes & 0 \\
14 & & 1 & 1 & 1 & 1 & 1 & 1 & 2 & 2 & 2 & No &- \\
15 & & 2 & 0 & 2 & 0 & 2 & 0 & 2 & 2 & 2 & No &- \\\rowcolor{LightCyan}
16 & & 2 & 0 & 1 & 1 & 1 & 1 & 3 & 1 & 2 & Yes & 2 \\\rowcolor{LightCyan}
17 & & 1 & 1 & 2 & 0 & 1 & 1 & 2 & 3 & 1 & Yes & 2 \\\rowcolor{LightCyan}
18 & & 1 & 1 & 1 & 1 & 2 & 0 & 1 & 2 & 3 & Yes & 2 \\
19 & & 1 & 1 & 2 & 0 & 2 & 0 & 1 & 3 & 2 & Yes & 1 \\
20 & & 2 & 0 & 1 & 1 & 2 & 0 & 2 & 1 & 3 & Yes & 1 \\
21 & & 2 & 0 & 2 & 0 & 1 & 1 & 3 & 2 & 1 & Yes & 1 \\
22 & & 0 & 2 & 1 & 1 & 2 & 0 & 0 & 3 & 3 & No &1 \\
23 & & 0 & 2 & 2 & 0 & 1 & 1 & 1 & 4 & 1 & No &1 \\
24 & & 1 & 1 & 0 & 2 & 2 & 0 & 1 & 1 & 4 & No &1 \\
25 & & 1 & 1 & 2 & 0 & 0 & 2 & 3 & 3 & 0 & No &1 \\
26 & & 2 & 0 & 0 & 2 & 1 & 1 & 3 & 0 & 3 & No &1 \\
27 & & 2 & 0 & 1 & 1 & 0 & 2 & 4 & 1 & 1 & No &1 \\
\bottomrule
\end{tabular}

\end{document} 

在此处输入图片描述

答案2

您还可以使用 <{...} 而不是 @{...} 添加空格。

我相信存在足够大的自动重叠,\enspace但不是 20pt。

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{euler, beton}
\usepackage{booktabs}
\usepackage{array}
\usepackage{color, colortbl}
\usepackage{multirow}
%============================================================
\definecolor{LightCyan}{rgb}{0.88,1,1}
\begin{document}
\begin{tabular}{@{}r<{\hspace{20pt}}@{}*3{l<{\enspace}@{}l}l<{\enspace}@{}l<{\enspace}@{}lp{1cm}>{\centering\arraybackslash}p{1cm}}
\toprule
\multirow{3}{*}{\#}&\multicolumn{6}{c}{\small Results}&\multicolumn{3}{c}{Scores}& \multirow{3}{*}{\parbox{1.2cm}{All Diff\textsuperscript{nt}?}}&\multirow{3}{*}{\parbox{1.5cm}{Draws}}\\
\cmidrule(r){2-7}
\cmidrule(lr){8-10}
&\multicolumn{2}{c}{1}&\multicolumn{2}{c}{2}&\multicolumn{2}{c}{3}&\multirow{2}{*}{A}&\multirow{2}{*}{B}&\multirow{2}{*}{C}\\ 
\cmidrule(r){2-3}
\cmidrule(lr){4-5}
\cmidrule(lr){6-7}
&A&B&B&C&C&A\\
\midrule
1  &    0  &    2  &    0 & 2 & 0 & 2 & 2 & 2 & 2 & No &    - \\
2  &    0  &    2  &    0 & 2 & 1 & 1 & 1 & 2 & 3 & Yes &   1 \\
3  &    0  &    2  &    1 & 1 & 0 & 2 & 2 & 3 & 1 & Yes &   1 \\
4  &    1  &    1  &    0 & 2 & 0 & 2 & 3 & 1 & 2 & Yes &   1 \\
5  &    0  &    2  &    0 & 2 & 2 & 0 & 0 & 2 & 4 & Yes &   0 \\
6  &    0  &    2  &    2 & 0 & 0 & 2 & 2 & 4 & 0 & Yes &   0 \\
7  &    2  &    0  &    0 & 2 & 0 & 2 & 4 & 0 & 2 & Yes &   0 \\\rowcolor{LightCyan}
8  &    0  &    2  &    1 & 1 & 1 & 1 & 1 & 3 & 2 & Yes &   2 \\\rowcolor{LightCyan}
9  &    1  &    1  &    0 & 2 & 1 & 1 & 2 & 1 & 3 & Yes &   2 \\\rowcolor{LightCyan}
10 &    1  &    1  &    1 & 1 & 0 & 2 & 3 & 2 & 1 & Yes &   2 \\
11 &    0  &    2  &    2 & 0 & 2 & 0 & 0 & 4 & 2 & Yes &   0 \\
12 &    2  &    0  &    2 & 0 & 0 & 2 & 4 & 2 & 0 & Yes &   0 \\
13 &    2  &    0  &    0 & 2 & 2 & 0 & 2 & 0 & 4 & Yes &   0 \\
14 &    1  &    1  &    1 & 1 & 1 & 1 & 2 & 2 & 2 & No &- \\
15 &    2  &    0  &    2 & 0 & 2 & 0 & 2 & 2 & 2 & No &- \\\rowcolor{LightCyan}
16 &    2  &    0  &    1 & 1 & 1 & 1 & 3 & 1 & 2 & Yes &   2 \\\rowcolor{LightCyan}
17 &    1  &    1  &    2 & 0 & 1 & 1 & 2 & 3 & 1 & Yes &   2 \\\rowcolor{LightCyan}
18 &    1  &    1  &    1 & 1 & 2 & 0 & 1 & 2 & 3 & Yes &   2 \\
19 &    1  &    1  &    2 & 0 & 2 & 0 & 1 & 3 & 2 & Yes &   1 \\
20 &    2  &    0  &    1 & 1 & 2 & 0 & 2 & 1 & 3 & Yes &   1 \\
21 &    2  &    0  &    2 & 0 & 1 & 1 & 3 & 2 & 1 & Yes &   1 \\
22 &    0  &    2  &    1 & 1 & 2 & 0 & 0 & 3 & 3 & No &1 \\
23 &    0  &    2  &    2 & 0 & 1 & 1 & 1 & 4 & 1 & No &1 \\
24 &    1  &    1  &    0 & 2 & 2 & 0 & 1 & 1 & 4 & No &1 \\
25 &    1  &    1  &    2 & 0 & 0 & 2 & 3 & 3 & 0 & No &1 \\
26 &    2  &    0  &    0 & 2 & 1 & 1 & 3 & 0 & 3 & No &1 \\
27 &    2  &    0  &    1 & 1 & 0 & 2 & 4 & 1 & 1 & No &1 \\
\bottomrule
\end{tabular}

\end{document}

相关内容