# LyX new macros and instant preview

When we define new macros in LyX, can we still have instant preview for them?

For example, I defined a new command `\abc`, but when I put `\abc` in the math inset, it does not have instant preview. Though if I compile to a DVI, it's there in DVI.

Thank you.

-
Welcome newuser! Could you fill out your question a bit more? "Instant preview" sounds a bit like <a href="tex.stackexchange.com/questions/tagged/…; but not sure in the context of macros. What is it you want to do? If you're asking for a feature to be added to LyX, though, you should <a href="lyx.org/trac/wiki/BugTrackerHome">contact the LyX developers</a> –  Matthew Leingang Oct 27 '10 at 19:01
@Matthew. By instant preview, I mean Tools->Preferences->Look&Feel->Display->Instant Preview. It's in the math inset. My problem is that, for example, I define a new command \abc, but when I put \abc in the math inset, it does not have instant preview. Though if I complie to a DVI, it's there in DVI. –  newuser Oct 27 '10 at 20:11
Hm, that's strange, it works for me. Can you give us more details? How exactly do you define `\abc`. Do you get instant preview if you do not use user defined commands? –  Jan Hlavacek Oct 27 '10 at 22:25
Hi, I get instant preview with ordinarty commands. And for example, I define \$\newcommand{\abc}{A}\$, then I put \abc in math inset, it does not show anything –  newuser Oct 28 '10 at 3:06
@newuser You really should not define commands in the middle of your document this way. LyX has no way of knowing you defined them, and cannot use them when generating the preview. Either define all your commands in the document preamble, or use "insert->math->macro" to define new commands using LyX math macros. Look at the "Math" section of LyX help menu for more details. –  Jan Hlavacek Oct 28 '10 at 16:50

@Jan: Lyx assembles a Latex text from its own representation, but the contents of the preamble and Tex code block are completely uninterpreted. If one Tex block contains a `\newcommand` definition, Lyx won't know that it is related to a macro in another Tex block. Lyx can't do "instant preview" with them. –  Charles Stewart Nov 9 '10 at 16:55
@Jan: I've tried this out: with `\newcommand{\five}{5}` in either the preamble or a Tex block, the control sequence `\five` renders as whitespace. What do you mean by "macros defined in the preamble do seem to be recognized in the preview"? –  Charles Stewart Nov 9 '10 at 21:17