Skip to content

Commit

Permalink
Merge pull request #1 from delftswa2017/fix-issue-980
Browse files Browse the repository at this point in the history
Fixed issue 980
  • Loading branch information
John-Pap authored Feb 23, 2017
2 parents 9dd3818 + 7733aeb commit 06f2a72
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions notebook/static/notebook/js/mathjaxutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ define([

// MATHSPLIT contains the pattern for math delimiters and special symbols
// needed for searching for math in the text input.
var MATHSPLIT = /(\$\$?|\\(?:begin|end)\{[a-z]*\*?\}|\\[\\{}$]|[{}]|(?:\n\s*)+|@@\d+@@)/i;
var MATHSPLIT = /(\$\$?|\\(?:begin|end)\{[a-z]*\*?\}|\\[{}$]|[{}]|(?:\n\s*)+|@@\d+@@|\\\\(?:\(|\)))/i;

// The math is in blocks i through j, so
// collect it into one block and clear the others.
Expand Down Expand Up @@ -178,6 +178,11 @@ define([
end = block;
braces = 0;
}
else if (block === "\\\\\(") {
start = i;
end = "\\\\\)";
braces = 0;
}
else if (block.substr(1, 5) === "begin") {
start = i;
end = "\\end" + block.substr(6);
Expand All @@ -200,7 +205,9 @@ define([
//
var replace_math = function (text, math) {
text = text.replace(/@@(\d+)@@/g, function (match, n) {
return math[n];
return math[n]
.replace("\\\\\(", "\\\(")
.replace("\\\\\)", "\\\)");
});
return text;
};
Expand Down

0 comments on commit 06f2a72

Please sign in to comment.