Consider this
\documentclass[a4paper]{article}
\usepackage[left=0cm,right=12cm]{geometry}
\usepackage{unicode-math}
\setmathfont{Libertinus Math}
\usepackage[grid]{eso-pic}
\begin{document}
Before
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
After
\end{document}
At left, result from xelatex, at right from lualatex:
Testing was done with TL2018 (updated pretest). Do mentally the slight shift upwards of right image to perfectly align it with left. The point is that xetex output is more spread out vertically. In real life this means documents will differ easily in pagination.
It was pointed out in comment that this is already the case due to LuaTeX extending the hyphenation algorithm, whereas XeTeX sticks with the traditional one.
This testing came out of Problem with \underbrace and Libertinus Math
With default fonts, no discrepancy.
Sorry, edit: also discrepancy with commenting out \setmainfont{Libertinus Math} and keeping only unicode-math.
\documentclass[a4paper]{article}
\usepackage[left=0cm,right=12cm]{geometry}
\usepackage{unicode-math}
\usepackage[grid]{eso-pic}
\begin{document}
Before
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
\[ \underbrace{AAA}_{B}\]
After
\end{document}
Editing question title to remove reference to Libertinus Math.
Using only fontspec but not unicode-math outputs are identical. Using fontspec and unicode-math (or only the latter which loads the former) the outputs differ even with no additional font setup.
Same issue when using for example \setmathfont{TeX Gyre Pagella Math}.
It is not an issue of unicode-math but an engine “problem” which is shown using this Plain TeX example:
\nopagenumbers
\ifdefined\directlua
\input luaotfload.sty
\fi
% Load any Unicode math font (we don't need scriptscript here)
\font\mathfont="TeX Gyre Pagella Math:script=math" at 10pt
\textfont0=\mathfont
\font\mathfonts="TeX Gyre Pagella Math:script=math;+ssty=0" at 7pt
\scriptfont0=\mathfonts
% Define the relevant symbols
\Umathcodenum`A="1D434
\Umathcodenum`B="1D435
\def\underbrace#1{\mathop{\Umathaccent bottom 0 0 "23DF {#1}}}
$$ \hbox{Before} $$
$$ \underbrace{AAA}_{B} $$
$$ \underbrace{AAA}_{B} $$
$$ \underbrace{AAA}_{B} $$
$$ \underbrace{AAA}_{B} $$
$$ \underbrace{AAA}_{B} $$
$$ \underbrace{AAA}_{B} $$
$$ \underbrace{AAA}_{B} $$
$$ \underbrace{AAA}_{B} $$
$$ \hbox{After} $$
\bye
Left is LuaTeX, right is XeTeX:






unicode-mathdoes too much extra stuff, obfuscating what is actually going on). I highly doubt that theunicode-mathpackage is at fault though. It seems much more like an engine problem. – Henri Menke Mar 25 '18 at 22:35unicode-math. – Henri Menke Mar 26 '18 at 01:49unicode-mathhas means to correct such problems once fully understood. – Mar 26 '18 at 06:47