How do I integrate KaTeX into Qualtrics? | XM Community
Skip to main content

I am trying to put together a survey based on math formulae using KaTeX. I can add the JavaScript to a question following the guidance on an old forum post but am struggling to add the Katex style sheet (css) and JavaScript to my header as suggested.
Can someone please walk me through this? Thanks!
For reference I am trying to follow this old post:
https://community.qualtrics.com/XMcommunity/discussion/comment/32547#Comment_32547

Add this to the survey header. Make sure you click on <> to put it in source mode first.



Thanks TomG. I can see how you would do this for individual questions via the rich content editor in each individual element of the survey. Is there a way to do it for the entire survey globally?


https://community.qualtrics.com/XMcommunity/discussion/comment/50761#Comment_50761Put it in the survey header. Look & Feel -> General -> Header (edit). Then click the <> icon.


Thanks. I put the info. you posted here in the header. I also have the style sheet in Look & Feel -> Style -> External CSS. Is this required?
Is there a way to enable the JavaScript globally as well or does this need to be done in each question individually? i.e. this piece...
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*/
});


https://community.qualtrics.com/XMcommunity/discussion/comment/50784#Comment_50784You don't need external css because you already have a link to the katex stylesheet in the header.
Yes, you can make the script global, by putting it in the header inside a



Leave a Reply