Calculator style base 10 notation in LaTeX

What is the best way to write something like 6.22E-21 in LaTeX, given that I don't want the numerals to be \tt, I do want the E to be small, and I may want the exponent to be negative (without the huge LaTeX minus sign)?

I'm sure this is a duplicate of another question that I just can't find.

Example here:

-
 The description is not letting me visualise what you want.(But, may be, I am the only one.) Perhaps, why not give us a sample to think about? – kan Sep 7 '12 at 2:59 @KannappanSampath I tried, it wouldn't let me post images. I've added a link. – U2EF1 Sep 7 '12 at 3:06 You could try $6.22\mbox{\textsc{e}}-21$. I'm assuming this number will be typeset on math mode, right? If you don't want a (typographically correct) math minus sign but a simple dash, be sure to include it in the argument of the \mbox command. – Mico Sep 7 '12 at 3:39 @Mico $6.22\mbox{\sc{e}-}21$ is definitely the correct answer, it looks exactly how I'd like it to! You should post that so I can checkmark it. – U2EF1 Sep 7 '12 at 5:22

For a one-off implementation of your typesetting needs, you could try

6.22\mbox{\sc{e}-}21


This will work in both text and math mode. If you use the amsmath package, you should type

6.22\text{\sc{e}-}21


as this is slightly more general than the first solution. Specifically, it'll work better if the expression ever occurs in scriptstyle (first-level sub- and superscripts) or scriptscriptstyle (second-level sub- and superscripts) material.

Conversely, if you have a lot of numbers that you wish to typeset in this way, you should implement a solution along the lines provided in @AlfC's answer. Otherwise, sooner or later some inconsistencies in the way you typeset these numbers will creep in.

-

By far the most elegant way to do it is using the siunitx package:

\documentclass{article}
\usepackage{siunitx}
\sisetup{output-exponent-marker=\textsc{e}}
\begin{document}
\num{6.02e23}
\end{document}


EDIT: If you want a short minus sign, a not so elegant solution (but still within siunitx) is to replace this more complicated sisetup line:

\sisetup{output-exponent-marker=\textsc{e}, bracket-negative-numbers, open-bracket={\text{-}}, close-bracket={}}


This will in general affect also negative numbers (even without exponents) used within \num. For other hacks regarding the minus sign look at this question Making a shorter minus or typesetting of negative versus minus, no answer on this was really satisfactory to me.

-
 That looks good, how does it handle minus signs in the exponent? One problem (that I didn't put in my question): I'm using matplotlib, so extra packages probably aren't an option. – U2EF1 Sep 7 '12 at 5:23 @alfC You'll get a minus sign with siunitx: the question seems to be after what you see with a calculator, which is much more hyphen-like. – Joseph Wright♦ Sep 7 '12 at 5:52 See my edit. If you can't load external packages then use another solution, like Fabio's or Mico's. – alfC Sep 7 '12 at 6:08

You could try this code:

% this has to go in the preamble of the document.
\DeclareMathSymbol{\minus}{\mathord}{operators}{"2D} % unary minus
\newcommand{\scinot}[2]{#1\,\textrm{\scriptsize E}{#2}} % scientific notation
$\scinot{10}{\minus2}$

-