# Overbrace not aligning with itself

Why aren't my overbraces displaying correctly?

The code for this segment is as follows

\documentclass[12pt]{amsart}
\usepackage{amsfonts}
\usepackage{verbatim}
\usepackage{amsbsy}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{mathabx}
\usepackage{setspace}
\usepackage{mathtools}
\usepackage{xcolor}
\usepackage{pifont}
\begin{document}
...
\begin{align*}
g^{(e)}(x) &= \overbrace{(1 + \frac{x^2}{2!} + \frac{x^4}{4!} + \ldots)}^{\text{red}}\overbrace{(1 + \frac{x}{1} + \frac{x^2}{2!} + \ldots)}^{\text{green}}\overbrace{(1 + \frac{x}{1} + \frac{x^2}{2!} + \ldots)}^{\text{white}}\\
...
\end{align*}
...
\end{document}


And it gets typeset like in the image below.

I'm honestly not sure what packages are required to build this bit of code (there's a lot more stuff in the document, as you might imagine) so I left all of them in there—maybe there's a conflict between them?

• not relevant to question, but if you're using amsart, amsmath and amsfonts are already loaded. – barbara beeton Mar 1 '18 at 14:14

The issue here is the load order of mathtools and mathabx. Use this order:

\documentclass{amsart}

\usepackage{mathtools}
\usepackage{mathabx}

\begin{document}

$g^{(e)}(x) = \overbrace{\bigl( 1 + \tfrac{x^2}{2!} + \tfrac{x^4}{4!} + \dots \bigr)}^{\text{red}} \overbrace{\bigl( 1 + \tfrac{x}{1} + \tfrac{x^2}{2!} + \dots \bigr)}^{\text{green}} \overbrace{\bigl( 1 + \tfrac{x}{1} + \tfrac{x^2}{2!} + \dots \bigr)}^{\text{white}}$

\end{document}

• Wow, thank you! I definitely wouldn't have thought that the order of package loading would matter. Care to shed some light on the details? – alan Mar 2 '18 at 5:30
• @alan: General details: Some packages take care to see what other packages have been loaded and/or load their macros at different times (not just all at package load/\usepackage using \AtBeginDocument, say). However, in general, there are too may combinations of load orders to consider and therefore the onus rests with the end-user. hyperref is a typical example of a package that should typically be loaded last, because it makes changes to many fundamental document elements. – Werner Mar 2 '18 at 5:35