The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December. Read our blog post for more info about this change.
Hello. please help me
How to add a question with mathematical formulas to canvas from api?
Solved! Go to Solution.
Thanks for the clarification. I did misunderstand what you're wanting.
Is the problem in (1) creating a text question, (2) creating the mathematical content within the question, or (3) both?
The explanation of how to create a question at all is lengthy. Creating just the mathematical content is quicker.
For the mathematical content, do you have this as LaTeX or is it an image that you want to embed somewhere? If it's LaTeX, then you might want to look at Best way to add LaTeX equations . It's been almost 2 years since I contributed there, but I think it still works.
If it's an image, then you can just create an img element like you would with regular HTML, just make sure that it's to an HTTPS connection, otherwise the content will likely get blocked by browsers not wanting to mix https and http on the same page.
New Quizzes supports embedding LaTeX directly just by using \( and \) around it. However, I haven't seen an API for this yet and that approach doesn't work in the legacy quizzes.
There's a lot of useful information on how it should be formatted in this thread: Uploading answers to formula question using API
You probably misunderstood us.
We want to add a formula to the text question!
For example:
Solve the differential equation
Thanks for the clarification. I did misunderstand what you're wanting.
Is the problem in (1) creating a text question, (2) creating the mathematical content within the question, or (3) both?
The explanation of how to create a question at all is lengthy. Creating just the mathematical content is quicker.
For the mathematical content, do you have this as LaTeX or is it an image that you want to embed somewhere? If it's LaTeX, then you might want to look at Best way to add LaTeX equations . It's been almost 2 years since I contributed there, but I think it still works.
If it's an image, then you can just create an img element like you would with regular HTML, just make sure that it's to an HTTPS connection, otherwise the content will likely get blocked by browsers not wanting to mix https and http on the same page.
New Quizzes supports embedding LaTeX directly just by using \( and \) around it. However, I haven't seen an API for this yet and that approach doesn't work in the legacy quizzes.
Hello James.
Thanks for the help.
I am new to canvas. What did you mean by the phrase new quizzes?
There are two versions of quizzes right now.
The legacy version which has been called quizzes for years and is what all the Quiz APIs refer to. Development has stopped on this, so it's mostly frozen where it's at. This is what people get to when they click "Quizzes" in the course menu.
There is New Quizzes, which is found under the Assignments menu rather than the Quizzes menu. It has been in development for years and gone through several name changes. Our institution hasn't enabled it yet, but there is coming a time when legacy quizzes will disappear and everything will be new quizzes. There is no API (that I know of) for it yet, although there is a migration path from legacy quizzes to new quizzes.
With new quizzes, you can enter this directly into the text of the question, which means it just be part of a paragraph or div element inside the HTML.
\(\displaystyle e^y\left(\frac{dy}{dx}+1\right)=1\)
With legacy quizzes, you need to insert this into the HTML
<img class="equation_image" title="\displaystyle e^y\left(\frac{dy}{dx}+1\right)=1" src="/equation_images/%255Cdisplaystyle%2520e%255Ey%255Cleft(%255Cfrac%257Bdy%257D%257Bdx%257D%252B1%255Cright)%253D1" alt="LaTeX: \displaystyle e^y\left(\frac{dy}{dx}+1\right)=1" data-equation-content="\displaystyle e^y\left(\frac{dy}{dx}+1\right)=1" />
The Canvas Instructor Guide has a section on both Quizzes and New Quizzes.
Thanks for the help.
Here's another thread from almost three years ago that may help: https://community.canvaslms.com/docs/DOC-8799
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.