0

I want to colour only the hydrogen atoms in a cyclic molecule using the Chemfig environment. The atoms are placed over a nitrogen atom, with a positive charge. But when y draw the molecule, the group "NH2+" are misplaced. The bonds must go over the Nitrogen.

\documentclass{article}
\usepackage{chemfig}
\setchemfig{atom sep=1.5em}

\begin{document}

\chemfig{*6(--\charge{45:1.5pt=$\scriptstyle+$}{N\color{red}H_2}----)}

\end{document}

Here is a picture of the problem.

enter image description here

I tried some strategies, using the symbol | for example, for separate the group, or with the bond options like [,,,1]. But these seems useless. Thanks in advance for your help!

2 Answers 2

1
\documentclass{article}
\usepackage{chemfig}
\setchemfig{atom sep=1.5em}
\begin{document}
\chemfig{*6(--N|\charge{60:1pt=$\scriptstyle+$}{\color{red}{H_2}}----)} 
\end{document}

enter image description here

1
One way to do this


\documentclass{article}
    \usepackage{chemfig}
    \begin{document}
        \chemfig{*6(--\charge{60:3pt=$\scriptstyle+$}{N}|{\color{red}H_2}----)}
    \end{document}

one other way to do this is to put the H2 inside the \charge command

\documentclass{article}
\usepackage{chemfig}
\begin{document}
    \chemfig{*6(--[,,1]\charge{60:3pt=$\scriptstyle+$,356:4pt=\color{red}H$_2$}{N}----)}
\end{document}

enter image description here

Another way to do this is to put the H2 on a short "invisible" bond

\documentclass{article}
\usepackage{chemfig}
\begin{document}
    \chemfig{*6(--[,,1]\charge{60:3pt=$\scriptstyle+$}{N}(-[:356,.32,,,,draw=none]{\color{red}H_2})----)}
\end{document}

You must log in to answer this question.

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