# Clash between mhchem and breqn. Any way to dodge or fix?

The use of breqn causes the subscript numbers in chemical expressions, formatted by mhchem, to be exlargened and perhaps moved slightly making it look ugly.

Is there a way to avoid this or should I stop using breqn?

Many thanks

MWE - comment out breqn to see the diference

\documentclass{article}
\usepackage{amsmath}
\usepackage{breqn}
\usepackage[version=3]{mhchem}

\begin{document}
\ce{H2SO4}
\end{document}

-
Would you please present a minimal working example (MWE)? – egreg Jan 30 '13 at 10:47
I think it is something to do with mhchem using the dmath environment. – Darling Jan 30 '13 at 11:04

\documentclass{article}
\usepackage{amsmath}
\let\xxmathchoice\mathchoice
\usepackage{breqn}
\let\yymathchoice\mathchoice

\usepackage[version=3]{mhchem}

\begin{document}
\let\mathchoice\xxmathchoice
\ce{H2SO4}
...
\let\mathchoice\yymathchoice
\begin{dmath}...
\end{document}

-
Wouldn't this break breqn? – egreg Jan 30 '13 at 17:42
well not if you put it back again, I suppose I should show that – David Carlisle Jan 30 '13 at 17:46
So before each time you plan to use the dmath environment you also add your \let\mathchoice\... before and after? I'll have a go. :) – Darling Jan 30 '13 at 18:11
@Darling Or you patch the \ce macro itself: \makeatletter\renewcommand\ce[1]{\let\mathchoice\xxmathchoice\mhchem@ce@xiii{\m‌​hchem@ce@viii#1 \mhchem@END\mhchem@ENDEND}\let\mathchoice\yymathchoice}\makeatother (or use etoolbox’s \pretocmd and \apptocmd) – Qrrbrbirlbel Jan 30 '13 at 19:22