mitodl / mitx-grading-library

The MITx Grading Library, a python grading library for edX
https://edge.edx.org/courses/course-v1:MITx+grading-library+examples/
BSD 3-Clause "New" or "Revised" License
14 stars 9 forks source link

Typing lambdabar gives a math error #181

Closed jolyonb closed 5 years ago

jolyonb commented 5 years ago

Oh Asciimath, why do you taunt us so?

jolyonb commented 5 years ago

Here's a new one: deltaE+ gives a math error too.

ChristopherChudzicki commented 5 years ago

Without our preprocessEqn

similar to lambdabar:

Seems a group ending in any math-over symbol is bad.

similar to deltaE+:

Asciimath seems to parse these expressions just fine. It's mathjax that isn't rendering them. I should learn more about mathjax and edX's configuration in particular...

jolyonb commented 5 years ago

I think edX's MathJax version is somewhat out of date. They're planning to update it with the python3 push, so perhaps this isn't worth figuring out just at this moment.

ChristopherChudzicki commented 5 years ago

Re lambdabar, Asciimath wants barlambda for "lambda with a bar on top". I'm guessing you want physics lambdabar, though, in which case we should do it like hbar and use this unicode symbol: https://www.fileformat.info/info/unicode/char/019b/index.htm

I'm out till this afternoon.

jolyonb commented 5 years ago

Yeah, I do convert it to unicode. I'd just like to stop math processing errors from displaying!

jolyonb commented 5 years ago

So, edX appears to be using MathJax 2.7.5, which is the latest version. However, all of these issues appear to be fixed in the latest version of AsciiMath (http://asciimath.org/) and MathJax (https://www.mathjax.org/#demo), so there seems to be a bug in the edX configuration. I don't think this is something we should be worrying about; I've reported the bug to edX.

ChristopherChudzicki commented 5 years ago

OK. Still, do you want

// This is lambdabar, angular wavelength
      AM.newsymbol({
        input:"lambdabar",
        tag:"mo",
        output:"\u019b",
        tex:null,
        ttype:AM.TOKEN.CONST});

in our default updateMathJax()? This works fine in edX for me for generating

Screen Shot 2019-07-04 at 7 13 05 PM

(Although {:deltaE:}+{:lambdabar:} still gives a mysterious error on edX, but not on MathJax preview site.)

jolyonb commented 5 years ago

Not in the default. I currently do

eqn = eqn.replace(/lambdabar/g, '\u019B');

to make it work, which works fine.

That last one you found is really annoying... changing lambdabar to hbar also has the error. I don't think there's much to be done though :-(