I've been working on writing a contingency table in LaTeX (I've prepared myself for a long battle to get multi-line and multi-column cells to appear as I need).
\usepackage{booktabs}
\usepackage[detect-all]{siunitx}
\usepackage{multirow}
\begin{table}[htp]
\centering
\begin{tabular}{
@{}
l
S[table-format=3.2]
S[table-format=3.2]
S[table-format=3.2]
S[table-format=3.2]
S[table-format=3.2]
S[table-format=3.2]
@{}
}
\toprule
\multicolumn{7}{|c|}{Factor B} \\
& Alpha & Beta & Gamma & Delta & Epsilon & Row Total \\
\midrule
\multirow{2}{*}{Alpha} & 1 & 1 & 1 & 1 & 1 & 1 \\
& 11.11 & 2.11 & 3.11 & 4.11 & 5.11 & \\
\multirow{2}{*}{Beta} & 2 & 2 & 2 & 2 & 2 & 2 \\
& 22.22 & 2.22 & 3.22 & 4.22 & 5.22 & \\
\multirow{2}{*}{Gamma} & 3 & 3 & 3 & 3 & 3 & 3 \\
& 33.33 & 2.33 & 3.33 & 4.33 & 5.33 & \\
\multirow{2}{*}{Delta} & 4 & 4 & 4 & 4 & 4 & 4 \\
& 44.44 & 2.44 & 3.44 & 4.44 & 5.44 & \\
\multirow{2}{*}{Epsilon} & 5 & 5 & 5 & 5 & 5 & 5 \\
& 55.55 & 2.55 & 3.55 & 4.55 & 5.55 & \\
Column Total & 111 & 222 & 333 & 444 & 555 & 666 \\
\bottomrule
\end{tabular}
\caption {Table Caption}\label{my-table}
\end{table}
I receive the following error:
! siunitx Error
(siunitx) Invalid numerical input 'e'.
For immediate help type H <return>.
...
l.157 & Alpha & Beta &
Gamma & Delta & Epsilon & Row Total \\
I admit I don't understand it. The non-numerical text is in the header of the table. To see the table, replace the line
& Alpha & Beta & Gamma & Delta & Epsilon & Row Total \\
with
1 & 2 & 3 & 4 & 5 & 6 & 7 \\
just to allow it to render.
I'm puzzled. Why "e"?
Suggestions are very appreciated.
Thanks in advance.
Best Answer
The "e" is because siunitx is trying to parse "Delta" as a number in engineering notation (eg, 1.234E+04). Fix it by writing the headings as
\multicolumn{1}{c}{Delta}
, etc