Hi Hans,

Currently the following mathpairs are defined:

:=  \colonequals
=:  \equalscolon
<=  \le
=  \ge
!=  \neq

Are these all? (Why is != defined using specials?)

Does it make sense to define others? I can think of the following:

<<  \ll
 \gg
<<< \lll
\ggg
== \equiv

In addition, we can also add arrows.
Because one wants to distinguish between \Leftarrow (<=) and \le (<=), I am defining arrows using two ==.

-> \rightarrow
<- \leftarrow
<-> \leftrightarrow
==> \Rightarrow
<== \Leftarrow
<=> \Leftrightarrow
===> \Longrightarrow
<=== \Longleftarrow
<==> \Longleftrightarrow

I see this as marginally useful. Does it make sense to add support for math pairs of size three and four? If so, I am attaching a patch for char-def.lua that provides this support (as well as a test file).

Everything works except ===>. The reason is that === is not mapped to anything. In the attached file, I tried mapping === (i.e., 0x2261 + 0x3D) to 0x2A76 (I gave it a mathname "eqeqeq" as well; this is consistent with latex's unicode-math package). However, this glyph is missing from LM and cambria, and === to \eqeqeq mapping doesn't work.

Any idea on how to fix this or is there another approach without defining a mapping for ===. (that will also help us to define --> where I couldn't figure out what I should map -- to; I can map it to en-dash, but that just feels wrong).

Thanks,
Aditya

PS: Currently, !=== !<= etc doesn't work (neither does \not <=, etc.). It can be fixed, but at that stage I am not sure it worth using math pairs.

PPS: Monospace fonts with ligatures: https://www.hanselman.com/blog/MonospacedProgrammingFontsWithLigatures.aspx

Attachment: test.tex
Description: TeX document

--- char-def.lua	2017-08-04 22:39:56.000000000 -0400
+++ /opt/context-minimals/tex/texmf-context/tex/context/base/mkiv/char-def.lua	2017-08-05 00:37:15.000000000 -0400
@@ -62290,6 +62290,7 @@
   linebreak="ai",
   mathextensible="l",
   mathfiller="leftarrowfill",
+  mathpair={ 0x3C, 0x2212 },
   mathspec={
    {
     class="relation",
@@ -62333,6 +62334,7 @@
   linebreak="ai",
   mathextensible="r",
   mathfiller="rightarrowfill",
+  mathpair={ 0x2212, 0x3E },
   mathspec={
    {
     class="relation",
@@ -62377,6 +62379,7 @@
   linebreak="ai",
   mathclass="relation",
   mathextensible="h",
+  mathpair={ 0x2190, 0x3E },
   mathname="leftrightarrow",
   synonyms={ "relation" },
   unicodeslot=0x2194,
@@ -63050,6 +63053,7 @@
   mathclass="relation",
   mathextensible="l",
   mathname="Leftarrow",
+  mathpair={ 0x2264, 0x3D },
   unicodeslot=0x21D0,
  },
  [0x21D1]={
@@ -63071,6 +63075,7 @@
   direction="on",
   linebreak="ai",
   mathextensible="r",
+  mathpair={ 0x2261, 0x3E },
   mathspec={
    {
     class="relation",
@@ -63103,6 +63108,7 @@
   linebreak="ai",
   mathclass="relation",
   mathextensible="h",
+  mathpair={ 0x2264, 0x3E },
   mathname="Leftrightarrow",
   unicodeslot=0x21D4,
  },
@@ -64687,6 +64693,7 @@
   linebreak="ai",
   mathclass="relation",
   mathextensible="h",
+  mathpair={ 0x3D, 0x3D },
   mathname="equiv",
   unicodeslot=0x2261,
  },
@@ -64812,6 +64819,7 @@
   direction="on",
   linebreak="ai",
   mathclass="relation",
+  mathpair={ 0x3C, 0x3C },
   mathname="ll",
   mirror=0x226B,
   unicodeslot=0x226A,
@@ -64824,6 +64832,7 @@
   direction="on",
   linebreak="ai",
   mathclass="relation",
+  mathpair={ 0x3E, 0x3E },
   mathname="gg",
   mirror=0x226A,
   unicodeslot=0x226B,
@@ -65980,6 +65989,7 @@
   description="VERY MUCH LESS-THAN",
   direction="on",
   linebreak="al",
+  mathpair={ 0x226A, 0x3C },
   mathspec={
    {
     class="relation",
@@ -65998,6 +66008,7 @@
   description="VERY MUCH GREATER-THAN",
   direction="on",
   linebreak="al",
+  mathpair={ 0x226B, 0x3E },
   mathspec={
    {
     class="relation",
@@ -76360,6 +76371,7 @@
   mathclass="relation",
   mathextensible="l",
   mathfiller="Leftarrowfill",
+  mathpair={ 0x21D0, 0x3D },
   mathname="Longleftarrow",
   unicodeslot=0x27F8,
  },
@@ -76371,6 +76383,7 @@
   mathclass="relation",
   mathextensible="r",
   mathfiller="Rightarrowfill",
+  mathpair={ 0x2A76, 0x3E },
   mathname="Longrightarrow",
   unicodeslot=0x27F9,
  },
@@ -76382,6 +76395,7 @@
   mathclass="relation",
   mathextensible="h",
   mathfiller="Leftrightarrowfill",
+  mathpair={ 0x21D0, 0x3E },
   mathname="Longleftrightarrow",
   unicodeslot=0x27FA,
  },
@@ -81085,6 +81099,8 @@
   description="TWO CONSECUTIVE EQUALS SIGNS",
   direction="on",
   linebreak="al",
+  mathclass="relation",
+  mathname="eqeq",
   specials={ "compat", 0x3D, 0x3D },
   unicodeslot=0x2A75,
  },
@@ -81093,6 +81109,9 @@
   description="THREE CONSECUTIVE EQUALS SIGNS",
   direction="on",
   linebreak="al",
+  mathclass="relation",
+  mathpair={ 0x2261, 0x3D },
+  mathname="eqeqeq",
   specials={ "compat", 0x3D, 0x3D, 0x3D },
   unicodeslot=0x2A76,
  },
_______________________________________________
dev-context mailing list
dev-context@ntg.nl
https://mailman.ntg.nl/mailman/listinfo/dev-context

Reply via email to