Let's say I want to create a "macro" called \limx that will be defined as:


How can I make LyX recognize it and make an auto-prieview of it?

Another example, I'm using the cancel package. When I'm using \cancel in a math equation it doesn't preview it while editing. I can still see "\cancel" on the equation editor. Only when I render the document the \cancel is being really rendered. How can I add that functionality to the LyX's WYSIWYG environment as well?

  • Which version of LyX do you use? I have version 1.6.7 and when using the cancel package, \cancel previews just fine. So do macros that I define in the preamble. Dec 5, 2010 at 4:42
  • @Dave: Why the mathmode tag? Dec 14, 2010 at 17:59
  • @Jan: My mistake. Dec 14, 2010 at 18:03
  • @Jan I'm using Lyx 1.6.7, but when i use "\cancel" it doesn't work for me. I still just see "\cancel" in the mathmode...
    – Dig
    Dec 16, 2010 at 13:29
  • In the equation editor, when actually editing the formula, it will use \cancel. As far as I know, there is no way to teach LyX a graphical representation of new macros that it doesn't already know. When you are done with editing, and leave the particular "equation" (I think it is "math inset" in LyXspeak), LyX should preview the formula just the way it will look in the compiled document. At that moment, \cancel should render the way it is supposed to. When you click on the equation again, you will enter edit mode, and and you will see cancel again. Dec 16, 2010 at 17:08

2 Answers 2


As I understand things, it's not necessary to do anything special for macros that get used inside equations; LyX just runs them through LaTeX and (with the aid of preview.sty) extracts the preview images.

  • This doesn't really answer the question at hand. I'm also working on creating previews in Lyx for custom Latex classes, and its not really all that straight-forward. Feb 10, 2013 at 0:59

It's been a while, but in case someone runs across this later - it's possible to turn on Instant Preview, to, well, instantly preview insets. Detailed instructions can be found here, but if you're on Windows it's as simple as going to Tools > Preferences and activating Instant Preview.

  • I've defined a series of variables in this way: \newcommand{\var}[1]{\mathrm{#1}} \newcommand{\Coll}{\var{Coll}} \newcommand{\LDG}{\var{LGD}} \newcommand{\EAD}{\var{EAD}} etc. but when I activate Instat Preview they disappear. It works if I use every time \var{Coll} etc.
    – CarLaTeX
    Sep 26, 2016 at 4:55
  • 1
    I gave a slightly more detailed explanation of this answer here; tex.stackexchange.com/questions/499152/…
    – RMurphy
    Jul 9, 2019 at 0:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.