chemfig
Operation of chemfig
1 The \chemfig macro¶
The macro \chemfig has the following syntax
\chemfig[list of ⟨keys⟩=⟨values⟩]{⟨molecule code⟩}
The optional argument in square brackets sets the parameters used for this molecule. It should be noted that the parameters are only modified for the current molecule and will be restored to their previous values after the macro has been executed. To permanently modify parameters, the macro \setchemfig{⟨key⟩=⟨values⟩} should be used.
Here is the complete list of parameters for the \chemfig macro, their default values, and a brief description.
| ⟨keys⟩ | default ⟨values⟩ | Description |
|---|---|---|
| chemfig style | ⟨empty⟩ | style given to tikz |
| use atom strut | false | put in the the strut of previous atom in the argument of \printaom |
| atom style | ⟨empty⟩ | style of tikz nodes containing atoms |
| bond join | false | boolean for bond joins |
| fixed length | false | boolean for fixed bond widths |
| cram rectangle | false | boolean to draw rectangle Cram bond |
| cram width | 1.5ex | length of the base of the triangles Cram bonds |
| cram dash width | 1pt | width of dash Cram bonds |
| cram dash sep | 2pt | space between dash Cram bonds |
| atom sep | 3em | space between atoms |
| bond offset | 2pt | space between atom and bond |
| double bond sep | 2pt | space between multiple bonds lines |
| angle increment | 45 | increment of the angle of bonds |
| node style | ⟨empty⟩ | style of atoms |
| bond style | ⟨empty⟩ | style of bonds |
| baseline | 0pt | dimension or name of node to set the vertical position |
| debug | false | show nodes, anchors and names of nodes |
| cycle radius coeff | 0.75 | shrinkage ratio of the circle or arc inside cycles |
| stack sep | 1.5pt | vertical gap between arguments of \chemabove and \chembelow macros |
| show cntcycle | false | show rings numbers |
| autoreset cntcycle | true | reset ring counter at \chemfig execution |
| gchemname | true | if true, makes the depth assignments made by \chemnameinit and \chemname global |
| save | false | if ⟨true⟩, saves the TikZ commands generated by the \chemfig macro to a file |
| save name | \jobname-fig* | sets the file name |
The ⟨molecule code⟩ contains instructions for drawing the molecule according to a syntax that will be explained in this document. There are no restrictions on the characters accepted in the code:
all catcode 11 or 12 characters, i. e. upper and lower-case letters, numbers, mathematical operators (+ - * / =), punctuation marks whether active or not (. , ; : ! ? ' ` " |), parenthesis and brackets;
more special characters such as "~", "#"1 as well as "^" and "_" which have their normal mathematical mode properties;
spaces, but these are ignored by default because the atoms are composed in mathematical mode;
the "{" and "}" braces that have their normal behavior as group markers or macro argument delimiters;
macros.
1 To avoid that # is doubled when the macro \chemfig is in the argument of a macro, instead of #, the macro \# or the macro \CFhash can be used.