Hi everyone,
I’m encountering an issue with the st.write
method for rendering LaTeX expressions; it’s being displayed as plain text instead of properly formatted LaTeX. However, the same LaTeX expression works correctly with st.latex
.
I’m using Streamlit version 1.33.0.
Here’s the code:
This works:
st.latex(r"""
\text{Annual Cost} = \left(\frac{\text{Miles per Year}}{\text{Fuel Efficiency}}\right) \times \text{Price per Gallon}
""")
This doesn’t:
st.write("""
$$
\text{Annual Cost} = \left(\frac{\text{Miles per Year}}{\text{Fuel Efficiency}}\right) \times \text{Price per Gallon}
$$
""")
I’m new to Streamlit and not sure if I’m missing something in the syntax. Also, does math text mode \(. . . \)
and display mode \[. . . \]
work in Streamlit?
Thank you