5

I try to number atoms in an aromate using a code of the chemfig manual on page 30.

As seen in the picture the blue number 5 does not align with the other numbers.

Any ideas why H in NH misaligns my numbering?

PS: Similar: This answer aligns the numbers (in this case letters), but the letters are the same size of the N atom. Using \scriptstyle causes the same problem.

\documentclass[border=1cm]{standalone}
\usepackage{chemfig}

\begin{document}

    %%% numbers in ring
    \definesubmol\X1{-[,-0.35,,,draw=none]#1}
    \newcommand\BLUE[1]{\scriptstyle\textcolor{blue}{#1}}

    \definesubmol{D}{*6(((!\X \BLUE{2}))-N(!\X \BLUE{1})(-R|ibose)-(!\X \BLUE{6})(=O)-NH(!\X \BLUE{5})-(!\X \BLUE{4})(=O)-(!\X \BLUE{3})=)}
        
    \chemfig{!D}

\end{document}

enter image description here

6

You must tie the \X bond to N instead of H like it is the case in your first code. You can set the departure atom to 1 in the submol definition:

\documentclass[border=1cm]{standalone}
\usepackage{chemfig}
\begin{document}
\definesubmol\X1{-[,-0.35,1,,draw=none]\scriptstyle\color{blue}#1}
\chemfig{*6(((!\X{2}))-N(!\X{1})(-R|ibose)-(!\X{6})(=O)-NH(!\X{5})-(!\X{4})(=O)-(!\X{3})=)}
\end{document}
1
  • Mmh... I also tried this before but it did not work. I must have had a typo. +1 – Roland May 13 at 22:54
5

I found a solution to go around it by simply drawing an invisible bond between N and H.

Nevertheless, suggestions are still appreciate.

\documentclass[border=1cm]{standalone}
\usepackage{chemfig}


\begin{document}

    %%% numbers in ring
    \definesubmol\X1{-[,-0.35,,,draw=none]#1}
    \newcommand\BLUE[1]{\scriptstyle\textcolor{blue}{#1}}

    \definesubmol{D}{*6(((!\X \BLUE{2}))-N(!\X \BLUE{1})(-R|ibose)-(!\X \BLUE{6})(=O)-N(-[0,0.26,,,draw=none]H)(!\X \BLUE{5})-(!\X \BLUE{4})(=O)-(!\X \BLUE{3})-[,,1])}
        
    \chemfig{!D}


\end{document}

enter image description here

4

Another approach with the center of the ring

\documentclass[border=1cm]{standalone}
\usepackage{chemfig}
\begin{document}
\chemfig{*6(-N(-[6]R|ibose)-(=[:-30]O)-NH-(=[2]O)-=)}
\chemmove{\foreach \x in {1,...,6}
    \path (cyclecenter1) ++(330-60*\x:2em) node[blue,font={\scriptsize}] {\x};}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.