Math & Sciencechemmacros | Correct Alignment for Oxidation Number

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

chemmacros | Correct Alignment for Oxidation Number

Post by ghostanime2001 »

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.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

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

chemmacros | Correct Alignment for Oxidation Number

Post by cgnieder »

Try this:

Code: Select all

\documentclass{article}
\usepackage{chemmacros,etoolbox}

\begin{document}

\ox{2,Ca}

\ExplSyntaxNamesOn
\patchcmd{\chemmacros_ox:nn}{\rlap}{\clap}{}{}
\ExplSyntaxNamesOff

\ox{2,Ca}

\end{document}
Regards
site moderator & package author
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: chemmacros | Correct Alignment for Oxidation Number

Post by ghostanime2001 »

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: 2000
Joined: Sat Apr 16, 2011 7:27 pm

chemmacros | Correct Alignment for Oxidation Number

Post by cgnieder »

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

Code: Select all

\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}
site moderator & package author
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: chemmacros | Correct Alignment for Oxidation Number

Post by ghostanime2001 »

oxidation numbers of more than one atom in the same molecule. For example H and O in water
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

chemmacros | Correct Alignment for Oxidation Number

Post by cgnieder »

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.
site moderator & package author
Post Reply