St.write treats $ symbol as start of latex expression and that spoils the rest of text formatting


I have a long text (see below), this text contain $ symbol

text = “”"
Chili offers to help Tommy’s widow, Edie Athens, manage the failing business, which owes $300,000 to hip-hop producer Sin LaSalle.
More text…

Steps to reproduce

Code snippet:


Expected behavior:

I actually want this text to be shown as is i.e. with $ symbol.

Actual behaviour:

st.write treat this text as ‘markdown’ and $ is considered as the start of latex expression, due to this text after $ symbol just shows up weird.

I can use st.text but then my long text will be shown in a box with horizontal scrollbar, I don’t want that. I want text to be shown as is (with $ symbol) and auto-wrap so that it expand vertically.

any idea how to achieve this?

1 Like

How about removing the Dollar sign using regex and then passing it to st.text

Check this related thread to escape the dollar signs so they are just rendered as such:

$ is part of the text itself and actually representing the money, can’t remove it.

yup worked, perfect. Thanks edsaac!