Implicit \color, explicitly grouped \textcolor (#619)

This commit is contained in:
Erik Demaine
2017-06-12 23:11:27 -04:00
committed by Kevin Barabash
parent ad0abbd4e9
commit 25dde7f841
9 changed files with 82 additions and 33 deletions

View File

@@ -23,9 +23,9 @@ const ParseNode = parseData.ParseNode;
* - "color": An html color, like "#abc" or "blue"
* - "original": The same type as the environment that the
* function being parsed is in (e.g. used for the
* bodies of functions like \color where the first
* argument is special and the second argument is
* parsed normally)
* bodies of functions like \textcolor where the
* first argument is special and the second
* argument is parsed normally)
* Other possible types (probably shouldn't be used)
* - "text": Text-like (e.g. \text)
* - "math": Normal math
@@ -151,7 +151,7 @@ defineFunction([
});
// A two-argument custom color
defineFunction("\\color", {
defineFunction("\\textcolor", {
numArgs: 2,
allowedInText: true,
greediness: 3,
@@ -166,6 +166,14 @@ defineFunction("\\color", {
};
});
// \color is handled in Parser.js's parseImplicitGroup
defineFunction("\\color", {
numArgs: 1,
allowedInText: true,
greediness: 3,
argTypes: ["color"],
}, null);
// An overline
defineFunction("\\overline", {
numArgs: 1,