# math calligraphic

## Using math calligraphic or script fonts in mkiv

In mkii it is possible to replace the standard calligraphic (alias script) math fonts with rsfs (Ralph Smith's Formal Script fonts): see the dedicated page on this wiki [1].

However this old method does not work in mkiv where there is a more robust way to use any opentype or truetype font. Indeed in mkiv it is rather easy to specify any such font to be used for the calligraphic (alias script) math fonts. For instance let us assume that we want to use math calligraphic fonts from Asana Math, while other glyphs come from Latin Modern. To do so, use the following setups:

\definefallbackfamily[mainface][math][Asana Math][range={uppercasescript,lowercasescript}]

\definefontfamily [mainface] [rm] [Latin Modern]
\definefontfamily [mainface] [math] [Latin Modern Math]

\setupbodyfont[mainface]

\starttext
${\cal ABCDEFGHIJKLMNOPQRSTUVWXYZ}$

${\cal abcdefghijklmnopqrstuvwxyz}$

The space of distributions on $\Omega$ is denoted by ${\cal D}'(\Omega)$, while ${\cal S}({\Bbb R}^n)$ is the space of Schwartz functions, and ${\cal S}'({\Bbb R}^n)$ is its dual.
\startformula
\langle T,\phi \rangle_{{\cal D}'(\Omega),{\cal D}(\Omega)}
\stopformula
The set of admissible controls is denoted by ${\cal U}_{\rm ad}$.
\stoptext


Here, the command

\definefallbackfamily[mainface][math][Asana Math][range={uppercasescript,lowercasescript}]


tells mkiv that the fallback font for mainface in math mode comes from Asana Math, as far as the slots of lowercase and uppercase calligraphic (or script) glyphs are concerned.

If one wishes to use for instance Palatino instead of Latin Modern as the text font, as well as the font used in math mode, it is enough to replace the two lines

\definefontfamily [mainface] [rm] [Latin Modern]
\definefontfamily [mainface] [math] [Latin Modern Math]


with

\definefontfamily [mainface] [rm] [TeX Gyre Pagella]
\definefontfamily [mainface] [math] [TeX Gyre Pagella Math]


since « Palatino » is in fact an alias for TeX Gyre Pagella.