commit 76d87e8f90719c1fa87fbcbbdebe7fc38ed745e1
parent 4a507c40f13c8ec2395460a0893be7173dfcc59a
Author: Kevin Barabash <kevinb7@gmail.com>
Date: Wed, 29 Jul 2015 09:05:39 -0700
Merge pull request #319 from JeffEverett/fix_limit_controls
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}",