When to use math mode?

Don Knuth touched on this topic in his article for TUGboat -- "Typesetting Concrete Mathematics". His examples don't include units (for that, the siunitx package is a good choice, as already mentioned), but the method for determining what is math and what isn't is well illustrated otherwise.

(The article is set in Knuth's Concrete fonts, and shows some of the special techniques used in setting that book. Irrelevant for this question, but interesting nonetheless.)


As the math font and the main text font are likely to have different looking numbers you should aim for consistency. Whenever you refer to a part of a document, e.g. chapter 4, theorem 3.4, bullet point 2, figure 9.3, table 12.1 or similar elements, stick with the same font, which is likely to be your main text font.

Whenever your talk about parts of a mathematical expression, e.g. the leading coefficient, then be consistent and use the same font as used for typesetting the formular.

In case of physical quantities I would recommend the use of siunitx that allows for a consistent application of the SI system throughout the document.


As uli said, siuntix is recommended. I use it to typeset all numbers/values, that are not dates or something like that.

Example

\documentclass{article}

%\usepackage[default]{gfsneohellenic}% example font without math support

\usepackage{siunitx}
\sisetup{
   locale=UK,
%   mode=text,% when using a font without math support
}

\begin{document}
Lorem Ipsum is simply \SI{10.5}{\kilo\meter} dummy text of the printing. Lorem
Ipsum has been the \num{2e-19} industry's standard dummy text ever since the
1500s, when an unknown printer took a galley of type and scrambled it to make a
type \SI{2,6}{\volt\per\meter} specimen book. It has survived not only five
centuries, but also the leap into electronic typesetting, remaining essentially
unchanged. It was popularised in the 1960s with the release of Letraset sheets
containing Lorem Ipsum passages, and more recently with desktop publishing
software like Aldus PageMaker including versions of Lorem Ipsum.
\end{document}

si

Note the handling of 10.5 and 2,6 (both with . in output) and of 2e-9. The behavior of \per (in \volt\per\meter) is customizable.

This is the result for gfsneohellenic:

enter image description here


I didn’t found a solution to write soemthing like \num{2^3}. Does anybody know if this is possible?

As said in the comments it is possible to use \num[parse-numbers=false]{2^3}. But this affects an e12 part too.