How to put exponents (power symbol) in tables made using the gtable package?

37 Views Asked by At
tab_header(
    title = expression(Ni^"2+" ~ Remediation),
    subtitle = "Trials 1- 4",
    )

2+ is not shown as a power

I would like to know how to get the 2+ to come as a power.

Here, I tried the expression function, but it does not work.

1

There are 1 best solutions below

0
Felix Jassler On BEST ANSWER

If it's enough for the "2+" to show up in superscript, you could use the <sup> tag in HTML.

gt(df) %>%
  tab_header(
    title = html("Ni<sup>2+</sup> ~ Remediation"),
    subtitle = "Trials 1- 4"
  )