[Tex/LaTex] Crossing bonds in chemfig

chemfig

Sometimes, molecular structures have crossing bonds, and we want to indicate which bond is in the foreground. In the chemfig example below, I have done this by first drawing a thick, white bond to an empty fake substituent; this bond then serves as a background for a real bond.

\documentclass{minimal}
\usepackage{chemfig}
\setatomsep{6em}
\begin{document}
\chemfig{
              A
       -[:-45]B
  -[:180,0.75]C
        -[:45]D
        }
%                 
\quad\quad 
%
\chemfig{
               A
        -[:-45]B
   -[:180,0.75]C
        (-[:45,,,,white,line width=3pt]) % fake substituent
         -[:45]D
         }
\end{document}

enter image description here

This works, but there must be a better way. chemfig is built on tikz, so may be the tikz.decorations library can be used to create a bond style that carries its white background with it at all times. Does anyone know how to do this?

Best Answer

I would write this:

\chemfig{A
       -[:-45]B
  -[:180,0.75]C
        -[:45,,,,preaction={draw=white, -,line width=6pt}]D
        }
Related Question