Go to page:

Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

LyX /

InstantPreview

Categories: InstantPreview
<< | Page list | >>

Instant Preview

What is instant preview?

Instant preview is a feature that renders math formulae inside the LyX screen using LaTeX. These are generated on the fly so you can see how they'll look in the final document without having to break your train of thought with View→DVI.

Here are some screenshots on Mac OS X and Windows:

LyX will generate previews of math insets. It will also generate previews of Include insets if you select the Show preview check box in the inset's dialog. This latter is useful if you wish to generate a preview of a LaTeX figure, for example.

How do I activate it?

You'll need to install some software (see below). Thereafter, you should enable Instant preview in the Tools→Preferences dialog. (It can be found in the Look & feel→Display pane) Previews are generated when you load a document into LyX and when you finish editing an inset. Previews of an already loaded document are not generated just by selecting the Instant preview check box.

OK, I'm interested. What do I need on Unix/Linux?

Several external utilities, latex, dvips, gs and pnmcrop and the LaTeX package preview.sty have to be installed. Apart from preview.sty and, possibly, pnmcrop (part of the netpbm package), these utilities should already be present on your system if you're using LyX to generate documents. preview.sty is part of the preview-latex project. It can be obtained either from the project web site or from CTAN. Once these packages are installed, you may have to reconfigure LyX with Tools→Reconfigure; then things should "just work" for those of you using Unix machines.

I'm using LyX under Windows. What do I need?

It works out of the box, have a look at this page: InstantPreview under Windows

If it doesn't work, install the LaTeX-package "preview" (for example via the program "MiKTeX Package Manager" which is available from Windows Start menu). After that package has been installed, you may have to reconfigure LyX with Tools→Reconfigure.

How could I test it?

To test, I recommend that you:

  • Start LyX from the command line
  • Activate Instant Preview in the Edit→Preferences dialog, as described above.
  • Start a new document.
  • Create a new math inset a+b=c and leave the inset so that you are no longer editing it. LyX should start the process of generating the preview and if all is successful will display this preview once it is generated. If it fails, then you should be able to find the latex file that it failed to generate the bitmap image from in the temp directory. The console messages should tell you exactly where.

Changing the size of the instant preview

If the previews seem too small or too large compared to the surrounding text, you can fix it as follows:

Add a line \preview_scale_factor <your value> in the "MISC SECTION" of your preferences file:

  • On Unix: ~/.lyx/preferences
  • On Windows: ~:\Documents and Settings\user name\Application Data\lyx1.x.x.\preferences
  • On MacOS X: ~/Library/Application Support/LyX-x.x/preferences

The default value is 0.9. If you have installed LyX on LyXWinInstaller the value is 1.0.

Only for Unix: If this file does not exist, just create it using this command:

 echo '\preview_scale_factor 1.0' >> $HOME/.lyx/preferences

InstantPreview

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2011-04-15 18:21 CEST