Option “inter-unit-product” not working in siunitx package

siunitx

I am unable to insert a \cdot between the units when using the siunitx package.

Here is my MWE:

\documentclass[a4paper,12pt]{article}
\usepackage{microtype}
\usepackage{siunitx}
\sisetup{mode=text}
\sisetup{inter-unit-product=\ensuremath{\cdot}}
\begin{document}
What I Get:
\qty{12.5}{\meter\per\second}\par
What I want:
12.5 m\ensuremath{\cdot}s\textsuperscript{--1}.
\end{document}

The corresponding output is:

Output.jpg

Best Answer

You are printing in text mode, so siunitx replaces \cdot by \textperiodcentered. However, you've added \ensuremath, and we then end up with an invalid siltation (and a warning in the log). The easiest fix is to remove the \ensuremath part. If you want to keep that, you'll need to make a copy of \cdot that siunitx is not 'looking' for:

\NewCommandCopy\mycdot\cdot
\sisetup{inter-unit-product=\ensuremath{\mycdot}}