groff
[Top][All Lists]
Advanced

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

Re: [Groff] Line-drawing escape


From: Miklos Somogyi
Subject: Re: [Groff] Line-drawing escape
Date: Thu, 30 Nov 2006 00:30:23 +1100

Ted,

What a scholarly expose!  This should be part of the manual.
I've introduced .rchar and things are working nicely.
Thank you very much,

Miklos


On 29/11/2006, at 9:40 PM, (Ted Harding) wrote:

On 29-Nov-06 Miklos Somogyi wrote:
Ted,

Your solution and Tadziu's are rather similar and both are working
well:

.de iS
.char @ \0
\\$1  \\kx\\l'(\\n(.lu-\\nxu-\w'\\$2  'u)@'  \\$2
.char @
..

.de iS
.tr ~
\\$1  \\kx\\l'(\\n(.lu-\\nxu-\w'\\$2  'u)~'  \\$2
.tr ~~
..

I hope that `char @' ends watching for @, and `tr ~~' ends watching for
~.
Gentlemen, thank you both.

Miklos

Apologies, Miklos! I should have added ".rchar @":

  .de iS
  .char @ \0
  \\$1  \\kx\\l'(\\n(.lu-\\nxu-\w'\\$2  'u)@'  \\$2
  .rchar @
  ..

The interpretation is that ".char xxx yyy" defines a character
(with metrics) whose name is "xxx" (in this case "@"), according
to the groff text "yyy" (in this case a simple "\0"). If "xxx"
is already the name of a character (as "@" is) then this is replaced.

Then ".rchar xxx" removes that definition of "xxx" and (in general)
the name "xxx" disappears. However, if "xxx" (e.g. "@") is a
name which occurs in a font file, then groff will find it there
(you cannot remove "@" altogether since it is a name in a fint
file).

Hence after

  .rchar @

you again have the normal interpretation of "@".

Unfortunately, the use of ".char" does not "stack", so you can
only redefine a name once (it is like the use of "\fB ... \fP" in
this respect.

If (for instance) you did

  .char @ \0
     ....
  .char @ \(dd
     ....
  .rchar @
  .rchar @

then the first ".rchar" would restore the name "@" to mean the
usual @ (i.e. it would drop back to @), and the second would
do nothing (since you cannot remove the name of a "normal" character,
i.e. named in a font).

For example:


.char @ \0
.sp
address@hidden@address@hidden
.char @ \(dd
.sp
address@hidden@address@hidden
.rchar @
.sp
address@hidden@address@hidden
.rchar @
.sp
address@hidden@address@hidden


and compare this with:


.char \[xy] \0
.sp
This\[xy]is\[xy]some\[xy]text
.char \[xy] \(dd
.sp
This\[xy]is\[xy]some\[xy]text
.rchar \[xy]
.sp
This\[xy]is\[xy]some\[xy]text
.rchar \[xy]
.sp
This\[xy]is\[xy]some\[xy]text


In the first case you have assigned "\0" to the name "@",
and then assigned "\(dd" to the name "@", and then you
have removed the name "@" with the first ".rchar". But
the name "@" already exists in the standard fonts, so it
can be found again once you have removed it.

In the second case, you have assigned "\0" to the name "\[xy]"
which does not exist anywhere else, and then assigned "\(dd"
to the name "[xy]", and then you remove the name "\[xy]"
and it vanishes forever.

To come back to your own example above (using .char @), consider:

.de iS
.char @ \0
\\$1  \\kx\\l'(\\n(.lu-\\nxu-\w'\\$2  'u)@'  \\$2
.char @
..
.sp
.iS Text1 Text2
.sp
address@hidden address@hidden

and you will see that ".char @" has not restored the normal "@"
nut has given the name "@" yet another meaning! The "true way"
is to use ".rchar"

Hoping this helps, and apologies for my earlier omission.

Best wishes,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 29-Nov-06                                       Time: 10:39:58
------------------------------ XFMail ------------------------------






reply via email to

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