1

When using STIX2 fonts for both text and math, some glyphs in math mode differ from those of text mode. For example, $zuvw$ produces different glyphs than \emph{zuvw}:

Sample output

Q: Why is this so, and it is possible to change this, so that math mode glyphs are the same as in text mode?

I note that in the font file STIX2Math.otf both versions of the glyphs are present. Thus, I believe that the default behavior is according to general principles of design of math fonts, and not a bug.

MWE, assuming that the STIX2 OpenType fonts reside in the specified path:

\documentclass[11pt]{article}
\usepackage{fontspec} 
\usepackage{unicode-math}
\setmathfont{STIX2Math}[
Extension={.otf},
Path=./STIX2fonts/,
Scale=1]
\setmainfont{STIX2Text}[
Extension={.otf},
Path=./STIX2fonts/,
UprightFont={*-Regular},
BoldFont={*-Bold},
ItalicFont={*-Italic},
BoldItalicFont={*-BoldItalic}]

\begin{document}
\verb|$zuvw$|: $zuvw$, \verb|\emph{zuvw}|: \emph{zuvw}.
\end{document}
5
  • 2
    As always on the site, please provide a full but minimal example others can copy and test as is. Then everybody is on the same page and we don't have to guess exactly what you are doing.
    – daleif
    Commented Sep 23, 2022 at 10:58
  • 3
    This happens also with Computer Modern. Math mode letters and italic text letters are not necessarily the same. They're different fonts; similar, yes, but not equal.
    – campa
    Commented Sep 23, 2022 at 11:19
  • 2
    See e.g tex.stackexchange.com/q/565517/82917 for a closely related issue.
    – campa
    Commented Sep 23, 2022 at 11:21
  • Thanks for comments! I added a MWE. I do not think this is a bug, but a feature, but I would like to know if there are simple ways to fix it, e.g., by changing which glyph belongs to $z$, etc.
    – Jas Ter
    Commented Sep 23, 2022 at 12:10
  • 1
    You are using different fonts for text and math, use \mathit to use the text italic font Commented Sep 23, 2022 at 13:30

1 Answer 1

1

The official documentation of STIX Two (texdoc stixtwomath) shows a suitable stylistic set for “uvwz” like the italic STIX Two, but unfortunately, also the g would change to a shape different from the italic one.

enter image description here

Therefore, some juggling with ranges is necessary.

\documentclass[11pt]{article}
\usepackage{fontspec}
\usepackage{unicode-math}

\setmainfont{STIX Two Text}
\setmathfont{STIX Two Math}
\setmathfont{STIX Two Math}[
  range={`u,`v,`w,`z,"1D462,"1D463,"1D464,"1D467},
  StylisticSet=02,
]

\begin{document}

\verb|$zuvwg$|: $zuvwg$, \verb|\emph{zuvwg}|: \emph{zuvwg}.

\end{document}

enter image description here

2
  • 2
    The italic z with a curly tail, although traditional in Times, isn't really appropriate for math, as it can pose problems with attaching subscripts or under-markings. Commented Sep 23, 2022 at 14:20
  • @barbarabeeton I know, but I answered the OP's question… 😉
    – egreg
    Commented Sep 23, 2022 at 14:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .