Superscripts/subscripts in `gt` column labels?

I'm appreciating gt and searching around have yet to find an example of formatting subscripts in column labels:

My current column label is below, I'd like to explicitly format the superscript eg with LaTeX style formatting as used in ggplot, and have yet to get this working eg with bquote() or $m^{2}$ .

# current code fragment 
 cols_label(mean_hourly_kwh_m2 = "Mean kWh/m^2")

Thank you!

Oops, somehow my previous searching overlooked this example, here's the way to format it - gt uses html instead!

cols_label(median_hourly_kwh_m2 = html("Median hourly kWh/m<sup>2</sup>")
)

I also noticed gt works as a tag on this forum, but throws an error message as a search term since it's too short, which could be confusing for newcomers.

3 Likes

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