I am using pandoc to convert a .tex document into a .docx. The tex document uses the siunitx package.

As pandoc can not interpret the macros in the package, I have to write dummies for the macros I use, which will then be used by pandoc. As the docx is simply for review by my co-authors, this is not a problem and the final formatting will be done by LaTeX.

I have implemented some macros


\newcommand{\numrange}[2]{#1 to #2}


but I am struggling with \SI, particularly the preunit part


as the second argument [preunit] is the optional argument. I have found that I can specify the first argument as optional argument as follow:


But how can I do this with the square brackets and as the second argument?


Pandoc version: pandoc

  • \NewDocumentCommand{\si}{mO{test}m} using the xparse package, but I am not sure this will work with pandoc
    – user31729
    Commented Dec 1, 2015 at 10:15
  • Shouldn't it read \SI{number}[preunit]{unit}?
    – user31729
    Commented Dec 1, 2015 at 10:16
  • Perhaps a Generic Preprocessor could help here. However, I always thought GPP would be better for the markdown-to-*TeX workflow....
    – jon
    Commented Dec 1, 2015 at 17:54

1 Answer 1


Would something like this work?



\newcommand{\numrange}[2]{#1 to #2}





enter image description here

  • Unfortunately, does not work with pandoc.
    – Rainer
    Commented Dec 1, 2015 at 11:42
  • @Rainer You realize I am showing it with and without siunitx. To make it work in your setting, you need to remove the siunitx portion. Better still, let me restate it without the siunitx present. Commented Dec 1, 2015 at 11:45
  • @Rainer How about with this clarification? Commented Dec 1, 2015 at 11:47
  • Sure - in the pandoc version I have only the Not using siunitx section with ``renewcommand``` replaced with newcommand.
    – Rainer
    Commented Dec 1, 2015 at 11:47
  • @Rainer I am not a pandoc user, so I can't really say anything more. But I thought doing it with no packages would suffice. There is nothing unique in my coding. Commented Dec 1, 2015 at 11:48

You must log in to answer this question.

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