7

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.

EDIT:

Answering to PhilipPirrip comment:

enter image description here

produces

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. – PhilipPirrip May 25 '18 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 '21 at 07:50

1 Answers1

1

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} 

enter image description here

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