# How to turn off “bonds” in chemmacros\chemformula?

In chemmacros/chemformula a hyphen is replaced with a bond, and you have to put hyphens in quotes. I don't use the bond feature, as I use this to write out papers, rather then educational materials. Is there a way I can turn off the bond interface unless I specifically want it on for that formula (you see double or triple bonds in the names of papers once in a blue moon, so I'd like that feature accessible, just not the default).

Probably my shortest MWE ever:

\documentclass{article}

\usepackage{chemmacros}
\chemsetup{formula=chemformula} %chemformula, not mhchem or such

\begin{document}
\ch{UO2-H2O2 "-" K2CO3} %Note the bond vs hyphen
\end{document} %use chemformula instead of say, mhchem


That's actually rather easy:

\documentclass{article}
\usepackage{chemmacros}

\chemsetup{formula=chemformula}

\begin{document}

\ch{UO2-H2O2 "-" K2CO3}

\RemoveChemCompoundProperty{-}
\ch{UO2-H2O2 "-" K2CO3}

\end{document}


If you want to restrict the change you can either use grouping ({...} or \begingroup...\endgroup) or define the single bond again later with

\ExplSyntaxOn
\NewChemCompoundProperty {-} { \chemformula_single_bond: }
\ExplSyntaxOff


Because of the double role of - both as single bond and as minus sign using

\NewChemCompoundProperty{-}{\bond{single}}


won't suffice.

• That was fast! Now if I want to turn it back on, can I do that? All of these will be in my .bib file, so it is hard to just put that command before the one I need. – Canageek Jun 13 '16 at 18:39
• @Canageek I edited the answer. – cgnieder Jun 13 '16 at 19:17
• So I could so something like title = "{\RemoveChemCompoundProperty{-} \ch{...}}", and that would work? – Canageek Jun 14 '16 at 20:59
• @Canageek yes, it would – cgnieder Jun 14 '16 at 22:19