groff
[Top][All Lists]
Advanced

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

Re: [Groff] An observation on .writem


From: Werner LEMBERG
Subject: Re: [Groff] An observation on .writem
Date: Sat, 01 Sep 2001 19:19:50 +0200 (CEST)

> ... it shows one thing I never understood, that there is a
> difference between a macro, and content which is "diverted to a
> macro".  The two are only syntactically similar.  I'll have another
> go with my education.

The difference between a macro and diversion is how the data is
stored.  Input to a macro is stored as input tokens, while input to a
diversion is stored as nodes (i.e., glyphs, formatting information,
etc.).  groff handles strings, macros, and diversions with basically
the same structures, containing two lists for tokens and nodes.
Requests like .asciify and .unformat are able to convert nodes back to
tokens if possible.

A side effect of this common structure is that it is possible to save
nodes (i.e. formatted data) in strings, giving weird results
sometimes.  For example, 

  .ll 5i
  .di xx
  nice test\p
  .br
  .di
  .
  .ds yy \*(xx

  .xx

  This is a \*(yy.

produces

  nice                                          test

  This             is             a             nice
  test.

After ending the diversion xx, the space between the two words is no
longer stretchable (but discardable at the end of line).


    Werner

reply via email to

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