You are mixing chemistry typeset with maths typeset; I don't think that the mhchem module is set up for this. There is probably much more wrong than what you consider a bug. Assuming $K$ is an equilibrium constant, it should be in italics (it is not with \ce
) and the subscript should be in upright font (but get interpreted as variables within \ce
). A similar thing happens to the interpretation of the $x$.
The macro \ce{ ... }
will always try to interpret its contents as a chemistry or reaction equation; it is not designed to handle anything else. So in your equation, actually only the protons should be wrapped within this macro:
$$\begin{multline}
[\ce{H+}]^4
+ (K_\mathrm{a1} + xC_T)[\ce{H+}]^3
+ (K_\mathrm{a1} K_\mathrm{a2} + (x - 1) C_T K_\mathrm{a1}
- K_\mathrm{w})[\ce{H+}]^2\\
+ K_\mathrm{a1} ((x - 2)C_T - K_\mathrm{w})[\ce{H+}]
- K_\mathrm{a1} K_\mathrm{a2} K_\mathrm{w}
\tag{C4}
\end{multline}$$
$$\begin{multline}
[\ce{H+}]^4
+ (K_\mathrm{a1} + xC_T)[\ce{H+}]^3
+ (K_\mathrm{a1} K_\mathrm{a2} + (x - 1) C_T K_\mathrm{a1}
- K_\mathrm{w})[\ce{H+}]^2\\
+ K_\mathrm{a1} ((x - 2)C_T - K_\mathrm{w})[\ce{H+}]
- K_\mathrm{a1} K_\mathrm{a2} K_\mathrm{w}
\tag{C4}
\end{multline}$$