fontspec icon indicating copy to clipboard operation
fontspec copied to clipboard

Set mode for fonts used in math

Open zauguin opened this issue 3 years ago • 0 comments
trafficstars

Description

Currently fontspec sets the current text fonts as default fonts for \mathrm (...). Since the current text fonts typically uses the node or harf shaper in LuaLaTeX this uses such fonts in math mode which doesn't actually work since math mode is not processed by these shapers.

Can fontspec (at least for LuaTeX) automatically set \mathrm (...) to equivalent fonts with mode=base?

Check/indicate

  • [ ] Relevant for XeTeX
  • [x] Relevant for LuaTeX
  • [x] Issue tracker has been searched for similar issues?
  • [ ] Links to <tex.stackexchange.com> discussion if appropriate

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{fontspec}
\setmainfont{texgyrepagella}
\begin{document}
$\mathrm{H}H$
\typeout{\string\mathrm: \fontname\textfont0}
\end{document}

shows that \mathrm has mode=node instead of mode=base.

Further details

zauguin avatar Apr 20 '22 11:04 zauguin