Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/converters/latex-to-ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ import flatten from './flatten';


// Some of the latex commands that lead to spacing
const whitespace_rule = '\\s|\\\\,|\\\\!|\\\\ |\\\\>|\\\\;|\\\\:|\\\\quad\\b|\\\\qquad\\b';
const whitespace_rule = '\\s|\\\\,|\\\\!|\\\\ |\\\\>|\\\\;|\\\\:|\\\\quad\\b|\\\\qquad\\b|\\\\text{.*?}';

const latex_rules = [
['[0-9]+(\\.[0-9]*)?(E[+\\-]?[0-9]+)?', 'NUMBER'],
Expand Down
3 changes: 2 additions & 1 deletion spec/quick_latex-to-ast.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import { ParseError } from '../lib/converters/error';
var converter = new latexToAst();

var trees = {

'1 * 3\\text{eggs}' : ['*', 1, 3],
'\\frac{1}{2} x': ['*',['/',1,2],'x'],
'\\frac{1}{2\\text{foo}} x': ['*',['/',1,2],'x'],
'1+x+3': ['+',1,'x',3],
'1-x-3': ['+',1,['-','x'],['-',3]],
"1 + - x": ['+',1,['-','x']],
Expand Down