TransWikia.com

How to draw a dotted hydrogen bond with Chemfig?

TeX - LaTeX Asked by axvutt on January 14, 2021

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-Hcdots 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

One Answer

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}

Correct answer by leandriis on January 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP