Typesetting Mathematics According to the ISO Standard

In The Princeton Companion to Applied Mathematics we used the conventions that the constants e (the base of the natural logarithm) and i (the imaginary unit), and the d in derivatives and integrals, are typeset in an upright font. These conventions are part of an ISO standard, ISO 80000-2:2009. The standard is little-known, though there is an excellent article about it in TUGboat by Claudio Beccari, and Kopka and Daly’s A Guide to \LaTeX has a page on the standard (in section 7.4.10 of the fourth edition and section 5.4.10 of the third edition).

pcam_p178.jpg
An extract from The Princeton Companion to Applied Mathematics (page 178) showing the upright e, d, and i in one equation.

The standard goes into great detail about how all kinds of mathematical notation should be typeset. It is unclear how the typesetting choices were made or who was on the technical committees that made them. Nevertheless the recommendations are well thought-out.

The most interesting aspects of the standard concern the use of an upright versus a sloping font, which in practice usually amounts to roman versus italic.

  1. Variables and generic functions are written in italic. This, of course, is standard practice.
  2. Mathematical constants whose values do not change are written in roman. Thus e, i, and \pi should be in roman font. However, standard \LaTeX fonts do not have upright lower case Greek letters, so an italic \pi is unavoidable.
  3. Mathematical functions with a fixed meaning, such as exp and sin, are written in roman. Of course, \LaTeX has such definitions built in for many standard functions, but it is a common error for inexperienced users to write, for example, $sin(x)$ (giving sin(x)) instead of $\sin(x)$ (giving \sin(x)). The best way to define macros for additional functions is via \DeclareMathOperator, assuming you are using the amsmath package:

    \DeclareMathOperator{\diag}{diag}
    
  4. Mathematical operators are written in roman. This includes the d in derivatives and integrals.

Although the second and fourth of these rules are not widely followed, they are appealing in that they distinguish variable quantities from fixed ones.

There are some subtleties and some dubious cases.

  • A capital delta may appear in both forms: as an operator, hence roman, as in the forward difference operator \Delta(f) = f(x+h) - f(x); and combined with a letter to denote a variable, hence italic, as in A + \mathnormal{\Delta}A (where in \LaTeX the latter delta is typed as \mathnormal{\Delta}).
  • The ISO standard explicitly says that named polynomials, such as the Chebyshev polynomials, should be written in roman: \mathrm{T}_n(x) instead of T_n(x). This certainly follows the rules above, since such polynomials have a fixed meaning, but I have never seen the upright font being used for such polynomials in practice.

I’ve started to use rules 1–4 in my recent papers, most thoroughly in this recent EPrint on matrix functions, and intend to use them in my future writing. In doing so, I am using the following \LaTeX macros, based on those suggested in Beccari’s article.

% The number `e'.
\def\eu{\ensuremath{\mathrm{e}}}
% The imaginary unit.
\def\iu{\ensuremath{\mathrm{i}}}
% The differential operator.
\def\du{\ensuremath{\mathrm{d}}}

The \ensuremath is not essential, but it means that you can type \eu, etc., outside math mode—for example, in the phrase “the limit of this sequence is \eu”. You may want to rewrite the \def commands using \newcommand, so that if the \eu command has already been defined an error will be issued:

\newcommand{\eu}{\ensuremath{\mathrm{e}}}

With these definitions the example at the start of this article is typed as

\int_C\frac{\eu^z}{z}\,\du z = 2\pi\iu.

Note that if you are using Beamer with the recommended sans serif fonts then mathrm should be replaced by \mathsf in these definitions.

Obtaining the Standard

If you wish to download the ISO standard document from the link given at the start of this post you will be charged the princely sum of around $150 for it! If the aim of the ISO is that the standard becomes adopted then this appears counterproductive. However, it is easy to find a freely downloadable version via a Google search.

How To Typeset an Ellipsis in a Mathematical Expression

In mathematical typesetting we often use an ellipsis (three dots) to denote omission in an expression. It’s well known to \LaTeX users that an ellipsis is not typed as three dots, but rather as \dots or \cdots. The vertically centered \cdots is used between operators that sit above the baseline, such as +, -, = and \le. Ground level dots are produced by \dots and are used in a list or to indicate a product.

Recently the question arose of whether to write

$a_1$, $a_2$, \dots, $a_n$

or

$a_1, a_2, \dots, a_n$

The difference between these two does not show up well if I allow WordPress to interpret the \LaTeX, but as this PDF file shows the first of these two alternatives produces more space after the commas.

I don’t discuss this question in my Handbook of Writing for the Mathematical Sciences, nor does the SIAM Style Guide offer an opinion (it implies that the copy editor should stet whatever the author chooses).

As usual, Knuth offers some good advice. On page 172 of the TeXbook he gives the example

The coefficients $c_1$, $c_2$, \dots, $c_n$ are positive.

the justification for which is that the commas belong to the sentence, not the formula. (He uses \ldots, which I have translated to \dots, as used in \LaTeX.) In Exercise 18.17 he notes that this is preferred to $c_1, c_2, \dots, c_n$ because the latter leaves too little space after the commas and also does not allow line breaks after the commas. But he notes that in a more terse example such as

Clearly $a_i<b_i$ \ $(i=1,2,\dots,n)$

the tighter spacing is fine. Indeed I would always write $i=1,2,\dots,n$, because $i=1$, $2$, \dots, $n$ would be logically incorrect. Likewise, there is no alternative in the examples

$D = \diag(d_1,d_2,\dots,d_n)$ 
$f(x_1,x_2,\dots,x_n)$

Looking back over my own writing I find that when typesetting a list within a sentence I have used both forms and not been consistent—and no copy editor has ever queried it. Does it matter? Not really. But in future I will try to follow Knuth’s advice.