Writing a Thesis with LyX

LyX website

Your options aren’t great for choosing a word processor to write your thesis. I evaluated LyX, a word processor that uses Latex to generate its final output, a few years ago and decided that it wasn’t stable enough for me. Last year, however, I re-evaluated it and used it to write my thesis. I liked it enough to recommend that you do the same.

In LyX, you are using a word processor to write the content of your document. You use a stylesheet to format it. Lucky for you if such a stylesheet has already been defined — and it uses Latex stylesheets. Unlike plain Latex, you can’t make syntax errors. (Ok, that’s not strictly true. You can insert ERT (Evil Red Text) which are raw Latex commands — and doing so opens up pandora’s box of syntax errors). That means that LyX keeps track of opening and closing tags, gives you a table and equation editor, and understands your bibtex file. You don’t have to remember what the Latex command is for whatever, you can choose it from a menu. You can export your document as a .tex file, but you’ll usually just want to generate PDF.

My process

I set up a Subversion repository for my thesis. I used TortiseSVN on Windows and kdesvn on Linux. I recommend doing this starting with your thesis proposal and keeping everything, even graphics files, in your repository. That way you can’t lose them.

I installed LyX (the same version) on both my Windows laptop and Linux desktop. I think LyX looks and works a bit better on Linux, but the most recent version (1.5) uses the QT4 toolkit with good Windows support. Windows support before that was good but the fonts weren’t anti-aliased, which seems petty until you consider how long you’ll be staring at that screen. For Windows, I used the all-in-one installer that gives you the other software you need, including MikTex, spellcheckers, etc. The default LyX install is now ready to go.

I grabbed the cmuthesis.cls latex stylesheet from David Koes website, but I’ve included a copy below. I also created a LyX layout and template file, also included below. You may want to see if there is a more recent cmuthesis.cls file floating around, since many people tweak this over time. See the below linked wiki article I wrote on how to install the ACM stylesheet, doing the same for the CMU thesis files. Now LyX is ready to edit your thesis.

In LyX, browse the Document->Settings, especially the Latex Preamble section. BTW, Jonathan A. hated the “Draft” watermark on my thesis drafts, others didn’t mind it, but buyer beware.

I used JabRef to manage my bibtex bibliography. It’s not perfect but it’s good and getting better. Since it’s written in Java, it runs on any computer you’re using.

This isn’t a technical step. You may find, as I did, that it’s hard to focus on writing your thesis. I found the internet a distraction. My coping stategy was to take my laptop, turn off the wireless card, and sit on my living room couch. The change of normal location helped me to realize that, hey, it’s time to work and not procrastinate. Find what works for you, and be aware when you’re breaking your conditioning, say by surfing in your work zone.

Benefits

LyX gives you all the benefits of using Latex over Word, and it removes many of the headaches. Your document is a text file that plays nicely with diff utilities and version control, and you can edit it manually if terrible things happen. The final output is controlled by a single stylesheet, which seems to be technically possible in Word, but I’ve been struggling with its implementation/UI for years and haven’t mastered it. Pictures are placed well and don’t
stubbornly refuse your attempts to place them.

LyX understands documents made up of many source files. See my thesis for example. The top level thesis file includes files for the chapters, and references the bibtex file. One quirk — you have to generate the document once first before it understands all the subdocuments, so I just got into the habit of opening thesis.lyx then generating a PDF first. This opens each chapter file too, and you’ll soon memorize your chapter numbers and use the Alt-V + number to switch to them.

LyX includes a wysiwyg equation editor and table editor. Since I’m math illiterate, let me simply say that the table editor is quite good. I had some navigation troubles when my table was wider than I could make my window. And the tables come out looking good. You can rotate text in cells, or rotate the whole table. There’s a complex table in my thesis, with source code, and the editor was good for that.

Problems

Crashes. Ok, don’t freak out. Both Owen and I had the problem with LyX 1.4.3 that when paging up through a document with tables that LyX would crash. I never lost a character of data from this, as it seems to be quite good at saving your text continuously. I don’t have enough experience with 1.5 to say if it’s gone, but I did read that the table code was rewritten.

Graphic format conversions. There’s nothing new here compared to Latex, but transforming your graphics files from X to Y is a pain. SVG is a nightmare. I tried a half dozen tools and they’d all
render/transform the files differently and incompatibly. Perhaps it’s better by the time you’re reading this. Word is actually quite good these days — usually you just drop the file in and it renders it fine.

Postscript bounding boxes. For some pictures, the best I could do was to print from an application to a PS printer, saving to file. But then I had to manually edit the bounding boxes in the source code. Ug. Edit 3 March 2009: Not that PS bounding boxes were LyX’s fault anyway, I’ve found that ps2epsi works great at fixing them. Be sure to use the latest version — the one in Ubuntu Hardy was broken for me.

Spell and grammar check. Say what you want, Word has good inline spell and grammar checking. It’s not that I write non-grammatical sentences the first time (very often), but after editing I find that my subjects and objects don’t always agree. Word is pretty good at catching that. LyX only has a batch, not inline, spell checker. I pasted my thesis text into Word as a final check.

Some resources