Re: math macros via LaTex preamble

2012-07-22 Thread Richard Heck

On 07/21/2012 11:34 PM, Allen Barker wrote:

On 07/20/2012 03:40 AM, Guenter Milde wrote:

Also, math-macros are document specific - defining a math-macro in one
document does not make it available in other ones. This is why my
documents include a file of commonly used math macros -- just like I
\input a file with commonly used preamble definitions in my LaTeX
documents.


Could you elaborate on the best way to include a file of
commonly-used math macros, in a way which is compatible
with Lyx?  I tend to use a lot of \DeclareMathOperator
commands in the preamble, for example.


These kinds of commands do not (now) have any LyX equivalent, so they are
just entered as raw LaTeX and naturally go in the preamble. So put them in
some file mycmds.tex, and input it into your LyX preamble in the usual way.


I've avoided the Lyx macro stuff so far because it has
seemed to me to be *too* document specific.  I don't know
if it actually is, but I haven't found that information in
the preliminary searches I've conducted.

I have several files, for different projects, that contain nothing but 
math macros.

This gets input into my other documents, using InsertFileChild Document.

Note that LyX doesn't know anything about what you put in the preamble (it
just gets output raw into your document preamble), so if you use your new
math operators in LyX, they'll work, but not look nice. So the attached 
shows
a way around this problem. The difference between \test and \lest 
doesn't show

up inside LyX, but it does in the output.

Richard



mathop.lyx
Description: application/lyx


RE: math macros via LaTex preamble

2012-07-22 Thread Scott Kostyshak
From: Richard Heck [rgh...@lyx.org]
Sent: Sunday, July 22, 2012 10:20 AM

So the attached shows a way around this problem. The difference between \test 
and \lest
doesn't show up inside LyX, but it does in the output.

Is there any way to put these inside a preview inset?

Scott

Re: math macros via LaTex preamble

2012-07-22 Thread Guenter Milde
On 2012-07-22, Allen Barker wrote:
 On 07/20/2012 03:40 AM, Guenter Milde wrote:
 Also, math-macros are document specific - defining a math-macro in one
 document does not make it available in other ones. This is why my
 documents include a file of commonly used math macros -- just like I
 \input a file with commonly used preamble definitions in my LaTeX
 documents.

 Could you elaborate on the best way to include a file of
 commonly-used math macros, in a way which is compatible
 with Lyx?  I tend to use a lot of \DeclareMathOperator
 commands in the preamble, for example.

For definitions that should work in most documents, I use two files, a
tex preamble and a lyx preamble.

In DocumentSettingsLaTeX preamble, I write
 
 \input{preamble.tex}
 
and in the document itself I have an inset with
  
 InsertFileLyX Documentmath-macros.lyx.

In math-macros.lyx I use a branch macro-doc that is usually inactiv for
the comments/documentation.

Instead of \DeclareMathOperator, I use \operatorname in a math-macro, say
\Re := \operatorname{Re} which then translates to 

  \global\long\def\Re{\operatorname{Re}}
 
 Any general comments on the best way to organize and
 include preamble material in a way which is compatible
 with Lyx would also be appreciated.

The best way generally depends on weather conditions, personal preference
and other circumstances. 

For parent/child documents, I put the math-macros file (together with
some other stuff) in a branch that is set active in the child but inactive
in the parent doc. This way the child is also a valid standalone document.


Günter



Re: math macros via LaTex preamble

2012-07-22 Thread Richard Heck

On 07/21/2012 11:34 PM, Allen Barker wrote:

On 07/20/2012 03:40 AM, Guenter Milde wrote:

Also, math-macros are document specific - defining a math-macro in one
document does not make it available in other ones. This is why my
documents include a file of commonly used math macros -- just like I
\input a file with commonly used preamble definitions in my LaTeX
documents.


Could you elaborate on the best way to include a file of
commonly-used math macros, in a way which is compatible
with Lyx?  I tend to use a lot of \DeclareMathOperator
commands in the preamble, for example.


These kinds of commands do not (now) have any LyX equivalent, so they are
just entered as raw LaTeX and naturally go in the preamble. So put them in
some file mycmds.tex, and input it into your LyX preamble in the usual way.


