Thesis writing using Lyx

When it came time to write my thesis several months ago I decided to use Lyx instead of using LaTeX directly. This is a short tutorial explaining this decision and how it was accomplished.

Lyx is a front-end for LaTeX. It gives you all of the power of LaTeX if you want it but also offers a more traditional word processor like interface. Lyx lets LaTeX handle all of the document layout and gives you the professional look that drives so many people to LaTeX. Lyx also allows you to write without having to see the LaTeX commands or worry about the document layout. The most important thing to realize is that Lyx is not a WYSIWYG editor like MS Word. This is a good thing. If you are used to WYSIWYG editors this can at first seem very strange. I personally find it quite liberating because I have the tendency to obsess over the visual details as I write. In a normal word processor this tendency manifests as losing my train of thought when I stop to format the document. When writing in LaTeX or HTML the same problem occurs when I switch to formating the tags. Lyx does however give you enough feedback about the layout through changing the font of chapter and section titles among other things that the writer does still get some idea of the eventual layout. Lyx also handles cross references and the bibliography in a nice intuitive manor.

Since the Lyx file format is text based it is also very easy to use standard version control software on the document as work progresses. Just as when coding, I view the use of version control software with a document of the size of a thesis as being absolutely essential. The ability to scrap a paragraph and know that you can quickly and easily revert to the old version if necessary frees the writer to attempt larger changes than would otherwise be convenient. It really doesn’t matter what version control system you use with Lyx. Any of Subversion, Mercurial, Bazaar or, if you are on Linux, Git will work great. At completion my thesis Git repository consisted of over three hundred commits.

A short note about figure creation is also in order. I used Inkscape for all of the figures in my thesis. Inkscape is a vector graphics program which uses SVG as the standard file format and is available for Linux, MacOS and Windows. I am not a graphic artist in any way but I found Inkscape easy to use once I figured out how all of the tools work. Making use of the various alignment and transformation tools is especially time saving. Since Lyx cannot make use of native SVG files my solution was to save the figure in SVG format in case I wanted to do future editing and also export an .eps file which Lyx has no trouble consuming.

If you writing a thesis it is quite likely that your university or department has a LaTeX document class available. You should make use of this resource because it will save you the large amount of work involved in getting the document to match the university requirements. Obviously using Lyx would lose some of its appeal if it was impossible to use the provided document class. Fortunately this is not the case.

If you look at your document settings in Lyx you will see a long list of document classes. I used the report class for my thesis. When first attempting to use the LaTeX document class from my university I spent a lot of time trying to get the document class to show up as an option in Lyx. You can find various pointers on how to do this but it never worked well for me and it was too much trouble. Fortunately I found a simpler solution. Rather than get Lyx to use the document class I wrote the document using the standard report class. When the document was complete I exported the document from Lyx to LaTeX (pdflatex). Once I had the LaTeX file it was simple to edit it and replace the document class name with the one provided by the University and add the additional LaTeX commands which were required. This task was probably simplified by the fact that the provided document class inherited from the standard report class. Modifying the LaTeX file may seem like a lot of work, especially having to make the changes manually again each time the document requires revision. Fortunately it is a simple matter to maintain a patch file with the necessary changes and apply it to the exported LaTeX file after revisions have been made. Note that there is little point exporting the document until it is very near completion.

The rest of this tutorial is specific to the UWO Computer Science document class. I hope this information will be useful to others as well. If you don’t already have a copy of the UWO CS Latex template I have made a local copy available.

After exporting your Lyx document to LaTeX (pdflatex) open up the file in an editor. In these examples the exported file is named thesis.tex. The first thing you need to do is replace

 \documentclass[12pt,english]{report}

with

 \documentclass[12pt,english]{uwo-thesis}

The rest of the modifications basically involve adding new LaTeX commands to the file. Since it is the way I did things, I am going to assume that within Lyx the beginning of your document contains the following in this order: title, abstract, table of contents, list of tables and list of figures. This is the order that the UWO thesis style guide requires.

Immediately after the \title LaTeX command add lines similar to the following (obviously filling in the values for your thesis).

\spinetitle{a shorter title}
\firstname{Dan L.}
\lastname{Siemon}
\degreeaward{Master of Science}
\university{University of Western Ontario}
\address{London, Ontario}
\copyyear{\the\year}
\supervisor{your supervisor}
\examinerA{first examiner}
\examinerB{second examiner}
\examinerC{third examiner}
\dedication{a dedication if you want}

These LaTeX commands are used to create the certificate that goes at the front of the completed thesis.

Next locate the \maketitle command in the file. Immediately after this command and before the \begin{abstract} add the following.

\makecertificate
\begin{frontmatter}

Following the close of the abstract section with \end{abstract} command you can add an acknowledgment section if you desire.

\begin{acknowledgements}
The past and present residents of MC240.
\end{acknowledgements}

Now you need to close the frontmatter section. This is accomplished by adding the following text after the \listoffigures command.

\end{frontmatter}

This leaves just one more requirement, the Vita which must be at the end of the thesis. I handled this requirement by creating a short LaTeX document called vita.tex and including it at the end of the file. Place the following immediately before the \end{document} command.

\include{vita}

All of these changes may seem like a lot of work. Fortunately this can be automated by creating a patch file. To create a patch file both the unmodified and modified files are required. First make a copy of your newly modified file. Then re-export the file from Lyx to obtain the unmodified version.

cp thesis.tex thesis.tex.mod

Export from Lyx again.

diff -u thesis.tex.mod thesis.tex > thesis.patch

Reapplying this patch after exporting from Lyx should be as simple as:

patch < thesis.patch

