groff
[Top][All Lists]
Advanced

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

Re: [Groff] Line fragments with .TS and .PSPIC


From: Ted Harding
Subject: Re: [Groff] Line fragments with .TS and .PSPIC
Date: Wed, 24 Aug 2005 14:40:32 +0100 (BST)

On 23-Aug-05 Bernd Warken wrote:
> 
> 
> Jon Snader <address@hidden> schrieb am 23.08.05 23:40:11:
>> 
>> Perhaps a different macro, or a new argument to .TS to invoke the
>> behavior is what we want.
>  
> That's a good idea.
> 
> Bernd Warken

I would agree (with the "new argument" idea), though whether it
should be in the "official" ".TS" and ".TE" may be open to debate.

I've had such an arrangement for the 'pic' macros ".PS" and ".PE"
for a long time, but I have put these in my "private" macro set
(loaded after "-ms") so that they over-write the originals.

The background to this is that I find it very useful to use 'pic'
to perform in-line mathematical computations while the document is
being formatted -- 'pic' has a failry powerful numerical engine
built in to it -- so that for instance I can "copy thru" a file of
data through 'pic' commands to compute on it, set troff variables
(registers) with the results using gpic's "command" command, and
then insert these register contents into the document when required
(e.g. in tables).

But in order to do this one needs to encapsulate the 'pic' commands
between ".PS" and ".PE", otherwise nothing will happen, so I re-wrote
these so that ".PS T" with argument "T" (for "tacit") simply bypasses
the normal actions of ".PS" and ".PE" and there is no effect on the
printed page. I.e. ".PS T" and (following such an invocation) ".PE"
are in effect "no op" macros.

The details for this application are:

.de PS
.ie '\\$3'T' \{\
.ds pic*Table T
.\}
.el \{\
<the normal .PS stuff>
.\}
..

.de PE
.ie '\\*[pic*Table]'T' .rm pic*Table
.el \{\
<the normal .PE stuff>
.\}
..

[The reason for "\\$3" is that when 'pic' does its work it computes
a width and height for the graphic and replaces ".PS ..." with a line
".PS ht wid ..."; when there are no "graphic" commands the ht and wid
are both 0.]

A similar approach should work also with the ".TS" and ".TE" macros
to achieve the sort of effect being sought here.

Best wishes to all,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 24-Aug-05                                       Time: 14:40:25
------------------------------ XFMail ------------------------------




reply via email to

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