## LaTeX forum ⇒ Math & Science ⇒ chemmacros | Correct Alignment for Oxidation Number

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

### chemmacros | Correct Alignment for Oxidation Number

How do you make the oxidation number center itself in the center of each chemical element? If you take a closer look at the chemmacros package, the oxidation number is moved slightly to the left.

Tags:

cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm
Try this:

\documentclass{article}\usepackage{chemmacros,etoolbox} \begin{document} \ox{2,Ca} \ExplSyntaxNamesOn\patchcmd{\chemmacros_ox:nn}{\rlap}{\clap}{}{}\ExplSyntaxNamesOff \ox{2,Ca} \end{document}

Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am
How can you use this for multiple oxidation number assigning on the same molecule but on a different atom ?

cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm
I'm not sure I understand what you mean...

\documentclass{article} \usepackage{chemmacros} % patch chemmacros:\usepackage{etoolbox}\ExplSyntaxNamesOn\patchcmd{\chemmacros_ox:nn}{\rlap}{\clap}{}{}\ExplSyntaxNamesOff \begin{document} Calciumsulfate:\ch{"\ox{2,Ca}" S "\ox{-2,O}" {}4}  \end{document}
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am
oxidation numbers of more than one atom in the same molecule. For example H and O in water

cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm
Yo can just use the \ox command repeatedly. Or do you want the numbers in a structural formula? In the latter case I'd use chemfig.
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim