Enjoyify your LaTeX workflow: Kile, Xe(La)TeX and SyncTeX.

Obviously, writing a thesis an’ all, these days I’m pretty interested in ways to make my working environment as pleasant and smooth as possible. I do, after all, spend a lot of time in it.

Recently, I’ve spent quite some time searching for the right LaTeX-editor, and I must confess to be quite picky. None of them are all that I want, but a few almost are. My wish list includes: Xe(La)TeX support, code folding, clever and/or configurable keyboard shortcuts for compiling and viewing, auto completion, integration with the Gnome desktop, a simpl(ifiabl)e interface and a few more things.

To cut a long story – and possibly a later blogpost – short; after having sacrificed the Gnome integration, I think I’ve finally settled on using Kile on my laptop running Ubuntu 10.04. Kile was already a very attractive candidate despite it’s heavy KDE library dependencies, with its combination of customizable interface and keyboard shortcuts, XeLaTeX support, code folding, auto completion, lots of help functions and wizards. But what finally made it for me was to learn that Kile, with an extra ionstall of Okular and the right options set, also supports backwards navigation (that is, from PDF to .tex source file) with the SyncTeX library. Maybe you need to try it before yu realize just how convenient that is. Here’s how it works.

Open the Kile configuration window, navigate to Tools -> Build in the left hand menu, choose XeLaTeX in the middle column, and make sure the options are set as on this screenshot:

Kile configuration: XeLaTeX

Kile configuration: XeLaTeX

Second, select the “QuickBuild” tool. As configuration, choose “XeLaTeX + Preview (Okuar)” rather than Preview (Embedded) as I have chosen. Make sure the configuration looks as in this screen shot (You are of course free to add extra runs of XeLaTeX, BibTeX etc.):

Kile configuration: QuickBuild

Kile configuration: QuickBuild.

Now the QuickBuild command builds the synchronization info and embeds it in the PDF that is sent to the PDF viewer. This could in theory be done by any LaTeX client with configurable build commands – or, or course, from the command line. But on Linux only Okular supports SyncTeX.

To enable this, open the Okular preferences and change the default editor from Kate to Kile as shown below:

Okular configuration

Okular configuration.

This should be it! Now you can run QuickBuild from the Kile toolbar or by hitting Alt+1, and Okular will pop up with a document:

SyncTex in action

SyncTex in action.

Now if you find a spelling error or similar, Shift+ Left Click on that sentence, and voilá!, you are taken to the appropriate line in your .tex source to correct the error or write down that little spiffy witticism while it’s still hot.

Posted in Computers, LaTeX, Physics, Science | Leave a comment

Sound woes: Skype on Linux

I love Linux. But sometimes, just sometimes, it makes me so very annoyed.

I got a laptop a few months ago, which is running Ubuntu 10.04, and is very pretty and a lot faster than Windows 7 on the same machine. Just recently, I installed Skype on it (I don’t use Skype that often). I installed it to find that the sound input does not work. I heard the mic through the speakers, no problem there. But no response at all to the test call.

After a bit of Googling, I found this solution. It was painfully simple.

The story is, the Gnome-based Linux systems like Ubuntu have quite recently switched to a new audio handling system, PulseAudio, instead of the old one, Advanced Linux Sound Architecture. That is all fine. The trouble is, they are relying so much on everything just working perfectly and nicely auto detecting everything that they didn’t bother to include the manual volume control in the software package!

I installed it – the package is called pavucontrol. I opened it, and voilá: it showed that the input chanel was automatically muted – with no way (other than command-line) to unmute it in the default system.


I got my mic working. Just had to tell Skype not to auto-adjust it, but that hardly ever works anyway, so I always do that. But seriously. This is one of these little “paper cuts” that hinder broad adoption of an otherwise in most ways superior system.

Posted in Computers | Leave a comment


Okay, I have been sorta inactive blogging lately. Like, for a long time. Long story.

Anyway, I’m now through 5 out of 12 months writing my Master thesis. Quite early on in the process, I decided to abandon IDL (which seems to more or less be the standard for data reduction at the astronomical department of the Niels Bohr Institute) in favor of NumPy/SciPy and numerous other Python-based tools. It was, of course, with some trembling of the hand, since there isn’t any Python expertise around to help me out if anything went wrong. Knowing that I could always revert to IDL if there was stuff I couldn’t figure out on my own in the strange but fascinating new lands of Python was some consolation, but it still seemed a bit spooky.

Turns out, I needed not fear. I have hardly looked back once.

There might not be any Python expertise around physically, but it turns out the SciPy and NumPy community is both large, competent and very helpful. Besides, Python seems to have a wider application range than IDL, meaning developers from more different fields working on improving the software.  This in turn means a broader range of functionality. Especially, the data visualization capabilities of matplotlib have astonished me – the beauty and ease of use of gnuplot, the extensibility, power and programming language integration of IDL plotting (including a very versatile \TeX handling facility providing beautiful text rendering in figures).

Interactive plotting in matplotlib

Interactive plotting in matplotlib

Sure, there has been a learning curve. NumPy and SciPy are – although very stable and powerful – still in active development, meaning that especially the documentation is still sort of messy, it is vast and often confusing and changing between versions. This has changed a lot for the better in just a few months, though, and they are maturing very fast.

Also the (optional) object-oriented programming style of Python was a bit confusing to a half-studied code kludger like me, and a number of failed attempts to wrestle it and understand it has been the price of learning.

The result is still clear, though, and was at a very early stage. After a couple of weeks, I was able to do all the array handling in NumPy that I was in IDL, and after ~2-3 months, my data reduction and visualisation skills in the Python-based tools were fully up to speed with the skills it took me years to aquire in IDL, and in some areas already far ahead, doing things that I had given up figuring out in IDL.

