5

I'm using the chemmacros package to format redox reactions using its redox module to get the nice arrows that indicate which atoms are changing oxidation state as illustrated in the package manual. I am trying to do something that the manual says is nonstandard and may not work, which is using the mhchem package to format reactions. Nonetheless it works in one simple instance but not another and I'd appreciate any tips to get it working better.

It appears if you have chemmacros draw an arrow with the \redox(a,b) command where a and b are in the same compound, it works fine. But if a and b are in different compounds in the reaction (two formulas separated by a + or an arrow) in the \ce{ a + b -> c + d} reaction, then the chemmacros arrow doesn't quite know where to start.

Here's an example.

\documentclass{article} 
\usepackage[version=4]{mhchem}
\usepackage{chemmacros}
\usechemmodule{redox}
\begin{document}

\ce{\OX{a,Pt}(CH2CH=CH\OX{b,C}(CH2)2) + \OX{c,Fe} + \OX{d,Zn}}\redox(a,b)[draw=red,->]{\small oxidation}
%that above command produces good output

\bigskip

\ce{\OX{a,Pt}(CH2CH=CH\OX{b,C}(CH2)2) + \OX{c,Fe} + \OX{d,Zn}}\redox(a,c)[draw=red,->]{\small oxidation}
%that above command produces bad output

\end{document}

enter image description here

  • I don't have this problem. Did you compile twice? – Bernard Apr 23 '16 at 14:57
  • Bernard - yes I did. So you can use my MWE and the second example looks good? – William Kennerly Apr 23 '16 at 15:04
  • Quite good. I can't post the result in a comment, unfortunately. Do you have the latest version of chemmacros (5.5)? – Bernard Apr 23 '16 at 15:10
  • Yes -- chemmacros 5.5 and mhchem 4.04. I didn't add that figure up there, one of the editors did, so evidently they have the issue too. I'll add that I'm using TeXShop, TeXLive 2015 on a mac (Yosemite). – William Kennerly Apr 23 '16 at 15:16
  • Try replacing \ce (from mhchem) with \ch (from chemmacros). It appears to work for me. – Ross Apr 23 '16 at 15:24
5

It works if you place \ce inside \OX instead of the other way around:

\documentclass{article} 
\usepackage{chemmacros}
\chemsetup{
  formula = mhchem ,
  modules = redox
}
\begin{document}

\OX{a,\ce{Pt}}\ce{(CH2CH=CH\OX{b,C}(CH2)2) + }\OX{c,\ce{Fe}}\ce{ +}\OX{d,\ce{Zn}}
\redox(a,c)[draw=red,->]{\small oxidation}

\end{document}

This is one of the cases where the “natural” support package chemformula is easier to work with:

\documentclass{article} 
\usepackage{chemmacros}
\chemsetup{
  formula = chemformula ,
  modules = redox
}
\begin{document}

\ch{"\OX{a,Pt}" (CH2CH=CH\OX{b,C}(CH2)2) + "\OX{c,Fe}" + "\OX{d,Zn}"}
\redox(a,c)[draw=red,->]{\small oxidation}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.