Despite its possibly frightening appearance, the basic principles underlying the language are very simple: The parser keeps track of two things, the current position and direction. The initial position is "somewhere" (it doesn't matter where exactly), the initial direction is right. If you just write characters separated by spaces atoms will be placed as a chain, for example:
A B C D E F
The direction can be changed using the
\ operators, which change it 90 degrees left, right, 45 degrees left, right, respectively.
A B > C / D < E \ F
Parentheses allow you to add side chains without changing the main chain:
A B C(>F) D E
The two "overlayed" chains here are:
A B C D E A B C > F
This is already enough for typesetting simple molecules, e.g. ethane:
H C(<H)(>H) C(<H)(>H) H
C(<H)(>H) can be abbreviated as
CH2 due to its ubiquity:
H CH2 CH2 H
Invisible atoms can be rendered using either
,, note the difference in behaviour:
C . C , C
The syntax n
% can be used to achieve rotation by an arbitrary angle:
C 60% C 60 % C 60% C 60% C 60% C 60% .
See the reference and the examples for further info.