Skip to content

Commit

Permalink
Merge branch 'ast-parse-format' of https://github.com/mathiash/khan-e…
Browse files Browse the repository at this point in the history
…xercises into graph-parabola
  • Loading branch information
beneater committed Feb 28, 2012
2 parents 6709299 + 45fa6f6 commit e9a6f54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utils/math-model.js
Expand Up @@ -421,8 +421,9 @@ jQuery.extend ( KhanUtil, {
text = "";
jQuery.each(n.args, function (index, term) {
var opIndex = index - 1;
if ((term.args && (term.args.length >= 2)) ||
if ((term.args && (term.args.length >= 2) && (term.op !== OpStr.POW)) ||
!((n.op === OpStr.MUL) && (term.op === OpStr.PAREN ||
term.op===OpStr.POW ||
term.op===OpStr.VAR ||
term.op===OpStr.CST ||
(exprIsNumber(prevTerm) && !exprIsNumber(term))
Expand Down
3 changes: 3 additions & 0 deletions utils/test/latex_output_tests.html
Expand Up @@ -151,6 +151,7 @@
{src:"\\sin(x)^2", ref:"\\sin^{2}( x) "},

{title:"Misc"},
{src:"a(b+c)",ref:"a(b+c)"},
{src:"-2\\times -3", ref:"- 2\\times - 3"},
{src:"\\sqrt{x}", ref:"\\sqrt {x}"},
{src:"\\sqrt[3]{x}", ref:"\\sqrt[3] {3}"},
Expand All @@ -170,6 +171,7 @@
{src:"a-b-c", ref:"a- b- c"},
{src:"a\\times b\\times c", ref:"a\\times b\\times c"},
{src:"abc\\times def", ref:"abc\\times def"},

{title:"Mixed expressions"},
{src:"--a", ref:"- - a"},
{src:"a+-b", ref:"a+ - b"},
Expand All @@ -181,6 +183,7 @@
{src:"x^{2+3}", ref:"x^{2+ 3}"},
{src:"x^{y^{z}}", ref:"x^{y^{z}}"},
{src:"1+2-3+4", ref:"1+ 2- 3+ 4"},
{src:"2(x+y)^2", ref:"2( x+ y) ^{2}"},

{title:"Colors: single term, no braces"},
{src:"#2", colors:[PINK], ref:"\\color{#FF00AF}{2}"},
Expand Down

0 comments on commit e9a6f54

Please sign in to comment.