Equation wrapping with Shiny Dashboard

ε祈祈猫儿з 提交于 2019-12-11 07:27:27

问题


I just posted a question regarding equation wrapping with shinydashboard here. The answer presented worked, but my actual example is more complicated and includes tabItems. Unfortunately, including the MathJax config at the beginning of the dashboardBody does not wrap the equation when the box is in a tabItem. 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)

The preceding code yields:

I have tried placing the MathJax config at the beginning of tabItems and tabItem to no avail. Can anyone explain where to place the MathJax config? A brief explanation of MathJax config more generally would be quite helpful.


回答1:


You set the width of the column to 6 (width=6), but for the box you have a width of 12 (width=12). If you fix that it works

In addition, if you need to keep the column of that width, you can set style = 'overflow-x: scroll to add a scrolling bar.



来源:https://stackoverflow.com/questions/57610899/equation-wrapping-with-shiny-dashboard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!