[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] [Groff & Heirloom] tbl problem with backslashes
From: |
Ralph Corderoy |
Subject: |
Re: [Groff] [Groff & Heirloom] tbl problem with backslashes |
Date: |
Mon, 01 Sep 2014 14:52:11 +0100 |
Hi,
Ted wrote:
> WHile not quite sure about the details of the logic underlying the
> effect you describe
It's quite involved, as I recall. This bit of groff's manual seems
relevant.
$ info groff 2>/dev/null | sed -n '/-- Escape: \\\\/,/=> 1/p' | cat -s
-- Escape: \\
-- Escape: \e
-- Escape: \E
Print the current escape character (which is the backslash
character `\' by default).
`\\' is a `delayed' backslash; more precisely, it is the default
escape character followed by a backslash, which no longer has
special meaning due to the leading escape character. It is _not_
an escape sequence in the usual sense! In any unknown escape
sequence `\X' the escape character is ignored and X is printed.
But if X is equal to the current escape character, no warning is
emitted.
As a consequence, only at top-level or in a diversion a backslash
glyph is printed; in copy-in mode, it expands to a single
backslash which then combines with the following character to an
escape sequence.
The `\E' escape differs from `\e' by printing an escape character
that is not interpreted in copy mode. Use this to define strings
with escapes that work when used in copy mode (for example, as a
macro argument). The following example defines strings to begin
and end a superscript:
.ds { \v'-.3m'\s'\En[.s]*60/100'
.ds } \s0\v'.3m'
Another example to demonstrate the differences between the various
escape sequences, using a strange escape character, `-'.
.ec -
.de xxx
--A'123'
..
.xxx
=> -A'foo'
The result is surprising for most users, expecting `1' since `foo'
is a valid identifier. What has happened? As mentioned above,
the leading escape character makes the following character
ordinary. Written with the default escape character the sequence
`--' becomes `\-' - this is the minus sign.
If the escape character followed by itself is a valid escape
sequence, only `\E' yields the expected result:
.ec -
.de xxx
-EA'123'
..
.xxx
=> 1
$
Cheers, Ralph.
- [Groff] [Groff & Heirloom] tbl problem with backslashes, Blake McBride, 2014/09/01
- Re: [Groff] [Groff & Heirloom] tbl problem with backslashes, Carsten Kunze, 2014/09/01
- Re: [Groff] [Groff & Heirloom] tbl problem with backslashes, Ted Harding, 2014/09/01
- Re: [Groff] [Groff & Heirloom] tbl problem with backslashes, Carsten Kunze, 2014/09/01
- Re: [Groff] [Groff & Heirloom] tbl problem with backslashes, Mike Bianchi, 2014/09/01
- Re: [Groff] [Groff & Heirloom] tbl problem with backslashes, Carsten Kunze, 2014/09/01