groff
[Top][All Lists]
Advanced

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

Re: [Groff] TOC with links in mom


From: Keith Marshall
Subject: Re: [Groff] TOC with links in mom
Date: Tue, 22 Feb 2011 12:29:04 +0000

On 22 February 2011 10:45, Petr Man wrote:
> I am unable to figure out how to make groff/pdfroff with pdfmark to
> produce clickable TOC

Well, I wrote the pdfmark macros, and I have yet to figure it out
myself; I use the bookmarks pane of the pdf reader as my clickable
TOC, and populate it using the -O option to .pdfhref

> out of a mom document.

I've never used mom, so I cannot offer advice specific to it; I don't
believe anyone has contributed mom bindings for pdfmark, as I have done
for ms.

> From the mailing list
> archives it seemed to me, that pdfroff should be able to do that,

It should, if you use an auxiliary file in a "pre-press" pass[*], to
capture the TOC content, and arrange for this to be sourced near the
start of your document; (you may wish to provide an empty auxiliary
file, before you run pdfroff, to avoid first-pass warnings when you try
to source a non-existent file).  The trick is to embed the '.pdfhref -L'
markup into the auxiliary file, so that it is interpreted when that file
is sourced, while also placing corresponding '.pdfhref -M' markup at the
appropriate locations within the body text.

> but I end up with the same document twice in the file instead

That happens because pdfroff expects the TOC to be generated using
the .TC feature of ms, (or its equivalent in any other macro package).
This feature causes the TOC to be generated at the *end* of the output
stream, so pdfroff performs two output passes, with the PHASE register
set to 1 for a TOC capture pass, and to 2 for body capture; this is then
used by bindings such as defined in spdf.tmac, to adjust OPMODE within
pdfmark, to capture appropriate content in each pass.  If you aren't
controlling OPMODE appropriately, then you get the entire document in
both passes, hence two concatenated copies in the output stream; to
disable that, you need to specify the --no-toc-relocation option, when
you invoke pdfroff.

[*] A feature, which I'd like to add to pdfroff, is a mechanism for
capture of TOC defining markup directly into the auxiliary files used by
pdfroff itself.  Unfortunately, I just don't have time to devote to this
at present; patches will be gratefully considered.

-- 
Regards,
Keith.



reply via email to

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