As already noted chemfig
is quite powerful. So powerful, that actually no additional TikZ is needed if the hydrogen bridges were drawn as bonds (from chemfig
's point of view, using the bond's fourth optional argument to make them dashed) and both molecules were drawn as one chemfig
formula.
But even if you draw them both separately you can exploit the fact that you can give names to the nodes where the atoms are placed in in a chemfig
formula (@{<name>}
-syntax). To these nodes can later be referred to in another tikzpicture with remember picture
and overlay
options for which chemfig
has the wrapper \chemmove
. The only thing one has to take care of is that both molecules have the same baseline.
\documentclass{article}
\usepackage{chemfig}
\begin{document}
\chemname
{\chemfig{@{H1}H-[:180](-[:-120]H)-[:120]*6(-N(-@{H2}H)-(=@{O3}O)-(*5(-N=-N(-R)-))=-N-)}}
{Guanine}
\qquad
\chemname
{\chemfig{@{O1}O=[:60]*6(-N(-R)-=-(-N(-[::60]@{H3}H)-[::-60]H)=@{N2}N-)}}
{Cytosine}
\chemmove[dashed]{\draw (H1) -- (O1) (H2) -- (N2) (O3) -- (H3) ;}
\end{document}
You can even have the molecules as submols:
\documentclass{article}
\usepackage{chemfig}
\definesubmol{guanine}{
@{hb-gua1}H-[:180](-[:-120]H)
-[:120]*6(
-N(-@{hb-gua2}H)
-(=@{hb-gua3}O)
-(*5(-N=-N(-R)-))
=-N-
)
}
\definesubmol{cytosine}{
@{hb-cyt1}O=[:60]*6(
-N(-R)
-=-(
-N(-[::60]@{hb-cyt3}H)
-[::-60]H
)
=@{hb-cyt2}N-
)
}
\begin{document}
\chemname{\chemfig{!{guanine}}}{Guanine}
\qquad
\chemname{\chemfig{!{cytosine}}}{Cytosine}
\chemmove[dashed]{\foreach \i in {1,2,3} { \draw (hb-gua\i) -- (hb-cyt\i) ;}}
\end{document}
(The picture is the same)