1 .TH @G@CHEM @MAN1EXT@ "@MDATE@" "groff @VERSION@"
3 @g@chem \- groff preprocessor for producing chemical structure diagrams
5 .\" @g@chem.1 - man page for @g@chem (section 1).
6 .\" Source file position: <groff_source_top>/contrib/chem/chem.man
7 .\" Installed position: $prefix/share/man/man1/@g@chem.1
10 .\" ====================================================================
12 .\" ====================================================================
14 .\" Copyright (C) 2006-2018 Free Software Foundation, Inc.
16 .\" This file is part of chem, which is part of groff, a free software
19 .\" You can redistribute it and/or modify it under the terms of the GNU
20 .\" General Public License version 2 (GPL2) as published by the Free
21 .\" Software Foundation.
23 .\" The license text for GPL2 is available in the internet at
24 .\" <http://www.gnu.org/licenses/gpl-2.0.html>.
27 .\" ====================================================================
29 .\" ====================================================================
32 .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
37 .\" ====================================================================
39 .\" ====================================================================
42 .ie t .ds EL \fS\N'188'\fP\"
43 .el .ds EL \&.\|.\|.\&\"
47 .\" ====================================================================
49 .\" ====================================================================
70 .\" ====================================================================
72 .\" ====================================================================
75 produces chemical structure diagrams.
77 Today's version is best suited for organic chemistry (bonds, rings).
93 parts are translated into diagrams of the
101 argument is either a file name of an existing file or a minus
104 meaning standard input.
106 If no argument is specified then standard input is taken
112 display a usage message,
117 display version information;
124 originates from the Perl source file
129 to include a copy of the macro file
140 In a style reminiscent of
146 diagrams are written in a special language.
152 lines looks like this
166 Lines containing the keywords
170 start and end the input for
176 context, i.e., after the call of
179 input can optionally be started by the line
181 and ended by the line with the single word
187 Anything outside these initialization lines is copied through
188 without modification;
189 all data between the initialization lines is converted into
191 commands to draw the diagram.
212 groups with a bond between them.
216 To actually view this, you must run
222 .B @g@chem [file \*(EL] | groffer
225 If you want to create just
233 for the activation of
236 .B @g@chem [file \*(EL] | groff \-p \*(EL
239 .\" ====================================================================
241 .\" ====================================================================
245 input language is rather small. It provides rings of several styles
246 and a way to glue them together as desired, bonds of several styles,
253 .\" ====================================================================
254 .SS Setting Variables
255 .\" ====================================================================
257 There are some variables that can be set by commands.
259 Such commands have two possible forms, either
271 .IB "variable " = " value"
279 If more arguments are given only the last argument is taken, all other
280 arguments are ignored.
284 There are only a few variables to be set by these commands:
288 Set the height of the text to
294 Set the character width to
300 Set the bond length to
306 Scale the diagram to make it look plausible at point size
311 .\" ====================================================================
313 .\" ====================================================================
322 .IR Name | picstuff ]
327 draws a single bond in direction from nearest corner of
343 is the angle in degrees (0\~up, positive clockwise)
344 or a direction word like
350 If no direction is specified, the bond goes in the current direction
351 (usually that of the last bond).
355 Normally the bond begins at the last object placed; this
356 can be changed by naming a
360 For instance, to make a simple alkyl chain:
367 bond@(this one goes right from the CH3)
368 C@(at the right end of the bond)
369 double bond up@(from the C)
370 O@(at the end of the double bond)
378 A length in inches may be specified to override the default length.
382 commands can be tacked on to the end of a bond command, to created
383 dotted or dashed bonds or to specify a
388 .\" ====================================================================
390 .\" ====================================================================
392 There are lots of rings, but only 5 and 6-sided rings get
396 by itself is a 6-sided ring;
398 is the benzene ring with a circle inside.
400 puts a circle into any kind of ring.
404 .RB [ \%pointing\ ( up | right | left | down )]
406 .RB [ put\ Mol\ at\ \fIn\/\fP ]
417 The vertices of a ring are numbered 1, 2, \*(EL from the
418 vertex that points in the natural compass direction.
420 So for a hexagonal ring with the point at the top, the top vertex
421 is\~1, while if the ring has a point at the east side, that is
430 R2: ring pointing right
436 The ring vertices are named
442 in the pointing direction.
458 is the rightmost vertex and
462 These vertex names are used for connecting bonds or other rings. For
468 R1: benzene pointing right
469 R2: benzene pointing right with .V6 at R1.V2
473 creates two benzene rings connected along a side.
477 Interior double bonds are specified as
478 .BI \%double\ n1 , n2\ n3 , n4\ \fR\*(EL;\fP
479 each number pair adds an interior bond.
481 So the alternate form of a benzene ring is
484 .B "ring double 1,2 3,4 5,6"
488 Heterocycles (rings with something other than carbon at a vertex) are
490 .BI put\ X\ at\ V\fR,\fP
494 .B "R: ring put N at 1 put O at 2"
509 There are two 5-sided rings.
512 is pentagonal with a side that matches the 6-sided ring; it has four
517 is a 5-sided ring created by chopping one corner of a 6-sided ring so
518 that it exactly matches the 6-sided rings.
522 The description of a ring has to fit on a single line.
525 .\" ====================================================================
526 .SS Moieties and Strings
527 .\" ====================================================================
529 A moiety is a string of characters beginning with a capital letter,
532 Numbers are converted to subscripts (unless they appear to be
533 fractional values, as in N2.5H).
535 The name of a moiety is determined from the moiety after special
536 characters have been stripped out: e.g., N(C2H5)2) has the name NC2H52.
540 Moieties can be specified in two kinds.
542 Normally a moiety is placed right after the last thing mentioned,
543 separated by a semicolon surrounded by spaces, e.g.,
551 it is set after a bond.
555 As the second kind a moiety can be positioned as the first word in a
560 .B "CH3 at C + (0.5,0.5)"
565 It is placed at a position relative to
567 a moiety used earlier in the chemical structure.
571 So moiety names can be specified as
573 positions everywhere in the
577 Beneath their printing moieties are names for places.
585 It is not printed but just serves as a mark to be referred to in later
595 sets a mark at the end of the bond.
597 This can be used then for specifying a place.
603 (i.e., line crossing).
607 A string within double quotes
609 is interpreted as a part of a
613 It represents a string that should be printed (without the quotes).
615 Text within quotes \(dq\*(EL\(dq is treated more or less
616 like a moiety except that no changes are made to the quoted part.
619 .\" ====================================================================
621 .\" ====================================================================
623 In the alkyl chain above, notice that the carbon atom
625 was used both to draw something and as the name for a place.
627 A moiety always defines a name for a place; you can use
628 your own names for places instead, and indeed, for rings
640 is often the name of a moiety like
642 but it need not to be.
644 Any name that begins with a capital letter and which contains
645 only letters and numbers is valid:
653 .B "bond 30 from First"
657 .\" ====================================================================
659 .\" ====================================================================
661 The specific construction
664 .BR bond\ \*(EL " ; moiety"
678 Otherwise, each item has to be on a separate line (and only one line).
679 Note that there must be whitespace after the semicolon which separates
688 in the first column of a line signals a
690 command, which is copied through as-is.
694 A line whose first non-blank character is a hash character
696 is treated as a comment and thus ignored.
698 However, hash characters within a word are kept.
702 A line whose first word is
704 is copied through as-is after the word
715 scales the diagram to make it look plausible at point size\~\c
717 (default is 10\~point).
721 Anything else is assumed to be
723 code, which is copied through with a label.
731 preprocessor, it is possible to include
733 statements in the middle of a diagram to draw things not provided for
740 statements should be included in
744 as the first word of this line for clarity.
750 commands are accepted as
754 command word is needed:
758 Start the definition of
766 Start a block composite.
770 End a block composite.
774 Start a macro definition block.
778 End a macro definition block.
784 statements are stored and their call is accepted as a
789 .\" ====================================================================
791 .\" ====================================================================
794 This TODO list was collected by Brian Kernighan.
798 Error checking is minimal; errors are usually detected and reported in
799 an oblique fashion by
804 There is no library or file inclusion mechanism, and there is no
805 shorthand for repetitive structures.
809 The extension mechanism is to create
811 macros, but these are tricky to get right and don't have all the
812 properties of built-in objects.
816 There is no in-line chemistry yet (e.g., analogous to the $\*(EL$
821 There is no way to control entry point for bonds on groups.
823 Normally a bond connects to the carbon atom if entering from
824 the top or bottom and otherwise to the nearest corner.
828 Bonds from substituted atoms on heterocycles do not join at the proper
829 place without adding a bit of
834 There is no decent primitive for brackets.
838 Text (quoted strings) doesn't work very well.
842 A squiggle bond is needed.
845 .\" ====================================================================
847 .\" ====================================================================
850 .I @DATASUBDIR@/pic/chem.pic
857 .I @MACRODIR@/pic.tmac
858 A macro file which redefines
867 .IR @DOCDIR@/examples/chem/ * .chem
872 .IR @DOCDIR@/examples/chem/122/ * .chem
873 Example files from the classical
876 .I "CHEM \[en] A Program for Typesetting Chemical Structure Diagrams"
880 .\" ====================================================================
882 .\" ====================================================================
887 .MT groff\-bernd.warken\-72@\:web.de
891 It is based on the documentation of Brian Kernighan's original
896 .UR http://\:cm.bell\-labs.com/\:cm/\:cs/\:who/\:bwk/\:index.html
900 .\" ====================================================================
902 .\" ====================================================================
904 .BR \%groff (@MAN1EXT@),
905 .BR \%@g@pic (@MAN1EXT@),
906 .BR \%groffer (@MAN1EXT@).
910 You can still get the original
911 .UR http://\:cm.bell\-labs.com/\:netlib/\:typesetting/\:chem.gz
917 file was used for this manual page.
921 The other classical document on
924 .UR http://\:cm.bell\-labs.com/\:cm/\:cs/\:cstr/\:122.ps.gz
925 .I "CHEM \[en] A Program for Typesetting Chemical Structure Diagrams"
930 .\" Restore compatibility mode (for, e.g., Solaris 10/11).
934 .\" ====================================================================
936 .\" ====================================================================
941 .\" vim: set filetype=groff: