# Trouble with table using multirow and multicolumn

I have a table with multirow and multicolumn in a document. This compiles fine on Fedora but has trouble compiling on Ubuntu. Fedora and Ubuntu have different versions of pdflatex. My MWE is as below:

\documentclass{article}

\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{multirow}

\begin{document}

\begin{table}
\caption{Table Example}
\label{Table1}
\centering
\begin{tabular}{S[table-text-alignment=left]SSSS}
\toprule
\multirow{2}{*}{Two Rows} & \multirow{2}{*}{\makecell{Long\\ Data}} & \multicolumn{3}{c}{Short Data}\\
\cmidrule{3-5}
&        & {First Column} & {Second Column} & {Third Column}\\
\midrule
{Data One}   & 0 & 1 & 5 & 65 \\
{Data Two}   & 1 & 0 & 32 & 235 \\
{Data Three} & 0 & 0 & 2 & 0 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}


Latex details on Fedora are as below:

$pdflatex --version pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016) kpathsea version 6.2.2 Copyright 2016 Han The Thanh (pdfTeX) et al. There is NO warranty. Redistribution of this software is covered by the terms of both the pdfTeX copyright and the Lesser GNU General Public License. For more information about these matters, see the file named COPYING and the pdfTeX source. Primary author of pdfTeX: Han The Thanh (pdfTeX) et al. Compiled with libpng 1.6.31; using libpng 1.6.31 Compiled with zlib 1.2.11; using zlib 1.2.11 Compiled with poppler version 0.57.0  Latex details on Ubuntu are as following: $ pdflatex --version
pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017/Debian)
kpathsea version 6.2.3
Copyright 2017 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.34; using libpng 1.6.34
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with poppler version 0.62.0


Compilation on Ubuntu gives multiple errors for line 16

\multirow{2}{*}{Two Rows} & \multirow{2}{*}{\makecell{Long\\ Data}} & \multicolumn{3}{c}{Short Data}\\


Below I give only brief error messages by pdflatex on Ubuntu

Extra }, or forgotten $. Missing$ inserted.
Missing } inserted.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

!
! siunitx error: "invalid-number"
!
! Invalid numerical input '='.


These errors occur only when I compile the code with pdflatex on Ubuntu (TeX Live 2017/Debian) whereas it compiles fine without giving errors with pdflatex on Fedora (TeX Live 2016). I switch between the Fedora and Ubuntu systems for my work. I would be thankful if someone can help resolve the errors so that my MWE can compile with Ubuntu system as well.

A.

• Just out of curiosity: Why do you employ the S column type for the 1st column, which doesn't see have contain any numeric quantities? – Mico Dec 19 '18 at 18:50
• Related (duplicate?): siunitx incompatible with multirow? – leandriis Dec 19 '18 at 18:56
• @Mico, S worked for me and did not know much about other column types. Could have used 'l' perhaps. Thank you for pointing this out. – Adnan Ali Dec 19 '18 at 19:12

Any textual data in an S column should be enclosed in a pair of braces {}. I also agree with @Mico that the first column needn't be S type.

\documentclass{article}

\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{multirow}

\begin{document}

\begin{table}
\caption{Table Example}
\label{Table1}
\centering
\begin{tabular}{l*4{S}}
\toprule
\multirow{2}{*}{Two Rows} &
{\multirow{2}{*}{\makecell{Long\\ Data}}} &
\multicolumn{3}{c}{{Short Data}}\\
\cmidrule{3-5}
&        & {First Column} & {Second Column} & {Third Column}\\
\midrule
{Data One}   & 0 & 1 & 5 & 65 \\
{Data Two}   & 1 & 0 & 32 & 235 \\
{Data Three} & 0 & 0 & 2 & 0 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

• text in the firs column not need to be in curly brackets. also the same valid for multi column header "short data", it is sufficient to write \multicolumn{3}{c}{Short Data}. otherwise nice answer :-) – Zarko Dec 19 '18 at 20:50