jupyterquiz
jupyterquiz copied to clipboard
Javascript Error: MathJax.typeset is not a function
Getting the error Javascript Error: MathJax.typeset is not a function
when making a quiz in a notebook.
The quiz seems to work fine, but the error is displayed below the quiz display:
I'm using JupyterLab, in case that helps?
Can you please try the following? Make a Markdown cell above your cell that calls JupyterQuiz and put any LaTeX in it. For instance, the following should just be a blank space:
$~$
Please let me know if that resolves that error, and then I will consider how to best mitigate this in general.
Hi there, I tried what you suggested but it did not make the error go away :-(
I have also encountered this error message, and the resulting quiz does not correctly typeset the math.
After looking into the console for error message, I found out that the error message is in this line:
my MathJax version is 3.2.2. Could you help me with this issue?
This is a strange error because MathJax.typeset() is definitely defined in MathJax 3.2.2.
Can you please provide more information to help me try to figure this out:
What is the environment you are running this in? Is this in JupyterLab or something else? What version?
Can you open the Javascript Console in your browser and capture the output after executing the code that causes the error you sent?
Thank you for your quick reply. I execute the notebook inside the conda environment. I tried both Jupyter notebook and JupyterLab, but yielded the same error message.
Name: notebook Version: 7.0.6
Name: jupyterlab Version: 4.0.10
The following is the console output of the Javascript.
This is actually affecting me, too. The issue is that in JupyterLab 4, the MathJax variable never gets updated to have the appropriate methods. I have not been able to figure out how to access the MathJax.typeset() method, so I have reached out on the JupyterLab Discourse. I will update when I known something more.
OK, I have coded up a solution that works for me, but it is a little "hacky". Basically, I check whether MathJax.typeset() is available if it looks like MathJax 3 is loaded. If it is not available, then I configure and load MathJax 3 myself. Can you try it out? You will need to install version 2.7.0a1:
pip install jupyterquiz==2.7.0a1
The make sure you restart your kernel and rerun your Jupyter notebook using JupyterQuiz. Let me know if that solves the issue for you and if it causes any undesirable side effects to the rest of your NB.
Thanks for the promptly reply! Yes, the version 2.7.0a1
resolve the rendering issue. Now the LaTeX math can be rendered normally.
Great! Please bump to 2.7.0a2 to get better support for dark mode themes.
I am going to leave this open until we get a proper fix from upstream