# position between molecules in chemfig

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}

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

\end{document}


• 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

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)

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

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

\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.

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}