I've avoided the Lyx macro stuff so far because it has
seemed to me to be *too* document specific.  I don't know
if it actually is, but I haven't found that information in
the preliminary searches I've conducted.

I have several files, for different projects, that contain nothing but 
math macros.

This gets input into my other documents, using InsertFileChild Document.

Note that LyX doesn't know anything about what you put in the preamble (it
just gets output raw into your document preamble), so if you use your new
math operators in LyX, they'll work, but not look nice. So the attached 
shows
a way around this problem. The difference between \test and \lest 
doesn't show

up inside LyX, but it does in the output.

Richard



mathop.lyx
Description: application/lyx


RE: math macros via LaTex preamble

2012-07-22 Thread Scott Kostyshak
From: Richard Heck [rgh...@lyx.org]
Sent: Sunday, July 22, 2012 10:20 AM

So the attached shows a way around this problem. The difference between \test 
and \lest
doesn't show up inside LyX, but it does in the output.

Is there any way to put these inside a preview inset?

Scott

Re: math macros via LaTex preamble

2012-07-22 Thread Guenter Milde
On 2012-07-22, Allen Barker wrote:
 On 07/20/2012 03:40 AM, Guenter Milde wrote:
 Also, math-macros are document specific - defining a math-macro in one
 document does not make it available in other ones. This is why my
 documents include a file of commonly used math macros -- just like I
 \input a file with commonly used preamble definitions in my LaTeX
 documents.

 Could you elaborate on the best way to include a file of
 commonly-used math macros, in a way which is compatible
 with Lyx?  I tend to use a lot of \DeclareMathOperator
 commands in the preamble, for example.

For definitions that should work in most documents, I use two files, a
tex preamble and a lyx preamble.

In DocumentSettingsLaTeX preamble, I write
 
 \input{preamble.tex}
 
and in the document itself I have an inset with
  
 InsertFileLyX Documentmath-macros.lyx.

In math-macros.lyx I use a branch macro-doc that is usually inactiv for
the comments/documentation.

Instead of \DeclareMathOperator, I use \operatorname in a math-macro, say
\Re := \operatorname{Re} which then translates to 

  \global\long\def\Re{\operatorname{Re}}
 
 Any general comments on the best way to organize and
 include preamble material in a way which is compatible
 with Lyx would also be appreciated.

The best way generally depends on weather conditions, personal preference
and other circumstances. 

For parent/child documents, I put the math-macros file (together with
some other stuff) in a branch that is set active in the child but inactive
in the parent doc. This way the child is also a valid standalone document.


Günter



Re: math macros via LaTex preamble

2012-07-22 Thread Richard Heck

On 07/21/2012 11:34 PM, Allen Barker wrote:

On 07/20/2012 03:40 AM, Guenter Milde wrote:

Also, math-macros are document specific - defining a math-macro in one
document does not make it available in other ones. This is why my
documents include a file of commonly used math macros -- just like I
\input a file with commonly used preamble definitions in my LaTeX
documents.


Could you elaborate on the best way to include a file of
commonly-used math macros, in a way which is compatible
with Lyx?  I tend to use a lot of \DeclareMathOperator
commands in the preamble, for example.


These kinds of commands do not (now) have any LyX equivalent, so they are
just entered as raw LaTeX and naturally go in the preamble. So put them in
some file mycmds.tex, and input it into your LyX preamble in the usual way.


I've avoided the Lyx macro stuff so far because it has
seemed to me to be *too* document specific.  I don't know
if it actually is, but I haven't found that information in
the preliminary searches I've conducted.

I have several files, for different projects, that contain nothing but 
math macros.

This gets input into my other documents, using Insert>File>Child Document.

Note that LyX doesn't know anything about what you put in the preamble (it
just gets output raw into your document preamble), so if you use your new
math operators in LyX, they'll work, but not look nice. So the attached 
shows
a way around this problem. The difference between \test and \lest 
doesn't show

up inside LyX, but it does in the output.

Richard



mathop.lyx
Description: application/lyx


RE: math macros via LaTex preamble

2012-07-22 Thread Scott Kostyshak
From: Richard Heck [rgh...@lyx.org]
Sent: Sunday, July 22, 2012 10:20 AM

>So the attached shows a way around this problem. The difference between \test 
>and \lest
>doesn't show up inside LyX, but it does in the output.

