Support \stackrel (#468).

This commit is contained in:
Eddie Kohler
2016-11-26 23:00:01 -05:00
parent 6bb62b11b4
commit f8e0c91de4
4 changed files with 31 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
var utils = require("./utils");
var ParseError = require("./ParseError");
var parseData = require("./parseData");
var ParseNode = parseData.ParseNode;
/* This file contains a list of functions that we parse, identified by
* the calls to defineFunction.
@@ -236,6 +238,34 @@ defineFunction([
};
});
// Build a relation by placing one symbol on top of another
defineFunction("\\stackrel", {
numArgs: 2,
}, function(context, args) {
var top = args[0];
var bottom = args[1];
var bottomop = new ParseNode("op", {
type: "op",
limits: true,
alwaysHandleSupSub: true,
symbol: false,
value: ordargument(bottom),
}, bottom.mode);
var supsub = new ParseNode("supsub", {
base: bottomop,
sup: top,
sub: null,
}, top.mode);
return {
type: "mclass",
mclass: "mrel",
value: [supsub],
};
});
// Extra data needed for the delimiter handler down below
var delimiterSizes = {
"\\bigl" : {mclass: "mopen", size: 1},