Introduction to LyX
Although (or perhaps because) it is one of the most flexible typesetting tools, many people are a bit afraid of using LaTeX. They'd rather use a standard word processor. On the other hand, even for those of us quite accustomed to LaTeX, some kind of WYSIWYG editor would often come in handy, especially for shorter texts like letters.
Out on the Internet is a nice tool which may satisfy the needs of both. It is called LyX and its home page is http://la1ad.uio.no/lyx/. The primary download site is ftp://ftp.via.ecp.fr/pub/lyx/, but you can also simply follow the links from the home page. Initially it was written by Matthias Ettrich (firstname.lastname@example.org), one of the initiators of the KDE project, but it is now maintained by Lars Gullik Bjoennes (email@example.com). The most recent package is usually called lyx-current.tar.gz. For those of you running KDE, it may be interesting to know that Matthias Ettrich has just released a KDE version of LyX: KLyX (http://www-pu.informatik.uni-tuebingen.de/users/ettrich/klyx/klyx.html). From the screenshots it looks very promising, so it may be the version of choice if you have at least the basic KDE libraries installed.
For the installation of the source package, you will also need two libraries, which probably won't be included in your system. One is the Xpm library; the other is XForms, a library for simple XView GUI programming. You will need at least version 4.7 of libXpm and 0.81 of libforms. Both of them can already be obtained as Linux (ELF, a.out) binaries. You will find XForms at ftp://laue.phys.uwm.edu/pub/XFORMS/, ftp://ftp.via.ecp.fr/pub/xforms/ and ftp://ftp.cs.ruu.nl/pub/xforms/ and Xpm at Sunsite and its mirrors in libs/X/.
I will focus only on the installation of the binary distribution. It is available for several flavours of UNIX (even for OS/2) and is the easiest to install. Should you have any problems with the binaries, you can still switch back to compiling the sources (remembering to check for the other two libraries).
After you have downloaded lyx-current.tar.gz, log in as root and change to /usr/local. Now do:
tar xzf / cd share/lyx ./configure
The configure program checks your local LaTeX installation and sets up the LyX configuration accordingly. Later on, you can view a file (from the Help/Documentation menu) that lists both the packages installed and not installed in your system.
Of course, you do not need to put the LyX package in /usr/local. Nevertheless, LyX can display its messages in languages other than English. For this feature, it expects to find the internationalization files in /usr/local/share/locale. If you install LyX in a different place, you will have to set the environment variable LYX_LOCALEDIR pointing to the appropriate share/locale directory. If you chose to install LyX in /opt, then for bash you would need:
and for tcsh:
setenv LYX_LOCALEDIR /opt/share/localeIf you don't need the internationalization, i.e., English-only messages are accessible, you can skip this step.
Each user can have his/her own resource file in which customizations can be made. Start by copying the file /usr/local/lyx/system.lyxrc to $HOME/.lyxrc. Now start LyX by typing lyx.
You will be welcomed by a window like the one shown in Figure 1. Looking at the LyX window, you will be reminded of any standard word processor. That's the main reason I think users who have been reluctant to use LaTeX will be encouraged by LyX to make the transition.
At the top is a menu bar with the usual features. Beneath is a button bar with a list box for choosing the desired style and several command shortcuts. (By the way, this button bar can be customized.) The window is dominated by a large text input area with a scrollbar. Finally, at the bottom is a status line.
If you do not wish to experiment on your own but would rather read a little introduction, choose the menu Help/Documentation. A file selector will open, letting you choose one of the package's documentation files. The file extension (*.lyx) shows that LyX uses its own format. However, each document can also be saved in LaTeX format.
Now back to the documentation. As the program is still in version 0.12, most of the files are not too detailed, but for a quick start I'd recommend either Main.lyx or Tutorial.lyx. In this selector you will also find the already mentioned results of the LaTeX configuration check (LaTeXConfig.lyx).
Let's suppose you selected the file Main.lyx. After confirming the message that this file is read-only, it takes a little while to load all the fonts into the X-server. At this point, error messages may appear in your console/shell window. Don't worry; it just means you have not installed all the X-server fonts LyX wants to use. Then, you are presented with one of the really nice features: a table of contents (TOC). A TOC is well-known in LaTeX, but LyX has the ability to display it in a completely interactive window, i.e., you can click with your mouse on any entry and the cursor jumps to the appropriate section (see Figure 2). If you prefer to read instructions on paper, print out the document. Select File/Print, check that everything in the opening dialog box is set to your needs and click on OK (or press enter).
Now let's start to write our first LyX document. Our goal will be a short article with a title, three sections, some mathematics stuff, perhaps a picture, some footnotes and a TOC.
First, if you opened Main.lyx before, close the TOC and select File/Close. If LyX asks you about saving any changes, say no. Now create a new document by selecting File/New. If you are not in your home directory, change to it by pressing the Home button. Now, type in a file name, e.g., MyFirstTest.lyx. After clicking on OK, you are presented with a blank page.
Very well. You (and LyX) are now ready to start typing. First, we create the title. Click on the down arrow beside “Standard”. A list box will open in which you can choose one of several styles. (If you know LaTeX, you will recognize most of them.) Move down and click on “Title”. The layout on the screen will change a bit and you can type in your title, “My First LyX Document”, then press enter. Note that the style changes back to “Standard”. This is a characteristic of LyX. One style is valid within only one paragraph (ended by enter). If you want to type in more lines, press Newline (ctrl-enter).
To begin the first section, select the “Section” style in the list box to type in the section name (e.g., “The First Section”) and press enter. To add an itemize style, type in some text (“A simple itemize style:” enter), and select “Itemize” style—an asterisk will appear. Now you can write some items which are separated by enter. This is an exception to the mentioned rule: to get back to “Standard” style, you must select this explicitly. You can play around a little with the two font styles, emphasize and noun, by clicking on the button with the question mark and the person. The next section will contain some math. After adding a new section headline, click on the formula button and open the math panel (Math/Math Panel, MP). First, enter a three-dimensional unity matrix: type E =, click on the parentheses button in MP and click on OK. Now add the matrix by clicking on the matrix button in MP (the one with nine squares), set the size (3 by 3) and click on OK. This fills in the nine entries. For a unity matrix, the three rows should read 1 0 0, 0 1 0 and 0 0 1. If you wish, you can play around a little with the numerous buttons within the MP.
We will add a third section and insert a PostScript picture into our document. First, select Insert/Floats/Figure Float and type in any figure caption. After that (without clicking on enter), click on the “Insert Figure” button (just right of the formula button). In the dialog, select the first item (encapsulated PostScript). If you left-click on the appearing frame, a settings box opens. Click on “Browse” and select the file /usr/local/lyx/clipart/platypus.eps (or change the path according to your installation). Set the width to 3 inches and click on OK. The platypus should now appear on the screen. You will notice a red frame around the complete figure, with a small grey rectangle to the left reading “fig”. If you press the left button in this field, the whole figure will collapse into a small, red “fig”. Left-clicking on this brings back the whole frame. Pressing the left button anywhere within the figure opens the “Floats” context menu, giving you a choice of actions to perform.
By this time, your document should look like Figure 3. Congratulations—you've just finished your first LyX document. Now save it to disk (File/Save), if you have not already done so. If you like, print it out (File/Print). This may take a little time. As you know, LaTeX is still working behind the scenes, which means that the standard LaTeX procedure of compiling and printing has to be gone through.
If you followed the opening of the documentation file, you have already seen LyX's feature of displaying the table of contents (TOC) of a document in a separate window, letting you jump to each entry by using the mouse. How is this feature set up and invoked? In fact, you do not have to do anything special. LyX keeps track of the “Section” style as you assign it to parts of the text. Choose Edit/Table of Contents, and there it is. You will find all the sections you created; if not, just press the update button. Clicking on each entry takes your text cursor directly to the specified point.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...