Switching to LyX for Linguists

Introduction

This page explains how users of OpenOffice, Microsoft Office and other word processors can migrate to LyX, a Graphical User Interface for LaTeX.

I rarely use anything other than LyX these days for work, but you should be warned that switching to LyX/LaTeX is not a dabble, it’s a commitment. This page will get you started, but to really learn and understand how it all works, you will definitely have to poke around the manuals and have to decipher unclear instructions on your own. This is the price you pay for free software.

Advantages of LyX

  • Free
  • Stable
  • Fast
  • Compact: takes up very little room on your computer (11 times smaller than MS Office) and produces small files
  • Produces beautifully typeset PDF files that are readable on any machine
  • Makes typesetting equations and mathematical formulas easy
  • Excellent, powerful bibliography support
  • Easier to learn than LaTeX, since it is almost a WYSIWYG environment (i.e., what you see on the screen while you are editing the document looks almost like the final output)
  • Can export to HTML and to LaTeX
  • Better suited to the needs of linguists than OpenOffice. LyX even includes a special Linguistics module.

 

Disadvantages of LyX

  • Steeper learning curve than for word processors
  • Some things that are very easy in MSWord are harder in LyX, e.g., trees and some features of tables (beats OpenOffice, though!)
  • This is an open-source program, so occasional bugs are introduced after updates, even as other bugs are fixed
  • Many of the things linguists need to do require special packages that you have to download; the packages themselves require learning
  • Many of the more advanced typographic tasks require using the LaTeX mark-up language, so you do not know what your document will look like until you typeset it.
  • You have to pay very careful attention to the syntax of LaTeX code. Just as in HTML, misplaced spaces, brackets, and slashes can break your file
  • If you collaborate with MS Word users, you have to get MS Word or Open Office; LyX documents do not easily convert to those formats
  • It only does the one thing–make documents. For your spreadsheet and slide presentations, you have to keep Open Office around

 

Downloading and setting up LyX

  1. Since LyX is basically a sophisticated front end for LaTeX, the first step is to get a working LaTeX installation.
  2. Mac: Install MacTeX. MacTeX is a large download because it includes several programs. But, it puts everything on your computer where it is supposed to go, including BibDesk and a spellchecker program (which I usually delete after installing).
  3. Windows: get MikTeX.
  4. Linux: you might already have both LaTeX and LyX on your system; it ships with some distributions. If not, apt-get install lyx should do it (it also installs the prerequisite, Tex Live, which uses up a ton of room and takes some time to download).
  5. Download LyX here. To check whether it works, open one of the Help manuals that comes with the program and make it into a PDF file. Here’s how:
  6. Open the LyX program, and go to Help>Tutorial.
  7. While the Tutorial is open, go to View>PDF(ps2pdf). If everything is installed correctly, you should see a PDF file of the Tutorial shortly. Otherwise, you’ll get a (possibly very) cryptic error message, and then God help you.
  8. Get a bibliography program. If you are a Mac user, you should have gotten BibDesk as part of MacTeX. Alternatively, get JabRef, which runs on any platform. JabRef is a freely available Java-based program that is similar to Endnote. Once you set up this program, you will be able to edit your bibliography database and search for references. If I were you, I would borrow someone else’s BibTeX bibliography file. Of course, if you’re the strong silent type, you can also make your own from scratch. Note: The most recent distribution of LaTeX that I have came with a spellchecker program, Excalibur. LyX uses aspell and ispell, which I think are older LaTeX spellcheckers. I get annoyed with spellcheckers, but if you like them, perhaps you can figure out how to use them and tell me whether they are any good.
  9. The next step is to create and populate a texmf directory, which is where you keep extra packages (extensions not normally included in a TeX distribution). You’ll need them to do special formatting, like dashed lines in tables and so on.
    1. Mac: Re-create the following structure on your machine. You can look inside my texmf directory for reference.
      Macintosh HD/Users/YourUserName/Library/texmf/bibtex/bib/... (your bibliography files, with the extension .bib, go here)
      Macintosh HD/Users/YourUserName/Library/texmf/bibtex/bst/... (your custom bibliography formatting styles, with the extension .bst, go here)
      Macintosh HD/Users/YourUserName/Library/texmf/tex/latex/... (your latex packages go inside this directory. They can be inside other folders)
      Shortcut: you can simply take my texmf file and unzip it into your Library folder. If you do not see a Library folder, it is probably hidden, so you need to modify your OS view settings for these folders (find out how to do this for your version of Mac OS). Reconfigure LyX afterwards (LyX>Reconfigure), and it should find all the packages you have installed on your machine. You can verify that it did so correctly by going to the Tools>TeX Information menu of LyX and looking at the paths of installed .bst and .sty files. If new things aren’t showing up, hit “Rescan”. You can get additional packages from CTAN. Check CTAN for package manuals, since NONE of them are self-explanatory.
    2. Linux: As for Mac, re-create the texmf/tex/latex/etc. tree inside your user directory. Where to put it: you can get away with ~/texmf, but also see here for more complicated setups: http://math.arizona.edu/support/tex/accountpackages.html. As for Mac above, Reconfigure LyX (LyX>Tools>Reconfigure).
    3. Windows: It appears that there is no standard location for the texmf folder on this OS. You can put it wherever you want, but you will need to go through the extra step of registering it with MikTeX. Moreover, apparently, nothing happens automatically on a Windows LaTeX installation, so you have to update every time you add a package. Here are the instructions (see here for the full story):
      1. Run the MiKTeX “Settings” application (from the Start menu) and go to the “Roots” tab. That lists the directories on the search path MiKTeX uses. Add the location of your texmf folder to that tab (Add… button) and move it up to the top of the search chain.
      2. Whenever you add something to your local texmf directory, they should run the Settings application, and on the General tab click “Refresh FNDB” (which runs texhash to update the LaTeX file databases).