Is there any way to put these inside a preview inset?

Scott

Re: math macros via LaTex preamble

2012-07-22 Thread Guenter Milde
On 2012-07-22, Allen Barker wrote:
> On 07/20/2012 03:40 AM, Guenter Milde wrote:
>> Also, math-macros are document specific - defining a math-macro in one
>> document does not make it available in other ones. This is why my
>> documents include a file of commonly used math macros -- just like I
>> \input a file with commonly used preamble definitions in my LaTeX
>> documents.

> Could you elaborate on the best way to include a file of
> commonly-used math macros, in a way which is compatible
> with Lyx?  I tend to use a lot of \DeclareMathOperator
> commands in the preamble, for example.

For definitions that should work in most documents, I use two files, a
tex preamble and a lyx preamble.

In Document>Settings>LaTeX preamble, I write
 
 \input{preamble.tex}
 
and in the document itself I have an inset with
  
 Insert>File>LyX Document>math-macros.lyx.

In math-macros.lyx I use a branch "macro-doc" that is usually inactiv for
the comments/documentation.

Instead of \DeclareMathOperator, I use \operatorname in a math-macro, say
\Re := \operatorname{Re} which then translates to 

  \global\long\def\Re{\operatorname{Re}}
 
> Any general comments on the "best" way to organize and
> include preamble material in a way which is compatible
> with Lyx would also be appreciated.

The "best" way generally depends on weather conditions, personal preference
and other circumstances. 

For parent/child documents, I put the math-macros file (together with
some other stuff) in a branch that is set active in the child but inactive
in the parent doc. This way the child is also a valid standalone document.


Günter



Re: math macros via LaTex preamble

2012-07-21 Thread Allen Barker

On 07/20/2012 03:40 AM, Guenter Milde wrote:

Also, math-macros are document specific - defining a math-macro in one
document does not make it available in other ones. This is why my
documents include a file of commonly used math macros -- just like I
\input a file with commonly used preamble definitions in my LaTeX
documents.


Could you elaborate on the best way to include a file of
commonly-used math macros, in a way which is compatible
with Lyx?  I tend to use a lot of \DeclareMathOperator
commands in the preamble, for example.

I've avoided the Lyx macro stuff so far because it has
seemed to me to be *too* document specific.  I don't know
if it actually is, but I haven't found that information in
the preliminary searches I've conducted.

Any general comments on the best way to organize and
include preamble material in a way which is compatible
with Lyx would also be appreciated.




Re: math macros via LaTex preamble

2012-07-21 Thread Allen Barker

On 07/20/2012 03:40 AM, Guenter Milde wrote:

Also, math-macros are document specific - defining a math-macro in one
document does not make it available in other ones. This is why my
documents include a file of commonly used math macros -- just like I
\input a file with commonly used preamble definitions in my LaTeX
documents.


Could you elaborate on the best way to include a file of
commonly-used math macros, in a way which is compatible
with Lyx?  I tend to use a lot of \DeclareMathOperator
commands in the preamble, for example.

I've avoided the Lyx macro stuff so far because it has
seemed to me to be *too* document specific.  I don't know
if it actually is, but I haven't found that information in
the preliminary searches I've conducted.

Any general comments on the best way to organize and
include preamble material in a way which is compatible
with Lyx would also be appreciated.




Re: math macros via LaTex preamble

2012-07-21 Thread Allen Barker

On 07/20/2012 03:40 AM, Guenter Milde wrote:

Also, math-macros are document specific - defining a math-macro in one
document does not make it available in other ones. This is why my
documents include a file of commonly used math macros -- just like I
\input a file with commonly used preamble definitions in my LaTeX
documents.


Could you elaborate on the best way to include a file of
commonly-used math macros, in a way which is compatible
with Lyx?  I tend to use a lot of \DeclareMathOperator
commands in the preamble, for example.

I've avoided the Lyx macro stuff so far because it has
seemed to me to be *too* document specific.  I don't know
if it actually is, but I haven't found that information in
the preliminary searches I've conducted.

Any general comments on the "best" way to organize and
include preamble material in a way which is compatible
with Lyx would also be appreciated.




Re: math macros via LaTex preamble

2012-07-20 Thread Guenter Milde
On 2012-07-19, ralston wrote:

 I've got 10 years experience and 200 documents using LaTex with heavy
 math.  Like everyone else I paste a clot of \newcommands into my Latex
 preamble without looking at it.

 My student has recommended Lyx, which I appreciate has many great
 features.  I really want to like LyX.  What a great concept.  And
 yet... I find LyX math macros an absolutely horror. Why construct LyX
 to ignore macros in an imported LaTex preamble?  Why defeat the most
 popular usage, and why not write something to properly automate the
 import? 

Because (La)TeX is a macro language that is miles more difficult to
machine-parse than, say, XML.

This is why the focus is on *generating* (writing/editing) documents that
can be typeset with LaTeX (and/or HTML, Docbook, ...). LyX is *not* a LaTeX
editor.

Depending on your needs, existing documents and willingness to change
habits, LyX may boost your productivity or be not the tool of your choice.

 It's a fact that exchanging LaTex with collaborators and opening old
 files needs to be automated.  Yet Lyx wants me to paste macros by hand
 into every document, or else create subsidiary file systems I don't
 understand with no examples of what to do.  

I don't understand where LyX wants you to paste macros by hand...

 Why not automate that? 

This is a task too difficult to be done completely automatically. LyX did
improve and specific suggestions for further improvement are welcome.

 Once I create a macro it won't update (for me!) in an imported LaTeX
 document, and the error messages are too non-specific to debug.

The math-macros are really just for math-mode commands. This is why LyX
does not convert preamble definitions to math-macros - is just does not
know whether they are math-mode or text-mode (or both). (See your list below
for a mix of math-mode and text-mode commands.)

Also, math-macros are document specific - defining a math-macro in one
document does not make it available in other ones. This is why my
documents include a file of commonly used math macros -- just like I
\input a file with commonly used preamble definitions in my LaTeX
documents.

 Import also seems to forget a lot of small things like ^{}, _{}  and
 matrix formats that are real work to fix.

Yes, there are many non-supported ways to write things in LaTeX.

 I've only got about 10 macros to get running, but LyX has fought me all
 the way.  I hope I'm in the wrong and working with basic concept errors
 someone could straighten out... and why doesn't LyX post at least one
 completely running imported mathy FILE example, rather than abstract
 principleswhile my excuse is a definite lack of interest in working
 with things that create more work than they save.  Frustrated by hours
 or wasted time, I probably seem cranky. 

I do understand your frustration. Please keep in mind that LyX is not an
enterprise solution promising easy LaTeX for all but a volunteer effort
to create a document processor that matches the expectations and ideals
of its developers with much input from the users. As such, it may be not
the right tool for you - at least it needs more patience for things that
might seem easy to you but are very complex from the point of a
programmer...

 In case I've not been too rude, here's some macros, which LyX gurus
 will not find profound; I will surely either convert with enthusiasm to
 LyX, or forbid all my students and contacts to ever touch it, depending
 on how the importing and exporting of latex with macros can be
 automated.

I hope you will come to a more tempered evaluation of the program.
Even if it is not the tool for you, it might be valuable for your
students.

 \newcommand{\ab}{\allowbreak} \newcommand{\bit}{\begin{itemize}}
 \newcommand{\eit}{\end{itemize}} \newcommand{\im}{\item}
 \newcommand{\be}{\begin{equation}} \newcommand{\ee}{\end{equation}}
 \newcommand{\ba}{\begin{eqnarray}} \newcommand{\ea}{\end{eqnarray}}
 \newcommand{\nn}{\nonumber} \renewcommand{\bf}{\textbf}

All of these are rather shortcut aliases for text mode. math-macro is not
the right thing to emulate them.
I would try to find out whether tex2lyx already can be configured to do a
back-replacement (e.g. \bf - \textbf) before converting to LyX format or
write a simple search-and replace script to do this in a preprocessing step.

As you are not going to use these commands directly when writing in LyX,
there is no need for supporting the aliases.

 \newcommand{\ra}{\rightarrow} \newcommand{\NN}{\vec \nabla}
 \def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox 
 to\wd0{\hss\sl/\/\hss}}
 \def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance
 \dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox
 to\wd0{\hss\sl/\/\hss}}

These are (as far as I can see) real math macros, hence it may be sensible
to define math-macros for them (if you want a nice look in LyX). However,
it is possible to use them as is in math insets - it just does not look so
nice with the red 

Re: math macros via LaTex preamble

2012-07-20 Thread Guenter Milde
On 2012-07-19, ralston wrote:

 I've got 10 years experience and 200 documents using LaTex with heavy
 math.  Like everyone else I paste a clot of \newcommands into my Latex
 preamble without looking at it.

 My student has recommended Lyx, which I appreciate has many great
 features.  I really want to like LyX.  What a great concept.  And
 yet... I find LyX math macros an absolutely horror. Why construct LyX
 to ignore macros in an imported LaTex preamble?  Why defeat the most
 popular usage, and why not write something to properly automate the
 import? 

Because (La)TeX is a macro language that is miles more difficult to
machine-parse than, say, XML.

This is why the focus is on *generating* (writing/editing) documents that
can be typeset with LaTeX (and/or HTML, Docbook, ...). LyX is *not* a LaTeX
editor.

Depending on your needs, existing documents and willingness to change
habits, LyX may boost your productivity or be not the tool of your choice.

 It's a fact that exchanging LaTex with collaborators and opening old
 files needs to be automated.  Yet Lyx wants me to paste macros by hand
 into every document, or else create subsidiary file systems I don't
 understand with no examples of what to do.  

I don't understand where LyX wants you to paste macros by hand...

 Why not automate that? 

This is a task too difficult to be done completely automatically. LyX did
improve and specific suggestions for further improvement are welcome.

 Once I create a macro it won't update (for me!) in an imported LaTeX
 document, and the error messages are too non-specific to debug.

The math-macros are really just for math-mode commands. This is why LyX
does not convert preamble definitions to math-macros - is just does not
know whether they are math-mode or text-mode (or both). (See your list below
for a mix of math-mode and text-mode commands.)

Also, math-macros are document specific - defining a math-macro in one
document does not make it available in other ones. This is why my
documents include a file of commonly used math macros -- just like I
\input a file with commonly used preamble definitions in my LaTeX
documents.

 Import also seems to forget a lot of small things like ^{}, _{}  and
 matrix formats that are real work to fix.

Yes, there are many non-supported ways to write things in LaTeX.

 I've only got about 10 macros to get running, but LyX has fought me all
 the way.  I hope I'm in the wrong and working with basic concept errors
 someone could straighten out... and why doesn't LyX post at least one
 completely running imported mathy FILE example, rather than abstract
 principleswhile my excuse is a definite lack of interest in working
 with things that create more work than they save.  Frustrated by hours
 or wasted time, I probably seem cranky. 

I do understand your frustration. Please keep in mind that LyX is not an
enterprise solution promising easy LaTeX for all but a volunteer effort
to create a document processor that matches the expectations and ideals
of its developers with much input from the users. As such, it may be not
the right tool for you - at least it needs more patience for things that
might seem easy to you but are very complex from the point of a
programmer...

 In case I've not been too rude, here's some macros, which LyX gurus
 will not find profound; I will surely either convert with enthusiasm to
 LyX, or forbid all my students and contacts to ever touch it, depending
 on how the importing and exporting of latex with macros can be
 automated.

I hope you will come to a more tempered evaluation of the program.
Even if it is not the tool for you, it might be valuable for your
students.

 \newcommand{\ab}{\allowbreak} \newcommand{\bit}{\begin{itemize}}
 \newcommand{\eit}{\end{itemize}} \newcommand{\im}{\item}
 \newcommand{\be}{\begin{equation}} \newcommand{\ee}{\end{equation}}
 \newcommand{\ba}{\begin{eqnarray}} \newcommand{\ea}{\end{eqnarray}}
 \newcommand{\nn}{\nonumber} \renewcommand{\bf}{\textbf}

All of these are rather shortcut aliases for text mode. math-macro is not
the right thing to emulate them.
I would try to find out whether tex2lyx already can be configured to do a
back-replacement (e.g. \bf - \textbf) before converting to LyX format or
write a simple search-and replace script to do this in a preprocessing step.

As you are not going to use these commands directly when writing in LyX,
there is no need for supporting the aliases.

 \newcommand{\ra}{\rightarrow} \newcommand{\NN}{\vec \nabla}
 \def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox 
 to\wd0{\hss\sl/\/\hss}}
 \def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance
 \dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox
 to\wd0{\hss\sl/\/\hss}}

