Ugly bond joints in chemfig

I've contacted Christian Tellechea, the maintainer of the chemfig package.

Hi Christian,

there is currently a discussion about bound joints in chemfig on tex.stackexchange: Ugly bond joints in chemfig

Are you aware of that problem? Is it a chemfig-problem or a TikZ problem? I would really appreciate it if you could participate in the discussion!

Best regards, Martin

and got this answer (Thank you Christian!).

(canaaerus put the translation of the original Email, that was written in French, below each sentence in italics. Thank you!)

Bonjour, merci de m'écrire un email.

there is currently a discussion about bound joints in chemfig on tex.stackexchange: Ugly bond joints in chemfig

J'ai vu cette discussion.
I have seen the discussion.

Are you aware of that problem?

Mais ce n'est pas un problème !
Well – that is not an error.

Is it a chemfig-problem or a TikZ problem?

Ce n'est pas un problème, c'est le comportement de tikz (et pstricks) lorsqu'on trace des lignes les unes après les autres au lieu de tracer un chemin en une seule fois. On peut le constater avec ce code
It is not an error, but just the way tikz (and pstricks) behave at drawing lines, one after the other, when we draw a path. This can be demonstrated with the following code

\begin{tikzpicture}
    \draw[line width=5pt](0,0)--(2,1)--(4,0); 
\end{tikzpicture}
\bigbreak
\begin{tikzpicture}
    \draw[line width=5pt](0,0)--(2,1);
    \draw[line width=5pt](2,1)--(4,0);
\end{tikzpicture} 

qui produit l'affichage :
which produces:

enter image description here

Chemfig trace une liaison juste après l'avoir lue dans le code et donc trace les liaisons les unes après les autres ce qui conduit à des discontinuités comme dans l'exemple du bas.
Chemfig draws a bond right after finding it in the code and thus one bond after the other. That leads to the discontinuity in the second example.

I would really appreciate it if you could participate in the discussion!

Je ne parle pas l'anglais suffisamment bien pour y participer.
I do not speak English well enough to participate there.

Best regards, Martin

Merci pour votre email Cordialement, Christian Tellechea
Thanks for your email. Best regards, Christian Tellechea

Now I guess most people here don't speak French. My French and my english isn't very good, either, but I'll try:

According to Christian, this isn't a problem. TikZ gives this behavior when you make lines like in the first version he stated. You get nice bond joints when you use the second version.

Chemfig reads the code and writes the bonds one after another. This leads to the bonds as they currently are.


In the next email I wanted to know about his plans for Chemfig. He added this answer:

Lately I've been rather busy and I had no time to fix anything in my packages. Right now, I'm more available and I'm going to seek if I can solve the problem in chemfig. I can not promise anything.

That's good news :-) So there is a chance that this gets fixed.


I have tried to "fix" the problem. It is not really a "bugfix" (since there is no bug) but a dirty workaround. It seems to work :

enter image description here

The beta version needs more testing. If you can't wait (or want to test it), you can download it here. The zip file contains the package source itself (chemfig.tex), a small test file (test.tex) and the pdf manual, compiled with the new version (chemfig_doc_en.pdf)