Mathjax在Shiny中的对齐方式

huangapple go评论105阅读模式
英文:

Mathjax alignment in Shiny

问题

我已找到方法来左对齐我的闪亮应用中的所有Mathjax方程,但我想要将一些方程居中。是否有一种方法可以不同应用这个CSS?

  1. tags$style(HTML("div.MathJax_Display{text-align: left !important;}")),

是否有一种方法可以在将方程发送到输出时指定"text-align: center"?

  1. withMathJax(tags$p(equation))
英文:

I've found ways to left-align ALL of the Mathjax equations in my shiny app, but I want to center a couple of equations. Is there a way to differentially apply this CSS?

  1. tags$style(HTML("div.MathJax_Display{text-align: left !important;}"))),

Is there a way to specify "text-align: center" when I send the equation to output?

  1. withMathJax(tags$p(equation))

答案1

得分: 1

你可以按照以下方式使用CSS类:

  1. library(shiny)
  2. ui <- fluidPage(
  3. withMathJax(),
  4. tags$style(HTML(
  5. "p.mjleft div.MathJax_Display{text-align: left !important;}",
  6. "p.mjcenter div.MathJax_Display{text-align: center !important;}"
  7. )),
  8. br(),
  9. tags$p("$$\\int_0^1$$", class = "mjleft"),
  10. tags$p("$$\\int_0^1$$", class = "mjcenter")
  11. )
  12. server <- function(input, output) {}
  13. shinyApp(ui, server)

Mathjax在Shiny中的对齐方式

  1. <details>
  2. <summary>英文:</summary>
  3. You can use CSS classes as follows:
  4. ```r
  5. library(shiny)
  6. ui &lt;- fluidPage(
  7. withMathJax(),
  8. tags$style(HTML(
  9. &quot;p.mjleft div.MathJax_Display{text-align: left !important;}&quot;,
  10. &quot;p.mjcenter div.MathJax_Display{text-align: center !important;}&quot;
  11. )),
  12. br(),
  13. tags$p(&quot;$$\\int_0^1$$&quot;, class = &quot;mjleft&quot;),
  14. tags$p(&quot;$$\\int_0^1$$&quot;, class = &quot;mjcenter&quot;)
  15. )
  16. server &lt;- function(input, output) {}
  17. shinyApp(ui, server)

Mathjax在Shiny中的对齐方式

huangapple
  • 本文由 发表于 2023年6月22日 10:55:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76528326.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定