LaTeX forum ⇒ Math & Sciencechemmacros | 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

Postby ghostanime2001 » Thu Aug 02, 2012 11:23 pm

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:

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Sun Aug 05, 2012 9:21 pm

Try this:

  1. \documentclass{article}
  2. \usepackage{chemmacros,etoolbox}
  3.  
  4. \begin{document}
  5.  
  6. \ox{2,Ca}
  7.  
  8. \ExplSyntaxNamesOn
  9. \patchcmd{\chemmacros_ox:nn}{\rlap}{\clap}{}{}
  10. \ExplSyntaxNamesOff
  11.  
  12. \ox{2,Ca}
  13.  
  14. \end{document}


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

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Postby ghostanime2001 » Mon Aug 06, 2012 7:28 am

How can you use this for multiple oxidation number assigning on the same molecule but on a different atom ?

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Tue Aug 07, 2012 2:50 pm

I'm not sure I understand what you mean...

  1. \documentclass{article}
  2.  
  3. \usepackage{chemmacros}
  4.  
  5. % patch chemmacros:
  6. \usepackage{etoolbox}
  7. \ExplSyntaxNamesOn
  8. \patchcmd{\chemmacros_ox:nn}{\rlap}{\clap}{}{}
  9. \ExplSyntaxNamesOff
  10.  
  11. \begin{document}
  12.  
  13. Calciumsulfate:
  14. \ch{"\ox{2,Ca}" S "\ox{-2,O}" {}4}
  15.  
  16.  
  17. \end{document}
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Postby ghostanime2001 » Tue Aug 07, 2012 10:56 pm

oxidation numbers of more than one atom in the same molecule. For example H and O in water

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Wed Aug 08, 2012 8:47 am

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


Return to “Math & Science”

Who is online

Users browsing this forum: No registered users and 4 guests