3

I am trying to illustrate the hydrogen bonding between two nucleotides. However, chemfig is positioning one below the other. How can I place them adjacent horizontally?

\documentclass[11pt,letterpaper]{article}
\usepackage{chemfig}
\begin{document}

\chemfig{N*6([:270](-sugar)-=(-)-(=O@{d})-NH@{b}-(=O)-)}{Thymine}

\chemfig[shift={(3,2)}]{[:90]N*6(-*5(-N(-sugar)-=N-)=-(-NH_2@{a})=N@{c}-=)}{Adenine}

\chemmove{ \draw[,,,,,dash pattern=on 2pt off 2pt] (a)--(b); \draw[,,,,,dash pattern=on 2pt off 2pt] (c)--(d); }

\end{document}

adenine and thymine

1
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Apr 12, 2017 at 1:06

2 Answers 2

2

One way you can use to place the molecules side by side is by using the command \chemname{<molecule>}{<name>}, which also has the added effect of placing the name of the molecule below the molecule itself.

Apart from that, I did some minor changes to your drawing to make it look nicer:

  • Used [shift={(0,-2.5)}] instead for proper vertical alignment of the two molecules.
  • Shifted the placing of node to before the atom itself, not after the atom, as was in your code. Note this syntax by the chemfig package documentation: a node on an atom using the syntax “@{<name>}” immediately before the relevant atom. This will ensure that your arrows start and end at the right location.
  • Changed NH2 to H2N instead, because I presume the bond to the ring is attached to the N atom, not the H. (My chemistry is a little rusty.. :p)

adenine and thymine side by side

\documentclass[11pt,letterpaper]{article}
\usepackage{chemfig}
\begin{document}

    \chemname{%
    \chemfig{N*6([:270](-sugar)-=(-)-(=@{d}O)-N(-@{b}H)-(=O)-)}
    }{Thymine}
    \qquad
    \chemname{%
    \chemfig[shift={(0,-2.5)}]{[:90]N*6(-*5(-N(-sugar)-=N-)=-(-@{a}H_2 N)=@{c}N-=)}
    }{Adenine}

    \chemmove{%
        \draw[dash pattern=on 2pt off 2pt] (a)--(b); 
        \draw[dash pattern=on 2pt off 2pt] (c)--(d); 
    }

\end{document}

Ps. I'm not particularly sure about which arrows should go where for the H bonding, make any amendments as you see fit.

0
0

Thanks Troy. That did the trick. Actually, I realize that the H-bonds were pointing to the wrong locations (crossed with each other). Here is an update.

\documentclass[11pt,letterpaper]{article}
\usepackage{chemfig}
\begin{document}

\chemname{%
   \chemfig{
      N*6([:0](-sugar)-(=O)-N(-@{b}H)-(=@{d}O)-(-)=-)
   }
}{Thymine}
\qquad
\chemname{%
   \chemfig[shift={(-0.5,-1.25)}]{
      [:90]N*6(-*5(-N(-sugar)-=N-)=-(-@{a}H_2 N)=@{c}N-=)
   }
}{Adenine}
\chemmove{%
   \draw[-,dash pattern=on 2pt off 2pt] (a)--(d); 
   \draw[-,dash pattern=on 2pt off 2pt] (c)--(b); 
}

\end{document}

adenine and thymine

You must log in to answer this question.

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