16

Making my first scientific poster I have noticed that Chemfig does not join bonds in a very aesthetic way (see attached image). How can I avoid the small gaps shown here, and make sure the transition between bonds is smooth?

enter image description here

MWE as requested:

\documentclass{standalone}
\usepackage{chemfig}
\begin{document}
\chemfig{-[:30]-[:-30]}
\end{document}
  • 8
    Yes, this is a standard behaviour of chemfig. Unfortunately. I also think that instead of proposing some "workaround", it should be implemented directly in chemfig that the bonds align nicely, irrespectively from the width or angle of the bonds. – pisoir Feb 22 '14 at 13:56
  • 4
    Until it is fixed in chemfig, you can try \setbondstyle{cap=round} which makes the joints round. Maybe you will find it nice. – pisoir Feb 23 '14 at 10:17
  • @pisoir: Do you know who is working on the chemfig package? Is Chris­tian Tel­lechea aware of this problem? Is there something like an issue-tracker for chemfig / CTAN? – Martin Thoma Feb 27 '14 at 19:45
  • @moose I have no idea if the maintainer is aware of this problem. I did not find any issue-tracker. The problem may not be directly in chemfig, but in tikz and as it handles joints. There is a workaround using 'clip' command, but probably Christian is waiting for people from Tikz to come up with a better solution. – pisoir Feb 28 '14 at 7:46
9

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)

|improve this answer|||||
10

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.

|improve this answer|||||
  • 4
    And that's why \setbondstyle{cap=round} works, because it's done just by puting a circle in each corner, isn't it? – Manuel Feb 28 '14 at 14:11
  • 1
    Thanks moose for taking the effort! @Manuel, yes, the rounded ends of line is just a small "hack" for making it nicer. It does not solve the real issue with binding. Christian Tellechea, tu peut parler en francais;) – pisoir Feb 28 '14 at 18:59
  • 1
    Excellent. Thank you for posting Christian's answer to this query. Hopefully the issue will be fixed in a future update. – The V Mar 1 '14 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.