[Top][All Lists]

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

Re: pdfroff in groff 1.23.0.rc3 changes compared to 1.22.4

From: G. Branden Robinson
Subject: Re: pdfroff in groff 1.23.0.rc3 changes compared to 1.22.4
Date: Tue, 4 Apr 2023 11:58:52 -0500

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/ document in our
source tree...

$ git di
diff --git a/doc/ b/doc/
index 8376a71ed..359b586a1 100644
--- a/doc/
+++ b/doc/
@@ -4422,6 +4422,7 @@ the curious may consult its source in the file
 to see how its formatting was achieved.
 .\" ------------------------
+.if '\*[.T]'pdf' .pdfswitchtopage after top

...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

So here's another quick patch to our document, by way of

diff --git a/doc/ b/doc/
index 8376a71ed..7903b4569 100644
--- a/doc/
+++ b/doc/
@@ -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
 .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.


Description: Troff MS-macros document

Attachment: ms.pdf
Description: Adobe PDF document

Attachment: signature.asc
Description: PGP signature

reply via email to

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