textr-markdownequations

Parentheses under equations with two lines of text Rmarkdown


I would like to write in a Rmarkdown document an equation with some explanations below it. I have found the functions \underbrace{} coupled with _\textrm{}.

\underbrace{X}_\textrm{Text1 for X} = \underbrace{Y}_\textrm{Text1 for Y}

This is working perfectly fine for me. What I would like to add is a second text line for the variable X and Y. I tried splitting the text inside \textrm{} and adding a new term \textrm{}. But none of those solutions worked. Does anyone have an idea?


Solution

  • According to this tex.SE answer, you can use \substack (and \\ for newlines):

    $$\underbrace{X}_{\substack{\textrm{Text1 for X}\\  \textrm{Text2 for X}}}$$