Automatically-adjusted spacing for scientific notation in siunitx

With the input

[ n=CV = \SI{3.29e-3}{\micro\mol\per\L} \times \SI{8e-4}{L} = \SI{2.63}{\micro\mol} \]


I get output

As you see the spacing is not quite right - I really want the spacing of the scientific notation to be tighter, the terms 8 \times 10^-6 grouped together so it maintains its distinctness.

Edit: I noticed an arithmetic error; I left out e-06 on the RHS of the equation, but that's beside the point! :P

@aghsmith + @ Joseph Wright: Current accepted solution (2) compared with original (1).

It may be as good as it gets but I still have reservations about reading a page full of these kinds of scientific notations mixed with operators, numbers and units. The different terms meld into each other and it is difficult to discern discrete terms. Aghsmith's solution offers an improvement, but I can't help thinking more could be done with the spacing.

Solution accepted but still open to further suggestions for improvements, assuming I don't have the luxury of omitting or units or using dots for multiplication signs. I have thought about using \quad to increase the spacing between terms but that is too much manual effort...

-
instead of the second \times, try \cdot which gives a small dot. – Tom Bombadil Sep 7 '11 at 9:41
Personally, I'd add brackets in this case, or more usually omit the units in the calculations. – Joseph Wright Sep 7 '11 at 9:41
@ Tom Bombadil: The Tom Bombadil of Tolkien LoTR fame? Using a mix of dots and crosses is a great idea. – ptrcao Sep 7 '11 at 10:43
@Joseph Wright: Brackets might have to suffice. :) I'm not allowed to leave out the units unfortunately. :P – ptrcao Sep 7 '11 at 11:02
@ptrcao. siunitx is meant for typesetting units - the request looks more like a calculation, which is unsurprisingly more awkward to handle. In many ways, this is a question more of style than of code. – Joseph Wright Sep 7 '11 at 11:07

Use the tight-spacing=true option:

 \documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}

\begin{document}

$n=CV = \SI[tight-spacing=true]{3.29e-3}{\micro\mol\per\L} \times \SI[tight-spacing=true]{8e-4}{L} = \SI[tight-spacing=true]{2.63}{\micro\mol}$

\end{document}


or you can put that in the package options, or options just for the local environment:

  \sisetup{tight-spacing=true}

-

If you are unable to use a different symbol than \times to represent multiplication, you should consider using scientific E or e notation (I think little e is easier to read):

To enable this you can set output-exponent-marker = \ensuremath{\mathrm{E}} or output-exponent-marker = \text{e} if you prefer big E or little e notation respectively, either inline as @aghsmith suggested:

$n=CV = \SI[output-exponent-marker=\text{e}]{3.29e-3}{\micro\mol\per\L} \times \SI[output-exponent-marker=\text{e}]{8e-4}{L} = \SI[output-exponent-marker=\text{e}]{2.63}{\micro\mol}$


globally when calling \usepackage{}:

\usepackage[output-exponent-marker=\text{e}]{siunitx}


or with \sisetup either in the preamble or prior to the use of \SI:

\sisetup{output-exponent-marker=\text{e}}


You can also temporarily set it by using curly brackets around \sisetup and the wherever you want \sisetup to have effect, as I have done with the code to generate the image above:

\begin{align}
n=CV = \SI{3.29e-3}{\micro\mol\per\L} \times \SI{8e-4}{L} = \SI{2.63}{\micro\mol}\\
{
\sisetup{tight-spacing=true}
n=CV = \SI{3.29e-3}{\micro\mol\per\L} \times \SI{8e-4}{L} = \SI{2.63}{\micro\mol}
}\\
{
\sisetup{output-exponent-marker=\ensuremath{\mathrm{E}}}
n=CV = \SI{3.29e-3}{\micro\mol\per\L} \times \SI{8e-4}{L} = \SI{2.63}{\micro\mol}
}\\
{
\sisetup{output-exponent-marker=\text{e}}
n=CV = \SI{3.29e-3}{\micro\mol\per\L} \times \SI{8e-4}{L} = \SI{2.63}{\micro\mol}
}
\end{align}


Note that output-exponent-marker is documented on page 29 of the current pdf manual.

-

For anyone looking for a simpler way to typeset scientific notation, just use math mode and a thinspace:

\documentclass{article}
\begin{document}

8\thinspace$\times$\thinspace$10^{-4}$ L

\end{document}


This gives almost exactly the same result as using the SI package. In the picture below, the top number is from using \SI{8e-4}{L}, the bottom number is using the code above:

-
In what way is this simpler than \SI{8e-4}{L}? – egreg Jan 8 '15 at 13:44
It is simpler in that it does not require a package and can be used when there is no unit. – madroan Jan 8 '15 at 14:57
Why not $8\times10^{-4}$\,L? – Torbjørn T. Sep 29 '15 at 20:04