groff
[Top][All Lists]
Advanced

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

Re: [Groff] Unformatted diversion?


From: Miklos Somogyi
Subject: Re: [Groff] Unformatted diversion?
Date: Sat, 13 Dec 2008 13:14:16 +1100


Werner,

Thank you for this little beauty. I've tried to understand it, but it obviously needs more knowledge than I have. Nevertheless I built it into my routines and lo and behold, nobody spoiled my registers. I had one little problem: .eo and .ec were copied into the PS file literally, that the interpreter
did not like. When I deleted them, the PS file printed like charm.

So I deleted .eo and .ec references from your routines and prepended every backslash in my little inserts with another one. This works and, since these inserts are only a few lines long, prepending
is no trouble.

I had a bit of a problem with the mixing of internal/external stuff, 'cause \\*[inc_file] in the auxiliary (PS) part could not be put behind an "if ...", but in case of internal (macro) insert I re-named the macro
inc_file, then \\*[inc_file] could handle both cases.

Thank you very much again. Now I believe that you can walk on water, that is you are in the ninth order of the
ninefold celestial hierarchy :-)

Miklos

On 03/12/2008, at 06:08 AM, Werner LEMBERG wrote:


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]