Problems using character ' for derivatives in questions for Canvas

72 Views Asked by At

I am creating differential equation questions for uploading in Canvas via zip QTI. As you may think I write something like

\[ y'' + y = x+1 \]

in the body of the question. I tested the question in a HTML display and it was ok, BUT when I build a QTI file for Canvas and upload it, the formula was not correctly displayed.

A workaround is to replace y'' with \frac{d^2y}{dx^2} which displays correctly but simply y' would be preferred.

1

There are 1 best solutions below

6
On BEST ANSWER

Interestingly, the issue only occurs when using Rnw exercises but not with Rmd exercises and when using the pandoc-mathml converter (while pandoc-mathjax would work correctly, for example). It can also be replicated using exams2html() when using the following options that correspond to the setup used in Canvas:

exams2html("diffeq.Rnw", converter = "pandoc-mathml", mathjax = TRUE)

Luckily there is a simple workaround, namely in Rnw exercises use y^{''} instead of the y'' that you would use in Rmd exercises. And then make sure you use converter = "pandoc-mathml". See below for simple worked examples for the exercise files.

R/LaTeX version: diffeq.Rnw.

\begin{question}
Is this differential equation showing up correctly?

\[ y^{''} + y = x+1 \]

\begin{answerlist}
  \item Yes
  \item No
\end{answerlist}
\end{question}

\exname{differential equation}
\extype{schoice}
\exsolution{10}

R/Markdown version: diffeq.Rmd.

Question
========
Is this differential equation showing up correctly?

\\[ y'' + y = x+1 \\]

Questionlist
------------
* Yes
* No

Meta-information
================
exname: differential equation
extype: schoice
exsolution: 10