Nick Kuzmik wrote:
I do a lot of math in lyx, and I create a lot of macros on the fly.
What's the best way to keep them organized? Maybe make it so every
file I open has all the same macros?
The way I've handled this is to create a special file, macros.lyx, which
contains my standard math-macros. I can then include it in any file I wish.
Two tips:
1. LyX will parse the math-macros in an included file and display
them the same way it does when they are declared in the main file.
However, for this to happen, it seems that the included file
(macros.lyx, that is) needs to be opened /before/ the file in
which it is included. This is a bit of a pain. (I've just filed an
enhancement request.)
2. If your main document is a master document that includes other
files, you can run into a problem if you include your macros file
in each sub-document: When you compile the main document, LaTeX
will choke on all the redefinitions of the macros. Solution: At
the beginning of the file, add ERT containing e.g.:
\ifx\EPS\undefined, and then at the end of the file: \fi. Here,
EPS can be any macro you define in the file and "undefined" can be
any macro that you know will remain, uh, undefined. If \EPS is
defined, LaTeX will skip the definitions: No choking.
Richard Heck