[NTG-context] Math literal colon

Hans Hagen pragma at wxs.nl
Fri Jul 24 11:40:04 CEST 2015


On 7/20/2015 6:09 PM, Hans Aberg wrote:
>
>> On 20 Jul 2015, at 17:50, Manuel Blanco <manuelbl at ucm.es> wrote:
>>
>> A little bit more of intelligence can be given with
>>
>>     \begingroup\lccode`\~=`\:\lowercase{\endgroup
>>       \unexpanded\def~}{\futurelet\tmptoken\docolon}
>>     \unexpanded\def\docolon{\ifx=\tmptoken\mathrel{\mathop{\mathchar`\:}}\else\colon\fi}
>>     \mathcode`\:="8000 %
>>
>> That lets you do $f: A \to B$ and $f(x) := x^2$
>
> For the second, one can use ≔ COLON EQUALS U+2254. But it is a good point, though.

there is actually a more modern trick:

\starttext

\startluacode
characters.mathpairs[0x3A] = { [0x3D] = 0x2254 }
characters.mathpairs[0x3E] = { [0x3D] = 0x2265 }
characters.mathpairs[0x3C] = { [0x3D] = 0x2264 }
characters.mathpairs[0x3D] = { [0x3A] = 0x2255 }
\stopluacode

\startTEXpage
$a := b <= =< c =: d >= e$
\stopTEXpage

\stoptext

i uploaded a beta with these predefined (in char-def.lua) but we can add 
more (if someone provides me the list)

negations and a few more already were present

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list