Re: Getting LyX to replace custom-defined symbols as if they were standard LaTeX symbols

2005-02-04 Thread Davide Cescato
Hello,
Thanks for your reply and your example with \nicefraction. I did as you 
wrote but not get the instant preview to work, but the solution with 
math-macro works as wished and rocks!

Thank you very much!
D.
Johan Ingvast wrote:
On Wed, 2 Feb 2005, Davide Cescato wrote:

Hello,
I am writing a draft for an article and I am still unsure about the 
names of some variables I am going to use in my final version. In order 
to handle this situation, in LaTeX I would define

\newcommand{\ntx}{N_T}
\newcommand{\nrx}{N_R}
and then use \ntx and \nrx in my formulas whenever needed. If I later 
decide to use M_T instead of N_T, I can just redefine \ntx 
correspondingly without replacing all occurrencies in the document.

I can do the same in LyX, by adding the commands above to the document 
header or as LaTeX code within the document body.

The point is that if I enter math mode and type \ntx\sigma\nrx , LyX 
will replace the LaTeX standard \sigma command with the Greek character, 
but not my custom-defined symbols, which will only appear with their 
command names in red. This makes my formulas almost as unreadable as if 
they were written in plain LaTeX!

Is there a way to make LyX replace my commands as well, as it does with 
the standard LaTeX ones?
I think that math-macro is what you really need. 
Math macro is like \newcommand and some more ...
In the beginning of the document type:
M-x math-macro ntx 0
Then you get a box at the cursor consisting of Macro: ntx and two boxes
In the first box you fill in what shuld be displayed when processed by
latex. The second box is what is shown in the lyx editor when you type \ntx.

