R 闪亮与 mathjax 条件案例

R shiny with mathjax conditional cases

您好,我知道您可以使用 withMathJax 函数在 R-shiny 应用程序中使用内联方程,但据我所知,您可以像在 Rshiny 示例中那样使用简单的数学方程here。我想知道是否有人知道如何添加条件案例,就像在乳胶中使用以下代码一样

f(n) =
\begin{cases}
n/2,  & \text{if $n$ is even} \
3n+1, & \text{if $n$ is odd}
\end{cases}

这将产生以下内容,干杯

我认为以上 link 可以为您提供有关如何编写条件案例的良好信息。它还有一个link,其中有一个应用条件的正确教程cases.I希望它能对你有所帮助。

我想这就是你想要的或者?

library(shiny)

ui <- {fluidPage(
  title = 'MathJax Examples',
  withMathJax(),
  uiOutput('ex4')
  )}

server <- function(input, output, session) {
  output$ex4 <- renderUI({
    withMathJax(
      helpText('$$f(n)=\begin{cases}
               n/2,  & \text{if $n$ is even} \\
               3n+1, & \text{if $n$ is odd}
               \end{cases}\!$$'))
  })
}
shinyApp(ui, server)