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.

Punctuating Lists

ID-10094157-mod.jpg
Image courtesy of Stuart Miles at FreeDigitalPhotos.net.

Lists are common in all forms of writing. The list items can be included within the text or put on separate lines. Separate lines are used in order to draw attention to the items, to ease reading when the items are long or numerous, or to facilitate cross-reference to specific items.

The two main types of lists are enumerated lists, in which the items are numbered or labelled alphabetically, and itemized lists, in which each entry is preceded by a marker such as a bullet symbol. In \LaTeX these are produced by the enumerate and itemize environments, respectively. (The basic enumerate environment allows only numbers as labels, but the enumerate package extends the environment to allow letters, too.)

I have long felt unsure about how to punctuate lists, and especially the sentence that introduces the list. Advice is hard to find in books on English usage and there seems to be no agreed way to do it. Some recent reading, namely of the TUGboat article Makings Lists: A Journey Into Unknown Grammar by James. R. Hunt and the book Making a Point: The Pernickity Story of English Punctuation by David Crystal, has clarified my thinking. I will now explain how I intend to format lists in future.

My approach is based on a key principle, which stems from the fact that in English all sentences must be complete, and not mere fragments. (There is no universally agreed definition of what distinguishes a sentence from a fragment, but a sentence is usually required to contain a verb.) The principle is that

if the labels in a list are removed then what remains should make one or more complete and correctly punctuated sentences.

Here are three examples that are correctly formatted according to this principle.

Example 1. Programming languages from three decades will be compared:

  • C++ (1985),
  • Python (1991), and
  • Julia (2012).

This type of list could readily be collapsed inline into a regular sentence: “Programming languages from three decades will be compared: C++ (1985), Python (1991), and Julia (2012).” The author must judge whether the list form, with its clearer separation of the items, is preferable. Note the “and” after the second item. This is needed, though I think many people would find the example acceptable without it.

Example 2. We used three different algorithms in the experiments. The table reports the performance of

  • Algorithm 3.1 (based on a Taylor series),
  • Algorithm 3.2 (with parameter k = 1), and
  • Algorithm 3.3 (with tolerance 10^{-8}).

The sentence that precedes the list does not end with a colon. If it did, then the principle would be violated.

Example 3. Before printing the paper carry out the following steps.

  1. Run the paper through \LaTeX.
  2. Run the paper through BibTeX.
  3. Repeat steps 1 and 2 until no warnings occur about unresolved references.

In this example each list element is a complete sentence. The numbering of the elements is appropriate because they have a definite order. In some other list in which the ordering is arbitrary one might nevertheless decide to number the elements in order to be able to refer to the elements later on.

The next example does not conform to the principle.

Example 4. We will use three test matrices.

  • rosser: a classic symmetric matrix with close and repeated eigenvalues,
  • hilb: the Hilbert matrix, and
  • pascal: a matrix with elements taken from Pascal’s triangle.

If we remove the list markers then the list items turn into a sentence fragment containing no verb. I suspect few people would object to the formatting of this example. But we can easily modify it to conform.

Example 4 (modified). We will use three test matrices:

  • rosser, a classic symmetric matrix with close and repeated eigenvalues;
  • hilb, the Hilbert matrix; and
  • pascal, a matrix with elements taken from Pascal’s triangle.

Note the use of the semicolons to separate the items, which now contain commas. I much prefer the modified example, although in the past I might have been happy with the original.

Of course, style guidelines for individual publications may override what I have said above. However, my experience is that academic publishers tend not to change authors’ lists unless they are clearly grammatically incorrect. For example the SIAM Style Manual advises copy editors “Retain the author’s list style as long as it’s consistent”.

Finally, I note that the The Princeton Companion to Applied Mathematics follows the principle recommended here, though that is purely a coincidence. I did not think about list punctuation at all while working on the book, leaving it in the hands of copy editor Sam Clark (T&T Productions, London).

More Tips on Book and Thesis Writing

Following my earlier post Top Five Tips on Book Writing, here are seven more tips. These apply equally well to writing a thesis.

090826-0010-22-7268.jpg
Book sculpture at Fudan University, Shanghai.

1. Signpost Citations

In academic writing we inevitably include a fair number of citations to entries in the bibliography. In a book, even more so than in a paper, we do not want the reader to have to turn to the bibliography every time a citation is reached in order to understand what is being cited. So a sentence such as

The matrix logarithm appears in a wide variety of applications
[2], [8], [14].

is better phrased as the more informative

The matrix logarithm appears in a wide variety of applications,
such as reduced-order models [2], image registration [8],
and computer animations [14].

Likewise, instead of

Versions of the algorithm have been developed by several authors
[1], [3], [7].

I would write

Versions of the algorithm have been developed by Chester [1], 
Hughes [3, Sec. 2], and Smith and Jones [7].

Even that example lacks information about the date of publication. In my books I have used my own version of the \LaTeX \cite macro that allows me to include the year:

