# Problems with siunitx package?

Once I use the siunitx package, this error message prompts:

! File ended while scanning use of \__siunitx_table_rewrite_create_aux:w.
<inserted text>
\par
<*> paper.tex
I suspect you have forgotten a }', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type E' or X' now and fix your file.
! Emergency stop.
<*> paper.tex
*** (job aborted, no legal \end found)
Here is how much of TeX's memory you used:
21553 strings out of 494045
422667 string characters out of 3148364
448797 words of memory out of 3000000
24480 multiletter control sequences out of 15000+200000
91950 words of font info for 94 fonts, out of 3000000 for 9000
715 hyphenation exceptions out of 8191
56i,1n,55p,726b,104s stack positions out of 5000i,500n,10000p,200000b,50000s
! ==> Fatal error occurred, no output PDF file produced!


Here is my MWE.

\documentclass[conference]{IEEEtran}

\usepackage{natbib} % for the bibliography
\usepackage{graphicx}
\usepackage[cmex10]{amsmath} % http://www.ctan.org/tex-archive/macros/latex/required/amslatex/math/
\usepackage{amsfonts}
\usepackage{bm}
\usepackage{array} % http://www.ctan.org/tex-archive/macros/latex/required/tools/
\usepackage{mdwmath}
\usepackage{mdwtab} % http://www.ctan.org/tex-archive/macros/latex/contrib/mdwtools/
\usepackage{eqparbox} % http://www.ctan.org/tex-archive/macros/latex/contrib/eqparbox/
\usepackage[T1]{fontenc}
\usepackage[caption=false]{subfig} % http://www.ctan.org/tex-archive/obsolete/macros/latex/contrib/subfigure/
\usepackage{fixltx2e} % http://www.ctan.org/tex-archive/macros/latex/base/
\usepackage{stfloats} % http://www.ctan.org/tex-archive/macros/latex/contrib/sttools/
\usepackage{url} % http://www.ctan.org/tex-archive/macros/latex/contrib/misc/
\usepackage{siunitx}
% for TikZ drawing
\usepackage{tikz}
\usetikzlibrary{backgrounds, calc, positioning, fit}
\usepackage{color}
% for figure inclusion
\usepackage{pdfpages}
% for pseudocode
\usepackage{algorithmicx}
\usepackage{algorithm} % http://ctan.org/pkg/algorithms
\usepackage{algpseudocode} % http://ctan.org/pkg/algorithmicx
\algnewcommand\algorithmicinput{\textbf{INPUT: }}
\algnewcommand\Input{\item[\algorithmicinput]}
\algnewcommand\algorithmicoutput{\textbf{OUTPUT: }}
\algnewcommand\Output{\item[\algorithmicoutput]}

\begin{document}

\title{Title}

\author{
\IEEEauthorblockN{
Name1\IEEEauthorrefmark{1},
Name2\IEEEauthorrefmark{2},
Name3\IEEEauthorrefmark{3} and
Name4\IEEEauthorrefmark{4}}
\IEEEauthorblockA{\IEEEauthorrefmark{1}institute1\\ Email1}
\IEEEauthorblockA{\IEEEauthorrefmark{2}institute2\\ Email2}
}

holding assumption
HD algorithm
\SI{42.122}{\micro\tesla}
\footnote{National Geophysical Data Center http://www.ngdc.noaa.gov/geomag-web}

\end{document}

• If the MWE works, the please post something that does not. Otherwise we cannot help – daleif Nov 19 '13 at 11:27
• @perfectionm1ng There must be some key difference between the demo and the real file: work through removing part of your real file at a time until you locate what it is. – Joseph Wright Nov 19 '13 at 11:29
• That is actually not how to use siunitx. You should instead \SI{42.122}{\micro\tesla}. This adds a little space between the number among other improvements. – frankundfrei Nov 19 '13 at 12:24
• @perfectionm1ng There is a lot you can remove and still get the same error. This is minimal: \documentclass{article} \usepackage{array} \usepackage{mdwtab} \usepackage{siunitx} \begin{document} \SI{42.122}{\micro\tesla} \end{document} – Torbjørn T. Nov 19 '13 at 16:12
• @SvendTveskæg Yes and no. After removing array you still get an error, but it is a different error than the one mentioned in the question. That's why I left it in. – Torbjørn T. Nov 19 '13 at 18:43

The issue here is the mdwtab package, which completely alters the tabular code from array. Within siunitx, the code attempts to be cross-compatible by not making too many assumptions, but array is very widely used and so is treated as a baseline.

To fix the issue, there are a couple of changes needed. First, you have to account for this altered table mechanism. Secondly, you need to also allow for an additional token that gets placed in the tabular cells by mdwtab. A patch looks something like

\documentclass{article}

\usepackage{mdwtab}
\usepackage{siunitx}
\ExplSyntaxOn
\makeatletter
\cs_set_protected:Npn \__siunitx_table_rewrite_create:N #1
{
\newcolumntype {#1} [1] []
{
> { \__siunitx_table_collect_begin:Nn #1 {##1} }
c
< { \__siunitx_table_print: }
}

}
\cs_set_protected:Npn \__siunitx_table_collect_not_braced:N #1
{
\token_if_eq_meaning:NNF #1 \tex_ignorespaces:D
{
\token_if_eq_meaning:NNF #1 \tex_unskip:D
{
\token_if_eq_meaning:NNF #1 \tab@setcr
{ \__siunitx_table_collect_not_braced_aux_i:N #1 }
}
}
\__siunitx_table_collect_next:
}
\makeatother
\ExplSyntaxOff

\begin{document}

\begin{tabular}{S[table-format = 2.2]}
1.23 \\
45.6
\end{tabular}

\end{document}


I'll look to incorporate this into the next siunitx` release: there may be a few more wrinkles to iron out, but that should cover the basics.