Connect a 5-Ring to two 6-Rings in chemfig

The angles differ in case of rings with five and six corners. Therefore, the angles need to be specified manually. Trigonometric calculations using the regular/symmetric structure give the angles:

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\pgfmathsetmacro\angleA{-acos((sqrt(3)-1)/2)+30}
\pgfmathsetmacro\angleB{-\angleA + 30}
\chemfig{*6(-(-[::\angleA]-[::\angleB]?)-(*6(-?-----))----)}
\end{document}

Result

Version with labelled atoms for the calculation:

\chemfig{*6(-A(-[::\angleA]B-[::\angleB]C?)-E(*6(-D?-----))----)}

Labelled

Calculation:

  1. The length of AD is calculated by the the law of sinus of the triangle ADE with angles 120° and two times 30°. The length of AE and DE is the bond length.

  2. F is the orthogonal projection of B to the line AD. Then, there is an orthogonal triangle ABF. The length of AF can be calculated by subtracting the bond length from AD and dividing the result by two.

  3. The angle FAB is calculated (right triangle, see right-angled triangle definitions) and compared to -30°, the direction of the bond towards A. The result is stored in macro \angleA.

  4. The second relative angle \angleB angle is calculated to give the absolute angle of 0°.

Result:

\angleA: -38.529°
\angleB:  68.529°

Double bound

It still works with a double bound at the bottom:

\pgfmathsetmacro\angleA{-acos((sqrt(3)-1)/2)+30}
\pgfmathsetmacro\angleB{-\angleA + 30}
\chemfig{*6(-(-[::\angleA]=[::\angleB]?)-(*6(-?-----))----)}

Result with double bound


The problem here is that the command *<n>(<code>) is for regular polygons, and the 5-membered ring that you're trying to draw cannot possibly be regular (the angle around the top atom is already fixed at 120deg.

My solution is one of trial and error, but if I come up with another, more elegant solution I'll post it here again.

same bottom

Code

\documentclass{article}
\usepackage{chemfig}

\begin{document}
\chemfig{*6(-(-[::-42]=^[::72,1.11]?)-(*6(-?-----))----)}
\end{document}

Idea:

  • The typical angle for a regular polygon is 108 deg. Going CW from 12 o' clock position, the angles of the modified polygon are 120, 102, 108, 108, 102. Since we already have 120 deg at the top, I spread out the extra -12 degrees on either side to make 102 deg each.
  • I had to increase the length of the bottom-most bond because of the weird angle, using [::72,1.11].
  • The two ? ensures that the bonds are joint correctly, and makes up for any length error coming from the bottom-most bond.

EDIT

Alternative solution with the bottom bond having the same length as the hexagons. To preserve the pentagon shape, geometry then necessitates the two side bonds to be elongated, like so:

elong

\chemfig{*6(-(-[::-42,1.18]=^[::72]?)-(*6(-?-----))----)}

Personally I think this looks uglier. :-p

Correction

Well, colour me surprised. It is possible to have a pentagon with equal sides but unequal interior angles, known as an equilateral pentagon. @Heiko's method is conclusively better, that answer/code produces an equilateral pentagon.


In spite of the perfect symmetry taking the angles calculated by Heiko, I do not like very much a stumpy pyrrole (A), and enlarged bonds, as stated by Troy, does not help too much, because differences in angles still are clear at a glance inside the pentagon.

My idea is that irregular hexagons could be less noticeable that a simetric equilateral, but not regular, pentagon, so I tryed with:

(B) reducing a bit 5 of 6 angles of both benzene rings, so the bonds shared with the pyrrole ring are shorter, reducing a little the stumpy aspect of the pentagon. However, is not still a regular pentagon, due to the upper angle is far of the 108 degrees. More disclaimers: (a) I left trigonometric calculations to math experts, so symmetry shoul be not perfect (i. e., the angles were determined at a rough guess). (b) This approach avoid use *6(...) and *5(...) rings, so the double bonds look worse.

(C) Attempt to make a true regular pentagon just using one *5(...) and two *6(...)` benzene rings, but modified to adapt to the pentagon shape, so they are irregular hexagons. With some rotations of the molecule is hard to me detect the irregular rings, but as showed here, the lack of perfect vertical lines make this more apparent.

(D) Like (C) but in other way (the results is also a bit different).

IMHO there are no good solution in this case, is up to you what is the least bad option.

mwe

\documentclass{article}
\usepackage{chemfig}
\begin{document}
\setatomsep{20pt}\footnotesize
\chemname{\chemfig{*6(?[a]=
(-[::-38.529]=^[::68.529]?[c])
-*6(-?[c]=-=?[b])=?[b]-=?[a])}}{ --- A --- }
\chemname{\chemfig{[:90](?[a]?[c]=^
(-[::-60.5]=_[::-60.5]-[::-60.5]=_[::-60.5]?[a]?[b])-[::60.5]=^[::60.5]-[::60.5]=^[::60.5]?[c](-[::-44.4]=^[::72]?[b]))}}{ --- B --- } 
\chemname{\chemfig{*6([::0]?[a]=
*5([::6]-=-?[d,2]-?[c,2]-)
-[,,,,,draw=none]*6([::-0]-[,,,,,draw=none]=[,,,,,draw=none]?[d,2]-=?[b])-[,,,,,draw=none]?[b]?[c,2]-=?[a])}}{--- C --- }
\chemname{\chemfig{*6([::6]=*5(-=--(=^[,.95]?[a]))-*6([::-12]-=-=?[a])=[,,,,,draw=none]-[,,,,,draw=none]?[a]=-)}}{--- D --- }

\chemfig{*6(?[a]=
(-[::-38.529]\chembelow{N}{H}-[::68.529]?[c])
-*6(-?[c]=-=?[b])=?[b]-=?[a])}
\chemfig{[:90](?[a]?[c]=^(-[::-61]=_[::-61]-[::-61]=_[::-61]?[a]?[b])-[::61]=^[::61]-[::61]=^[::61]?[c](-[::-48]\chembelow{N}{H}
-[::74,,1]-[::74]))} 
\chemfig{*6([::0]?[a]=
*5([::6]-\chembelow{N}{H}--?[d,2]-?[c,2]-)
-[,,,,,draw=none]*6([::-2]-[,,,,,draw=none]=[,,,,,draw=none]?[d,2]-=?[b])-[,,,,,draw=none]?[b]?[c,2]-=?[a])}
{\chemfig{*6([::6]=*5(-\chembelow{N}{H}---(=^[,.95]?[a]))-*6([::-12]-=-=?[a])=[,,,,,draw=none]-[,,,,,draw=none]?[a]=-)}

\end{document}

Tags:

Chemfig