I notice that one way to check if pdfroff is called is to look at the value of \V[GROFF_TMPDIR], because the script sets it with an export. (pdfroff sets a ton of other environment variables, but since they aren't set with an export, they can't be checked from a troff document.) The trouble with GROFF_TMPDIR is of course that the name doesn't specifically scream pdfroff, and could have been plausibly set for other reasons. Maybe it'd be a good idea to similarly set a more pdfroff-specific environment variable too (e.g. INSIDE_PDFROFF)? --d
On Monday, October 26, 2015 12:16 PM, Keith Marshall <keith.d.marsh...@ntlworld.com> wrote: On 26/10/15 13:12, Dorai Sitaram wrote: > Incidentally, is there a way to tell from inside a document whether > it is being processed by pdfroff or groff -Tps? In both cases, the > string register .T is 'ps'. Not really; pdfroff is just a shell script, which runs groff -Tps multiple times, (to resolve internal pdfmark references), until the layout stabilizes, then pipes the resultant PostScript output through gs, to generate PDF output. You might infer use of pdfroff from the existence of a register called PHASE, (which will have a value of 1 when compiling a relocatable TOC, and 2 in the final document body generating pass), but that's hardly exclusive to pdfroff.