Created
June 25, 2016 01:52
-
-
Save laughinghan/1aaf578ba2c7b0ac07ee162083e76bf8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/commands/math/commands.js b/src/commands/math/commands.js | |
index 483d591..1226d69 100644 | |
--- a/src/commands/math/commands.js | |
+++ b/src/commands/math/commands.js | |
@@ -333,8 +333,8 @@ var SummationNotation = P(MathCommand, function(_, super_) { | |
function simplify(latex) { | |
return latex.length === 1 ? latex : '{' + (latex || ' ') + '}'; | |
} | |
- return this.ctrlSeq + '_' + simplify(this.ends[L].latex()) + | |
- '^' + simplify(this.ends[R].latex()); | |
+ return this.ctrlSeq + '_' + simplify(this.blocks[0].latex()) + | |
+ '^' + simplify(this.blocks[1].latex()) + this.blocks[2].latex(); | |
}; | |
_.parser = function() { | |
var string = Parser.string; | |
@@ -343,7 +343,7 @@ var SummationNotation = P(MathCommand, function(_, super_) { | |
var block = latexMathParser.block; | |
var self = this; | |
- var blocks = self.blocks = [ MathBlock(), MathBlock() ]; | |
+ var blocks = self.blocks = [ MathBlock(), MathBlock(), MathBlock() ]; | |
for (var i = 0; i < blocks.length; i += 1) { | |
blocks[i].adopt(self, self.ends[R], 0); | |
} | |
@@ -354,7 +354,9 @@ var SummationNotation = P(MathCommand, function(_, super_) { | |
block.children().adopt(child, child.ends[R], 0); | |
return succeed(self); | |
}); | |
- }).many().result(self); | |
+ }).many().then(block).then(function(summand) { | |
+ summand.children().adopt(blocks[2]); | |
+ }).result(self); | |
}; | |
_.finalizeTree = function() { | |
this.downInto = this.ends[L]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment