GNU TeXmacsUser manualReferenceAboutEnglish
How mathematical fonts work
Text and mathematics go together

A document has one main font, and its formulas are set in the mathematical font which goes with it. The fonts are designed in pairs: the letters of a formula have the same shapes, weights and proportions as the surrounding text, so that \(x\) in a sentence and \(x\) in a displayed equation look like the same letter. Changing the main font of a document therefore changes its mathematics too. For most fonts TeXmacs also knows a sans serif and a typewriter companion of the same design, which serve sans serif and typewriter text as well as the sans serif and typewriter letters of formulas.

Three kinds of mathematical fonts
The TeX fonts

The default font of TeXmacs, Roman, is Knuth's Computer Modern with the mathematical fonts of TeX. Its symbols are drawn from several TeX fonts, and TeXmacs composes the large delimiters and the symbols which no font provides itself. The older Concrete and Euler new roman are of the same kind.

OpenType math fonts

Modern mathematical fonts carry a table, called MATH, which describes everything a formula needs: the position of scripts and limits, the thickness of fraction bars and radicals, the size variants of every delimiter and how to build one of any height from pieces, the italic corrections and the placement of accents. TeXmacs reads this table and lays out formulas as the designer of the font intended, as LaTeX does with the unicode-math package. Almost all the fonts of this section are of this kind.

Hand-tuned fonts

For STIX (the first version) and the four TeX Gyre fonts, TeXmacs has its own corrections, adjusted by hand before it could read the MATH table. They are still used, and the table only supplies what they do not cover. The preference Hand tuned math fonts, among the experimental features of the tab Other of the preferences (Edit\(\rightarrow\)Preferences, or TeXmacs\(\rightarrow\)Preferences on macOS), switches them off, to see what the table alone gives.

Choosing the fonts of a document

The simplest way is the font button of the focus toolbar, which shows the name of the main font of the document (for instance Roman) when the cursor is not inside any particular tag. Its menu sorts the fonts by design, in the submenus Serif, Sans serif, Typewriter and Decorative. The first two begin with a section With mathematics: Roman and the first STIX fonts among the serif ones, and the OpenType pairs, under the names LaTeX users know: Times for TeX Gyre Termes as with the newtx package, Palatino for TeX Gyre Pagella as with newpx, Utopia, Charter, Euler and so on. Fonts TeXmacs knows but which are less common are in a submenu Other OpenType math fonts. Every entry sets the text font, the mathematical font and, when the pair calls for it, the font family, and a menu lists only the fonts which are installed. The second section of a submenu, Text only, changes the text font alone.

A design which comes in several weights or widths is a submenu of its own, whose name says which variant the document has: IBM Plex offers Regular, Text, Light, Medium and Condensed, DejaVu a condensed width, Iwona, Kurier and the two Antykwa fonts light and condensed variants, and Latin Modern, among the typewriter fonts, its typewriter of variable width. A variant sets the whole document and has its own italic and its own bold. A weight which has no bold of its own is paired with a heavier weight of the design: the bold of IBM Plex Light is the semibold, the bold of Iwona Light the bold of Iwona. The mathematics stay those of the design.

The menus only name the fonts. Font design, at the end of the same menu, opens a page which shows them. Its top lists the parts of a document with the font of each: the text, the mathematics, the sans serif and the typewriter text, and the blackboard bold, calligraphic and fraktur letters of the formulas. The name of a part is a button, which shows under it the fonts the part may have, each with a few words, a sample of that part (the alphabet of a calligraphic font, the formulas of a mathematical one) and a button Choose, so that the text of one font may go with the mathematics of another and the calligraphic letters of a third; a part which has no font of its own follows the text font. The top of the page lists the choice and shows a sample of it; Use for the document gives it to the document, which nothing changes before. The samples of the fonts which come with TeXmacs are pictures, so that the page does not load any font but those of the choice; for a font of your system, Show a sample makes the picture. When the font chosen for a part has variants, they are listed under it, each with its sample: a second choice, which changes that part only.

