As a mathematician and educator, I find it convenient to use TeX/LaTeX for creating article manuscripts, books, tests and homework assignments, and classroom materials (using Beamer). Increasingly I have been using the Desire2Learn (or D2L for short, though the name seems to be changing to Brightspace) course management system in association with my teaching assignments. D2L enables me to upload formatted mathematics in PDF files which the students will see rendered using the built-in PDF viewer of D2L. However, if I were to develop online courses (as opposed to online ancillary resources to face-to-face classes) it might be nice to render mathematics within HTML pages created within D2L. This has the advantage of allowing the instructor to see directly what the students will see when they visit the page. The MathJax project makes this possible. I recommend anyone interested in MathJax read the excellent online documentation and see their examples. If you want to jump right in and live dangerously, create a file in a D2L course shell, click on the "HTML Source Editor" icon which may resemble </> and insert the following lines between the tags <head> and </head>:

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']],
    processEscapes: true}});
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  TeX: { equationNumbers: { autoNumber: "AMS" } }
});
</script>
<script type="text/javascript"
  src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

Only the last Javascript script is required. The first two enable the use of the dollar sign $...$ for inline mathematics and enable automatic equation numbering just as in LaTeX. A literal dollar sign may be escaped (\$) as in TeX/LaTeX. The only tricky part is remembering that you will create the page in the HTML Source Editor rather than in the D2L edit window. I have found that you can create just the mathematics portion on the HTML Source Editor, close that editor, and then create the rest of the text on the page in D2L's file editor window. The results are not perfect (for example, using the defaults the formatted mathematics has a font size approximately 20% larger than the surrounding text) but probably good enough for online work. If anyone has suggestions for improving the output of MathJax under D2L, please leave a comment.

2 Comments