Repository: Khan/KaTeX
Pull request #1274 (2018-04-24 23:10:05)

Support Unicode ≘≙≚≛≝≞≟
Supports Unicode characters ≘ ≙ ≚ ≛ ≝ ≞ ≟

ronkok: Visual confirmation:
![stackrel](https://user-images.githubusercontent.com/16403058/39218515-08099ef8-47da-11e8-8ae3-c48ba9b5ebba.PNG)

codecov[bot]: # [Codecov](https://codecov.io/gh/Khan/KaTeX/pull/1274?src=pr&el=h1) Report
> Merging [#1274](https://codecov.io/gh/Khan/KaTeX/pull/1274?src=pr&el=desc) into [master](https://codecov.io/gh/Khan/KaTeX/commit/812b350a5dd0cafef30ed891fd17dbd4e3700966?src=pr&el=desc) will **increase** coverage by `1%`.
> The diff coverage is `100%`.


[![Impacted file tree graph](https://codecov.io/gh/Khan/KaTeX/pull/1274/graphs/tree.svg?width=650&src=pr&token=vfDnj2P77o&height=150)](https://codecov.io/gh/Khan/KaTeX/pull/1274?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master    #1274   +/-   ##
=======================================
+ Coverage   82.44%   83.45%   +1%     
=======================================
  Files          60       60           
  Lines        3880     3887    +7     
  Branches      651      651           
=======================================
+ Hits         3199     3244   +45     
+ Misses        578      545   -33     
+ Partials      103       98    -5
```


| [Impacted Files](https://codecov.io/gh/Khan/KaTeX/pull/1274?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/macros.js](https://codecov.io/gh/Khan/KaTeX/pull/1274/diff?src=pr&el=tree#diff-c3JjL21hY3Jvcy5qcw==) | `84.71% <100%> (+0.71%)` | :arrow_up: |
| [src/buildMathML.js](https://codecov.io/gh/Khan/KaTeX/pull/1274/diff?src=pr&el=tree#diff-c3JjL2J1aWxkTWF0aE1MLmpz) | `94.8% <0%> (+1.29%)` | :arrow_up: |
| [src/buildHTML.js](https://codecov.io/gh/Khan/KaTeX/pull/1274/diff?src=pr&el=tree#diff-c3JjL2J1aWxkSFRNTC5qcw==) | `96.77% <0%> (+2.3%)` | :arrow_up: |
| [src/Style.js](https://codecov.io/gh/Khan/KaTeX/pull/1274/diff?src=pr&el=tree#diff-c3JjL1N0eWxlLmpz) | `100% <0%> (+4%)` | :arrow_up: |
| [src/Options.js](https://codecov.io/gh/Khan/KaTeX/pull/1274/diff?src=pr&el=tree#diff-c3JjL09wdGlvbnMuanM=) | `98.11% <0%> (+5.66%)` | :arrow_up: |
| [src/functions.js](https://codecov.io/gh/Khan/KaTeX/pull/1274/diff?src=pr&el=tree#diff-c3JjL2Z1bmN0aW9ucy5qcw==) | `96.29% <0%> (+9.25%)` | :arrow_up: |
| [src/functions/op.js](https://codecov.io/gh/Khan/KaTeX/pull/1274/diff?src=pr&el=tree#diff-c3JjL2Z1bmN0aW9ucy9vcC5qcw==) | `94.36% <0%> (+11.26%)` | :arrow_up: |
| [src/functions/kern.js](https://codecov.io/gh/Khan/KaTeX/pull/1274/diff?src=pr&el=tree#diff-c3JjL2Z1bmN0aW9ucy9rZXJuLmpz) | `81.25% <0%> (+31.25%)` | :arrow_up: |
| [src/functions/sizing.js](https://codecov.io/gh/Khan/KaTeX/pull/1274/diff?src=pr&el=tree#diff-c3JjL2Z1bmN0aW9ucy9zaXppbmcuanM=) | `100% <0%> (+37.5%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/Khan/KaTeX/pull/1274?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Khan/KaTeX/pull/1274?src=pr&el=footer). Last update [812b350...4aa208a](https://codecov.io/gh/Khan/KaTeX/pull/1274?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

edemaine: By the way, are these supported in unicode-math? 
ronkok: @edemaine  Good point about the braces. I've removed them. 

Re: `unicode-math`: Yes, it does support all of the characters in this PR, and applies `\mathrel` to each, as one would expect.

Visual confirmation on the latest commit:
![stackrel](https://user-images.githubusercontent.com/16403058/39398901-9d46ffbe-4ac9-11e8-855d-3cca3a91403e.PNG)


Patch:
diff --git a/src/macros.js b/src/macros.js
index 8799d2fe..85f53284 100644
--- a/src/macros.js
+++ b/src/macros.js
@@ -151,6 +151,16 @@ defineMacro("\\llap", "\\mathllap{\\textrm{#1}}");
 defineMacro("\\rlap", "\\mathrlap{\\textrm{#1}}");
 defineMacro("\\clap", "\\mathclap{\\textrm{#1}}");
 
+// Unicode stacked relations
+defineMacro("\u2258",
+    "\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}");
+defineMacro("\u2259", "\\stackrel{\\tiny\\wedge}{=}");
+defineMacro("\u225A", "\\stackrel{\\tiny\\vee}{=}");
+defineMacro("\u225B", "\\stackrel{\\scriptsize\\star}{=}");
+defineMacro("\u225D", "\\stackrel{\\tiny\\mathrm{def}}{=}");
+defineMacro("\u225E", "\\stackrel{\\tiny\\mathrm{m}}{=}");
+defineMacro("\u225F", "\\stackrel{\\tiny?}{=}");
+
 //////////////////////////////////////////////////////////////////////
 // amsmath.sty
 // http://mirrors.concertpass.com/tex-archive/macros/latex/required/amsmath/amsmath.pdf


Test patch:
diff --git a/test/katex-spec.js b/test/katex-spec.js
index 1830d4fc..2d2cb613 100644
--- a/test/katex-spec.js
+++ b/test/katex-spec.js
@@ -2982,7 +2982,7 @@ describe("Unicode", function() {
     });
 
     it("should parse more relations", function() {
-        expect("⊂⊃⊆⊇⊏⊐⊑⊒⊢⊣⊩⊪⊸⋈⋍⋐⋑⋔⋛⋞⋟⌢⌣⩾⪆⪌⪕⪖⪯⪰⪷⪸⫅⫆").toParse();
+        expect("⊂⊃⊆⊇⊏⊐⊑⊒⊢⊣⊩⊪⊸⋈⋍⋐⋑⋔⋛⋞⋟⌢⌣⩾⪆⪌⪕⪖⪯⪰⪷⪸⫅⫆≘≙≚≛≝≞≟").toBuild();
     });
 
     it("should parse symbols", function() {