[Tex/LaTex] Using hepparticles with breqn

breqnincompatibility

I want to use the two packages hepparticles and breqn together in the same document.
But the hepparticles package does not seem to work well with breqn.
Here is a minimal not-working example.

\documentclass{article}
\usepackage{hepparticles}
\usepackage{breqn}
\begin{document}
This is the notation for an electron neutrino \HepParticle{\nu}{e}{}.\\
This is the notation for an electron anti-neutrino \HepAntiParticle{\nu}{e}{}.
\end{document}

Compiling with pdflatex shows strange symbols for the greek letters \nu, although the subscripts "e" are displayed fine.

enter image description here

The \HepParticle command works fine when breqn is not used.
Is there a way I can use both packages hepparticles and breqn?

Best Answer

A really minimal example actually doesn't require hepparticle:

\documentclass{article}
\usepackage{breqn}

\begin{document}

$\mathit{\nu}$

\end{document}

If you try it, you'll see the same strange symbol you get with your code, which is the ring accent from the italic font. The fact is that eventually \HepParticle{\nu}{e}{} wants to do

\mathit{\nu}

Such a command would simply produce a standard nu letter, with the default LaTeX setting; hepparticles uses this to italicize letters, but not using math italic.

However, breqn (or, better, flexisym) changes the meaning of \nu so that it gives essentially a random result if in the argument to \mathit. For very strange reasons, Greek letters are redeclared by flexisym to be of type 7 instead of 0, so they obey the current math group.

You can fix \nu, but you'll have similar problems with other characters, probably. Look in cmbase.sym and copy the offending definitions changing Var into Ord as I did for \nu.

\documentclass{article}
\usepackage{hepparticles}
\usepackage{breqn}

% Fix the wrong assignment to \nu
\DeclareFlexSymbol{\nu}{Ord}{greek}{17}

\begin{document}
Electron neutrino \HepParticle{\nu}{e}{}.

Electron anti-neutrino \HepAntiParticle{\nu}{e}{}.
\end{document}

enter image description here

This is clearly a bug of flexisym; but I usually recommend against using breqn in the first place. A nice idea which simply doesn't work.


On the other hand, it seems that at least this example works with unicode-math. Compile with XeLaTeX:

\documentclass{article}
\usepackage{hepparticles}
\usepackage{breqn}
\usepackage{unicode-math}

\begin{document}
Electron neutrino \HepParticle{\nu}{e}{}.

Electron anti-neutrino \HepAntiParticle{\nu}{e}{}.
\end{document}

enter image description here