I would like to use e.g. the calligraphic font from two different fonts conveniently in the same document.

For example in the snippet below, how can I load in parallel e.g. the calligraphic fonts from LatinModern and use it via a command like \symcallatin{ABC}?

I have already found some solutions that rely on switching the whole font e.g. using mathversion. But I would like to avoid this and instead have a dedicated command that allows to write certain symbols in a predefined font. How can this be achieved?

% !TeX TS-program = lualatex

\setmathfont{TeX Gyre Pagella Math}
\setmathfont[range={cal,bfcal},StylisticSet=1]{XITS Math}

  • If you do \symscr you get the glyphs from Pagella Math. – egreg Jul 2 '18 at 10:42
  • @egreg Thanks for your reply. But isn't that (in general) a different font than the calligraphics from Pagella math? – bonanza Jul 2 '18 at 10:44

Combining different fonts in Math mode was traditionally implemented with the \fam primitive. unicode-math does not use \fam by default for OTF fonts, but you can change that by manually loading the fonts into mathgroups. The additional fonts are not loaded by the unicode-math machinery, so range etc. is not available:

\setmathfont{XITS Math}
\definemathgroup\mathmyothercal\symcal{}{Latin Modern Math}
\definemathgroup\mathtgcal\symcal{}{Tex Gyre DejaVu Math}

enter image description here

In the command \definemathgroup the second parameter(always \symcal in the examples above) select the math alphabet. This can be replaced by the other \sym... commands from unicode-math to load other math alphabets, e.g. \smybb for blackbord bold, \symfrak, \symit, \symnormal, ...

  • Thanks, that looks really great! Could you add what needs to be changed in the case other than calligraphic fonts are desired (e.g. fraktur, blackboard, typewriter, upright, italic etc. )? – bonanza Jul 6 '18 at 8:44
  • @bonanza Just replace \symcal with the corresponding \sym.... A full list is to be found in the unicode-math documentation. – Marcel Krüger Jul 6 '18 at 8:58
  • Thanks, I thought its more complicated as I believed that the \fontspec_set_family: .... line only loads the script glyphs. – bonanza Jul 6 '18 at 8:59
  • 1
    @bonanza Probably because of Script=Math, but that does not mean to only load script glyphs, it indicates that the font is used for mathematical writing instead of text in latin script, arabic script, etc. – Marcel Krüger Jul 6 '18 at 9:12
  • 1
    I added a issue to unicode-math for this github.com/wspr/unicode-math/issues/481 – Ulrike Fischer Jul 7 '18 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.