groff
[Top][All Lists]
Advanced

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

Re: [Groff] a .text macro


From: Bernd Warken
Subject: Re: [Groff] a .text macro
Date: Tue, 11 Dec 2001 01:34:25 +0100
User-agent: Mutt/1.2.5i

On Mon, Dec 10, 2001 at 09:49:18PM -0000, Ted Harding wrote:
> 
> Sorry, I don't understand why either of these behaviours
> is needed.
> 
> 1. ".text The .text macro prints an ellipsis
>     .text ..."
> 
> If you want to print something, why not just print it?
> What's the point of prefacing it with ".text"?
> 
> 2. ".nop But .nop does not print an ellipsis
>     .nop ..."
> 
For example in groff(7), I define a large set of local macros.  It is
very handy to have indentation available within the macro definitions.
But a text line cannot be indented because the leading space is printed
as additional space.  Text lines in macro definitions should be avoided
anyway due to subtle problems.

The effect of .nop (which is defined as .if 1) is to add syntactical
sugar and just handle the arguments as if given without it.
When a text line is fed into .nop the text is just output, but if the
first argument starts with a dot or accent the arguments are interpreted
as a macro call.

To define a macro that allways outputs its arguments as text another
syntactical sugar must be added.  In the .text macro this is the 
additional `\{\}' argument.

Such a .text macro is not overkill, but is absolutely necessary in
dynamic macro programming.

> Why is it needed that ".nop" should print anything?
> 
I do not want to raise another discussion on this subject.  If you can
esteem .nop's value use it, otherwise leave it.

> I'm introducing personal preference and practice here,
> but my view of ".nop" is that it should literally do
> nothing (like the "nop" op-code for a CPU, for example).
> There is an internal macro "@nop" in tmac.s, for example,
> to which unimplemented macros are aliased when encountered.
> 
> In my case, I define
> 
>   .de nop
>   ..
> 
Then you are a heretic ;-).  groff uses a different definition of .nop.


Now my question again, is it syntactically clean to have

.if 1 \{\}some text

output `some text' whatever it might be, including leading dots.
It works in groff, but is it ok, or does it create incompatibilities?

Bernd Warken


reply via email to

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