Andre Poenitz wrote: >> Is there a nice script that replaces SW macros like \unit{} with >> normal tex commands? > > You could simply define a \unit macro that does what you need > without translating it at all. Apart from that,
Alternatively, create a math-macro. For example, if I open up a new, empty document and then type M-x (the Alt key and 'x' at the same time) the cursor is placed in the minibuffer at the bottom of the LyX window. Typing in this window: math-macro Vector 1[Return] creates a math-macro in the main LyX window, looking something like: Macro: Vector: [][] Input the latex definition of the macro in the first box. In my case that would be Macro: Vector: [\boldmath{#1}][] Usually you should leave the second box empty. It is a useful hack for those times when the math editor doesn't provide visual feedback for the macro you have defined. For example, LyX 1.3.x has no native support for \boldmath, so you can 'fix' the display by telling LyX to use \mathbf or similar. Macro: Vector: [\boldmath{#1}][\mathbf<space>#1] where <space> is a literal space char. Note that, because LyX understands \mathbf, this gets translated so that the '#1' is typeset in bold. What to put in the box? Whatever SW uses as its definition of \unit. -- Angus