equations displaying in question preview but not survey | XM Community
Skip to main content
Question

equations displaying in question preview but not survey


Forum|alt.badge.img+1

I've followed the instructions here: https://community.qualtrics.com/XMcommunity/discussion/comment/32547#Comment_32547 to integrate katex into a survey for displaying equations. Interestingly, when I use "preview question" on a question with embedded katex, it displays fine in the pop-up window, as below:
image.pngBut when I use "preview block," "preview survey" or even just look at the published survey, I get a mess:
image.pngInterestingly, you'll see that the variable d_{blue, red flag} is actually displayed properly within that block.
I feel like maybe there's a command I'm missing somewhere that doesn't get triggered when doing the broader previews? Has anyone gotten math display to work properly (using katex or otherwise)?

6 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5933 replies
  • April 10, 2022

Post your question html (as a code block).


Forum|alt.badge.img+1
  • Author
  • 3 replies
  • April 11, 2022

Text block:

Globally/Always:

\\text{``Always between } t=1_1 \\text{ and } t=t_2:S\\text{"} means that the statement S must always be true for all time between t_1 \\text{ and } t_2. This is equivalent to \\text{``}G_{[t_1,t_2]}:S\\text{"}, where G stands for "globally"



Finally/Eventually:

Other Operators:

“∧” means “AND”

“∨” means “OR”

“¬” means “NOT”

“≤“ means “less than or equal to”

"≥“ means “greater than or equal to”`

Question 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*/


});


Look and Feel \\ General \\ Header:





TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5933 replies
  • April 11, 2022

Remove defer and onload from your


Forum|alt.badge.img+1
  • Author
  • 3 replies
  • April 11, 2022

I just realized that text block isn't the exact same text block example I gave previously, but all cases that have katex run into the same issue.


Forum|alt.badge.img+1
  • Author
  • 3 replies
  • April 11, 2022

Hi TomG - thanks for the suggestion. It seems that removing defer and onload has helped some instances display correctly, but when I copy/paste your suggested edits to the text (removing the \\text{} tags), a few things happen:
The question-only preview gives this, with the text in the math font:
image.png(As expected from the code, and not something I want.)
And the block preview very briefly shows up as the same thing, before quickly turning into this:
image.png
With much more red text going on, until it reaches "stands for "globally"". Any idea why that might be happening?


Forum|alt.badge.img+1
  • 2 replies
  • September 8, 2022

Dear all
I have the same issue as hoseasiu, my equations are displaying in question preview but not in survey. I tried the suggestions above but it didnt work
hoseasiu were you somehow able to solve the problem or has anyone an idea what I can do? Why is it a difference whether you look at the question preview or the preview of the survey?
Thank you!

my textblock is the other parts are the same as the parts from hoseasiu :
Median nicht direkt aus der Reihe der Merkmalswerte an der (mittleren) Stelle \\frac{n+1}{2} abgelesen werden. Stattdessen gilt: Md = 5.5 (Stelle q = \\frac{n}{2} = 4; Stelle q + 1 = \\frac{n}{2} + 1 = 5; Mittelwert der Merkmalswerte \\frac{x_{4} + x_{5}}{2} = \\frac{5 + 6}{2} = 5.5)