[Tex/LaTex] STIX Math with LuaLaTeX: incorrect spacing

luatexstixunicode-math

When I am using STIX Math in combination with LuaLaTeX with unicode-math, the spacing in formulas looks quite horrible. With other math fonts (I've tried with TeX Gyre Pagella, Latin Modern, and some others), things appear to look fine.

I'm running MacTeX-2016 including all updates. The MWE below gives the following output: screenshot

The problem appears similar to this one for XeTeX. There it was mentioned that switching to LuaTeX solved the problem. In my case switching to XeTeX doesn't appear to resolve the problem.

MWE:

\documentclass[10pt]{article}
\usepackage{amsmath}
\usepackage{fontspec,xunicode}
\usepackage[math-style=ISO]{unicode-math}

\setmainfont{STIX}\setmathfont{STIX Math}
%   \setmainfont{Tex Gyre Pagella}\setmathfont{texgyrepagella-math.otf}
%   \setmainfont{Latin Modern Roman}\setmathfont{Latin Modern Math}
%   \setmainfont{TeX Gyre Termes}\setmathfont{TeX Gyre Termes Math}
%   \setmainfont{TeX Gyre Schola}\setmathfont{TeX Gyre Schola Math}
%   \setmainfont{TeX Gyre Bonum}\setmathfont{TeX Gyre Bonum Math}

\renewcommand{\vec}[1]{\symbf{#1}} 

\begin{document}
This is a test.
\begin{align}
P(\vec{k}) = \int_a^b
       e^{i\vec{k} \cdot \vec{R}}
       P(\vec{R}) \,\mathrm{d}\vec{R}.
\end{align}
\end{document}

Best Answer

(I've updated the answer to reflect the arrival of the STIX Two text and math fonts in late 2016. The STIX Two fonts weren't available yet in Sept. 2016, when this query was posted.)

I'm not in a position to evaluate the STIX Text and STIX Math fonts. Whatever it is that's afflicting them, there's good news: The STIX Two text and math fonts, which were released in Dec. 2016, have much better properties, as is shown below.

If, for some reason, your TeX distribution doesn't (yet) have the STIX Two text and math fonts, you may wish to consider using the XITS and XITS Math fonts. They are derived from STIX and STIX Math, but they don't generate the problem behavior you've run into. (Well, there's a different, and fortunately minor problem: The lower limit of integration is typeset too far to the right when using XITS Math. This may be fixed by issuing a directive such as \mkern-9mu, which is equivalent to three negative thin-spaces.) Speaking for myself, I must say that I much prefer the shape of the integral symbol used by STIX Two Math over the version that's used by both STIX and XITS.

The following code was compiled on a Mac running MacOS10.12 "Sierra", MacTeX2016, LuaTeX 0.95, and LuaLaTeX format dated 2017/02/25. I understand that MacTeX2017, which will be released later this quarter, will use LuaTeX 1.04. The latest version of LuaTeX reportedly does a much better job of placing the limits of integration.

enter image description here

\documentclass[10pt]{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage[math-style=ISO]{unicode-math}

\newcommand\myeq{%
\[
P(\vec{k}) = \int_a^b e^{i\vec{k} \cdot \vec{R}} P(\vec{R}) \,\mathrm{d}\vec{R}.
\]}

\setlength\textwidth{7cm}
\begin{document}

\setmainfont{STIX}\setmathfont{STIX Math}
\renewcommand{\vec}[1]{\symbf{#1}} 
STIX
\myeq

\medskip
\setmainfont{STIX Two Text}\setmathfont{STIX Two Math}
\renewcommand{\vec}[1]{\symbf{#1}} 
STIX Two
\myeq

\medskip
\setmainfont{XITS}\setmathfont{XITS Math}
\renewcommand{\vec}[1]{\symbf{#1}} 
XITS
\myeq
\end{document}

Update, Oct. 2017: Prompted by a follow-up comment by @HaraldHanche-Olsen, here's the "look" of the equation using the Stix Two text and math fonts, but now with MacTeX2017, LuaTeX 1.0.4, and unicode-math 2017/08/02 v0.8f:

enter image description here

As Harald has noted, the positioning of the lower limit of integration is now just fine.

Related Question