Add more symbols
Summary: ', \angle, \circ, \gets, \infty, \leftarrow, \prime, \rightarrow, \times, \to Fixes T1191. Reviewers: emily Reviewed By: emily Maniphest Tasks: T1191 Differential Revision: http://phabricator.khanacademy.org/D3053
This commit is contained in:
parent
c774b69de8
commit
a5840aae4b
1
Lexer.js
1
Lexer.js
|
@ -17,6 +17,7 @@ var normals = [
|
|||
[/^[*+-]/, 'bin'],
|
||||
[/^[=<>]/, 'rel'],
|
||||
[/^[,;]/, 'punct'],
|
||||
[/^'/, "'"],
|
||||
[/^\^/, '^'],
|
||||
[/^_/, '_'],
|
||||
[/^{/, '{'],
|
||||
|
|
86
Parser.js
86
Parser.js
|
@ -78,6 +78,10 @@ Parser.prototype.parseSuperscript = function(pos) {
|
|||
// Throw an error if we didn't find a group
|
||||
throw "Parse error: Couldn't find group after '^'";
|
||||
}
|
||||
} else if (sup.type === "'") {
|
||||
var pos = sup.position;
|
||||
return new ParseResult(
|
||||
new ParseNode("textord", "\\prime"), sup.position);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -179,18 +183,78 @@ var colorFuncs = [
|
|||
// For example, if the lexer returns something of type "colon", we should
|
||||
// return a node of type "punct"
|
||||
var copyFuncs = {
|
||||
"textord": ["textord"],
|
||||
"textord": [
|
||||
"textord",
|
||||
"\\angle",
|
||||
"\\infty",
|
||||
"\\prime"
|
||||
],
|
||||
"mathord": ["mathord"],
|
||||
"bin": ["bin", "\\pm", "\\div", "\\cdot"],
|
||||
"open": ["open", "\\lvert"],
|
||||
"close": ["close", "\\rvert"],
|
||||
"rel": ["rel", "\\leq", "\\geq", "\\neq", "\\nleq", "\\ngeq"],
|
||||
"spacing": ["\\qquad", "\\quad", "\\space", "\\ ", "\\,", "\\:", "\\;"],
|
||||
"punct": ["punct", "\\colon"],
|
||||
"namedfn": ["\\arcsin", "\\arccos", "\\arctan", "\\arg", "\\cos", "\\cosh",
|
||||
"\\cot", "\\coth", "\\csc", "\\deg", "\\dim", "\\exp", "\\hom",
|
||||
"\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\tan",
|
||||
"\\tanh"]
|
||||
"bin": [
|
||||
"bin",
|
||||
"\\cdot",
|
||||
"\\circ",
|
||||
"\\div",
|
||||
"\\pm",
|
||||
"\\times"
|
||||
],
|
||||
"open": [
|
||||
"open",
|
||||
"\\lvert"
|
||||
],
|
||||
"close": [
|
||||
"close",
|
||||
"\\rvert"
|
||||
],
|
||||
"rel": [
|
||||
"rel",
|
||||
"\\geq",
|
||||
"\\gets",
|
||||
"\\leftarrow",
|
||||
"\\leq",
|
||||
"\\neq",
|
||||
"\\ngeq",
|
||||
"\\nleq",
|
||||
"\\rightarrow",
|
||||
"\\to"
|
||||
],
|
||||
"spacing": [
|
||||
"\\ ",
|
||||
"\\,",
|
||||
"\\:",
|
||||
"\\;",
|
||||
"\\qquad",
|
||||
"\\quad",
|
||||
"\\space"
|
||||
],
|
||||
"punct": [
|
||||
"punct",
|
||||
"\\colon"
|
||||
],
|
||||
"namedfn": [
|
||||
"\\arcsin",
|
||||
"\\arccos",
|
||||
"\\arctan",
|
||||
"\\arg",
|
||||
"\\cos",
|
||||
"\\cosh",
|
||||
"\\cot",
|
||||
"\\coth",
|
||||
"\\csc",
|
||||
"\\deg",
|
||||
"\\dim",
|
||||
"\\exp",
|
||||
"\\hom",
|
||||
"\\ker",
|
||||
"\\lg",
|
||||
"\\ln",
|
||||
"\\log",
|
||||
"\\sec",
|
||||
"\\sin",
|
||||
"\\sinh",
|
||||
"\\tan",
|
||||
"\\tanh"
|
||||
]
|
||||
};
|
||||
|
||||
// Build a list of all of the different functions in the copyFuncs list, to
|
||||
|
|
31
katex.js
31
katex.js
|
@ -151,19 +151,28 @@ var charLookup = {
|
|||
"*": "\u2217",
|
||||
"-": "\u2212",
|
||||
"`": "\u2018",
|
||||
"\\cdot": "\u22C5",
|
||||
"\\lvert": "|",
|
||||
"\\rvert": "|",
|
||||
"\\pm": "\u00b1",
|
||||
"\\div": "\u00f7",
|
||||
"\\leq": "\u2264",
|
||||
"\\geq": "\u2265",
|
||||
"\\neq": "\u2260",
|
||||
"\\nleq": "\u2270",
|
||||
"\\ngeq": "\u2271",
|
||||
"\\ ": "\u00a0",
|
||||
"\\angle": "\u2220",
|
||||
"\\cdot": "\u22c5",
|
||||
"\\circ": "\u2218",
|
||||
"\\colon": ":",
|
||||
"\\div": "\u00f7",
|
||||
"\\geq": "\u2265",
|
||||
"\\gets": "\u2190",
|
||||
"\\infty": "\u221e",
|
||||
"\\leftarrow": "\u2190",
|
||||
"\\leq": "\u2264",
|
||||
"\\lvert": "|",
|
||||
"\\neq": "\u2260",
|
||||
"\\ngeq": "\u2271",
|
||||
"\\nleq": "\u2270",
|
||||
"\\pm": "\u00b1",
|
||||
"\\prime": "\u2032",
|
||||
"\\rightarrow": "\u2192",
|
||||
"\\rvert": "|",
|
||||
"\\space": "\u00a0",
|
||||
"\\colon": ":"
|
||||
"\\times": "\u00d7",
|
||||
"\\to": "\u2192"
|
||||
};
|
||||
|
||||
var textit = function(value) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user