OS/2 eZine - http://www.os2ezine.com
Spacer
November 16, 2002
 
Isaac Leung got a degree in Engineering Physics and then Electrical Engineering after which he promptly got a job as a product engineer at a company which makes high speed datacom chips. He is old enough to have cut his computer teeth on Commodore 64's and first played with OS/2 1.3 EE while at a summer job with IBM. The first PC he ever owned came with Windows 95, but he soon slapped on OS/2 Warp 3 and has been Warping ever since. In his spare time, he plots to take over the world.

If you have a comment about the content of this article, please feel free to vent in the OS/2 eZine discussion forums.

There is also a Printer Friendly version of this page.



Spacer
Previous Article
Home
Next Article


One hardware platform; three environments:  OS/2, Linux, Windows.  What more do you need?


LyX for OS/2

You can think of LyX as another word processor, that's what you're going to use it for. It's actually a front end, and a bit more, for the LaTeX typesetting engine. (LaTeX, pronounced "Lay-Tek" is an version of TeX. The last "X" isn't actually an "X", it is the greek letter "Chi". Don't ask me why, UNIX people have funny humour). TeX was originally created by the rather legendary (at least amongs computer science people) Donald Knuth. He was unhappy with his publishers typesetting, so he created his own typesetting engine. While full-featured, LaTeX/Tex is a bit of a pain for some average users, because you have to type your document up in a sort of mark up language, and then the resulting file actually had to be compiled before you could print it out properly. (Who wants to compile a letter to grandma?)


This is what part of a LaTeX file looks like:

====================================================================
\begin{center}
Introduction to \LaTeX \\ % \\ = new line
February 26, 2002
\end{center}

\section{Introduction}
\TeX\ looks more difficult than it is. It is
almost as easy as $\pi$. See how easy it is to make special
symbols such as $\alpha$,
$\beta$, $\gamma$,
$\delta$, $\sin x$, $\hbar$, $\lambda$, $\ldots$ We also can make
subscripts
$A_{x}$, $A_{xy}$ and superscripts, $e^x$, $e^{x^2}$, and
$e^{a^b}$. We will use \LaTeX, which is based on \TeX\ and has
many higher-level commands (macros) for formatting, making
tables, etc. More information can be found in Ref.~\cite{latex}.
====================================================================

Now you know why it never caught on with the general public! However, LaTeX/TeX is powerful, full-featured, stable and produces very good output, especially for typesetting, so it continues to be used in many specialized fields. Fortunately, along comes LyX, so the average user can use LaTeX/Tex painlessly. Lucky you. It has even been ported to OS/2, and is absolutely free and open-source.

Getting set up

Too good to be true, isn't it? Well, yeah, there is actually one catch. It's been compiled for OS/2....but it requires an X-window server to be running on your system. If you want, XFree86/2 is free, but less pain-free than commercial software such as HOBLink X11. I actually have HOB X11, so setting up LyX was relatively easy. Maybe one of these days somebody will port it to OS/2 PM (it is open source software.)

First up, you need a working X-Window server. I'm not going to go into details about that here, that's for another article. Now, if are using something other than XFree86/2, then you need to install the XFree86 Libraries, because LyX assumes that you are running XFree86/2 (and so do nearly all ported X applications). The easiest way is a nice WarpIn Package of XFree86 Libraries. (You can refer to a previous OS/2 e-Zine article about getting that set up). Once you've done that, you can get started on installing LyX itself. It's pretty easy:

  • Head on over to hobbes and grab yourself a copy of LyX/2.
  • Unzip the package into your XFree86 directory. (You have one even if you aren't running XFree86/2, as long as you've installed the XFree86/2 Libraries.) You can theoretically put it elsewhere, but I assure you, the headaches are not worth it! Put all XFree86/2 applications in the XFree86 directory.
That's it. You need to have your X-server running, then you can just run the lyx.exe to start it up. Since this is just a bit over 2MB, it's pretty instantaneous. Now, there's actually a few other utilities you might like to have, such as "dvips" or other PDF utilities. These are described in the documentation, and pretty much all of it is available for OS/2 on hobbes, but you don't need these for now.

When you first start up, it may give you an error message about the /tmp directory, if one doesn't already exist in your drive. Don't worry, it will work just fine. On the first startup, just go to "Edit->Preferences" and you can change the temporary directory path.

Here's where you'll meet one of LyX's little user interface quirks. It isn't charming, it's horribly bad practice.

LyX Preferences

It's a multi-tab dialog in multiple rows. The top row are the main sections. The bottom row, even if it does look the same as the top, is not a continuation of the sections! These are the subsections of the main sections shown in the top row. UGH! They may produce elegant, stable code, but they've got a thing or two to learn about user interface design! Anyways, at least it works. With a bit of poking around, you can find what you need to change.

