Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!romwa From: romwa@utgpu.UUCP Newsgroups: comp.text Subject: Re: Preprocessor for General Text Processing Message-ID: <1987Aug29.111617.4236@gpu.utcs.toronto.edu> Date: Sat, 29-Aug-87 11:16:17 EDT Article-I.D.: gpu.1987Aug29.111617.4236 Posted: Sat Aug 29 11:16:17 1987 Date-Received: Sun, 30-Aug-87 07:20:29 EDT References: <1828@super.upenn.edu> <1987Aug22.180919.9252@gpu.utcs.toronto.edu> <705@hslrswi.UUCP> Organization: University of Toronto Computing Services Lines: 41 Checksum: 27548 Summary: mea culpa In article <705@hslrswi.UUCP>, graham@hslrswi.UUCP (Graham Tritt) writes: > >> 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. No, you're right, I was wrong. Somehow my brain got switched off when I wrote that reply. I preprocess troff all the time. Nothing like a little public humiliation to put one in one's place :-). > > 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.