问题
I just trying to get $\10^{-1}$ in a table in Shiny, but it is not working. I'm trying the following code (thanks in advance):
ui.R:
require(shiny)
shinyUI(tableOutput('mytable')
)
server.R:
require(shiny)
shinyServer(function(input, output){
output$mytable <- renderTable({
df <- data.frame(A = c("$\\10^{-1}$", 33.1, 6),B = c(111111, 3333333, 3123.233))
df
}, sanitize.text.function = function(x) x)
})
回答1:
You can use mathJAX in shiny:
require(shiny)
ui <- shinyUI(
fluidPage(
withMathJax()
, h2("$$\\mbox{My Math example }\\sqrt{2}$$")
, tableOutput('mytable')
)
)
server <- function(input, output, session){
output$mytable <- renderTable({
df <- data.frame(A = c(HTML("$$\\alpha+\\beta$$"), 33.1, 6),B = c(111111, 3333333, 3123.233))
df
}, sanitize.text.function = function(x) x)
}
shinyApp(ui = ui, server = server)
来源:https://stackoverflow.com/questions/26620221/latex-rendertable-in-shiny-r