LaTeX and OTF math fonts

17 views
Skip to first unread message

Rob Beezer

unread,
Mar 3, 2026, 10:50:22 AMMar 3
to prete...@googlegroups.com
Maybe a TeXnician or two has some experience that will allow them to comment on
the following.

I'd like to support math OTF fonts selected by a publisher for LaTeX output.
With the xelatex engine. So it seems:

* load the font with \setmathfont from the fontspec package, similar to how
you do this for the main font. The font might have some features you can
specify/enable.

* but you need to first use the unicode-math package. This takes generic
options that apply for any math font. It will implement a pile of LaTeX macros,
provided your font has the glyphs the macro needs. It is supposed to implement
the macros in the amssymb package (which we load now by default).

* so now you better not load amssymb or you will be redefining macros (a
runtime error).

When I try all this with the sample article, some macros like \blacksquare and
\lozenge are left undefined (I have a workaround for this).

Main question: how many macros from amssymb, in use by authors in our math
elements, might go undefined when we support alternate math fonts?

Thanks in advance for any insights!

Rob

Alex Jordan

unread,
Mar 3, 2026, 11:44:37 AMMar 3
to prete...@googlegroups.com
If you want to go down this road, PTX could define missing amsymb macros like \blacksquare as
\mdblksquare
And do likewise with a comprehensive list of whichever amssymb commands are missing. Yes, I know you are asking for a list (or at least a count) of what is missing. I assume you've Googled and found no list, like I just did. The amssymb documentation looks to have a little over 200 macros defined, and could be scraped to make a test doc with everything in it.

A problem will be when the author chose a certain math font, but it simply doesn't have a glyph for this or that. I'm not sure what you can do then. Like, is there a way to say for this one glyph only, I want to use this other font.

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/MTAwMDA0Ny5iZWV6ZXI.1772553019%40pnsh.

Rob Beezer

unread,
Mar 3, 2026, 2:18:27 PMMar 3
to prete...@googlegroups.com
Thanks, Alex. All a little murky. ;-)

I have a hint that the "pifont" package will allow for some simple shapes like
open/black square and lozenge *as text mode* items (from an old PostScript
"dingbats" font). Right now our tcolorbox styles use them as "end-of" markers,
but in math mode. So that should improve and avoid a gotcha of *our* making. I
think - no experiments yet.

There is this list, organized by font, of what unicode-math can provide.

https://mirrors.ctan.org/macros/unicodetex/latex/unicode-math/unimath-symbols.pdf

At some point we are just going to have to say: "Buyer beware. Use at your own
risk." We can make recommendations, but this is too much of a minefield to
provide any foolproof mechanisms, it seems.

Rob



On 3/3/26 08:44, Alex Jordan wrote:
> If you want to go down this road, PTX could define missing amsymb macros
> like \blacksquare as
> \mdblksquare
> And do likewise with a comprehensive list of whichever amssymb commands are
> missing. Yes, I know you are asking for a list (or at least a count) of what is
> missing. I assume you've Googled and found no list, like I just did. The amssymb
> documentation looks to have a little over 200 macros defined, and could be
> scraped to make a test doc with everything in it.
>
> A problem will be when the author chose a certain math font, but it simply
> doesn't have a glyph for this or that. I'm not sure what you can do then. Like,
> is there a way to say for this one glyph only, I want to use this other font.
>
> email to pretext-dev...@googlegroups.com <mailto:pretext-
> dev%2Bunsu...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/
> MTAwMDA0Ny5iZWV6ZXI.1772553019%40pnsh <https://groups.google.com/d/msgid/
> pretext-dev/MTAwMDA0Ny5iZWV6ZXI.1772553019%40pnsh>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-dev...@googlegroups.com <mailto:pretext-
> dev+uns...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/pretext-dev/
> CA%2BR-jrdOyChtcq%2BK4CDaRzcwD-tFphE30VBiGopRefkJUmfMMA%40mail.gmail.com
> <https://groups.google.com/d/msgid/pretext-dev/CA%2BR-jrdOyChtcq%2BK4CDaRzcwD-
> tFphE30VBiGopRefkJUmfMMA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Rob Beezer

unread,
Mar 7, 2026, 2:14:46 PMMar 7
to prete...@googlegroups.com
Experimental, and just for the cognesceti. Working on documentation (which is a
lot of work!) and may post to "pretext-announce" soon.

You can now specify a Unicode math font to use in your LaTeX output. Existing
documentation about LaTeX fonts is pretty much OK, but does need a re-write.

* If you do this, the amssymb package needs to go away, and will. The
"extpfeil" package will still load anssymb and there will be a clash - no good
workaround for that.

* Math in titles of divisions will not migrate to a PDF bookmark anymore
(breaks a hyperref convenience). If you set a #shorttitle with no markup, it
will be used preferentially. Not sure if this is a good long-term solution.

* Documentation by example (for now). This font is likely available if you
have TeXLive "extra" fonts, or similar, set up. In your publication file add

<latex>
<fonts>
<main regular="TeX Gyre Pagella" options="Numbers={SlashedZero}"/>
<math regular="TeX Gyre Pagella Math" options="math-style=french"/>
</fonts>
</latex>

or just un-comment this in the sample article and give that a go (read comments
there no matter what).

Options for the #math font maybe be options to the "unicode-math" package (as
shown), or font features for a math font (uncommon), as is being shown for the
main font. Separate multiple options with commas.

Oscar - built a new template which is used in the construction of the preamble.
Did not include it for the classic build, since I don't think you want to go
there. Right now, an attempt to specify a math font will just (almost) silently
fail, except amssymb will go away and nothing will replace it. Likely easy to
implement the template with a big fat fatal error?

Reports welcome, even if to say this works fine.

Rob
Reply all
Reply to author
Forward
0 new messages