I am trying to create the following table
However, I keep getting the following error message
! Misplaced \noalign.
\rowcolor ->\noalign
{\ifnum 0=`}\fi \global \let \CT@do@color \CT@@do@color...
l.24 \tableHeaders{Figur}{Antall sirkler}
I expect to see \noalign only after the \cr of
an alignment. Proceed, and I'll ignore this case.
I tried adding {} around the arguments to make sure siunitx columns worked, however even that did not work. To summarize
- How can I fix the white space between the multicolumns? I added
\\[-0.02cm], but that feels like the worlds dirtiest trick. - How can I fix the
\noalignerror? - Is there a better way to center the
nat the bottom of the table?
Code
\documentclass[a4paper, dvipsnames*,svgnames, table, 11pt]{article}
\usepackage{tabularx,siunitx}
\usepackage{multirow}
\usepackage{xcolor}
\definecolor{maincolorLight}{HTML}{838fbc}
\definecolor{maincolorMedium}{HTML}{425b9b}
\definecolor{maincolorDark}{HTML}{003d80}
\newcommand{\maincolor}{maincolorLight}
\newcommand{\Rowcolor}{\rowcolor{\maincolor}}
\newcommand{\tableHeaders}[2]{%
\Rowcolor & \\[-0.02cm]
{\Rowcolor \multirow{-2}{*}{#1}} & {\multirow{-2}{*}{#2}} \\
}
\begin{document}
\begin{table}[htbp]
\centering
\begin{tabular}{| S | S |}
\tableHeaders{Figur}{Antall sirkler}
1 & 6 \\
2 & 10 \\
3 & 14 \\
4 & \\
5 & \\
{n} & \\ \hline
\end{tabular}
\caption{}
\label{tab:del-1-oppgave-1.8}
\end{table}
\end{document}




