On 2012-07-26, Carlos Eduardo de Brito Novaes wrote:

> I use lyx for some years, and use some (very few) advanced features. By
> now I intend to create a command to create a list of simbols in abnt
> style. So I wrote this in the preamble, for testing reasons only.

> \newcommand{\simbolo}[2]
> {
>   \ifthenelse{\equal{#1}{}}
>     {Then1}
>     {Else1}
>  \ifthenelse{\equal{#2}{}}
>     {Then2}
>     {Else2}
> }

> And in plain latex I would use:

> ...a vector defined in 
>      \simbolo{$R^{n}$}{Euclidian Space of dimension n} is ...

> wich works as expected.

> But in lyx, I had found out that if I insert a ert (wrote ert in <> and the 
> text in $$ is inserted with lyx math mode): 

Don't nest an ERT-inset in a math-inset. Instead, type in a math-box

   \simbolo{
   
and you will get the LaTeX $\simbolo{ } with the cursor between the braces
(open View>LaTeX Source to see the effect).

Now insert the first argument and type

   \{
   
to get an unescaped pair of braces for the second argument.

This is described in the mathematics manual (Help>Maths).
   
> Do you have any suggestions?

Consider creating a math-macro instead of a preamble definition. (Again, see
the mathematics manual for guidance.

Günter


Reply via email to