Latex,RenderTable in Shiny,R

时间:2014-10-28 23:21:06

标签: r latex shiny

我只是想在Shiny中的表中获取$\10^{-1}$,但它无效。我正在尝试以下代码(提前感谢):

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 个答案:

答案 0 :(得分:2)

你可以在有光泽的情况下使用mathJAX:

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)

enter image description here