I am trying to write multiline text inside the mathmode in Lyx like this:

enter image description here

I did that based on this answer. I have made it work in Lyx by defining a macro

enter image description here

so that the usage is

enter image description here

and the output is that of the first picture. But there are some problems:

  1. As you can see I have to introduce blanc spaces "by hand" typing "\ ". I would like to be able to introduce spaces just hitting the bar (the same way as when inside a \text box).

  2. There is no way to introduce mathematical symbols. For example if instead of "This is a nice function..." I want to write "f(x) is a nice function...".

  3. I would like to have the possibility to introduce the characters áéíóú because I typically write in Spanish. This is also being impossible with my definition.


Answering to PhilipPirrip comment:

enter image description here


enter image description here

  • LyX obviously thinks your text is still a formula. Can you show what it exports for latex? LyX>View>Code preview. May 25, 2018 at 13:28
  • As for no.2, you might find \ensuremath macro useful. May I ask how did you add that tight text box in your macro definition? Thank you
    – Yoav
    May 15, 2021 at 7:50

1 Answer 1


I do not know LyX, but here are two possible LaTeX codes, based on empheq(which loads \=mathtools, which loads amsmath:



        \[ f(x)\to\begin{dcases}\parbox{40mm}{$f(x)$ is a nice \emph{función}, so I want to add this multiline comment\bigstrut[b]}
            \end{dcases} \]%

          \parbox{40mm}{$f(x)$ is a nice \emph{función}, so I want to add this multiline comment}


enter image description here

  • Thanks for your answer. In Latex I got it working, I was looking for a Lyx specific solution. Thanks anyway.
    – user171780
    May 23, 2018 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.