4/22/11

LyX and LaTeX

It's been said that one should never use MS Word to write a thesis, so I headed that advice and started writing my thesis in LaTeX, using LyX since I'm on Windows. Here the problems started.

Here's a list of problems I've encountered, and their solutions:

Escape _ URLs and DOIs when using natbib and mode author-year

When using natbib citation engine and using author-year style, for some reason you have to make sure that there'are no unescaped underscores _ in URLs and DOIs and probably other fields. To esacape, add backslash \, so for example

doi = {10.1007/978-3-540-72559-6_4}

should be

doi = {10.1007/978-3-540-72559-6\_4}


Hack your .lyx file to get author-year working with natbib


I always encountered (author?) in my files instead of a good reference when using natbib and mode author-year. Until I found out how it should be done:

Edit your .lyx file in a plain text editor, and find the entry that starts with:

\begin_inset CommandInset bibtex
LatexCommand bibtex
...

\end_inset
and change the option field to:

options "plainnat"

(At least for LyX 2.0 this works)

It's sad that you have go to those great lengths to track down errors. If you wanna use LyX you need to learn some LaTeX too, unfortunately.

The reason I learned this, was that I downloaded a LyX thesis template and compared the template with my file. The link to the template is: http://sites.google.com/site/lyxthesistemplate/

I hope that this information can help somebody struggling with the same hard-to-track-down errors.