groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "Writing my PhD using groff"


From: Deri
Subject: Re: "Writing my PhD using groff"
Date: Sun, 24 Jul 2022 13:33:33 +0100

On Sunday, 24 July 2022 03:08:01 BST G. Branden Robinson wrote:
> At 2022-07-23T18:30:22-0700, Larry McVoy wrote:
> > (a) the two pass thing so you could easily do a table of contents and
> 
> You can _do_ the table of contents in one pass; relocating it to the
> front matter requires either a second pass or a post-processing tool.
> An index is a much bigger pain because it has to be sorted.
> 

If your output is intended to be a pdf you could do the mom trick which
produces a TOC in a single pass. Unlike postscript, where the pages are
linear, a pdf uses objects, and the order of page objects is specified by an
array object.

See AUTO_RELOCATE_TOC in the mom macro. It uses the gropdf commands
.pdfpagename and .pdfswitchtopage which are documented in the gropdf man
page [1]:-

   \X'pdf: pagename name'
        This gives the current page a name.

        There  are  two  default names for any document which do not need to be
        declared ‘top’ and ‘bottom’.

        The convenience command for this is .pdfpagename.

   \X'pdf: switchtopage when name'
        Normally each new page is appended to the end  of  the  document,  this
        command  allows  following  pages  to be inserted at a ‘named’ position
        within the document (see pagename command above).  ‘when’ can be either
        ‘after’ or ‘before’.  If it is ommitted it defaults to ‘before‘.

        The  convenience  command  for  this is .pdfswitchtopage.  It should be
        used at the end of the page before you want the switch to happen.

        This allows pages such as a TOC to be moved to elsewhere in  the  docu‐
        ment, but more esoteric uses are possible.

It should be possible to extend macros which generate TOCs to include these 
commands if the output processor is gropdf.

Cheers 

Deri

[1] the definition is in the latest version of the man page, I missed 
documenting
the command in earlier versions.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]