From rs_faq
Jump to: navigation, search

Lyx is a kind of graphical front-end to LaTeX. This means you

  • Can read your document as you write it, rather than having to decode lots of formatting tags in your head.
  • Don't have to learn hundreds of obscure tags.
  • Can see what equations look like as you write them.

The authors describe it as WYSIWYM, What You See Is What You Mean, rather than WYSIWYG because it still uses the LaTeX engine to convert documents into their final format. The screenshot shows Lyx running on Windows, and you can see that headings appear as headings (with the correct numbering), equations appear as equations, and it all just makes sense!

Screenshot of Lyx running on Windows

Installing Lyx

On the School's Linux systems, Lyx is installed as /bham/pd/bin/lyx. As of May 2009, version 1.6.2 is installed which is the latest version.

On Windows (unless you have admin rights) you'll have to submit a support request to have Lyx installed. The installation is slightly involved, as the MiKTeX LaTeX implementation and possibly some other dependencies will have to be installed first.

Using Lyx with custom LaTeX classes (and multi-file documents)

Lyx is not quite a WYSIWYG front-end to LaTeX, because it has its own file format (.lyx instead of .tex). This is not generally a problem, because Lyx can generate PDF files directly, and if you need LaTeX sources you can run File->Export->LaTeX (pdflatex).

However if you need to use a custom LaTeX class (for example one provided by a journal or a conference), this presents a minor problem, as Lyx only has a limited number of LaTeX classes built in. The complete and correct way to address this would be to create a new Lyx layout file corresponding to the class file (e.g. create a file ~/.lyx/layouts/my-conf.layout containing Lyx-ified versions of the definitions in my-conf.cls). However there is a much simpler solution: just use a multi-file document.

To do this, you create a "wrapper" Lyx file that includes the various Lyx files for your document (such as Introduction.Lyx, Method.Lyx, etc), using the Insert->File->Child Document menus. The document class for the master and child documents should be just report if the LaTeX class uses chapters, and article otherwise.

You then create an equivalent LaTeX wrapper file LatexMaster.tex that contains \input{Introduction.tex} and \input{Method.tex}, and to build the document you run a script like:

lyx --export pdflatex LyxWrapper.lyx
pdflatex LatexMaster.tex
bibtex LatexMaster
pdflatex LatexMaster.tex
pdflatex LatexMaster.tex

You can then edit all the child documents in Lyx (if you open the wrapper file, Lyx builds the TOC for all child documents too), and still use the custom LaTeX class.

Personal tools