Hi Oliver, At 2024-03-22T21:01:27+0100, Oliver Corff via wrote: > recently I compiled, and re-compiled, and again recompiled a set of > various documents with different tables, equations etc.. For each of > the documents, the precise requirements of preprocessors were > different, and more often than not, I forgot to set the appropriate > groff option when running the compilation to the effect that I had to > redo my edit - check cycle.
I second Dave's suggestion that what you want _here_ is a Makefile. Why struggle to remember what invocation is required when you can record it in a reliable script? Since I have it handy, I'll attach Stuart Feldman's original make(1) paper from Seventh Edition Unix. > Since there is no groffer script anymore, may I humbly propose a new > option to groff, namlely "-A" (mnemomic: [A]ll preprocessors) which > forces all available preprocessors to be used? My view is expressed in groff(1): To process a roff input file using the preprocessors tbl and pic and the me macro package in the way to which AT&T troff users were accustomed, one would type (or script) a pipeline. pic foo.me | tbl | troff -me -Tutf8 | grotty Using groff, this pipe can be shortened to an equivalent command. groff -p -t -me -T utf8 foo.me An even easier way to do this is to use grog(1) to guess the preprocessor and macro options and execute the result by using the command substitution feature of the shell. $(grog -Tutf8 foo.me) You might therefore define a couple of functions in your .bashrc or similar shell startup file. # format for typesetter gr () { $(grog -T pdf "$@") } # format for terminal grt () { $(grog -T utf8 "$@") } > The penalty of this display of laziness is, in my eyes, minor: running > a document against a preprocessor which is not needed does not do any > harm I am aware of (I stand to be corrected in case there is such a > situation), and since we talk only of a handful of preprocessors, not > dozens, the overhead in CPU time should also be acceptable; all the > more since -A would be invoked only in case of the presumed presence > of any of tables, equations, pictures, reference lists. I agree that even the accumulated cost of repeated unnecessary preprocessor runs is likely low on modern systems. But I also think that combining the "groff guesser" with features extant in nearly every Unix shell enable people to be lazy in ways that they can tailor to their needs. > I am ready to accept the appropriate reprimand for this idea. I don't think a reprimand is warranted for seeking to economize your personal workflow. Much of the power of Unix comes from the way it encourages the user to compose independent code modules, including entire programs, in ways that you can fine-tune. One of the virtues of a mailing list like this is that we can share, refine, and adapt tips and tricks for doing so. Regards, Branden
feldman.pdf
Description: Adobe PDF document
signature.asc
Description: PGP signature