18

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."

8
  • 2
    Of course it does: you can't have 'one mega', only 'one mega <something>'. What is the aim here?
    – Joseph Wright
    Nov 19, 2014 at 17:21
  • 2
    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, 2014 at 17:24
  • 1
    @jalalhugo That's 1×10⁶
    – egreg
    Nov 19, 2014 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, 2014 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}. Jan 27, 2016 at 14:28

1 Answer 1

24

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
  • 4
    This is a perfectly reasonable way to express oneself in some fields.
    – Reid
    Sep 1, 2016 at 20:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .