After working some more I was able to get everything to work. Too bad we have to write out an entire new file, but it's better than nothing. Thanks to all who worked on this. The script is below:
#!/usr/bin/perl
#Nisus Macro Block
#source front
#destination new
#Send Text as RTF
#End Nisus Macro Block


# dochemsubcripts.pl -- perl script to sniff out molecular formulas in an
# RTF file and insert subscript tags for the numbers, superscript tags for
# ionic signs. JL 8/2003


@myfile=<STDIN>;
foreach $s (@myfile){
     $s=~s/([A-Z][a-z]?[0-9]*)([0-9][+-])/$1\{\\super $2\}/g;
        $s=~s/([A-Z][a-z]?)([0-9]*[+-])/$1\{\\super $2\}/g;
        $s=~s/\)([+-])/\)\{\\super $1\}/g;
        $s=~s/\)([0-9]+)([0-9][+-])/\)\{\\sub $1\}{\\super $2\}/g;
        $s=~s/([A-Z][a-z]?)([0-9]+)/$1\{\\sub $2\}/g;
        $s=~s/\)([0-9]+)/\)\{\\sub $1\}/g;
        print $s;
}

# end of script
--
Patrick Gormley
Lapeer East High School
Lapeer MI 48446
http://chem.lapeer.org
--A generation which ignores history has no past and no future.
----Robert Heinlein



---------------------------------------------------
The Nisus Interactive List
[EMAIL PROTECTED]

Searchable archives:
http://www.mail-archive.com/nisus-interactive%40nisus.com/

To unsubscribe from this list please send a message with "unsubscribe
nisus-interactive" in the body of the email to [EMAIL PROTECTED]




Reply via email to