WP-Courseware LaTex Integration

Background:

Tried Quiz Master Next plugin for WordPress with some Math quizzes with success. However, this plugin has no feature to let users to upload image file for quiz, i.e. if there are some non-multiple choice question and need to review student’s steps, then this plugin is not enough.

Then purchased a Learning Management plugin by Flyplugins called WP-Courseware to accept upload image as the written answers with student’s working steps and to extend the quiz feature to a full function learning management system.

Issue:

Unlike Quiz Master Next plugin, WP-Courseware has no built-in LaTex rendering feature. To present Math formulae into a question, there must be a separate LaTex rendering mechanism, among several solution, I picked MathJax-LaTex plugin as it includes the AMSMath package, but after testing several scenarios, all are fine except after submit answers, the quiz result cannot render the LaTex shortcodes, probably because after the quiz result page is loaded dynamically via AJAX. It is interesting that after a hitting on the reload button, the LaTex will then be nicely rendered.

Solution:

After searching on web, it is a known that for MathJax to handle dynamic content, a MathJax reload is required. Actually a suggested function below may cure this issue:

MathJax.Hub.Queue([“Typeset”,MathJax.Hub]);

I tried to include this to the Header.php of the activated theme, but failed with a total white screen. According to the developer of WP-courseware – Flyplugins, it is logical to place the above function call in wpcw_front.js as the suggested code is javascript function call. After placing it in line 380 immediately before function: quizHandler_setup(), it works brilliantly.

Credit has to be given to Flyplugins’ Ben Arellano who responded to my query promptly and finally advised where to insert the javascript function.

Config:

  • WordPress   4.1.1
  • WP-Courseware   3.2
  • Quiz Master Next 4.1.0
  • MathJax-LaTex  1.3.3

Tricks:

  1. Flyplugins has no idea on LaTex support and proficiency in MathJax. And they originally did not believe LaTex would work on WP-Courseware! Without try-and-error, LaTex integration with WP-Courseware is unachievable.
  2. short code \( \small{[ \text{latex} ] \dots [ \text{/latex} ]} \) should be compatible with MathJax-LaTex and WP-Courseware, however, the questions using this shortcode is fine, but even adding the MathJax queue function stated above, the quiz result within this shortcode still cannot be rendered, only using equivalent short code \(\small{\backslash (\; \dots \backslash )}\) works fine. Together with the short code \(\small{\backslash [\; \dots \backslash ]} \) (that forces line break and horizontal centre aligned), there is good enough control provided by the MathJax-LaTex plugin.
Close Menu