latex3 / unicode-math

XeLaTeX/LuaLaTeX package for using unicode/OpenType maths fonts
http://ctan.org/pkg/unicode-math
LaTeX Project Public License v1.3c
239 stars 28 forks source link

Issue with DejaVu fonts after usage of `\mathrm` #531

Closed HeptaSean closed 2 years ago

HeptaSean commented 4 years ago

Description

After using \mathrm in a document that uses DejaVu Serif or DejaVu Sans as main font with LuaLaTeX, the following math formulae are oddly spaced to the extent that the lower indexes of sums are completely missing.

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{fontspec}
\setmainfont{DejaVu Serif}
\usepackage{unicode-math}
\begin{document}
\[ \sum_{i=1}^{n} a_i \]
$\mathrm{hom}$
\[ \sum_{i=1}^{n} a_i \]
Test
\[ \sum_{i=1}^{n} a_i \]
\end{document}

Picture of the resulting document

The first sum looks normal, but after the use of \mathrm, not only the immediately following sum, but all following math content is broken.

Additional information

This phenomenon arises with both, DejaVu Serif and DejaVu Sans, but not with another TTF font (Exo2) that I tested.

The package option mathrm=sym prevents the effect (but the option no-math for fontspec does not).

I have discovered the effect on a fully updated texlive on an Arch linux with DejaVu system fonts ttf-dejavu 2.37-2, but could also exactly reproduce it on another machine with Ubuntu 18.04.3 LTS, fonts-dejavu-core 2.37-1 and texlive-* 2017.20180305-1 (yes, it's ancient).

RuixiZhang42 commented 4 years ago

I cannot reproduce your example with the following log report:

This is LuaTeX, Version 1.10.0 (MiKTeX 2.9.7200 64-bit) (format=lualatex 2019.11.1) 5 NOV 2019 10:30
...
LaTeX2e <2019-10-01> patch level 1
Lua module: luaotfload-main 2019-09-13 3.00 luaotfload entry point
...
Package: fontspec 2019/10/19 v2.7d Font selection for XeLaTeX and LuaLaTeX
Lua module: fontspec 2019/10/19 2.7d Font selection for XeLaTeX and LuaLaTeX
...
Package: unicode-math 2019/09/26 v0.8p Unicode maths in XeLaTeX and LuaLaTeX
...

The output looks normal: noproblem

HeptaSean commented 4 years ago

I tried again. To exclude some issues with the font installation of the distribution, I downloaded the original DejaVu fonts and loaded them with:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{DejaVuSerif}[
    Path = dejavu-fonts-ttf-2.37/ttf/,
    Extension = .ttf
]
\usepackage{unicode-math}
\begin{document}
\[ \sum_{i=1}^{n} a_i \]
$\mathrm{hom}$
\[ \sum_{i=1}^{n} a_i \]
Test
\[ \sum_{i=1}^{n} a_i \]
\end{document}

Still looks like in the original issue report above with the following in the log:

This is LuaTeX, Version 1.10.0 (TeX Live 2019)  (format=lualatex 2019.11.16)  16 NOV 2019 22:01
...
LaTeX2e <2019-10-01> patch level 3
Lua module: luaotfload-main 2019-11-10 3.11 luaotfload entry point
...
Package: fontspec 2019/10/19 v2.7d Font selection for XeLaTeX and LuaLaTeX
Lua module: fontspec 2019/10/19 2.7d Font selection for XeLaTeX and LuaLaTeX
...
Package: unicode-math-luatex 2019/09/26 v0.8p Unicode maths in XeLaTeX and LuaLaTeX

Could this be some difference between Linux and Windows or TeX Live and MikTeX?

HeptaSean commented 2 years ago

Tried again after over two years, because I found this issue in my subscriptions: Issue is gone in a much newer installation. Closing to keep it tidy.