About Me

My photo
Delhi, NewDelhi, India
I am currently pursuing my Ph.D from IIT Delhi. I started blogging so that people don't face much of a hassle in finding solutions to problems that I've already faced and sorted out. Problems could be either hardware or software. Of late, it's becoming a hobby, especially after I received an e-mail from an anonymous reader from Germany who found one of my blog entries very useful.

Friday, January 22, 2010

Import tables from excel to latex

Since this is my first post, I would like to write something that I have been obsessed with for the past few months........LATEX (yes, you read it right). Ever since my supervisor asked me to write a technical paper to be submitted to a journal in Latex, I've been intrigued with what Latex can do.

I got hold of some excellent guides to start off with, and since Latex is open source, there is abundant material available on the internet. After typesetting the initial part of my document, I had to add results that I obtained after simulation. All my results were in tables (numerical values), stored in an excel sheet. I found it really painful to enter the contents of the table one by one, separated by ampersands (&). I did this exercise for small tables, but how was I going to do this for a table of size 30x5 ?

I googled "Excel to Latex" and came across this very useful macro that provided me the code to paste in the latex editor, the contents of the table. All I had to do was install the macro and run it, after highlighting the table that I wanted to export.

I told my supervisor about my latest discovery and he was surprised to know about the availability of this useful tool. He confessed to me that as a student he used to enter the values manually.

Since I use Latex on UBUNTU (my favourite distro), I used the macro calc2latex. I've tried the excel2latex macro as well on office2003 and it worked satisfactorily. One of my colleagues had office2007 installed on his laptop and the macro gave some weird error. So, make sure you run office2003 for the macro to work.

The macro and the installation instructions are given here (linux) and here (windows).

Be on the lookout for such interesting experiences of my experiments with latex and of course ubuntu, and MAC OS X because I have a second generation MACBOOK (triple booting with MAC OS X (leopard), Ubuntu 8.04 LTS and WIN XP).

This will not only help me archive my work, but will also be useful to many others.

See you'll soon.

No comments:

Post a Comment