# Writing Mathematical Expressions in Canvas Using LaTeX

An update coming to Canvas on Feb. 20th should be of interest to anybody involved in courses that use mathematical or chemical expressions, equations, and formulae. The update will enable MathJax, a JavaScript display engine that works in all modern browsers and was designed with the goal of creating a single, comprehensive, math-on-the-web platform.

Before this update, the best way to input mathematical formulae was to use the Math Editor built into the Canvas Rich Content Editor. The Math Editor functions in a similar way to the “Equation Editor” you might have used in Microsoft Word. To input a formula, you click from an array of buttons to do things like shift to an exponent, make a fraction, add an integral, input a Greek letter, etc. While it works fine, it is very cumbersome and slow to build equations in this manner – it might take you a couple dozen mouse-clicks to create a single formula!

The good news about MathJax is that it will enable users in Canvas to now use LaTeX (“lay-tech”) directly in any text field. LaTeX is a document preparation system that takes the guesswork out of typesetting – similar to how HTML works, LaTeX provides a markup language for writers to signify when they are using a mathematical expression, and then MathJax takes care of displaying it in a standardized and predictable way. Once you know the syntax, it makes mathematical expressions a lot easier to input in a way that ensures a reliable and high-quality display.

This update also means that you can now put mathematical expressions in places within Canvas that do not use the Rich Content Editor (e.g., into Titles, or into the Calendar).

See the following video for an overview of this Canvas update:

# Delineating Characters for LaTeX Display in Canvas

In Canvas, you can achieve either an inline or block display for your LaTeX expressions. You must let Canvas know you are using LaTeX by using specific “character wraps” or delineating characters around your LaTeX syntax. In the below examples, I have highlighted the delineating characters in red.

For inline display, to show the expression within a paragraph of regular text, you would use:

$$...$$

For block display, to set the expression into its own separate center block, you would use:

$$...$$

In both cases, you would add the LaTeX expression you want to display into the space between the wraps, where the “…” is shown.

Inline example:

The area under a curve is $$area = \int_{a}^b f(x)dx$$

Block example:

Using page 83 in your textbook, please also solve:
$$y=x^2$$
$$y = mx + b$$
$$\sqrt(s)$$

Here’s how it looks in the Canvas Rich Content Editor:

Here’s how it would display, after you hit “Publish” on the Page. Note the differences between the inline and block presentation:

You can input LaTeX into any Canvas text field, but keep in mind that inline display will work better in some areas than block display (such as within titles for Assignments or Pages).

# What If I Don’t Know How to Write LaTeX?

There are many resources to learn the unique syntax of LaTeX. Here are some suggestions.

## Basic (Canvas-based) LaTeX Resources

• If you use the Canvas Math Editor, you can toggle between Basic View (which does not show LaTeX) and Advanced View (which displays the LaTeX code of the equation you made in Basic View, and also allows you to type or paste LaTeX directly).
• For a basic list of expressions, symbols, operations, number sets, and Greek letters, see: Canvas Equation Editor Tips: Basic View
• For more advanced notations such as intervals, piecewise functions, arrays, determinants, matrices, tables, or special characters, see: Canvas Equation Editor Tips: Advanced View

## More Advanced (non-Canvas-based) LaTeX Resources

• For a quick (non-Canvas) online editor to write and test snippets of LaTeX, try: CodeCogs LaTeX Equation Editor.
• For information about the origins of LaTeX, and to download free software for writing documents using LaTeX, see: The LaTeX Project.
• A cloud-based solution for the construction of more complex documents through LaTeX is Overleaf. It does cost money to use, but there is also a free student option. More applicable to Canvas users, Overleaf does offer a good Guide to Mathematical Expressions that can help you achieve more detailed typesetting using LaTeX (if you reference this guide, note that Overleaf uses slightly different delineating characters than Canvas does!).
• The following video offers a nice introduction: Intro to LaTeX : Learn to write beautiful math equations

While there is a bit of a learning curve to picking up LaTeX, I promise it’s not as daunting as it may initially appear. And, if you spend a lot of time working with mathematical symbols, it’s definitely worth the effort to become familiar with it!

Photo by Karolina Grabowska from Pexels