I have encountered few problems. 1. .pdfswitchtopage puts ToC always as the first page, and I would like to put it after the cover page. 2. There is a page number shift between the actual page number and the one I need to input into the evince to jump to particular heading. 3. What is the preferred way to automatically add .XS and .XE? 4. In doc/groff.pdf I am able to quickly jump to the heading by clicking on it in the ToC. How is this achieved?
I can see that doc/groff.pdf has perfectly formatted ToC, this is exactly what I would like to achieve. However, trying to figure out how it was achieved is not so easy as it looks like there is quite a lot *nix wizardry behind it. Best regards, Michał Kruszewski Sent with Proton Mail secure email. ------- Original Message ------- On Tuesday, April 4th, 2023 at 6:58 PM, G. Branden Robinson <g.branden.robin...@gmail.com> wrote: > At 2023-04-04T16:26:30+0000, Michał Kruszewski wrote: > > > I use pdfroff only because of 2 reasons. If you know how to do the > > same with groff I would even prefer to use groff instead: > > > Sure, maybe I can help. > > > 1. ToC. I haven't managed to generate ToC with groff at the beginning > > of the document. > > > When creating a PDF, you can use a groff pdf driver macro > called 'pdfswitchtopage' to achieve this. > > For instance, I just did the following to our doc/ms.ms document in our > source tree... > > $ git di > diff --git a/doc/ms.ms b/doc/ms.ms > index 8376a71ed..359b586a1 100644 > --- a/doc/ms.ms > +++ b/doc/ms.ms > @@ -4422,6 +4422,7 @@ the curious may consult its source in the file > .I ms.ms > to see how its formatting was achieved. > .\" ------------------------ > +.if '\*[.T]'pdf' .pdfswitchtopage after top > .TC > . > . > > ...and it worked just fine. > > > I do not ask for a lot. Just print me the info about header pages > > (stdout or file) and I will easily generate ToC with Perl/Python > > script and Makefile target. I guess it is currently not possible? > > > No, I think it's quite possible; see above. :) > > > 2. PDF meta data. > > pdfroff has .pdfinfo, how to achieve the same with groff? > > > groff's pdf output driver supports it as well, with the same syntax I > think; but to my surprise it is not documented in the gropdf(1) man > page. > > So here's another quick patch to our ms.ms document, by way of > illustration. > > diff --git a/doc/ms.ms b/doc/ms.ms > index 8376a71ed..7903b4569 100644 > --- a/doc/ms.ms > +++ b/doc/ms.ms > @@ -41,6 +41,10 @@ > .EF '''' > .OH 'Using \f[I]groff\f[] with the \f[I]ms\f[] macros''%' > .OF '''' > +.pdfinfo /Title Using groff with the ms Macro Package > +.pdfinfo /Author Larry Kollar, G. Branden Robinson > +.pdfinfo /Subject composing 2023 documents with a 1975 macro package > +.pdfinfo /Keywords groff ms troff nroff > .TL > Using > .BI groff > > These items show up in the "Properties" pop-up dialog box of the > "evince" and "okular" PDF viewers for me. > > I'm attaching the document in source and rendered forms so you can > verify whether they work as well for you. > > Regards, > Branden