# \parbox in mathmode in Lyx

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

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

so that the usage is

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.

EDIT:

produces

• 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

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

\documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{empheq}
\usepackage{bigstrut}

\begin{document}

$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}$%

\begin{empheq}[left=f(x)\to\empheqlbrace]{equation*}
\parbox{40mm}{$f(x)$ is a nice \emph{función}, so I want to add this multiline comment}
\end{empheq}

\end{document}


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