From f66e9592f6dc17d47088487d1cca791dd56fd5c1 Mon Sep 17 00:00:00 2001 From: bwarken Date: Thu, 9 Nov 2006 23:56:49 +0000 Subject: Update chem-0.3.0 --- contrib/chem/ChangeLog | 16 +- contrib/chem/Makefile.sub | 16 +- contrib/chem/chem.man | 1111 -------------------------------------- contrib/chem/chem.man1 | 1078 ++++++++++++++++++++++++++++++++++++ contrib/chem/chem.pic | 97 ++++ contrib/chem/chem.pl | 12 +- contrib/chem/examples/122/README | 18 +- contrib/chem/examples/README.txt | 18 +- contrib/chem/macros.pic | 97 ---- 9 files changed, 1237 insertions(+), 1226 deletions(-) delete mode 100644 contrib/chem/chem.man create mode 100644 contrib/chem/chem.man1 create mode 100644 contrib/chem/chem.pic delete mode 100644 contrib/chem/macros.pic diff --git a/contrib/chem/ChangeLog b/contrib/chem/ChangeLog index 5f967a60..65bd6abb 100644 --- a/contrib/chem/ChangeLog +++ b/contrib/chem/ChangeLog @@ -1,6 +1,20 @@ +2006-11-10 Bernd Warken + ________________________________________________________________ + * release of chem 0.3.0 + + * chem.man1: Rename `chem.man' to translate some `@...@' + constructs. Some minor corrections. Remove some unused macros. + + * examples/README.txt, examples/122/README: Add information on + `roff2*' programs. + + * chem.pic: Rename `macros.pic'. + + * Makefile.sub, chem.pl: Replace `macros.pic' by `chem.pic'. + 2006-11-09 Werner LEMBERG - * chem.man: Revised. + * chem.man: Revised. 2006-11-08 Bernd Warken ________________________________________________________________ diff --git a/contrib/chem/Makefile.sub b/contrib/chem/Makefile.sub index 1d537e8f..8fec7c4a 100644 --- a/contrib/chem/Makefile.sub +++ b/contrib/chem/Makefile.sub @@ -5,7 +5,7 @@ # Copyright (C) 2006 Free Software Foundation, Inc. # Written by Bernd Warken. -# Last update: 8 Nov 2006 +# Last update: 9 Nov 2006 # This file is part of `chem' which is part of `groff'. @@ -27,12 +27,18 @@ ######################################################################## MAN1=chem.n -CLEANADD=chem chem.n README examples/README +CLEANADD=chem chem.n chem.man README examples/README # not all make programs have $(RM) predefined. RM=rm -f -all: README examples/README chem $(MAN1) +all: README examples/README chem chem.man + +chem.man: $(srcdir)/chem.man1 + sed \ + -e "s|@tmacdir@|$(DESTDIR)$(tmacdir)|g" \ + -e "s|@picdir@|$(DESTDIR)$(datasubdir)/pic|g" \ + $< >$@ README: $(srcdir)/README.txt sed -e "s|@g@|$(g)|g" $< >$@ @@ -54,7 +60,7 @@ chem: $(srcdir)/chem.pl $(SH_DEPS_SED_SCRIPT) install_data: chem \ README examples/README \ - $(srcdir)/macros.pic \ + $(srcdir)/chem.pic \ $(srcdir)/examples/*.chem $(srcdir)/examples/122/* -test -d $(DESTDIR)$(bindir) || $(mkinstalldirs) $(DESTDIR)$(bindir) $(RM) $(DESTDIR)$(bindir)/$(g)chem @@ -62,7 +68,7 @@ install_data: chem \ -test -d $(DESTDIR)$(datasubdir)/pic \ || $(mkinstalldirs) $(DESTDIR)$(datasubdir)/pic $(RM) $(DESTDIR)$(datasubdir)/pic/chem.pic - $(INSTALL_DATA) $(srcdir)/macros.pic \ + $(INSTALL_DATA) $(srcdir)/chem.pic \ $(DESTDIR)$(datasubdir)/pic/chem.pic -test -d $(DESTDIR)$(exampledir)/chem \ || $(mkinstalldirs) $(DESTDIR)$(exampledir)/chem/122 diff --git a/contrib/chem/chem.man b/contrib/chem/chem.man deleted file mode 100644 index 8884aac6..00000000 --- a/contrib/chem/chem.man +++ /dev/null @@ -1,1111 +0,0 @@ -.TH @g@CHEM @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@" -.SH NAME -@g@chem \- groff preprocessor for producing chemical structure diagrams -. -. -.SH "SYNOPSIS" -.\" The .SH was moved to this place in order to appease `apropos'. -. -.mso www.tmac -. -.\" -------------------------------------------------------------------- -.\" Legalize -.\" -------------------------------------------------------------------- -. -.ig -@g@chem.1 - man page for @g@chem (section 1). - -Source file position: /contrib/chem/chem.man -Installed position: $prefix/share/man/man1/@g@chem.1 - -Last update: 9 Nov 2006 -.. -. -. -.de author -This file was written by -.MTO "" "Bernd Warken" . -It is based on the documentation of -.URL http://cm.bell-labs.com/cm/cs/who/bwk/index.html "Brian Kernighan\f[R]'s\f[]" -original -.I awk -version of -.IR chem . -.. -. -. -.de copyleft -Copyright (C) 2006 Free Software Foundation, Inc. -. -. -.P -This file is part of -.IR chem , -which is part of -.IR groff , -a free software project. -. -You can redistribute it and/or modify it under the terms of the -.nh -.B GNU General Public License -.hy -as published by the -.nh -.BR "Free Software Foundation" , -.hy -either version\~2, or (at your option) any later version. -. -. -.P -You should have received a copy of the \f[CR]GNU General Public -License\f[] along with -.IR groff , -see the files \%\f[CB]COPYING\f[] and \%\f[CB]LICENSE\f[] in the top -directory of the -.I groff -source package. -. -Or read the -.I man page -.BR gpl (1). -You can also write to the -.nh -.B Free Software Foundation, 51 Franklin St - Fifth Floor, Boston, -.BR "MA 02110-1301, USA" . -.hy -.. -. -. -.\" -------------------------------------------------------------------- -.\" Setup -.\" -------------------------------------------------------------------- -. -.if n \{\ -. mso tty-char.tmac -. ftr CR R -. ftr CI I -. ftr CB B -.\} -. -.if '\*[.T]'dvi' \{\ -. ftr CB CW -.\} -. -.ds Ellipsis "\&.\|.\|.\&\"" -. -. -.\" -------------------------------------------------------------------- -.\" Macro definitions -. -.\" Ignore all arguments like a comment, even after a .eo call. -.de c -.. -. -.c -------------------------------------------------------------------- -.c .CB (...) -.c -.c Print in constant-width bold font. -.c -.de CB -. ft CB -. Text \\$* -. ft -.. -. -.c -------------------------------------------------------------------- -.c .CI (...) -.c -.c Print in constant-width italic font. -.c -.de CI -. ft CI -. Text \\$* -. ft -.. -. -.c -------------------------------------------------------------------- -.c .CR (...) -.c -.c Print in constant-width roman font. -.c -.de CR -. ft CR -. Text \\$* -. ft -.. -. -.c -------------------------------------------------------------------- -.c .TP+ () -.c -.c Continuation line for .TP header. -.c -.de TP+ -. br -. ns -. TP \\$1 -.. -. -.c -------------------------------------------------------------------- -.c .File_name () -.c -.c Display a file or directory name in CB font. -.c -.de File_name -. Header_CB \\$@ -.. -. -.c -------------------------------------------------------------------- -.c .Header_CB () -.c -.c Display a line in CB font, for example after .TP -.c -.de Header_CB -. nh -. Text \f[CB]\\$1\f[]\\$2 -. hy -.. -. -.c -------------------------------------------------------------------- -.c Static register for inter-macro communication in `.Synopsis'. -.c -.nr chem:Synopsis.level 0 -. -.c -------------------------------------------------------------------- -.c .Synopsis () -.c -.c Begin a synopsis section, to be ended by a ./Synopsis macro. -.c -.de Synopsis -. if (\\n[chem:Synopsis.level] > 0) \ -. Error .\\$0: previous .Synopsis was not closed by ./Synopsis. -. nh -. ds @1 \\$1\" -. nr @old_indent \\n[.i] -. ad l -. in +\w'\fB\\*[@1]\0'u -. ti \\n[@old_indent]u -. B \\*[@1]\0\c -. rr @old_indent -. rm @1 -. nr chem:Synopsis.level +1\" marker for ./Synopsis -.. -. -.c -------------------------------------------------------------------- -.c ./Synopsis () -.c -.c Close a synopsis section opened by the previous .Synopsis macro. -.c -.de /Synopsis -. if (\\n[chem:Synopsis.level] <= 0) \ -. Error .\\$0: no previous call of .Synopsis -. br -. ad -. in -. hy -. nr chem:Synopsis.level -1 -.. -. -.c -------------------------------------------------------------------- -.c .Text (...) -.c -.c Treat the arguments as text, no matter how they look like. -.c -.de Text -. if (\\n[.$] == 0) \ -. return -. nh -. nop \)\\$*\) -. hy -.. -. -.\" End of macro definitions -. -. -.\" -------------------------------------------------------------------- -.\" SH "SYNOPSIS" -.\" -------------------------------------------------------------------- -. -.ad l -.Synopsis @g@chem -.RI [ "\%option" \*[Ellipsis]] -.RB [ \-\- ] -.RI [ "\%filespec" \*[Ellipsis]] -./Synopsis -. -.Synopsis @g@chem -\f[CB]\-h\fP\f[CR]|\fP\f[CB]\-\-help\fP -./Synopsis -. -.Synopsis @g@chem -\f[CB]\-v\fP\f[CR]|\fP\f[CB]\-\-version\fP -./Synopsis -. -. -.P -There are no other options than \f[CB]\-\-help\f[] and -\%\f[CB]\-\-version\f[]; these options provoke the printing -of a version or usage information, respectively, and all -.I filespec -arguments are ignored. -. -A -.I filespec -argument is either a file name of an existing file or a minus -character -.BR \- , -meaning standard input. -. -If no argument is specified then standard input is taken -automatically. -. -. -.\" -------------------------------------------------------------------- -.SH DESCRIPTION -.\" -------------------------------------------------------------------- -. -.I chem -produces chemical structure diagrams. -. -Today's version is best suited for organic chemistry (bonds, rings). -. -The -.B @g@chem -program is a -.B groff -preprocessor like -.BR @g@eqn , -.BR @g@pic , -.BR @g@tbl , -etc. -. -It generates -.I pic -output such that all -.I chem -parts are translated into diagrams of the -.I pic -language. -. -. -.P -The program -.B @g@chem -originates from the Perl source file -.File_name chem.pl . -It tells -.B @g@pic -to include a copy of -.File_name macros.pic . -. -Moreover the -.I groff -source file -.File_name pic.tmac -is loaded. -. -. -.P -In a style reminiscent of -.I eqn -and -.IR pic , -the -.I chem -diagrams are written in a special language. -. -. -.P -A set of -.I chem -lines looks like this -. -. -.IP -.nf -.ft B -\&.cstart -\f[I]chem data\f[] -\&.cend -.ft -.fi -. -. -.P -Lines containing the keywords -.B .cstart -and -.B .cend -start and end the input for -.BR @g@chem , -respectively. -. -In -.I pic -context, i.e., after the call of -.BR .PS , -.I chem -input can optionally be started by the line -.B \%begin\~chem -and ended by the line with the single word -.B end -instead. -. -. -.P -Anything outside these initialization lines is copied through -without modification; -all data between the initialization lines is converted into -.I pic -commands to draw the diagram. -. -. -.P -As an example, -. -.IP -.nf -.ft B -\&.cstart -CH3 -bond -CH3 -\&.cend -.ft -.fi -. -. -.P -prints two -.B CH3 -groups with a bond between them. -. -. -.P -To actually view this, you must run -.B @g@chem -followed by -.BR groffer : -. -.IP -.B @g@chem [file\*[Ellipsis]] | groffer -. -.P -If you want to create just -.B groff -output, you must run -.B @g@chem -followed by -.B groff -with the option -.B \-p -for the activation of -.BR @g@pic : -.IP -.B @g@chem [file\*[Ellipsis]] | groff -p \*[Ellipsis] -. -. -.\" -------------------------------------------------------------------- -.SH THE LANGUAGE -.\" -------------------------------------------------------------------- -. -The -.I 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., -.BR C , -.BR NH3 , -\*[Ellipsis]) and strings. -. -. -.\" -------------------------------------------------------------------- -.SS Setting Variables -.\" -------------------------------------------------------------------- -. -There are some variables that can be set by commands. -. -Such commands have two possible forms, either -.br -.RS -.I "variable value" -.RE -.br -or -.br -.RS -.IB "variable " = " value" -.RE -. -. -.P -This sets the given -.I variable -to the argument -.IR value . -If more arguments are given only the last argument is taken, all other -arguments are ignored. -. -. -.P -There are only a few variables to be set by these commands: -. -.TP -.BI textht " arg" -Set the height of the text to -.IR arg ; -default is 0.16. -. -.TP -.BI cwid " arg" -Set the character width to -.IR arg ; -default is 0.12. -. -.TP -.BI db " arg" -Set the bond length to -.IR arg ; -default is 0.2. -. -.TP -.BI size " arg" -Scale the diagram to make it look plausible at point size -.IR arg ; -default is 10 point. -. -. -.\" -------------------------------------------------------------------- -.SS Bonds -.\" -------------------------------------------------------------------- -. -.IP -.B bond -.RI [ direction ] -.RI [ length\~n ] -.RB [ from -.IR Name | picstuff ] -. -.P -draws a single bond in direction from nearest corner of -.IR Name . -.B bond -can also be -.BR "double bond" , -.BR "front bond" , -.BR "back bond" , -etc. -. -(We will get back to -.I Name -soon.) -. -. -.P -.I direction -is the angle in degrees (0\~up, positive clockwise) -or a direction word like -.BR up , -.BR down , -.B sw -(=\~southwest), etc. -. -If no direction is specified, the bond goes in the current direction -(usually that of the last bond). -. -. -.P -Normally the bond begins at the last object placed; this -can be changed by naming a -.B from -place. -. -For instance, to make a simple alkyl chain: -. -.RS -.TP 10m -.B CH3 -.TP+ -.B bond -(this one goes right from the CH3) -.TP+ -.B C -(at the right end of the bond) -.TP+ -.B double bond up -(from the C) -.TP+ -.B O -(at the end of the double bond) -.TP+ -.B bond right from C -.TP+ -.B CH3 -.RE -. -. -.P -A length in inches may be specified to override the default length. -. -Other -.I pic -commands can be tacked on to the end of a bond command, to created -dotted or dashed bonds or to specify a -.B to -place. -. -. -.\" -------------------------------------------------------------------- -.SS Rings -.\" -------------------------------------------------------------------- -. -There are lots of rings, but only 5 and 6-sided rings get -much support. -. -.B ring -by itself is a 6-sided ring; -.B benzene -is the benzene ring with a circle inside. -.B aromatic -puts a circle into any kind of ring. -. -.IP -.B ring -.RB [ \%pointing\ ( up | right | left | down )] -.RB [ \%aromatic ] -.RB [ put\ Mol\ at\ \f[I]n\f[] ] -.RB [ \%double -.IR i , j -.IR k , l -\*[Ellipsis]] -.RI [ picstuff ] -. -. -.P -The vertices of a ring are numbered 1, 2, \*[Ellipsis] from the -vertex that points in the natural compass direction. -. -So for a hexagonal ring with the point at the top, the top vertex -is\~1, while if the ring has a point at the east side, that is -vertex\~1. -. -This is expressed as -. -.IP -.ft B -.nf -R1: ring pointing up -R2: ring pointing right -.fi -.ft -. -. -.P -The ring vertices are named -.BR .V1 , -\*[Ellipsis], -.BI .V n\f[R],\f[] -with -.B .V1 -in the pointing direction. -. -So the corners of -.B R1 -are -.B R1.V1 -(the -.IR top ), -.BR R1.V2 , -.BR R1.V3 , -.B R1.V4 -(the -.IR bottom ), -etc., whereas for -.BR R2 , -.B R2.V1 -is the rightmost vertex and -.B R2.V4 -the leftmost. -. -These vertex names are used for connecting bonds or other rings. For -example, -. -.IP -.ft B -.nf -R1: benzene pointing right -R2: benzene pointing right with .V6 at R1.V2 -.fi -.ft -.P -creates two benzene rings connected along a side. -. -. -.P -Interior double bonds are specified as -.BI \%double\ n1 , n2\ n3 , n4\ \f[R]\*[Ellipsis];\f[] -each number pair adds an interior bond. -. -So the alternate form of a benzene ring is -. -.IP -.B ring double 1,2 3,4 5,6 -. -. -.P -Heterocycles (rings with something other than carbon at a vertex) are -written as -.BI put\ X\ at\ V\f[R],\f[] -as in -. -.IP -.B R: ring put N at 1 put O at 2 -. -. -.P -In this heterocycle, -.B R.N -and -.B R.O -become synonyms for -.B R.V1 and -.BR R.V2 . -. -. -.P -There are two 5-sided rings. -. -.B ring5 -is pentagonal with a side that matches the 6-sided ring; it has four -natural directions. -. -A -.B \%flatring -is a 5-sided ring created by chopping one corner of a 6-sided ring so -that it exactly matches the 6-sided rings. -. -. -.P -The description of a ring has to fit on a single line. -. -. -.\" -------------------------------------------------------------------- -.SS 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. -. -. -.P -Moieties can be specified in two kinds. -. -Normally a moiety is placed right after the last thing mentioned, -separated by a semicolon surrounded by spaces, e.g., -. -.IP -.B B1: bond ; OH -. -.P -Here the moiety is -.BR OH ; -it is set after a bond. -. -. -.P -As the second kind a moiety can be positioned as the first word in a -.IR pic -like -command, e.g., -. -.IP -.B CH3 at C + (0.5,0.5) -. -.P -Here the moiety is -.BR CH3 . -It is placed at a position relative to -.BR C , -a moiety used earlier in the chemical structure. -. -. -.P -So moiety names can be specified as -.I chem -positions everywhere in the -.I chem -code. -. -Beneath their printing moieties are names for places. -. -. -.P -The moiety -.B BP -is special. -. -It is not printed but just serves as a mark to be referred to in later -.I chem -commands. -. -For example, -. -.IP -.B bond ; BP -. -.P -sets a mark at the end of the bond. -. -This can be used then for specifying a place. -. -The name -.BP BP -is derived from -.I branch point -(i.e., line crossing). -. -. -.P -A string within double quotes -.B \[dq] -is interpreted as a part of a -.I chem -command. -. -It represents a string that should be printed (without the quotes). -. -Text within quotes \[dq]\*[Ellipsis]\[dq] is treated more or less -like a moiety except that no changes are made to the quoted part. -. -. -.\" -------------------------------------------------------------------- -.SS Names -.\" -------------------------------------------------------------------- -. -In the alkyl chain above, notice that the carbon atom -.B 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 -. -.IP -.IB Name : -\*[Ellipsis] -. -. -.P -.I Name -is often the name of a moiety like -.BR CH3 , -but it need not to be. -. -Any name that begins with a capital letter and which contains -only letters and numbers is valid: -. -.RS -.TP -.B First: -.B bond -.TP+ -\& -.B bond 30 from First -.RE -. -. -.\" -------------------------------------------------------------------- -.SS Miscellaneous -.\" -------------------------------------------------------------------- -. -The specific construction -.RS -.TP -.BR bond\ \*[Ellipsis] "; moiety" -.RE -.P -is equivalent to -.IP -.ft B -.nf -bond -moiety -.fi -.ft -. -. -.P -Otherwise, each item has to be on a separate line (and only one line). -Note that there must be whitespace after the semicolon which separates -the commands. -. -. -.P -A period character -.B .\& -or a single quote -.B ' -in the first column of a line signals a troff command, -which is copied through as-is. -. -. -.P -A line whose first non-blank character is a hash character -.RB ( # ) -is treated as a comment and thus ignored. -. -However, hash characters within a word are kept. -. -. -.P -A line whose first word is -.B pic -is copied through as-is after the word -.B pic -has been removed. -. -. -.P -The command -.IP -.B size -.I n -.P -scales the diagram to make it look plausible at point size\~\c -.I n -(default is 10\~point). -. -. -.P -Anything else is assumed to be -.I pic -code, which is copied through with a label. -. -. -.P -Since -.B @g@chem -is a -.B @g@pic -preprocessor, it is possible to include -.I pic -statements in the middle of a diagram to draw things not provided for -by -.I chem -itself. -. -Such -.I pic -statements should be included in -.I chem -code by adding -.B pic -as the first word of this line for clarity. -. -. -.P -The following -.I pic -commands are accepted as -.I chem -commands, so no -.B pic -command word is needed: -. -.IP -.B define -Start the definition of -.I pic -macro within -.IR chem . -. -.RS -.TP -.B [ -Start a block composite. -. -.TP -.B ] -End a block composite. -. -.TP -.B { -Start a macro definition block. -. -.TP -.B } -End a macro definition block. -.RE -. -.P -The macro names from -.B define -statements are stored and their call is accepted as a -.I chem -command as well. -. -. -.\" -------------------------------------------------------------------- -.SS WISH LIST -.\" -------------------------------------------------------------------- -. -.P -This TODO list was collected by Brian Kernighan. -. -. -.P -Error checking is minimal; errors are usually detected and reported in -an oblique fashion by -.IR pic . -. -. -.P -There is no library or file inclusion mechanism, and there is no -shorthand for repetitive structures. -. -. -.P -The extension mechanism is to create -.I pic -macros, but these are tricky to get right and don't have all the -properties of built-in objects. -. -. -.P -There is no in-line chemistry yet (e.g., analogous to the $...$ -construct of eqn). -. -. -.P -There is no way to control entry point for bonds on groups. -. -. -Normally a bond connects to the carbon atom if entering from -the top or bottom and otherwise to the nearest corner. -. -. -.P -Bonds from substituted atoms on heterocycles do not join at the proper -place without adding a bit of -.IR pic . -. -. -.P -There is no decent primitive for brackets. -. -. -.P -Text (quoted strings) doesn't work very well. -. -. -.P -A squiggle bond is needed. -. -. -.\" -------------------------------------------------------------------- -.SH "FILES" -.\" -------------------------------------------------------------------- -. -.TP -.File_name @libdir@/groff/chem/macros.pic -A collection of -.B @g@pic -macros needed by -.BR @g@chem . -. -.TP -.File_name @tmacdir@/pic.tmac -A macro file which redefines -.B .PS -and -.BR .PE -to center -.I pic -diagrams. -. -. -.\" -------------------------------------------------------------------- -.SH "BUGS" -.\" -------------------------------------------------------------------- -. -Report bugs to the -.MTO bug-groff@gnu.org "bug-groff mailing list" . -. -Include a complete, self-contained example that will allow the bug to -be reproduced, and say which version of -.I groff -and -.I chem -you are using. -. -You can get both version numbers by calling -.BR "@g@chem --version" . -. -. -.P -You can also use the -.MTO groff@gnu.org "groff mailing list" , -but you must first subscribe to this list. -. -You can do that by visiting the -.URL http://\:lists.gnu.org/\:mailman/\:listinfo/\:groff \ -"groff mailing list web page" . -. -. -.P -See -.BR \%groff (@MAN1EXT@) -for information on availability. -. -. -.\" -------------------------------------------------------------------- -.SH "SEE ALSO" -.\" -------------------------------------------------------------------- -. -.BR \%groff (@MAN1EXT@), -.BR \%@g@pic (@MAN1EXT@), -.B \%groffer (@MAN1EXT@) -. -. -.P -You can still get the original -.URL http://cm.bell-labs.com/netlib/typesetting/chem.gz \ -"chem awk source" . -. -Its -.File_name README -file was used for this manual page. -. -. -.P -The other classical document on -.I chem -is -.URL http://cm.bell-labs.com/cm/cs/cstr/122.ps.gz 122.ps . -. -. -.\" -------------------------------------------------------------------- -.SH "AUTHOR" -.\" -------------------------------------------------------------------- -.author -. -. -.\" -------------------------------------------------------------------- -.SH "COPYING" -.\" -------------------------------------------------------------------- -.copyleft -. -. -.\" -------------------------------------------------------------------- -.\" Emacs settings -.\" -------------------------------------------------------------------- -. -.\" Local Variables: -.\" mode: nroff -.\" End: diff --git a/contrib/chem/chem.man1 b/contrib/chem/chem.man1 new file mode 100644 index 00000000..a2e5b7f5 --- /dev/null +++ b/contrib/chem/chem.man1 @@ -0,0 +1,1078 @@ +.TH @g@CHEM @MAN1EXT@ "@MDATE@" "Groff Version @VERSION@" +.SH NAME +@g@chem \- groff preprocessor for producing chemical structure diagrams +. +. +.SH "SYNOPSIS" +.\" The .SH was moved to this place in order to appease `apropos'. +. +.mso www.tmac +. +.\" -------------------------------------------------------------------- +.\" Legalize +.\" -------------------------------------------------------------------- +. +.ig +@g@chem.1 - man page for @g@chem (section 1). + +Source file position: /contrib/chem/chem.man +Installed position: $prefix/share/man/man1/@g@chem.1 + +Last update: 9 Nov 2006 +.. +. +. +.de author +This file was written by +.MTO "" "Bernd Warken" . +It is based on the documentation of +.URL http://cm.bell-labs.com/cm/cs/who/bwk/index.html "Brian Kernighan\f[R]'s\f[]" +original +.I awk +version of +.IR chem . +.. +. +. +.de copyleft +Copyright (C) 2006 Free Software Foundation, Inc. +. +. +.P +This file is part of +.IR chem , +which is part of +.IR groff , +a free software project. +. +You can redistribute it and/or modify it under the terms of the +.nh +.B GNU General Public License +.hy +as published by the +.nh +.BR "Free Software Foundation" , +.hy +either version\~2, or (at your option) any later version. +. +. +.P +You should have received a copy of the \f[CR]GNU General Public +License\f[] along with +.IR groff , +see the files \%\f[CB]COPYING\f[] and \%\f[CB]LICENSE\f[] in the top +directory of the +.I groff +source package. +. +Or read the +.I man page +.BR gpl (1). +You can also write to the +.nh +.B Free Software Foundation, 51 Franklin St - Fifth Floor, Boston, +.BR "MA 02110-1301, USA" . +.hy +.. +. +. +.\" -------------------------------------------------------------------- +.\" Setup +.\" -------------------------------------------------------------------- +. +.if n \{\ +. mso tty-char.tmac +. ftr CR R +. ftr CI I +. ftr CB B +.\} +. +.if '\*[.T]'dvi' \{\ +. ftr CB CW +.\} +. +.ds Ellipsis "\&.\|.\|.\&\"" +. +. +.\" -------------------------------------------------------------------- +.\" Macro definitions +. +.\" Ignore all arguments like a comment, even after a .eo call. +.de c +.. +. +.c -------------------------------------------------------------------- +.c .TP+ () +.c +.c Continuation line for .TP header. +.c +.de TP+ +. br +. ns +. TP \\$1 +.. +. +.c -------------------------------------------------------------------- +.c .File_name () +.c +.c Display a file or directory name in CB font. +.c +.de File_name +. Header_CB \\$@ +.. +. +.c -------------------------------------------------------------------- +.c .Header_CB () +.c +.c Display a line in CB font, for example after .TP +.c +.de Header_CB +. nh +. Text \f[CB]\\$1\f[]\\$2 +. hy +.. +. +.c -------------------------------------------------------------------- +.c Static register for inter-macro communication in `.Synopsis'. +.c +.nr chem:Synopsis.level 0 +. +.c -------------------------------------------------------------------- +.c .Synopsis () +.c +.c Begin a synopsis section, to be ended by a ./Synopsis macro. +.c +.de Synopsis +. if (\\n[chem:Synopsis.level] > 0) \ +. Error .\\$0: previous .Synopsis was not closed by ./Synopsis. +. nh +. ds @1 \\$1\" +. nr @old_indent \\n[.i] +. ad l +. in +\w'\fB\\*[@1]\0'u +. ti \\n[@old_indent]u +. B \\*[@1]\0\c +. rr @old_indent +. rm @1 +. nr chem:Synopsis.level +1\" marker for ./Synopsis +.. +. +.c -------------------------------------------------------------------- +.c ./Synopsis () +.c +.c Close a synopsis section opened by the previous .Synopsis macro. +.c +.de /Synopsis +. if (\\n[chem:Synopsis.level] <= 0) \ +. Error .\\$0: no previous call of .Synopsis +. br +. ad +. in +. hy +. nr chem:Synopsis.level -1 +.. +. +.c -------------------------------------------------------------------- +.c .Text (...) +.c +.c Treat the arguments as text, no matter how they look like. +.c +.de Text +. if (\\n[.$] == 0) \ +. return +. nh +. nop \)\\$*\) +. hy +.. +. +.\" End of macro definitions +. +. +.\" -------------------------------------------------------------------- +.\" SH "SYNOPSIS" +.\" -------------------------------------------------------------------- +. +.ad l +.Synopsis @g@chem +.RI [ "\%option" \*[Ellipsis]] +.RB [ \-\- ] +.RI [ "\%filespec" \*[Ellipsis]] +./Synopsis +. +.Synopsis @g@chem +\f[CB]\-h\fP\f[CR]|\fP\f[CB]\-\-help\fP +./Synopsis +. +.Synopsis @g@chem +\f[CB]\-v\fP\f[CR]|\fP\f[CB]\-\-version\fP +./Synopsis +. +. +.P +There are no other options than \f[CB]\-h\f[], \f[CB]\-\-help\f[], +\f[CB]\-v\f[] and \%\f[CB]\-\-version\f[]; these options provoke the +printing of a version or usage information, respectively, and all +.I filespec +arguments are ignored. +. +A +.I filespec +argument is either a file name of an existing file or a minus +character +.BR \- , +meaning standard input. +. +If no argument is specified then standard input is taken +automatically. +. +. +.\" -------------------------------------------------------------------- +.SH DESCRIPTION +.\" -------------------------------------------------------------------- +. +.I chem +produces chemical structure diagrams. +. +Today's version is best suited for organic chemistry (bonds, rings). +. +The +.B @g@chem +program is a +.B groff +preprocessor like +.BR @g@eqn , +.BR @g@pic , +.BR @g@tbl , +etc. +. +It generates +.I pic +output such that all +.I chem +parts are translated into diagrams of the +.I pic +language. +. +. +.P +The program +.B @g@chem +originates from the Perl source file +.File_name chem.pl . +It tells +.B @g@pic +to include a copy of the macro file +.File_name chem.pic . +. +Moreover the +.I groff +source file +.File_name pic.tmac +is loaded. +. +. +.P +In a style reminiscent of +.I eqn +and +.IR pic , +the +.I chem +diagrams are written in a special language. +. +. +.P +A set of +.I chem +lines looks like this +. +. +.IP +.nf +.ft B +\&.cstart +\f[I]chem data\f[] +\&.cend +.ft +.fi +. +. +.P +Lines containing the keywords +.B .cstart +and +.B .cend +start and end the input for +.BR @g@chem , +respectively. +. +In +.I pic +context, i.e., after the call of +.BR .PS , +.I chem +input can optionally be started by the line +.B \%begin\~chem +and ended by the line with the single word +.B end +instead. +. +. +.P +Anything outside these initialization lines is copied through +without modification; +all data between the initialization lines is converted into +.I pic +commands to draw the diagram. +. +. +.P +As an example, +. +.IP +.nf +.ft B +\&.cstart +CH3 +bond +CH3 +\&.cend +.ft +.fi +. +. +.P +prints two +.B CH3 +groups with a bond between them. +. +. +.P +To actually view this, you must run +.B @g@chem +followed by +.BR groffer : +. +.IP +.B @g@chem [file\*[Ellipsis]] | groffer +. +.P +If you want to create just +.B groff +output, you must run +.B @g@chem +followed by +.B groff +with the option +.B \-p +for the activation of +.BR @g@pic : +.IP +.B @g@chem [file\*[Ellipsis]] | groff -p \*[Ellipsis] +. +. +.\" -------------------------------------------------------------------- +.SH THE LANGUAGE +.\" -------------------------------------------------------------------- +. +The +.I 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., +.BR C , +.BR NH3 , +\*[Ellipsis]) and strings. +. +. +.\" -------------------------------------------------------------------- +.SS Setting Variables +.\" -------------------------------------------------------------------- +. +There are some variables that can be set by commands. +. +Such commands have two possible forms, either +.br +.RS +.I "variable value" +.RE +.br +or +.br +.RS +.IB "variable " = " value" +.RE +. +. +.P +This sets the given +.I variable +to the argument +.IR value . +If more arguments are given only the last argument is taken, all other +arguments are ignored. +. +. +.P +There are only a few variables to be set by these commands: +. +.TP +.BI textht " arg" +Set the height of the text to +.IR arg ; +default is 0.16. +. +.TP +.BI cwid " arg" +Set the character width to +.IR arg ; +default is 0.12. +. +.TP +.BI db " arg" +Set the bond length to +.IR arg ; +default is 0.2. +. +.TP +.BI size " arg" +Scale the diagram to make it look plausible at point size +.IR arg ; +default is 10 point. +. +. +.\" -------------------------------------------------------------------- +.SS Bonds +.\" -------------------------------------------------------------------- +. +.IP +.B bond +.RI [ direction ] +.RI [ length\~n ] +.RB [ from +.IR Name | picstuff ] +. +.P +draws a single bond in direction from nearest corner of +.IR Name . +.B bond +can also be +.BR "double bond" , +.BR "front bond" , +.BR "back bond" , +etc. +. +(We will get back to +.I Name +soon.) +. +. +.P +.I direction +is the angle in degrees (0\~up, positive clockwise) +or a direction word like +.BR up , +.BR down , +.B sw +(=\~southwest), etc. +. +If no direction is specified, the bond goes in the current direction +(usually that of the last bond). +. +. +.P +Normally the bond begins at the last object placed; this +can be changed by naming a +.B from +place. +. +For instance, to make a simple alkyl chain: +. +.RS +.TP 10m +.B CH3 +.TP+ +.B bond +(this one goes right from the CH3) +.TP+ +.B C +(at the right end of the bond) +.TP+ +.B double bond up +(from the C) +.TP+ +.B O +(at the end of the double bond) +.TP+ +.B bond right from C +.TP+ +.B CH3 +.RE +. +. +.P +A length in inches may be specified to override the default length. +. +Other +.I pic +commands can be tacked on to the end of a bond command, to created +dotted or dashed bonds or to specify a +.B to +place. +. +. +.\" -------------------------------------------------------------------- +.SS Rings +.\" -------------------------------------------------------------------- +. +There are lots of rings, but only 5 and 6-sided rings get +much support. +. +.B ring +by itself is a 6-sided ring; +.B benzene +is the benzene ring with a circle inside. +.B aromatic +puts a circle into any kind of ring. +. +.IP +.B ring +.RB [ \%pointing\ ( up | right | left | down )] +.RB [ \%aromatic ] +.RB [ put\ Mol\ at\ \f[I]n\f[] ] +.RB [ \%double +.IR i , j +.IR k , l +\*[Ellipsis]] +.RI [ picstuff ] +. +. +.P +The vertices of a ring are numbered 1, 2, \*[Ellipsis] from the +vertex that points in the natural compass direction. +. +So for a hexagonal ring with the point at the top, the top vertex +is\~1, while if the ring has a point at the east side, that is +vertex\~1. +. +This is expressed as +. +.IP +.ft B +.nf +R1: ring pointing up +R2: ring pointing right +.fi +.ft +. +. +.P +The ring vertices are named +.BR .V1 , +\*[Ellipsis], +.BI .V n\f[R],\f[] +with +.B .V1 +in the pointing direction. +. +So the corners of +.B R1 +are +.B R1.V1 +(the +.IR top ), +.BR R1.V2 , +.BR R1.V3 , +.B R1.V4 +(the +.IR bottom ), +etc., whereas for +.BR R2 , +.B R2.V1 +is the rightmost vertex and +.B R2.V4 +the leftmost. +. +These vertex names are used for connecting bonds or other rings. For +example, +. +.IP +.ft B +.nf +R1: benzene pointing right +R2: benzene pointing right with .V6 at R1.V2 +.fi +.ft +.P +creates two benzene rings connected along a side. +. +. +.P +Interior double bonds are specified as +.BI \%double\ n1 , n2\ n3 , n4\ \f[R]\*[Ellipsis];\f[] +each number pair adds an interior bond. +. +So the alternate form of a benzene ring is +. +.IP +.B ring double 1,2 3,4 5,6 +. +. +.P +Heterocycles (rings with something other than carbon at a vertex) are +written as +.BI put\ X\ at\ V\f[R],\f[] +as in +. +.IP +.B R: ring put N at 1 put O at 2 +. +. +.P +In this heterocycle, +.B R.N +and +.B R.O +become synonyms for +.B R.V1 and +.BR R.V2 . +. +. +.P +There are two 5-sided rings. +. +.B ring5 +is pentagonal with a side that matches the 6-sided ring; it has four +natural directions. +. +A +.B \%flatring +is a 5-sided ring created by chopping one corner of a 6-sided ring so +that it exactly matches the 6-sided rings. +. +. +.P +The description of a ring has to fit on a single line. +. +. +.\" -------------------------------------------------------------------- +.SS 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. +. +. +.P +Moieties can be specified in two kinds. +. +Normally a moiety is placed right after the last thing mentioned, +separated by a semicolon surrounded by spaces, e.g., +. +.IP +.B B1: bond ; OH +. +.P +Here the moiety is +.BR OH ; +it is set after a bond. +. +. +.P +As the second kind a moiety can be positioned as the first word in a +.IR pic -like +command, e.g., +. +.IP +.B CH3 at C + (0.5,0.5) +. +.P +Here the moiety is +.BR CH3 . +It is placed at a position relative to +.BR C , +a moiety used earlier in the chemical structure. +. +. +.P +So moiety names can be specified as +.I chem +positions everywhere in the +.I chem +code. +. +Beneath their printing moieties are names for places. +. +. +.P +The moiety +.B BP +is special. +. +It is not printed but just serves as a mark to be referred to in later +.I chem +commands. +. +For example, +. +.IP +.B bond ; BP +. +.P +sets a mark at the end of the bond. +. +This can be used then for specifying a place. +. +The name +.BP BP +is derived from +.I branch point +(i.e., line crossing). +. +. +.P +A string within double quotes +.B \[dq] +is interpreted as a part of a +.I chem +command. +. +It represents a string that should be printed (without the quotes). +. +Text within quotes \[dq]\*[Ellipsis]\[dq] is treated more or less +like a moiety except that no changes are made to the quoted part. +. +. +.\" -------------------------------------------------------------------- +.SS Names +.\" -------------------------------------------------------------------- +. +In the alkyl chain above, notice that the carbon atom +.B 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 +. +.IP +.IB Name : +\*[Ellipsis] +. +. +.P +.I Name +is often the name of a moiety like +.BR CH3 , +but it need not to be. +. +Any name that begins with a capital letter and which contains +only letters and numbers is valid: +. +.RS +.TP +.B First: +.B bond +.TP+ +\& +.B bond 30 from First +.RE +. +. +.\" -------------------------------------------------------------------- +.SS Miscellaneous +.\" -------------------------------------------------------------------- +. +The specific construction +.RS +.TP +.BR bond\ \*[Ellipsis] " ; moiety" +.RE +.P +is equivalent to +.IP +.ft B +.nf +bond +moiety +.fi +.ft +. +. +.P +Otherwise, each item has to be on a separate line (and only one line). +Note that there must be whitespace after the semicolon which separates +the commands. +. +. +.P +A period character +.B .\& +or a single quote +.B ' +in the first column of a line signals a +.I troff +command, which is copied through as-is. +. +. +.P +A line whose first non-blank character is a hash character +.RB ( # ) +is treated as a comment and thus ignored. +. +However, hash characters within a word are kept. +. +. +.P +A line whose first word is +.B pic +is copied through as-is after the word +.B pic +has been removed. +. +. +.P +The command +.IP +.B size +.I n +.P +scales the diagram to make it look plausible at point size\~\c +.I n +(default is 10\~point). +. +. +.P +Anything else is assumed to be +.I pic +code, which is copied through with a label. +. +. +.P +Since +.B @g@chem +is a +.B @g@pic +preprocessor, it is possible to include +.I pic +statements in the middle of a diagram to draw things not provided for +by +.I chem +itself. +. +Such +.I pic +statements should be included in +.I chem +code by adding +.B pic +as the first word of this line for clarity. +. +. +.P +The following +.I pic +commands are accepted as +.I chem +commands, so no +.B pic +command word is needed: +. +.IP +.B define +Start the definition of +.I pic +macro within +.IR chem . +. +.RS +.TP +.B [ +Start a block composite. +. +.TP +.B ] +End a block composite. +. +.TP +.B { +Start a macro definition block. +. +.TP +.B } +End a macro definition block. +.RE +. +.P +The macro names from +.B define +statements are stored and their call is accepted as a +.I chem +command as well. +. +. +.\" -------------------------------------------------------------------- +.SS WISH LIST +.\" -------------------------------------------------------------------- +. +.P +This TODO list was collected by Brian Kernighan. +. +. +.P +Error checking is minimal; errors are usually detected and reported in +an oblique fashion by +.IR pic . +. +. +.P +There is no library or file inclusion mechanism, and there is no +shorthand for repetitive structures. +. +. +.P +The extension mechanism is to create +.I pic +macros, but these are tricky to get right and don't have all the +properties of built-in objects. +. +. +.P +There is no in-line chemistry yet (e.g., analogous to the $...$ +construct of eqn). +. +. +.P +There is no way to control entry point for bonds on groups. +. +Normally a bond connects to the carbon atom if entering from +the top or bottom and otherwise to the nearest corner. +. +. +.P +Bonds from substituted atoms on heterocycles do not join at the proper +place without adding a bit of +.IR pic . +. +. +.P +There is no decent primitive for brackets. +. +. +.P +Text (quoted strings) doesn't work very well. +. +. +.P +A squiggle bond is needed. +. +. +.\" -------------------------------------------------------------------- +.SH "FILES" +.\" -------------------------------------------------------------------- +. +.TP +.File_name @picdir@/chem.pic +A collection of +.I pic +macros needed by +.BR @g@chem . +. +.TP +.File_name @tmacdir@/pic.tmac +A macro file which redefines +.B .PS +and +.BR .PE +to center +.I pic +diagrams. +. +. +.\" -------------------------------------------------------------------- +.SH "BUGS" +.\" -------------------------------------------------------------------- +. +Report bugs to the +.MTO bug-groff@gnu.org "bug-groff mailing list" . +. +Include a complete, self-contained example that will allow the bug to +be reproduced, and say which version of +.I groff +and +.I chem +you are using. +. +You can get both version numbers by calling +.BR "@g@chem --version" . +. +. +.P +You can also use the +.MTO groff@gnu.org "groff mailing list" , +but you must first subscribe to this list. +. +You can do that by visiting the +.URL http://\:lists.gnu.org/\:mailman/\:listinfo/\:groff \ +"groff mailing list web page" . +. +. +.P +See +.BR \%groff (@MAN1EXT@) +for information on availability. +. +. +.\" -------------------------------------------------------------------- +.SH "SEE ALSO" +.\" -------------------------------------------------------------------- +. +.BR \%groff (@MAN1EXT@), +.BR \%@g@pic (@MAN1EXT@), +.B \%groffer (@MAN1EXT@). +. +. +.P +You can still get the original +.URL http://cm.bell-labs.com/netlib/typesetting/chem.gz \ +"chem awk source" . +. +Its +.File_name README +file was used for this manual page. +. +. +.P +The other classical document on +.I chem +is +.URL http://cm.bell-labs.com/cm/cs/cstr/122.ps.gz 122.ps . +. +. +.\" -------------------------------------------------------------------- +.SH "AUTHOR" +.\" -------------------------------------------------------------------- +.author +. +. +.\" -------------------------------------------------------------------- +.SH "COPYING" +.\" -------------------------------------------------------------------- +.copyleft +. +. +.\" -------------------------------------------------------------------- +.\" Emacs settings +.\" -------------------------------------------------------------------- +. +.\" Local Variables: +.\" mode: nroff +.\" End: diff --git a/contrib/chem/chem.pic b/contrib/chem/chem.pic new file mode 100644 index 00000000..13fdd55a --- /dev/null +++ b/contrib/chem/chem.pic @@ -0,0 +1,97 @@ +# macros for chem + +# Source file position: /contrib/chem/chem.pic +# Installed position: /lib/groff/chem + +# Copyright (C) 2006 Free Software Foundation, Inc. +# Written by Brian Kernighan , +# modified by Bernd Warken. + +# This file is part of `chem', which is part of `groff'. + +# `groff' is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# `groff' is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with `groff'; see the files COPYING and LICENSE in the top +# directory of the `groff' source. If not, write to the Free Software +# Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, +# USA. + +######################################################################## + +pi = 3.141592654 +deg = 57.29578 +# cr = 0.08 # radius of invis circle at ring vertices (see cr[vh]) +# crh = 0.16; crw = 0.12 # ht & wid of invis ellipse around atoms at ring vertices +# dav = 0.015 # vertical shift up for atoms in atom macro + +# atom(text, wid, ht, carbon position, crh, crw, dav) +define atom { [ + T: $1 wid $2 ht $3-2*$7 + C: ellipse invis ht $5 wid $6 at T.w + ($4,$7) + L: ellipse invis ht $5 wid $6 at T.w + (cwid/2,$7) + R: ellipse invis ht $5 wid $6 at T.e + (-cwid/2,$7) +] } + +# bond(length, angle in degrees, whatever) +define bond { + line $3 by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg) +} + +# fancy bonds: r, theta, from/at +define doublebond { + line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg) + V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y + norm = sqrt(dx*dx + dy*dy) + ny = dx * .02 / norm + nx = -dy * .02 / norm + line from V1 + (nx,ny) to V2 + (nx,ny) + line from V1 - (nx,ny) to V2 - (nx,ny) + move to V2 +} +define triplebond { + line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg) + V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y + norm = sqrt(dx*dx + dy*dy) + ny = dx * .025 / norm + nx = -dy * .025 / norm + line from V1 + (nx,ny) to V2 + (nx,ny) + line from V1 - (nx,ny) to V2 - (nx,ny) + line from V1 to V2 + move to V2 +} +define backbond { + line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg) + V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y + norm = sqrt(dx*dx + dy*dy) + n = norm / .025 + ny = dx * .02 / norm + nx = -dy * .02 / norm + for i = 1 to n-1 do { + XZ: i/n + line from XZ + (nx,ny) to XZ - (nx,ny) + } + move to V2 +} +define frontbond { + line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg) + V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y + ah = arrowht; aw = arrowwid; ahead = arrowhead + arrowht = sqrt(dx*dx + dy*dy) + arrowwid = 0.05 + arrowhead = 7 + line <- from V1 to V2 + arrowht = ah; arrowwid = aw; arrowhead = ahead +} +### Emacs settings +# Local Variables: +# mode: Nroff +# End: diff --git a/contrib/chem/chem.pl b/contrib/chem/chem.pl index 9c6ea782..7dc38657 100755 --- a/contrib/chem/chem.pl +++ b/contrib/chem/chem.pl @@ -30,8 +30,8 @@ # settings ######################################################################## -my $Program_Version = '0.2.0'; -my $Last_Update = '8 Nov 2006'; +my $Program_Version = '0.3.0'; +my $Last_Update = '10 Nov 2006'; # this setting of the groff version is only used before make is run, # otherwise @VERSION@ will set it. @@ -57,7 +57,7 @@ use FindBin; my $Chem_Name; my $Groff_Version; -my $File_macros_pic; +my $File_chem_pic; my $File_pic_tmac; BEGIN { @@ -74,7 +74,7 @@ BEGIN { my $chem_dir = $FindBin::Bin; $at_at{'BINDIR'} = $chem_dir; $at_at{'G'} = ''; - $File_macros_pic = File::Spec->catfile($chem_dir, 'macros.pic'); + $File_chem_pic = File::Spec->catfile($chem_dir, 'chem.pic'); $File_pic_tmac = File::Spec->catfile($chem_dir, '..', 'pic.tmac'); $Groff_Version = ''; $Chem_Name = 'chem'; @@ -84,7 +84,7 @@ BEGIN { $at_at{'G'} = '@g@'; $at_at{'PICDIR'} = '@picdir@'; $at_at{'TMACDIR'} = '@tmacdir@'; - $File_macros_pic = + $File_chem_pic = File::Spec->catfile($at_at{'PICDIR'}, 'chem.pic'); $File_pic_tmac = File::Spec->catfile($at_at{'TMACDIR'}, 'pic.tmac'); $Chem_Name = $at_at{'G'} . 'chem'; @@ -820,7 +820,7 @@ sub fields { # sub init { if ($First_Time) { - printf "copy \"%s\"\n", $File_macros_pic; + printf "copy \"%s\"\n", $File_chem_pic; printf "\ttextht = %g; textwid = .1; cwid = %g\n", $Params{'textht'}, $Params{'cwid'}; printf "\tlineht = %g; linewid = %g\n", diff --git a/contrib/chem/examples/122/README b/contrib/chem/examples/122/README index 28f127a5..1b3b3c36 100644 --- a/contrib/chem/examples/122/README +++ b/contrib/chem/examples/122/README @@ -26,15 +26,27 @@ You can view the graphical display of the examples by calling groffer -`groffer' calls `chem' automatically. Or get a suitable `groff' -output by running +`groffer' calls `chem' automatically. + +If you want to transform example files to a different format use the +`roff2*' programs: + +`roff2dvi' prints dvi format to standard output, +`roff2html' generates html output, +`roff2pdf' outputs pdf mode, +`roff2ps' produces PostScript output, +`roff2text' generates text output in the groff device `latin1', +`roff2x' prints the output in the groff device X that is + suitable for programs like `gxditview' or `xditview'. + +To get a suitable `groff' output run @g@chem | groff -p ... ####### License -Last update: 6 Nov 2006 +Last update: 9 Nov 2006 Copyright (C) 2006 Free Software Foundation, Inc. Written by Bernd Warken. diff --git a/contrib/chem/examples/README.txt b/contrib/chem/examples/README.txt index 160cabda..2e2da232 100644 --- a/contrib/chem/examples/README.txt +++ b/contrib/chem/examples/README.txt @@ -4,8 +4,20 @@ You can view the graphical display of the examples by calling groffer -`groffer' calls `chem' automatically. Or get a suitable `groff' -output by running +`groffer' calls `chem' automatically. + +If you want to transform example files to a different format use the +`roff2*' programs: + +`roff2dvi' prints dvi format to standard output, +`roff2html' generates html output, +`roff2pdf' outputs pdf mode, +`roff2ps' produces PostScript output, +`roff2text' generates text output in the groff device `latin1', +`roff2x' prints the output in the groff device X that is + suitable for programs like `gxditview' or `xditview'. + +To get a suitable `groff' output run @g@chem | groff -p ... @@ -25,7 +37,7 @@ chemically. ####### License -Last update: 6 Nov 2006 +Last update: 9 Nov 2006 Copyright (C) 2006 Free Software Foundation, Inc. Written by Bernd Warken. diff --git a/contrib/chem/macros.pic b/contrib/chem/macros.pic deleted file mode 100644 index c0c31e15..00000000 --- a/contrib/chem/macros.pic +++ /dev/null @@ -1,97 +0,0 @@ -# macros for chem - -# Source file position: /contrib/chem/macros.pic -# Installed position: /lib/groff/chem - -# Copyright (C) 2006 Free Software Foundation, Inc. -# Written by Brian Kernighan , -# modified by Bernd Warken. - -# This file is part of `chem', which is part of `groff'. - -# `groff' is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# `groff' is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with `groff'; see the files COPYING and LICENSE in the top -# directory of the `groff' source. If not, write to the Free Software -# Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, -# USA. - -######################################################################## - -pi = 3.141592654 -deg = 57.29578 -# cr = 0.08 # radius of invis circle at ring vertices (see cr[vh]) -# crh = 0.16; crw = 0.12 # ht & wid of invis ellipse around atoms at ring vertices -# dav = 0.015 # vertical shift up for atoms in atom macro - -# atom(text, wid, ht, carbon position, crh, crw, dav) -define atom { [ - T: $1 wid $2 ht $3-2*$7 - C: ellipse invis ht $5 wid $6 at T.w + ($4,$7) - L: ellipse invis ht $5 wid $6 at T.w + (cwid/2,$7) - R: ellipse invis ht $5 wid $6 at T.e + (-cwid/2,$7) -] } - -# bond(length, angle in degrees, whatever) -define bond { - line $3 by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg) -} - -# fancy bonds: r, theta, from/at -define doublebond { - line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg) - V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y - norm = sqrt(dx*dx + dy*dy) - ny = dx * .02 / norm - nx = -dy * .02 / norm - line from V1 + (nx,ny) to V2 + (nx,ny) - line from V1 - (nx,ny) to V2 - (nx,ny) - move to V2 -} -define triplebond { - line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg) - V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y - norm = sqrt(dx*dx + dy*dy) - ny = dx * .025 / norm - nx = -dy * .025 / norm - line from V1 + (nx,ny) to V2 + (nx,ny) - line from V1 - (nx,ny) to V2 - (nx,ny) - line from V1 to V2 - move to V2 -} -define backbond { - line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg) - V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y - norm = sqrt(dx*dx + dy*dy) - n = norm / .025 - ny = dx * .02 / norm - nx = -dy * .02 / norm - for i = 1 to n-1 do { - XZ: i/n - line from XZ + (nx,ny) to XZ - (nx,ny) - } - move to V2 -} -define frontbond { - line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg) - V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y - ah = arrowht; aw = arrowwid; ahead = arrowhead - arrowht = sqrt(dx*dx + dy*dy) - arrowwid = 0.05 - arrowhead = 7 - line <- from V1 to V2 - arrowht = ah; arrowwid = aw; arrowhead = ahead -} -### Emacs settings -# Local Variables: -# mode: Nroff -# End: -- cgit v1.2.1