Implement \colon as amsmath does (#1410)

* Implement \colon as amsmath does

* Remove \colon from symbols.js

* Update screenshots

* Pick up comments

* Replace screenshots
This commit is contained in:
Ron Kok
2018-06-06 19:24:41 -07:00
committed by Erik Demaine
parent 93904c51ab
commit a5ef29fab1
6 changed files with 7 additions and 2 deletions

View File

@@ -289,6 +289,11 @@ defineMacro("\\varPhi", "\\mathit{\\Phi}");
defineMacro("\\varPsi", "\\mathit{\\Psi}");
defineMacro("\\varOmega", "\\mathit{\\Omega}");
// \renewcommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript
// \mkern-\thinmuskip{:}\mskip6muplus1mu\relax}
defineMacro("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}" +
"\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu");
// \newcommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}}
defineMacro("\\boxed", "\\fbox{\\displaystyle{#1}}");

View File

@@ -592,7 +592,6 @@ defineSymbol(math, main, spacing, null, "\\nobreak");
defineSymbol(math, main, spacing, null, "\\allowbreak");
defineSymbol(math, main, punct, ",", ",");
defineSymbol(math, main, punct, ";", ";");
defineSymbol(math, main, punct, ":", "\\colon");
defineSymbol(math, ams, bin, "\u22bc", "\\barwedge", true);
defineSymbol(math, ams, bin, "\u22bb", "\\veebar", true);
defineSymbol(math, main, bin, "\u2299", "\\odot", true);

View File

@@ -99,7 +99,7 @@ describe("A rel parser", function() {
});
describe("A punct parser", function() {
const expression = ",;\\colon";
const expression = ",;";
it("should not fail", function() {
expect(expression).toParse(strictSettings);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -289,6 +289,7 @@ Spacing: |
^3+[-1][1-1]1=1(=1)\lvert a\rvert~b \\
\scriptstyle{^3+[-1][1-1]1=1(=1)\lvert a\rvert~b} \\
\scriptscriptstyle{^3+[-1][1-1]1=1(=1)\lvert a\rvert~b} \\
a : a \colon a \\
\end{matrix}
Sqrt: |
\sqrt{\sqrt{\sqrt{x}}}_{\sqrt{\sqrt{x}}}^{\sqrt{\sqrt{\sqrt{x}}}