groff
[Top][All Lists]
Advanced

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

Re: [Groff] Beginner Groff issue: number registers inside macros


From: Anton Shepelev
Subject: Re: [Groff] Beginner Groff issue: number registers inside macros
Date: Wed, 27 Jun 2012 20:05:39 +0400

Zoe Blade:

> I'm  learning a bit of Groff syntax, and I seem to
> be having trouble getting Groff to remember number
> registers from inside macros.  Here's some example
> code I'm trying out:
>
>               [...]
>               .de D
>               .if (\n[bar] == 1) .sp
>               .nr bar 1
>               ..
>               [...]
>
> I'd expect both pages to consist of  two  separate
> paragraphs,  but  for  the second one, they're all
> bunched up together as if the "\n[bar] == 1"  con-
> dition is never met.

Inside a macro, you should say:

              .if (\\n[bar] == 1) .sp

because  with a single slash, the register is evalu-
ated at the moment of macro  definition  instead  of
use.   With  a  double  slash,  the first evaluation
leads to \n[bar], which  is  later  evaluated  again
when you actually use the macro.  See also:

             http://tinyurl.com/6w5lfuh

-- 
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments



reply via email to

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