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

Incorrect \underbrace output if used with mathtools #582

Closed zepinglee closed 2 years ago

zepinglee commented 2 years ago

Description

The \underbrace command produces incorrect output if the mathtools package is loaded.

Add info or delete as appropriate:

Minimal example demonstrating the issue

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{STIXTwoMath-Regular.otf}
\usepackage{mathtools}
\begin{document}
\[
  \overbrace{a+b+c+d}^{e/f/g/h}
  \underbrace{a+b+c+d}_{e/f/g/h}
  \LaTeXoverbrace{a+b+c+d}^{e/f/g/h}
  \LaTeXunderbrace{a+b+c+d}_{e/f/g/h}
\]
\end{document}
Screen Shot 2022-01-19 at 23 00 35

Further details

I'm sure if it's better for unicode-math to fix it rather than mathtools.

zepinglee commented 2 years ago

I suppose it should be fixed in mathtools.

\AtEndOfPackageFile*{mathtools}{
  \@ifpackageloaded{unicode-math}{
    \let\underbrace\LaTeXunderbrace
    \let\overbrace\LaTeXoverbrace
  }{}
}