I am trying to use KaTex for equations in my Qualtrics survey. All of the math renders correctly in “question preview” but only two of them render in “block preview”. This block contains page breaks, if that’s relevant.
I put the starter template in the header (Browser · KaTeX), and each question with the KaTex has the JavaScript:
Qualtrics.SurveyEngine.addOnload(function() {
jQuery(".katex").each(function() {
katex.render(this.innerHTML, this, { throwOnError: false });
});
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
});
Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/
});
The math is rendering for some of my questions but not others. For example, this worked (in the question text HTML):
Bernoulli trial equation: <span class="katex"> P(X = \mathrm{x}) = \binom{n}{\mathrm{x}} p^{\mathrm{x}} (1 - p)^{n-\mathrm{x}} </span>
This one also worked (in the question choice>Rich Content Editor>Source):
A.) <span class="katex"> P(X = 5) = \binom{3}{5} (0.4)^5 (1 - 0.4)^{3 - 5} </span>
However, this one did not work (another question text HTML) -- notice that it’s the same HTML as the first working example:
Bernoulli trial equation: <span class="katex"> P(X = \mathrm{x}) = \binom{n}{\mathrm{x}} p^{\mathrm{x}} (1 - p)^{n-\mathrm{x}} </span>
This one did not work either (question choice):
A.) Calculate <span class="katex"> \binom{27}{15} </span>
The two working examples I included are the only two that work in “block preview”. There are several others that did not work in “block preview” besides the examples provided. ALL of them work in “question preview”.