If you make large changes to the document the patch may fail to apply cleanly. In this case fix the file manually and re-create the patch file for future use.

Thanks to Andrew for a couple of the ideas presented here.

The Social Graph

I’ve been thinking about the social graph (though not by that name) for a little while now. It seems I am not the only one. My interest in this area comes from my dislike of walled gardens such as Facebook (which I have still been able to avoid joining despite the peer pressure).

Here are a few interesting links.

Thoughts on the Social Graph
Social Network Fatigue and the Missing Web 2.0 Address Book
Opening up the Social Network Graph
Using Open Standards to Free the Social Graph

Pinker on violence

Yesterday Andrew posted an entry about a TED presentation called A brief history of violence by Steven Pinker. Take a look at his post and watch the video. The video is only 20 minutes long. In short, the presentation offers data that refutes the idea that the human race was more peaceful in the past.

At around the 9:50 mark Pinker mentions that people link the ease by which a specific incident of something can be recalled with the perceived probability that it will occur. For many years I have avoided watching local newscasts for exactly this reason. When half of the newscast talks about car crashes and the other half talks about bad things happening at local schools one can’t help but think that car travel is very dangerous and that there are ‘bad’ people everywhere.

New keyboard (or bye bye RSI)

I spend a lot of time in front of a keyboard. It is one the negatives that come along with having your work and play intersect. As a result I have had some small RSI problems over the years. It has never gotten to the debilitating stage but it is has definitely caused me to go watch TV when I’d rather be working on the computer (I hate watching TV).

In an attempt to reduce the RSI problems I have tried a quite a few different keyboards. For many years I used my trusty MS Natural Keyboard. This is an original MS full size natural. I bought it as part of the first computer I paid for by myself, sometime around 1995. It still works perfectly. The layout is better than most keyboards but the keys are pretty stiff, this may be age related.

MS Natural Keyboard

I also have an really nice keyboard that came with an IBM iSeries server. It is a traditionally shaped keyboard but the keys are really nice. Unfortunately, using this keyboard didn’t do much good (or bad) for my RSI problems.

IBM Keyboard

I have also tried a small laptop size keyboard. This was probably the worst of the many keyboards I have tried to use. I don’t know what I was thinking.

Laptop-like keyboard

There are many more less memorable keyboards that I have tried which were also of little use in reducing the RSI pain.
Not only have I tried many different keyboards I have tried adding a keyboard tray with an attached mouse tray to get the proper posture and positioning. I think this helped but it did not solve the problem.

During the time I have been experimenting with other keyboards I knew about Kinesis keyboards. There are probably very few computer geeks who haven’t ooogled over a Kinesis contoured keyboard at some point. These keyboards look cool and are designed to be ergonomic. Unfortunately, they also cost a small fortune.

Kinesis keyboard picture 2

Kenesis keyboard picture 1

A few months ago, with the inspiration of my friend Andrew, I finally broke down and bought a Kinesis contoured keyboard. Honestly, this is the best ~$350 I have ever spent. After using this keyboard for a few months most of my day-to-day RSI symptoms are gone. It only took a few days to get reasonably fast at typing on the Kinesis but there are still moments when my fingers instinctively go to the wrong spot (especially after a day at work with a normal keyboard). The fact that the Kinesis lacks a keypad is also a nice plus; this keyboard actually sits centered in the keyboard tray and if you use it on a desk surface it doesn’t force your mouse to be far off to the right. The feel of the keys is also the best of any keyboard I have tried. I am reasonably confident that the combination of this keyboard and the keyboard tray is responsible for the improvement in my RSI symptoms because it only takes a few hours at a normal keyboard before the symptoms to return.

So why am I writing this little story? There is a lesson here. For several years I was too cheap to buy the proper equipment that may have helped my RSI problems and I paid for it a little each day with unnecessary pain. Don’t be like me. If you have RSI problems get yourself a keyboard designed for your hands not ease of manufacture.

I’m probably buying a second one to have at work.

SVG demo

If you are running Firefox (no idea what other browsers this works with) take a moment to play around with photos.svg. This is a reimplementation of one of the Microsoft Silverlight demos using SVG and Javascript. It may be slightly slow but I think many people will be surprised that this level of interactivity can be accomplished on a web page.

After you are done playing with the above take a look at the SVG video demo. It is basically the same demo as above but has movies playing instead of static pictures. Unless you run a development version of Firefox you’ll just have to watch the videos.

Torvalds interview

Q&A: Torvalds on Linux, Microsoft, software’s future

CW: Lots of researchers made millions with new computer technologies, but you preferred to keep developing Linux. Don’t you feel you missed the chance of a lifetime by not creating a proprietary Linux?

Torvalds: No, really. First off, I’m actually perfectly well off. I live in a good-sized house, with a nice yard, with deer occasionally showing up and eating the roses (my wife likes the roses more, I like the deer more, so we don’t really mind). I’ve got three kids, and I know I can pay for their education. What more do I need? . . . So instead, I have a very good life, doing something that I think is really interesting, and something that I think actually matters for people, not just me. And that makes me feel good.

The original network neutrality problem

From History of the Public Switched Telephone Network:

  • 1884
    • AT&T is incorporated as a subsidiary of American Bell
    • Bell Telephone creates the first long distance connection from Boston to New York City
  • 1891
    • Almon Strowger receives patent for his automated electromechanical call switching device
      “No longer will my competitor steal all my business just because his wife is a BELL operator.”
  • 1899
    • AT&T buys out American Bell assets.
    • Cleyson Brown founds Bell System competitor Brown Telephone (eventually becomes Sprint)

Somehow that comment seems relevant given the current net neutrality debate.