Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!sun!angel!henry From: henry%angel@Sun.COM (Henry McGilton -- Software Products) Newsgroups: comp.unix.questions Subject: Re: software tools question Summary: Source'ing files in the troff preprocessors. Keywords: software tools question macro include text processing Message-ID: <128978@sun.Eng.Sun.COM> Date: 8 Dec 89 20:04:54 GMT References: <694@dgis.dtic.dla.mil> Sender: news@sun.Eng.Sun.COM Lines: 54 In Article <19856@dgis.dtic.dla.mil> jkrueger (Jon Krueger) writes: * I have a table that is common to many different * documents. I decided to keep it in a separate file, so * I can maintain a single copy, and include it into my * documents as needed. I'm using text processing tools * commonly found on the UNIX (registered trademark of * AT&T) timesharing system: troff and tbl. So I placed * my tbl definitions into a file we'll call mytable. I * figured I'd just use the the .so command in troff: .so mytable. * Right? * Wrong: the .so command includes mytable *after* tbl is done. This is indeed true. .so is a troff request, and as such is processed by troff, which, regrettably, comes after its preprocessors in the pipeline. * It needs to be included before. So I went * looking for an interpolation tool. The right tool on * UNIX seemed to be simple macro preprocessor: m4. I * changed the .so mytable to include(mytable), and * generated my document with m4 mydoc | tbl | troff. * This worked pretty well. * . . . lines deleted detailing why m4 is not the whole answer. This requirement occurs all the time. If you have access to any UNIX system running the 4.x BSD (Berkeley) flavor of UNIX, you should find a program called `soelim'. While soelim was originally written for another purpose, it turns out that it does just what you want, namely, to do the source'ing of included files before the troff preprocessors do their work. Then you run the pipeline of commands in the form: soelim sourcefiles . . . | pic | tbl | eqn | troff . . . I don't know if soelim is available on System V at this point. If you have access to a BSD system, grab the source from such a system. soelim was written by Bill Joy in 1977, and, as far as I know, is not copyrighted. Anybody wish to elucidate on the issue of whether a status of `not copyrighted' implies `publicly distributable'? ................ Henry +------------------+------------------------+---------------------------+ | Henry McGilton | I saw the future, | arpa: hmcgilton@sun.com | | Sun Microsystems | and it didn't work. | uucp: ...!sun!angel!henry | | Mt. View, CA | | | +------------------+------------------------+---------------------------+