Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

2 Answers

up vote 5 down vote accepted

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}}

in your preamble.

share|improve this answer
1  
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
add comment

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.

share|improve this answer
    
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
1  
@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
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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