Keith Marshall <keithmarsh...@users.sourceforge.net> wrote: |On 17/09/14 21:47, Steffen Nurpmeso wrote: |> In general it is a pity that it is impossible to generate a complete |> document with TOC, index etc. in "safe" mode. But this is way |> off-topic. | |It may be off-topic, but FWIW, it is perfectly feasible to do all of the |above entirely in safe mode, by adapting the technique employed by |pdfroff to capture PDF outline and reference data.
True. The question would be how to implement this on the macro level -- a new command to create safe and managed temporary files isn't enough, just like pdfroff demonstrates multiple passes are necessary to get the TOC and index entries at the right place and with the right content (page numbers). Some fantasizing. For this to work troff would also have to implement a three-pass mechanism, a number register has to state which pass we're in, a command to "regain" the paths of safely managed temporary files in further runs is necessary. E.g., create a "toc" file in the first run, include it in the second run while at the same time creating a new toc temporary file with update page numbers etc., finally include that new "toc" file in the third run. Likewise for indices. To not run into ressource limits it must be possible to request deletion of a managed temporary file. At first glance this doesn't look as if it is an impossible thing to do, but today maybe only Werner has the necessary knowledge to comment on that. --steffen