On 12/28/2021 5:54 PM, Hans Åberg via ntg-context wrote:
Is it possible to use the Unicode superscript and subscript parentheses as
superscript and subscript operators? That is, ⁽…⁾ having the same function as
^{…}, and ₍…₎ as _{…}.
It might be something like the following, but somehow bundling the last part of
\letcharcode into a command.
\appendtoks
\catcode`⁽=\activecatcode
\letcharcode `⁽ ^{
\catcode`⁾=\activecatcode
\letcharcode `⁾ }
\catcode`₍=\activecatcode
\letcharcode `₍ _{
\catcode`₎=\activecatcode
\letcharcode `₎ }
\to \everymathematics
\protected\def\FancySuperscript#1⁾{\superscript{#1}}
\protected\def\FancySubscript #1₍{\subscript {#1}}
\protected\def\FancyScripts
{\catcode`⁽=\activecatcode\letcharcode`⁽=\FancySuperscript
\catcode`₍=\activecatcode\letcharcode`₍=\FancySubscript}
\appendtoks
\FancyScripts
\to \everymathematics
\starttext
test $ x⁽3y⁾ $
\stoptext
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________