mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 19:28:39 +00:00
Support \stackrel (#468).
This commit is contained in:
@@ -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},
|
||||
|
Reference in New Issue
Block a user