groff
[Top][All Lists]
Advanced

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

Re: weird behaviour of .sp| with expression


From: Peter Schaffter
Subject: Re: weird behaviour of .sp| with expression
Date: Thu, 11 Nov 2021 12:14:56 -0500
User-agent: Mutt/1.9.4 (2018-02-28)

On Thu, Nov 11, 2021, Ulrich Lauther wrote:
> look at this code:
> 
>       .nr t1 5c
>       .nr t2 5c
>       .nr foo1 \n[t1]u+\n[t2]u
>       foo1 \n[foo1]
>       
>       .nr foo2 (\n[t1]+\n[t2])u
>       foo2 \n[foo2]
>       .sp |10c
>       10 c
>       .sp |\n[t1]u+\n[t2]u
>                     no braket
>       .sp |(\n[t1]+\n[t2])u
>       with braket
> 
> It prints
>       foo1 283464
> 
>       foo2 283464
> 
> so both esxpressions are evaluted to the same result.
> 
> Then it prints "10c  no bracket" on one line somewhere in the middle of my 
> page.
> But "with bracket" is printed o few lines below.
> 
> How come?

The default scaling indicator (unit of measure) for .sp is 'v'.  It
applies to every numeric argument passed to .sp, including those
that are part of an expression, regardless of whether the expression
is in parentheses.  The .sp before "with bracket" is thus evaluated as

  (\n[t1]v+\n[t2]v)

The 'u' after the right parens is discarded.  Personally, I find
this counter-intuitive.  I've been tripped up by it more times
than I can count,

-- 
Peter Schaffter
https://www.schaffter.ca



reply via email to

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