代码之家  ›  专栏  ›  技术社区  ›  Cyrillm_44

r在mathjax条件案例中闪闪发光

  •  4
  • Cyrillm_44  · 技术社区  · 7 年前

    嗨,我知道你可以使用 withMathJax 函数,但从我所看到的,是一些简单的数学公式 here . 我想知道是否有一个新的方法来添加条件用例,就像下面的代码一样

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

    会产生下面的欢呼声

    conditional output

    2 回复  |  直到 7 年前
        1
  •  1
  •   SeGa    7 年前

    我想这就是你想要的还是?

    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)
    
        2
  •  -2
  •   Sovik Gupta    7 年前

    how to acheive conditional output based on tab selection in shiny app

    我认为上面的链接可以给你一个很好的信息,如何写有条件的情况。它还有一个链接,里面有一个应用条件案例的适当教程,希望对你有帮助。