ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
To: ntg-context@ntg.nl
Subject: Re: Math literal colon
Date: Fri, 24 Jul 2015 15:34:08 +0200	[thread overview]
Message-ID: <55B23ED0.9060500@wxs.nl> (raw)
In-Reply-To: <488207D2-1B5D-4623-8761-BEAFFF57D3CD@telia.com>

On 7/24/2015 2:40 PM, Hans Aberg wrote:
>
>> On 24 Jul 2015, at 11:40, Hans Hagen <pragma@wxs.nl> wrote:
>>
>> On 7/20/2015 6:09 PM, Hans Aberg wrote:
>>>
>>>> On 20 Jul 2015, at 17:50, Manuel Blanco <manuelbl@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 have experimented with a theorem proof assistant that admitted parallel ASCII and Unicode symbol names, but it turns out to be complicated. Think of C/C++ trigraphs, a chore to implement, only to be removed in the latest standards.
>
> So I think one should only focus on UTF-8, and add TeX ASCII “\” commands as a complement.
>
> One problem with this approach is the lack of Unicode input methods. But that may coming.
>
> For example, instead having “:=“ in the input file and let Lua translate it, one can merely type it and let the text editor translate it ≔ COLON EQUALS U+2254.

that is ok for some input sequences (this kind of input translation 
happens for accented characters and some math like negated symbols) but 
replacing <= in the input is bad as it is only meaningful in math and 
not all input is math (and unicode lacks script/language tagging); keep 
in mind that 'verbatim' in tex really means verbatim and input 
translation contradicts that

> It will save a lot of programming time, at least on the ConTEXt project. :-)

not really as that code is already in place for years; in this case it 
mainly boils down to adding some extra entries in the character database

(and this code is simple compared to other code so not much to save here)

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
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2015-07-24 13:34 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-20 12:30 Hans Aberg
2015-07-20 14:40 ` Aditya Mahajan
2015-07-20 15:43   ` Manuel Blanco
2015-07-20 15:50     ` Manuel Blanco
2015-07-20 16:09       ` Hans Aberg
2015-07-24  9:40         ` Hans Hagen
2015-07-24 12:40           ` Hans Aberg
2015-07-24 13:34             ` Hans Hagen [this message]
2015-07-24 14:13               ` Hans Aberg
2015-07-24 14:28                 ` Hans Hagen
2015-07-24 16:18                   ` Hans Aberg
2015-07-24 16:34                     ` Hans Hagen
2015-07-24 16:57                       ` Hans Aberg
2015-07-24 19:58                         ` Hans Hagen
2015-07-24 20:45                           ` Hans Aberg
2015-07-20 16:22     ` Hans Aberg
2015-07-20 19:34       ` Manuel Blanco
2015-07-20 20:06         ` Hans Aberg
2015-07-20 20:13         ` Hans Aberg
2015-07-24  9:43       ` Hans Hagen
2015-07-24 13:00         ` Hans Aberg
2015-07-24 13:48           ` Hans Hagen
2015-07-24 14:19             ` Hans Aberg
2015-07-24 14:29               ` Hans Hagen
2015-07-24 16:20                 ` Hans Aberg
2015-07-20 16:06   ` Hans Aberg
2015-07-20 16:37     ` Aditya Mahajan
2015-07-20 17:08       ` Hans Aberg
2015-07-20 17:18       ` Hans Aberg
2015-07-20 21:29       ` Hans Aberg
2015-07-24  8:30     ` Hans Hagen
2015-07-24 12:32       ` Hans Aberg
2015-07-24 13:29         ` Hans Hagen
2015-07-24 14:08           ` Hans Aberg
2015-07-24 14:26             ` Hans Hagen
2015-07-24 16:11               ` Hans Aberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B23ED0.9060500@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).