groff
[Top][All Lists]
Advanced

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

Re: Putting hyperlinks in a PDF document


From: G. Branden Robinson
Subject: Re: Putting hyperlinks in a PDF document
Date: Tue, 15 Nov 2022 21:03:02 -0600

Hi Deri,

At 2022-11-15T23:20:49+0000, Deri wrote:
> On Tuesday, 15 November 2022 19:21:05 GMT G. Branden Robinson wrote:
> > At 2022-11-15T18:35:35+0000, Deri wrote:
> > > Incidentally using \X'papersize ..." you can mix portrait and
> > > landscape in the same document.
> > 
> > It's a shame that gropdf(1) is the only output driver that recognizes
> > this device control command.  Like hyperlinks, it's a feature that seems
> > to want increased standardization, at least within groff.
> > 
> > Regards,
> > Branden
> 
> The man grodvi page defines \X'papersize:..." so gropdf is not unique.

It's not the same syntax (the colon should NOT be used), the argument
order is different (width, length instead of length, width), and there
is no _specific_ support for this; the contents of the \X escape are
simply blasted to the output DVI file as a special.  No interpretation
or parsing is done.

Here's what grodvi(1) says about the feature in groff Git HEAD.

    By design, the DVI format doesn’t care about the physical dimensions
    of the output medium.  Instead, grodvi emits the equivalent to TeX’s
    \special{papersize=width,length} on the first page; dvips (or
    another DVI driver) then sets the page size accordingly.  If either
    the page width or length is not positive, no papersize special is
    output.

    A device control escape sequence \X'anything' is translated to the
    same DVI file instructions as would be produced by
    \special{anything} in TeX; anything cannot contain a newline.

An experiment is revealing.

$ printf '\\X@supercalifragilisticexpialodocious@' | groff -Tdvi | strings
papersize=8.268in,11.693in
"supercalifragilisticexpialodocious
color gray 0

Try this nonsense with grotty and it will tell you it's ignoring it.

$ printf '\\X@supercalifragilisticexpialodocious@' | groff -Tascii | strings
grotty:<standard input>:15: X command without 'tty:' tag ignored

grodvi's approach also complicates the interpretation of any device
control commands by the DVI driver, frustrating future enhancements.  I
propose:

1.  Migrate this feature to require a "dvi:" or "dvi: special" tag at
    the beginning of the device control command, in alignment with most
    other groff output drivers.
2.  When implementing a groff-generic 'papersize' device control command
    as gropdf(1) recognizes it, translate it into a DVI special as is
    currently done, not forgetting to swap the argument order.

This doesn't seem to have ever bothered anyone so I reckon it's not
groff 1.23-critical.

What do you think?

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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