[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mom, mm, and PDF files
From: |
G. Branden Robinson |
Subject: |
Re: mom, mm, and PDF files |
Date: |
Tue, 16 Apr 2024 13:00:33 -0500 |
Hi Jan,
At 2024-04-16T19:32:18+0200, Jan Eden wrote:
> after using LaTeX (pdflatex) for several years, I am testing groff
> (with mom and mm) to create PDF documents for the first time.
>
> With mom, the process is straightforward: A PDF outline is created
> automatically, the TOC entries are linked to the headings, and
> additional PDF links can be created according to the docs[1].
Yup. mom(7) has had first-class PDF support for several years.
> It is a bit trickier with mm. I was able to create a PDF outline using
> a tip by T. Kurt Bond[2], and a link using the .pdfhref macro – but
> only with the native gropdf (groff -Tpdf), which creates really large
> files (> 500k).
The large size may be due to the lack of font subsetting in groff 1.23.0
and earlier. But I have good news for you; in groff Git, gropdf has,
and in the forthcoming 1.24 release we expect, precisely this feature.
> The output of pdfmom, on the other hand, can be piped
> to ps2pdf without losing the PDF outline or links (output size: ~
> 80k).
>
> Is it possible to
>
> - create small PDF files (via pdfroff or groff | ps2pdf) while keeping
> PDF outline/links using the mm package?
I think Deri James's recent changes to gropdf will indeed reduce the
size of PDF files, but outlining and linking will require some work,
either within the package or via supplementary user-authored macros.
The latter is not necessarily difficult. For an example, see the
following extension to ms(7).
https://github.com/g-branden-robinson/retypesetting-mathematics/blob/master/g.mac
Since Kernighan & Cherry had presciently defined an `SC` macro, local to
the document, to manage section headings for them, it was shockingly
easy for me declare a PDF bookmark within it.
One line: that's how straightforward it was to add a PDF outline to a
1970s document.
> - create links from the TOC to the document headings/sections
> automatically using mm?
I don't think this is possible with no macro effort from a document
author at present since the mm(7) package has no notion of internal
hyperlinking features or PDF.
However, having just added these to man(7) and mdoc(7), I have an idea
how to do so for ms(7), me(7), and mm(7), and once that is done, we'll
have hyperlink/navigation parity among all of groff's full-service macro
packages.
Regards,
Branden
signature.asc
Description: PGP signature