[Top][All Lists]

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

RE: [Groff] is it possible to PSPIC in 3 part titles?

From: Ted Harding
Subject: RE: [Groff] is it possible to PSPIC in 3 part titles?
Date: Thu, 17 Jun 2004 07:52:12 +0100 (BST)

On 17-Jun-04 Daniel Senderowicz wrote:
>>.ds RH \Z'\h'-2i'\v'0.4i'\X'ps: import 0 0 288 108 144000''
> Thanks Peter and Ted. Using Ted's sugestion with -me was
> straightforward.
> I assume that trying to do the same thing with a macro call instead
> of a string would be a bit more complicated, such as including a
> gremlin or pic file.

I think it would be more complicated. Taking 'pic' as example (I'm not
really familiar with gremlin), the encapsulating ".PS" and ".PE"
serve two purposes. One is to identify to the 'pic' pre-processor
the 'pic' code in the document. The other is to invoke the ".PS" and
".PE" macros in whatever macro set you're using, which have the task
of placing and spacing the graphic. It's the latter that may get under
your feet when you try to place such a graphic in the top RH corner
of each page.

You can get round the worst aspects of the latter by redefining
".PS" and ".PE", using perhaps a special argument to ".PS" to
identify the context. E.g.

.PS LOGO ...

where ".PS" would test for argument 'LOGO' and do something special.
(I have something similar when I want to use 'pic' purely to do
numerical computation in-line: ".PS T ... .PE", "T" for "tacit",
produces no visible effect).

On the lines of Peter Schaffter's suggestion, placing the whole chunk
of ".PS ... .PE" in a diversion might work, though I'd expect it to
require some effort to get it working as wanted.

I'm inclined to think that your best bet for this would be to create
the graphic, using pic or gremlin, separately, and save it as an EPS
file; then import it where wanted with \X'ps: import ... ': myself,
I like to have the direct control which this gives.

> I have one more question, is there any register that stores the
> total number of pages in a document?

Well, there's the value of \n[PN] on the last page! Until troff
gets there, it doesn't know how many pages there are. There's a
little-known request ".em" which allows you to define a macro to
be executed after all input has ended:

.em finis

will cause macro "finis" to be executed at the end of the document.

If you need to know, earlier in the document, how many pages there
are )e.g. for a footer "Page n of N", then I think your only hope
is to have this saved in a file which you source at the start of the
document. E.g. the file "total_pages" might contain

.nr pages 45

where the line ".nr pages 45" was written to the file by the "finis"
macro on a previous pass, getting the "45" from \n[PN]. Of course,
in this yau also have to watch out if you start a new page-numbering
sequence (e.g. .bp 1 after 10 pages of front matter etc.); but then
you could also start a new register

.nr sheet 1 1

at the beginning of the document, and re-write whatever macro is
called at the bottom of each page to include a command to increment

Best wishes,

E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 17-Jun-04                                       Time: 07:52:12
------------------------------ XFMail ------------------------------

reply via email to

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