Using LaTeX with the New Canvas Quiz Engine

Using LaTeX with the New Canvas Quiz Engine

Using LaTeX with the New Canvas Quiz Engine 800 601 mathgrrl

Okay. Deep breath. It’s time to start figuring out how to teach online.

I mean, how to do Actually Do It Well, not just as an emergency solution thrown together over a frenzied and sleepless week. There is a lot to work to do, so let’s start with something small: online math quizzes.

Here’s what I’m working with:

  • At some point I’ll want to give students an online quiz or test, for a grade;
  • My university is already using the Canvas LMS, which has quiz and gradebook and auto-grading functionality; and
  • If I can’t use LaTeX for math typesetting I swear I will have to burn something down.

If this describes you too, then store this post somewhere safe so you can find it when you get around to making Canvas quizzes and want to use LaTeX!

Canvas Quiz Engines

Canvas has a new quiz engine that you can turn on in Settings and then choose (or not) for any new quiz. Some of the features are quite nice and some of the formatting is a bit better. It’s still Canvas but… it’s better, I think.

For example, there are new question types like “Stimulus Questions”, where you can display content on the left side of the screen and ask questions about it on the right. I’m hoping I can use questions like this to make quizzes whose answers are more difficult to look up online during the quiz (this problem was taken from my favorite Calculus textbook):

Yes, this Stimulus Question thing is just horizontally reformatting something which we could previously have done vertically, but it looks cool. There are a bunch of other interesting question types in the new Canvas quiz engine that I’d like to be able to use, provided I can still use LaTeX.

Using LaTeX with the new quiz engine

In the example question above, I used a screenshot of a LaTeX-ed question from the book and embedded it into the problem as an image. That’s fine, but if you want to actually use LaTeX on a regular basis in your quiz questions, then you need to be able to type it.

The new Canvas quiz engine has an equation editor called Mathquill, which is kind of nice if that’s your thing. You get to it by selecting the fx symbol at the end of the toolbar in any content editing window:

But Mathquill is not nice if your thing is typing 80 words a minute in LaTeX. Here’s the mess that happens if you close your eyes and type \lim_{x \to \infty} \frac{1}{\sin^2 x} into the Mathquill editor:

Basically, Mathquill tries to render your LaTeX code on the fly, which forces you to stop typing LaTeX and switch to the WYSIWYG equation editor, mid-expression.

If you *paste* LaTeX code into the Mathquill window then it works, which is good for cutting and pasting existing content into Canvas quiz questions, but not for typing new problems.

The key to getting LaTeX to work with the new Canvas quiz engine is to type it directly into the edit window using the delimiters “\(” and  “\)“. You can add \displaystyle inside the delimiters if you want fancy inline formatting, or use $$ delimiters if you want your expression centered on its own line. Here’s what your LaTeX will look in the edit window:

You can mix LaTeX and regular text just by popping in and out of the delimiters. This appears to work in any edit window, including in multiple-choice answers, which is great! Here’s what the completed problem looks like in the quiz:

Using LaTeX with the old quiz engine

If you want to stick with what you know and stay with the old Canvas quiz engine, you can use LaTeX there too. From any content field editor, click on the “square root” symbol to open the math editor:

Then inside that pop-up editor you can type any LaTeX code you want, and it will be live-previewed underneath. Be sure you’re in Advanced View if it doesn’t come up by default (click “Switch View to Advanced” if you see that on the upper right of the text box).

You can use LaTeX in the multiple choice options in the old engine as well, but it’s tricky to find; in order to get to a proper edit window with a “square root” button, you have to click the pencil icon that is way to the right and outside of the text box for the multiple choice answer:


Just use “\(” and “\)” delimiters, pretty much anywhere. Don’t try to use MathQuill. Have a great day :)

What’s next?

I don’t know. There is a lot to figure out. Stay tuned, and if I think of anything else worth sharing as I work through endless online resource options and problems, I’ll let you know!


As an Amazon Associate we earn from qualifying purchases, so if you’ve got something you need to pick up anyway, going to Amazon through this link will help us keep Hacktastic running. Thanks! :)

  • Thank you so much for your post. I am using the new quizzes on Canvas and I have spent so much time trying to get my limits to look like yours! I typed in exactly what you have but I cannot get the limit and what it is approaching to stack. No matter what I try the x goes to infinity part comes subscripted but to the right of the lim… any idea what I am doing wrong?

    Thanks for your time!

    • Hi Angie,
      My reply is probably coming way too late to be of use to you, but I do have an idea. You could try adding \displaystyle right before the limit and that might work?

    • Try typing this for LaTeX code:

      \lim\limits_{x\to\infty} blah

      This fixed it for me in a regular LaTeX document, so it may be useful here.

  • What do the H and P mean

  • Thank you so much. I was so frustrated not being able to use my beloved LaTeX code on this new Canvas quiz format, but this method works great!

Leave a Reply

Back to top