| Julien Rioux | Burkard's Group | Department of Physics | University of Konstanz |

LyX

Although it could be more than just that, the primary function of LyX is to be a frontend to LaTeX, the document formatting system. Therefore, LyX relies on a latex distribution, but this is almost a tool of the trade in physics (and other sciences, I am sure).

Custom LyX layouts and modules

There are many more latex packages available than what LyX could ever hope to support natively. Fortunately you can extend its functionalities with new layout and module files. Here are some of my own LyX layouts and modules.

How to use these files:

The .module and .layout files are copied to your LyX user directory (usually ~/.lyx/layouts on linux and Documents and Settings\username\Application Data\LyX16\layouts on windows). Then, within LyX run the menu Tools > Reconfigure, and restart LyX. The new layouts and modules will be available from the menu Document > Settings. The sample .lyx documents provided here can be used as examples.

Example of a full-page width abstract in a two-column document.

abstract.module

Module to typeset a full-page width abstract in a two-column article (uses abstract.sty). Tested with article, article (paper), and article (TUGboat) document classes.

LyX 1.6.x LyX 2.0.x
abstract.module abstract.module
Sample document Sample document

cv.module

This module defines a very plain and simple CV environment. Based on CV.sty by Philipp Maier.

LyX 1.6.x LyX 2.0.x
cv.module cv.module

lilypond.module

This module adds an inset to enter LilyPond code directly into LyX. The code is processed by lilypond-book to produce beautiful musical output.

LyX 1.6.x LyX 2.0.x
Not available. Since LyX 2.0.0 this layout is officially distributed with LyX.

revtex4-1.layout

The RevTeX 4.1 format for LyX 1.6.x and 2.0.x (requires revtex4-1.cls from the American Physical Society).

LyX 1.6.x LyX 2.0.x LyX 2.1.x
revtex4-1.layout revtex4-1.layout Since LyX 2.1.0 this layout is officially distributed with LyX.
Sample document Sample document

sidecap.module

Module to typeset a caption next to a table or figure, as opposed to above or below. Can also be used to extend the caption into the outer margin. (uses sidecap.sty).

sidecap-starred.module

Same as above but without caption numbering.

Example of a document using side captions, page 1. Example of a document using side captions, page 2. Example of a document using side captions, page 3.
LyX 1.6.x LyX 2.0.x
sidecap.module sidecap.module
sidecap-starred.module sidecap-starred.module
Sample document Sample document
Example of a title page for the ut-thesis layout.

ut-thesis.layout

The University of Toronto thesis format (requires ut-thesis.cls).

ut-thesis-extra.module

A module containing the special customizations made for my own thesis.

LyX 1.6.x LyX 2.0.x
ut-thesis.layout ut-thesis.layout
ut-thesis-extra.module ut-thesis-extra.module
Sample document Sample document

Installing the LyX development version from source

Warning! This information is outdated!

Getting the source and dependencies:

For subsequent updates it is sufficient to simply do "svn update".

Build process:

  1. ./autogen.sh
  2. ./configure (optional --with-version-suffix=SUFFIX)
  3. make
  4. (optional) make install

Importing SVG images from inkscape

This explains how to set up LyX for proper .svg file handling using inkscape.

  1. Add a new SVG format
    • Short name "svg"
    • Extension "svg"
    • Editor "inkscape"
    • Viewer "inkview"
    • Select "Vector graphics format"
  2. Add converters from svg to ...
    • eps : "inkscape $$i --export-eps=$$o"
    • pdf (ps2pdf) : "inkscape --export-area-drawing $$i --export-pdf=$$o"
    • png : "inkscape --export-area-drawing $$i --export-png=$$o"

Importing figures from ipe

Ipe is a neat little editor that does what inkscape does, but better in many ways when it comes to drawing technical figures, especially because it supports latex input directly. Ipe can save in eps and pdf formats natively (without loss). It does this by including its own markup into a compressed string comment in the output file. Since version 6 (?) Ipe also has its own ipe format which extends on xml. This format is more interesting from a version control point of view because it is in plain text. Here is how to configure LyX to handle files created with ipe.

  1. Add a new Ipe format
    • Short name "ipe"
    • Extension "ipe"
    • Editor "ipe"
    • Viewer "ipeview"
    • Select "Vector graphics format"
  2. Add converters from ipe to ...
    • eps : "ipetoipe -eps -export $$i $$o"
    • pdf (ps2pdf) : "ipetoipe -pdf -export $$i $$o"
    • png : "iperender -png $$i $$o"
    • svg : "iperender -svg $$i $$o"
    Warning: the -export flag is optional; it will strip ipe markup from the output file.
  3. Make sure ipe's bin directory is in your PATH, or at least in your LyX PATH

Importing plots from xmgrace

On unix, LyX usually set this up on his own. To include .agr files in LyX under windows requires installing the version of xmgrace bundled with cygwin.

  1. Add a new Grace format (if not already present)
    • Short name "agr"
    • Extension "agr"
    • Editor "xmgrace -display 127.0.0.1:0.0"
    • Viewer "xmgrace -display 127.0.0.1:0.0"
    • Select "Vector graphics format"
  2. Add converters from agr to ...
    • eps : "gracebat -hardcopy -hdevice EPS -printfile $$o $$i"
    • png : "gracebat -hardcopy -hdevice PNG -printfile $$o $$i"
  3. Final touches:
    • Add <cygwin root dir>\usr\share\grace\bin to your LyX PATH.
    • Overwrite the gracebat.exe symlink with a proper filesystem copy of xmgrace.exe at that location.
  4. Keep in mind to have your X Server running when you want to invoke the grace GUI.

NOTE: Grace 5.99 supports embedding fonts in eps files, which is necessary when submitting to a journal. It can be installed on cygwin and most unix distributions. To install Grace 5.99 in Ubuntu Karmic:

  1. Grab a package (.deb file) from here.
  2. sudo dpkg -i grace6_version_arch.deb

To embed fonts, add the flag "-hdevice-options embedfonts:all" to the gracebat command.