GNU TeXmacsUser manualReferenceAboutEnglish
Selecting fonts
From the dialogs

The font of a whole document is chosen in Document\(\rightarrow\)Font, and the font of a piece of text in Format\(\rightarrow\)Font. When the preference Complex actions is set to popup windows, both open the font browser, which lets you pick a family, a shape and a size, and which can also search for a font by its properties; the font selection system describes the browser and its filters.

When it is set to menus, Document\(\rightarrow\)Font has instead three submenus which set the font of one mode at a time, one for the OpenType features, and two which set the sizes:

Text font

The font of ordinary text.

Mathematical font

The font of formulas. Its entries are the traditional TeXmacs math fonts, and, at the end of the list, the OpenType math fonts which are installed on your system and which TeXmacs knows how to use. This setting counts only while the text font is the default one, Roman: with any other text font, formulas are set in the mathematical companion of that font, or in the font itself. The font button of the focus toolbar sets text and mathematics together, and the section Mathematical fonts of the user manual shows each pair.

Features

The OpenType features of the document font, such as old style figures or small capitals.

Program font

The font of program sessions and of program text; like the mathematical font, it counts while the text font is Roman.

Size, Dpi

The base size of the document in points and the resolution at which the glyphs are rendered.

Whatever you choose in these dialogs is stored in the document itself, as the value of an environment variable, so a document carries its fonts with it. Nothing else is stored: a document asks for TeX Gyre Pagella, not for a file on your disk, and the request is resolved again every time the document is opened.

The environment variables

A dialog is a convenient way of setting the variables below; you may also set them by hand, which is what a style file does.

variable default what it says
font roman the font name in text mode
font-family rm rm, ss or tt
font-series medium medium, bold, …
font-shape right right, italic, small-caps, …
font-base-size 10 the base size in points
font-size 1 a multiplier of the base size
font-effects extra effects, such as bold=0.5
font-features OpenType features, such as onum
math-font roman the font name in math mode
math-font-family mr mr, ms or mt
math-font-series medium as in text mode
math-font-shape normal normal or right
prog-font roman the font name in program mode
prog-font-family tt as in text mode
magnification 1 magnifies everything, slides for instance

Table 1. The environment variables which select a font.

The three modes are not independent. A formula is set from the text font and its family: in a document whose font is Libertinus, formulas are set in Libertinus Math, the mathematical companion of that font, and in a sans serif paragraph their letters turn sans serif. The variables math-font and prog-font are used only while font is roman. To combine a text font with another mathematical font than its own, write both in font as a rule, math=Euler Math,TeX Gyre Pagella, where the part before the comma applies to mathematics only. The family, the series and the shape are requests: if the font you asked for has no bold italic, TeXmacs takes the closest match it can find, or emulates it.

A different font for part of the characters

The value of font, and of math-font and prog-font as well, need not be a single family: it is a font sequence, a comma separated list of items which are tried in order for every character. An item is either a family name, or a family name preceded by conditions, written conditions=family. The first item whose conditions hold and whose family has the character at hand is the one which draws it, so

digit=Fira Sans,roman

sets the figures in Fira Sans and everything else in the roman family.

Several conditions are separated by spaces and all of them have to hold; alternatives inside one condition are separated by a vertical bar, as in greek|cyrillic=DejaVu Serif. A condition is one of the following.

a Unicode range

ascii, latin, greek, cyrillic, cjk, hiragana, hangul, mathsymbols, mathextra or mathletters. The ranges are those of the code point: mathsymbols is U+2000 to U+23FF, mathextra is U+2900 to U+2E7F, and mathletters is the mathematical alphanumerics of the first plane.

a class of mathematical characters

mathbigop for the big operators, mathrubber for the stretchable characters, the brackets, the wide accents and the long arrows, and mathlarge for both.

a mathematical alphabet

bold-math, italic-math, bold-italic-math, cal, bold-cal, frak, bold-frak, bbb, ss, bold-ss, italic-ss, bold-italic-ss or tt. The condition holds for the letters of that alphabet, which is how the script or the double-struck letters of your formulas can be taken from a font of their own.

a collection of characters

digit, latin, greek, lowercase-latin, uppercase-latin, lowercase-greek, uppercase-greek, their -bold variants, and basic-letters for all of them together. A name preceded by an exclamation mark holds for the characters which are not in the collection.

a character or a range of characters

A single character stands for itself, and two characters separated by a colon stand for every code point between them, as in a:z or 0:9.

a feature of the request

Any feature of the font being asked for, such as bold, italic or sansserif. The condition holds when the current request has it, which is how a family can be replaced in the bold series only.

math

The item applies in formulas and is ignored in text, whatever the character.