A document whose parts have fonts of their own has no font of the menus: the font button then says Custom, and so does an entry of its menu, which opens the page again. Save these fonts in the menu, or Save as on the page, keeps the choice under a name of yours: the name is then on the button, and the section Saved fonts at the top of the menu offers it for every document, also the next time TeXmacs runs. Forget saved fonts removes a name; the documents which use those fonts keep them.

Inside a document, Format\(\rightarrow\)Weight changes the weight of the selection, or of the text to come. It lists the weights which the font at the cursor really has, from the lightest to the heaviest, and marks the current one: eight for IBM Plex, from Thin to Bold, four for Iwona, Light, Regular, Bold and Heavy. In a document set in a variant, the weights are those of the design in the width of the variant, and Bold is the bold which goes with the variant.

Document\(\rightarrow\)Font\(\rightarrow\)Mathematical font changes the mathematical font alone, and keeps the text font. Its entries are the traditional TeXmacs math fonts and, at the end, the installed OpenType math fonts. Formulas follow the text font, so this menu only has an effect while the text font is the default one, Roman; to combine another text font with a mathematical font, use the font button, or the rule described below.

The same thing in markup

An entry of the menu stores its choice in the document as environment variables. The main font is font, which names a font by its family, Libertinus or Kepler for instance, and formulas are then set in the mathematical font which belongs to that family. (The TeX Gyre entries, Times, Palatino, Bookman and Schoolbook, add a style package instead, such as pagella-font, which also sets the hand-tuned mathematics.) When a text font is combined with another mathematical font than its own, the value of font is a rule which names both: Euler is set with Pagella text by

<assign|font|math=Euler Math,TeX Gyre Pagella>

and the part before the comma applies to mathematics only. A variant of a design is a family of its own, which keeps the mathematics of the design in the same way: math=IBM Plex Math,IBM Plex Light. The variable font-family says whether the text is set in roman (rm), sans serif (ss) or typewriter (tt) letters; a sans serif pair such as Kp Sans sets it to ss. A formula, or any part of a document, can be given other fonts with with:

<with|font|Fira|<math|a<rsup|2>+b<rsup|2>=c<rsup|2>>>

Bold, sans serif and typewriter formulas

Bold mathematics (for instance in a bold title, or with math-font-series set to bold) uses a real bold mathematical font when the family has one, as New Computer Modern, Kp Fonts, Utopia, Charter and Concrete do, and is otherwise emulated by thickening the strokes of the regular font. Sans serif and typewriter letters in a formula come from the companions of the font.

Letters, alphabets and alternates

With an OpenType math font, the letters of a formula are taken from the mathematical italic alphabet of the font, so that the italic corrections and the kerning of the font apply to them; the hand-tuned TeX Gyre fonts take them from the italic of their text font. An OpenType math font also has alphabets for blackboard bold (\(\mathbb{R}\)), calligraphic (\(\mathcal{F}\)) and fraktur (\(\mathfrak{g}\)) letters, which are used when present; TeXmacs emulates those which are missing. In scripts, the smaller alternates the font designs for that purpose are used, as are its dotless \(i\) and \(j\) under an accent. The font browser, and, when complex actions go through the menus, Format\(\rightarrow\)Font features and Document\(\rightarrow\)Font\(\rightarrow\)Features, give access to the other variants a font offers, such as old style figures or its stylistic sets.

Fonts that are not installed

A document names its fonts, not files, and the name is looked up again every time the document is opened. On a system where a font is missing, TeXmacs uses the closest font it can find, so a document looks the same on every system only when it uses fonts which come with TeXmacs; the next page shows them all. After installing new fonts, Tools\(\rightarrow\)Fonts\(\rightarrow\)Scan disk for fonts makes them known. The chapter Fonts, from selection to glyph of the reference guide explains the machinery in detail, and the chapter OpenType fonts of the developer documentation describes how the MATH table is put to work.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".