66

I'm trying to come up with a typographically appealing way to express "special" numbers such as the complex unit i = sqrt(-1) or Euler's number e. It has to be such that it cannot be confused with regular numbers (such as the running index i, for example), and would ideally work for serif as well as sans-serif fonts.

I was briefly thinking of typesetting these numbers in bold, but found that bold face is often used to indicate vector quantities.

[Edit: Johannes Küster suggests to use upright for constants (about 14 minutes into his talk).]

I've seen double-stroked small letters too, and must say this isn't without appeal. I have no idea how to consistently typeset those, though. The (outdated?) bbm package seems to provide at least some basic functionality.

What do you use to represent special numbers, why do use it, and how to you typeset your solution?

10
  • 10
    Whatever you choose, you should be consistent about it and therefore create a macro for their presentation (see Consistent typography). For example, \newcommand{\complex}{\mathbbm{i}}. There should be no need for \ensuremath, since you'll most likely use these "mathematical elements" inside math mode anyway/mostly.
    – Werner
    Commented May 31, 2012 at 22:45
  • 3
    Perhaps the dotless i \newcommand*{\I}{\imath} and upright for e: \newcommand*{\E}{\mathrm{e}}? Commented May 31, 2012 at 22:59
  • 2
    Related question: Upright Lowercase \pi Commented May 31, 2012 at 23:04
  • 9
    I've seen tons of math books where those "special" numbers don't get any special treatment at all: just italics. I'd be adamant about excluding double stroked fonts.
    – egreg
    Commented May 31, 2012 at 23:08
  • 3
    @Caramdir If you feel that confusion can arise, don't use i for indexing. My experience tells me that usually there's no harm in using i for both meanings.
    – egreg
    Commented May 31, 2012 at 23:15

8 Answers 8

38

Consistency is the primary goal. So the first task is to know what "special numbers" we need and define commands for them:

\newcommand{\euler}{e}
\newcommand{\ramuno}{i}

(ramuno was how some Italian mathematicians of the 16th century called the quantity that squared gives –1; then Euler started using i).

The mathematical typography tradition usually didn't have a special treatment of these symbols. See, for example, n. 359 in Gauss's Disquisitiones Arithmeticae, where the equivalent of

$\cos\frac{\lambda kP}{e} + i\sin\frac{\lambda kP}{e}$

is found (the edition I consulted is from the Werke by the Königlichen Gesellschaft der Wissenschaften in Göttingen, vol. 1, 1863, page 450). There's no doubt what this i is denoting.

enter image description here

http://gdz.sub.uni-goettingen.de/dms/load/img/?PPN=PPN235993352&IDDOC=137206

However, in recent times, under the influence of physics and applied mathematics, people started to denote "constants" with upright letters. There's even an ISO regulation about this, which is compulsory in some fields where uniformity among papers and books is very important.

In pure mathematics there's essentially no rule. Do as you like or how your field is used to. Using special names for the special numbers allow you to change the appearance of your document just by changing the definition.

If you feel that there may be confusion between the "imaginary unit" (no worse name could be chosen for it) and an index (for summations, for instance), you have three strategies:

  1. use a special denotation for the imaginary unit;

  2. don't use i as an index;

  3. forget about it and let the reader know from the context.

Strategy 2 is used by Graham, Knuth and Patashnik in their "Concrete Mathematics". Strategy 3 is very common in math textbooks.

23

Unicode has special glyphs for these symbols: 0x2148 for imaginary i, 0x2149 for imaginary j, 0x2107 for Euler's constant, etc (although on most fonts they look ugly).

