groff
[Top][All Lists]
Advanced

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

Re: [Groff] Question on string registers and requests


From: Clarke Echols
Subject: Re: [Groff] Question on string registers and requests
Date: Fri, 21 Sep 2007 17:49:40 -0600
User-agent: Thunderbird 2.0.0.6 (Windows/20070728)

I stand corrected.

I put together a text file as follows.

The first excerpt incorrectly uses the defined string as a macro
call.

The second interpolates the string.

The only difference lies in how the "macro" is interpreted.  There
is no white space after "interpolating" the macro, and thus no
space at the end of the sentence.

If you put a \c (ignore newline) after the \*U in the second
code segment, you'd get the same result.

That aside, it makes little sense to define a string and execute
it as a macro in any cases I can recall encountering, unless you
want to confuse someone coming along later who wants to
interpret what you did.

Source file:
============
.ds U This is a string of stuff.  This is more of the same string.
.sp 2i
This is the start of some text.
.U
This is some more text.

This is the start of some text.
\*U
This is some more text.
==========
Output from nroff:

This is the start of some text.  This is a string of stuff.  This
is more of the same string.This is some more text.

This is the start of some text.  This is a string of stuff.  This
is more of the same string.  This is some more text.

==========

Clarke

Clarke Echols wrote:
Doesn't work that way.

If you use:

.de U
.\" troff/groff requests and other stuff here
..

to define macro U, then use

.ds U \\s-1UNIX\\s0

to define a string named U, the namespace conflict causes macro U
to be overwritten by the defined string.

Executing

.U

does nothing because macro U was never defined by a .de statement.
You can interpolate the string using \*U, but that is the only way
to get the string contents back from the definition.

andlabs wrote:
Hello. I noticed, that given

.ds U \\s-2UNIX\\s0

in a troff file after -ms, and neither -ms nor that file define a macro .U,
I could do

.U

and it would be replaced with the contents of that string. Is that a feature
of groff? I'd like to clear things up. Thanks.







reply via email to

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