CHEM(1) | General Commands Manual | CHEM(1) |
NAME
chem - groff preprocessor for producing chemical structure diagramsSYNOPSIS
[option...] [--] [filespec...] -h | --help -v | --versionOPTION USAGE
There are no other options than -h, --help, -v, and --version; these options provoke the printing of a version or usage information, respectively, and all filespec arguments are ignored. A filespec argument is either a file name of an existing file or a minus character -, meaning standard input. If no argument is specified then standard input is taken automatically.DESCRIPTION
chem produces chemical structure diagrams. Today's version is best suited for organic chemistry (bonds, rings). The chem program is a groff preprocessor like eqn, pic, tbl, etc. It generates pic output such that all chem parts are translated into diagrams of the pic language.-
.cstart
chem data
.cend
-
.cstart
CH3
bond
CH3
.cend
- chem [file...] | groffer
- chem [file...] | groff -p ...
THE LANGUAGE
The chem input language is rather small. It provides rings of several styles and a way to glue them together as desired, bonds of several styles, moieties (e.g., C, NH3, ...), and strings.Setting Variables
There are some variables that can be set by commands. Such commands have two possible forms, either- textht arg
- Set the height of the text to arg; default is 0.16.
- cwid arg
- Set the character width to arg; default is 0.12.
- db arg
- Set the bond length to arg; default is 0.2.
- size arg
- Scale the diagram to make it look plausible at point size arg; default is 10 point.
Bonds
This
[direction] [length n] [from Name|picstuff]
CH3 | |
bond | (this one goes right from the CH3) |
C | (at the right end of the bond) |
double bond up | (from the C) |
O | (at the end of the double bond) |
bond right from C | |
CH3 |
Rings
There are lots of rings, but only 5 and 6-sided rings get much support. ring by itself is a 6-sided ring; benzene is the benzene ring with a circle inside. aromatic puts a circle into any kind of ring.
[pointing (up|right|left|down)] [aromatic] [put Mol at n] [double i,j k,l ...] [picstuff]
-
R1: ring pointing up
R2: ring pointing right
-
R1: benzene pointing right
R2: benzene pointing right with .V6 at R1.V2
- ring double 1,2 3,4 5,6
- R: ring put N at 1 put O at 2
Moieties and Strings
A moiety is a string of characters beginning with a capital letter, such as N(C2H5)2. Numbers are converted to subscripts (unless they appear to be fractional values, as in N2.5H). The name of a moiety is determined from the moiety after special characters have been stripped out: e.g., N(C2H5)2) has the name NC2H52.- B1: bond ; OH
- CH3 at C + (0.5,0.5)
- bond ; BP
Names
In the alkyl chain above, notice that the carbon atom C was used both to draw something and as the name for a place. A moiety always defines a name for a place; you can use your own names for places instead, and indeed, for rings you will have to. A name is just- Name: ...
- First:
- bond bond 30 from First
Miscellaneous
The specific construction- bond ... ; moiety
-
bond
moiety
- size n
- define Start the definition of pic macro within chem.
- [
- Start a block composite.
- ]
- End a block composite.
- {
- Start a macro definition block.
- }
- End a macro definition block.
WISH LIST
This TODO list was collected by Brian Kernighan.FILES
- $@
- A collection of pic macros needed by chem.
- $@
- A macro file which redefines .PS and .PE to center pic diagrams.
- $@
- Example files for chem.
- $@
- Example files from the classical chem book 122.ps.
BUGS
Report bugs to the bug-groff mailing list Include a complete, self-contained example that will allow the bug to be reproduced, and say which version of groff and chem you are using. You can get both version numbers by calling chem --version.SEE ALSO
groff(1), pic(1), groffer(1).AUTHOR
This file was written by Bernd Warken. It is based on the documentation of Brian Kernighan original awk version of chem.COPYING
Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.30 December 2012 | Groff Version 1.22.1 |