Unicode superscript and subscript parentheses as operators

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

On 12/28/2021 5:54 PM, Hans Åberg via ntg-context wrote:
\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 -----------------------------------------------------------------

This is great, though there is a typo in the second line. I attach a corrected example, illustrating what I might use it for: A logic program, where I found it readable in plain text to use the Unicode superscript and subscript parentheses. But when typeset, they should be superscripts and subscripts. — \definefallbackfamily [mainface][serif][stixtwotext][range={00B2-00B3,00B9,02070-0208F},force=yes] \definefallbackfamily [mainface][mono][stix][range={0100-10FFFF},force=yes] \definefallbackfamily [mainface][mono][stixtwotext][range={00B2-00B3,00B9,02070-0208F},force=yes] \definefallbackfamily [mainface][math][stixtwomath][range={00B2-00B3,00B9,02070-0208F},force=yes] \definefontfamily [mainface][serif][stix] \definefontfamily [mainface][mono][courier] \definefontfamily [mainface][math][stix] \setupbodyfont [mainface,10pt] \setmathfontalternate{upright} \setupmathematics[integral=nolimits, lcgreek=normal, default=normal] \setupformulae[location=left, indentnext=auto] \setuptyping[indentnext=auto] % Might use: 'small' indentation, no indentation on 'first': \setupindenting[yes, medium, next] \setupheads[indentnext=yes] \setupinteraction[state=start, click=yes, focus=standard, color=darkblue] \mainlanguage[en] \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 Course-of-values induction: $$𝜞 ⊢ 𝑷(0); 𝜞, 𝒚 ≤ 𝒙 ⇒ 𝑷(𝒚) ⊢⁽𝒚⁾₍𝒙₎ 𝑷(s(𝒙)) ⊩ 𝜞 ⊢ 𝑷(𝒕)$$ \stoptext —

On 12/28/2021 10:53 PM, Hans Åberg wrote:
stay away from $$ but use \startformula 𝜞 ⊢ 𝑷(0); 𝜞, 𝒚 ≤ 𝒙 ⇒ 𝑷(𝒚) ⊢⁽𝒚⁾₍𝒙₎ 𝑷(s(𝒙)) ⊩ 𝜞 ⊢ 𝑷(𝒕) \stopformula -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------

On 12/28/2021 10:53 PM, Hans Åberg wrote:
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------

I found using Unicode superscript and subscript parentheses more readable in general than the TeX convention in plain text. Otherwise, the program has logic as a basis, but is not intended to be restricted to that. FYI, the program is posted here, but has some dependencies to get running. The directory 'tests' has examples that are precompiled (checked agains with 'make check'). https://savannah.gnu.org/git/?group=metalogic-inference
participants (2)
-
Hans Hagen
-
Hans Åberg