Skip to content

Commit

Permalink
FIX: Resolved the issue #2530 (#2556)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashp116 authored Dec 2, 2024
1 parent b197950 commit 48447ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/formats/parse-math-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function parseMathExpression(
return `\\text{${m[1]}}${parseMathExpression(m[2], options)}`;
}

m = s.match(/^([^a-zA-Z\(\{\[\_\^\\\s"]+)(.*)/);
m = s.match(/^([^a-zA-Z0-9\(\{\[\_\^\\\s"]+)(.*)/);;
// A string of symbols...
// Could be a binary or relational operator, etc...
if (m) {
Expand Down
4 changes: 4 additions & 0 deletions test/math-ascii.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,8 @@ describe('ASCII MATH', function () {
equalASCIIMath('\\left\\lbrack1,1\\right\\rbrack', '[1,1]');
equalASCIIMath('\\left\\lbrace1,1\\right\\rbrace', '{1,1}');
equalASCIIMath('\\left(1,1\\right)', '(1,1)');

expect(convertAsciiMathToLatex('1/2')).toBe('\\frac{1}{2}');
expect(convertAsciiMathToLatex('(1/2)')).toBe('\\left(\\frac{1}{2}\\right)');
expect(convertAsciiMathToLatex('1/2sin x')).toBe('\\frac{1}{2}\\sin x');
});

0 comments on commit 48447ac

Please sign in to comment.