Fitting the battle of life

LaTeX hints

Posted in ubuntu by jerichokb on January 23rd, 2008

If you’ve read one of my previous posts, you’ll know I’m using the LaTeX typesetting programme to produce a document at the moment, which consists of writing the content in plain text format with some additional instructions (such as writing “\emph{like this}” to get writing like this), and then passing it through LaTeX to produce the final document. I can write all the chapters in separate files, and the programme will pull them all together under my instructions and paginate, add page numbers and a table of contents page automatically. I find it’s far more powerful than word processing as it does half the work for you.

Anyway, LaTeX isn’t perfect. If I add a whole new section and lengthened others, some of the page numbers in the table of contents will often go a bit odd when I first run it through. So, I usually run it a couple of times before checking the output, to make sure all the numbering’s right. Now, I’m a bit lazy, and don’t want to have to spend longer than I have to at the command line typing “pdflatex filename” twice (I know, I could use the up arrow to get the last-used command, but as I said, I’m too lazy even for that!) and then “evince filename.pdf” to open the document. So, I wrote myself a little script.

It’s in bash, of course, and goes something like this:

#!/bin/bash

cd ~/Debating/guide;
pdflatex guide;
pdflatex guide;
notify-send "Document created" "Now opening preview"
evince guide.pdf;

What this does, when run with “sh guide.sh”, is to navigate to the right directory, run pdflatex twice (to produce a pdf instead of dvi file), and then send a pop-up to the desktop telling me all has been successful, before opening the file itself. A bit overkill, perhaps, but it tends to save me a little time. Using xpdf instead of evince would probably shave a second or two off the process as well, as I’ve found it to be lighter.

Ah, the joys of being a lazy student!

Tagged with: , , , ,

Choosing LaTeX

Posted in ubuntu by jerichokb on January 20th, 2008

I’m currently involved in (i.e. pretty much doing it myself at this stage, though I will bring in others once the groundwork is done) writing a guide to competitive debating for my debating society. We send out teams to various inter-varsity competitions most weekends, and while we had three semi-final reaching teams last term, that’s not good enough, so we’re getting a guide together to try and boost everyone’s skill level. It’s all in the knowledge-sharing vein, which is good. Anyway, I usually use OpenOffice.org for my word-processing jobs, but for this I thought it might be fun to try something new - \LaTeX.

I can’t remember exactly why I wanted to try it, but it had come to my attention during the summer and I figured it sounded pretty neat, and this was the perfect opportunity to try something. If all else failed, my document(s) would be in plain-text format so I could easily import them in OO.o and finish the job there. Turns out I’m pretty enamoured by \LaTeX. It’s incredibly simple to use once you’ve set up the document, and even that’s pretty easy if you follow templates. Making a .dvi of your document is quick and easy so you can see how any formatting changes look before the (tbh, only slightly) longer .pdf process, and that’s how I preview my document.

The thing I love is, it’s a lot easier to separate out all the chapters/sections of the guide from each other so I can concentrate on one bit at a time, and not worry about manually inserting page breaks between each one, and ensuring I’ve followed the same formatting throughout however many pages - \LaTeX takes care of all that for me, pulling all the separate files together when I run it on the main document.

I can easily add notes to myself about what to include that don’t get included in the final file simply by using comments, which in gedit are automatically highlighted blue, to differentiate them. (To write a comment in \LaTeX, just use the percentage symbol, %, at the start of the comment. The rest of the line will be commented.) This is a lot easier than using lots of bits of paper around my desk, and far quicker than any corresponding feature in a word-processor.

It’s not for everyone, this way of working on documents. One friend had a massive go at me - and I mean massive - for using a non-standard, geeky, out-dated bit of kit when she could do better on MS Word. But, I don’t really care. It helps me work on it, and it’s a choice I have - to use whatever software I wish. It’s not as if no one can open the resulting .pdf file, is it now?

Useful site: http://en.wikibooks.org/wiki/LaTeX/

Tagged with: , , ,