
どうやら私が使うと>{\columncolor{green!30}}c
そしてその列にコンテンツがある場合\multirow
、その色は前景に表示されます。
これら 2 つの表の唯一の違いは、2 番目の表が>{\columncolor{green!30}}
最初の列に適用されているのに対し、最初の表は適用されていないことです。
コード:
\documentclass{article}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{colortbl}
\usepackage{multirow}
\newcommand*{\MyTabelContent}{%
\toprule
&$+$ & 0 & 1 & 2 & 3 & 4 & 5
\\
\multirow{6}{*}{\rotatebox{90}{Label}}
&0 & & & & & &
\\
&1 & & & & & &
\\
&2 & & & & & &
\\
&3 & & & & & &
\\
&4 & & & & & &
\\
&5 & & & & & &
\\
\bottomrule
}
\begin{document}
\noindent
\begin{tabular}{c >{\columncolor{cyan!30}}cccccc c @{}}
\MyTabelContent
\end{tabular}
\quad
\begin{tabular}{>{\columncolor{green!30}}c >{\columncolor{cyan!30}}cccccc c @{}}
\MyTabelContent
\end{tabular}%
\end{document}
答え1
\multirow
一番下の行で を使用し、負の行数を指定することで、必要なものを取得できます。
\documentclass{article}
\usepackage[table]{xcolor} % also loads colortbl
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{multirow}
\newcommand*{\MyTabelContent}{%
\toprule
&$+$ & 0 & 1 & 2 & 3 & 4 & 5
\\
&0 & & & & & &
\\
&1 & & & & & &
\\
&2 & & & & & &
\\
&3 & & & & & &
\\
&4 & & & & & &
\\
\multirow{-6}{*}{\rotatebox{90}{Label}}
&5 & & & & & &
\\
\bottomrule
}
\begin{document}
\noindent
\begin{tabular}{c >{\columncolor{cyan!30}}cccccc c @{}}
\MyTabelContent
\end{tabular}
\quad
\begin{tabular}{>{\columncolor{green!30}}c >{\columncolor{cyan!30}}cccccc c @{}}
\MyTabelContent
\end{tabular}%
\end{document}
答え2
(およびキー){NiceTabular}
を使用すると、期待される結果が直接得られます。nicematrix
colortbl-like
\documentclass{article}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{nicematrix}
\newcommand*{\MyTabelContent}{%
\toprule
&$+$ & 0 & 1 & 2 & 3 & 4 & 5
\\
\multirow{6}{*}{\rotatebox{90}{Label}}
&0 & & & & & &
\\
&1 & & & & & &
\\
&2 & & & & & &
\\
&3 & & & & & &
\\
&4 & & & & & &
\\
&5 & & & & & &
\\
\bottomrule
}
\begin{document}
\noindent
\begin{NiceTabular}{c >{\columncolor{cyan!30}}ccccccc@{}}[colortbl-like]
\MyTabelContent
\end{NiceTabular}
\quad
\begin{NiceTabular}{>{\columncolor{green!30}}c >{\columncolor{cyan!30}}ccccccc@{}}[colortbl-like]
\MyTabelContent
\end{NiceTabular}%
\end{document}
booktabs
色付きのパネルは、 の設計によりのルールまで拡張されますnicematrix
。
複数のコンパイルが必要です (nicematrix
内部で PGF/Tikz ノードが使用されるため)。