\(\LaTeX\) and Learning Management Systems

The goal of this post is to maintain some hopefully useful information about what support currently exists in popular Learning Managment Systems (LMSs) for displaying mathematics using LaTeX mathematics code, which is the standard for modern for communicating science and mathematics in modern research. If you are new to LaTeX, I suggest reading the introduction at overleaf.com. Overleaf is itself a great resource for communicating mathematics online, and they have robust LaTeX documentation.

I have far more to say about Blackboard than I do any other LMS because it is the system my institution uses. I have spent a significant amount of time figuring out how I might best communicate math on Blackboard, with moderate success. However, I have also tried to collect in this post useful links and factoids regarding LaTeX on other LMSs. If you have information to share, I encourage you to reach out to me.

There is a lot of general discussion before I go into each individual LMS, so if you mainly want to see what — if anything — I have helpful to say about your LMS, you should start by finding it in the Table of Contents and jumping to that section. (If it is not in the table of contents, then sadly I do not know anything useful about it! Please feel free to share!)

Preliminary Considerations

Built-In Support vs. MathJax vs. Other

I definine “built-in” support as any system internal to the LMS which converts LaTeX to displayed mathematics. The good news is that just about every (LMS) has some built-in support for displaying mathematics. The bad news is manifold:

  • different systems have different solutions, that work or don’t work in different ways;
  • built-in solutions may be slow, buggy, poorly readable, and may or may not have good accessibility support;
  • some systems have multiple solutions, which may be confusing;
  • good, clear, thorough documentation can be hard to find.

MathJax is a javascript framework for displaying mathematics online. Having been in development for over a decade, MathJax has grown into a reliable and versatile system for modern mathematics communication online. It is the closest thing to a standard for online mathematics communication and used widely by online platforms.

Most LMSs seem to have some mixture of built-in or MathJax support; for some, such as Brightspace, the built-in system utilizes MathJax. There are other ways to bring mathematics into your LMS. For example, if you use Google Docs and your LMS supports the “iframe” tag, then you can create documents using the “Auto-LaTeX Equations” add-on for Google Docs, and include that in your webpage. This add-on uses an alternative solution, provided by codecogs.com.

LaTeX vs. MathML vs. Other

While LaTeX is an incredibly effective format for writing out mathematics that is to be typeset, it is not the only one, and it is not ideal for all circumstances. The modern standard for storing mathematics on the web is MathML. But MathML is intended to be neither human-writable nor human-readable. It is an intermediary language, designed for storage and transport. Web browser support for MathML is spotty: for example you will find that if you ask MathJax to render as MathML in Chrome, you will receive a warning that Chrome does not support MathML. Similarly, in Firefox, you will receive a warning that Firefox’s MathML renderer is not as full-featured as MathJax’s.

It is worth being aware that are other mathematical mark-up languages in existence. For example, AsciiMath, which is supported by MathJax, presents a simplified method for creating mathematics.

Your Home Environment

Each institution has its own install of its chosen LMS, which was possibly chosen without ever considering how well it really supports mathematical communication. Different installs may have some features enabled or disabled; there may be custom code that supports or inadvertently inhibits good mathematical communication. Different LMSs may support different integrated learning tools, though there is a standard, called Learning Tool Interoperabilitys (LTI). Finally, institutions may make mandates, such as only using platforms supported through directly the LMS, to avoid instructors overwhelming students with dozens of different platforms.

In short, each instructor has a somewhat unique environment in which they are operating, and which they must figure out how to bend to their specific needs. It may take some time exploring to figure out whether or not a given solution will be appropriate to your desires, and it is very possible that an ongoing communication with your institution’s IT and/or Educational Technology Services may be necessary to accomplish what you need.

Equation Editors?

This post will not discuss the use of equation editors. Most systems seem to have some equation editor available, which may be sufficient for an instructor’s purposes. However, in my experience, the use of a graphical interface is simply not an effective way to generate the mathematics needed in math-heavy discussions. This issue is compounded when systems require multiple windows or tabs to be opened and closed while trying to create equations.

Equation editors can be extremely helpful. They have a lower barrier to entry, so a person does not have to try to learn LaTeX code and mathematics at the same time. This can make mathematics communication much more accessible to people who do not “speak LaTeX,” especially students. But for a person who has spent the time to learn LaTeX math code (and who has gotten comfortable with searching out more esoteric commands quickly), I do not believe equation editors can match the efficiency and robustness of straight LaTeX.

