闪亮面板中的LaTeX公式 [英] LaTeX formula in Shiny panel
本文介绍了闪亮面板中的LaTeX公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在Shiny面板中显示-LaTeX格式的公式,但是找不到将textOutput
与withMathJax
组合的方法.我尝试了以下操作,但没有成功.任何帮助将不胜感激.
I want to display a -LaTeX formated- formula in a Shiny panel, but I can't find a way to combine textOutput
with withMathJax
. I tried the following but it didn't work. Any help would be gratefully appreciated.
-ui.r
...
tabPanel("Diagnostics", h4(textOutput("diagTitle")),
withMathJax(textOutput("formula")),
),
...
-server.r
...
output$formula <- renderText({
print(paste0("Use this formula: $$\\hat{A}_{\\small{\\textrm{M€}}} =", my_calculated_value,"$$"))
})
...
推荐答案
在UI端使用uiOutput
在服务器端使用renderUI
来获取动态内容.
Use uiOutput
on the UI side and renderUI
on the server side for dynamic content.
ui <- fluidPage(
withMathJax(),
tabPanel(
title = "Diagnostics",
h4(textOutput("diagTitle")),
uiOutput("formula")
)
)
server <- function(input, output, session){
output$formula <- renderUI({
my_calculated_value <- 5
withMathJax(paste0("Use this formula: $$\\hat{A}_{\\small{\\textrm{M€}}} =", my_calculated_value,"$$"))
})
}
shinyApp(ui, server)
更多示例: http://shiny.leg.ufpr.br/daniel/019-mathjax/
这篇关于闪亮面板中的LaTeX公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文