These are (as far as I can see) real math macros, hence it may be sensible
to define math-macros for them (if you want a nice look in LyX). However,
it is possible to use them as is in math insets - it just does not look so
nice with the red 

Re: math macros via LaTex preamble

2012-07-20 Thread Guenter Milde
On 2012-07-19, ralston wrote:

> I've got 10 years experience and 200 documents using LaTex with heavy
> math.  Like everyone else I paste a clot of \newcommands into my Latex
> preamble without looking at it.

> My student has recommended Lyx, which I appreciate has many great
> features.  I really want to like LyX.  What a great concept.  And
> yet... I find LyX math macros an absolutely horror. Why construct LyX
> to ignore macros in an imported LaTex preamble?  Why defeat the most
> popular usage, and why not write something to properly automate the
> import? 

Because (La)TeX is a macro language that is miles more difficult to
machine-parse than, say, XML.

This is why the focus is on *generating* (writing/editing) documents that
can be typeset with LaTeX (and/or HTML, Docbook, ...). LyX is *not* a "LaTeX
editor".

Depending on your needs, existing documents and willingness to change
habits, LyX may boost your productivity or be not the tool of your choice.

> It's a fact that exchanging LaTex with collaborators and opening old
> files needs to be automated.  Yet Lyx wants me to paste macros by hand
> into every document, or else create subsidiary file systems I don't
> understand with no examples of what to do.  

I don't understand where LyX wants you to paste macros by hand...

> Why not automate that? 

This is a task too difficult to be done completely automatically. LyX did
improve and specific suggestions for further improvement are welcome.

> Once I create a macro it won't update (for me!) in an imported LaTeX
> document, and the error messages are too non-specific to debug.

The math-macros are really just for math-mode commands. This is why LyX
does not convert preamble definitions to "math-macros" - is just does not
know whether they are math-mode or text-mode (or both). (See your list below
for a mix of math-mode and text-mode commands.)

Also, math-macros are document specific - defining a math-macro in one
document does not make it available in other ones. This is why my
documents include a file of commonly used math macros -- just like I
\input a file with commonly used preamble definitions in my LaTeX
documents.

> Import also seems to forget a lot of small things like "^{}, _{} " and
> matrix formats that are real work to fix.

Yes, there are many non-supported ways to write things in LaTeX.

> I've only got about 10 macros to get running, but LyX has fought me all
> the way.  I hope I'm in the wrong and working with basic concept errors
> someone could straighten out... and why doesn't LyX post at least one
> completely running imported mathy FILE example, rather than abstract
> principleswhile my excuse is a definite lack of interest in working
> with things that create more work than they save.  Frustrated by hours
> or wasted time, I probably seem cranky. 

I do understand your frustration. Please keep in mind that LyX is not an
enterprise solution promising "easy LaTeX for all" but a volunteer effort
to create a document processor that matches the expectations and ideals
of its developers with much input from the users. As such, it may be not
the right tool for you - at least it needs more patience for things that
might seem easy to you but are very complex from the point of a
programmer...

> In case I've not been too rude, here's some macros, which LyX gurus
> will not find profound; I will surely either convert with enthusiasm to
> LyX, or forbid all my students and contacts to ever touch it, depending
> on how the importing and exporting of latex with macros can be
> automated.

I hope you will come to a more tempered evaluation of the program.
Even if it is not the tool for you, it might be valuable for your
students.

> \newcommand{\ab}{\allowbreak} \newcommand{\bit}{\begin{itemize}}
> \newcommand{\eit}{\end{itemize}} \newcommand{\im}{\item}
> \newcommand{\be}{\begin{equation}} \newcommand{\ee}{\end{equation}}
> \newcommand{\ba}{\begin{eqnarray}} \newcommand{\ea}{\end{eqnarray}}
> \newcommand{\nn}{\nonumber} \renewcommand{\bf}{\textbf}

All of these are rather shortcut aliases for text mode. "math-macro" is not
the right thing to emulate them.
I would try to find out whether tex2lyx already can be configured to do a
back-replacement (e.g. \bf -> \textbf) before converting to LyX format or
write a simple search-and replace script to do this in a preprocessing step.

