mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-06 03:38: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},
|
||||
|
BIN
test/screenshotter/images/StackRel-chrome.png
Normal file
BIN
test/screenshotter/images/StackRel-chrome.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
BIN
test/screenshotter/images/StackRel-firefox.png
Normal file
BIN
test/screenshotter/images/StackRel-firefox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
@@ -116,6 +116,7 @@ Sqrt: |
|
||||
^{\sqrt{\sqrt{\sqrt{x}}}}}
|
||||
SqrtRoot: |
|
||||
1+\sqrt[3]{2}+\sqrt[1923^234]{2^{2^{2^{2^{2^{2^{2^{2^{2^{2^{2^2}}}}}}}}}}}
|
||||
StackRel: a \stackrel{?}{=} b \stackrel{\text{def}}{=} c
|
||||
StyleSwitching: a\cdot b\scriptstyle a\cdot ba\textstyle\cdot ba\scriptstyle\cdot b
|
||||
SupSubCharacterBox: a_2f_2{f}_2{aa}_2{af}_2\mathbf{y}_Ay_A
|
||||
SupSubHorizSpacing: |
|
||||
|
Reference in New Issue
Block a user