6

I would like to draw a compound with a hydrogen bond with the chemfig package. Usually, this is drawn with a dotted line. However, this seems not to be a standard bond for this package (i.e. it is not in the table p. 8 in the manual). Is there a simple way to do it?

MWE:

\documentclass{article}
\usepackage{chemfig}

\begin{document} \begin{center} \chemfig{A-H\cdots B(-[:60]C)-[:-60]D} \end{center} Here I use \texttt{\textbackslash cdots} ($ \cdots $) where I would like to have a bond command. \end{document}

Result:

enter image description here

axvutt
  • 63
  • 4
  • You could give \chemfig{A-H-[:0,,,,dotted]B(-[:60]C)-[:-60]D} or \chemfig{A-H-[:0,,,,thick,dotted]B(-[:60]C)-[:-60]D} a try. – leandriis Jan 04 '21 at 18:26
  • @leandriis That works perfectly, thank you! How can I mark your comment as the correct answer? – axvutt Jan 04 '21 at 18:35
  • I just added an answer including the two suggestions from my previous comment as well as an alternative approach in case you prefer the dotted line to consist of small circles instead of small squares. – leandriis Jan 04 '21 at 18:37

1 Answers1

7

Here are three possible ways of drawing a dotted bond inside of \chemfig. The first two options use dotted from the tikz package with varying line thicknesses. Since this will result in the line being composed of small squares as opposed to circles, I added a third option based on the dots style originally defined by Jake.

enter image description here

\documentclass{article}
\usepackage{chemfig}

\makeatletter % from: https://tex.stackexchange.com/a/101263/134144 \tikzset{ dot diameter/.store in=\dot@diameter, dot diameter=1pt, dot spacing/.store in=\dot@spacing, dot spacing=5.5pt, dots/.style={ line width=\dot@diameter, line cap=round, dash pattern=on 0pt off \dot@spacing } } \makeatother

\begin{document}

\chemfig{A-H-[:0,,,,dotted]B(-[:60]C)-[:-60]D}

\chemfig{A-H-[:0,,,,thick,dotted]B(-[:60]C)-[:-60]D}

\chemfig{A-H-[:0,,,,dots]B(-[:60]C)-[:-60]D}

\end{document}

leandriis
  • 62,593