ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Unicode superscript and subscript parentheses as operators
@ 2021-12-28 16:54 Hans Åberg via ntg-context
  2021-12-28 21:29 ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Åberg via ntg-context @ 2021-12-28 16:54 UTC (permalink / raw)
  To: Ntg-context; +Cc: Hans Åberg

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


___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicode superscript and subscript parentheses as operators
  2021-12-28 16:54 Unicode superscript and subscript parentheses as operators Hans Åberg via ntg-context
@ 2021-12-28 21:29 ` Hans Hagen via ntg-context
  2021-12-28 21:53   ` Hans Åberg via ntg-context
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen via ntg-context @ 2021-12-28 21:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicode superscript and subscript parentheses as operators
  2021-12-28 21:29 ` Hans Hagen via ntg-context
@ 2021-12-28 21:53   ` Hans Åberg via ntg-context
  2021-12-28 22:03     ` Hans Hagen via ntg-context
  2021-12-28 22:05     ` Hans Hagen via ntg-context
  0 siblings, 2 replies; 8+ messages in thread
From: Hans Åberg via ntg-context @ 2021-12-28 21:53 UTC (permalink / raw)
  To: Hans Hagen; +Cc: Hans Åberg, mailing list for ConTeXt users


> On 28 Dec 2021, at 22:29, Hans Hagen <j.hagen@xs4all.nl> 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

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
—

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicode superscript and subscript parentheses as operators
  2021-12-28 21:53   ` Hans Åberg via ntg-context
@ 2021-12-28 22:03     ` Hans Hagen via ntg-context
  2021-12-28 22:12       ` Hans Åberg via ntg-context
  2021-12-28 22:05     ` Hans Hagen via ntg-context
  1 sibling, 1 reply; 8+ messages in thread
From: Hans Hagen via ntg-context @ 2021-12-28 22:03 UTC (permalink / raw)
  To: Hans Åberg; +Cc: Hans Hagen, mailing list for ConTeXt users

On 12/28/2021 10:53 PM, Hans Åberg wrote:
> 
>> On 28 Dec 2021, at 22:29, Hans Hagen <j.hagen@xs4all.nl> 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
> 
> 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

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
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicode superscript and subscript parentheses as operators
  2021-12-28 21:53   ` Hans Åberg via ntg-context
  2021-12-28 22:03     ` Hans Hagen via ntg-context
@ 2021-12-28 22:05     ` Hans Hagen via ntg-context
  2021-12-28 22:25       ` Hans Åberg via ntg-context
  2021-12-30 20:34       ` Hans Åberg via ntg-context
  1 sibling, 2 replies; 8+ messages in thread
From: Hans Hagen via ntg-context @ 2021-12-28 22:05 UTC (permalink / raw)
  To: Hans Åberg; +Cc: Hans Hagen, mailing list for ConTeXt users

On 12/28/2021 10:53 PM, Hans Åberg wrote:

> 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.
i still want to come up with domain specific math features ... sp fpr 
instance we could have a module for logic but it's users who have to 
come up with demands ...

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
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicode superscript and subscript parentheses as operators
  2021-12-28 22:03     ` Hans Hagen via ntg-context
@ 2021-12-28 22:12       ` Hans Åberg via ntg-context
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Åberg via ntg-context @ 2021-12-28 22:12 UTC (permalink / raw)
  To: Hans Hagen; +Cc: Hans Åberg, mailing list for ConTeXt users


> On 28 Dec 2021, at 23:03, Hans Hagen <j.hagen@xs4all.nl> wrote:
> 
> On 12/28/2021 10:53 PM, Hans Åberg wrote:
>> \starttext
>> Course-of-values induction:
>>   $$𝜞 ⊢ 𝑷(0); 𝜞, 𝒚 ≤ 𝒙 ⇒ 𝑷(𝒚) ⊢⁽𝒚⁾₍𝒙₎ 𝑷(s(𝒙)) ⊩ 𝜞 ⊢ 𝑷(𝒕)$$
>> \stoptext
> 
> stay away from $$ but use
> 
>  \startformula
>  𝜞 ⊢ 𝑷(0); 𝜞, 𝒚 ≤ 𝒙 ⇒ 𝑷(𝒚) ⊢⁽𝒚⁾₍𝒙₎ 𝑷(s(𝒙)) ⊩ 𝜞 ⊢ 𝑷(𝒕)
>  \stopformula

Thanks, I am aware if that, but wrote it in a hurry. :-)


___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicode superscript and subscript parentheses as operators
  2021-12-28 22:05     ` Hans Hagen via ntg-context
@ 2021-12-28 22:25       ` Hans Åberg via ntg-context
  2021-12-30 20:34       ` Hans Åberg via ntg-context
  1 sibling, 0 replies; 8+ messages in thread
From: Hans Åberg via ntg-context @ 2021-12-28 22:25 UTC (permalink / raw)
  To: Hans Hagen; +Cc: Hans Åberg, mailing list for ConTeXt users


> On 28 Dec 2021, at 23:05, Hans Hagen <j.hagen@xs4all.nl> wrote:
> 
> On 12/28/2021 10:53 PM, Hans Åberg wrote:
> 
>> 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.
> i still want to come up with domain specific math features ... sp fpr instance we could have a module for logic but it's users who have to come up with demands ...

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


___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Unicode superscript and subscript parentheses as operators
  2021-12-28 22:05     ` Hans Hagen via ntg-context
  2021-12-28 22:25       ` Hans Åberg via ntg-context
@ 2021-12-30 20:34       ` Hans Åberg via ntg-context
  1 sibling, 0 replies; 8+ messages in thread
From: Hans Åberg via ntg-context @ 2021-12-30 20:34 UTC (permalink / raw)
  To: Hans Hagen; +Cc: Hans Åberg, mailing list for ConTeXt users


> On 28 Dec 2021, at 23:05, Hans Hagen <j.hagen@xs4all.nl> wrote:
> 
> On 12/28/2021 10:53 PM, Hans Åberg wrote:
> 
>> 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.
> i still want to come up with domain specific math features ... sp fpr instance we could have a module for logic but it's users who have to come up with demands ...

With direct bindings in LuaTeX it might be easier. —TeX syntax is good for writing by hand only.


___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-12-30 20:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28 16:54 Unicode superscript and subscript parentheses as operators Hans Åberg via ntg-context
2021-12-28 21:29 ` Hans Hagen via ntg-context
2021-12-28 21:53   ` Hans Åberg via ntg-context
2021-12-28 22:03     ` Hans Hagen via ntg-context
2021-12-28 22:12       ` Hans Åberg via ntg-context
2021-12-28 22:05     ` Hans Hagen via ntg-context
2021-12-28 22:25       ` Hans Åberg via ntg-context
2021-12-30 20:34       ` Hans Åberg via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).