10

How can I typeset a number with a prefix but without a unit with siunitx? The following code

\SI{1.0}{\mega}

gives this error: "Prefix with no unit."

  • 2
    Of course it does: you can't have 'one mega', only 'one mega <something>'. What is the aim here? – Joseph Wright Nov 19 '14 at 17:21
  • 1
    I have a table with a column called "number of nodes", and I would like to write "1M" in one of the cells. – jalalhugo Nov 19 '14 at 17:24
  • 1
    @jalalhugo That's 1×10⁶ – egreg Nov 19 '14 at 17:26
  • 5
    I understand that "1M" goes against the standard, but ultimately I think that the notation should be at the discretion of the user, so in my opinion raising an error (as opposed to a warning) is pushing it. – jalalhugo Nov 20 '14 at 14:59
  • 1
    @jalalhugo I agree. It should be only a warning. I'm also using it when discussing unity conversion to teach a trick to convert a number from \meter\squared to \deca\meter\squared: \meter\squared = \frac{\da\squared\meter\squared}{\da\squared} = \frac{\deca\meter\squared}{100}. – Leonardo Castro Jan 27 '16 at 14:28
17

You can of course do it:

\documentclass{article}
\usepackage{siunitx}

\DeclareSIUnit{\nothing}{\relax}

\begin{document}
\SI{1.0}{\mega\nothing} is a wrong way to typeset data.
\end{document}

enter image description here

However, you should think at least twice whether this is a good way to express yourself and your readers will understand what you mean. With

\num{1e6}

the printout would be much clearer and not so wider.

  • 1
    This is a perfectly reasonable way to express oneself in some fields. – Reid Sep 1 '16 at 20:29

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.