groff
[Top][All Lists]
Advanced

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

RE: [Groff] Line-drawing escape


From: Ted Harding
Subject: RE: [Groff] Line-drawing escape
Date: Tue, 28 Nov 2006 17:15:45 -0000 (GMT)

On 28-Nov-06 Miklos Somogyi wrote:
> Folks,
> 
> I used this macro for inserting dots between left- and right aligned 
> test, a la   text1 .....  text2:
> 
> .de iD
> \\$1  \\kx\\l'(\\n(.lu-\\nxu-\w'\\$2  'u).'  \\$2
> ..
> 
> It worked in troff, it works in groff.
> 
> I had an "insert space" version of this (replacing `.' with a space).
> It worked in troff, but groff complains that `normal or special 
> character expected (got a space)'.
> \0 is a special character but no good either (got a node).
> 
> Is this a bug or a well-considered feature?
> Is there a way to save this structure?
> 
> Well, I can always print text1 left-aligned and text2 right aligned, 
> but still ...
> 
> Thank you,
> 
> Miklos

I agree that this is puzzling!

I suspect (but am not sure) that the confusion arises because
of ambiguity about the meaning of "special character" in groff.

If you look at 'man 7 groff' (the "short reference for the GNU
roff language"), and look for instances of "special", you will
first encounter

-- the special non-spacing character \&
-- "There is a small set of characters that have a special
    controlling task in certain conditions."
-- "a dot is only special at the beginning of a line ...
    ... making the dot "." a non-special character."
-- "The escaped double quote \" introduces a comment.
    Otherwise, it is not special."

and so on -- in other words, there is a class of input characters
which are "special" in the sense of having a control function.

This includes \&, \  (i.e. "\" followed by SPACE), \0, \% etc.

But now go further down 'man 7 groff', searching for "special",
and you will find:

\(sc   "The special character with 2-character name sc,
        see section Special Characters."


And so:

Special Characters
  Common special characters are predefined by escape sequences
  of the form \(xy with characters x and y. Some of these exist
  in the usual font while most of them are only available in the
  special font. Below you'll find a selection of the most
  important glyphs; a complete list can be found in groff_char(7).

              \(bu   Bullet sign
              \(co   Copyright
              \(ct   Cent
              \(dd   Double dagger
              \(de   Degree
              \(dg   Dagger
              \(rs   Printable double quote
              \(em   Em-dash
              \(hy   Hyphen
              \(rg   Registered sign
              \(rs   Printable backslash character
              \(sc   Section sign
              \(ul   Underline character
              \(==   Identical
              \(>=   Larger or equal
              \(<=   Less or equal
              \(!=   Not equal
              \(->   Right arrow
              \(<-   Left arrow
              \(+-   Plus-minus sign

and these too are "special characters". What I think is meant
by the error message is that you either need an ordinary character
(like "a") or a special character (like the ones listed immediately
above). And indeed you will find that you ".iD" macro works fine
if you use any of these.

However, it seems (from my experiments) that you can also use
a "special" of the other kind, like "\&" or "\ " or "\0", if
you define it in your macro using ".char". For instance:

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

(However, ".tr @\0", for instance, will not work, since this
makes the substitution on input).

And, of course, the "real" special characters (such as "\(dd"),
work literally:

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

Hoping this helps (but still remaining slightly uncertain),
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 094 0861
Date: 28-Nov-06                                       Time: 17:15:41
------------------------------ XFMail ------------------------------




reply via email to

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