commit f8e0c91de464af514479d53521d77036494145ce
parent 6bb62b11b4eadf8039fa98b75e642e6fe47da2fd
Author: Eddie Kohler <ekohler@gmail.com>
Date: Sat, 26 Nov 2016 23:00:01 -0500
Support \stackrel (#468).
Diffstat:
4 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/src/functions.js b/src/functions.js
@@ -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},
diff --git a/test/screenshotter/images/StackRel-chrome.png b/test/screenshotter/images/StackRel-chrome.png
Binary files differ.
diff --git a/test/screenshotter/images/StackRel-firefox.png b/test/screenshotter/images/StackRel-firefox.png
Binary files differ.
diff --git a/test/screenshotter/ss_data.yaml b/test/screenshotter/ss_data.yaml
@@ -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: |