posted by Killermike on Tue 27th Feb 2007 16:49 UTC
IconLyx is an open source, structured document creation system. Conceptually, it falls somewhere between a markup editor and a word processor. The creators of Lyx have coined the term WYSIWYM (what you see is what you mean) to summarise the approach that Lyx takes to document creation.

The current stable version of Lyx is the recently released 1.4.4. However, on the 21st of Feb 2007, the team released the first beta of 1.5.0. The development team officially support builds for Linux, MacOSX and Windows. Other users can, of course, build from source.

In this article, I'll give an overview of Lyx and try to cover some of the new features that have been introduced in 1.5.0. Lyx is a very powerful program and contains too many features to list here. In truth, in an article of this length, I wouldn't even be able to cover most of the new features of 1.5.0, so, I'll give you an overview of some of the features that I make use of in my day to day use.

An overview of Lyx

The driving concepts behind Lyx's approach are the separation of content from formatting and structured document creation. Lyx probably isn't the tool for every type of writing. Where is shines is in the creation of documents such as reports, articles and books.

The separation of content and formatting.

Hand editing mark-up such as HTML in a text editor would be an extreme example of separation of content and formatting. When editing markup in this way, the user uses tags to specify the formatting, knowing that the finished document will look very different from the source code.

Most wordprocessors represent the other extreme as they attempt to give the user a WYSIWYG representation of the document while the user is editing it.

I can highlight one weakness of this approach with an example:

What if I wanted to use an unusual font on part of the document? Within a word processor, I would have to actually edit using that font, regardless of its usability. I could solve this problem by using a more neutral font when editing and then change back to desired font for print out. Unfortunately, as you change the font, all of the document layout alters around it. Another problem with this approach is that, in my experience, a procedure of this sort is apt to encourage errors to creep into the creative process.

The preceding example might seem somewhat contrived but a more common problem would be that a lot of people, such as myself, like to use a sans-serif font as a screen font while preferring the look of a serif font on the printed page.

Ideally, the user shouldn't be overly concerned with layout and formatting while he or she is creating the content.

Another weakness of WYSIWYG becomes apparent on projects in which the finished document will need to be transformed from one format to another. In most word processors, the user is free to add formatting that has no real meaning in relation to the content. Such inconsistencies might not even be apparent when editing the document. However, features such as extra spaces and carriage returns are interpreted literally by conversion programs, with potentially baffling results for the reader of the target document.

To use an analogy, often, when teaching someone how to use a word-processor, it is difficult to convince them of the importance of using tabs as opposed to spaces. To the novice they are both equivalent as they look the same on screen.

WYSIWYM

As I said earlier, Lyx strikes a slightly different balance to that of a word processor when it comes to the relationship between layout and content.

Lyx sits on top of a well-established publishing markup language called Latex. The user is protected from the actual markup language. For example, I use Lyx quite a lot and I can't think of any Latex tags, off hand. However, the user can enter actual Latex into the document (ERT - Evil Red Text, as Lyx calls it) on the occasions when it is needed. One use for this would be that the user might want to make use of a slightly less common feature such as starting a numbered bulleted list with a value other than 1. Latex is vast and the chances are, if there is something you want to do in terms of typesetting, there is a way of doing it within Latex.

Latex is also extensible and there exist many add-ons to do unusual things such as adding Latex commands to handle unusual formatting requirements. For example, if you were writing an academic report for a journal with some weird formatting requirements, you'd probably be able to find a latex class that can support it.

Don't worry, even though it's mark-up underneath, Lyx does reflect things such as font size and weight, visually, onscreen in much the same way as word processor.

As the Lyx editor is not focused around document layout, the text simply re-wraps to window size. This means that you don't have to work full screen all of the time. This comes in handy when, for example, I am taking notes from a web page.

In those cases, I start by making the Lyx window small. On my KDE setup, each window has a ``stay at front'' control on it and I activate that. I can then work with the webpage in the background and without fear of the Lyx window obscuring things or getting pushed to the back. To do the same in a word processor, I suppose that I would have to change the margins or alter the zoom factor of the document.

I'm not much of a mathematician myself but even I have, on occasion, made some small use of the powerful, integrated math editor.

