commit 9b0f42ea502c22c0a4a54c5dce9b53592c89331d
parent 4be3931cb5b685c38e868eb2436522563d6f7de2
Author: Jeff Everett <everett.jeff.w@gmail.com>
Date: Mon, 27 Jul 2015 14:15:30 -0600
Fixed limit controls in textstyle
Diffstat:
5 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/Parser.js b/src/Parser.js
@@ -261,8 +261,9 @@ Parser.prototype.parseAtom = function(pos, mode) {
this.lexer, currPos);
}
else {
- var limits = lex.text == "\\limits";
+ var limits = lex.text === "\\limits";
base.result.value.limits = limits;
+ base.result.value.alwaysHandleSupSub = true;
currPos = lex.position;
}
} else if (lex.text === "^") {
diff --git a/src/buildHTML.js b/src/buildHTML.js
@@ -104,7 +104,8 @@ var shouldHandleSupSub = function(group, options) {
} else if (group.type === "op") {
// Operators handle supsubs differently when they have limits
// (e.g. `\displaystyle\sum_2^3`)
- return group.value.limits && options.style.size === Style.DISPLAY.size;
+ return group.value.limits &&
+ (options.style.size === Style.DISPLAY.size || group.value.alwaysHandleSupSub);
} else if (group.type === "accent") {
return isCharacterBox(group.value.base);
} else {
diff --git a/test/screenshotter/images/LimitControls-chrome.png b/test/screenshotter/images/LimitControls-chrome.png
Binary files differ.
diff --git a/test/screenshotter/images/LimitControls-firefox.png b/test/screenshotter/images/LimitControls-firefox.png
Binary files differ.
diff --git a/test/screenshotter/ss_data.json b/test/screenshotter/ss_data.json
@@ -20,7 +20,7 @@
"LeftRight": "http://localhost:7936/test/screenshotter/test.html?m=\\left( x^2 \\right) \\left\\{ x^{x^{x^{x^x}}} \\right.",
"LeftRightListStyling": "http://localhost:7936/test/screenshotter/test.html?m=a+\\left(x+y\\right)-x",
"LeftRightStyleSizing": "http://localhost:7936/test/screenshotter/test.html?m=+\\left\\{\\rule{0.1em}{1em}\\right.x^{+\\left\\{\\rule{0.1em}{1em}\\right.x^{+\\left\\{\\rule{0.1em}{1em}\\right.}}",
- "LimitControls": "http://localhost:7936/test/screenshotter/test.html?m=\\displaystyle\\int\\limits_2^3 3x^2\\,dx + \\sum\\nolimits^n_{i=1}i",
+ "LimitControls": "http://localhost:7936/test/screenshotter/test.html?m=\\displaystyle\\int\\limits_2^3 3x^2\\,dx + \\sum\\nolimits^n_{i=1}i + \\textstyle\\int\\limits_x^y z",
"NestedFractions": "http://localhost:7936/test/screenshotter/test.html?m=\\dfrac{\\frac{a}{b}}{\\frac{c}{d}}\\dfrac{\\dfrac{a}{b}}{\\dfrac{c}{d}}\\frac{\\frac{a}{b}}{\\frac{c}{d}}",
"NullDelimiterInteraction": "http://localhost:7936/test/screenshotter/test.html?m=a \\bigl. + 2 \\quad \\left. + a \\right)",
"OpLimits": "http://localhost:7936/test/screenshotter/test.html?m={\\sin_2^2 \\lim_2^2 \\int_2^2 \\sum_2^2}{\\displaystyle \\lim_2^2 \\int_2^2 \\intop_2^2 \\sum_2^2}",