As you are not going to use these commands directly when writing in LyX,
there is no need for supporting the aliases.

> \newcommand{\ra}{\rightarrow} \newcommand{\NN}{\vec \nabla}
> \def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox 
> to\wd0{\hss\sl/\/\hss}}
> \def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance
> \dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox
> to\wd0{\hss\sl/\/\hss}}

These are (as far as I can see) real math macros, hence it may be sensible
to define math-macros for them (if you want a "nice" look in LyX). However,
it is possible to use them "as is" in math 

math macros via LaTex preamble

2012-07-19 Thread ralston
I've got 10 years experience and 200 documents using LaTex with heavy math. 
Like everyone else I paste a clot of \newcommands into my Latex preamble 
without looking at it.
My student has recommended Lyx, which I appreciate has many great features. 
I really want to like LyX.  What a great concept.  And yet...
I find LyX math macros  an absolutely horror. Why construct LyX to ignore macros
in an imported LaTex preamble?  Why defeat the most
popular usage, and why not write something to properly automate the import? 
It's a
fact that exchanging LaTex with collaborators and opening old files needs to be 
automated.  Yet Lyx wants me
to paste macros by hand into every document, or else create subsidiary file 
systems
I don't understand with no examples of what to do.  Why not automate that? 
 Once I create a macro it won't update (for me!) in an imported LaTeX document,
and the error messages are too non-specific to debug.  Import also seems to 
forget
a lot of small things like ^{}, _{}   and matrix formats that are real work 
to fix.  I've only got about 10 macros
to get running, but  LyX has fought me all the way.  I hope I'm in the wrong 
and working with 
basic concept errors someone could straighten out... and why doesn't LyX post 
at least one
completely running imported mathy FILE example, rather than abstract 
principleswhile my excuse is a definite lack of interest
in working with things that create  more work than they save.  Frustrated by 
hours
or wasted time, I probably seem cranky.   In case I've not been too rude, 
here's some macros, which
LyX gurus will not find profound; I will surely either convert with enthusiasm 
to LyX, or forbid all
my students and contacts to ever touch it, depending on 
how the importing and exporting of latex with macros can be automated. 
\newcommand{\ab}{\allowbreak}
 \newcommand{\bit}{\begin{itemize}} \newcommand{\eit}{\end{itemize}}
\newcommand{\im}{\item}
\newcommand{\be}{\begin{equation}} \newcommand{\ee}{\end{equation}}
\newcommand{\ba}{\begin{eqnarray}} \newcommand{\ea}{\end{eqnarray}}
\newcommand{\nn}{\nonumber} \renewcommand{\bf}{\textbf}
\newcommand{\ra}{\rightarrow} \newcommand{\NN}{\vec \nabla}
\def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox 
to\wd0{\hss\sl/\/\hss}}
\def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance
\dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox
  to\wd0{\hss\sl/\/\hss}}

John P



--
View this message in context: 
http://lyx.475766.n2.nabble.com/math-macros-via-LaTex-preamble-tp7580151.html
Sent from the LyX - Users mailing list archive at Nabble.com.

math macros via LaTex preamble

2012-07-19 Thread ralston
I've got 10 years experience and 200 documents using LaTex with heavy math. 
Like everyone else I paste a clot of \newcommands into my Latex preamble 
without looking at it.
My student has recommended Lyx, which I appreciate has many great features. 
I really want to like LyX.  What a great concept.  And yet...
I find LyX math macros  an absolutely horror. Why construct LyX to ignore macros
in an imported LaTex preamble?  Why defeat the most
popular usage, and why not write something to properly automate the import? 
It's a
fact that exchanging LaTex with collaborators and opening old files needs to be 
automated.  Yet Lyx wants me
to paste macros by hand into every document, or else create subsidiary file 
systems
I don't understand with no examples of what to do.  Why not automate that? 
 Once I create a macro it won't update (for me!) in an imported LaTeX document,
