- From: Deyan Ginev <deyan.ginev@gmail.com>
- Date: Thu, 6 Jan 2022 19:48:36 -0500
- To: Murray Sargent <murrays@exchange.microsoft.com>
- Cc: Alexis King <lexi.lambda@gmail.com>, "www-math@w3.org" <www-math@w3.org>
- Message-ID: <CANjPgh8+dyDCF9GEaW-eh1B2ukvmKZD4OMb_RWu_GtomhjU6Lw@mail.gmail.com>

Hi Murray, all, I'm not a physicist, but I do get tempted by notation challenges. I looked up a string theory book, found a good hit for an introductory text from Berkeley: https://math.berkeley.edu/~kwray/papers/string_theory.pdf Skimming, I encountered some italic names (what one would consider "content symbols") such as "Het" and "SO", introduced in 13.1.4 and used in equations 13.43 and 13.44. And just as I was getting discouraged that no italic variables were used, I stumbled on Problem 3 on page 214, which uses italic NN, ND, DN, DD as variable names for sets. Neat! Attaching some screenshots for people that don't want to inspect a large PDF. I'm also interested in finding an upgrade path for the issue Alexis has presented to the list, and will continue reading the discussion with interest. Greetings, Deyan On Thu, Jan 6, 2022 at 4:46 PM Murray Sargent <murrays@exchange.microsoft.com> wrote: > > Interesting question. In my experience as a theoretical physicist, variables are single letters that may be adorned by primes, accents, subscripts and superscripts. Multicharacter function names like “sin” are not italicized. Can you give an example of a multicharacter variable? > > > > Thanks, > > Murray > > > > From: Alexis King <lexi.lambda@gmail.com> > Sent: Thursday, January 6, 2022 10:56 AM > To: www-math@w3.org > Subject: [EXTERNAL] Rendering multi-symbol variable names and OpenType math fonts > > > > Hi all, > > > > I apologize in advance if this question is not entirely on-topic, as I don’t know how much the nitty-gritty of actually rendering mathematics is within the purview of the Math WG. But math typesetting is generally a pretty niche topic, so I’m not sure if there’s a better place to ask such questions—please do let me know if there is! > > > > As for my actual question: I am currently working on a math renderer, and it would be great to be able to render MathML input. It seems wise to take advantage of OpenType math fonts to assist with the typographical subtleties of math typesetting, so I have been trying to take that route so far. Unfortunately, the OpenType math specification bakes certain assumptions into the font metrics that seem to make this tricky. > > > > For those unfamiliar, OpenType math fonts use glyphs in the Unicode Mathematical Alphanumeric Symbols block to represent variables. For example, instead of using U+0066 LATIN SMALL LETTER F from an italic font, the typesetting system must use 𝑓, which is U+1D453 MATHEMATICAL ITALIC SMALL F. The OpenType MATH table associates additional metrics with these glyphs to assist in placement of e.g. subscripts and superscripts. > > > > While this mechanism works just fine for single-letter variable names, it does not work correctly for multi-letter variable names, as the glyphs in the Mathematical Alphanumeric Symbols block have wider spacing than their Basic Latin counterparts in the italic text font of the same family. This choice—inherited from TeX—helps to distinguish two variables juxtaposed in implicit multiplication from a single, multi-letter variable. > > > > This is a problem, since one can easily write <mi mathvariant="italic">abc</mi>, which must result in a single, italic, multi-letter identifier. In TeX, the usual workaround is to use the \mathit command, which despite its name actually sets its argument in the current italic text font. However, MathML makes no such explicit distinction, so this results in two immediate questions: > > When rendering, does it make sense to automatically use the special glyphs in a math font where possible and fall back to a text font depending on the contents of an <mi> element? > How should subscript/superscript attachment positions be determined for a multi-letter variable? Since it is not possible to use the math font for such identifiers, there is no information in the MATH table to use. > > It’s worth explicitly noting that this issue is also present in TeX. As an example, try typesetting \[ f^1_2 \quad \mathit{of}^1_2 \] with pdfLaTeX and observe that the first subscript “cuts into” the empty space below the f glyph (which is desirable), whereas the second does not. > > (This is arguably an implementation infelicity in TeX, since TeX actually provides italic corrections for all glyphs, which could be used to place the subscript even in the second case. But OpenType fonts only include italic correction information in the MATH table, so ordinary characters have no such metrics. LuaTeX synthesizes italic corrections for other characters based on some heuristics in luaotfload, but that is getting pretty deep into the weeds.) > > One could argue that perhaps this is really an OpenType question, not a MathML question, but I don’t think any “OpenType Math WG” exists, as the spec is long since finalized. Besides, even if it did, this interaction is still relevant to MathML, since it’s a clear point of friction between the MathML spec and what appears to be the de facto standard for math fonts (to the extent such a thing exists at all). > > > > Regardless of whether this sort of thing is “in scope” for MathML, I’d appreciate any advice or pointers about the right way to proceed here. I’d really like to do the “right thing” to the extent that’s possible, but getting this stuff right is really subtle, and few people seem to have thought much about it. > > > > Many thanks, > > Alexis

## Attachments

- image/png attachment: Screenshot_2022-01-06_at_19-15-12_revised_wray_String_Theory_dvi_-_string_theory_pdf.png

- image/png attachment: Screenshot_2022-01-06_at_19-14-39_revised_wray_String_Theory_dvi_-_string_theory_pdf.png

- image/png attachment: Screenshot_2022-01-06_at_19-35-16_revised_wray_String_Theory_dvi_-_string_theory_pdf.png

Received on Friday, 7 January 2022 00:49:17 UTC