Math integration into some content types!
i'd like to share with you my little project. I integrated math formula support into some (the ones I wanted most) content types, by writing a dependency that loads KaTeX (because MathJax was too slow in a test I ran more than a year ago - haven't tried again - when elements are dynamically created, e.g. drag questions with infinite dragabbles, dialog card turn) and watches for changes in the DOM to render math formulas. Here is a overview of some key facts:
- You have to enclose LaTeX formulas in $$, e.g. $$x^2$$ for an inline formula (different form KaTeX default, that does a non inline with that command, enabling $ was no option, like it is in LaTeX).
- Formulas are only rendered in some Editors (e.g. Drag n Drop) and not in the Text input fields - which is not what y'd like, I know, but works for me, since the user doesn't see that, only the creator and I can read LaTeX.
- Technically it is enough to add the dependency, but since that would be overwritten by updates to the original content types I cloned the conent types and prefixed them with (KaTeX) so I can use it on our server without interfering with anything else.
Supported Content Types: InteractiveVideo, QuestionSet, SingleChoiceSet, TrueFalse, Blanks, MarkTheWords, MuliChoice, DragText, Drag&Drop, DialogCards
- There is one exemption from the point above: I had to rewrite self.clearScorePoint in word.js from MarkTheWords, because it removes all childs and just leaves text - since a renderd formula is a child it got removed too.
- The attached file only includes the changed content types, you have to have the original content types installed so that the dependencys of the original content types are present - I didn't change those.
- Please test on some testing installation before uploading it to your production server as I did not do much testing (yet) - and let me know about bugs you find.
Hope you like it :)