A First Look at LYX

A First Look at LyX

Whether you are writing technical documentation, an article, CV, letter, or thesis, working with LyX, the free, fully-featured cross-platform document processor, can increase your productivity immensely. In this introductory tutorial, we’ll see how to get started with LyX, and explore a few of its big features and drawbacks.
What is LyX?

LyX is a `document processor’ that can be used for many of the same tasks that traditional word processors are used for. But LyX is based on a WYSIWYM (what you see is what you mean), not WYSIWYG (what you see is what you get), philosophy, that encourages an author to think about a document’s structure instead of worrying about its formatting and presentation. With a TeX backend and document classes, LyX richly beautifies documents beyond the capabilities of an ordinary word processor. On top of all this, LyX is incredibly simple to use, with an uncluttered GUI and compatibility with many file formats.

So let’s take a look a first look at LyX.

Getting LyX

Installing LyX on GNU/Linux is straightforward. At the time of this writing, the current stable release of LyX is 1.4.1. Check in your distro’s package repositories for a `lyx’ package, if possible.

On Gentoo, you will find app-office/lyx 1.4 keyword-masked. Just unmask and emerge:
# echo “>=app-office/lyx-1.4 ~{x86|amd64|ppc|sparc}” >> /etc/portage/package.keywords

# emerge lyx

On Debian, Ubuntu, or Slackware, you may not find the 1.4 package available yet. In that case, check for the latest binaries at ftp://ftp.lyx.org/pub/lyx/bin/.
To get the latest source distribution, check ftp://ftp.lyx.org/pub/lyx/stable. Installation is mostly standard:
$ tar zxf lyx-1.4.1.tar.gz

$ cd lyx-1.4.1
You must select a frontend from either Qt, GTK or XForms at configuration. If you do not specify one, you will get an error.
$ ./configure –with-frontend={qt|gtk|xforms}

$ make

$ make install

LyX is built around the TeX/LaTeX systems, so you will need to have a TeX distribution such as TeTeX installed. If you have not already got one, beware that this could be a large package.

Once set up, you can launch LyX from either your desktop environment’s menu (look in Office or Productivity) or from the command line with:
$ lyx

LyX at startup.

Getting Started

Select File > New from the menubar to start editing blank document. Type something in the work area and play around to get a feel for the editor. You should start noticing some unusual things.

You are not editing text on a page as such, which we might be used to from other word processors — everything is in one text area.
It is not possible to type two consecutive spaces or line breaks.
There are no basic formatting operations such as font or alignment settings; instead there is a dropdown menu at the top listing “Itemize, Enumerate, Section…”.

These are all features of LyX’s WYSIWYM attitude, which will greatly simplify life. It does not take much getting used to, so let’s de-mystify WYSIWYM.
What You See Is What You Mean

The basic premise of WYSIWYM is to remove the burden of micro-managing presentation details from the document author.

When we edit a document, we need only think about its logical formatting — structure — such as sections, subsections, lists, etc. They are called environments, and they in turn define the presentational formatting for the text such as fonts, spacing, etc.

There are various document classes from which to choose (article, book, letter, etc.), and each provides its own kinds of environments. The `letter’ class has a `Send To Address’ environment, for instance.

To see this in practise, go to File > New from Template and choose letter.lyx in the file dialog box. This is a basic template for a letter in LyX, which uses the `letter’ class. Visit different parts of the document and see how the specialised environments are applied. In the Signature environment, click the button labelled `Note’ to read it.

With this in mind, we can begin editing the document.
Editing with Environments

Edit the boilerplate text, adding a few more paragraphs, and experiment by applying some of the environments, like Itemize and Enumerate into the body of the letter, by highlighting a region and selecting an environment from the dropdown menu.

LyX automatically handles numbering, indentation, sizes and so on. Environments are applied to each paragragh of text. Note that you only need to apply the Section environment to the section’s heading.

Once we have formatted our document’s structure, still the presentational appearance is not quite what we want on paper. That is because LyX’s editor only displays a what-you-mean version for easier authoring.

To preview the file in a print context, go to View > PDF from the menubar; this should open a PDF file in a new window. The text layout will be much prettier for printing, and the big red labels and the note will not be visible.

When you are happy with the content, we can go about customizing the presentational aspects of the document.

Making Pretty Documents

There are three basic levels at which presentational formatting can be applied in LyX: document, paragraph, and character.

Go to Layout > Document in the menubar. In the various sections, we can set global parameters such as the document class, default font and line spacing, page margins, paper dimensions, and more.

Enter a paragraph and go to Layout > Paragraph. Here we can set the alignment, line spacing and indentation for the active paragraph.
Select a region of characters and go to Layout > Character. This dialog allows us to apply basic formats such font family, weight, italics, color, etc.

Between these dialogs, document classes and environments, we have the basic means of formatting a LyX document. Most of the settings in the dialogs ought to be familiar to someone who has used other word processors.

To save your document, go to File > Save to save as a LyX file, or File > Export to create a file in another format like PDF.

We have seen some of LyX’s features surrounding its WYSIWYM philosophy. Although we have only caught a glimpse of its power in editing our simple letter, it should be apparent how clean and simple the process becomes. Due to its TeX backend, LyX produces incomparable text layout — certainly compared with most popular word processors. The benefits multiply as we edit longer and more complex documents.

LyX does not have many drawbacks, as it is a mature project that is well-focused — it does one thing and does it well. But there are a few issues to consider.

As LyX is not a traditional word processor, it is not entirely compatible with other popular ones. It cannot directly and reliably import Microsoft Word or OpenOffice.org Writer files, but it can export in compatible formats. Documents made in LyX are still portable as PDF, PS, TeX/LaTeX, HTML, text files — or even LyX files as LyX is cross-platform and free. As other applications gradually converge towards open document formats, we can expect to see better interoperability.
LyX does not yet have fully customizable character-level styles. The 1.4 release does have a semi-hidden function (charstyle-insert), but it is not exactly convenient. Expect to see this in a future version.
LyX lacks an embedded scripting language, which might make extending the program easier, as well as allowing it to understand dynamic content, structure and formatting.

The developers have acknowledged these and more, but it remains to be seen how quickly the community can get to tackling them.

Where to go Next

We’ve only scratched the surface in this article. Among other things, you might want to insert images, tables, mathematical notation, use citations, create slideshows, or define your own styles and classes. All of this is possible in LyX but beyond our scope here. You don’t need to wait for our next article on LyX, though, if you dive into these resources:

LyX Wiki
An extensive source of information on doing just about anything in LyX. Some discussions have more external links to useful packages, styles and classes, which can be invaluable.

LyX Help Menu
This includes a tutorial, user’s guide, FAQ and more. They’re all very readable and complete. Go through these right away if you’re interested in using LyX by now. Accesible from within the program.

Good luck!