Style / format text using Markdown in TableInput

I would like to write: f"$c_{{{‘nom’}}}$" as possible in a general TextField but within a table (column name).

Is there a possible way?
Using a custom search functions results in:


Which isn’t very pretty…


Hi Johan!

I think you want to display “c subscript nom”? I think in that case $c_{nom}$ should be sufficient. The underscore is for subscript, and the curly brackets are used to make sure “nom” goes to the subscript, instead of only the n

I hope that fixes it!

Edit: I realise you are using an f-string now. I’m not sure how those two would combine as both KeTeX and fstrings use curly brackets. You could try adding strings together instead of using an fstring to circumvent this.

So in that case: If you want to generate a TextField name with a variable is called subscript containing the string "num" you could try:

"$c_{" + subscript + "}$"

to create the string $c_{num}$ without using f-strings.

This syntax doesn’t work for the columns of a table input:

It does work however for common text in the UI

Its not a big thing though. I’ll just write cnom. However I thought it would be possible to use $c_{nom}$ in the headers as well

I am facing the same issue, I would like to write kN/m2 as the units for the user input (with the 2 as superscript, can’t seem to use superscript on the forum). It would be a really nice to have feature to make the interface look a bit more professional.

Hi Rutger, and also Johan of course,

While no new developments have been published which relate to this post (the internal issue is still open though), I just wanted to add that it is possible to use regular unicode characters in your strings. These are mostly supported. So "kN/m²" should work fine in the case of Rutger. For Johan’s case this would still result in: "Cₙₒₘ" which looks the same as your original fix (using get_sub(‘nom’)).

Hopefully this helps!

I’ve changed this to a feature request, and changed the heading.

Also requested by Ruud H.