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}
Ethan Bolker
  • 9,333
  • 3
  • 42
  • 69

1 Answers1

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.

egreg
  • 1,121,712