Lyx: the Multi-Platform Document Editor

Lyx 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.

External tools and extensions


For some functionality, Lyx requires the assistance of external tools.


One example of this would be when making use of a Bibtex format bibliography database. For example, if I wanted to cite the source of a quotation, I first click on the “insert citation” icon. Having done this, I can then search within and select an entry from the database as my source. Different academic disciplines have different conventions for citation format but I have Lyx setup so that it places a number within square brackets. At the end of the document, Lyx can place a key to all of the citations in the document.


However, to actually insert an entry into the Bibtex database, an external tool must be used. This means that the same Bibtex database can be used between multiple documents and with any piece of software that understands the format. There are a lot of Bibtex tools available but I use a KDE app called KBib.


Obviously, Lyx isn’t an office suit. Graphics editing, for example, must be done with external tools.


Document classes


Another way that Lyx can be expanded is through the use of document classes. As supplied, Lyx comes with document classes for various types of book, report, article and some esoteric formats such as those that adhere to various scientific and academic journal specifications. In addition, it also comes with a screenplay and a stage-play class.


The Community


Lyx is widely used and has great community supporting it. Check out the mailing list archive on the website. If you have a problem that you can’t answer via the documentation, the user mailing list should be your next stop. In addition, whenever I have interacted with the developers, I have found them to be helpful and genuinely interested in user opinions.


I think that the quality of a support community is an important feature that is often overlooked when people are assessing a new piece of software.


New in 1.5.x


Lyx is so big that that it contains many features that I will probably never even visit, although their omission might have been a deal-breakers for other people. The new Unicode support would be an example of such a feature. That said, I might benefit from Unicode support in the future if it enables interoperability with new third-party tools.


As I said above, within this overview, I am only able to scratch the surface of the new features, but the ones that I am particularly looking forward to exploring include: the glossary support, the enhanced table support, the aforementioned enhancements of the section browser and the new MDI interface.


The GUI has had a revamp for 1.5.x and it now makes use of QT4. The 1.4.x series had somehow lost some of its GUI speed when compared with 1.3.x. The developers were aware of this and have solved the performance problems that had gradually crept in.


In general, while writing this article in the 1.5.x beta, it seems as though every menu and toolbar has been features an enhancement of some sort.


Criticisms of Lyx


Obviously, Lyx isn’t suitable for every type of document creation.


Strict formatting


Lyx is designed for the creation of documents such as reports, articles and books. If I were given the task of creating a document with loose formatting, such as a leaflet, I would probably use Open Office Word. Also, although I am sure that journals and such have been created with Latex in the past, given the task of creating a print magazine, I would be more inclined to use Open Office or perhaps even a fully-fledged DTP package.


In general, one is sometimes better doing things “the Lyx way” as opposed to working against Lyx in terms of formatting.


Quirky user interface


It has to be said that Lyx is a bit quirky in comparison with a standard word processor. To create anything beyond the most basic document, most users would need to look at the Lyx documentation. Lyx ships with document classes for things like letters or a CV but I would doubt that even the most experienced word processor user would be able to create documents of those types without making use of the Lyx manual.


I think that too much is made of GUI consistency these days. For an application that is designed for occasional, casual use, a user interface that complies with standard conventions is a must. However, in the case of an application that is going to be used for long periods of time, for serious work, I think that a user interface that requires some learning time is acceptable. This is why people who do actual content creation favour features such as keyboard shortcuts.


In summary, I consider it to be acceptable to invest some time in learning a tool that is going to be used for serious project work. On the other hand, a person who might write two or three letters a year, might be better off with a more standard word processor.


In Summary


Lyx is a wonderfully useful tool, in both conception and execution, and I would recommend that anyone who is interested in writing check it out.


Lyx certainly isn’t a “do everything” text editor but I think that it’s a shame that more people don’t know about it. It’s also a shame that there isn’t some serious corporate interest in developing it. I’m left wondering what tools big organisations actually use to create their documentation. Hand written mark-up? A word processor?


A tool like Lyx creates allows content creators to concentrate on what they should be concentrating on: the creation of the content. As needed, the documents can be reliably exported to whatever format is needed at the time. The beauty of Lyx, is that you can create all of your content from within one piece of software, regardless of the eventual output format.


About the author:
Mike is an average super-turbo-geek and once tried to ask a woman out using set-theory. By the time he drew a big circle around the symbol that represented him and the symbol that represented her, she had realised what he was getting at and made a run for it. Check out his website: The Unmusic Website.

41 Comments

  1. 2007-02-27 5:18 pm
  2. 2007-02-27 5:22 pm
    • 2007-02-27 5:28 pm
    • 2007-02-27 10:25 pm
  3. 2007-02-27 5:39 pm
    • 2007-02-27 5:53 pm
      • 2007-02-27 6:03 pm
    • 2007-02-27 6:07 pm
      • 2007-02-27 6:38 pm
    • 2007-02-27 6:24 pm
      • 2007-02-27 8:09 pm
    • 2007-02-28 12:32 am
  4. 2007-02-27 5:51 pm
    • 2007-02-28 9:59 am
  5. 2007-02-27 6:43 pm
  6. 2007-02-27 6:54 pm
  7. 2007-02-27 6:57 pm
  8. 2007-02-27 7:00 pm
  9. 2007-02-27 7:17 pm
  10. 2007-02-27 7:18 pm
  11. 2007-02-27 7:22 pm
    • 2007-02-27 7:48 pm
    • 2007-02-27 8:07 pm
    • 2007-02-27 11:48 pm
    • 2007-02-28 7:53 am
      • 2007-03-01 11:31 am
  12. 2007-02-27 7:48 pm
  13. 2007-02-27 8:05 pm
  14. 2007-02-27 8:23 pm
  15. 2007-02-27 8:45 pm
  16. 2007-02-27 10:01 pm
    • 2007-02-28 7:48 am
  17. 2007-02-27 10:13 pm
  18. 2007-02-27 10:30 pm
    • 2007-02-27 11:39 pm
  19. 2007-02-27 11:55 pm
    • 2007-02-28 2:38 pm
      • 2007-02-28 5:26 pm
  20. 2007-02-28 6:41 am
    • 2007-02-28 7:37 am
    • 2007-02-28 3:59 pm