You can also add arguments to the math-macro by replacing the 0 to the
number of arguments you want. The arguments are called by #no
I sometimes defines a nicefraction by  M-x math-macro nf 2
\nicefrac{#1}{#2}   % first box
#1/#2   % second box
(with \usepackage{nicefrac} in preamble)
Then i get nice looking fractions in the output when calling \nf
Another maybe simpler solution is to turn on the instant-preview
(in Preferences/Look and freel/graphics (qt-version))
and have your \newcommand's in the preamble. Then you will see the result
in the lyx windown when you leave the equation.
/johan



Re: Getting LyX to replace custom-defined symbols as if they were standard LaTeX symbols

2005-02-04 Thread Davide Cescato
Hello,
Thanks for your reply and your example with \nicefraction. I did as you 
wrote but not get the instant preview to work, but the solution with 
math-macro works as wished and rocks!

Thank you very much!
D.
Johan Ingvast wrote:
On Wed, 2 Feb 2005, Davide Cescato wrote:

Hello,
I am writing a draft for an article and I am still unsure about the 
names of some variables I am going to use in my final version. In order 
to handle this situation, in LaTeX I would define

\newcommand{\ntx}{N_T}
\newcommand{\nrx}{N_R}
and then use \ntx and \nrx in my formulas whenever needed. If I later 
decide to use M_T instead of N_T, I can just redefine \ntx 
correspondingly without replacing all occurrencies in the document.

I can do the same in LyX, by adding the commands above to the document 
header or as LaTeX code within the document body.

The point is that if I enter math mode and type \ntx\sigma\nrx , LyX 
will replace the LaTeX standard \sigma command with the Greek character, 
but not my custom-defined symbols, which will only appear with their 
command names in red. This makes my formulas almost as unreadable as if 
they were written in plain LaTeX!

Is there a way to make LyX replace my commands as well, as it does with 
the standard LaTeX ones?
I think that math-macro is what you really need. 
Math macro is like \newcommand and some more ...
In the beginning of the document type:
M-x math-macro ntx 0
Then you get a box at the cursor consisting of Macro: ntx and two boxes
In the first box you fill in what shuld be displayed when processed by
latex. The second box is what is shown in the lyx editor when you type \ntx.

You can also add arguments to the math-macro by replacing the 0 to the
number of arguments you want. The arguments are called by #no
I sometimes defines a nicefraction by  M-x math-macro nf 2
\nicefrac{#1}{#2}   % first box
#1/#2   % second box
(with \usepackage{nicefrac} in preamble)
Then i get nice looking fractions in the output when calling \nf
Another maybe simpler solution is to turn on the instant-preview
(in Preferences/Look and freel/graphics (qt-version))
and have your \newcommand's in the preamble. Then you will see the result
in the lyx windown when you leave the equation.
/johan



Re: Getting LyX to replace custom-defined symbols as if they were standard LaTeX symbols

2005-02-04 Thread Davide Cescato
Hello,
Thanks for your reply and your example with \nicefraction. I did as you 
wrote but not get the instant preview to work, but the solution with 
math-macro works as wished and rocks!

Thank you very much!
D.
Johan Ingvast wrote:
On Wed, 2 Feb 2005, Davide Cescato wrote:

Hello,
I am writing a draft for an article and I am still unsure about the 
names of some variables I am going to use in my final version. In order 
to handle this situation, in LaTeX I would define

\newcommand{\ntx}{N_T}
\newcommand{\nrx}{N_R}
and then use \ntx and \nrx in my formulas whenever needed. If I later 
decide to use M_T instead of N_T, I can just redefine \ntx 
correspondingly without replacing all occurrencies in the document.

I can do the same in LyX, by adding the commands above to the document 
header or as LaTeX code within the document body.

The point is that if I enter math mode and type \ntx\sigma\nrx , LyX 
will replace the LaTeX standard \sigma command with the Greek character, 
but not my custom-defined symbols, which will only appear with their 
command names in red. This makes my formulas almost as unreadable as if 
they were written in plain LaTeX!

Is there a way to make LyX replace my commands as well, as it does with 
the standard LaTeX ones?
I think that math-macro is what you really need. 
Math macro is like \newcommand and some more ...
In the beginning of the document type:
M-x math-macro ntx 0
Then you get a box at the cursor consisting of "Macro: ntx" and two boxes
In the first box you fill in what shuld be displayed when processed by
latex. The second box is what is shown in the lyx editor when you type \ntx.

You can also add arguments to the math-macro by replacing the 0 to the
number of arguments you want. The arguments are called by #no
I sometimes defines a nicefraction by  M-x math-macro nf 2
\nicefrac{#1}{#2}   % first box
#1/#2   % second box
(with \usepackage{nicefrac} in preamble)
Then i get nice looking fractions in the output when calling \nf
Another maybe simpler solution is to turn on the instant-preview
(in Preferences/Look and freel/graphics (qt-version))
and have your \newcommand's in the preamble. Then you will see the result
in the lyx windown when you leave the equation.
/johan



Getting LyX to replace custom-defined symbols as if they were standard LaTeX symbols

2005-02-02 Thread Davide Cescato
Hello,
I am writing a draft for an article and I am still unsure about the 
names of some variables I am going to use in my final version. In order 
to handle this situation, in LaTeX I would define

\newcommand{\ntx}{N_T}
\newcommand{\nrx}{N_R}
and then use \ntx and \nrx in my formulas whenever needed. If I later 
decide to use M_T instead of N_T, I can just redefine \ntx 
correspondingly without replacing all occurrencies in the document.

I can do the same in LyX, by adding the commands above to the document 
header or as LaTeX code within the document body.

The point is that if I enter math mode and type \ntx\sigma\nrx , LyX 
will replace the LaTeX standard \sigma command with the Greek character, 
but not my custom-defined symbols, which will only appear with their 
command names in red. This makes my formulas almost as unreadable as if 
they were written in plain LaTeX!

Is there a way to make LyX replace my commands as well, as it does with 
the standard LaTeX ones?

Thanks for your suggestions
D.


Re: Getting LyX to replace custom-defined symbols as if they were standard LaTeX symbols

2005-02-02 Thread Johan Ingvast
On Wed, 2 Feb 2005, Davide Cescato wrote:

 Hello,
 
 I am writing a draft for an article and I am still unsure about the 
 names of some variables I am going to use in my final version. In order 
 to handle this situation, in LaTeX I would define
 
 \newcommand{\ntx}{N_T}
 \newcommand{\nrx}{N_R}
 
 and then use \ntx and \nrx in my formulas whenever needed. If I later 
 decide to use M_T instead of N_T, I can just redefine \ntx 
 correspondingly without replacing all occurrencies in the document.
 
 I can do the same in LyX, by adding the commands above to the document 
 header or as LaTeX code within the document body.
 
 The point is that if I enter math mode and type \ntx\sigma\nrx , LyX 
 will replace the LaTeX standard \sigma command with the Greek character, 
 but not my custom-defined symbols, which will only appear with their 
 command names in red. This makes my formulas almost as unreadable as if 
 they were written in plain LaTeX!
 
 Is there a way to make LyX replace my commands as well, as it does with 
 the standard LaTeX ones?
I think that math-macro is what you really need. 
Math macro is like \newcommand and some more ...
In the beginning of the document type:
M-x math-macro ntx 0
Then you get a box at the cursor consisting of Macro: ntx and two boxes
In the first box you fill in what shuld be displayed when processed by
latex. The second box is what is shown in the lyx editor when you type \ntx.

You can also add arguments to the math-macro by replacing the 0 to the
number of arguments you want. The arguments are called by #no
I sometimes defines a nicefraction by  M-x math-macro nf 2
\nicefrac{#1}{#2}   % first box
#1/#2   % second box
(with \usepackage{nicefrac} in preamble)
Then i get nice looking fractions in the output when calling \nf

Another maybe simpler solution is to turn on the instant-preview
(in Preferences/Look and freel/graphics (qt-version))
and have your \newcommand's in the preamble. Then you will see the result
in the lyx windown when you leave the equation.

/johan

-- 
Johan Ingvast, PhD student http://www.md.kth.se/~ingvast
Department of Machine Design, Royal Institute of Technology, Sweden
http://www.md.kth.se, http://www.md.kth.se/~cas --- Walking robot proj
tel +46 (0)8 790 95 36  mob. +46 (0)70 34 34 498




Re: Getting LyX to replace custom-defined symbols as if they were standard LaTeX symbols

2005-02-02 Thread Vaclav Smidl
It si probably math-macros what you are looking for.
Basicaly, it is LyX frontend to \newcommand.

It is all well described in the User Guide (MenuHelpUserGuide), Section 5.6 
Usedr defined macros in math mode.

good luck,

Vasek


On Wednesday 02 February 2005 17:10, Davide Cescato wrote:
 Hello,

 I am writing a draft for an article and I am still unsure about the
 names of some variables I am going to use in my final version. In order
 to handle this situation, in LaTeX I would define

 \newcommand{\ntx}{N_T}
 \newcommand{\nrx}{N_R}

 and then use \ntx and \nrx in my formulas whenever needed. If I later
 decide to use M_T instead of N_T, I can just redefine \ntx
 correspondingly without replacing all occurrencies in the document.

 I can do the same in LyX, by adding the commands above to the document
 header or as LaTeX code within the document body.

 The point is that if I enter math mode and type \ntx\sigma\nrx , LyX
 will replace the LaTeX standard \sigma command with the Greek character,
 but not my custom-defined symbols, which will only appear with their
 command names in red. This makes my formulas almost as unreadable as if
 they were written in plain LaTeX!

 Is there a way to make LyX replace my commands as well, as it does with
 the standard LaTeX ones?

 Thanks for your suggestions

 D.

-- 
-
Ing. Vaclav Smidl, Ph.D.tel: +420 26605 2420
AS department,  Institute   web: http://www.utia.cas.cz/AS/smidl/
of Information Theory and Automation,   fax: +420 26605 2068
Prague, Czech Republic


Getting LyX to replace custom-defined symbols as if they were standard LaTeX symbols

2005-02-02 Thread Davide Cescato
Hello,
I am writing a draft for an article and I am still unsure about the 
names of some variables I am going to use in my final version. In order 
to handle this situation, in LaTeX I would define

\newcommand{\ntx}{N_T}
\newcommand{\nrx}{N_R}
and then use \ntx and \nrx in my formulas whenever needed. If I later 
decide to use M_T instead of N_T, I can just redefine \ntx 
correspondingly without replacing all occurrencies in the document.

I can do the same in LyX, by adding the commands above to the document 
header or as LaTeX code within the document body.

The point is that if I enter math mode and type \ntx\sigma\nrx , LyX 
will replace the LaTeX standard \sigma command with the Greek character, 
but not my custom-defined symbols, which will only appear with their 
command names in red. This makes my formulas almost as unreadable as if 
they were written in plain LaTeX!

Is there a way to make LyX replace my commands as well, as it does with 
the standard LaTeX ones?

Thanks for your suggestions
D.


Re: Getting LyX to replace custom-defined symbols as if they were standard LaTeX symbols

2005-02-02 Thread Johan Ingvast
On Wed, 2 Feb 2005, Davide Cescato wrote:

 Hello,
 
 I am writing a draft for an article and I am still unsure about the 
 names of some variables I am going to use in my final version. In order 
 to handle this situation, in LaTeX I would define
 
 \newcommand{\ntx}{N_T}
 \newcommand{\nrx}{N_R}
 
 and then use \ntx and \nrx in my formulas whenever needed. If I later 
 decide to use M_T instead of N_T, I can just redefine \ntx 
 correspondingly without replacing all occurrencies in the document.
 
 I can do the same in LyX, by adding the commands above to the document 
 header or as LaTeX code within the document body.
 
 The point is that if I enter math mode and type \ntx\sigma\nrx , LyX 
 will replace the LaTeX standard \sigma command with the Greek character, 
 but not my custom-defined symbols, which will only appear with their 
 command names in red. This makes my formulas almost as unreadable as if 
 they were written in plain LaTeX!
 
 Is there a way to make LyX replace my commands as well, as it does with 
 the standard LaTeX ones?
I think that math-macro is what you really need. 
Math macro is like \newcommand and some more ...
In the beginning of the document type:
M-x math-macro ntx 0
Then you get a box at the cursor consisting of Macro: ntx and two boxes
In the first box you fill in what shuld be displayed when processed by
latex. The second box is what is shown in the lyx editor when you type \ntx.

You can also add arguments to the math-macro by replacing the 0 to the
number of arguments you want. The arguments are called by #no
I sometimes defines a nicefraction by  M-x math-macro nf 2
\nicefrac{#1}{#2}   % first box
#1/#2   % second box
(with \usepackage{nicefrac} in preamble)
Then i get nice looking fractions in the output when calling \nf

Another maybe simpler solution is to turn on the instant-preview
(in Preferences/Look and freel/graphics (qt-version))
and have your \newcommand's in the preamble. Then you will see the result
in the lyx windown when you leave the equation.

/johan

-- 
Johan Ingvast, PhD student http://www.md.kth.se/~ingvast
Department of Machine Design, Royal Institute of Technology, Sweden
http://www.md.kth.se, http://www.md.kth.se/~cas --- Walking robot proj
tel +46 (0)8 790 95 36  mob. +46 (0)70 34 34 498




Re: Getting LyX to replace custom-defined symbols as if they were standard LaTeX symbols

2005-02-02 Thread Vaclav Smidl
It si probably math-macros what you are looking for.
Basicaly, it is LyX frontend to \newcommand.

It is all well described in the User Guide (MenuHelpUserGuide), Section 5.6 
Usedr defined macros in math mode.

good luck,

Vasek


On Wednesday 02 February 2005 17:10, Davide Cescato wrote:
 Hello,

 I am writing a draft for an article and I am still unsure about the
 names of some variables I am going to use in my final version. In order
 to handle this situation, in LaTeX I would define

 \newcommand{\ntx}{N_T}
 \newcommand{\nrx}{N_R}

 and then use \ntx and \nrx in my formulas whenever needed. If I later
 decide to use M_T instead of N_T, I can just redefine \ntx
 correspondingly without replacing all occurrencies in the document.

 I can do the same in LyX, by adding the commands above to the document
 header or as LaTeX code within the document body.

 The point is that if I enter math mode and type \ntx\sigma\nrx , LyX
 will replace the LaTeX standard \sigma command with the Greek character,
 but not my custom-defined symbols, which will only appear with their
 command names in red. This makes my formulas almost as unreadable as if
 they were written in plain LaTeX!

 Is there a way to make LyX replace my commands as well, as it does with
 the standard LaTeX ones?

 Thanks for your suggestions

 D.

-- 
-
Ing. Vaclav Smidl, Ph.D.tel: +420 26605 2420
AS department,  Institute   web: http://www.utia.cas.cz/AS/smidl/
of Information Theory and Automation,   fax: +420 26605 2068
Prague, Czech Republic


Getting LyX to replace custom-defined symbols as if they were standard LaTeX symbols

2005-02-02 Thread Davide Cescato
Hello,
I am writing a draft for an article and I am still unsure about the 
names of some variables I am going to use in my final version. In order 
to handle this situation, in LaTeX I would define

\newcommand{\ntx}{N_T}
\newcommand{\nrx}{N_R}
and then use \ntx and \nrx in my formulas whenever needed. If I later 
decide to use M_T instead of N_T, I can just redefine \ntx 
correspondingly without replacing all occurrencies in the document.

I can do the same in LyX, by adding the commands above to the document 
header or as LaTeX code within the document body.

The point is that if I enter math mode and type \ntx\sigma\nrx , LyX 
will replace the LaTeX standard \sigma command with the Greek character, 
but not my custom-defined symbols, which will only appear with their 
command names in red. This makes my formulas almost as unreadable as if 
they were written in plain LaTeX!

Is there a way to make LyX replace my commands as well, as it does with 
the standard LaTeX ones?

Thanks for your suggestions
D.


Re: Getting LyX to replace custom-defined symbols as if they were standard LaTeX symbols

2005-02-02 Thread Johan Ingvast
On Wed, 2 Feb 2005, Davide Cescato wrote:

> Hello,
> 
> I am writing a draft for an article and I am still unsure about the 
> names of some variables I am going to use in my final version. In order 
> to handle this situation, in LaTeX I would define
> 
> \newcommand{\ntx}{N_T}
> \newcommand{\nrx}{N_R}
> 
> and then use \ntx and \nrx in my formulas whenever needed. If I later 
> decide to use M_T instead of N_T, I can just redefine \ntx 
> correspondingly without replacing all occurrencies in the document.
> 
> I can do the same in LyX, by adding the commands above to the document 
> header or as LaTeX code within the document body.
> 
> The point is that if I enter math mode and type \ntx\sigma\nrx , LyX 
> will replace the LaTeX standard \sigma command with the Greek character, 
> but not my custom-defined symbols, which will only appear with their 
> command names in red. This makes my formulas almost as unreadable as if 
> they were written in plain LaTeX!
> 
> Is there a way to make LyX replace my commands as well, as it does with 
> the standard LaTeX ones?
I think that math-macro is what you really need. 
Math macro is like \newcommand and some more ...
In the beginning of the document type:
M-x math-macro ntx 0
Then you get a box at the cursor consisting of "Macro: ntx" and two boxes
In the first box you fill in what shuld be displayed when processed by
latex. The second box is what is shown in the lyx editor when you type \ntx.

You can also add arguments to the math-macro by replacing the 0 to the
number of arguments you want. The arguments are called by #no
I sometimes defines a nicefraction by  M-x math-macro nf 2
\nicefrac{#1}{#2}   % first box
#1/#2   % second box
(with \usepackage{nicefrac} in preamble)
Then i get nice looking fractions in the output when calling \nf

Another maybe simpler solution is to turn on the instant-preview
(in Preferences/Look and freel/graphics (qt-version))
and have your \newcommand's in the preamble. Then you will see the result
in the lyx windown when you leave the equation.

/johan

-- 
Johan Ingvast, PhD student http://www.md.kth.se/~ingvast
Department of Machine Design, Royal Institute of Technology, Sweden
http://www.md.kth.se, http://www.md.kth.se/~cas <--- Walking robot proj
tel +46 (0)8 790 95 36  mob. +46 (0)70 34 34 498




Re: Getting LyX to replace custom-defined symbols as if they were standard LaTeX symbols

2005-02-02 Thread Vaclav Smidl
It si probably math-macros what you are looking for.
Basicaly, it is LyX frontend to \newcommand.

It is all well described in the User Guide (Menu>Help>UserGuide), Section 5.6 
Usedr defined macros in math mode.

good luck,

Vasek


On Wednesday 02 February 2005 17:10, Davide Cescato wrote:
> Hello,
>
> I am writing a draft for an article and I am still unsure about the
> names of some variables I am going to use in my final version. In order
> to handle this situation, in LaTeX I would define
>
> \newcommand{\ntx}{N_T}
> \newcommand{\nrx}{N_R}
>
> and then use \ntx and \nrx in my formulas whenever needed. If I later
> decide to use M_T instead of N_T, I can just redefine \ntx
> correspondingly without replacing all occurrencies in the document.
>
> I can do the same in LyX, by adding the commands above to the document
> header or as LaTeX code within the document body.
>
> The point is that if I enter math mode and type \ntx\sigma\nrx , LyX
> will replace the LaTeX standard \sigma command with the Greek character,
> but not my custom-defined symbols, which will only appear with their
> command names in red. This makes my formulas almost as unreadable as if
> they were written in plain LaTeX!
>
> Is there a way to make LyX replace my commands as well, as it does with
> the standard LaTeX ones?
>
> Thanks for your suggestions
>
> D.

-- 
-
Ing. Vaclav Smidl, Ph.D.tel: +420 26605 2420
AS department,  Institute   web: http://www.utia.cas.cz/AS/smidl/
of Information Theory and Automation,   fax: +420 26605 2068
Prague, Czech Republic