chemfig
Operation of chemfig
11 Branches¶
11.1 Principle¶
Up to now, all the molecules have been linear, which is rare. A sub-molecule can be attached to an atom by following the atom with ⟨code⟩ in parentheses. This ⟨code⟩ is the code of the sub-molecule which will be attached to the atom.
In this example, the sub-molecule “-[1]W-X” will be attached to atom “B”:
\chemfig{A-B(-[1]W-X)-C}
There can be several sub-molecules which are to be attached to the same atom. Just have several parentheses containing the code for each sub-molecule:
\chemfig{A-B(-[1]W-X)(-[6]Y-[7]Z)-C}
The code of each sub-molecule can define its own default values, which will be valid throughout the whole sub-molecule. Here a sub-molecule “[:60]-D-E” is attached to atom “B”, with a default angle of 60° absolute. A second sub-molecule “[::-30,1.5]-X-Y” is attached to “B” with a default bond angle 60° less than that of the preceding bond (which will be the one between “A” and “B”) and with an interatomic distance 1.5 times the default value:
\chemfig{A-B([:60]-D-E)([::-30,1.5]-X-Y)-C}
Observe what happens if, at the beginning of the main molecule, one writes “[:-45]”:
\chemfig{[:-45]A-B([:60]-D-E)([::-30,1.5]-X-Y)-C}
We see that the angle between the bond B-C and the bond B-X stays at 30° because it is a relative angle for the sub-molecule “-X-Y”. By contrast, the branch “-D-E” stays inclined at 60° to the horizontal, and does not follow the rotation given by the \(-45\degres\) angle at the beginning; this is expected because “-D-E” has an absolute angle. It is essential that all the angles be relative in order to rotate the whole molecule.
11.2 Nesting¶
Sub-molecules may be nested, and the rules seen in the preceding paragraphs stay in force:
\chemfig{A-B([1]-X([2]-Z)-Y)(-[7]D)-C}
11.3 Method¶
Suppose now that we want to draw an acid anhydride molecule:
The best way to get this is to find the longest chain. Here, for example, we can draw the chain R-C-O-C-R taking into account angles and using only relative angles:
\chemfig{R-C-[::-60]O-[::-60]C-[::-60]R}
To this structure we just have to add two “=O” sub-molecules to each of the carbon atoms:
\chemfig{R-C(=[::+60]O)-[::-60]O-[::-60]C(=[::+60]O)-[::-60]R}
Because we used only relative angles, we can rotate this molecule by giving a default angle of e.g. 75°:
\chemfig{[:75]R-C(=[::+60]O)-[::-60]O-[::-60]C(=[::+60]O)-[::-60]R}