I think I wrote here before about my work in improving math macros in LyX. LyX has some hacky support for them for quite a time. They are for LyX what \newcommand is for LaTeX. I use them heavily in my thesis to create complex lambda terms in WYSIWYG visual representation, works fantastic compared to staring minutes on a TeX version of a term in Emacs, loosing the overview all the time.
Well, a good reason the spend some time into improving LyX’s macro support. It’s hard to describe my approach here in a few words. Some more can be found here: http://wiki.lyx.org/Devel/Macros .
Next to free software there is also the commercial Scientific WorkPlace which has the same goal as LyX. I expected it to have some support for macros as well. In fact it has, but it resolves them during import as far as I can see. Also my colleague, who is a big fan of Scientific WorkPlace, could tell me anything different. So, no chance to borrow some ideas from them.
My main problem currently is to find an elegant intuitive way to switch between the WYSIWYG display (the macro definition is shown with “holes” in it to fill with the arguments) and the TeX display, i.e. displaying it verbatim as \foo{arg1}{arg2}. The old implementation in LyX 1.5 and older does a switch to a similar view everytime you enter the macro with the cursor. This is very awkward because again loose the overview of your formulas because the display jumps around. Normally you don’t want that and only in exceptional cases it is desired to see this mode.