LWN.net Logo

A look at LyX 2.0

November 24, 2010

This article was contributed by Joe 'Zonker' Brockmeier.

The LyX project has been quietly, but effectively, hammering away at a major update to its document processing program for about two years. On November 10, the LyX project unveiled the first beta for LyX 2.0. With better revision control, document previews, and new support for many LaTeX commands, LyX 2.0 is shaping up very nicely.

For the uninitiated, LyX is a multi-platform "document processor," essentially a front-end for editing TeX/LaTeX documents without having to muck with the actual TeX/LaTeX markup. At least, not unless one wants to fiddle with the markup. LyX does make it possible to insert TeX/LaTeX markup, but you don't generally need to.

[LyX navigation menu]

The difference between LyX and, say, LibreOffice Writer or Microsoft Word goes beyond the document format on the backend. LyX doesn't attempt to render documents in a "What You See Is What You Get" (WYSIWYG) style. Instead, the LyX motto is "What You See Is What You Mean" (WYSIWYM). LyX presents the structure of the document instead of the exact presentation. One reason for that is that the LyX folks want users to focus on the writing rather than bit-twiddling the presentation. Another is that LyX can export to a number of formats (PDF, HTML, plain text, etc.) and the presentation is going to change depending on the stylesheet and target format.

Though LyX works differently than Word or Writer, it has many of the features that users would like to have. For instance, LyX has spell checking, version tracking, and even revision control. It can produce simple documents, or entire books with beautifully (thanks to TeX/LaTeX) rendered equations.

Looking at 2.0

Binaries haven't shown up for LyX 2.0 yet, but there's very little difficulty in compiling from source. For users who want to test LyX 2.0 alongside an existing 1.6.x release, there are two options. One is to run LyX from the src directory after compiling, the other is to use the --with-version-suffix option when running ./configure.

After compiling LyX 2.0 beta I set about creating a few documents and testing some of the new features listed for 2.0. From the limited testing I've done this week, the first LyX 2.0 beta seems stable enough to use for day-to-day work. One word of caution, though, for those who wish to test out 2.0: the document format seems to be backward-incompatible with 1.6.x. When trying to open a document created in 2.0, LyX 1.6.7 complained about being unable to convert the format.

Major New Features

At first glance, there's not an enormous difference between LyX 1.6.x and 2.0. Open LyX 2.0 and 1.6.7 side by side and it's difficult to tell them apart. But the two years of LyX development have generated quite a few major and minor new features.

The idea is that the formatting of LyX documents is set by the document type. For instance, the layout of a presentation is set by the Beamer class. If you want to change those things, you make changes in the class, not the document itself. It's been possible to embed layout information in a LyX document previously, but the 2.0 release adds a way to do this via the "Local Layout" tab under "Document Settings". Now users can easily define specific tweaks to a layout without having to muck with the class itself. Even so, the LyX folks caution that it's "not a good idea to mess with a layout when you are actually working on a document."

Most books or other works include only one index — but some works call for more than one index. For example, in a book discussing the history of the Linux kernel one might want to have an index of names, and an index for features. LyX 2.0 introduces multiple indexes so users can do just that. If more than one index is defined, LyX adds menu entries for each under the "Insert" menu so that users can choose between the relevant indexes, and separate entries to place the target indexes in the document.

LyX has had thesaurus support for some time, but that support has been limited to English. This is, obviously, not terribly useful for much of the world. LyX 2.0 adds support for the MyThes library, which happens to be what OpenOffice.org uses as well. This makes all of the OpenOffice.org thesauri available to LyX 2.0 users as well. Likewise, LyX has had spell check support for some time, but it required running the spell check manually. 2.0 adds support for continual spell checking, though it can be turned off for users who prefer the manual way.

It seems that several of the changes are moving LyX towards being more directly fussy with formatting. A new feature in LyX 2.0 is support for LaTeX commands that were not previously supported in LyX. For example, by adding the "Initials" module (under "Document Settings"), users can define initial caps (where the first letter of a paragraph or section of text is larger than the surrounding text). But it does not automatically set an initial cap for any structure in the document — it adds an "Initial" entry under the menu, which allows users to define initial caps manually. There's also support for several types of new underlines (via the LaTeX ulem package). One addition that seems like it should have been available earlier is the introduction of support for the LaTeX \rule command, which inserts a horizontal line in the document.

For those who wish to typeset songbooks, or just add a bit of musical notation to a document, LyX now supports the Lilypond LaTeX module and can import from Lilypond.

[LyX file comparison]

One of the most interesting additions is the "compare documents" feature. LyX already had version control support and support for tracking changes, but this new feature produces a document that incorporates the changes between two documents and produces output from that. At least in theory. To test the theory I tried comparing the User Guide for 1.6.7 and 2.0 beta. It took about a minute to produce the differences document, which can be viewed in LyX. However, trying to produce output (like a PDF) of that document failed with a spectacular number of errors.

In general, LyX has had dozens of small enhancements for better control over output, document presentation, and support for new types of layout. See the "what's new" document for the full list of new features. Though most are incremental updates, taken together it adds up to quite a major revision.

LyX users who aren't itching to upgrade will be happy to know that many, but not all, of the features new to LyX 2.0 have been backported to the 1.6.8 LyX release that came out on November 15th. The 1.6.8 release is the recommended upgrade for users who want a "solid and polished" version. The LyX project hasn't yet released Linux binaries for 1.6.8, but one can find installers for Windows and Mac OS X if they want or need to use LyX on those platforms.

