Latex symbols in rmarkdown table using knitr::kable

拥有回忆 提交于 2021-02-07 20:59:37

问题


I am trying to use knitr::kable in Rmarkdown to create a table of latex equations. However, I am having difficulties getting special characters such as $\sum$ or $\hat$ to work. For example the following works:

knitr::kable(head(mtcars[,c(1,2)], 10),
         row.names = FALSE,
         col.names = c("Time", "$\\delta_{m}_1$"))

but when trying to include a hat or bar the following does not work:

knitr::kable(head(mtcars[,c(1,2)], 10),
         row.names = FALSE,
         col.names = c("Time", "$\\hat{m}_1$"))

Has anyone figured out how to embed these characters using kable?

Thanks

来源:https://stackoverflow.com/questions/48873875/latex-symbols-in-rmarkdown-table-using-knitrkable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!