groff
[Top][All Lists]
Advanced

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

Re: [Groff] Unformatted diversion?


From: Werner LEMBERG
Subject: Re: [Groff] Unformatted diversion?
Date: Tue, 02 Dec 2008 20:08:48 +0100 (CET)

> Werner, at the bottom of the third page there is 3-liner PS.
> Currently I read them in from a file into a macro somehow without
> interpretation and dump it in the ps auxiliary of .end_under1
> routine where it is dumped.  It works well, but I don't like the
> idea of hundreds of such little snippets lying around outside the
> groff program.

Sorry for the late reply.  It's still not really clear what you want
to achieve.

> If I were to include such stuff (that includes references to just
> set number registers) then there are 2 questions: a) How to get this
> ps code to the right place without pre-evaluated.

Please give a (short) source code example which shows what you would
like to have.  Looking at your PDF, I think you want to use the power
of the .dei macro to bypass problems with .eo:

  .de end-macro
  ..
  .ds end-macro-name end-macro\"
  .
  .
  .de begin
  .  ds env-name \\$1\"
  .  ds end-name end\"
  .
  .  eo
  .
  .  dei env-name end-name
  .    eo
  ..
  .
  .
  .de end
  .  ami env-name end-macro-name
  .    ec
  .  end-macro
  .
  .  ec
  .
  .  if !'\\*[env-name]'\\$1' \
  .    ab environment `\\*[env-name]' ended with `\\$1'
  ..
  .
  .
  .
  .begin foo
  This is a \test with
  \n[umbers] and \*[strings].
  .end foo
  .
  .
  .nf
  .foo
  .fi

  This is a \test with
  \n[umbers] and \*[strings].


Result:

  This is a \test with
  \n[umbers] and \*[strings].

  This is a est with 0 and .


> b) At the top of page 2 are the .end_macro1 parameters. If possible,
> I would like to see .end_under1 clever enough to see that the 5th
> parameter is the name of a file to be read-in, or a macro/whatever
> that only needs to be dumped.

Well, this should be straightforward.  You can test whether a macro,
string, diversion, or request `foo' is defined with

  .if d foo

Otherwise, you can handle your fifth parameter as a file.


    Werner




reply via email to

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