yihui / xaringan

Presentation Ninja 幻灯忍者 · 写轮眼
https://slides.yihui.org/xaringan/
Other
1.49k stars 280 forks source link

How can I get rid of the back-tic inside this table generated by `kableExtra` in `xaringan` slides? #264

Closed jorgesinval closed 4 years ago

jorgesinval commented 4 years ago

How can I get rid of the back-tic inside this table generated by kableExtra in xaringan slides?

library(knitr)
library(kableExtra)

text_tbl <- data.frame(
   a= c("1", "2","...","L",""),
   b= c("$O_{11}$","$O_{21}$","...","$O_{L1}$","$n_{.1}$"),
   c= c("$O_{11}$","$O_{22}$","...","$O_{L2}$","$n_{.2}$"),
   d= c("...","...","...","...","..."),
   e= c("$O_{C1}$","$O_{C2}$","...","$O_{LC}$","$n_{.C}$"),
   f= c("$n_{1.}$","$n_{2.}$","...","$n_{L.}$","$N$"))
kable(text_tbl, "html", booktabs = T, col.names = c("","1","2","...","C"," "), escape=F) %>%
  kable_styling(full_width = F,bootstrap_options = "striped") %>%
  add_header_above(c(" Variável A", "Variável B" = 4, " ")) %>%
  column_spec(1, bold = T) %>%
  column_spec(2)

Table within back-tics

I inspected the HTML code generated, and I didn't see any back-tics.

PS: I made the same question on Stack Overflow and on RStudio Community.


By filing an issue to this repo, I promise that

I understand that my issue may be closed if I don't fulfill my promises.

jorgesinval commented 4 years ago

Replace the $ with \( or \). As suggested in the Stack Overflow answer to my question.