groff
[Top][All Lists]
Advanced

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

Fwd: [Groff] How to pass parameters to included ps


From: Miklos Somogyi
Subject: Fwd: [Groff] How to pass parameters to included ps
Date: Fri, 10 Mar 2006 23:30:21 +1100



Begin forwarded message:

From: Miklos Somogyi <address@hidden>
Date: 10 March 2006 9:56:05 PM
To: Werner LEMBERG <address@hidden>
Subject: Re: [Groff] How to pass parameters to included ps


On 24/02/2006, at 5:53 PM, Werner LEMBERG wrote:

How would I pass arbitrary ps parameters to an included ps routine?

E.g.

         .something 50 (hello) 100

You probably want something like this:

  .de END
  ..
  .
  .de something
  .  de something-aux END
  ps: exec \\$*
  .  END
  \Y[something-aux]
  ..
  .
  .something 50 (hello) 100


Thank you, thank you. I never used macros with endings other than `..', so I would have never guessed
this solution.
And yeah, you can use $1, $2, ... if you are in a macro. Fabulous.


It seems that not even man grops' example is working

         .nr x 5i
         ,de y
          ps: exec
          \nx u 0 rlineto stroke
         ..

It does -- in the example above you use `,' instead of `.' ...

Sorry about the `,'

Since this is the one and only example in `man grops' regarding PostScript, I can still see
some problems:

1) To the uninitiated groffer, like me, it suggests that the way to pass argument to PS is via number registers, which is clearly not the case (put `.nr x 1i' between the `y' macro and `\Yy').

2) `man' says that `u' will convert from groff units to the current system. Not so. It is defined as `/u {.001 mul} bind def' which is only ok if the PS insert does not change
    the scale. Mostly it does.

3) For the uninitiated groffer `man' perhaps should say that though PS has nothing to do with spaces in text, /Yy will generate one, so please take evasive action.

4) Grops wraps included PS in a dictionary, that's all. So, dear user, if you are doing more
     PostScripty things, supply your own save-restore, please.

Miklos



reply via email to

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