A few sequences worth knowing:

cjk=Songti SC,roman

Chinese characters from Songti SC and the rest from the roman family. The shorthands sys-chinese, sys-japanese and sys-korean expand into sequences of this shape, with the default font of your system.

math=TeX Gyre Pagella Math,Linux Libertine

A mathematical font used in formulas only, and Linux Libertine everywhere else.

cal=Zapf Chancery,roman

The script letters of formulas from Zapf Chancery.

mathrubber=stix,pagella

The stretchable brackets and accents from the Stix fonts, the rest of the document from Pagella.

A sequence is written like any other value: the dialogs propose one family at a time, so this is one of the places where you set the variable yourself, in markup or from Scheme. An item whose family is not installed is simply skipped, and a character which no item claims is resolved as usual, so a sequence is a hint and never makes a document unreadable elsewhere.

Asking for an OpenType feature

A font may carry several shapes of the same character and say, in its OpenType layout tables, under which feature each of them is to be used: old style figures under onum, small capitals under smcp, tabular figures under tnum, a stylistic set under ss01 and so on. The variable font-features names the features you want, separated by commas:

<with|font-features|onum|In 1789, …>

A feature which offers several alternates for the same character takes the number of the one you want after an equals sign, counting from 0, as in salt=1 for the second; the first, 0, is taken by default, and a number the font does not have leaves the glyph alone. Features apply from left to right, so onum,tnum asks for old style figures and then for the tabular form of those.

The substitution happens when the glyph is drawn, so the text of your document is untouched: it still holds the digits you typed, and a copy, a search, a spell check or an export sees them. A font which does not have the feature you asked for simply ignores it, which means that the variable is safe to set on a whole document.

The menus propose the features of the font at the cursor which they know, the figure, capital and stylistic features and the stylistic sets ss01 to ss05: when complex actions go through the menus, Format\(\rightarrow\)Font features (with detailed menus) applies one to the selection, Document\(\rightarrow\)Font\(\rightarrow\)Features to the whole document, and a tick shows which are in force. The font browser has them too, in its Font customization area and under its Features tab, where the list follows the font the dialog has selected and the sample text shows the effect.

Only the features which replace one glyph by another are supported at present. That covers onum, lnum, tnum, pnum, zero, smcp, c2sc, salt, swsh, hist and the stylistic sets ss01 to ss20 in the fonts shipped with TeXmacs; those the menus do not list can be named in the variable. The ligature features, liga, dlig and frac, replace several glyphs by one and are not applied yet.

In markup

Setting a variable on a piece of text is what the with tag does:

<with|font|TeX Gyre Pagella|font-shape|italic|a line of Pagella italic>

Applied to a whole document, the same assignment goes into the initial environment of the document, which is what Document\(\rightarrow\)Font writes, or into a style file as

<assign|font|TeX Gyre Pagella>

A style file may of course compute the value; the assign above is ordinary markup, and so are the definitions which use it.

From Scheme

The same two operations are available in the editor language. The first applies a variable to the selection or to what you type next, and the second sets the document-wide value:

(make-with "font-shape" "italic")
(init-env "font" "TeX Gyre Pagella")
(init-default "font")
(make-with var val)
(apply a variable locally)

Insert a with tag which sets var to val around the current selection, or around what will be typed next.

(init-env var val)
(set a variable for the document)

Set var to val in the initial environment of the current buffer. This is what the entries of Document\(\rightarrow\)Font do.

(init-default var)
(forget a document-wide value)

Remove var from the initial environment, so that the value of the style is used again.

(get-env var)
(read a variable)

The value of var at the current cursor position, as a string.

The font of a formula follows the text font, as explained above, so a pair of fonts which belong together is set at once: init-opentype-font takes the name of a profiled OpenType math font and sets its text font, the rule for its mathematics when needed and the font family, which is what the entries of the font menu do, and init-font takes a text font and a traditional math font. For the four TeX Gyre fonts both add a style package, such as pagella-font, instead of setting font, and the package sets the hand-tuned mathematics:

(init-opentype-font "Libertinus Math")
(init-opentype-font "Euler Math")
(init-font "pagella" "math-pagella")
Which fonts are there?

TeXmacs ships a number of fonts of its own, among them the mathematical fonts shown in the section Mathematical fonts of the user manual, and finds the others on your system. If a font you have installed does not appear in the browser, ask for a scan with Tools\(\rightarrow\)Fonts\(\rightarrow\)Scan disk for fonts; if a font behaves as if TeXmacs still remembered an older state of your system, empty the caches with Tools\(\rightarrow\)Fonts\(\rightarrow\)Clear font cache and restart. What those two entries really do, and which files they read and write, is the subject of the font configuration files.

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".