[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: user-defined characters, translation maps, and environment binding
From: |
Ralph Corderoy |
Subject: |
Re: user-defined characters, translation maps, and environment binding |
Date: |
Mon, 24 Apr 2023 11:31:10 +0100 |
Hi Branden,
> > .char £ pound sterling
> > .char $ United States dollar
> > .
> > The £ and $ are almost at par.
> > .
> > .tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
> > £ crashes overnight!
> > .
> > .pl \n(nlu
> > ^D
> > The pound sterling and United States dollar are almost at par.
> > POUND STERLING CRASHES OVERNIGHT!
...
> > I'd want to see shouty caps.
>
> I think this an excellent example of user-defined character abuse.
It's a long-standing idiom. Not abuse.
> There's no reason not to use strings here.
...
> . de UP
> . tr aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ
> . ds \\$1 \\*[\\$1]
> . tr AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXXYYZZ
> . .
...
> .ds P pound sterling\"
> .ds D United States dollar\"
> .
> The \*P and \*D are almost at par.
> .
> .ds news \*P crashes overnight!
> .UP news
> \*[news]
> .pl \n(nlu
Reasons not to use strings here:
- It avoids having to re-work existing documents.
- The text should be typed with £ and $, not \*P and \*D.
- The text to shout now has to be put into a string, a macro called, and
the string interpolated. Before, the text was just written.
It sounds like transliteration local to an environment is a new feature,
not one worthy of breaking .tr.
--
Cheers, Ralph.
- Proposed: stop subjecting right-hand sides of `char` family requests to character translation, Douglas McIlroy, 2023/04/01
- Re: Proposed: stop subjecting right-hand sides of `char` family requests to character translation, G. Branden Robinson, 2023/04/01
- Re: Proposed: stop subjecting right-hand sides of `char` family requests to character translation, Ralph Corderoy, 2023/04/02
- Re: Proposed: stop subjecting right-hand sides of `char` family requests to character translation, Douglas McIlroy, 2023/04/02
- Re: Proposed: stop subjecting right-hand sides of `char` family requests to character translation, Dave Kemper, 2023/04/10
- user-defined characters, translation maps, and environment binding (was: Proposed: stop subjecting right-hand sides of `char` family requests), G. Branden Robinson, 2023/04/24
- Re: user-defined characters, translation maps, and environment binding,
Ralph Corderoy <=
- Re: user-defined characters, translation maps, and environment binding, G. Branden Robinson, 2023/04/24
- Re: user-defined characters, translation maps, and environment binding, G. Branden Robinson, 2023/04/24