# newtxmath + libertine: integral sign spacing is wrong

I have trouble with the spacing around integral signs while using newtxmath and libertine. The integral sub-/superscripts are to far off the integral sign.

I took the same example TEX code as in this posting: mathabx integral sign in newtxmath style:

\documentclass{article}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}
\usepackage{amsmath}
\usepackage{esint}

\begin{document}

This is almost trivial to prove:
\begin{equation*}
\int_{-\infty}^{\infty}e^{-x^{2}}\,dx=\sqrt{\pi}
\end{equation*}
And here are the other integral symbols:
\begin{equation*}
\end{equation*}
\end{document}


I am using TeXLive with Debian stable. This is coming with "newtxmath 2014/09/28 v1.29". I also tried "newtxmath 2016/08/12 v1.5" like with this screenshot. There is no difference.

What is going wrong?

Matthias

• With TeX Live 2016 (fully updated), I can't reproduce the issue. – egreg Aug 26 '16 at 8:43
• I realized that this is a lualatex issue. With pdflatex the spacing is fine. I compared pdfTeX, Version 3.14159265-2.6-1.40.15 with LuaTeX, Version beta-0.79.1, both from TeX Live 2015/dev/Debian. That is a bug. Where should I report that? – Matthias Bodenbinder Aug 26 '16 at 16:41

Load fontspec with the no-math option to avoid that it resets math fonts at the begin of the document:

\documentclass{article}
\usepackage[no-math]{fontspec}
\usepackage{libertine}
\usepackage[libertine]{newtxmath}
\usepackage{amsmath}
\usepackage{esint}

\begin{document}

This is almost trivial to prove:
\begin{equation*}
\int_{-\infty}^{\infty}e^{-x^{2}}\,dx=\sqrt{\pi}
\end{equation*}
And here are the other integral symbols:
\begin{equation*}
\end{equation*}
\end{document}


After a big digging around I think the source of the wrong spacing is that the open type linux libertine has a so-called mathconstants table. Loading such a font in math changes quite a number of math related dimensions (this is documented in the luatex manual) but seems also to change the way how the super-/subscripts are placed even if legacy math fonts are used. I'm not sure if this is intended and I asked a question on the luatex list about it. The problem can be demonstrated e.g. with Cambria Math too:

\documentclass{article}
\usepackage[no-math]{fontspec}

\setsansfont{Cambria Math}
\DeclareMathAlphabet      {\mathtest}{EU2}\sfdefault\mddefault\updefault

\begin{document}

$\mathtest{abc}$

$\int_{-\infty}^{\infty}a$

\end{document}


This is a fonts issue. pdflatex is using type1 fonts (like /usr/share/texlive/texmf-dist/fonts/type1/public/libertine/L‌​inLibertineT.pfb) while lualatex is using opentype (like /usr/share/fonts/opentype/linux-libertine/LinLibertine_R.ot‌​f). When I force type1 fonts in lualatex with \usepackage{libertine-type1} the output is correct.