The packages

A linguist will probably need at least the following packages. You can download from CTAN, or copy my texmf directory:

  1. tipa: for phonetic fonts. Even though LyX can handle Unicode, on occasion, you still need to use the native IPA input method.
  2. arydshln: for dashed lines in tables. LyX can do solid lines, double lines, and no lines, but for dashed lines, you need a special package.
  3. colortbl: for shading cells in tables, if you’re gonna bother. I don’t recommend it for OT use, but it might come in handy for shading out holidays in syllabi or something.
  4. covington: for sequentially numbered examples and aligned glosses. There are alternatives, such as gb4e and such. Covington is implemented in LyX.
  5. bbding: For exotic symbols such as the pointy hand with cuff. You might want to download the LaTeX symbols manual while you’re at it.
  6. qtree: Trees. Others I use are xyling and forest.

Learning how to use LyX

Before you do anything else, you should take the LyX Tutorial, which takes about 30 minutes. The Tutorial is in the Help menu of LyX. If you already know how to use paragraph styles in Microsoft Word, this should not take very long and it won’t be that new to you, but you have to get used to the way LyX is set up. Then, read and try to typeset the Linguistics manual (LyX>Help>Specific Manuals>Linguistics). The next step is to go to LinguistLyX and practice with the formatting tricks discussed there. Make sure to try out the new Linguistics Module. There is a LyX help file associated with it, which takes you through the steps of special linguistics formatting.

Please read the manuals. Please use a search engine. It’s the only way. Your helpful local LaTeX users most likely have very customized needs and don’t know how to do everything you need. This is not the kind of program that is well suited to the idle personality.

Customization

You can customize LyX quite a bit to suit your work habits. I find the following indispensable.

  1. A customized key shortcut file (for Macs only; Windows and Linux users will have to figure this one out on their own): this allows you to use pre-defined key shortcuts and introduce new ones for starting numbered examples, switching between environments and so on.
  2. You can customize the preamble so that it always includes certain packages and other commands that you use often. Mine includes the following line:%\bibpunct{(}{)}{,}{a}{,}{,}The “%” symbol comments out the line so that it is ignored. The bibpunct command tells BibTeX how to format the punctuation in your bibliography (for example, the “year” will be surrounded by ( on the left and ) on the right, multiple publications from the same author of the same year will be annotated with letters such as “a”, references separated by commmas, and so on. Without it, the bibliography will not be formatted correctly. If you have the line but no bibliography, on the other hand, the file will not typeset correctly. So by default it’s commented out.
  3. LyX supports Unicode, so you can input IPA symbols directly in a Unicode IPA font such as SIL Doulos. For that, it really helps to have a keyboard layout. I like SIL’s old IPA-SIL layout, which they no longer distribute. The following zip file has a manual and the layout so you can install it on your Mac.

Some useful websites

Once you switch, you will need to look for help on your own. Pretty much everything you need to know about LyX and LaTeX is available online, though many still recommend Lamport’s published book guide to LaTeX for reference. Here are some LyX-related websites:

 

 

Comments Off on Switching to LyX for Linguists

Filed under lyx and latex, tutorials

Comments are closed.