ray reeves wrote:
I have learned enough LyX to prepare a math document but now I would like to define some macros to abbreviate some commands. In Latex I can say: \define \name{body} but how shall I do the same thing in LyX? I've had no success with the TeX code boxes.
It depends. There's been talk of adding general macros to LyX, but I'm not sure if it's been implemented yet. If that's what you want, you can put the LaTeX definition in the preamble (Document > Settings > LaTeX Preamble) and then invoke the macros in ERT (TeX boxes).
On the other hand, if you're talking about macros to use in math mode, LyX already supports that. Somewhere in the document body, prior to where you first want to use the macro, click Insert > Math > Macro. That will create an inset that looks like \newmacroname:=[box][box]. Overwrite newmacroname with the name you want for the macro. In the TeX box, insert the LaTeX code you want the macro to generate. By default, that's what will show up in the GUI when you use the macro; if you want LyX to display something else in the GUI, you can put that into the LyX box. (I always leave the LyX box blank, but then I lack imagination. If the macro expands to something long and gory, I can see where you might want to use a shorter "place holder" in the GUI.)
You can also define your macro with arguments. All this is covered in section 20.2 of the Math help document, so I won't repeat it here.
/Paul