and the error messages are too non-specific to debug.  Import also seems to 
forget
a lot of small things like ^{}, _{}   and matrix formats that are real work 
to fix.  I've only got about 10 macros
to get running, but  LyX has fought me all the way.  I hope I'm in the wrong 
and working with 
basic concept errors someone could straighten out... and why doesn't LyX post 
at least one
completely running imported mathy FILE example, rather than abstract 
principleswhile my excuse is a definite lack of interest
in working with things that create  more work than they save.  Frustrated by 
hours
or wasted time, I probably seem cranky.   In case I've not been too rude, 
here's some macros, which
LyX gurus will not find profound; I will surely either convert with enthusiasm 
to LyX, or forbid all
my students and contacts to ever touch it, depending on 
how the importing and exporting of latex with macros can be automated. 
\newcommand{\ab}{\allowbreak}
 \newcommand{\bit}{\begin{itemize}} \newcommand{\eit}{\end{itemize}}
\newcommand{\im}{\item}
\newcommand{\be}{\begin{equation}} \newcommand{\ee}{\end{equation}}
\newcommand{\ba}{\begin{eqnarray}} \newcommand{\ea}{\end{eqnarray}}
\newcommand{\nn}{\nonumber} \renewcommand{\bf}{\textbf}
\newcommand{\ra}{\rightarrow} \newcommand{\NN}{\vec \nabla}
\def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox 
to\wd0{\hss\sl/\/\hss}}
\def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance
\dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox
  to\wd0{\hss\sl/\/\hss}}

John P



--
View this message in context: 
http://lyx.475766.n2.nabble.com/math-macros-via-LaTex-preamble-tp7580151.html
Sent from the LyX - Users mailing list archive at Nabble.com.

math macros via LaTex preamble

2012-07-19 Thread ralston
I've got 10 years experience and 200 documents using LaTex with heavy math. 
Like everyone else I paste a clot of \newcommands into my Latex preamble 
without looking at it.
My student has recommended Lyx, which I appreciate has many great features. 
I really want to like LyX.  What a great concept.  And yet...
I find LyX math macros  an absolutely horror. Why construct LyX to ignore macros
in an imported LaTex preamble?  Why defeat the most
popular usage, and why not write something to properly automate the import? 
It's a
fact that exchanging LaTex with collaborators and opening old files needs to be 
automated.  Yet Lyx wants me
to paste macros by hand into every document, or else create subsidiary file 
systems
I don't understand with no examples of what to do.  Why not automate that? 
 Once I create a macro it won't update (for me!) in an imported LaTeX document,
and the error messages are too non-specific to debug.  Import also seems to 
forget
a lot of small things like "^{}, _{}  " and matrix formats that are real work 
to fix.  I've only got about 10 macros
to get running, but  LyX has fought me all the way.  I hope I'm in the wrong 
and working with 
basic concept errors someone could straighten out... and why doesn't LyX post 
at least one
completely running imported mathy FILE example, rather than abstract 
principleswhile my excuse is a definite lack of interest
in working with things that create  more work than they save.  Frustrated by 
hours
or wasted time, I probably seem cranky.   In case I've not been too rude, 
here's some macros, which
LyX gurus will not find profound; I will surely either convert with enthusiasm 
to LyX, or forbid all
my students and contacts to ever touch it, depending on 
how the importing and exporting of latex with macros can be automated. 
\newcommand{\ab}{\allowbreak}
 \newcommand{\bit}{\begin{itemize}} \newcommand{\eit}{\end{itemize}}
\newcommand{\im}{\item}
\newcommand{\be}{\begin{equation}} \newcommand{\ee}{\end{equation}}
\newcommand{\ba}{\begin{eqnarray}} \newcommand{\ea}{\end{eqnarray}}
\newcommand{\nn}{\nonumber} \renewcommand{\bf}{\textbf}
\newcommand{\ra}{\rightarrow} \newcommand{\NN}{\vec \nabla}
\def\slasha#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\hbox 
to\wd0{\hss\sl/\/\hss}}
\def\slashb#1{\setbox0=\hbox{$#1$}#1\hskip-\wd0\dimen0=5pt\advance
\dimen0 by-\ht0\advance\dimen0 by\dp0\lower0.5\dimen0\hbox
  to\wd0{\hss\sl/\/\hss}}

John P



--
View this message in context: 
http://lyx.475766.n2.nabble.com/math-macros-via-LaTex-preamble-tp7580151.html
Sent from the LyX - Users mailing list archive at Nabble.com.