5

Using chemfig v1.1a, cram bonds are not drawn well in a way similar to the issue found in previous versions.

Edit: My precise question here would be: does anyone know how to fix this? Or, worst case, is there a good-looking workaround?


Cram bond

\documentclass[border=5pt]{standalone}
\usepackage{chemfig}
\begin{document}
\chemfig{A<B}
\end{document} 
  • 1
    Welcome to TeX.SX! And what is the precise question here? – user31729 Apr 9 '15 at 0:09
  • Thanks! I've edited the question to state what I would like. – gbacic Apr 9 '15 at 3:39
8

Disclaimer: I did not know how to solve this myself when I asked the question, but managed to figure it out almost immediately after asking it.

The author of chemfig said he did not speak English well enough to participate in the previous issue that was similar to this, and the correspondence was written in French. Although I'm Canadian, my French is shamefully inadequate and I figured I'd post this answer here, attempt to contact the author, and direct him here so that the new version of chemfig may include my solution.

For the braver and more trusting readers, my chemfig version can be downloaded here.


I suspected that this was due to the same inherent drawing solution that Christian Tellechea, author of chemfig, mentioned in the correspondence quoted in the question "Ugly bond joints in chemfig," namely that each bond was drawn one-after-another such that tikz could not fix the joints itself.

After looking at the source, it became clear that the cram bonds' shapes were not drawn in the same way, and that something else must have been the issue.

Tellechea has a clever solution to allow the cram bonds to follow the user's style specifications that involved drawing two nodes half the base-width above and below the centre on the appropriate side.

I did some searching here on Stack Exchange and found that node and coordinate and both are just macros for path operations, and that a node can be set to have the shape coordinate.

I set the option shape=coordinate for the appropriate node commands in the source on lines 840, 841, 844 and 845. Here is what I got (it's the same code the MWE in the question above).

first attempt


It seemed as if the cram bond was not a closed path, so I located the code that draws the bond and closed each one. What results is the, in my opinion, properly drawn cram bond.

fixed version

The paths were closed by adding --cycle to the end of each path definition on lines 935, 939, 944, 951, 957, and 959.


The hollow cram bonds (i.e. \chemfig{A<|B}) are also drawn properly now.

hollow

Note that if you set the cram bond width to be too small, the miter join at the point will be too sharp and is cut off by tikz defaults. I tried changing the miter limit in the source, but the point protrudes too far to be tenable.

Here is the version with a very sharp point sharp version

and the version I have left it as in my version my version

  • Good job. I hope This fix will get to the official chemfig package. – pisoir Apr 14 '15 at 18:28
  • Hi @gbacic, I'm using your .tex file from ge.tt but it draws the bonds with the sharp point that gets too close to the symbol. – Arch Stanton Jun 7 '15 at 11:54
  • Solved. Lowering the miter limit corrected it. – Arch Stanton Jun 7 '15 at 21:30

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.