The structured approach

As it sits on top of markup, Lyx imposes some restrictions, in terms of document layout. For example, in Lyx, the purpose of a carriage return is to end a paragraph and start a new one. Consequently, if the user hits return a second time, nothing happens. This is because, in Lyx, a carriage return is used to mark the end of a paragraph, rather than to create extra white space.

This might seem restrictive at first, but like a lot of structured approaches to creative things, it is a truism that if you can't state why you wanted to add an element - or in other words what its meaning was - it's usually an indication that the idea was not as well conceived as it should have been. When you need a special piece of formatting, impose that as part of the style of the document. It might have been apparent, to you, what you meant by some ad-hoc formatting, but it might not be as obvious to the person who has to use your document.

Document structure

The basic unit of composition in Lyx is the paragraph. Every element of the document should be contained within a paragraph. Each paragraph has, associated with it, a style. For example, a subsection title is paragraph with the style of "subsection". Upon adding a new section header, the document structure is updated; so, if the user has added a table of contents at the start of the document, the new section will be added to the contents.

As you might expect, there are styles for things like quote, quotation, bullet lists and description of terms paragraphs.

The user is able to browse the document structure in the document overview. Lyx features a drop down menu-based structure browser that looks a bit like a dynamically generated version of the bookmarks menu of a web browser.

In addition to this, Lyx offers a pop up browser dialogue. With the advent of 1.5.0, the developers have added the much requested feature of allowing the user to move sections up and down in order to move whole sections around the document. Sections can also be promoted or demoted from within this dialogue.

If the user chooses, the chapters, parts, sections, subsections and subsections can be automatically numbered.

Graphics and tables

When adding a table or graphic figure, you can insert directly into the document. However, a better use of Lyx functionality is to insert the table or figure into a floating frame. Such a floating frame can be moved about the document by the typesetting algorithm when the finished document is exported. Don't worry, the reader won't loose the table or frame as an anchor can be attached to it so that when the text says something like "see figure #6 for an example", Lyx can be told to add something like, "in section 3.2 on page 32" or "on the next page" to the finished document.

Support for file formats.

One of Lyx's strengths is its support for different file formats.

Output formats

Being based upon mark-up, Lyx is particularly adept at exporting to other mark-up based formats such as HTML. You can add nearly any format to Lyx, as a export format, as long as you have a command line tool to convert from latex.

For example, I have my Lyx setup so that I can output modern CSS HTML or 2.0 HTML, depending on what I need. To do this I had to first, within the GUI, add a "file format" that I call "HTML (modern)". I then added a "converter" called "latex to html". I associated with this the command line "htlatex $$i" (htlatex is a command line tool for converting between html and latex). I went through a similar procedure when adding an exporter for HTML 2.0. I use HTML 2.0 in cases in which the submission procedure for an article specifies that only a small subset of basic tags can be used.

If you can find a tool to convert a format from Latex, you should be able to add it as a converter for use with Lyx. As standard, Lyx is set up to export a handful of common formats such as HTML, PDF and RTF. This is how I like to work with the program, and personally, if the developers were to remove printing functionality from them program, I wouldn't miss it.

When outputting to a format such as postscript or PDF, the layout is handled by the time-served TEX engine. This engine gives the finished document a polished, professional look that is uncannily like that of a text book.

In 1.5.0, making a quick check of the document rendered within the PDF viewer of your choice is now as simple as clicking on a toolbar icon.

Input formats

With input formats, things get even better. You can setup converters in order to allow you to import different document types. However, it gets better still as you can set up converters that allow you to actually incorporate various files into Lyx.

For example, I like creating my diagrams in Inkscape. Unfortunately, Lyx doesn't come with SVG support built in. To remedy this, I added the file type and some converters. Subsequently, I can now add SVG diagrams directly into the document. To be rendered onscreen, Lyx converts to into a bitmap format. When exporting to PDF, it converts the source file into a vector format that the PDF converter understands.

If you can find a tool to convert your file into EPS (encapsulated postscript), you can work with it in Lyx.

Table of contents
  1. "Lyx, 1/2"
  2. "Lyx, 2/2"
e p (1)    41 Comment(s)

Technology White Papers

See More