Monday 11 January 2010

Aquiring a rubber fetish

No, I haven't been getting kinky (well no more than normal) but I have been getting into LaTeX which as you may or may not know, is a bunch of software and a mark-up language for typesetting documents, particularly maths ones.

I've been sort of dimly aware of it for years but a few weeks ago me and everyone else in the East of England region doing MST221 this year were invited on a day-long "Intro to LaTeX" session in Cambridge given by one of the OU math team.

Well I had a rummage in the documentation online and it all looked quite interesting and actually not that horrendous to use. I'd done all of MU120 using Word 2007 which has a half-way decent equation and math editor nowadays (certainly way better than earlier Word versions) but I must admit after the first TMA for MST121 the amount and complexity of equations and formulae became a real chore to word process so I went back to the mk-1 pencil and paper method; far from ideal as (a) my handwriting is crap and (b) I get writers cramp really quickly and had to stop to stomp up and down and curse after every page.

I've also been around the block when it comes to word processors, the first "real" word processor I used - although you would be hard-pushed to call it that nowadays - was Wordstar running on a 286 in DOS so dicking around with formatting codes was not new, and having paid my dues in days gone by as a developer hacking together old-school ASP pages I was no stranger to markup and the whole concept of "What You See Is What You Mean" (rather than "Get") was familiar.

However I was surprised by just how powerful LaTeX is and what lovely results it produces and how quickly you can get it to do nice stuff.

Over the years I've kind of fallen out of love with the whole Linux/Open Source ideal - I am pretty sure it's because of my job as I am under lots of pressure just to get the code working and onto the trader's desktops so I really want to shove a couple of DVDs into the PC, install the development environment and off I go. I just don't have the time to fanny around with hand crafting config files, rummaging in HKEY_LOCAL_TOUCH_THIS_AND_YOUR_PC_WILL_NEVER_WORK_AGAIN and all the usual fluff that goes with open source. So with that said at first LaTeX was pressing all my "oh dear" buttons.

Need to install more than one program to get it working - CHECK
Various bits of code scattered all over the web - CHECK
1419 obscure tiny files, one of which allows me to typeset Ancient Nabbatean - CHECK
Irritating cliquey in-joke in that you need to write the name of the PrOgrAm in a miXeD CaSe and then it's not even pronounced "latex" but "lay-tec" - CHECK
Cutesy animal mascot for the application...

- CHECK

Not looking promising so far and indeed although I got up and running pretty quickly with an .iso distro off the net (for a given value of "running") there was a lot of fiddling around to do to get it working right until I realised that it hadn't actually installed everything I needed to make things work right so I needed to fiddle with the innards of a package manager (eventually giving up and saying "Yes, you win, install every sodding package including the ones that let me typeset Elder Futhark Runes, Astrological Birth Charts and even bloody Hieroglyphs")

So - not exactly software I would expect your average Joe to be able to install but then that's the point I guess, this stuff was written by geeks for geeks so your average geek (like me) with a bit of perseverance and consultations with Professor Google can get it working.

And when it is working... blimey it's powerful. The syntax is not too tricky but there's a lot of it and all those little files just extend the basic facilities by orders of magnitude and wow does it produce good looking, very readable output. Here's an example...



and you produce that using this markup:


\section*{Question 2}
\subsection*{(a)(i)}
The sum of the first $n$ integers is given by
\[\sum_{i=1}^n = \frac{1}{2}n(n+1)
\]
So the sum of the first 28 integers is $\frac{1}{2}28(29) = 378$
and the sum of the first 107 integers is $\frac{1}{2}107(108)=5778$
so the sum of the integers from 29 to 107 is $5778-378=5400$
\subsection*{(a)(ii)}
The sum $\displaystyle\sum_{i=29}^{107}(4+3_i)$ can be rearranged as
\begin{equation}
4(107-29+1)+3\sum_{i=29}^{107}i
\end{equation}
and from the answer obtained in \textbf{(a)(1)} above we can write (1) as
\begin{equation*}
4(107-29+1)+3(5400)=16516
\end{equation*}


I was hooked within minutes - one of those 3am "are you coming to bed yet love" times (sorry Mrs Dracunculus if you're reading this). Within a couple of days I'd already started work on a template for submitting TMAs just so I could learn how "fancyhdr" worked and that was before the class last saturday.

The day didn't start well with me totally failing to get into the building and walking round twice before finding the goods bay and a doorbell. Once inside I spotted the tutor giving the day school - wayward hair, yellow sleeveless jumper, blue bow tie, brogues... yep, you're committing every style crime in the book so you must be a maths professor and indeed he was. His enthusiasm for the subject was plain to see and quite infectious and like everyone on the OU tutoring staff he really knew his stuff. I was pleased I'd already had a play around with the software before the day but I got a whole load out of the day, fixed my install on the lappy to something better and came away with a different template for TMAs which I didn't like a lot of so I stole some of the ideas out of it and added them to mine.

So I'm a happy LaTeX convert... expect more witterings on the subject as MST221 progresses. Now where did I put my gimp suit.

No comments:

Post a Comment