# Latex does not work

Hello,
I am running this code example:

import plotly.express as px

fig = px.line(x=[1, 2, 3, 4], y=[1, 4, 9, 16], title=r'$\alpha_{1c} = 352 \pm 11 \text{ km s}^{-1}$')
fig.update_layout(
xaxis_title=r'$\sqrt{(n_\text{c}(t|{T_\text{early}}))}$',
yaxis_title=r'$d, r \text{ (solar radius)}$'
)
fig.show()


I installed Plotly 5.6.0 and Mathjax 3.2.0. I use a clean environment, with a Jupyter Notebook, with Visual Studio Code. What am I doing wrong? What surprises me is that it works when i use the base environment.

Thank you,

hi @Mx9s
What do you mean by “it works when I use the base environment”?

Hello, thank you. When i plot this figure in the base environment of anaconda, the Latex is compiled in the figure. Now, i am running the same code in a new and clean anaconda environment but Latex does not compile.

hi @Mx9s
I’m not sure why that problem arises. Probably has to do with the anaconda environment.

I ran this code in PyCharm within a venv virtual environment with Plotly 5.6.0 (without installing mathjax separately) and it worked for me.