groff
[Top][All Lists]
Advanced

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

Re: [Groff] trying to understand .ad request


From: Werner LEMBERG
Subject: Re: [Groff] trying to understand .ad request
Date: Fri, 21 Sep 2012 06:32:44 +0200 (CEST)

> If you run the example given for the .ad request in the groff info
> manual:
> 
>    text
>    .ad r
>    .nr ad \n[.j]
>    text
>    .ad c
>    text
>    .na
>    text
>    .ad         \" back to centering
>    text
>    .ad \n[ad]  \" back to right justifying
> 
> you'll find it doesn't actually work, which seems to be because .ad
> does not produce a break.  Adding a .br after every one of the
> "text" lines makes it do what's advertised.

You are right, thanks for noticing.  I'll fix that.

> What I'm not understanding, though, is the behavior in a much simpler
> case:
> 
>    text
>    .br
>    .ad r
>    text
>    .br
>    .ad   \" should go back to the default....
>    but doesn't seem to
>    .br
> 
> The second .ad, made without an argument, should return groff to the
> mode it was in before the first .ad call; in the case, the default,
> 'b' mode.  Instead, the last line is output still in 'r' mode.

You've missed a paragraph in the documentation:

     With no argument, `gtroff' adjusts lines in the same way it did
     before adjusting was deactivated (with a call to `na', for
     example).

In other words, `.ad XXX' stores `XXX' in the \[.j] register, and
emitting `.ad' without argument is the same as `.ad \[.j]', simply
re-using the stored value in \[.j].  This is different to other
requests which kind-of `pop' values from a stack if no arguments are
present.


    Werner



reply via email to

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