Some equation editors do support LaTeX, and can convert back and forth between code and the displayed mathematics. For example, WIRIS makes a widely used editor, which claims to support LaTeX. In my home environment, it does not seem to be functioning, however.

The Learning Management Systems

Blackboard

Blackboard Built-In Support

It is telling that a web search “site:www.blackboard.com latex” (which searches for the term “latex”, but only returns results from blackboard.com) returns zero results. It is also telling that when one searches without restricting to blackboard.com, one finds many results from individual institutions specifying how they have dealt with the problem, and what steps their faculty and students may need to take in order to make LaTeX mathematics work.

Blackboard however does support built-in LaTeX by the use of double-dollar signs $$:

LaTeX code in a Blackboard item textbox.

If you are lucky, each piece of error-free LaTeX code will be displayed as an image when the post is created. Below are some examples:

Mathematics displayed as images generated by Blackboard.
Mathematics displayed as images generated by Blackboard.
Image displaying calculation of product rule using built-in Blackboard LaTeX support.
Image displaying calculation of product rule using built-in Blackboard LaTeX support.

If you are not lucky, the mathematics may not display. For example, you may see something like this:

Broken mathematics shows "broken-image" link and alt-text.
Broken mathematics shows “broken-image” link and alt-text.

The image above shows that the built-in engine was able to interpret the mathematics, since it generated the correct alt-text, but for some reason Blackboard was not able to generate the images for some of the mathematics. It seems that after a minute or two, the correct mathematics images load when one refreshes the page. This illustrates the main issue with built-in LaTeX support in Blackboard — it is unpredictable and possibly unreliable. Even when it does work, there are some serious deficiencies:

  • You can judge for yourself from the images how readable they are and how well they fit interspersed in text. Blackboard does seem to support inline mathematics using the same $$ delimiters, but you’ll notice that the mathematics is offset slightly from the text making it unattractive.
  • It takes time to load the images, and Blackboard does not handle this well from the user’s perspective. When one clicks “Submit” on a post, there is no indication that anything has happened. One may notice eventually a small “Waiting for blackboard…” message to pop-up at the bottom of the web browser. But Blackboard itself does nothing to tell the user what it is doing. This process can take some time, even for a few simple pieces of mathematics, one can expect to wait 20 to 30 seconds with no feedback.
  • While valid LaTeX code should re-appear in the editor when you re-open it to edit a previously created message, invalid code only shows a “broken image” icon and a message that there was an error in the conversion. When you re-open the editor, the invalid code is gone. So any code that has an error in it has to be re-typed from scratch. For anything but the most minor code, this is a huge burden to any person who isn’t always perfect. One solution is to always keep a “local” copy of any post one is creating, so that if it disappears from Blackboard, you always have it and can copy it back. In fact, completely outside the context of mathematics, this recommendation was made to me for any large post to Blackboard, since Blackboard can be buggy in any context. I have lost posts before due to bugs in Blackboards text editor that had nothing to do with mathematics.
  • The images are “PNG” (portable network graphics) files, which are a nice format, but they are not scalable. Scalable vector graphics (SVG) would be better, since they would not lose quality when zooming in. Even at the standard zoom, the PNG images appear somewhat blurry for some reason. Its not clear why these lower quality renderings should be used. Wikipedia, for example, displays mathematics as images by default, and its visual integration with the text is quite nice.
  • It can become rather difficult to read what one is typing, and newlines cannot be used in the rich text editor to help make the code more readable, since this will prevent it from being interpreted as mathematics. (The newlines in the rich text editor add html <p> tags, which interfere with the $$ delimiters.) It may help to edit the raw HTML code by clicking the “HTML” button, so that you can make it more readable as you enter it, but be aware that the first thing Blackboard will do is strip away any newlines, potentially rendering much of your formatting useless if you need to revise any of it later. A better solution is to keep a local version of the message in a file on your computer — perhaps have a “blackboard posts” folder in the folder for your course. Then you can edit it in whatever text editor you prefer, make your math code as readable as you like, and there is less chance of your formatting or your work getting lost.

Blackboard – MathJax Support

Blackboard does not technically support MathJax. The good news is that, for the most part, it does not get in your way. The bad news is that it does get in your students’ way. That is, when an instructor creates a “Content Item” in Blackboard, or edits the description of some other item they create, they can switch from the default richt-text editor to the HTML code editor (by finding and clicking the “HTML” button). They can then insert a javascript call to a MathJax implementation:

<script type="text/javascript"
   src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-AMS_CHTML-full">
</script>
<p>
Display math: \[5^2\]
</p>
<p>
I want to talk about \(x^7\) now:
</p>

