Using LaTeX in LearnDash

By: Justin Ferriman • April 17, 2018
Filed Under:

Yes, you can use LaTeX for math equation in LearnDash.

One question we often receive is if it is possible to use LaTeX for creating math equations, particularly in a quiz for both the question and possible answer selections.

I am happy to say that this is indeed possible, and it is easier than you think! 🙂

Step 1: Install the free MathJax LaTeX plugin

This is what makes the entire use of latex in LearnDash a reality.

The MathJax plugin makes it possible to render embedded latex or mathml in your LearnDash quizzes.  With MathJax installed, you may embed latex using simple shortcodes. Here is one example:

[latex]E=mc^2[/latex]

Step 2: Add this code snippet to your theme’s functions.php file

Copy this code snippet. In it you will find code that you should copy and paste into your theme’s functions. Make sure you take a backup of your site before doing so just in case!

Specifically, this snippet makes it possible to use latex in places like the “incorrect” and “correct” messages of a quiz. If you don’t need that for your quizzes then you can actually skip this step.

Step 3: Install LearnDash and create your quiz!

You can now begin creating a quiz.

When you need to use latex, then just follow the format outlined in Step 1.

Are there any limitations?

While the above steps will get you a long way with using latex in your LearnDash quizzes, there are some limitations.

For instance, latex cannot be used for Fill in the Blank and Assessment question types. It will work for the other options.

The other key limitation is related to the MathJax plugin.

The MathJax javascript needs to be delivered either from your own server, or you can use a CDN (Content Distribution Network) such as CloudFlare. The latter what MathJax recommends as it is considered more reliable compared to hosting the javascript and configuring the library yourself.

In some cases we have heard reports of the latex conversion being delayed. This is because the MathJax plugin has to call a CDN to download some of the javascript.

That’s it!

The above steps have worked well for many LearnDash users and is definitely worth trying if you want to use latex in your quizzes.

If you have questions regarding MathJax or need assistance in its configuration then please contact MathJax Support.

Justin Ferriman

Justin started LearnDash, the WordPress LMS trusted by Fortune 500 companies, major universities, training organizations, and entrepreneurs worldwide. He is currently founder & CEO of GapScout. Justin’s Homepage | GapScout | Twitter