Add some AMS characters
Summary: \nleq and \ngeq are AMS characters, so add support for parsing and showing those. Also, add font metrics from the ams_regular font. Test Plan: View `\ngeq \geq`, make sure that they look the same but with a slash through `\ngeq`. View `a \ngeq b`, make sure there's the right spacing for a rel. Reviewers: alpert Reviewed By: alpert Differential Revision: http://phabricator.khanacademy.org/D3547
This commit is contained in:
parent
7f25fd7dc9
commit
920dd0bef9
|
@ -265,11 +265,13 @@ var copyFuncs = {
|
|||
"\\leftarrow",
|
||||
"\\leq",
|
||||
"\\neq",
|
||||
"\\ngeq",
|
||||
"\\nleq",
|
||||
"\\rightarrow",
|
||||
"\\to"
|
||||
],
|
||||
"amsrel": [
|
||||
"\\ngeq",
|
||||
"\\nleq"
|
||||
],
|
||||
"spacing": [
|
||||
"\\ ",
|
||||
"\\,",
|
||||
|
|
|
@ -40,6 +40,7 @@ var groupToType = {
|
|||
textord: "mord",
|
||||
bin: "mbin",
|
||||
rel: "mrel",
|
||||
amsrel: "mrel",
|
||||
open: "mopen",
|
||||
close: "mclose",
|
||||
frac: "minner",
|
||||
|
@ -90,6 +91,10 @@ var groupTypes = {
|
|||
return makeSpan(["mrel", options.color], [mathrm(group.value)]);
|
||||
},
|
||||
|
||||
amsrel: function(group, options, prev) {
|
||||
return makeSpan(["mrel", options.color], [amsrm(group.value)]);
|
||||
},
|
||||
|
||||
supsub: function(group, options, prev) {
|
||||
var base = buildGroup(group.value.base, options.reset());
|
||||
|
||||
|
@ -467,6 +472,10 @@ var mathrm = function(value) {
|
|||
return makeText(value, "main-regular");
|
||||
};
|
||||
|
||||
var amsrm = function(value) {
|
||||
return makeSpan(["amsrm"], [makeText(value, "ams-regular")]);
|
||||
};
|
||||
|
||||
var buildTree = function(tree) {
|
||||
// Setup the default options
|
||||
var options = new Options(Style.TEXT, "");
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -39,7 +39,7 @@ end
|
|||
font_dir = File.join(File.dirname(__FILE__), 'static/fonts/')
|
||||
metrics = {}
|
||||
|
||||
%w[main-regular math-italic].each do |face|
|
||||
%w[main-regular math-italic ams-regular].each do |face|
|
||||
metrics[face] = metrics_for_file(File.join(font_dir, 'katex_%s.ttf' % face))
|
||||
end
|
||||
|
||||
|
|
|
@ -30,6 +30,10 @@ big parens
|
|||
font-style: italic;
|
||||
}
|
||||
|
||||
.amsrm {
|
||||
font-family: katex_ams;
|
||||
}
|
||||
|
||||
@thinspace: 0.16667em;
|
||||
@mediumspace: 0.22222em;
|
||||
@thickspace: 0.27778em;
|
||||
|
|
Loading…
Reference in New Issue
Block a user