> I am intrigued by this behaviour, by the way. I consider it to be > a close approximation to a bug! I have looked into the classic > documentation of UNIX troff, and I have not found any warnings > about this. > > These days, I do not have access to a UNIX (non-groff) troff, > so cannot test it. So, for anyone with access to UNIX troff, > or to Heirloom troff, what is the behaviour on these?
nroff on DEC OSF1 does the same. I don't have the sources but I guess this is pretty much "Unix nroff" since the names of the source files found in the binary follow closely those of plan9 troff. Without looking at the sources I can't tell how it's actually done, but my impression is that all processing actually takes place as text, so when you say .nr Y \nX the internal representation of the number in register X is not simply copied to Y, but instead the \nX is first converted to its textual representation, and then the line is again interpreted and the textual representation is converted back to the internal representation of the number. Perhaps inefficient, but predictable. And this is also why .nr X 9 .af X i .nr Y \nX doesn't work.