Repository: Khan/KaTeX
Pull request #1752 (2018-10-24 08:53:11)

Add \>
Add `\>`: fixes partly #164.

`\>` is defined as `\medmuskip`, but uses a fixed value, like `\:`. (Added TODO)

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


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

```diff
@@            Coverage Diff            @@
##           master   #1752      +/-   ##
=========================================
+ Coverage   93.99%     94%   +<.01%     
=========================================
  Files          78      78              
  Lines        4549    4550       +1     
  Branches      792     792              
=========================================
+ Hits         4276    4277       +1     
  Misses        242     242              
  Partials       31      31
```

| Flag | Coverage Δ | |
|---|---|---|
| #screenshotter | `88.64% <100%> (ø)` | :arrow_up: |
| #test | `85.36% <100%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/Khan/KaTeX/pull/1752?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/macros.js](https://codecov.io/gh/Khan/KaTeX/pull/1752/diff?src=pr&el=tree#diff-c3JjL21hY3Jvcy5qcw==) | `97.14% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/Khan/KaTeX/pull/1752?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/1752?src=pr&el=footer). Last update [0b7b4db...ee7b1ab](https://codecov.io/gh/Khan/KaTeX/pull/1752?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/docs/support_table.md b/docs/support_table.md
index e7a26ed3..928adba9 100644
--- a/docs/support_table.md
+++ b/docs/support_table.md
@@ -44,6 +44,7 @@ table td {
 |&#060;|$<$||
 |\\=|$\text{\={a}}$|<code>\text{\\={a}}</code>|
 | >|$>$||
+|\\>|$a\>\>{b}$|`a\>\>{b}`|
 |\[|$[$||
 |\]|$]$||
 |{|${a}$|`{a}`|
diff --git a/docs/supported.md b/docs/supported.md
index f6693b6b..2d69441c 100644
--- a/docs/supported.md
+++ b/docs/supported.md
@@ -233,17 +233,18 @@ KaTeX also supports `\llap`, `\rlap`, and `\clap`, but they will take only text,
 |:----------------|:-------------------|:---------------------|:--------------------------------------|
 | `\,`            | ³∕₁₈ em space      | `\kern{distance}`    | space, width = *distance*
 | `\thinspace`    | ³∕₁₈ em space      | `\mkern{distance}`   | space, width = *distance*
-| `\:`            | ⁴∕₁₈ em space      | `\mskip{distance}`   | space, width = *distance*
-| `\medspace`     | ⁴∕₁₈ em space      | `\hskip{distance}`   | space, width = *distance*
-| `\;`            | ⁵∕₁₈ em space      | `\hspace{distance}`  | space, width = *distance*
-| `\thickspace`   | ⁵∕₁₈ em space      | `\hspace*{distance}` | space, width = *distance*
-| `\enspace`      | ½ em space         | `\phantom{content}`  | space the width and height of content
-| `\quad`         | 1 em space         | `\hphantom{content}` | space the width of content
-| `\qquad`        | 2 em space         | `\vphantom{content}` | a strut the height of content
-| `~`             | non-breaking space | `\!`                 | – ³∕₁₈ em space
-| `\<space>`      | space              | `\negthinspace`      | – ³∕₁₈ em space
-| `\nobreakspace` | non-breaking space | `\negmedspace`       | – ⁴∕₁₈ em space
-| `\space`        | space              | `\negthickspace`     | – ⁵∕₁₈ em space
+| `\>`            | ⁴∕₁₈ em space      | `\mskip{distance}`   | space, width = *distance*
+| `\:`            | ⁴∕₁₈ em space      | `\hskip{distance}`   | space, width = *distance*
+| `\medspace`     | ⁴∕₁₈ em space      | `\hspace{distance}`  | space, width = *distance*
+| `\;`            | ⁵∕₁₈ em space      | `\hspace*{distance}` | space, width = *distance*
+| `\thickspace`   | ⁵∕₁₈ em space      | `\phantom{content}`  | space the width and height of content
+| `\enspace`      | ½ em space         | `\hphantom{content}` | space the width of content
+| `\quad`         | 1 em space         | `\vphantom{content}` | a strut the height of content
+| `\qquad`        | 2 em space         | `\!`                 | – ³∕₁₈ em space
+| `~`             | non-breaking space | `\negthinspace`      | – ³∕₁₈ em space
+| `\<space>`      | space              | `\negmedspace`       | – ⁴∕₁₈ em space
+| `\nobreakspace` | non-breaking space | `\negthickspace`     | – ⁵∕₁₈ em space
+| `\space`        | space              |
 
 </div>
 
diff --git a/src/macros.js b/src/macros.js
index d3e36bca..0db4271b 100644
--- a/src/macros.js
+++ b/src/macros.js
@@ -605,8 +605,10 @@ defineMacro("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");
 defineMacro("\\,", "\\tmspace+{3mu}{.1667em}");
 // \let\thinspace\,
 defineMacro("\\thinspace", "\\,");
+// \def\>{\mskip\medmuskip}
 // \renewcommand{\:}{\tmspace+\medmuskip{.2222em}}
-// TODO: math mode should use \medmuskip = 4mu plus 2mu minus 4mu
+// TODO: \> and math mode of \: should use \medmuskip = 4mu plus 2mu minus 4mu
+defineMacro("\\>", "\\mskip{4mu}");
 defineMacro("\\:", "\\tmspace+{4mu}{.2222em}");
 // \let\medspace\:
 defineMacro("\\medspace", "\\:");


Test patch:
diff --git a/test/__snapshots__/mathml-spec.js.snap b/test/__snapshots__/mathml-spec.js.snap
index 25b923ba..3ed5593b 100644
--- a/test/__snapshots__/mathml-spec.js.snap
+++ b/test/__snapshots__/mathml-spec.js.snap
@@ -713,6 +713,9 @@ exports[`A MathML builder special spaces render specially 1`] = `
       <mtext>
         &MediumSpace;
       </mtext>
+      <mtext>
+        &MediumSpace;
+      </mtext>
       <mtext>
         &ThickSpace;
       </mtext>
@@ -757,7 +760,7 @@ exports[`A MathML builder special spaces render specially 1`] = `
       </mtext>
     </mrow>
     <annotation encoding="application/x-tex">
-      \\,\\thinspace\\:\\medspace\\;\\thickspace\\!\\negthinspace\\negmedspace\\negthickspace\\mkern1mu\\mkern3mu\\mkern4mu\\mkern5mu\\mkern-1mu\\mkern-3mu\\mkern-4mu\\mkern-5mu
+      \\,\\thinspace\\:\\&gt;\\medspace\\;\\thickspace\\!\\negthinspace\\negmedspace\\negthickspace\\mkern1mu\\mkern3mu\\mkern4mu\\mkern5mu\\mkern-1mu\\mkern-3mu\\mkern-4mu\\mkern-5mu
     </annotation>
   </semantics>
 </math>
diff --git a/test/katex-spec.js b/test/katex-spec.js
index d415de6e..f15c50a3 100644
--- a/test/katex-spec.js
+++ b/test/katex-spec.js
@@ -752,7 +752,7 @@ describe("A text parser", function() {
     });
 
     it("should parse spacing functions", function() {
-        expect`a b\, \; \! \: ~ \thinspace \medspace \quad \ `.toBuild();
+        expect`a b\, \; \! \: \> ~ \thinspace \medspace \quad \ `.toBuild();
         expect`\enspace \thickspace \qquad \space \nobreakspace`.toBuild();
     });
 
diff --git a/test/mathml-spec.js b/test/mathml-spec.js
index f862feba..b44db6b4 100644
--- a/test/mathml-spec.js
+++ b/test/mathml-spec.js
@@ -109,7 +109,7 @@ describe("A MathML builder", function() {
     });
     it('special spaces render specially', function() {
         expect(getMathML(
-            "\\,\\thinspace\\:\\medspace\\;\\thickspace" +
+            "\\,\\thinspace\\:\\>\\medspace\\;\\thickspace" +
             "\\!\\negthinspace\\negmedspace\\negthickspace" +
             "\\mkern1mu\\mkern3mu\\mkern4mu\\mkern5mu" +
             "\\mkern-1mu\\mkern-3mu\\mkern-4mu\\mkern-5mu")).toMatchSnapshot();