1

As of title, I need to increase MathJax's font size globally for my Shiny app. I tried as written in the answer to this question, so I put

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

inside my ui's fluidPage, but that doesn't seem to work.

I reckon that I could also write \\large{...} for each piece of MathJax code, but my app has a lot of formulas and that would be very expensive. Any ideas?

Marco Z.
  • 11
  • 1

1 Answers1

1

Using !important works for me:

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)
starja
  • 9,887
  • 1
  • 13
  • 28