Math & Sciencechemfig | Alignment of Atoms

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
ac10
Posts: 13
Joined: Wed Dec 29, 2010 3:01 pm

chemfig | Alignment of Atoms

Post by ac10 »

Hello,

I've found that when putting a charged atom on position [6] the atom is not in line with the bond. It's slightly to the left. (Like the O- below the P).

Is there anything I can do about this? \hspace doesn't work. It puts the atom too far to the right.

Code: Select all

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[margin=1in]{geometry}                
\usepackage{wrapfig}
\usepackage{chemfig}

\begin{document}
\Large{\chemfig{R-O-P(=[2]O)(-[6]O^{-})-O^{-}}}
\end{document}

Thank you
Attachments
phos.png
phos.png (8.43 KiB) Viewed 3644 times
Last edited by ac10 on Sun Nov 27, 2011 6:33 pm, edited 1 time in total.

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
Stefan Kottwitz
Site Admin
Posts: 10397
Joined: Mon Mar 10, 2008 9:44 pm

chemfig | Alignment of Atoms

Post by Stefan Kottwitz »

Hi,

very good minimal working example!

You can fix it by adding the superscript with \rlap:

Code: Select all

\Large{\chemfig{R-O-P(=[2]O)(-[6]O\rlap{${}^{-}$})-O^{-}}}

Stefan
Attachments
chemfig.png
chemfig.png (2.88 KiB) Viewed 3641 times
LaTeX.org admin
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

chemfig | Alignment of Atoms

Post by cgnieder »

There is an easier fix using chemfig's "|" syntax, see section "Separating Atoms", page 28 of the manual:

Code: Select all

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[margin=1in]{geometry}               
\usepackage{wrapfig}
\usepackage{chemfig}

\begin{document}
\Large{\chemfig{R-O-P(=[2]O)(-[6]O|^{-})-O^{-}}}
\end{document}
site moderator & package author
ac10
Posts: 13
Joined: Wed Dec 29, 2010 3:01 pm

Re: chemfig | Alignment of Atoms

Post by ac10 »

Thank you... That's great!
Post Reply