# Placement of subscripts using unicode-math. Is it XeTeX bug?

I don't like placement of subsripts when using unicode math fonts under XeLaTeX. In contrast to CM fonts the subscripts are placed at different vertical positions obviously depending on the depth of preceding symbol. Here is an example:

It is produced with the following MWE:

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Renderer=Basic,Ligatures={TeX}}
\setmainfont[Numbers={OldStyle}]{Minion Pro}
\usepackage[math-style=ISO,bold-style=ISO]{unicode-math}
\setmathfont[version=asana]{Asana Math}
\setmathfont[version=cambria]{Cambria Math}
\setmathfont[version=lm]{Latin Modern Math}
\setmathfont[version=stix]{STIXGeneral}
\setmathfont[version=xits]{XITS Math}

\begin{document}%

Asana Math \mathversion{asana}
$$\nabla_{\bot}p_{\bot} + \nabla_{\parallel}p_{\parallel} + d_{s}J_{s}$$

Cambria Math
\mathversion{cambria}
$$\nabla_{\bot}p_{\bot} + \nabla_{\parallel}p_{\parallel} + d_{s}J_{s}$$

STIXGeneral
\mathversion{stix}
$$\nabla_{\bot}p_{\bot} + \nabla_{\parallel}p_{\parallel} + d_{s}J_{s}$$

Latin Modern
\mathversion{lm}
$$\nabla_{\bot}p_{\bot} + \nabla_{\parallel}p_{\parallel} + d_{s}J_{s}$$

XITS Math
\mathversion{xits}
$$\nabla_{\bot}p_{\bot} + \nabla_{\parallel}p_{\parallel} + d_{s}J_{s}$$
\end{document}


And original PDFLaTeX with Computer Modern fonts yields subscript aligned at same vertical position:

UPDATE:

LuaLaTeX has no such "feature":

Q#1: Is it the XeLaTeX bug?

Q#2: Is it possible to instruct unicode-math to align subscripts on same vertial position under XeLaTeX?

-
Does this happen with LuaTeX as well? For me it only happens with XeTeX. – Philipp Jan 8 '12 at 19:29
@Philipp: you are right, this is XeLaTeX "feature". – Igor Kotelnikov Jan 9 '12 at 5:22
I've asked a similar question before: tex.stackexchange.com/questions/19370/… – morbusg Jan 21 '12 at 22:19
It was indeed a XeTeX bug and is fixed now (in my testing at least). – Khaled Hosny Apr 14 '12 at 8:22

I experienced a similar problem with superscripts. Searching for a solution I encountered your question.

Problem Description: Just typeset

$$F\le\frac{c^4}{4G}\frac{Mm}{(M+m)^2}$$


The alignment is wrong.

Further search, which might contribute to a solution, revealed that:

Q#1 It is not a xelatex bug, because typesetting with eulervm as a math font and the mathspec package does not lead to this behavior. It is also not an error of opentype font metrics, because the above formulae appear correctly in Word 2010 using Cambria Math (this is embarrassing). Therefore, I am led to believe that there is something rotten in the code of the unicode-math package.

Q#2: Reading the documentation of the unicode-math package, I didn't find any way of correcting this behavior except for modifying the source code, which I don't know how to do.

I think that this should be filed as an example of an unwanted behavior (or bug) to the maintainer of the unicode-math package, in order to be corrected in future versions.

Compiling with lualatex cannot be a general solution, because (at least in my case) I need polyglossia's features, as my text involves English, Greek and some Russian text and polyglossia has its problems with lualatex (or the other way around?).

-
Note, in XeTeX (and LuaTeX) typesetting old math fonts (eulervm etc) and OpenType math fonts takes different code paths, so bugs might exist in the later and not the former. – Khaled Hosny Jan 16 '12 at 17:43
In fact, you can run lualatex over Russian text: try using babel instead of polygrlossia, but substitute russianb.ldf (Russian Language Definition file) that came with babel by this one: tug.ctan.org/pkg/russian. – Igor Kotelnikov Jan 18 '12 at 10:15

There is already a pending bug report for this issue in the XeTeX bug tracker. Unfortunately, it hasn't been addressed for more than a year.

https://sourceforge.net/tracker/?func=detail&aid=3067472&group_id=194926&atid=951385

-