You may have noticed the language tab in the screenshot above. Yes, since LyX is a worldwide effort, there is support for many languages. There is even available Chinese-Japanese-Korean (CJK) support, but that hasn't been built into the main branch for OS/2 yet. As long as you've installed the fonts for your X-server, you can use whatever language you want, presumably.

How's it work?

LyX looks and works pretty much like most other word processors. Although it may seem spartan compared to something like Word, basically all the features one needs are there.

LyX main window
[Click image to view full size.]

Nothing really stands out, but the interface looks pretty familiar, and there is even fly-over bubble help on the buttons. Footnotes, margin notes, figures, tables, etc. There are a few differences in operation, mainly because the "philosophy" of LaTeX is different from that of a normal word processor. The idea is that you should be writing, not playing around with positioning tables and fancy fonts and all those other things you can do nowadays. It would help to go through the tutorial first.

So what's missing? You may have noticed it already. There is no font/font size selection, there's no buttons for bold, underline or italic. What happened? This is by design. The originators of LaTeX/TeX figured that people should stop mucking around with pretty fonts and just get on with the job of writing. So, all you do is specify what kind of text it is (i.e. section header, plain text, sub-chapter, footnote, etc.) and everything is taken care of for you. If you're the sort that likes to customize, yes, the fonts and styles can be altered (and is designed to be customizable, it isn't hacking), but you'll have to learn a bit about LaTeX/Tex or read the LyX manual, which I will not go into here.

Working with LyX

The first thing you want to do is create a new document. Unlike other word processors, it's probably less likely that you want to make one from scratch, more likely to start a new one from a template. That's because it takes some work to define all the sections and style types that you have in your document. Fortunately, several sample templates are included, and many templates are available freely from the Internet. This sort of scheme makes a bit more sense when you understand that the primary consumers of this were usually scientists and engineers. Often the documents submitted are required to be in a particular format, so you would not want to mess with your own templates. For example, in the screen shot shown above, it's a template for submission into the IEEE Transactions journals, so once someone has got it right, everybody will just follow the same template to make sure they don't miss out on any requirements.

All about style

With LyX, everything is in the styles. You want a bulleted list? There is no "bullet" button, just highlight the text, and select the style to be "List". How about a numbered list? Same thing, highlight the text, then select the style to be "Enumerate". There's something to be said for this approach. Once you realize there is no playing around, you just get to your writing. And you know that all your lists will look the same, all the time, everytime. No accidental formatting possible here. Same thing for all title and section headers. If you want it to be such, you have to change the style, not the font. This ensures that all your titles are consistent in appearance, and that they are automatically numbered and you can be sure they won't be left out of the Table of Contents.

Some of you may be happy to hear this: LyX can handle start and end quotes "properly". (i.e. 66's and 99's, unlike WordPro.) The trick here is to select the style "Quote". LyX will then automatically handle start and end quotes differently.

Graphics

Pictures may be a bit of a weak point with LyX (or LaTeX/TeX.) Not that it is bad at handling graphics, but the only issue here is that the LaTeX engine can only handle Encapsulated Postcript (.EPS) or Postscript (.PS) files. So graphs or figures will have to be converted. Now, that in itself wouldn't be so bad, but it is unable to render the EPS or PS files on screen for you, so you have to either print it out, or ask it to render a DVI or PDF file to see how it turned out. To be fair though, if you've got an EPS file embedded in the document, you can be pretty much certain that it will turn out properly. You just have to worry about placing it. Also there is no built in function in LyX to draw even simple figures. Any graphics will have to be done with an external application.

Tables and Equations

Tables can be created by using "Insert->Tabular" or by clicking the button on the toolbar. You apparently get one table type. With one row for header and the rest for data. The table cell widths will expand automatically to fit the text. I say apparently, because LyX has another very non-intuitive feature here. If you select the table, you can actually change the layout, borders, etc. using the menu item "Layout->Tabular". This is bad because normally, the "Tabular" option doesn't exist. It's not simply greyed out or something. It is not present. If I didn't tell you, you'd have to experiment and discover "Aha! There's a new item in that menu during this particular time!". Well, the functionality is there, but the user-interface is not so good for this.

Table Options

The equation editor is reasonably complete and decently useable (but not as good as WordPro's, in my opinion). You can be pretty certain it will be complete, as it was originally catered towards scientists and engineers! I suppose if you prefer LyX for this, you can generate a LaTeX equation, which you can then import into WordPro. One advantage of this editor is that if you're familiar with the LaTeX "codes" for the various symbols and formatting for equation entry, you can type in long equations very quickly, instead of searching through various menus and boxes for all the symbols and formats you need. For example, typing the "_" character automatically starts a subscript. In WordPro, I'd have to wiggle my mouse up to the top menu bar and click on the subscript button.

LyX main window

If you aren't familiar with it yet, there is a nice little box of math functions and symbols for you. In another little quirk though, if you want superscripts or subscripts, it isn't in the "Math Panel", you have to go to "Insert->Special Character" and pick superscript or subscript.

Tables, figures and probably equations can have auto-numbering. When you go to make a list of them, everything is automatically handled. No need to manually number each item (well, the same feature is available on most word processors too.) Actually, to be honest, it doesn't seem obvious to me how to auto-number the equations, but as everyone does it, the function must be there somewhere! (Yes, and I did see it in the manual somewhere, I just haven't got around to reading it yet.)