If you are using a unicode aware engine and a opentype math font, you can just type these directly or use the corresponding macro for them (ConTeXt uses \imaginaryi, \imaginaryj, \Eulerconst, etc.; I don't know what names unicode-math package for LaTeX uses).

EDIT: I don't know whether \Eulerconst refers to "Euler's number" e or not. As pointed out by Caramdir, it not used frequently.

4
  • 6
    unicode-math defines them as \mitBbbe, \mitBbbi and \mitBbbj. You can see them with texdoc unimath-symbols, listed under “Ordinary symbols”. Note that the Euler constant (\Eulerconst in unicode-math) is not the same as the Euler's number (=natural exponent exp(1)).
    – Caramdir
    Commented Jun 1, 2012 at 4:15
  • 4
    Actually, I have never seen (ℇ U+2107) used anywhere; and Wikipedia seems to be confused about what it stands for. So better to stick to e and γ.
    – Caramdir
    Commented Jun 1, 2012 at 4:25
  • 2
    I looked into the Wikipedia and I don't know what 0x+2107 is supposed to represent. But it is strange that Unicode standard includes a separate slot for plank's constant, but not for Euler's number. The Unicode symbols for imaginary number, differential operator, probability, etc are not used too often because (a) until recently there were a few full unicode math fonts, and (b) their default implementations are ugly (though that is font dependent issue). I think that one should use the unicode input for these characters, the actual shape can be changed by patching the font on the fly.
    – Aditya
    Commented Jun 1, 2012 at 7:34
  • 1
    I believe the Unicode used for Euler's constant is U+1D452 = 𝑒 and it's in the Mathematical Alphanumeric Symbols block U+1D400 - U+1D7FF
    – mchid
    Commented Jul 27, 2020 at 9:14
17

Whenever I'm unsure about how I'll eventually want something to look, I'll create a \newcommand so that I can hope to control things globally.

In this particular case, I might define something like

\newcommand{\myspecial}[1]{\mathrm{#1}}

which could be used, for example, as

$\myspecial{e}$

(I wouldn't necessarily use \mathrm, it's just to demonstrate the idea).

Another reason I find this approach useful is that I can then easily grep the file to find all occurrences, something like

egrep 'myspecial' myfile.tex
2
  • 8
    I'd even go further and define separate macros for all the constants, in case I want to change just one of them.
    – Caramdir
    Commented May 31, 2012 at 23:04
  • @Caramdir good idea :)
    – cmhughes
    Commented May 31, 2012 at 23:04
8

How about reserving Sans Serif type for special numbers? Usually the main font is some kind of Roman, so displaying the imaginary unit in a non-italic Sans Serif would make a difference.

So, for example

\newcommand{\imagi}{\mathsf{i}} \newcommand{\myexp}{\mathsf{e}}

produce something like what there is in the screenshot

Sans Serif to distinguish special letters

I hope the letters are big enough to tell the difference

4
  • A full example would make this a real answer with some screenshot ;-)
    – user31729
    Commented Aug 4, 2014 at 12:07
  • @ChristianHupfer I am quite new in Stack Exchange, I will edit my answer to include the screenshot
    – Octania
    Commented Aug 4, 2014 at 16:09
  • If you are so new then Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Commented Aug 4, 2014 at 16:30
  • 1
    This approach will not work if the document font is sans-serif already (as common for presentations, for example). Commented Aug 7, 2014 at 12:34
6

Just use roman (\mathrm) for all non-variables. In particular, this includes standard operators, functions, and constants (such as $\mathrm{lim, sup; exp, ln; e, i}$) and can be extended to any mathematical object that has a unique fixed meaning, without needing any parameters to be specified, throughout a particular work in which it is defined.

4
  • 25
    Note that \mathrm{lim} is wrong with respect to spacing; use the predefined operator \lim (and the similar ones \sup, \exp and \ln).
    – egreg
    Commented Jun 3, 2012 at 14:12
  • @egreg: Good point! I was only trying to compile a list of names. I'm new to this site and my attempt didn't work too well anyway. It seems that MathJax doesn't operate here. Commented Jun 4, 2012 at 19:32
  • No, MathJax doesnt't work because we want to talk about (La)TeX code, so rendering it would not show the point! Welcome to TeX.SX!
    – egreg
    Commented Jun 4, 2012 at 19:57
  • And even in MathJax you can define mathematical operators :) Despite that - Welcome to TeX.SX
    – Ronny
    Commented Apr 4, 2014 at 7:32
