Contents
This document discusses LaTeX math font selection, suitable math letter fonts for the ISO math style, and the relation of LaTeX and Unicode mathematical typesetting.
There are three complementary methods to set font attributes in LaTeX math mode: [fntguide] describes math alphabets and math versions, several extension packages provide alternative math styles (cf. Table 2).
Math alphabets are a counterpart to the mathematical alphanumeric symbols block in Unicode. Both are “to be used for mathematical variables where style variations are important semantically”. The font guide [fntguide] defines in section 3:
Some math fonts are selected explicitly by one-argument commands such as \mathsf{max} or \mathbf{vec}; such fonts are called math alphabets.
Math fonts [...] have the same five attributes as text fonts: encoding, family, series, shape and size. However, there are no commands that allow the attributes to be individually changed. Instead, the conversion from math fonts to these five attributes is controlled by the math version.
The predefined math alphabets are:
\mathnormal
default1
\mathrm
roman2
\mathbf
bold roman
\mathsf
sans serif
\mathit
text italic
\mathtt
typewriter
\mathcal
calligraphic
\mathnormal is used by default for alphanumeric characters in math mode. It sets the letter shape according to character class and math style. (Table 1 shows the default letter shapes for common math styles).
The specifier “roman” is ambiguous: roman shape stands for upright, while roman type stands for serif (as opposed to sans serif).
Many packages define additional math alphabets (cf. Table 5).
In contrast to the similar named text commands, math alphabets are not orthogonal, e. g., the code $\mathit{\mathbf{a}}$ sets the letter a in upright bold type.
The number of mathematical symbols exceeds the maximal number of characters in a TeX font file by an order of magnitude.3 Grouping math fonts with common characteristics in math versions simplifies the setting of font attributes for mathematical expressions.
Math versions set up “math symbol fonts” for non-alphanumeric symbols and bind the math alphabet commands to fonts using default values for non-specified font attributes. TeX limits the number of (symbol + alphanumeric) fonts per math version to 16.
The predefined math versions are normal and bold with the defaults:
normal
bold
type
serif
serif
weight
medium
bold
shape
upright
upright
Packages can define additional math versions, e. g., the wrisym package defines a mono math version. A sans math version example is available from a comp.text.tex post
Math versions are intended for mathematical content in a special context, e. g., a bold section heading. Setting a math version resembles the individual selection of text font attributes (bold, sans-serif, monospaced).
Math versions can only be changed outside of math mode. The commands \boldsymbol (amsmath) and \bm (bm) behave like “in-line math versions”: they typeset their argument using the fonts of the bold math version but can be used inside math mode.
Example: four ways to set the letter a in a bold sans-serif font:
% Text Math: \textbf{\textsf{a}} $\bm{\mathsf{a}}$ \bfseries \textsf{a} \mathversion{bold} $\mathsf{a}$
Unicode provides about 2500 math characters. Font files used by 8-bit TeX engines can hold up to 256 characters. The standard math fonts adhere to the original limit of 128 characters.
A math style is a document-level feature that determines the default letter shape in math mode (i. e. the shape attribute of letters in the \mathnormal math alphabet).
math style |
latin |
Latin |
greek |
Greek |
---|---|---|---|---|
TeX |
it |
it |
it |
up |
ISO |
it |
it |
it |
it |
French |
it |
up |
up |
up |
upright |
up |
up |
up |
up |
LaTeX defaults to the “TeX” math style (without naming it such). Alternative math styles are introduced by extension packages (Table 2).
math style |
Package |
Option(s) |
---|---|---|
ISO |
||
slantedGreeks |
||
math-style=iso |
||
greekuppercase=italicized |
||
slantedGreek |
||
slantedGreek |
||
math-style=ISO |
||
French |
upright |
|
frenchstyle (or upright) |
||
math-style=french |
||
uppercase=upright, greeklowercase=upright |
||
math-style=french |
||
upright |
||
math-style=upright |
||
math-style=upright |
Unicode math alphabets contain Latin and Greek letters. With LaTeX, this is simplest achieved with a font that contains all required letters in one file.
There is only one established LaTeX font encoding that contains Latin and Greek letters, the OML font encoding. The standard Greek font encoding T7 is just a “reserved name” and the de-facto standard Greek text font encoding LGR has no Latin letters. Unfortunately, OML support is limited to a few (mostly italic) fonts.
The LaTeX font encodings guide [encguide] names the OML encoding TeX math italic and defines:
The OML encoding contains italic Latin and Greek letters for use in mathematical formulas (typically used for variables) together with some symbols.
The reference to italic shape is odd:
No other font encoding is specific to the font shape.
The different font selection and the semantic of font features in math do not interfere with the font encoding: Both, \DeclareSymbolFont and \DeclareMathAlphabet require a shape argument. Thus it is possible to set up OML encoded math alphabets in roman {n} as well as italic {it} shape without conflicts.
This seems to be more a remnant of pre-NFSS times than a necessary restriction – there is only one OML encoded font in Knuth's Computer Modern fonts: Computer Modern Math Italic (cmmi).
Proposals:
Drop the italic from the definition. Optionally add an explanation:
The OML encoding contains Latin and Greek letters for use in mathematical formulas (typically used for variables) together with some symbols. It first appeared in the Computer Modern Math Italic (cmmi) font.
The name TeX math italic can be interpreted as “the encoding of Computer Modern Math Italic” rather than “an encoding for math italic” fonts.
A less confusing name would be TeX math letters or Original/Old Math Letters. The latter would also explain the acronym OML.
Unfortunately, support for the OML encoding is missing for many font families even if the text font defines Greek letters. Supported font families can be found searching for oml*.fd files and grepping for DeclareFont.*OML in *.sty files.
Table 3 lists the findings for a selection of TeXLive 2009 + some additionally installed font packages.
If there is an alias (substitution) from the text font to a math-variant, only the text font is listed.
Many text fonts define substitutions also for upright shape, however mapping to an italic variant of the OML encoded font. These are not listed as supporting m/n or bx/n here.
Name |
Family |
m/it |
bx/it |
m/n |
bx/n |
---|---|---|---|---|---|
aer |
AE (Almost European) |
✓ |
✓ |
||
antt |
Antykwa Torunska |
✓ |
✓ |
||
cmr |
Computer Modern Roman |
✓ |
✓ |
||
ccr |
Concrete |
✓ |
✓ |
||
cmbr |
Computer Modern Bright |
✓ |
✓ |
||
hlh |
Lucida |
✓ |
✓ |
||
hfor |
CM with old-style digits |
✓ |
✓ |
||
iwona |
Iwona (sans serif) |
✓ |
✓ |
||
jkp |
Kepler Serif |
✓ |
✓ |
||
jkpl |
Kepler Serif |
✓ |
✓ |
||
jkpvos |
Kepler Serif |
✓ |
✓ |
||
jkplvos |
Kepler Serif |
✓ |
✓ |
||
llcmm |
LX Fonts (sans serif) |
✓ |
✓ |
||
lmr |
Latin Modern Roman |
✓ |
✓ |
||
mak |
Kerkis |
✓ |
|||
kurier |
Kurier |
✓ |
✓ |
||
mdbch |
Math Design Charter |
✓ |
✓ |
✓ |
✓ |
mdput |
Math Design Utopia |
✓ |
✓ |
✓ |
✓ |
mdugm |
Math Design Garamond |
✓ |
✓ |
✓ |
✓ |
neohellenic |
GFS Neohellenic |
✓ |
|||
plcm |
CM (PLaTeX) |
✓ |
|||
ptmom |
Times (Omega or MB-Times) |
✓ |
✓ |
||
ptmomu |
Times (Omega or MB-Times) |
✓ |
✓ |
||
ptmcm |
Times (psfont) |
✓ |
|||
pxr |
Palatino (pxfonts) |
✓ |
✓ |
||
qpl |
Palatino/Pagella (qpxmath) |
✓ |
✓ |
||
qtm |
Times/Termes (qtxmath) |
✓ |
✓ |
||
txr |
Times (txfonts) |
✓ |
✓ |
||
udidot |
Didot (gfsdidot) |
✓ |
|||
ywclm |
(greektex) |
✓ |
✓ |
||
zavm |
Arev (Vera Sans-Serif) |
✓ |
✓ |
||
zesfcm |
(efont) |
✓ |
|||
zplm |
Palatino (mathpazo) |
✓ |
✓ |
||
zpple |
Palatino |
✓ |
✓ |
||
ztmcm |
Times (mathptmv) |
✓ |
|||
zer |
Computer Modern (zefonts) |
✓ |
✓ |
This section compares math font selection in LaTeX and Unicode. It suggests a set of 14 math alphabets that covers all Unicode mathematical alphanumeric symbols and discusses compatibility issues between math typesetting with traditional (8-bit) TeX engines versus the unicode-math package for Unicode-enabled TeX engines (XeTeX, LuaTeX).
Chapter 2 Mathematical Character Repertoire of [tr25] lists 14 Mathematical Alphabets in Table 2.1. These mathematical alphabets are a superset of the predefined math alphabets in the LaTeX core.
Unicode assignes code points to most letters of the mathematical alphabets in the mathematical alphanumeric symbols Unicode block. The plain (upright, serifed) letters have been unified with the existing characters in the Basic Latin and Greek blocks.
Table 4 maps the 14 Unicode mathematical alphabets to LaTeX commands according to the naming scheme below. Table 5 lists the status of LaTeX support for the mathematical alphanumeric symbols. Full support is provided by the unicode-math package.
serifs |
weight |
shape |
symbols |
math alphabet |
---|---|---|---|---|
serif |
medium |
upright |
Latin/Greek/digits4 |
\mathrm |
bold |
Latin/Greek/digits |
\mathbf |
||
italic |
Latin/Greek |
\mathit |
||
bold |
italic |
Latin/Greek |
\mathbfit |
|
script |
Latin |
\mathcal |
||
bold |
script |
Latin |
\mathbfcal |
|
fraktur |
Latin |
\mathfrak |
||
double-struck |
Latin/digits |
\mathbb |
||
bold |
fraktur |
Latin |
\mathbffrak |
|
sans serif |
Latin/digits |
\mathsf |
||
sans serif |
bold |
Latin/Greek/digits |
\mathsfbf |
|
sans serif |
italic |
Latin |
\mathsfit |
|
sans serif |
bold |
italic |
Latin/Greek |
\mathsfbfit |
monospace |
Latin/digits |
\mathtt |
The naming scheme is an extension of the predefined math alphabet commands with the established short-cuts:
bf
bold
it
italic
cal
script (calligraphic)
frak
fraktur
bb
double-struck (blackboard bold)
sf
sans serif
combined to commands in the form \math<type><weight><shape>.
The <type>, <weight>, and <shape> specifiers are optional (defaults depend on the math version). Their order matches the names of Unicode Mathematical Alphanumeric Symbols.
Examples:
\mathbf{d} % MATHEMATICAL BOLD SMALL D \mathsfbfit{d} % MATHEMATICAL SANS-SERIF BOLD ITALIC SMALL D.
style |
math alphabet |
package, comment |
---|---|---|
plain4 |
\mathrm |
predefined5 |
\mathup |
||
bf |
\mathbf |
predefined5 |
it |
\mathit |
predefined5 |
bf it |
\mathbfit |
isomath6 |
\mathbold |
||
\boldsymbol |
||
\bm |
||
cal |
\mathcal |
predefined7 |
\mathscr |
||
bf cal |
\mathbfscr |
|
frak |
\mathfrak |
|
bf frak |
\mathbffrak |
|
bb |
\mathbb |
|
\mathbbm |
||
\mathds |
dsfont (doublestoke) |
|
sf |
\mathsf |
predefined5 |
sf bf |
\mathbfsfup |
|
sf it |
\mathsfit |
isomath6 |
sf bf it |
\mathsfbfit |
isomath6 |
\mathbold |
||
\mathbfsfit |
||
tt |
\mathtt |
predefined5 |
no small Greek, full Greek with possible with OML encoded fonts (omlmath*.sty auxiliary styles or OMLmath* options to isomath).
Some italic math fonts (e. g., cmr, cmbr) have old-style numbers in place of italic digits. As there are no math italic digits in Unicode, this is no problem when mapping Unicode symbols to math alphabets.
Users of UTF-8 enabled TeX engines (XeTeX, LuaTeX) can typeset mathematics with the experimental unicode-math package by Will Robertson. It provides a LaTeX interface to OpenType fonts with math support, e. g., Asana Math, Cambria Math, New Euler or XITS, with commands to access the complete mathematics character repertoire of the Unicode Standard
The three math font selection methods also work with unicode-math (with some modifications):
math alphabets map to a range of the mathematical alphanumeric symbols block in the current font (or a substitution defined with the range math font option).
Some command names differ from the predefined math alphabets or the above naming scheme:
LaTeX |
unicode-math |
---|---|
\mathbf |
\mathbfup |
\mathsf |
\mathsfup |
\mathsfbf |
\mathbfsfup |
\mathsfbfit |
\mathbfsfit |
With unicode-math, \mathbf, \mathsf, and \mathbfsf behave similar to “in-line math versions”: they consider the math style for upright vs. italic shape. Compatibility can be achieved via the options bold-style=upright and sans-style=upright. However, then also literal Mathematical Alphanumeric Characters like MATHEMATICAL BOLD ITALIC CAPITAL A are typeset upright.
In \mathbfsf and \mathbfsfit the order of the sf and bf selectors deviates from the order in the Unicode names, so that, e. g., the Unicode character MATHEMATICAL SANS-SERIF BOLD ITALIC CAPITAL A is selected by the non-mnemonic \mathbfsfit{A}.
A similar "confusion" of the order can be seen in XML Entity Definitions for Characters that lists the following alphabets for Mathematical Alphanumeric Characters:
XML Entity Definitions for Characters |
Unicode name |
---|---|
Bold (Serif) |
BOLD |
Italic or Slanted |
ITALIC |
Bold Italic or Slanted |
BOLD ITALIC |
Double Struck (Open Face, Blackboard Bold) |
DOUBLE-STRUCK |
Script (or Calligraphic) |
SCRIPT |
Bold Script |
BOLD SCRIPT |
Fraktur |
FRAKTUR |
Bold Fraktur |
BOLD FRAKTUR |
Sans Serif |
SANS-SERIF |
Bold Sans Serif |
SANS-SERIF BOLD |
Slanted Sans Serif |
SANS-SERIF ITALIC |
Slanted Bold Sans Serif |
SANS-SERIF BOLD ITALIC |
Monospace |
MONOSPACE |
math versions are not directly supported but easy to emulate.
As Unicode fonts can hold all math symbols in a single font file, a single \setmathfont[<font features>]{<font name>} can replace the \mathversion{<mathversion>} command if a complete OpenType math font in the desired version is available.
However, complete OpenType math fonts are rare. Therefore unicode-math supports using multiple fonts with the range option. This way one can emulate, e. g., the bold math version via:
\renewcommand{\boldmath}{% \setmathfont{XITS Bold}% \setmathfont[range={"1D400-"1F020}]{XITS Math}% \setmathfont[range=\mathup->\mathbfup]{XITS Math}% \setmathfont[range=\mathsfit->\mathbfsfit]{XITS Math}% % ... }
It would be nice if unicode-math could provide a \newmathversion command similar to the \newfontfamily in fontspec for such setups.
For alphanumerical characters, the \mathbf, \mathsf, and \mathsfbf behave like “in-line math versions”.
math styles are supported with the math-style package option that accepts the values TeX, ISO, french, upright, and literal.
lists differences between math symbol commands in «traditional» LaTeX and the unicode-math package.
Frank Mittelbach, Robin Fairbairns, Werner Lemberg, LaTeX3 Project Team, LaTeX font encodings: http://mirror.ctan.org/macros/latex/doc/encguide.pdf.
LaTeX3 Project Team, LaTeX 2e font selection: http://mirror.ctan.org/macros/latex/doc/fntguide.pdf.
Barbara Beeton, Asmus Freytag, Murray Sargent III, Unicode Support for Mathematics, Unicode Technical Report #25: http://www.unicode.org/reports/tr25/.
Barbara Beeton: Unicode and math, a combination whose time has come – Finally!, TUGBoat, 21#3, 2000: http://www.tug.org/TUGboat/Articles/tb21-3/tb68beet.pdf.