Setting up TeXlipse and SumatraPDF

When you really need to get yourself to finally start working on something, you brain usually kicks into overdrive looking for anything unrelated to occupy itself witOOOH, SHINEY... Start looking up something on wikipedia, and three hours later you no longer remember how you got to where you are right now and there are still ten or so unread tabs in your browser.

Some time ago I've started to try and trick my lazy ass brain into channeling these efforts into something productive. Need to start coding a new project? Hey, let's check out that fancy new DVCS that everyone is going on about! New project? Let's learn a new language! Maybe not optimal, but it still gets me there (eventually).

Then there is this year's thesis. While still desperately trying to avoid starting work on it, I accidentaly stumbled across LaTeX, immediately thinking 'this might be it'.

I've opted to using Eclipse (along with TeXlipse plugin) for the actual writing, since I was already pretty familiar with Eclipse and none of the editors available under Windows raised interest in me (I've heard heaps of praise for Kile, though). I got the actual LaTeX core with the MikTeX package.

The MikTeX installation is... strange. After unpacking the downloaded archive, the installation itself is launched from a PDF document, no less. You scroll down the document, which also acts as a sort of a manual, clicking hyperlinks, which will run the actual (un)installers for the various components. Also - and this pissed me off a bit - it refuses to start unless you have Adobe Acrobat Reader installed (I'm using Sumatra for viewing PDF files).

(Don't trust that fucker, you probably only want MikTeX)

So, after installing MikTeX, you probably want to set up your editor. The package comes with TeXnic Center, but you don't want that, dear sir or madam.

We'll be using Eclipse, BECAUSE THE TITLE SAID SO. Grabbing it is pretty straightforward, just visit this page and pick one that suits you best; the plugin will work with either build. Unpack the zip archive where you want, and fire it up (you might need to install Java JRE/JDK if you don't have one already. Eclipse will display a helpful warning message before dying if that is the case).

After starting it up, we'll be visiting Help > Install new software...



Just enter texlipse.sourceforge.net into the text field, and Eclipse itself should take care of the rest.

This should get you up and running, you can start creating your LaTeX project right now if you so wish. There are however some other things i'd like to mention, as they were the sole reason I even decided to write this post. These are the mythical beasts known as 'forward-search' and 'inverse-search'. Particularly inverse-search is useful, since it allows your editor to move your cursor to a certain row by double-clicking a corresponding passage in the resulting PDF document.

Setting this is a bit more tricky, and though I found some tutorials/examples of setting it up correctly, I didn't find a single one that would have all of the settings right. So, off we go.

First, we enable synctex support in our PDF generator. Go to Window > Preferences...


The `-synctex=-1` is the interesting part. Yes, that's `minus one`. Don't ask.

Now, we just need to set up the PDF viewer, SumatraPDF, again BECAUSE THE TIT-- you get the idea.

Still in the preferences dialog, we'll look for Texlipse > Viewer settings. We'll add a new viewer:


The interesting parts are:
-reuse-instance %fullfile
[ForwardSearch("%fullfile","%texfile",%line, 0,0,1)]
The first one prevents launching a new instance of Sumatra every time you want to view the result. The second one helpfully highlights current line in the previewer.

Now for the final round, configuring Sumatra itself. Run Sumatra with a command line parameter `-inverse-search foo`. This will open up an additional option in Sumatra's preferences dialog:

Sneaky.

You'll want to paste the following line into the dropdown:

javaw -classpath "C:\Program Files\eclipse\plugins\net.sourceforge.texlipse_1.4.1\texlipse.jar" net.sourceforge.texlipse.viewer.util.FileLocationClient -p 55000 -f %f -l %l
It will of course differ depending on your location of Eclipse installation and the version of TeXlipse you are using.

Now we can fire up Eclipse, start a new document and try us some fancy inverse searchin'.



About this entry


0 comments: