闪亮:增加MathJax的字体大小

问题描述

标题开始,我需要为我的Shiny应用程序全局增加MathJax的字体大小。 我按照this question的答案进行了尝试,于是我放了

tags$head(
    tags$style(
      HTML(
        ".MathJax {
            font-size: 2em;
          }"
      )
    )
  )

在我的ui的{​​{1}}内,但这似乎不起作用。

我认为我也可以为每段MathJax代码编写fluidPage,但是我的应用程序具有很多公式,这将非常昂贵。 有什么想法吗?

解决方法

使用!important对我有用:

library(shiny)



ui <- fluidPage(
  title = 'MathJax Examples',withMathJax(),tags$head(
    tags$style(
      HTML(
        ".MathJax {
            font-size: 2em !important;
          }"
      )
    )
  ),helpText('An irrational number \\(\\sqrt{2}\\)
           and a fraction $$1-\\frac{1}{2}$$'),helpText('and a fact about \\(\\pi\\):
           $$\\frac2\\pi = \\frac{\\sqrt2}2 \\cdot
           \\frac{\\sqrt{2+\\sqrt2}}2 \\cdot
           \\frac{\\sqrt{2+\\sqrt{2+\\sqrt2}}}2 \\cdots$$')
)

server <- function(input,output,session) {
  
}

shinyApp(ui,server)