|
|
Subscribe / Log in / New account

A look at LyX 2.1

By Nathan Willis
May 7, 2014

LyX is a graphical document editor that serves as a front end to TeX and various TeX extensions (LaTeX, XeTeX, etc.). In that sense, LyX serves as a bridge between the high-precision world of TeX typesetting and the easier-to-use WYSIWYG world of word processors. Version 2.1.0 was released on April 25, incorporating updates to the handling of special-purpose content like equations or phonetic notation, improvements to LaTeX option support, and several new page-layout features.

The new release is available for download as source code and in binary packages for a variety of Linux distributions. It requires a working LaTeX installation (due to LaTeX's modularity, almost any modern version should be compatible) as well as Qt and Python.

LyX aims at a target that, to some, sounds inherently unattainable: it is designed to make TeX documents as easy to work with as generic letters and memos are in a word processor like LibreOffice Writer. The challenge stems from the fact that TeX was created to enable fine-grained manipulation of typesetting features that word processors gloss right over. TeX succeeds at this goal, which is why it is the de-facto document-preparation system for scientific research—after all, when one's PhD or professional reputation is on the line, having the equations look "more-or-less correct" just does not cut it. But, in practice, TeX achieves its precision by relying on well-honed macro collections and predefined document classes. Projects like LaTeX and BibTeX provide useful macros and shortcuts that authors can employ rather than writing raw TeX markup by hand.

[A letter in LyX 2.1]

Even so, the fact that authors can always drop down into TeX markup to handle the inevitable corner cases or specify mathematical formulas directly in math syntax is a strength—when no LaTeX option generates perfect output, TeX is always there to come to the rescue. Consequently, there is a school of thought which says that LyX, with its word-processor-like interface, does not add to the TeX-writing experience, it simply hides it behind another layer of indirection. That is, LyX users are not freed from the need to understand LaTeX and TeX, since they will eventually confront the same corner cases.

But that viewpoint short-sells much of what LyX has to offer. Yes, LyX provides a word-processor-like graphical user interface (GUI), but the GUI does not hide TeX's features from the user—it provides a way to access them via visual cues in the document and GUI components (e.g., toolbars and menu items). LyX does not reduce TeX to an implementation detail, but it makes it easier to create a valid TeX document—and, perhaps more importantly, it makes it more difficult to create a bad TeX document.

[Classes in LyX 2.1]

Many of the improvements found in LyX 2.1 illustrate this fact. For example, the most basic decision about a LaTeX document is the class to which it belongs, but not only do generic offerings like "letter" and "article" exist; each field, journal, and professional organization can have its own stylistic rules, with a separate class to represent them. In LyX 2.1, all of these classes are organized into categories (as opposed to the flat list of previous generations), which helps make sense out of the plethora of alternatives.

Similarly, version 2.1 adds GUI support for accessing far more LaTeX options, and it does a better job of presenting and explaining those options to the user. LaTeX provides macros that simplify formatting for common document features, such as code listings; LyX exposes the various options in pop-up dialogs. In 2.1, these option panels have been rewritten to standardize terminology, make all options visible at the same time, and to allow presets for common values. Support for several new commands has been added as well, many of which deal with mathematical expressions or with horizontal spacing tweaks.

[LaTeX options in LyX 2.1]

Table support got an update in 2.1. Arguably the most useful new feature is the ability to move or swap table rows and columns (either with keystrokes or menu commands). It is also now possible to rotate tables on the page—to any arbitrary angle, not just 90-degree increments. Perhaps it is difficult to imagine a use for such rotation functionality, but that might be overthinking matters.

The removal of arbitrary restrictions is a recurring theme in TeX; LyX 2.1 also adds support for custom paragraph shapes, but in removing the restriction that limited paragraphs to simple rectangles, the project could have settled for implementing a fixed set of polygons. Instead, any shape is supported, including unusual options like shapes with holes in the middle. It is also now possible to nest multiple columns of text within an existing column (which is useful for citing and quoting other documents where the page layout itself is important).

Several specific use-cases for LyX received their own improvements in the 2.1 release, such as the beamer class for creating presentation slides, phonetic notation using the International Phonetic Alphabet (IPA), and mathematical formulas. The beamer improvements center around a rewrite of the formerly awkward beamer layout module, but also add some new features like the ability to overlay content. Real IPA support is new; the IPA characters are accessible to the user through a special toolbar, providing an editing workflow that resembles the one used to access special math characters. In previous releases, the rudimentary IPA support was a hack of the existing math-editing code, so this represents a step forward.

Improved support for math typesetting is hardly a surprise; TeX was originally created by Donald Knuth to help him typeset The Art of Computer Programming, and TeX is used heavily by math journals. Nevertheless, there is always room for advancement. LyX 2.1 improves on its formula-and-equation support by adding a document-wide "math font" setting (which will not get overwritten if one changes the font of other body text), by adding a unicode-math package that supports math OpenType fonts (such as STIX or XITS), and by adding a new inline "equation editor" mode.

[Equation editing in LyX 2.1]

Several new languages are supported in LyX 2.1, if one activates the optional XeTeX output engine. XeTeX is best known for its support of OpenType, Apple Advanced Typography (AAT), and Graphite font systems, which enable typesetting many writing systems that are not supported (or are not easily supported) by pdfTeX, the default LyX output engine. XeTeX also supports several microtypographic features like hanging punctuation. It is also important to note that "language support" in LyX has a stronger meaning than it does in some other applications: switching the language setting of a document causes LyX to automatically make adjustments to features like the type of quotation marks used.

Speaking of typography, LyX 2.1 also adds support for several new TeX fonts. Unlike the WYSIWYG word-processor world, in which users can highlight any characters they want and put them in a different font via a drop-down menu, in the TeX world, font settings are often a document-centric decision. If the document class designer specifies one font for subheadings and another for body text, then that is simply how it goes, unless one adds document-specific overrides. LyX now ships with more built-in fonts available, and makes it easier for authors to add their own.

Finally, there are many small additions and enhancements in the new release, such as the ability to write multilingual captions, the ability to insert standard-issue "chemical risk and safety" statements, and a new dependency on libmagic to determine the file type of external resources (as opposed to built-in format detection). Nevertheless, there are also some limitations to make note of. Most importantly, LyX 2.1 is not yet compatible with Python 3; if it is the system default Python interpreter on the machine where LyX is installed, one should expect some trouble.

In all, LyX 2.1 is an incremental improvement over previous LyX releases—at least where everyday document editing is concerned—but there are still some significant enhancements that make a reexamination worthwhile for those who have found LyX too limiting in the past. There is still a learning curve, but the conceptual model of TeX is different enough from WYSIWYG word processing that some amount of retraining is inevitable. But if you think TeX is too difficult to learn, a few minutes with LyX is worth the investment.

[Those interested in TeX development should also see Knuth's TeX Tune-Up of 2014 [PDF] from TUGboat 35–1]


to post comments

A look at LyX 2.1

Posted May 8, 2014 12:10 UTC (Thu) by ibukanov (subscriber, #3942) [Link]

Thanks for the nice write up. It caused me to try LyX again after I guess 10 years of ignoring it. It became so much better so I guess I will use it for short letters etc.

A look at LyX 2.1

Posted May 8, 2014 13:57 UTC (Thu) by peter-b (guest, #66996) [Link]

LyX is absolutely brilliant. It was the key to quickly and easily typesetting many of my assignments during my undergraduate studies; while studying for my PhD, I was able to use LyX for preparing all of my journal and conference papers, as well as (eventually) my thesis.

LyX is so much more comfortable to use than writing raw TeX in a text editor -- and this meant that I had a lot more TeX-bashing energy to spare on creating beautiful diagrams with TikZ.

I've now introduced LyX to a friend who's recently begun her postgraduate studies, and who has very little knowledge or experience of programming. She loves it, because it lets her get much more accurate typesetting and page layout than "word processors" can provide, without compromising on ease-of-use or discoverability. She's recently started hacking around with little LaTeX snippets for some little tweaks that LyX doesn't do exactly how she wants... ;-)

A look at LyX 2.1

Posted May 9, 2014 19:19 UTC (Fri) by RelytDeveloper (guest, #96089) [Link]

I'm using LyX to write technical documentation for a project of moderate complexity, and it is generating BEAUTIFUL type-setting. It's also teaching me about the TeX type-setting family.

A look at LyX 2.1

Posted May 10, 2014 11:45 UTC (Sat) by keeperofdakeys (guest, #82635) [Link] (1 responses)

> Most importantly, LyX 2.1 is not yet compatible with Python 3; if it is the system default Python interpreter on the machine where LyX is installed, one should expect some trouble

Having python3 set as default should not be a problem on modern systems. Any such system will also have python2 installed, and a symlink named "python2" that links to the python2 executable. So the smart developer can use the python2 symlink, and the default version of python on the target system should deal no trouble.

I can only assume from the writer's comments that lyx does not use this symlink.

A look at LyX 2.1

Posted May 12, 2014 11:04 UTC (Mon) by xyz (subscriber, #504) [Link]

IIRC, without looking into the code, lyx checks that python is python 2, if not it searches for python2

A look at LyX 2.1

Posted May 15, 2014 5:36 UTC (Thu) by rsidd (subscriber, #2582) [Link]

I tried lyx years ago but never warmed to it. After reading this I installed lyx 2.1 and wrote some notes in it (I normally use plain latex if there is math involved, libreoffice if not). It took a few minutes to retrain my finger (eg, ^m rather than $ for math mode, and I need to remember not to put spaces inside equations) but it's brilliant. I think I'm a convert...

A look at LyX 2.1

Posted May 16, 2014 10:53 UTC (Fri) by massysett (guest, #52736) [Link]

"in the TeX world, font settings are often a document-centric decision."

I think this should be "in the LaTeX world". The whole LaTeX model seems to be to require the user first to decide what kind of document he's got, and then it will format it for you. What if you don't have any kind of document that someone has already though of and that you have a class for? Well, use "article" (although I haven't exactly got an article) and use that grab bag of macros.

TeX does not impose this kind of top-down thinking. I got Knuth's TeX book hoping I could use TeX instead. That seems quite an easy thing for him to do since he designed it, but after getting it I realized why people do use LaTeX even though it heaps on a huge layer of indirection which is itself difficult to understand. TeX is just too low-level.

I do remember there being some other macro packages (maybe Plain TeX?) that made TeX a little simpler without the huge lumbering apparatus that is LaTeX. I think ConTeXt was also not so document-class-driven. But I found it harder to learn these systems because they do not have the same huge body of documentation. So I continue to use LaTeX for some things even though it's like using a nail gun to mount a picture hanger.


Copyright © 2014, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds