9

With the latest TeXlive update to the 2012 version, for some reason I am getting missing $ inserted messages, when using the inter-unit-product option for \si.

For example, this is taken directly from the PDF documentation:

\documentclass{minimal}

\usepackage{mathtools}
\usepackage{siunitx}

\begin{document}
\[
    \si[inter-unit-product={}\cdot{}]{\farad\squared\lumen\candela}
\]
\end{document}

and it fails to compile for me with the above error.

5
  • In math mode, that is.
    – mSSM
    Jul 23 '12 at 1:23
  • 1
    Can you provide a MWE?
    – J M
    Jul 23 '12 at 1:37
  • Not really necessary here, but sure.
    – mSSM
    Jul 23 '12 at 1:41
  • This seems to work fine \si[inter-unit-product={$\cdot$}]{\farad\squared\lumen\candela} with TeXLive2011. Or if you want the extra spacing use [inter-unit-product={${}\cdot{}$}]. TeXLive2011 even requires this -- perhaps an error in the documentation? Jul 23 '12 at 1:47
  • Or the method that they wrote word-for-word in the manual, using the ensuremath command. I also found that it works if you surround the whole command in $s
    – J M
    Jul 23 '12 at 1:49
8

It looks both you and I were looking at an older version of the documentation. I just downloaded the latest version (2012-07-22) which suggests the use of

\si[inter-unit-product=\ensuremath{{}\cdot{}}]

which yields:

enter image description here

Code:

\documentclass{article}
\usepackage{siunitx}

\begin{document}
\[
    \si[inter-unit-product=\ensuremath{{}\cdot{}}]{\farad\squared\lumen\candela}
\]
\end{document}
3
  • Wow...this is a legitimate use of \ensuremath!
    – Ryan Reich
    Jul 23 '12 at 2:14
  • @RyanReich: Yeah was about to replace it with $ fearing @egreg's wrath :-), but then realized in this case he would probably let it slide since you may want to use units outside of math mode. Jul 23 '12 at 2:20
  • Even better: you have no way of knowing how the inter-unit product is actually produced internally. This is truly a "just use this math symbol" situation.
    – Ryan Reich
    Jul 23 '12 at 3:00
2

This is a minor update! In the most recently updated version (10/28/2014) of siunitx, this code works, and produces the correct symbol and spacing.

\usepackage[inter-unit-product=\cdot]{siunitx}

The code from the answer here:

\usepackage[inter-unit-product=\ensuremath{{}\cdot{}}]{siunitx}

no longer seems to work, and will throw an error about a missing $ or }. I discovered this quite by accident, and thought I would share.

Edit

Here is an MWE, asked for in the comments:

\documentclass[]{article}
\usepackage[inter-unit-product=\ensuremath{{}\cdot{}}]{siunitx}

\begin{document}

\si{\joule\per\cm\squared\per\hour}

\end{document}
2
  • I tested this, and here is what I found: using \sisetup{inter-unit-product=\ensuremath{{}\cdot{}}} did work, and produced the correct spacing and symbols. However, loading the option like so: \usepackage[inter-unit-product=\ensuremath{{}\cdot{}}]{siunitx} does not work. This produces the errors described above. I will post an MWE above.
    – SteelAngel
    Dec 2 '14 at 18:27
  • 2
    I very strongly discourage load time options for siunitx: the way that the LaTeX kernel handles such things means that expansion can lead to issues. \sisetup is strongly preferred.
    – Joseph Wright
    Dec 2 '14 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.