[Top][All Lists]

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

Re: [Groff] What's valid in \X?

From: Ted Harding
Subject: Re: [Groff] What's valid in \X?
Date: Wed, 27 Oct 1999 21:55:27 +0100 (BST)

On 27-Oct-99 Larry Jones wrote:
> For a structured document, you probably want a bookmark for each
> numbered section heading.  I'm using the mm macros which even have very
> convenient hooks for doing this:
>       .de HY
>       \\X'ps: exec [ /Title (\\*(}0\\$3) /OUT pdfmark'\c
>       ..
> Unfortunately, \*(}0 (the section number) also contains the separating
> space so it's something like "1.2\ \ " and $3 (the section title) may
> well contains something like "The \&\fInew\fP features".  What groff
> does now is object to the nonbreaking space and the zero-width space
> and ignore them so I get three warnings and the output is:
>       [ /Title (1.2The new features) /OUT pdfmark
> whereas what I'd like is to get no warnings and:
>       [ /Title (1.2  The new features) /OUT pdfmark

This is a deep one. I think there are good reasons why troff escapes
like "\0" don't go through with "\X", to do with the way troff
communicates with the postprocessor (ditroff output format).
I will try to think of a good way to describe this, but not now!

Meanwhile, as far as the spacings are concerned I have a feeling the
following substitute for your Header Exit Macro above should do what you

  .de HY
  \\X'ps: exec [ /Title (\\*(}0  \\$3) /OUT pdfmark'\c

I.e., simply put two spaces (which will be PostScript spaces in the
current font therefore fixed width); you don't need "\ " etc for this.
For instance, a file containing:

  .P 1
  .H 1 "First Section
  This is the first section
  .de HY
  \\X'ps: exec [ /Title (\\*(}0  \\$3) /OUT pdfmark'\c
  .H 2 "Second Section
  And this is more text

produces what looks to me like acceptable output. Although you get
a couple of warnings " a node is illegal within \X",
one for \\^(}0 and one for \\$3, it doesn't seem to do any damage!

As to things like switching fonts within the header, this is much more
problematic. The purpose of "\X'ps: exec ...'" is to pass raw PS code
straight to the printer (i.e. immune from grops). If you know what
the next font would be called in normal PostScript then you can do
it; but beware that grops defines short font name for the fonts
it is going to need, so youwould neet to find out what these would be.
Not straightforward.

Troff itself knows nothing about PostScript (the only use it makes of the
"-Tps" option is to find out where to look for the font definition files;
it is grops which does all the rest, including downloading the PS
preamble and any font downloads). Therefore troff has no idea what to pass
transparently to the printer in order to implement something like "\fI".
Changing this situation would require a radical re-writing of troff, and
make it device-dependent. The output from troff itself bears no
resemblance to PostScript and has to be interpreted by grops. Therefore
the device-independent troff-output code which corresponds to
non-character information (such as positioning, movement, point size)
really has no place in "\X'ps:...'".

However, you have raised an interesting and important issue, and I will
try to give it some fruitful thought. I was not aware of the "pdfmark"
operator in PostScript -- it must be a recent level -- but clearly,
if groff is to keep up with the times and provide the sort of capability
that one can get with other programs then it should try to find
ways of doing it. As things seem to stand, coping with something like
"pdfmark" makes one face the issue that it is not always so easy to
separate the device from the program.

Perhaps an enhancement to grops which could deal with this internally
might be the answer. However, at this moment I can't comment on its

I hope the above is of some help.

E-Mail: (Ted Harding) <address@hidden>
Date: 27-Oct-99                                       Time: 21:55:27
------------------------------ XFMail ------------------------------

reply via email to

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