Re: Strange behaviour on user command defined in preamble.

2012-07-27 Thread PhilipPirrip
Why don't you try this: 
http://www.ctan.org/tex-archive/macros/latex/contrib/acronym/acronym.pdf


(Though I never worked with it, I think that InsertNomenclature 
entry... could do the same within LyX)




Re: Strange behaviour on user command defined in preamble.

2012-07-27 Thread Guenter Milde
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 ViewLaTeX 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 (HelpMaths).
   
 Do you have any suggestions?

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

Günter




Re: Strange behaviour on user command defined in preamble.

2012-07-27 Thread PhilipPirrip
Why don't you try this: 
http://www.ctan.org/tex-archive/macros/latex/contrib/acronym/acronym.pdf


(Though I never worked with it, I think that InsertNomenclature 
entry... could do the same within LyX)




Re: Strange behaviour on user command defined in preamble.

2012-07-27 Thread Guenter Milde
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 ViewLaTeX 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 (HelpMaths).
   
 Do you have any suggestions?

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

Günter




Re: Strange behaviour on user command defined in preamble.

2012-07-27 Thread PhilipPirrip
Why don't you try this: 
http://www.ctan.org/tex-archive/macros/latex/contrib/acronym/acronym.pdf


(Though I never worked with it, I think that Insert>Nomenclature 
entry... could do the same within LyX)




Re: Strange behaviour on user command defined in preamble.

2012-07-27 Thread Guenter Milde
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




Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread PhilipPirrip



Do you have any suggestions?


Minimal example .lyx file please.



Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread PhilipPirrip

The attached example works for me, an produces


-

Else1 Else2 is















-


simbolo-minimal.lyx
Description: application/lyx


Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread Carlos Eduardo de Brito Novaes
This test case worked here too. Just my file behave strange, if I wrote some 
parts I got no errors, but if I copy the section that gave-me errors in your 
example it works fine.
I found out that for some reason the lyx code had an line \lang brasilian 
just 
after the section that does not work, I just open the lyx file in a text editor 
and deleted that line. Everything works fine now.




Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread Carlos Eduardo de Brito Novaes

I tried to replicate this error by setting a different language on different 
sections
(something I do frequently in citations and for some expressions), but I 
cant reproduce the error anymore. Maybe if I mess up the text a little.

Thanks for the help.





Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread Carlos Eduardo de Brito Novaes

I tried to replicate this error by setting a different language on different 
sections
(something I do frequently in citations and for some expressions), but I 
cant reproduce the error anymore. Maybe if I mess up the text a little.

Thanks for the help.



Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread Carlos Eduardo de Brito Novaes
Just for information, the actual command definition is presented below.
I plan to use at the very first time a symbol is declared so it will get 
written 
to the list of symbols with the corresponding description.

\newcommand{\simbolo}[2]
{
  \ifthenelse{\equal{#2}{}}
{\addcontentsline{los}{simbolo}{#1}#1}
{\addcontentsline{los}{simbolo}{#1: #2}#1}
}





Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread PhilipPirrip



Do you have any suggestions?


Minimal example .lyx file please.



Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread PhilipPirrip

The attached example works for me, an produces


-

Else1 Else2 is















-


simbolo-minimal.lyx
Description: application/lyx


Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread Carlos Eduardo de Brito Novaes
This test case worked here too. Just my file behave strange, if I wrote some 
parts I got no errors, but if I copy the section that gave-me errors in your 
example it works fine.
I found out that for some reason the lyx code had an line \lang brasilian 
just 
after the section that does not work, I just open the lyx file in a text editor 
and deleted that line. Everything works fine now.




Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread Carlos Eduardo de Brito Novaes

I tried to replicate this error by setting a different language on different 
sections
(something I do frequently in citations and for some expressions), but I 
cant reproduce the error anymore. Maybe if I mess up the text a little.

Thanks for the help.





Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread Carlos Eduardo de Brito Novaes

I tried to replicate this error by setting a different language on different 
sections
(something I do frequently in citations and for some expressions), but I 
cant reproduce the error anymore. Maybe if I mess up the text a little.

Thanks for the help.



Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread Carlos Eduardo de Brito Novaes
Just for information, the actual command definition is presented below.
I plan to use at the very first time a symbol is declared so it will get 
written 
to the list of symbols with the corresponding description.

\newcommand{\simbolo}[2]
{
  \ifthenelse{\equal{#2}{}}
{\addcontentsline{los}{simbolo}{#1}#1}
{\addcontentsline{los}{simbolo}{#1: #2}#1}
}





Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread PhilipPirrip



Do you have any suggestions?


Minimal example .lyx file please.



Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread PhilipPirrip

The attached example works for me, an produces


-

Else1 Else2 is















-


simbolo-minimal.lyx
Description: application/lyx


Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread Carlos Eduardo de Brito Novaes
This test case worked here too. Just my file behave strange, if I wrote some 
parts I got no errors, but if I copy the section that gave-me errors in your 
example it works fine.
I found out that for some reason the lyx code had an line "\lang brasilian" 
just 
after the section that does not work, I just open the lyx file in a text editor 
and deleted that line. Everything works fine now.




Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread Carlos Eduardo de Brito Novaes

I tried to replicate this error by setting a different language on different 
sections
(something I do frequently in citations and for some expressions), but I 
cant reproduce the error anymore. Maybe if I mess up the text a little.

Thanks for the help.





Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread Carlos Eduardo de Brito Novaes

I tried to replicate this error by setting a different language on different 
sections
(something I do frequently in citations and for some expressions), but I 
cant reproduce the error anymore. Maybe if I mess up the text a little.

Thanks for the help.



Re: Strange behaviour on user command defined in preamble.

2012-07-26 Thread Carlos Eduardo de Brito Novaes
Just for information, the actual command definition is presented below.
I plan to use at the very first time a symbol is declared so it will get 
written 
to the list of symbols with the corresponding description.

\newcommand{\simbolo}[2]
{
  \ifthenelse{\equal{#2}{}}
{\addcontentsline{los}{simbolo}{#1}#1}
{\addcontentsline{los}{simbolo}{#1: #2}#1}
}