[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] \n[rst] and \n[rsb] inside a string
From: |
Ted Harding |
Subject: |
Re: [Groff] \n[rst] and \n[rsb] inside a string |
Date: |
Tue, 02 Oct 2012 15:57:21 +0100 (BST) |
Sorry to be sending this out late. Composed in Friday, just as my
internet connection was about to go down big time. Finally up&running
today, Tuesday.]
On 28-Sep-2012 21:21:05 Dave Kemper wrote:
> Hi,
>
> I'm having trouble understanding why the values of \n[rst] and \n[rsb],
> when used inside a string after a \w, are different depending on where
> the string is called from.
>
> In the first case below, I call the string \*[direct] directly, and the
> values are as expected.
>
> In the second case, I wrap the call to the string inside macro .indirect,
> and the values are 0, although the width is reported correctly.
>
> If I add another call to \*[direct] at the bottom of the file, below
> the call to .indirect, this call again displays the correct values for
> \n[rst] and \n[rsb].
>
> Thanks for any advice.
.ds direct \
Howdy: \w'Howdy', rst = \\n[rst], rsb = \\n[rsb]
.
.de indirect
\*[direct]
..
.
\*[direct]
.br
.
.indirect
Ths point is that your definition of .indirect, because it uses
"\*[direct]", evaluates \*[direct] as it finds it at the time of
reading the definition of .indirect. Since \*[direct] has not yet
been issued as a command (at that stage it is merely a definition),
\n[rst] and \n[rsb] might be anything. When you want to call
.indirect, it is the results of this first evaluation which will
be in the definition of .indirect.
If you re-write .indirect as:
.de indirect
\\*[direct]
..
you should find that it does the right thing, since now, when called,
.indirect re-reads \*[direct] and evaluates \n[rst] and \n[rsb]
at their ambient values.
Hoping this helps,
Ted.
-------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Date: 28-Sep-2012 Time: 22:52:59
This message was sent by XFMail
-------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Groff] \n[rst] and \n[rsb] inside a string,
Ted Harding <=