Here is an example of MathJax output in Blackboard:

MathJax output in Blackboard.
MathJax output in Blackboard.

Unfortunately, while Blackboard does not prevent an instructor from including javascript in the HTML code for a posting, it does seem to prevent it from functioning in both discussion board posts and test questions.

Another issue to content with is that Blackboard will modify any HTML code entered by the user. For example, it immediately strips away any newlines placed in HTML code, as mentioned in the section on built-in support. Even worse, often a MathJax user may want to insert some configuration code, such as:

MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [['\\(','\\)']]
    },
...

This code can be used to set up delimiters, set up cross-referencing, or other customizations. Unfortunately, Blackboard wraps in this in a “CDATA” block, and replaces some characters with their HTML codes, as seen below:

<script type="text/x-mathjax-config">/*<![CDATA[*/
/**/
/**/
MathJax.Hub.Config({
    tex2jax: {
        inlineMath: [[&#039;\\(&#039;,&#039;\\)&#039;]]
 ...  

This means that any MathJax configuration code needs to be re-adjusted to fix anything changed by Blackboard if one wishes to edit previously submitted code. As with writing for the built-in interpreter, the simplest solution seems to be to keep a local copy of the MathJax code, including the call and configuration. As a bonus, if one saves it as an HTML file, the local can be opened in a web-brower as a preview. For example, the following code saved as a text file entitled “test.html” should open in Chrome, Firefox, or Edge, with the mathematics nicely rendered:

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
    CommonHTML: {
        scale: 88,
        mtextFontInherit: true,
    },
});
</script>
<script type="text/javascript"
   src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-AMS_CHTML-full">
</script>
    <p> \[\frac{3}{5}\cdot 1.5 = \frac{3^3}{10}\]</p> 

There is some additional good news here. With MathJax, you can use code such as the following to insert \newcommand macros:

<div class="hidden-content" style="display: none;">
  \(\newcommand{\inv}{^{-1}}\)
</div>
<p>
  \[ f(x) = y \iff f\inv(y) = x. \]
</p>

This, for example, will enable you to use the command \inv to conveniently display the “-1 power” notation for an inverse:

illustration showing that a LaTeX \newcommand macro functions when placed in a hidden "div" block.
We can use macros!

Brightspace

The Brightspace documentation notes that it uses MathML and MathJax to store and render mathematics. The documentation includes an overview page discussing LaTeX mathematics in the text editor, as well as a page with some additional details on LaTeX.

Here is a 2015 blog post by Brandon Grasley on his efforts to use LaTeX in D2L. It is a few years old, so it may be out of date.

Canvas

Canvas seems to have built-in support for using LaTeX by switching to the “Advanced” view in its Math Editor, according to this April 2020 article. The article links to PDF files including references for basic symbols, information on more advanced editing (including things like piecewise functions and matrices), and information on chemistry.

In an April 2020 discussion on accessibility issues with the Math Editor, there is a link to a post noting that Canvas account administrators can include javascript. This would enable MathJax to work for an entire site.

Moodle

Moodle supports features through a system of “filters“. In fact, Moodle has filters for both “built-in” LaTeX and for MathJax.

  • Documentation for the Moodle MathJax Filter. The documentation claims that this is enabled by default.
  • Documentation for the Moodle TeX Notation Filter. The output of this filter depends on how the system is set up, since the site administrators may have (ideally) installed binaries supporting compilation, as noted in the documentation, or it may rely on a fallback binary distributed with Moodle.

Interestingly, the documentation notes that as of version 2.8 both filters can be enabled and work at once, with the TeX Notation filter first displaying images and then having the MathJax images replace the TeX Notation when ready.

The Moodle Documentation includes a page for Using TeX Notation.

Sakai

Sakai has an information page for enabling LaTeX support.

Schoology

Schoology has built-in LaTeX support through an option in its “Insert Content” menu in its editor. I have found little other discussion of it, aside from a recent bug report, which seems to have been resolved.

An Alternative: Embedded Pages

If your LMS enables you to include HTML iframe tags, then you may be able to host your mathematics documents on an external site and embed that document in your LMS content with an iframe. This is possible within Blackboard, for example. Note that it may be the case that only https pages can be embedded. If you have a place to host files that uses https, then you can simply upload files there, using MathJax to display the mathematics, and then embed this in an iframe. Alternatively, Google Docs, Sheets, and Forms can be embedded in iframes. The Auto-LaTeX Equations add-on enables the inclusion of LaTeX mathematics through the use of codecogs.com, a popular alternative to MathJax for generating mathematics images online.