I'm using MathJax to render math equations on my website. I use Python to create those math equations and I use f-strings a lot.
Currently, I have to concatenate every string because to write a square root in mathJax (as far as I can tell), you can only use sqrt{x=3}
, but that's a problem because in Python f-strings use {}
too.
Is there any other way to write a square root in mathJax or fraction in mathJax without using curly brackets?
An example of what I'm talking about/in other words:
Off of what I know currently, this is how you write a square root in mathJax:
$$sqrt{4}$$
But in Python when dealing with f-strings:
x = 4
equation = f'$$sqrt{x}$$'
creates
$$sqrt4$$
– which is not what I want.
Of course I see that you can just concatenate the string by doing and not do an f-string:
equation = '$$sqrt{' + x + '}$$'
However when I'm doing larger problems, and I'm making a lot of varying equations and this takes forever to do for every string.