Is there a way to disable latex support with st.write and st.markdown (etc) ?
Iām not interested in latex but unfortunately the text Iām writing seems to include latex commands.
I remember seeing a code snippet on this forum using a html hack to disable latex so that text is written correctly but unfortunately I did not bookmark it and the search function does not return anything when itās within code blocks.
Maybe thereās a way to escape all the ālatexā characters so that theyāre ignored by latex ?
Thanks for your question, could you perhaps share a code snippet of your app that is showing this. It may be helpful for the community in providing solutions.
I think the KaTeX typesetting is only triggered when it encounters a dollar sign in the string. Escaping those $ before calling st.write should get you covered.
My code outputs BASIC-like programming language code ⦠you know like
Input A$
Print "Hello " + A$ + " How are you ?"
I think the $ sign is what triggers the latex renderer but Iām not sure if there are no other latex sequences that can be triggered (Iām not familiar with latex syntax)
Then I think your best option is using st.text() to show all the text.
Using st.write() or st.markdown() is going to be a pain, because you need to transform the original text into the markdown that will render exactly as the original text, and that can get very tricky. You can probably fix the latex issue by prepending a backslash to each ā$ā, but chances are you will find more things that do not render as you expect: bacticks, asterisks, dashes, bracketsā¦
And of course you will get code that doesnāt work; basic interpreters wonāt understand Print āHello worldā.