How to do Symbols, subscripts, superscripts etc. in st.experimental_data_editor column headers without unicode?

Summary

I created this little dataframe below using st.experimental_data_editor, but I canโ€™t get the symbols and sub/super-scripts working for column headers. Is there a way to get get it done without using unicode?

Steps to reproduce

Code snippet:

df = pd.DataFrame(
    [
    {"Section": "12inx30ft", "$b_{w}$": 12, "$\mu^2$": 30},
    {"Section": "8inx47.2ft", "$\alpha_{w}$": 8, "$x^a$": 47.2},
    ]
) 
edited_df = st.experimental_data_editor(df, num_rows="dynamic")

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:
Symbols, Sub/Super-Scripts

Actual behavior:
For example, it shows up as $b_{w}$

Debug info

Streamlit, version 1.22.0

Requirements file

I am using Conda.

Links

Hello! need some help when it comes to subscripts or superscripts. How do we include this in the st.title? Canโ€™t seem to use markdown because it is not supported. Thank you so so much

2 Likes

Hi @clarac1996. For st.title I recommend using HTML in st.markdown instead.

import streamlit as st

st.markdown(
    "<h1>This <sup style='font-size:.8em;'>is</sup> <sub style='font-size:.8em;'>a</sub> title.</h1>",
    unsafe_allow_html=True,
)

image

1 Like

Got it, thanks so much @mathcatsand !

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.