【问题标题】:Wrap equations in box in Shiny Dashboard在 Shiny Dashboard 中将方程式包装在框中
【发布时间】:2019-12-27 19:30:10
【问题描述】:

我在shinydashboard 中遇到问题,我正在编写的方程式在放入box 时没有换行。这些方程式超出了box 的限制。 MWE:

library(shinydashboard)
library(shiny)

# UI
ui <- dashboardPage(
    dashboardHeader(),

    dashboardSidebar(),

    dashboardBody(
        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)

这个例子产生:

boxes 中的数据框也有同样的问题,但在网上找不到任何答案。有没有人可以确保box 的内容不会超出box 的边界?

【问题讨论】:

    标签: r shiny shinydashboard


    【解决方案1】:

    这是要使用的 MathJax 配置:

      dashboardBody(
        tags$head(tags$script(type = "text/x-mathjax-config", 
                              'MathJax.Hub.Config({
      "HTML-CSS": { linebreaks: { automatic: true } },
             SVG: { linebreaks: { automatic: true } }
    });')),
        fluidRow(......
    

    【讨论】:

    • 不幸的是,当boxtabItem 内时,这不起作用。我在这里发布了一个单独的问题:stackoverflow.com/questions/57610899/…。如果您能看看这个新问题,我将不胜感激。
    • @bjorn2bewild 嗯,很奇怪。抱歉,我试过了,但没有成功。
    • 奇数。感谢您调查。
    猜你喜欢
    • 1970-01-01
    • 2017-09-26
    • 2019-01-28
    • 1970-01-01
    • 2020-07-15
    • 2015-08-07
    • 2016-07-21
    • 1970-01-01
    • 2018-08-02
    相关资源
    最近更新 更多