3

I'm getting this weird error, and I've run out of ideas on how to fix it. I use the follow code:

\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}
5

Apparently, \rowfont must be used before \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}

enter image description here

There's no need of \captionof if you're inside a table. Note the marked % characters, for avoiding unwanted spaces.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.