From b98670b8ed66dd694427025b4e800fcaf2e962a3 Mon Sep 17 00:00:00 2001 From: Kevin Barabash Date: Thu, 10 Sep 2015 21:53:25 -0700 Subject: [PATCH] Set the greedines of font functions to 2 so that e^\mathbf{x} will parse Test Plan: make test Reviewers: emily --- src/functions.js | 3 ++- test/katex-spec.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/functions.js b/src/functions.js index aa9f0e971..777b1096b 100644 --- a/src/functions.js +++ b/src/functions.js @@ -462,7 +462,8 @@ defineFunction([ // aliases "\\Bbb", "\\bold", "\\frak" ], { - numArgs: 1 + numArgs: 1, + greediness: 2 }, function (func, body) { if (func in fontAliases) { func = fontAliases[func]; diff --git a/test/katex-spec.js b/test/katex-spec.js index 0f40cff06..446636982 100644 --- a/test/katex-spec.js +++ b/test/katex-spec.js @@ -1259,6 +1259,10 @@ describe("A font parser", function () { expect(bf.value.body.value[1].value.font).toMatch("mathrm"); expect(bf.value.body.value[2].value).toMatch("c"); }); + + it("should have the correct greediness", function() { + expect("e^\\mathbf{x}").toParse(); + }); }); describe("An HTML font tree-builder", function () {