Compiling this example:
\documentclass{scrartcl}
\usepackage{mathtools}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\begin{document}
\begin{equation*}
\symcal{L}_{\text{QED}} =
- \underbrace{\frac{1}{4} F_{\mu\nu} F^{\mu\nu}}_\text{Photon}
+ \underbrace{\bar{\psi} (i \gamma^\mu\partial_\mu - m) \psi}_\text{Dirac}
- \underbrace{eQ\bar{\psi} \gamma_\mu \psi A^\mu}_\text{WW}
\end{equation*}
\end{document}
using lualatex from TeXLive 2016, the second \underbrace
is shifted to the left. This only seems to happen when the first thing in the \underbrace
is \bar
.
Even adding something ridiculous like \hphantom{}
resolves the issue.
Only \underbrace{\bar{\psi} (i \gamma^\mu\partial_\mu - m) \psi}_\text{Dirac}
:
Adding an \hphantom{}
before \bar
A “more minimal” example, to be compiled with luatex
\input ifluatex.sty
\ifluatex
\input luaotfload.sty
\fi
\font\mf="[latinmodern-math.otf]"
\textfont1=\mf \scriptfont1=\mf \scriptscriptfont1=\mf
\protected\def\underbrace#1{%
\mathop{\Umathaccent bottom 7 1 "023DF\relax {#1}}\limits
}
\protected\def\hat{\Umathaccent fixed 7 1 "00302\relax}
$\underbrace{z+w}_y$\qquad$\underbrace{\hat{z}+w}_{y}$
\bye
If compiled with xetex
, the output is
Changing the math font to xits-math.otf
doesn't change the situation. With Asana-Math.otf
the output is different:
\hat
... it should be reported as a bug. – Andrew Swann Aug 8 '16 at 8:42{}
not sure yet whether it's a problem in unicode-math or luatex (it's not mathtools, you get the same if you use\[
and just load amstex for\text
– David Carlisle Aug 8 '16 at 8:44unicode-math
underlualatex
that is the problem. Minimal example:\documentclass{article} \usepackage{unicode-math} \begin{document} \begin{displaymath} \underbrace{ABCDEFGH}_P + \underbrace{\bar a IJKLMNOP}_D \end{displaymath} \end{document}
. Under XeLaTeX it is fine. – Andrew Swann Aug 8 '16 at 9:46unicode-math
works fine. – Andrew Swann Aug 8 '16 at 10:31unicode-math
: github.com/wspr/unicode-math/issues/391 – Socob Oct 23 '17 at 9:59