Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mcvax!cernvax!hslrswi!graham From: graham@hslrswi.UUCP (Graham Tritt) Newsgroups: comp.text Subject: Re: Preprocessor for General Text Processing Message-ID: <705@hslrswi.UUCP> Date: Tue, 25-Aug-87 13:05:35 EDT Article-I.D.: hslrswi.705 Posted: Tue Aug 25 13:05:35 1987 Date-Received: Fri, 28-Aug-87 06:23:42 EDT References: <1828@super.upenn.edu> <1987Aug22.180919.9252@gpu.utcs.toronto.edu> Reply-To: graham@hslrswi.UUCP (Graham Tritt) Organization: Hasler AG, CH-3000 Berne 14, Switzerland Lines: 45 >> I am wondering if there >> is a preprocessor for the whole process that will allow me to say >> #define .sqroot. @what ever the eqn code is >> #define .ECOLI. \fIE. coli\fP >> #include ... > >A possible solution to this is to postprocess your document >with sed or awk or even global changes with ed. (sed is preferred). > >Set up your sed script to look like: >s/.ECOLI./\\fIE. coli\\fP/ (syntax not guaranteed) >etc... >etc... > >All you have to do is set up your "defines" with sed syntax, >and then you t/nroff run a command which looks like: > >eqn file | troff -macro | sed ... | lp > >Mark T. Dornfeld >utgpu!romwa What you need is a pre-processor rather than a post-processor. Or, for instance, your line lengths and justification set by troff (in our case nroff) will be all screwed up. Tell me if I am wrong. We use several extra pre(pre)processors to make such substitutions. For instance, for words in a file "listofstrings", to insert \fI \fR bracketing, which is handy for manual pages containing lots of command names. Similarly for the expansion of abbreviations. We find that sed is enough, and can be wrapped up in a friendly (but slow) script. Some of these are used once only followed by manual checking. Some are automatically called everytime (if needed, like lbl, tbl or col) in the script which intelligently decides what has to be done and calls nroff in the appropriate pipe. ____________ Graham D. Tritt | ________|__ P.O. Box 302, 3000 Berne 25, Switzerland | | _ | | | _| |_ | Telephone: +41 31 63 39 25 | | |_ + _| | X.400: graham@hslrswi.hasler |__| |_| | Bitnet: graham%hslrswi.UUCP@cernvax.BITNET |_________| Uucp: ... {seismo,ukc, ... }!mcvax!cernvax!hslrswi!graham ***************************************************************************