# Conflict between breqn and newtxmath packages

I was typesetting a document. I have imported the breqn package and everything is working just fine. I decided that I did not like the default Computer Modern math font, so I wanted to change it to something nicer, and through the LaTeX Font Catalogue I found Heuristica. All of this is going well until I noticed a problem in how \implies is rendered. Here is the output when I type $= \implies$.

As you can see, the \implies symbol looks like an equal sign with a shorter arrow overlaid on top. If I remove either package, the problem disappears. Why and how can I resolve this problem?

MWE:

\documentclass{standalone}

\usepackage[scale=0.85]{heuristica}
\usepackage[heuristica,vvarbb,bigdelims]{newtxmath}
\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{\textosf{#1}}

\usepackage{breqn}

\begin{document}
$= \implies$
\end{document}


It was rather clear to me that the equal sign = was “shifted down” by breqn. This observation hinted that the = sign was taken from a wrong math font slot, probably. So, I don’t think the conflict is between breqn and heuristica, but is between breqn and newtxmath.

I shall first recover the possible wrong mapping of glyph using the original definition of = found in newtxmath.sty:

\DeclareMathSymbol{=}{\mathrel}{lettersA}{61}


This makes the first = in your MWE shifting upward to its correct position.

I shall then provide

\edef\Relbar{\mathchar\string"\hexnumber@\symlettersA3D }


to fix how \Relbar is supposed to behave. Note that \Relbar is used to construct many other symbols, e.g., \Longrightarrow, \Longleftarrow, \xLeftarrow, \xRightarrow and \xLeftrightarrow (the last 3 come from mathtools).

\documentclass{article}
\usepackage{mathtools}
\usepackage[scale=0.85]{heuristica}
\usepackage[heuristica]{newtxmath}
\usepackage{breqn}

\DeclareMathSymbol{=}{\mathrel}{lettersA}{61}
\makeatletter
\edef\Relbar{\mathchar\string"\hexnumber@\symlettersA3D }
\makeatother

\begin{document}
$= \implies$\par
$\Longrightarrow \, \Longleftarrow$\par
$\xLeftarrow{abc} \, \xRightarrow{abc} \, \xLeftrightarrow{abc}$
\end{document}


Disclaimer: Although the above solution fixed your problem, it would make breqn unable to auto line-break equations at equal signs. However, I’m not a fan of the breqn package: It works by radically changing the way TeX handles math lists. Currently, it has support for Computer Modern, mathpazo and mathptmx, but that’s all. There is no support for the new math font packages like newpxmath and newtxmath (which are the recommended replacements for mathpazo and mathptmx), and understandably, no support for commercial math font like mtpro2.

If your favorite math font doesn’t work with breqn, its documentation states

Page 3: If you find that a particular math font package doesn’t work then please see implementation in flexisym.dtx for how to create a support file — it is easier than one might think.

But currently the flexisym documentation is not much documented at all. Unless one has already had ton of experiences with TeX, I doubt any regular user would be able to create such support files on the fly. It took me hours to even locate the bug, and then a few more to find a fix.

Also, you wouldn’t have this problem in the first place if you had not loaded breqn. In this regard, I completely agree with @egreg in this previous answer:

… I consider breqn a nice proof of concept, but nothing really usable at document level.

How hard can it be for anyone to manually line-break an equation, knowing that he/she has full control of the typographical end result? Who knows what else would be unexpected after breqn is loaded. You have so many options provided by amsmath:

align, align*, gather, gather*, ... ;
split, aligned, gathered, ...