![奇怪的“放错 \noalign \end{tabu}}”错误](https://linux22.com/image/332495/%E5%A5%87%E6%80%AA%E7%9A%84%E2%80%9C%E6%94%BE%E9%94%99%20%5Cnoalign%20%5Cend%7Btabu%7D%7D%E2%80%9D%E9%94%99%E8%AF%AF.png)
我遇到了这个奇怪的错误,我不知道该如何修复它。我使用以下代码:
\documentclass[a4paper, 11pt]{report}
\usepackage{tabu}
\usepackage[version=3]{mhchem}
\usepackage{xcolor,colortbl}
\definecolor{dtured}{RGB}{153,0,0}
\definecolor{dtugray}{RGB}{153,153,153}
\begin{document}
\begin{table}[h*]
\resizebox{\textwidth}{!}{\begin{tabu}{cccccccccc}
\rowcolor{dtured}\rowfont{\color{white}}
\textbf{m i ton} & $\mathbf{m_{totalt}}$ & \textbf{\ce{SiO2}} & \textbf{\ce{Al2O3}} & \textbf{\ce{Fe2O3}} & \textbf{\ce{MgO}} & \textbf{\ce{CaO}} &\textbf{ \ce{Na2O}} & \textbf{\ce{K2O} }& \textbf{\ce{SO3}} \\
\textbf{98 menger} & $306.20$ & $202.42$ & $4.69$ & $0.19$ & $5.04$ & $27.54$ & $35.74$ & $0.91$ & $0.83$
\end{tabu}}
\captionof{table}{Oxid-indhold i ton af det daglige råvareforbrug bestående af 98 menger.}
\end{table}
\end{document}
答案1
显然,\rowfont
必须在之前使用\rowcolor
:
\documentclass[a4paper, 11pt]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tabu}
\usepackage[version=3]{mhchem}
\usepackage{xcolor,colortbl}
\definecolor{dtured}{RGB}{153,0,0}
\definecolor{dtugray}{RGB}{153,153,153}
\begin{document}
\begin{table}
\centering
\resizebox{\textwidth}{!}{% <------
\begin{tabu}{@{}*{10}{c}@{}}
\rowfont{\color{white}}\rowcolor{dtured}
\textbf{m i ton} & $\mathbf{m_{totalt}}$ & \textbf{\ce{SiO2}} &
\textbf{\ce{Al2O3}} & \textbf{\ce{Fe2O3}} & \textbf{\ce{MgO}} &
\textbf{\ce{CaO}} &\textbf{ \ce{Na2O}} & \textbf{\ce{K2O} }& \textbf{\ce{SO3}} \\
\textbf{98 menger} & $306.20$ & $202.42$ & $4.69$ & $0.19$ & $5.04$ & $27.54$ & $35.74$ & $0.91$ & $0.83$ \\
\end{tabu}% <------
}
\caption{Oxid-indhold i ton af det daglige råvareforbrug bestående af 98 menger.}
\end{table}
\end{document}
\captionof
如果您在 内,则无需table
。请注意标记的%
字符,以避免出现不需要的空格。