And I must admit, I have fallen somewhat in love with Python. Dynamical typing and whitespace seems a bit confusing to begin with, but already at a very early stage the benefits are clear: it forces you to write structured, tidy and good-looking code, otherwise it won’t work!

NumPy code in Gedit

NumPy code in Gedit

The common Python base makes it easy to import the modules you need and leave out the rest, keeping your programs lean and slim and incredibly flexible.

In the time to come, I’ll probably post some neat little tips and tricks for scientific (especially astronomical) Python based tools. It is partly as a sort of log book for myself, partly in the hope that it will be of help to others.

Posted in Astronomy & Space, Computers, matplotlib, NumPy, Physics, Python, Science, SciPy | Leave a comment

Letter from a former Skateboard Punk Rocker

Recently, triggered by the verdict in the Oakland Shooting case, I remembered the old song “Graffiti Limbo” by Michelle Shocked, which suddenly, after so many years, seemed all too relevant and fresh and necessary.

Seeing no other way to share it with my friends, I made a video of it which I uploaded on YouTube. Not completely surprising, but still somewhat disappointing, after 2-3 days I received the following YouTube message:

Graffiti Limbo
Please remove the unauthorized upload of Graffiti Limbo. It is copyright controlled material and the unauthorized upload is an infringment. Thank you for your prompt cooperation. The message of the song is timely and relevant, we agree. Please visit the artist’s website, where the song is available, as well as iTunes, Amazon, etc.

Thank you

Campfire Girl Publishing

Since I don’t wanna dance with the big guys, even when they disguise themselves as You And Me, of course I removed the video, and replied with the following message:

Re: Graffiti Limbo

I know the material is copyrighted, and that I am therefore finding myself forced to remove same video. I shall do so without further ado, but find myself urged to state the following:

My action of removing it would only have been cooperation had I had a choice. We all know that I don’t and am effectively doing so at gunpoint. I must therefore consider the line “Thank you for your prompt cooperation” to be an empty gesture and an ill-disguised threat while the chance to willfully and voluntarily cooperate still remains to be left me.

You tell me to please refer to Michelle Shocked’s site or music sales services like iTunes to purchase the song. This is tell-tale of a total failure to understand my motivation to post the song. As you wrote, the message is timely and relevant. This is really the song’s strongsuit; hardly anyone will disagree to say that the composition is somewhat generic.
Now, my motivation to put up the song was to communicate this message to a number of people, of whom most have never even heard of the artist Michelle Shocked. These people were unlikely to start buying the songs just to hear the message I wanted to communicate to them, and unlikely to feel the strength of it by being referred to a written version of the lyrics. I have looked around and not seen any possible way to present this song to a new audience short of inviting them to my house and play the CD. Since my friends are scattered across continents, this was not really an option. I would love to follow any properly given methods to present this song to my friends, were any available. But this is not the case.

Michelle Shocked and Campfire Girl Publishing should, in my opinion, see this kind of fan communication not as an infringement but a way of alternative marketing: I am, by posting this video, presenting this song to an audience of which the majority have never heard of Michelle before. At the same time, by placing this in a relevant political and historical context, I provide a sense of relevancy to my target group that no marketing campaign could provide. At the same time, being published as a YouTube video, the song is highly unlikely to become an illegit part of anyone’s music collection. A publishing of the song in this manner is, as far as I can see, a pure win-win situation for both artist and fans, established as well as new and potential.

I will also take this moment to remind you that copyright doesn’t necessarily imply zealously guarding the use and sharing of the song. Lots of artists have shown the way forward in communicating their music while keeping full copyright control, and for an example of the ultimately creative and progressive use of copyright, I will refer the General Public License authored by the Free Software Foundation.
In my opinion, setting up artificial barriers for fans to aquire what is technically extremely easy to aquire without losses to anyone is both a dead end and an unnecessary harrassment of the audience that was supposed to be the friends, not the enemies of the artist.
The only real loser in a scenario of more liberal sharing policy is the middle man; the major labels. They repeatedly – and falsely – claim that one illegit sharing equals one lost sale. This is of course bogus; the most likely outcome of me not sharing this song is a lot of people who will both before and after be completely and totally oblivious to its existence.

By zealously hoarding fictitious sales rates rather than taking a pragmatic stance on it – which, in this case, would in all likelihood be an increase in potential sales by an increase in potential fan base – Michelle Shocked and Campfire Girl Publishing is running the errand of major labels, harming the interests of both artist, fans and a general high level of cultural education and awareness.

Last, I shall state that I have no personal gains from posting this video, other than communicating what I found a strong and relevant message that only someone suffering from severe delusions of grandeur would believe the same people would otherwise have rushed to iTunes or Amazon to buy, just so they could hear it on my recommendation. I am disappointed, though, sadly, not surprised, by the reaction from an artist and publisher of whom I had much higher thoughts.

Posted in Culture, Music, Politics | Leave a comment

Gappy Together

In smug contendedness that our Commie-Yankee family reunificated alliance has contributed to pissing off our national chauvinistic politicians; Fuck You Skaarup Productions in collaboration with Nuh Nuh-Nuh-Nuh Nuh! Promotion proudly present: Gappy Together!

Posted in Uncategorized | Leave a comment

More fabulous software


Originally uploaded by Lusepuster

I just rediscovered the fabulous free software package Celestia. I am going to use it in the physics classes that I am teaching – the danish equivalent of junior year of high school, more or less. I just can’t express the awesomeness in words, so here’s some Celestia-generated photo goodness. Aaawwwwww……

Posted in Uncategorized | Leave a comment

Posts imported

I imported some anglophone  posts from my other blog. that’s why some posts suddenly appear before the first one.

Posted in Uncategorized | Leave a comment