Re: [EXTERNAL] Rendering multi-symbol variable names and OpenType math fonts

On Thu, Jan 6, 2022 at 3:45 PM Murray Sargent <> wrote:

> Interesting question. In my experience as a theoretical physicist,
> variables are single letters that may be adorned by primes, accents,
> subscripts and superscripts.

Yes, it’s definitely not very common in many fields, which is probably why
the potential for such a thing is often overlooked.

> Can you give an example of a multicharacter *variable*?

I am a computer scientist specializing in the field of programming
languages. Much of the notation used in my field looks rather different
from the notation most people think of as “mathematics”, but it is still
very much mathematical: it’s set in math mode in TeX, and much of it has
roots in formal logic.

Precise conventions vary from author to author, but it’s not uncommon for
multi-letter names to be used to represent, say, the names of language
grammar nonterminals. For example, we might write something like

expr ::= number | expr_1 + expr_2 | if expr_1 then expr_2 else expr_3 | ...

where the nonterminal names *expr* and *number* are set in italics to
distinguish them from the syntactic keywords if, then, and else, which are
set in roman or sans. Using multi-letter variable names in this way
introduces no syntactic ambiguity, since we do not use juxtaposition to
mean multiplication in such contexts.

I suspect that these “unconventional” flavors of mathematics are rarely
paid much thought by most people, and certainly there are many things in
TeX that do not serve it particularly well. But much of our notational
conventions—such as, for example, sequent calculus
<> inference rules, which are
often used to specify type systems—result in many of the same challenges as
typesetting other forms of mathematics. Such notations are intensely
two-dimensional, and they often demand complex and subtle alignment and

Unfortunately, the differences from more conventional flavors of
mathematics do mean that the defaults are very often unhelpful when
typesetting PL notation, and we often have to actively work around them.
For example, the MathML rule that <mi> is italic by default if and only if
the content is a single character is unhelpful when typesetting things like
my example above. But that’s largely to be expected—the defaults cater to
what is most common—so having to override some defaults is perfectly
palatable so long as there is some mechanism to do so!

Hope that helps,

Received on Thursday, 6 January 2022 23:13:10 UTC