Versions of the algorithm have been developed by Baker and
Chester [1, 2006], Hughes [3, 2001, Sec. 2], 
and Smith and Jones [7, 2004].

The macro is

\def\ycite[#1#2#3#4#5]#6{\cite[$\mit{#1#2#3#4}$#5]{#6}}

(which puts the year in the distinctive math italic font) and the first two citations in the previous sentence would be typed as \ycite[2006]{bach06} and \ycite[2001, Sec.~2]{hugh01}.

2. Produce a Good Index

A good index is essential, since it is the main way that readers can find content. The vast majority of books that I read have an inadequate index, as I have noted in my post A Call for Better Indexes at SIAM Blogs. Usually the index is too small. Occasionally the index is of about right length but is flawed. The main problems are

  • Items that should be indexed are absent from the index.
  • An index entry does not point to all (significant) occurrences of the term.
  • Related entries are not grouped properly.

Advice on producing an index can be found in Section 13.4 of my Handbook of Writing for the Mathematical Sciences and various other sources (try a Google search), and I intend to wrote a post on indexing soon.

\LaTeX, through its \index command, used in conjunction with the MakeIndex program, provides an excellent way to produce an index.

3. Use the Backref \LaTeX package

Backref.sty is a \LaTeX package that adds to each bibliography entry the text “cited on pages” and then lists the pages on which that item was cited. It costs nothing to use it, but it adds great value to the bibliography, which then functions as a separate index into the book. I started using backref with my book MATLAB Guide (2005). To a large extent it removes the need for an author index, and if I do a third edition of Accuracy and Stability of Numerical Algorithms I will probably use backref and drop the author index.

The backref package is not widely used, though a number of SIAM books have made use of it.

4. Use Hyperlinks

For a book provided in PDF form, hyperlinks from an equation reference to the equation, a citation to the bibliography entry, a URL to the web page, and so on, are a great aid to the reader. In \LaTeX obtaining the hyperlinks is usually just a matter of adding \usepackage{hyperref} in the pre-amble.

5. Make Figures Readable and Consistent

It’s very easy nowadays to produce figures containing plots of functions or computational results. But it’s much harder to produce a set of figures that

  • are clearly legible,
  • have labels, legends, and annotations that are of similar size to the main text,
  • are consistent in format (axes, line thicknesses etc.)

All too often I see figures in which the text is so small that I cannot read it at a normal reading distance. My experience (which is mainly with MATLAB, and with the \LaTeX packages TikZ and PGFplots) is that it is a time-consuming process to produce high quality plots. But it is worth the effort.

6. Use Short Captions in the List of Figures/Tables

The general form of the \LaTeX caption command is \caption[short caption]{long caption}. The short caption is what is printed in the List of Figures or List of Tables at the front of the book, if you are printing those lists. The short caption will be read in isolation from the figure or table so it should omit all unnecessary detail, such as explaining line or marker types. All too often, the short and long captions are the same, resulting in unnecessarily long and detailed lists of figures or tables.

Here is an example (simplified, with other macros removed) of the caption from a figure in my book Functions of Matrices:

\caption[Illustration of condition (b) of Theorem~11.4.]%
        {Illustration of condition (b) of Theorem~11.4,
         which requires every eigenvalue of $B$ to lie in the
         open half-plane (shaded) of the corresponding eigenvalue
         of $A^{1/2}$.}

7. Make the Header Contain the Section and Chapter Number and Title

I like to know where I am when I am reading a book, so I expect the page headers to tell me the section number and chapter number, and preferably their titles as well. I cannot understand why some books omit this information. Without it, phrases such as “as discussed in the previous chapter” become harder to follow up, and searching for a particular section is more difficult.

Top Five Tips on Book Writing

Snoopy writing

I’ve written four books, and am currently writing and editing a fifth (The Princeton Companion to Applied Mathematics). I am also an editor of two SIAM book series and chair the SIAM Book Committee. Based on this experience here are my top five tips about writing an (academic) book. These cover high level issues. In a subsequent post I will give some more specific tips relating to writing and typesetting a book or thesis.

1. Identify Your Audience

Book publishers ask prospective authors to complete a proposal form, one part of which asks who is the audience for the book. This is a crucial question that should be answered before a book is written, as the answer will influence the book in many ways.

As an example, you might be contemplating writing a book about the numerical solution of a certain class of equations and intend to include computer code. Your audience might be

  • readers in mathematics or a related subject who wish to learn about numerical methods for solving the equations and are most concerned with the theory or algorithms,
  • readers whose primary interest is in solving the equations and who wish to have lots of sample code that they can run,
  • readers in the previous class who also need to learn the language in which the examples are written.

The choice of content, and how the book is presented, will depend very much on which audience you are writing for.

2. Revise, Revise, Revise

Just like a paper, a book draft needs to go through multiple revisions, and you must not be afraid to make major changes at any stage. You may receive constructive criticisms from reviewers of your book proposal, but reviewers may not have time to read the complete manuscript carefully and you should not assume that they have found all errors, typos, and areas for improvement.

3. Take Time to Choose Your Publisher

Given the huge effort that goes into writing a book you should take the time to find the right publisher. Discuss your book with several publishers and compare what they can offer in the way of

  • format (hardback, paperback, electronic) and, if more than one format, the timescale in which each is made available,
  • if the publisher has branches in more than one country, how price and publication schedule will differ between the countries,
  • whether you are allowed to make a PDF version of the book freely available on your website, if this interests you,
  • willingness to allow you to choose the book design (page size, font, cover, etc.),
  • use of colour (which increases the cost),
  • royalties (including a possible advance),
  • pricing,
  • the publisher’s policy on translations,
  • copy editing (see the next section),
  • time from delivering a completed manuscript to publication,
  • marketing (will the book be advertised at all, and if so how?), and
  • how long your book is guaranteed to stay in print.

It is perfectly acceptable to submit a proposal to several publishers and see what they are willing to offer. However, it is only fair and proper to make clear to a publisher that you are talking to other publishers and, once you have set the wheels of a publisher’s review process in motion, to wait for an offer before making a decision to go with another publisher.

I am always surprised when I hear of authors who approach only one publisher, or who go with the first publisher to express an interest in the book. As in many contexts, it is best to make an informed choice from among the available options.

4. Ensure Your Book is Copy Edited

If you are an inexperienced writer, or your first language is not English, the benefits of copy editing are obvious. But even an experienced author finds it virtually impossible to think about all the little details that a copy editor will check for, such as correctness and consistency of spelling, notation, punctuation (notably the serial comma), citations, and references. For example, I sometimes mix US and UK spellings and don’t want to have to worry about finding and correcting my occasional lapses. A good copy editor will also suggest minor improvements of the text that might escape even the best writers.

Unfortunately, not all publishers copy edit all books nowadays. Notable exceptions that always do copy edit (and, as I know from experience, work to the highest standards in every respect) are Princeton University Press and SIAM.

If your publisher has a Style Manual it obviously makes sense to follow its guidelines in order to minimize changes at the copy editing stage. Here is a link to the SIAM Style Manual.

5. Think Twice Before Co-Authoring a Book

It might seem an attractive proposition to share authorship of a book: surely having n co-authors reduces the work by a factor 1/n? Unfortunately it often does not work out like that, despite best intentions. In fact, n co-authors can easily take n times as long to write a book as any one of them would. One of the biggest difficulties is timescale: one author may be willing and able to finish a book in a year but another may need twice that period to make their contribution. Indeed it is rare for the co-authors to be matched in the amount of effort they can put into the book; this is clearly problematic if initial expectations are not realized. Other potential problems are potentially differing opinions on content, notation, level, length, and almost anything else associated with a book.

Successful authorship teams often have a track record of co-authoring papers together. Although it is no guarantee that a much larger book project will run smoothly, experience with writing papers together will at least have given a good indication of where disagreements are likely to lie.

The Spotlight Factor

In my Handbook of Writing for the Mathematical Sciences I described the spotlight factor, originally introduced by Tompa in 1989. The spotlight factor is defined for the first author of a paper in which there are n authors listed alphabetically, and it is assumed that the paper is from a community where it is the custom to order authors alphabetically.

The spotlight factor is the probability that if n-1 coauthors are chosen independently at random they will all have surnames later in the alphabet than the first author. This definition is not precise, since it is not clear what is the sample space of all possible names, so it is better to regard the spotlight factor as being defined by the formula given by Tompa, which is implemented in the MATLAB function below.

The smallest spotlight factor I have found is the value 0.0244 for Zielinski, for the paper

Pawel Zielinski and Krystyna Zietak, The Polar Decomposition—Properties, Applications and Algorithms, Applied Mathematics, Ann. Pol. Math. Soc. 38, 23-49, 1995

This beats the best factor of 0.0251 reported by Tompa in a 1990 follow-up paper.

Can you do better?

Here is a MATLAB M-file to compute the spotlight factor, preceded by an example of its usage:

>> spotlight('zielinski',1)
ans =
   2.4414e-02
function s = spotlight(x, k)
%SPOTLIGHT   Tompa's spotlight factor of authorship.
%   SPOTLIGHT(X, K) is the spotlight factor for the author whose 
%   last name is specified in the string X, with K coauthors.
%   Mixed upper and lower case can be used.
%   Smaller spotlight factors correspond to rarer events.

%   Reference:
%   Martin Tompa, Figures of Merit, SIGACT News 20 (1), 62-71, 1989

if ~ischar(x), error('First argument must be a string.'), end
if nargin < 2, error('Must give two arguments.'), end

x = double(upper(x)) - double('A') + 1;
x( find(x < 0 | x > 26) ) = 0;  % Handle punctuation and spaces.

s = 0;

% Ideally use Horner's rule, but the following is clearer.

for i=1:length(x)
    t = x(i);
    s = s + t/27^i;
end

s = (1 - s)^k;