groff
[Top][All Lists]
Advanced

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

Re: [Groff] Using variables from register within fractions or equations


From: Ralph Corderoy
Subject: Re: [Groff] Using variables from register within fractions or equations
Date: Fri, 17 Feb 2012 14:09:08 +0000

Hi maouinin,

I'll have a stab...

> > if \\nm=1 .X \\$@
> 
> I follow the front, but what is address@hidden

From

    .de Q
    .if \\nm=1 .X \\$@
    .if \\nm=2 .Y \\$@
    .if \\nm=3 .Y \\$@
    ..

$@ refers to all the arguments passed to the macro, similar to $@ and $*
in sh.  IOW, macro Q is calling either macro X or Y with all the
arguments it was passed.  From groff's info page,

    $ info groff 2>/dev/null |
    > sed '/-- Escape: \\\$\*/p; 1,//d; /^$/Q'
     -- Escape: \$*
     -- Escape: \$@
         In some cases it is convenient to use all of the arguments at once
         (for example, to pass the arguments along to another macro).  The
         `\$*' escape concatenates all the arguments separated by spaces.
         A similar escape is `\$@', which concatenates all the arguments
         with each surrounded by double quotes, and separated by spaces.
         If not in compatibility mode, the input level of double quotes is
         preserved (see *note Request and Macro Arguments::).
    $ 

> the following also loses me:
> 
> > \h'\\nwu'\v'1m'\\*n\v'-1m'\h'\\nwu'\\$2
> 
> what exactly  is \\nwu?

\nw is the value of the w number register.  The trailing u is stating
what units that number, e.g. 42, is in to \h for the horizontal
movement.  If it was \nwi then it would be 42 inches instead.  See

    info groff 2>/dev/null | less +'/^[0-9.]* Measurements$'

In both cases, backslashes are doubled to delay interpretation to when
the macro is run, not defined.

Cheers, Ralph.



reply via email to

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