unicode-math icon indicating copy to clipboard operation
unicode-math copied to clipboard

Provide \addmathfontfeature, \mathfontspec etc

Open stone-zeng opened this issue 7 years ago • 1 comments
trafficstars

Description

In fontspec package, one can use \addfontfeature to add features for a loaded font, and can use \fontspec to specify a font in the document. Could you please consider to add the commands for math font, e.g. \addmathfontfeature and \mathfontspec etc.?

At present, to use different math font or different features, we must use mathversion, which is not convenient.

Check/indicate

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

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{XITS Math}
\begin{document}
% This formula is in XITS Math
\[ a = b \]

% This formula is in Latin Modern Math
{\mathfontspec{Latin Modern Math} \[ a = b \]}

% This formula is in XITS Math with upright integrals (ss08)
{\addmathfontfeature{StylisticSet=8} \[ a = b \]}
\end{document}

Further details

stone-zeng avatar Oct 08 '18 04:10 stone-zeng

Hmm, I’m not sure about this.

For sure I need to improve the interfaces here, but changing maths font mid-document is a very “heavy” operation and I don’t want to encourage it (in fact, LaTeX is not in any way designed for this, and it’s a bit of a hack that I made it work in unicode-math at all).

OTOH if there are particular use cases (like switching integral style?) maybe there are other ways to accommodate this so I’ll leave the issue open.

wspr avatar Oct 08 '18 05:10 wspr