【问题标题】:Equation wrapping with Shiny Dashboard用 Shiny Dashboard 包裹方程
【发布时间】: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 配置放在 tabItemstabItem 的开头,但无济于事。谁能解释在哪里放置 MathJax 配置?更一般地对 MathJax 配置进行简要说明会很有帮助。

【问题讨论】:

    标签: r shiny shinydashboard


    【解决方案1】:

    您将列的宽度设置为 6 (width=6),但对于框,您的宽度为 12 (width=12)。如果你修复它的工作原理

    另外,如果需要保持该宽度的列,可以设置style = 'overflow-x: scroll添加滚动条。

    【讨论】:

      猜你喜欢
      • 2019-12-27
      • 2018-03-16
      • 2017-09-26
      • 1970-01-01
      • 2021-03-30
      • 2020-01-30
      • 1970-01-01
      • 2017-10-14
      • 2014-07-30
      相关资源
      最近更新 更多