groff-commit
[Top][All Lists]
Advanced

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

[groff] 32/35: [docs]: Update negative reg assignment discussion.


From: G. Branden Robinson
Subject: [groff] 32/35: [docs]: Update negative reg assignment discussion.
Date: Mon, 25 Oct 2021 03:32:43 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit e681ceb4870de9b6348f0773a6b2eb070f21afc4
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Oct 25 12:27:17 2021 +1100

    [docs]: Update negative reg assignment discussion.
    
    * Condense examples.
    * Parallelize groff(7) with our Texinfo manual better in this area.
---
 doc/groff.texi  | 26 ++++++++++----------------
 man/groff.7.man | 13 ++++++++++---
 2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/doc/groff.texi b/doc/groff.texi
index 7f428c2..f7f4619 100644
--- a/doc/groff.texi
+++ b/doc/groff.texi
@@ -6558,8 +6558,12 @@ Increment (decrement) register @var{ident} by 
@var{value}.
 @endExample
 
 @cindex negating register values
-To assign the negated value of a register to another register, some care
-must be taken to get the desired result:
+A leading minus sign in @var{value} is always interpreted as a
+decrementation operator, not an algebraic sign.  To assign a register a
+negative value or the negated value of another register, you can use
+either of two techniques to to force GNU @code{troff} to interpret the
+assigned value as a numeric expression: enclose it in parentheses or
+subtract it from zero.
 
 @Example
 .nr a 7
@@ -6570,23 +6574,13 @@ must be taken to get the desired result:
 .nr a (-\nb)
 \na
     @result{} -3
-@endExample
-
-@noindent
-The surrounding parentheses prevent the interpretation of the minus sign
-as a decrementing operator.  An alternative is to start the assignment
-with a @samp{0}:
-
-@Example
-.nr a 7
-.nr b -3
-.nr a \nb
-\na
-    @result{} 4
-.nr a 0\nb
+.nr a 0-\nb
 \na
     @result{} -3
 @endExample
+
+If a register's prior value does not exist (the register was undefined),
+an increment or decrement is applied as if to@tie{}0.
 @endDefreq
 
 @Defreq {rr, ident}
diff --git a/man/groff.7.man b/man/groff.7.man
index cd2138a..87f6132 100644
--- a/man/groff.7.man
+++ b/man/groff.7.man
@@ -1248,10 +1248,17 @@ Without a sign,
 .I N
 replaces any existing value.
 .
-To assign a negative number,
-either prefix the expression with a zero or enclose it with parentheses.
+A leading minus sign
+.RI in\~ N
+is always interpreted as a decrementation operator,
+not an algebraic sign.
 .
-If a prior value does not exist,
+To assign a register a negative value or the negated value of another
+register,
+enclose the assigned expression in parentheses or subtract it from zero.
+.
+If a prior value does not exist
+(the register was undefined),
 an increment or decrement is applied as if to\~0.
 .
 .



reply via email to

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