4

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}
3
  • Not that it helps you, but if you look at this list, page 7, the same problem seem to be there in Stix. It might be worth to file a bug report somewhere. Maybe you can use Xits?
    – mickep
    Commented Sep 2, 2016 at 16:18
  • And if you just load stix using \usepackage{stix} instead of through fontspec then everything is fine, also.
    – JPi
    Commented Sep 2, 2016 at 16:39
  • mickep: well spotted! Sounds like it is really a more general problem and not directly related to my setup. JPi: I suppose that method doesn't use the OpenType fonts, is that correct? Does it have any potential drawbacks? Using XITS is certainly a workable solution, so I will accept Mico's answer.
    – Mark Vis
    Commented Sep 3, 2016 at 14:11

1 Answer 1

7

(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.

3
  • 2
    Wonderful! Strangely, MacTeX 2017 still appears to come only with STIX version 1, so I downloaded the latest verstion myself (from here). But it solved a number of spacing issues that threatened to derail my plans to use STIX fonts for a project I am working on. Commented Jul 30, 2017 at 13:06
  • 2
    I should note that the lower integral limit in the STIX Two sample as shown is too far to the right. The placement has been improved somewhere between the posting of this answer and the current MacTeX, and looks just fine now. Commented Oct 3, 2017 at 9:17
  • @HaraldHanche-Olsen - Thanks for this update! I've gone ahead and posted a new screenshot, showing the output of compiling the equation with the Stix Two fonts, but now with MacTeX2017 (and hence LuaTeX 1.0.4).
    – Mico
    Commented Oct 3, 2017 at 10:14

You must log in to answer this question.

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