![使用 colortbl 时,列仍然是白色的。我做错了什么?](https://linux22.com/image/291702/%E4%BD%BF%E7%94%A8%20colortbl%20%E6%97%B6%EF%BC%8C%E5%88%97%E4%BB%8D%E7%84%B6%E6%98%AF%E7%99%BD%E8%89%B2%E7%9A%84%E3%80%82%E6%88%91%E5%81%9A%E9%94%99%E4%BA%86%E4%BB%80%E4%B9%88%EF%BC%9F.png)
可能很明显,我试图将最后一列涂成绿色,但对我来说,它仍然显示为白色。
另外,如果我理解正确的话,“>”只是用于tabularx
划分格式信息?
\documentclass[compress,red,notes]{beamer}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{colortbl}
\definecolor{Green}{rgb}{0,1,0}
\begin{document}
\frame{\frametitle{Performance}
\begin{figure}
\centering
\resizebox{\textwidth}{!}{%
\begin{tabular}{lrrrrrrrr>{\columncolor[rgb]{Green}}r}
\textbf{(a)} \hspace{1.2cm} & Max. $\mu$ & Model &
Standard FBA & Fitted FBA & GIMME & iMAT & Lee et al. & FALCON\\
& 75 \%& Yeast~5 MC & 0.66 & 0.66 & NaN & 0.57 & 0.64 & 1 \\
& 75 \%& Yeast~7 MC & 0.66 & 0.66 & 0.68 & 0.66 & 0.66 & 0.98\\
& 75 \%& Yeast~5 HC & 0.73 & 0.78 & 0.75 & 0.66 & 0.98 & 0.99\\
Pearson's r
& 75 \%& Yeast~7 HC & 0.70 & 0.70 & 0.80 & 0.66 & 0.98 & 0.99\\
& 85 \%& Yeast~7 MC & 0.62 & 0.62 & 0.65 & 0.62 & 0.62 & 0.97\\
& 85 \%& Yeast~5 HC & 0.88 & 0.89 & 0.9 & 0.81 & 0.99 & 0.99\\
& 85 \%& Yeast~7 HC & 0.67 & 0.67 & 0.87 & 0.62 & 0.98 & 0.98\\
\end{tabular}}
\caption{Here is a caption.}
\label{tab:FalcPerf}
\end{figure}
}
\end{document}
答案1
您的规范中有 10 列,但您只使用了 9 列。缩写列规范可能更易于管理的另一个原因是:
\begin{tabular}{l*{7}{r}>{\columncolor{Green}}r}
%...
\end{tabular}
答案2
你算错了列数,你要么给出[rgb]
三个数字,要么只给出一个名字(规则与\color
\documentclass[compress,red,notes]{beamer}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{colortbl}
\definecolor{Green}{rgb}{0,1,0}
\begin{document}
\frame{\frametitle{Performance}
\begin{figure}
\centering
\resizebox{\textwidth}{!}{%
\begin{tabular}{lrrrrrrr>{\columncolor{Green}}r}
\textbf{(a)} \hspace{1.2cm} & Max. $\mu$ & Model &
Standard FBA & Fitted FBA & GIMME & iMAT & Lee et al. & FALCON\\
& 75 \%& Yeast~5 MC & 0.66 & 0.66 & NaN & 0.57 & 0.64 & 1 \\
& 75 \%& Yeast~7 MC & 0.66 & 0.66 & 0.68 & 0.66 & 0.66 & 0.98\\
& 75 \%& Yeast~5 HC & 0.73 & 0.78 & 0.75 & 0.66 & 0.98 & 0.99\\
Pearson's r
& 75 \%& Yeast~7 HC & 0.70 & 0.70 & 0.80 & 0.66 & 0.98 & 0.99\\
& 85 \%& Yeast~7 MC & 0.62 & 0.62 & 0.65 & 0.62 & 0.62 & 0.97\\
& 85 \%& Yeast~5 HC & 0.88 & 0.89 & 0.9 & 0.81 & 0.99 & 0.99\\
& 85 \%& Yeast~7 HC & 0.67 & 0.67 & 0.87 & 0.62 & 0.98 & 0.98\\
\end{tabular}}
\caption{Here is a caption.}
\label{tab:FalcPerf}
\end{figure}
}
\end{document}