Cellcolor-未定义的控制序列

Cellcolor-未定义的控制序列

请问这有什么问题?我遇到了错误

! Undefined control sequence. Fit& 1& 2& 3& 4& 5& 6& 7& 8& 9& \cellcolor

谢谢

\documentclass[12pt,a4paper]{report}
\usepackage[locale=FR]{siunitx}
\usepackage{booktabs}
\usepackage{xcolor}

\begin{document}


\noindent
\textbf{Konvergence - MOST a BRITE}

\begin{table}[h!!]
\renewcommand{\arraystretch}{1.45}
\scriptsize
\begin{tabular}{r|S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]}

Fit&    1&  2&  3&  4&  5&  6&  7&  8&  9& \cellcolor{blue!25}10 &  11\\

\end{tabular}
\end{table}

\end{document} 

答案1

您需要加载table的选项xcolor,该选项加载colortbl包含的选项\cellcolor等。

\documentclass[12pt,a4paper]{report}
\usepackage[locale=FR]{siunitx}
\usepackage{booktabs}
\usepackage[table]{xcolor}
\begin{document}
\noindent
\textbf{Konvergence - MOST a BRITE}
\begin{table}[h!!]
\renewcommand{\arraystretch}{1.45}
\scriptsize
\begin{tabular}{r|S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]S[table-format=5.6,table-auto-round]}
Fit&    1&  2&  3&  4&  5&  6&  7&  8&  9& \cellcolor{blue!25}10 &  11\\
\end{tabular}
\end{table}
\end{document} 

顺便问一下,你的桌子为什么这么宽?

答案2

尽管原因正确,但@user156344 的解决方案对我没有帮助。进一步的谷歌搜索让我这里

该帖子中的两个解决方案如下:

  1. \PassOptionsToPackage{table}{xcolor}在 之前在序言中添加命令\documentclass
  2. table直接在您的中添加选项\documentclass

相关内容