I've never written anything with chemfig before so had to just guess at the syntax. This is basically my comment above made into an example and expanded a little.
There are two ways to achieve the effect of one line going over another. One way is for the under line to "know" that it is the under line and break itself at the crossing point (this is what I do in my braids
package). The other way is for the over line to, as you say, carry around its white background. This has the advantage that no-one actually has to know the exact crossing point (and is what I do in my knots
package .. which isn't on CTAN yet, but there's examples hereabouts). However, this has the disadvantage that you have to know the background colour and it has to be uniform. Plus there can be "edge" effects if the lines get close to each other but don't actually cross.
Here's examples of both of those approaches. To get the under line to break, we use the decorations.markings
library to put a node in the line. As you may be able to guess from the code, I had to do a bit of trial-and-error to get the right break point. The over line method doesn't need any such hand-holding, nor any special libraries. I've also packaged the methods up as styles to make them easy to apply.
Here's the code:
\documentclass{article}
%\url{http://tex.stackexchange.com/q/40153/86}
\usepackage{chemfig}
\usetikzlibrary{decorations.markings}
\setatomsep{6em}
\tikzset{
over line/.style={
white,
double=black,
double distance=\the\pgflinewidth,
line width=1.5pt,
},
under line/.style={
decoration={
markings,
mark connection node=mid node,
mark=at position #1 with {}
{\node[transform shape,minimum size=3pt] (mid node) {};}
},
decorate
}
}
\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
}
%
\quad\quad
%
\chemfig{
A
-[:-45]B
-[:180,0.75]C
-[:45,,,,over line]D
}
%
\quad\quad
%
\chemfig{
A
-[:-45,,,,under line=.46]B
-[:180,0.75]C
-[:45]D
}
\end{document}
Here's the result. Your original ones are the first two, then the "over line" approach, and lastly the "under line".
double
line where the outer line was the background colour and the inner line the original colour. But when you dig deep in the code, what really happens is that it draws two lines just as you are doing.minimal
class isn't a great one to use for examples. It really is too minimal.)