3 # Source file position: <groff-source>/contrib/chem/chem.pic
4 # Installed position: <prefix>/lib/groff/chem
6 # Copyright (C) 2006 Free Software Foundation, Inc.
7 # Written by Brian Kernighan <http://cm.bell-labs.com/cm/cs/who/bwk>,
8 # modified by Bernd Warken.
10 # This file is part of `chem', which is part of `groff'.
12 # `groff' is free software; you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2, or (at your option)
17 # `groff' is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with `groff'; see the files COPYING and LICENSE in the top
24 # directory of the `groff' source. If not, write to the Free Software
25 # Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301,
28 ########################################################################
32 # cr = 0.08 # radius of invis circle at ring vertices (see cr[vh])
33 # crh = 0.16; crw = 0.12 # ht & wid of invis ellipse around atoms at ring vertices
34 # dav = 0.015 # vertical shift up for atoms in atom macro
36 # atom(text, wid, ht, carbon position, crh, crw, dav)
38 T: $1 wid $2 ht $3-2*$7
39 C: ellipse invis ht $5 wid $6 at T.w + ($4,$7)
40 L: ellipse invis ht $5 wid $6 at T.w + (cwid/2,$7)
41 R: ellipse invis ht $5 wid $6 at T.e + (-cwid/2,$7)
44 # bond(length, angle in degrees, whatever)
46 line $3 by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
49 # fancy bonds: r, theta, from/at
51 line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
52 V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
53 norm = sqrt(dx*dx + dy*dy)
56 line from V1 + (nx,ny) to V2 + (nx,ny)
57 line from V1 - (nx,ny) to V2 - (nx,ny)
61 line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
62 V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
63 norm = sqrt(dx*dx + dy*dy)
65 nx = -dy * .025 / norm
66 line from V1 + (nx,ny) to V2 + (nx,ny)
67 line from V1 - (nx,ny) to V2 - (nx,ny)
72 line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
73 V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
74 norm = sqrt(dx*dx + dy*dy)
80 line from XZ + (nx,ny) to XZ - (nx,ny)
85 line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
86 V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
87 ah = arrowht; aw = arrowwid; ahead = arrowhead
88 arrowht = sqrt(dx*dx + dy*dy)
92 arrowht = ah; arrowwid = aw; arrowhead = ahead