请问这有什么问题?我遇到了错误
! 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 的解决方案对我没有帮助。进一步的谷歌搜索让我这里:
该帖子中的两个解决方案如下:
\PassOptionsToPackage{table}{xcolor}
在 之前在序言中添加命令\documentclass
。table
直接在您的中添加选项\documentclass
。