4

This is more of an extended comment —

If your reader or audience quickly glances at your article/slide, will they be able to tell an i (the imaginary unit) from an i (a running index)? I would contend not. They may be able to avoid getting confused by considering the context or paying close attention to the typeface, but ideally they shouldn't have to.

Working in quantum informatics, this is a notational issue which arises all the time: we often use complex numbers and combinatorics simultaneously. Sometimes people make no distinction at all between indices and the imaginary unit, which is obviously not great. Occasionally someone decides to use \iota for the imaginary unit, which is not a real improvement over using just i. People who don't often write on the subject and are therefore less accustomed to using complex numbers will sometimes represent the imaginary unit explicitly as \sqrt{-1} (which looks terrible, especially if they occur several places in equations including exponents, please don't do this if you use the imaginary unit more than a couple of times).

After one time encountering the expression e^{2\pi iijk/N} in someone else's work, I made the choice to never, ever to use i as a running index if there is even the slightest chance of me using complex numbers in my article, notes, or slides. That goes for hand-written work as well. My indices start with either h or j, usually the latter. I've found that this is a good policy.

I similarly try to avoid using e for anything but Euler's constant, despite often writing about the edges of graphs — though at least I have \exp to use as a respectable alternative when I exponentiate. I'm not quite as adamant about that, as e is larger and easier to spot variation of typeface for, and because I can keep my uses of e as a non-constant well contained in practise.

Having said that, I make the imaginary unit and Euler's constant appear however I find most aesthetically pleasing. For me that is \mathrm e and plain-old i.

2
  • 2
    Where did you read the expression e^{2\pi iijk/N}? Very amusing! ^^ Commented Jun 7, 2014 at 11:55
  • @AlexanderFrei Looks when you change to momentum space in quantum mechanics, usually in discrete models or spin models. As a kind of fourier transform.
    – snulty
    Commented May 24, 2016 at 16:56
2

Sorry to chime in so many years later. I often like to use a different upright font for them. Here, for example, is Hermann Zapf’s Euler as a companion for (a clone of) his Palatino:

\documentclass[varwidth, preview]{standalone}

\usepackage{mathtools}
\usepackage{unicode-math}

\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont{TeX Gyre Pagella}[
  Scale=1.0,
  Ligatures={Common, Discretionary, TeX}]
\setmathfont{Asana Math}
\setmathfont[range={up/{Latin,latin,Greek,greek},
                    bfup/{Latin,latin,Greek,greek},
                    cal, bfcal, frak, bffrak},
              script-features={},
              sscript-features={}
            ]{Neo Euler}

\newcommand\upi{\symup{i}}
\newcommand\upe{\symup{e}}

\begin{document}
\begin{align*}
  \upe^{\upi x} &= \cos{x} + \upi \sin{x} \\
  \upe^{\upi \uppi} + 1 &= 0
\end{align*}
\end{document}

Palatino/Neo Euler sample

This can be done just as easily in PDFTeX, by loading the family zeur as a math alphabet.

Euler is also a good match for Optima, by the same designer. This is also a good use for the Upright Italic style of Computer Modern.

1

First off, since they are scalar constants (and not vectors) they should not be boldface. Furthermore, numeric constants such as values 0, 1, 2, .. are typeset upright, and not slanted like variables. Sans-serif styles seem to be reserved for tensor quantities in isomath when not in component form.

So use \mathrm{e} and \mathrm{i} or {\rm e} and {\rm i}

Example:

Example

PS. Example isomath pdf output

2
  • 3
    Note that two-letter font commands (\rm, \bf, etc.) are obsolete for more than 20 years now, so the \mathrm version should be used. Commented Oct 16, 2018 at 14:36
  • @PhelypeOleinik - there, I fixed it!!! Commented Oct 16, 2018 at 14:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .