1.5e-10 Style Scientific Notation Looks Ugly In LaTeX Math Mode. How Can I Format It (kerning, Etc) More Nicely?


Answer :

It's not ugly, but exactly what's expected. If you type

$2x-10$ 

then you expect that there is some space around the minus sign, because it denotes an operation. When you type $1e-10$, TeX interprets it in exactly the same way, because it can't read your mind: the two expressions are formally the same, only two symbols are different.

If you want that an expression that's normally interpreted as a polynomial should be treated in a different way, then you have to properly mark it.

One solution might be

$1\mathrm{e}{-10}$ 

because in this case the braces around -10 tell TeX to enter a subformula and so the minus sign is initial, so not interpreted as a binary operation, but as a unary operator.

You could make a definition, such as

\newcommand{\expnumber}[2]{{#1}\mathrm{e}{#2}} 

and input the number as

$\expnumber{1}{-10}$ 

but there's a much better alternative, the package siunitx.

\documentclass{article}  \usepackage{siunitx} \sisetup{output-exponent-marker=\ensuremath{\mathrm{e}}}  \begin{document}  \num{1e-10}  \end{document} 

This package offers many more features than just printing numbers in the desired format; consult its documentation to find them.

enter image description here


Note that siunitx is not understood by MathJax, so with it you must stick to the “hand made” solution. You can still say, in it,

$\def\num#1{\numx#1}\def\numx#1e#2{{#1}\mathrm{e}{#2}}$  

and a formula such as $\num{1e-10}$ will be printed in the way you want.


Take a look at the siunitx package. This is helpful for typesetting units and unitless numbers (among many other things). This works in text mode as well as math mode.

\documentclass{article} \usepackage{siunitx} \begin{document} Number only: \num{1e-10}  Number with units: \SI{1e-10}{\meter\per\second} \end{document} 

enter image description here


Here's a really simple solution, not using any extra packages and looks just fine, in my opinion:

$9.54\text{e-}7$ 

That is, you're writing the "e-" part in normal text.


Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable