siunitx 包有问题?

siunitx 包有问题?

一旦我使用该siunitx包,就会提示此错误消息:

! 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!

这是我的 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}

答案1

这里的问题是mdwtab包,它完全改变了 中的表格代码array。在 中siunitx,代码试图通过不做太多假设来实现交叉兼容,但array使用非常广泛,因此被视为基线。

要修复此问题,需要进行一些更改。首先,您必须考虑这种改变的表格机制。其次,您还需要允许通过 放置在表格单元格中的额外标记mdwtab。补丁看起来像

\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}

我将考虑将其纳入下一个siunitx版本:可能还有一些问题需要解决,但应该涵盖基本内容。

相关内容