Navigation and Organization

In order to get a nice title-looking font, you are forced to select the correct style. This in turn makes it a breeze for LyX to generate a Table of Contents. The same applies for a List of Figures, Tables, or Equations. Even Index entries and References are easily handled. So even though it may have seemed a bit of a hassle at first to be forced to select the style, when it comes to putting it all together, you can't go wrong any more. Inserting a Table of Contents or any other list is just as easy as any other word processor. Just go to "Insert->Lists & TOC" and select the one you want. Unlike other word processors, you get no choice in the matter. Consistent with the rest of LyX, if you ask for a Table of Contents, you can have any colour you want, as long as it's black. It's the usual trade off. If I force you to do things only one way, there's very little chance it will be messed up.

Since you've so nicely defined the different sections, might as well make use of it. The navigation feature is present in any modern word processor, but LyX has made it particularly accessible without wasting valuable screen space. For example, Word takes up a huge area of your screen with a big navigation window pane on the left side if you want to use this feature.

LyX Navigate

Just go to Navigate in the menu bar and you can select the section to jump to. In a simple letter, probably not of much use, but if you're re-writing "War & Peace", this is invaluable. Also available is the ability to jump to "Notes" within your document. These obviously don't print out, but are little reminders for you. (It could be something like "Be sure to update the graph here!").

Compatibility

Ouch! LyX doesn't deal with anything except for ASCII text, LaTeX/TeX files and LyX files. It does sort of have the ability to generate PDF and Postscript files automatically, providing you have installed the requisite (free) utilities. This leaves you with a sticky problem. Either you use LaTeX/TeX, or you use some other word processor. There's no real room for mixing things around here. The way the world is nowadays, you probably need at least a Word viewer or importer of some sort, so if you like LyX, it won't be your only word processor. On the other hand, I see entire departments using exclusively LaTeX/TeX for generating their documents, and it's still a very common format in certain fields, so you certainly won't have a problem using LyX as your document generator. And if you can tell those people who keep sending you Word files to send a plain text version, then you're free.

If you poke around a bit in the Preferences, you'll find some settings for format coverters. This doesn't really count, as it just calls up an external viewer for formats it doesn't know how to deal with.

Help!

When all else fails, it's time to RTFM, isn't it? And a Fine Manual it is indeed! It's probably better than any other word processor out there! (When's the last time you saw a word processor ship with a decent manual? Even in electronic format? Okay, SmartSuite's stuff is actually pretty good too.) Who else can boast an Introduction, a complete Tutorial, a User's Guide, a Reference Manual, a FAQ and more!

Actually, I highly recommend reading the Tutorial before you embark on any adventure. While LyX looks like a normal word processor, there are differences which can make your life difficult if you don't know why or how. I would compare this to a user moving from Windows to OS/2. It might be a fight at the start, but when you realize why something is done, you understand that different isn't always bad. Often it's better!

Conclusion

So after all this, you might be asking "Why LyX?", is there anything that stands out? (Apart from being free). Well, yes, there is a very good reason why you might consider LyX. It isn't obvious at first until you have used many other word processors for a while. LyX and the LaTeX/TeX engine have been time tested and all the bugs ironed out, even for very long and complicated multi-part documents. You can be sure that you won't have any funny bugs when it comes time to turn in your document. Me? I actually prefer using WordPro. But as I'm looking at a 300-500 page document with lots of figures and equations, I find myself looking for alternatives. Especially when it comes to figures and equations, WordPro has too many "special features" (i.e. bugs) that I'm reluctant to pick that as my tool of choice. Many years ago, I used Word 95 for a 200+ page document, and I had enough of a fight with that to print everything out properly. With LyX and the LaTeX engine, I can be sure it will print out as intended, first time.

LyX is a front end for LaTeX engine. It has just about everything one might need in a word processor. Honestly, many people have used this to write large textbooks with many figures, tables, and equations. It's likely to be far beyond what most people require. Although the time required to learn how to use Lyx/LaTeX style of document processing effectively may be a bit longer, you may find it worth your while. You can't beat free, so give it a shot.

This was not intended to be a comprehensive review of LyX, but just to highlight a few things and give you a taste of what it's like. I'm sure I've missed many things, but you can always explore them yourself.


LyX Home Page
LyX/2 from hobbes
University of Duesseldorf FTP Site for X WarpIn Packages
XFree86 for OS/2 Home Page


Previous Article
Home
Next Article

Copyright (C) 2002. All Rights Reserved.