Katex doesn't work when used in more than one question? How to resolve this? | XM Community
Skip to main content

Hi Everyone,

 

I am using Katex to write some math questions that involves algebraic expressions like x squared and etc. I used this forum to incorporate the Katex: 

The solution provided there worked but works only if there is one question with Katex. I tried to use the same steps for a second question and now in the preview all i get is some weird long text that is filled with some code. Can anyone help how to resolve this?

@Lrudman,

Are the questions on the same page or different pages?  What JS are you using?  Have you added it to each question?


Using page breaks between the questions fixed the problem.


@Lrudman,

If you put the script from the other post in the survey header, then you don’t need to add it to every question and you don’t have to worry about page breaks:

<script>
Qualtrics.SurveyEngine.addOnload(function() {
jQuery(".katex").each(function() {
katex.render(this.innerHTML, this, { throwOnError: false });
});
});
</script>

 


Leave a Reply