\elementarycharge command not recognized in siunitx package

I'm trying to use

\SI{0.006}{\elementarycharge}


in the siunitx package

\usepackage{siunitx}.


The \elementarycharge command does not work. I'm using

\documentclass[prb,twocolumn,showpacs]{revtex4}


Any idea?

-
Please include your \usepackage{siunitx} command. –  Seamus Jan 21 '11 at 15:39
@Seamus. Ok, I updated the question. Do I need specific options to have it work? –  Nigu Jan 21 '11 at 16:44
Could you also copy and paste the error message about the command not working? And also the version of siunitx you are using? –  Seamus Jan 21 '11 at 17:04

You do not say which version of siunitx you have installed. With the current release (v2), something like

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\SI{0.006}{\elementarycharge\per\cubic\angstrom}
\end{document}


should be fine. If you have version 1 then \elementarycharge will not be defined and you'll need

\newunit{\elementarycharge}{\text{\ensuremath{e}}


-
The definition for \elementarycharge I've given here is exactly the one used by v2 of siunitx, by the way. –  Joseph Wright Jan 21 '11 at 16:54
Thanks! I was using texlive 2008, now I upgraded it and it works fine. Other errors appeared due to the upgrade, but I will ask them in a separate question if I can't solve them myself. –  Nigu Jan 22 '11 at 20:10
@Nigu. If the first instants, load siunitx with no options then set \sisetup{load-configurations = version-1} to load the back-compatibility code. –  Joseph Wright Jan 22 '11 at 20:33

The correct use is:

\si{\elementarycharge}


All SI units, not-quite-SI units, prefixes and suffixes from siunitx need to be enclosed in the \si{} macro. See the manual for more information and more advanced examples of use.

Dimensionless numbers and angles have their own commands for typesetting: \num, \numrange, \numlist, \ang, and they don't need to be inside the \si macro.

-
Sorry, I forgot to mention I was using it in the \SI{} macro. I tried \SI{0.006}{\elementarycharge\per\AA^3}, which does not work. So I have to resort to \SI{0.006}{e\per\AA^3} for the moment. Any idea? –  Nigu Jan 21 '11 at 15:05
\SI{0.006}{\elementarycharge\per\AA^3} works for me. Could you post a complete minimal example that produces the issue for you? –  Martin Tapankov Jan 21 '11 at 15:16
@Martin. I will update it once I'm back on that computer. –  Nigu Jan 21 '11 at 16:45
@Martin. Using \AA^3 will force 'literal' mode in your unit. That might be what you want, but I usually recommend sticking with 'semantic' units so that the various formatting options can be applied. –  Joseph Wright Jan 21 '11 at 16:53
@Joseph Sure, I just used what Nigu tried to see whether this replicated the problem. –  Martin Tapankov Jan 21 '11 at 17:38