# units error with siunitx

! Undefined control sequence.

\documentclass[12pt]{article}
\usepackage{siunitx}
\begin{document}
\si{300}{\nanogram\per\millilitre}
\end{document}


Why?

-
While in this case it was easy enough to guess the message you were getting, it is usually best to post the full text of an error message rather than just part of it. –  Joseph Wright May 30 '11 at 9:40

You have to use \SI{<number>}{<unit macros>} if you want to typeset a number with units (instead of the lowercase \si, which typesets just units), and unit prefixes like \milli and \nano have to be separated from the unit macros \liter and \gram:

\documentclass[12pt]{article}
\usepackage{siunitx}
\begin{document}
\SI{300}{\nano\gram\per\milli\litre}
\end{document}

-

Jake answered the core question: units and prefixes have to be given separately. However, I think I should add a few comments. There are simply too many potential combinations to provide all of them, and so the core of the package only defines separate prefixes and units. You can define additional units using \DeclareSIUnit

\DeclareSIUnit\nanogram{\nano\gram}


There are a large number of abbreviated units, which currently have to be loaded as an option

\documentclass[12pt]{article}
\usepackage{siunitx}
\begin{document}
\SI{300}{\ng\per\ml}
\end{document}


(I'm planning to revise this so that they are loaded as standard when I do the v2.3 updates: hopefully this will happen some time in June.)

On the \si versus \SI issue, using \si as you have will mean that the package treats 300 as a unit, then does a 'free standing unit' approach to the later part. This is not going to give you the correct output.

-
Thanks got the abbrev tip - a real time-saver and reduces text clutter. :) –  ptrcao May 30 '11 at 9:46

You need to use \SI instead of \si.

-