3 # Source file position: <groff-source>/contrib/chem/chem.pic
4 # Installed position: <prefix>/share/groff/<version>/pic
6 # Copyright (C) 2006-2018 Free Software Foundation, Inc.
7 # Written by Brian Kernighan <http://cm.bell-labs.com/cm/cs/who/bwk>,
8 # modified by Bernd Warken <groff-bernd.warken-72@web.de>.
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 (GPL) version 2 as
14 # published by the Free Software Foundation.
16 # 'groff' is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 # General Public License for more details.
21 # The license text for GPL2 is available in the internet at
22 # <http://www.gnu.org/licenses/gpl-2.0.html>.
24 ########################################################################
28 # cr = 0.08 # radius of invis circle at ring vertices (see cr[vh])
29 # crh = 0.16; crw = 0.12 # ht & wid of invis ellipse around atoms at ring vertices
30 # dav = 0.015 # vertical shift up for atoms in atom macro
32 # atom(text, wid, ht, carbon position, crh, crw, dav)
34 T: $1 wid $2 ht $3-2*$7
35 C: ellipse invis ht $5 wid $6 at T.w + ($4,$7)
36 L: ellipse invis ht $5 wid $6 at T.w + (cwid/2,$7)
37 R: ellipse invis ht $5 wid $6 at T.e + (-cwid/2,$7)
40 # bond(length, angle in degrees, whatever)
42 line $3 by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
45 # fancy bonds: r, theta, from/at
47 line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
48 V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
49 norm = sqrt(dx*dx + dy*dy)
52 line from V1 + (nx,ny) to V2 + (nx,ny)
53 line from V1 - (nx,ny) to V2 - (nx,ny)
57 line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
58 V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
59 norm = sqrt(dx*dx + dy*dy)
61 nx = -dy * .025 / norm
62 line from V1 + (nx,ny) to V2 + (nx,ny)
63 line from V1 - (nx,ny) to V2 - (nx,ny)
68 line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
69 V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
70 norm = sqrt(dx*dx + dy*dy)
76 line from XZ + (nx,ny) to XZ - (nx,ny)
81 line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
82 V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
83 ah = arrowht; aw = arrowwid; ahead = arrowhead
84 arrowht = sqrt(dx*dx + dy*dy)
88 arrowht = ah; arrowwid = aw; arrowhead = ahead