2

I tried to draw hydantoin's structure with the code like this:

\documentclass{report}
\usepackage[utf8]{inputenc} 
\usepackage{chemfig}
\def\Hv@scale{0.65}
\makeatother
\DeclareMathAlphabet{\foo}{OT1}{phv}{m}{n}
\renewcommand*\printatom[1]{\ensuremath{\foo{#1}}}
\makeatother
\setchemfig{double bond sep = 0.20700 em,   
            fixed length = false,    
            bond offset = 0.18265 em, 
            bond style={line width=0.50pt},
            atom sep = 1.2 em}

\begin{document}
\begin{figure}[h!]
\centering
\chemfig{*6(-=*6(-O--(-=^[:-30]*5(-[2,2]HN-(=O)-NH-(=O)-))=-)-=-=)}
\end{figure}
\end{document}

and the output:

enter image description here

However, I expect to draw something like this:

enter image description here

The bond is supposed to connect with nitrogen atom not hydrogen. How to adjust the bond between nitrogen atom and carbon atom correctly? I've tried guanine example in chemfig documentation (page 42) but it didn't work. Thank you for your explanation.

3
  • Welcome to the TeX.SE. community. For example I am not expert of the chemical structure :-(...But how must be your image?
    – Sebastiano
    Jul 20, 2021 at 12:05
  • I've updated the question with how the image is supposed to be. Thank you for your response. Jul 20, 2021 at 12:48
  • Welcome again and thank you for the addendum.
    – Sebastiano
    Jul 20, 2021 at 15:00

1 Answer 1

7

How about this?

\documentclass{report}
\usepackage[utf8]{inputenc} 
\usepackage{chemfig}
\def\Hv@scale{0.65}
\makeatother
\DeclareMathAlphabet{\foo}{OT1}{phv}{m}{n}
\renewcommand*\printatom[1]{\ensuremath{\foo{#1}}}
\makeatother
\setchemfig{double bond sep = 0.20700 em,   
            fixed length = false,    
            bond offset = 0.18265 em, 
            bond style={line width=0.50pt},
            atom sep = 1.2 em}

\begin{document}
\begin{figure}[h!]
\centering
\chemfig{
  *6(
  -=*6(
  -O--
  (-=^[:-30]
  *5(-[,,,2]HN-(=O)-NH-(=O)-NH)
  )
  =-
  )-=-=
  )
}
\end{figure}
\end{document}

enter image description here

5
  • 1
    Thank you very much! It worked perfectly. Jul 20, 2021 at 14:12
  • 1
    @lafuannaufal, you are very welcome.
    – citsahcots
    Jul 20, 2021 at 14:14
  • @modnar Please what is the error? Thank you very much.
    – Sebastiano
    Jul 20, 2021 at 15:00
  • 1
    @Sebastiano, according to the documentation of chemfig (Section 7, I believe), the arrival and departure atoms are supposed to be specify by [,,d,a].
    – citsahcots
    Jul 20, 2021 at 15:08
  • 1
    @modnar Thank you very much...I have upvoted 5 min ago :-)
    – Sebastiano
    Jul 20, 2021 at 15:10

You must log in to answer this question.

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