We use cookies on this site. By browsing our site you agree to our use of cookies. Close this message Find out more

Home > Computer Science home > Computer Documentation > Typesetting documents using LyX
More in this section Computer Documentation

Typesetting documents using LyX

LyX is a powerful wysiwym (what-you-see-is-what-you-mean) front-end to LaTeX. Not to be confused with custom text-editors such as WinEdt, LyX goes a long way to hiding the user from the underlying LaTeX code.

LyX is available on Sartre, Plato and Aspasia, and can be invoked with the command:

$ lyx
Although LyX looks like a word-processor, it works in a fundamentally different way. As with LaTeX, a LyX document delegates issues of style to the underlying package. LyX provides native support for the most common LaTeX classes, such as article, report and book. In addition, a LyX-friendly variant of the rhultechreport has been developed, and can be used by adding
to the lyx preamble. (only at RHUL - this is not part of the LyX distribution!)


LyX has inbuilt support for BibTex, the creation of tables of contents, the insertion of images and tables and such like. As a rule of thumb, if you can do it in LaTeX, you can do it in LyX. Perhaps most importantly, LyX provides wysiwyg editing of mathematical formulas. In addition to a point-and-click interface to the common mathematical symbols, LyX instantly renders mathematical commands such as sum and sigma using the appropriate symbols. This wysiwyg functionality extends to multiline equations, arrays, cases environments and similar.

In cases where LyX does not natively support a LaTeX feature, raw TeX commands can be inserted directly into the document. These elements will not be rendered until the ps/pdf/dvi is generated.

LyX saves documents in a special format using the .lyx file extension. LyX allows documents to be exported as .tex, .dvi, .ps and .pdf, depending on the particular setup of your system. Furthermore, LyX includes a tool reLyX, which will attempt to import your .tex document into LyX. The success or failure of reLyX is largely dependent on how convoluted your LaTeX is.

LyX is open source (www.lyx.org), but, unlike many open source applications, is supplied with extensive documentation. User guides and tutorials are available (as LyX documents, naturally) from the Help menu.

LyX for LaTeXers

The following tips should be of use to LaTeX users migrating to LyX.

Changing the document class

The default document class is article. To change this, along with many other settings, go to Layout -> Document -> Layout.

The lyx preamble

Layout -> Document -> Preamble will allow the insertion of plain TeX commands into the LyX preamble. This is especially useful for the insertion of macros, and the inclusion of additional packages.

Math mode

Mathematical typesetting must be carried out in mathmode. To enter math mode either click the fraction button on the toolbar, or use to Ctrl + m shortcut. The subtleties of mathmode take some getting used to, but perseverance is richly rewarded.

Inserting raw TeX

Raw TeX commands can be entered using ERT (Evil Red Text) boxes. Select the TeX button on the toolbar, or use the Ctrl + l shortcut to get a red box. Text entered into this box will be copied to the resultant LaTeX file.

Generating the typeset document

To generate a typeset document, choose an option from the View menu. Depending on the converters installed on your system, you may be offered the choice of DVI, Postscript and PDF. Selecting one of these will generate a temporary file, and the appropriate viewer will be launched. To create a persistent file, choose an option from File -> Export instead.

Getting good PDF from LyX

Generating pdf that looks good in Acrobat is something of an issue in LaTeX. The ghastly pdf that ps2pdf and pdflatex produces is often due to the fact that the postscript fonts are rendered in pdf as bitmapped images. A quick workaround for this in LyX (although it applies in LaTeX too), is to add \usepackage{pslatex} to the document preamble. Alternatively, from within LyX, select Layout -> Document -> Layout and choose pslatex from the drop-down font menu.

Getting further help

There is a very well populated users' group that has solutions to most queries and installation issues.


Comment on this page

Did you find the information you were looking for? Is there a broken link or content that needs updating? Let us know so we can improve the page.

Note: If you need further information or have a question that cannot be satisfied by this page, please call our switchboard on +44 (0)1784 434455.

This window will close when you submit your comment.

Add Your Feedback