mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-09 21:18:40 +00:00
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:
1
Lexer.js
1
Lexer.js
@@ -17,6 +17,7 @@ var normals = [
|
|||||||
[/^[*+-]/, 'bin'],
|
[/^[*+-]/, 'bin'],
|
||||||
[/^[=<>]/, 'rel'],
|
[/^[=<>]/, 'rel'],
|
||||||
[/^[,;]/, 'punct'],
|
[/^[,;]/, '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 an error if we didn't find a group
|
||||||
throw "Parse error: Couldn't find group after '^'";
|
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 {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -179,18 +183,78 @@ var colorFuncs = [
|
|||||||
// For example, if the lexer returns something of type "colon", we should
|
// For example, if the lexer returns something of type "colon", we should
|
||||||
// return a node of type "punct"
|
// return a node of type "punct"
|
||||||
var copyFuncs = {
|
var copyFuncs = {
|
||||||
"textord": ["textord"],
|
"textord": [
|
||||||
|
"textord",
|
||||||
|
"\\angle",
|
||||||
|
"\\infty",
|
||||||
|
"\\prime"
|
||||||
|
],
|
||||||
"mathord": ["mathord"],
|
"mathord": ["mathord"],
|
||||||
"bin": ["bin", "\\pm", "\\div", "\\cdot"],
|
"bin": [
|
||||||
"open": ["open", "\\lvert"],
|
"bin",
|
||||||
"close": ["close", "\\rvert"],
|
"\\cdot",
|
||||||
"rel": ["rel", "\\leq", "\\geq", "\\neq", "\\nleq", "\\ngeq"],
|
"\\circ",
|
||||||
"spacing": ["\\qquad", "\\quad", "\\space", "\\ ", "\\,", "\\:", "\\;"],
|
"\\div",
|
||||||
"punct": ["punct", "\\colon"],
|
"\\pm",
|
||||||
"namedfn": ["\\arcsin", "\\arccos", "\\arctan", "\\arg", "\\cos", "\\cosh",
|
"\\times"
|
||||||
"\\cot", "\\coth", "\\csc", "\\deg", "\\dim", "\\exp", "\\hom",
|
],
|
||||||
"\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\tan",
|
"open": [
|
||||||
"\\tanh"]
|
"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
|
// 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",
|
"*": "\u2217",
|
||||||
"-": "\u2212",
|
"-": "\u2212",
|
||||||
"`": "\u2018",
|
"`": "\u2018",
|
||||||
"\\cdot": "\u22C5",
|
|
||||||
"\\lvert": "|",
|
|
||||||
"\\rvert": "|",
|
|
||||||
"\\pm": "\u00b1",
|
|
||||||
"\\div": "\u00f7",
|
|
||||||
"\\leq": "\u2264",
|
|
||||||
"\\geq": "\u2265",
|
|
||||||
"\\neq": "\u2260",
|
|
||||||
"\\nleq": "\u2270",
|
|
||||||
"\\ngeq": "\u2271",
|
|
||||||
"\\ ": "\u00a0",
|
"\\ ": "\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",
|
"\\space": "\u00a0",
|
||||||
"\\colon": ":"
|
"\\times": "\u00d7",
|
||||||
|
"\\to": "\u2192"
|
||||||
};
|
};
|
||||||
|
|
||||||
var textit = function(value) {
|
var textit = function(value) {
|
||||||
|
Reference in New Issue
Block a user