groff
[Top][All Lists]
Advanced

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

Re: [Groff] conditionals


From: Werner LEMBERG
Subject: Re: [Groff] conditionals
Date: Tue, 01 Jun 2010 13:41:24 +0200 (CEST)

> However, I have recently written (as a learning exercise) a macro
> that automatically indented, nested, aligned, and numbered
> paragraphs.  The macro takes an optional single argument:
> 1
> a
> A
> i
> I
> 0
> <none>
> <anything else>
> Arguments 1, a, A, i, and I set the type of numbering; "0" finishes
> the then current sequence and backs out to the previous level;
> <nothing> takes a new paragraph and increments the current number;
> and <anything else (I use "b")> creates bullets.

This is rather easy to handle by using indirect macro calls.  Here an
outline of a solution:

.\" fill the macros with something useful
.de para-1
..
.de para-a
..
.de para-A
..
.de para-i
..
.de para-I
..
.de para-0
..
.de para-
..
.de para-b
..
.
.\" $1 selects the action of the macro
.de para
.  ie d para-\\$1 \
.    para-\\$1
.  el \
.    para-b
..


    Werner



reply via email to

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