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