From 73d80f595c1fbc319fdeda5e50475b0f81e45994 Mon Sep 17 00:00:00 2001 From: Ron Kok Date: Mon, 5 Feb 2018 18:17:36 -0800 Subject: [PATCH] Add \nobreakspace (#1145) --- src/symbols.js | 3 +++ test/katex-spec.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/symbols.js b/src/symbols.js index 7572aded..8c498fdc 100644 --- a/src/symbols.js +++ b/src/symbols.js @@ -563,6 +563,8 @@ defineSymbol(math, main, spacing, null, "\\enspace"); defineSymbol(math, main, spacing, null, "\\qquad"); defineSymbol(math, main, spacing, null, "\\quad"); defineSymbol(math, main, spacing, "\u00a0", "\\space"); +// Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{% +defineSymbol(math, main, spacing, "\u00a0", "\\nobreakspace"); defineSymbol(text, main, spacing, null, "\\!"); defineSymbol(text, main, spacing, "\u00a0", "\\ "); defineSymbol(text, main, spacing, "\u00a0", "~"); @@ -573,6 +575,7 @@ defineSymbol(text, main, spacing, null, "\\enspace"); defineSymbol(text, main, spacing, null, "\\qquad"); defineSymbol(text, main, spacing, null, "\\quad"); defineSymbol(text, main, spacing, "\u00a0", "\\space"); +defineSymbol(text, main, spacing, "\u00a0", "\\nobreakspace"); defineSymbol(math, main, punct, ",", ","); defineSymbol(math, main, punct, ";", ";"); defineSymbol(math, main, punct, ":", "\\colon"); diff --git a/test/katex-spec.js b/test/katex-spec.js index 384a5e4f..e1d432af 100644 --- a/test/katex-spec.js +++ b/test/katex-spec.js @@ -2999,7 +2999,7 @@ describe("Symbols", function() { }); it("should parse spacing functions in math or text mode", () => { - expect("A\\;B\\,C \\text{A\\;B\\,C}").toParse(); + expect("A\\;B\\,C\\nobreakspace \\text{A\\;B\\,C\\nobreakspace}").toParse(); }); it("should render ligature commands like their unicode characters", () => {