7

! 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
10

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

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}
\sisetup{load-configurations = abbreviations}
\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
  • When I tried use abbreviations inside a key of a glossary entry, I got error, however, the abbreviations are working inside the main documents. What is probably the reason? – Diaa Sep 5 '17 at 23:46
  • I posted a MWE about this crash here – Diaa Sep 6 '17 at 0:12
3

You need to use \SI instead of \si.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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