[net.unix-wizards] NROFF Question

chasma (03/08/83)

Recently, I tried using the .rd control in an nroff source file
and got some unexpected results: it seems to work as described
in the manual, *except* that the text typed from the terminal
for insertion to the document is not echoed on the terminal.
I believe this is the first time anyone at this installation
has tried to use .rd and am wondering if this is a problem
with nroff in general, or a bug in our installation. Any help/
comments/sympathy/etc will be appreciated.


-Charles Marsh
(decvax!ittvax!ittapp!chasma)

jrc@rlgvax.UUCP (Jim Chapell) (07/24/85)

Re: nroff, how come
.sp 4/2+1

spaces 1 line whereas
.nr s 4/2+1
.sp \ns



spaces 3 lines?

Or is this a local bug?
-- 
                

     Jim Chappell
     CCI, Reston, Va

{seismo | allegra | ihap4} !rlgvax!jrc

     703-648-3319

jaap@mcvax.UUCP (Jaap Akkerhuis) (07/30/85)

In article <707@rlgvax.UUCP> jrc@rlgvax.UUCP (Jim Chapell) writes:
 > 
 > Re: nroff, how come
 > .sp 4/2+1
 > 
 > spaces 1 line whereas
 > .nr s 4/2+1
 > .sp \ns
 > 
 > spaces 3 lines?
 > 

The answer is of course in the Nroff/Troff reference manual (Page 9,
alinea 1.4 \fINumerical expressions\fP).
"In the present of default scaling, ..." etc.

The commands
	.nr s 4/2+1
	.sp \ns
should be read as:
	.sp (4u/2u+1u)*1v
giving a spacing of 3 lines (default scaling is `v'),
while
	.sp 4/2+1
specifies a spacing of 42 units, rounded to 40 units (==\n(.v)
as shown by
	.nr a 4v/2v+1v
	.nr b \na/\n(.v
	.ie \nb>1 .tm \na  units rounded to \nb lines of spacing
	.el .tm \na units rounded to a single line of spacing
	.ab "End of demonstration"

kolstad@convex.UUCP (08/02/85)

you asked:

why does 
		.sp 4/2+1
not do the same as
		.sp 3
(in essence, anyway)

The answer is:

nroff (and troff) are always trying to be helpful and give you default
units for things.  When you say ".sp 1" then nroff (and troff, too)
say:  ``well, he doesn't want to space 1 UNIT (maybe 1/432" or 1/300")
he really wants to space 1 LINE (a VERTICAL UNIT -- 1v)''.  Now, this
is all well and good for things like ".sp 1+1" which translates to
".sp 1v+1v".  The trick comes when you do something like ".sp 4/2+1"
which good old nroff (and troff, too) changes to:

	.sp 4v/2v+1v

which is of course:

	.sp 2u+1v

which is a single space (or close enough)...

The solution to your problem is to remember two things:

(a) nroff & troff's only goal in life is to screw you
(b) when in doubt, ALWAYS SPECIFY UNITS.

The following seems to work just fine:

	.sp 4v/2u+1v

which is probably what you wanted anyway.

				Your friend in text processing,

					Rob Kolstad
					CONVEX Computers
					214-952-0351