The release schedule for 2.0 calls for a final release in December. Since the project has hit its targets so far, it seems likely that (barring any major show-stoppers), users will have a stable LyX 2.0 in time for the holidays. Though on the surface LyX 2.0 doesn't look that different, it has a fairly significant set of improvements. What's coming in later versions? There's no roadmap for LyX releases beyond the 2.0.x series, but users can add to the wishlists, which have gotten long enough that they've been broken into two lists roughly lined up by internal features (tools, citing, inline editing) and external (saving, exporting, installing).

Assuming one wants to produce PDF, HTML, or other non-Word and ODF documents, LyX is a top-notch document processor. The 2.0 release is well worth the two years it's taken to produce.


(Log in to post comments)

A look at LyX 2.0

Posted Nov 25, 2010 4:16 UTC (Thu) by jmspeex (subscriber, #51639) [Link]

I'll be sure to give LyX 2.0 a try. I've written all my technical documents -- including my PhD thesis -- with LyX since around 1997 (version 0.10.x IIRC) and I still haven't seen anything that comes close in terms of friendliness and output quality.

A look at LyX 2.0

Posted Nov 28, 2010 22:06 UTC (Sun) by oak (guest, #2786) [Link]

I've been using LyX over a decade too and it's indeed great. I've never lost any text I've edited with it, I can convert it to different formats, and text can be easily split into different chapters that are their own documents (with common parts like bibliography).

Some things in previous versions of LyX have been a bit awkward to use e.g. when you have a small screen and are editing a large table, but hopefully also those things work better nowadays.

Compatibility with LyX 1.6

Posted Nov 25, 2010 9:44 UTC (Thu) by xyz (subscriber, #504) [Link]

As usual the compatibility with the previous stable version is only guaranteed after the first stable version of LyX 2.0 is released.

At that time a new version version of LyX 1.6 will be released (probably 1.6.9) with the ability to read files created with LyX 2.0.

What I like about LyX 2.0 is...

Posted Nov 25, 2010 18:35 UTC (Thu) by bredelings (subscriber, #53082) [Link]

I personally am especially looking forward to Search & Replace functioning on math objects in equations.

http://wiki.lyx.org/LyX/NewInLyX20

I have never used LyX for this, but I am intrigued by the ability to output MathML. I would love is to use LyX for editting Docbook 5 w/ MathML. My current solution is to use itex2MML on my Docbook files (editted in Emacs) before calling xsltproc. But this is kind of a hack.

Shameless plug

Posted Nov 25, 2010 21:45 UTC (Thu) by man_ls (guest, #15091) [Link]

I maintain a little package called eLyXer which converts LyX documents into HTML. While LyX 2.0 will sport basic XHTML export capabilites, eLyXer can perform complex conversions to HTML 4.0, output MathML (with MathJax), split documents at sections, and quite a bit more.

eLyXer is available in Debian and Ubuntu, with the alt Windows installer or as a stand-alone package with its own installer.

Shameless plug

Posted Nov 26, 2010 17:11 UTC (Fri) by jmspeex (subscriber, #51639) [Link]

Thanks for the plug. I'll make sure to try eLyXer next time I need to put math in html. Your examples look much nicer than latex2html.

LyX's XHTML Output

Posted Dec 2, 2010 21:03 UTC (Thu) by rgheck (guest, #71605) [Link]

The description of LyX's XHTML export capabilities as "basic" is more than a little tendentious. No doubt, there are some things elyxer does better now---LyX's XHTML output is still officially "experimental"---so there are unsurprisingly some cases in which elyxer is now the better choice. Which works best in a particular case will depend upon what LyX features you have used in creating the document.

For example, elyxer does not handle math macros well at all if they have arguments, so documents that contain them are rendered poorly. Another advantage of LyX's math output is that it has automatic fallback: If LyX doesn't know how to output your code as MathML or HTML, if you've chosen one of those options, then it falls back to outputting it as an image, compiled via LaTeX, the way htlatex does. (And if even that fails, then it outputs raw LaTeX). This matters a lot if you use more complicated math, like xymatrix or feynman, and it means you aren't hostage to the commands LyX happens to know about.

Perhaps the biggest advantage to LyX's export is that it "knows" about everything LyX knows about, and it strives to make the XHTML version of the document look much as the LyX version does on screen. For example, if you change the font for titles to sans-serif in the layout file for your document, then LyX will automatically produce CSS that styles the title as sans-serif. More generally, XHTML output can be customized using exactly the same mechanism you use to customize LyX anyway: Layout files and modules. LyX doesn't treat the "standard" layouts any differently than it treats user defined ones. Absolutely everything is defined in the layout file. So you can add CSS information, or customize the tags used for a certain construct, right in the layout file. And if the layout has an associated counter, you can define that, and when you tell LyX how it ought to be formatted on screen, it will also be formatted that same way in the output, with no additional work.

The main limitation of LyX's own export is that it is not done yet. The math export, in particular, is not yet complete, and "splitting" documents is not yet implemented. The math stuff should be done by the 2.0 release. Splitting will likely come later, and only if people seem really to want it.

Copyright © 2010, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds