1

What is the best way to have a 'detached but attracted' ion in chemfig? So I have a large molecule with a positive charge and want to position a negatively charged ion close by it.

According to my understanding, \charge{}{} or \Charge{}{} should be used. This works up until \charge{X}{Y^+}, but \charge{X^{-}}{Y^+} fails with some PGF error (roughly "can't divide 0 by 0"). My workaround is \charge{\ce{X-}}{Y}, but I don't like to use two separate packages.

Do you have any suggestions on how to better approach this?

My MWE is

\documentclass{article}
\usepackage{chemfig, mhchem}

\begin{document}
    This is not quite minimal but shows what I intend:\\
    \schemestart
    \chemfig{[:90]-[@{op1,.5} ::-30]-[::-60](-[@{cl1,.5} ::60])-[::-60]C(=[::-60]O)-[::30]O-[@{op,.5} ::30]-[@{cl,.5} ::30]\charge{[extra sep=.4cm]130=\ce{X-}}{N^+}*5(=-N(-R)-=-)}
    \polymerdelim[height = 5pt, indice = \!n', h align=false, delimiters={[]}]{op1}{cl1}
    \polymerdelim[height = 5pt, indice = \!n, delimiters={[]}]{op}{cl}
    \schemestop
    
    \vspace{3cm}
    This is actually minimal and works with package mhchem:\\
    
    \vspace{1cm}
    \charge{[extra sep=.4cm]130=\ce{X-}}{N^+}
    
    \vspace{3cm}
    This is what I want but doen't work
    
    \vspace{1cm}
    %\charge{[extra sep=.4cm]130=X^-}{N^+}
\end{document}

1 Answer 1

2

You can write

\charge{[extra sep=.4cm]130=\printatom{X^-}}{N^+}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .