groff
[Top][All Lists]
Advanced

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

Re: [Groff] Question re: Appending to a diversion


From: Tadziu Hoffmann
Subject: Re: [Groff] Question re: Appending to a diversion
Date: Tue, 20 Dec 2005 14:50:47 +0100
User-agent: Mutt/1.5.6i

>   . If-else clauses look like this:
> 
>        .ie ... \{\
>        ...
>        .\}
>        .el \{\
>        .\}
> 
>     Note the trailing backslashes!  I think this was the reason of
>     not getting more than a single footnote.

No, the reason for not getting more than one footnote was an
interesting syntactic "feature": the expression for the value
of a number register in a ".nr" request must be given as a
single argument (without spaces) unless you use parentheses
to indicate that the expression isn't finished yet with the
first space character:

  .nr footnote_flag \\n[footnote_flag] +1   \" doesn't work
  .nr footnote_flag \\n[footnote_flag]+1    \" works
  .nr footnote_flag (\\n[footnote_flag] +1) \" works

This is because it is also possible to give a 3rd argument
to ".nr", to be used as an auto-increment value whenever
that number register is accessed.

Of course, like Werner already said, in the case of
incrementing or decrementing a number register, you
can use the simpler syntax:

  .nr footnote_flag +1    \" works

Regarding if and if-else clauses with multi-line grouping:

  .ie ... \{
  ...
  .\}
  .el \{
  ...
  .\}

without the backslashes is syntactically correct, but gives
you extra blank lines (from the "\{" lines).  This can be
avoided with (note the dot):

  .ie ... \{.\" comment
  ...
  .\}
  .el \{.\" another comment
  ...
  .\}

(there was a discussion regarding this a while back on this
list).


Regarding footnotes: Clarke, you might also want to
take a look at the "Tutorial Examples" at the end of
the "Troff User's Manual".






reply via email to

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