【发布时间】:2019-08-23 17:15:26
【问题描述】:
我刚刚发布了一个关于用shinydashboard here 进行方程换行的问题。给出的答案有效,但我的实际示例更复杂,包括tabItems。不幸的是,当box 位于tabItem 中时,在dashboardBody 的开头包含MathJax 配置不会包含等式。 MWE:
library(shinydashboard)
library(shiny)
# UI
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
menuItem( "TEST", tabName = "test", selected = T)
),
dashboardBody(
tags$head(tags$script(type = "text/x-mathjax-config", 'MathJax.Hub.Config({
"HTML-CSS": { linebreaks: { automatic: true } },
SVG: { linebreaks: { automatic: true } }
});')),
tabItems(
tabItem(tabName = "test",
fluidRow(
column(width = 6,
box("Long Equation", width = 12,
h3(withMathJax("$$ \\alpha + \\beta + \\gamma + \\delta + \\alpha + \\beta + \\gamma + \\delta + \\alpha + \\beta + \\gamma + \\delta + $$")))
)
)
)
)
)
)
# Server
server <- function(input, output) {
}
# Run the application
shinyApp(ui = ui, server = server)
前面的代码产生:
我尝试将 MathJax 配置放在 tabItems 和 tabItem 的开头,但无济于事。谁能解释在哪里放置 MathJax 配置?更一般地对 MathJax 配置进行简要说明会很有帮助。
【问题讨论】:
标签: r shiny shinydashboard