# siunitx incompatible with multirow?

I can't for the life of me figure out what's causing the errors in this table. As written, I get about a dozen warnings (all on the first data line of the table) about missing } or \$.

\documentclass{article}
\usepackage{mathpazo}

\usepackage{array}
\usepackage{booktabs,caption}
\usepackage{multirow}
\usepackage{siunitx}
\usepackage{color}

\begin{document}

\begin{table}[!htbp]
\captionsetup{skip=0.5\baselineskip,size=footnotesize}
\footnotesize
\centering
\begin{tabular}{c
S[table-format=2.0]
*3{S[table-format=1.1]}
}
\toprule
\multirow{2}[4]{*}{\textbf{Homegrid}} & \multirow{2}[4]{*}{\textbf{Battery capacity}} & \multicolumn{3}{c}{\textbf{Load priority and power}} \\ \cmidrule{3-5}
&       & \textbf{High} & \textbf{Medium} & \textbf{Low} \\ \midrule
\textcolor[rgb]{ 0,  .447,  .741}{1} & 7     & 1.5   & 4.5   & 0 \\
\textcolor[rgb]{ .851,  .325,  .098}{2} & 55    & 1.5   & 4.5   & 1.5 \\ \bottomrule
\end{tabular}
\caption{Thresholds and actions for the homegrids of the experiment plotted in ...}
\label{tab:export}
\end{table}

\end{document}


As soon as I switch the tabular format to {ccccc}, everything works perfectly.

I can use \tablenum{} (as suggested in this answer) in the middle column to get 7 and 55 to line up properly, which is why I'm using siunitx. But why won't siunitx work on it's own?

• on my system this code compiles without warnings (pdfTeX, Version 3.14159265-2.6-1.40.15, array 2014/10/28 v2.4c, siunitx 2014/10/01 v2.6c) – jakun May 8 '17 at 5:10
• @jakun I have more recent versions of all three (pdfTeX, Version 3.14159265-2.6-1.40.17, array 2016/10/06 v2.4d, and siunitx 2017/03/23 v2.7f) using MiKTeX 2.9.6210 64-bit with TeXstudio. – LShaver May 8 '17 at 18:30

The siunitx code does it's best to 'guess' when content is 'purely textual', but it is best to give it some guidance. Here, the issue arises as siunitx picks up \multirow as 'before the number' but fails to grab all of the arguments in the same way. Adding a set of braces fixes this:

\documentclass{article}
\usepackage{mathpazo}

\usepackage{array}
\usepackage{booktabs,caption}
\usepackage{multirow}
\usepackage{siunitx}
\usepackage{color}
\begin{document}

\begin{table}[!htbp]
\captionsetup{skip=0.5\baselineskip,size=footnotesize}
\footnotesize
\centering
\begin{tabular}{c
S[table-format=2.0]
*3{S[table-format=1.1]}
}
\toprule
\multirow{2}[4]{*}{\textbf{Homegrid}} &
{\multirow{2}[4]{*}{\textbf{Battery capacity}}} & % Braces here
\multicolumn{3}{c}{\textbf{Load priority and power}} \\ \cmidrule{3-5}
&       & {\textbf{High}} & {\textbf{Medium}} & {\textbf{Low}} \\ \midrule
\textcolor[rgb]{ 0,  .447,  .741}{1} & 7     & 1.5   & 4.5   & 0 \\
\textcolor[rgb]{ .851,  .325,  .098}{2} & 55    & 1.5   & 4.5   & 1.5 \\ \bottomrule
\end{tabular}
\caption{Thresholds and actions for the homegrids of the experiment plotted in ...}
\label{tab:export}
\end{table}

\end{document}