3

I just had the following error after including mdwtab while using siunitx inside a tabular block:

! Extra \fi.
\@maybe@unskip ...skip \m@ne \lastskip \relax \fi 
                                                  
l.18   1.0 &
             0.0 \\ \hline

Apparently, this is not the first clash between these packages. Is there any "easy" workaround for this issue? I have to include mdwtab, so if there is no workaround, I will need to use something other than siunitx for number alignment in tables like dcolumn.

Complete example

\documentclass[12pt,letterpaper]{article}
\usepackage{siunitx}

% Compilation fails if mdwtab is included
\usepackage{mdwtab}

\begin{document}

\begin{tabular}{|S[table-format=4.1]|}
  \hline
  1.0 \\ \hline
  2.0 \\ \hline
  3.0 \\ \hline
\end{tabular}

% The problem happens in there
\begin{tabular}{|S[table-format=4.1]|c|}
  \hline
  1.0 & 0.0 \\ \hline
  2.0 & 0.0 \\ \hline
  3.0 & 0.0 \\ \hline
\end{tabular}

\end{document}

Package versions

Package: siunitx 2015/01/21 v2.6e A comprehensive (SI) units package

Package: mdwtab 1998/04/28 1.9 Table typesetting with style

Package: array 2014/10/28 v2.4c Tabular extension package (FMi)

5
  • 1
    If I'm not mistaken mdwtab is incompatible with a lot of things, mit even be just array that is the problem. It has not been updated for a long time, what particular feature from mdwtab do you need that is not provided by other packages?
    – daleif
    Oct 15, 2015 at 8:42
  • The LaTeX template for the paper I'm writing highly recommends to use it, hence my reluctance to remove the include.
    – BenC
    Oct 15, 2015 at 8:52
  • Don't mention that evil word... (How much do you trust the template and when was it last updated?) Now seriously, if you don't see a difference when removing mdwtab you are probably good to go. Also note that the doc of mdwtabs states "The mdwtab environment is not 100% compatible with the tabular environment found in LaTeX2ε".
    – moewe
    Oct 15, 2015 at 8:59
  • Well, apparently the 2015 IEEEtran template still mentions it (cf. bare_adv.tex), but the include is commented by default. A contributor of the paper uncommented it in a totally unrelated commit, so I guess removing it and quickly checking that this does not break the layout of the paper is the smartest/safest route.
    – BenC
    Oct 15, 2015 at 9:18
  • Isn't this once again a case of the template not having been updated for 5+ years?
    – daleif
    Oct 15, 2015 at 9:48

1 Answer 1

4

There's another special-case macro that needs to be detected by siunitx. Fix for the present:

\usepackage{siunitx}
\ExplSyntaxOn
\makeatletter
\AtBeginDocument
  {
    \@ifpackageloaded { mdwtab }
      {
        \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
                      {
                        \token_if_eq_meaning:NNF #1 \@maybe@unskip
                          { \__siunitx_table_collect_not_braced_aux_i:N #1 }
                      }  
                  }
              }
            \__siunitx_table_collect_next:
          }
      }
      { }
  }
\makeatother
\ExplSyntaxOff
1
  • Well, that solves it, and I would clearly not have been able to fix that. Thanks!
    – BenC
    Oct 15, 2015 at 9:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .