here’s an updated solution based on new features since that post:
from anvil.js.window import MathJax
class Form1(Form1Template):
def __init__(self, **properties):
self.init_components(**properties)
self.label_1.text = "When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]"
def form_show(self, **event_args):
"""This method is called when the HTML panel is shown on the screen"""
MathJax.typeset() # rerender any latex on this page
# if you add content dynamically you may need to recall this function
Also I removed the async part of the script because otherwise MathJax might not have loaded when we try to import it…