Incorporating maths expressions (LaTeX notation) to SMF 2.x

Started by Ian Wild, June 16, 2018, 01:58:42 PM

Previous topic - Next topic

GigaWatt

Maybe one of the two sites I mentioned used this proprietary solution ???... who knows :). Well, for what it's worth, I hope it was the IEEE redirect :D... that editor was so cool, before it's time... this was back in 2007, 2008... I think... and it was fluid and responsive and the cursor was not just jumping from item to item, it had arrow keys integration and it did exactly what you wanted it to. Very similar to a regular text editor :).

EDIT: I don't think you can cut out anything :S... I think they're vectorized... part of a font :S... that's why the mod is so big :S. You could probably cut down on font solutions (different types of appearance of the same equation), I think that would be doable ;).
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Ian Wild

Thanks again for checking this out. I'll have a look at the issue with the \DifferentialDx tag not rendering properly. I'm suspecting that this is to do with the MathJax plugin (which would render the LaTeX) rather than the LaTeX that's being generated. But, again, I'll check this out.

GigaWatt

I found the mathrm{d}x notation while searching online for "derivative LaTeX code" trying to fix the "Undefined control sequence" error. That is supposed to be the default LaTeX notation tor form a differential at the end of the equation. Has the default notation for a derivative/differential changed in LaTeX? Since that (\DifferentialDx) is the LaTeX code that the equation editor generated.
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Ian Wild

Hi GigaWatt,

As mentioned previously, I'm using the MathJax plugin to render LaTeX but, just looking quickly through the list of supported commands [nofollow], I can't see \DifferentialDx. How you typeset the dx is a bit of a minefield anyway (for example see this tex.stackexchange.com thread [nofollow])

I still haven't heard from the author of the fMath plugin so I think I'm going to put together another mod based on MathQuill (I should be able to refactor the most of the code).

EDIT: I've changed the verification questions on the YourMathsTutor forum. Thanks for that advice!

GigaWatt

Yeah, I can't find the command on the MathJax list either, but that's what the editor wrote when I automatically (through the buttons of the editor) chose an integral with an exponent.

And this is what your second link (regarding typesetting) suggests.

operatorname{d}

Which is exactly what I did manually.

mathrm{d}x
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Ian Wild

Hi again,

I've just had a response back from the developer of the fMath editor (Ionel Alexandru) to say that he's happy with the way I'm using it (along with the well-deserved attribution to his work, of course) so I'll have a go at submitting the mod back to the community at the mod site now...

Thanks all :D

GigaWatt

Did you check the problem with the differential at the end of an integral?
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Ian Wild

Hi GigaWatt,

Oh yes you're right: I'd forgotten about that. Also, I need to make sure there are no redundant files in there and that the JS is minimised.

I'll let you know when I get those issues sorted.

Thanks again,

Ian.


GigaWatt

"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Ian Wild

So I've been taking a deeper look into the issue with '\DifferentialD' and I think the issue is that the MathML specification says we should be using the ⅆ entity but the rest of the world (it seems  ::) ) says that really we should be using 'upright d'. I'm using the MathJax mod to render the math notation and the issue with 'DifferentialD' has been discussed there too (see https://github.com/mathjax/MathJax/issues/1237 [nofollow])

For example, in LaTeX an anti-derivative would, usually, be something like:

\int x^4 \mathrm{dx}

... although there doesn't seem to be an agreement on this.

Internally the fMath editor is using MathML so the move away from the DifferentialD entity to '\mathrm' markup was looking tricky :o so I replaced it with the letter 'd' ;D

I'll send an email to Ionel (the fMath editor's author) later to see what he thinks about all of this. I guess the other alternative is to filter the LaTeX returned by the editor but that just seemed a little bit clunky.

Anyway, I've updated the plugin on the Your Maths Tutor website. There are a couple more configuration improvements I'd like to make and then I'll try submitting it to the mod site.

Thanks again guys for your help :)

GigaWatt

"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Ian Wild

Hi all,

I now have a new version of the fMath plugin, available from https://luminaconsultancy.com/?attachment_id=184 [nofollow], that not only uses 'Latin d' instead of the &DifferentialD entity for derivatives but also includes the following changes:

1) New configuration options to allow an administrator to specify 'open', 'inline open' and 'close' tags - what these are will depend on the LaTeX filter you have installed.
2) A checkbox on the editor to allow you to specify if you want inline notation.





I've also minified the main fMath script which will obviously speed things up for end users but didn't make a lot of difference to the overall size of this mod  :o

I'll have a go later at submitting it to the mod site :)

Cheers,

Ian.

Ian Wild

After a discussion here about how stupidly big this mod was originally (due to fMath editor's 50Mb footprint) I've split the package into a wrapper mod (which is a standard SMF package) and a separate editor repository, available on GitHub, which will need to be installed separately.

I've submitted it to the mod folks so hopefully everything will be okay with it!

Thanks again guys for your help :)

Advertisement: