Why you should show Word the sword and try on some LaTeX

Latexian for OS X

Whilst many academics and authors already swear by it, LaTeX is not a tool that has penetrated the realms of the average computer typist. The main reason for this, aside from a lack of awareness and Microsoft’s marketing assault on the world, is probably the initial technical barrier. It’s not pitched as user friendly, because it’s a ‘professional’ tool, and so its ‘selling point’ is normally related to its features. But that doesn’t mean that it is impossibly difficult to use.

Although LaTeX’s main draw tends to be in scientific writing because of its equation-friendliness and bibliography tools, I want to make the case that it’s actually a lot more useful and a lot less frustrating than Word, even for less complex pieces of writing.

What’s LaTeX again?

It’s best to think of LaTeX as a type of programming language. Underlying LaTeX is something called TeX, which is an open-source typesetting engine. What this does is convert some code into a nice, shiny, formatted PDF document. Digital typesetting tools are basically what underlies modern books when they get formatted and published. I always wondered why Word documents always look like, well, Word documents, and why books always have a different flavour to them which is hard to replicate in a standard word processing package. The answer is typesetting.

To get the TeX engine to actually output something, you need some input code to tell it what to do. That’s where LaTeX (and it’s various offshoots) comes in. When you save a LaTeX document, you are basically saving a bunch of code in a text file with the extension ‘.tex’. You can open this up with any text editor (like Notepad, if you were feeling really masochistic), but open a .tex file with a specialist LaTeX editor and you’ll see the text in your document, along with some coloured text. The coloured text indicates the ‘code’ portions of the text that instruct TeX to do something when it outputs the finished document. As an example, here is some LaTeX source code:

Some LaTeX code

And here’s what it looks like after it has been processed and exported:

LaTeX output

You can see where the blue code bits correspond to symbols and formatting in the output text.

That looks scary. Why should I use it?

Although it may look intimidating at first glance to the casual Word user, I hope I can give you some reasons to, at the very least, give LaTeX a go.

1. It’s free

Yes, not the most sophisticated opening argument, but it’s still a pretty strong statement when most people use Word as part of a suite that costs upwards of £100. Plus, it being open and editable, lots of people have produced various add-ons, templates and the like to enhance functionality. Most of these are free too. No brainer that you should at least try, then.

2. What you see is not what you get.

To start off with this seems weird, because unlike Word, you don’t ‘operate’ on the final document. If you want to make a title big and bold, you don’t change its font size and click the bold button, because you can’t. Instead you tell LaTeX you want a title or heading or new section by typing the appropriate code, and it will format the output accordingly.

If you’re an advanced Word user and you set up formatting styles, it works in the same sort of way. But it’s far cleaner and more powerful in LaTeX, because LaTeX is designed with ‘proper’ document structure in mind. It makes all the minutia-type decisions for you based on best practice, so you spend less time worrying about formatting and more on actually writing. Left two spaces in your code between words? LaTeX doesn’t care – it will recognise that and ignore the second one when it compiles the document. No need to worry about tab and indent lengths. You get the idea.

That doesn’t mean it’s not customisable though. At the start of the document, you have a section of code known as the ‘preamble’. There, you can specify any style changes you want that will apply to the entire document. Best of all, if you decide later on that you want to change some style, it’s as easy as typing in a line of code at the beginning of the document. Hindsight formatting in Word can be a real pain in the butt when you start to see formatting glitches, things jumping around on the page and so on.

3. Easy equations

In fairness, this is the main reason why the academic community uses it so much. Just wrap your equations in the appropriate tags, and LaTeX will automatically use its math mode to display any mathematical character or object you wish, and will even put the expression on a new line and number it if you so desire. Equations are why I was drawn to LaTeX in the first place, but after using it more extensively, I’d like to stress that equations are nowhere near the only reason why LaTeX is a superior tool to a word processor.

4. Bibliographies and referencing

This is probably the second main reason academics love LaTeX. It’s obtusely difficult to create automatic bibliography in Word without some external program like EndNote, which is quite expensive. Along with a .tex file, you can create a BibTeX .bib file which contains all your reference data under categories (author, date, title etc.). You also then come up with a reference code, say book1. Then, in your main document, you just need a command like \cite{book1}, and it will insert a correctly formatted reference. If you then have a bibliography at the end of your document, the full reference will automatically be added to it.

It maybe sounds a bit complicated to have to create your own .bib file from scratch. But, as with most things LaTeX, there are programs that do this automatically for you. In fact, if you search for books and articles on Google Scholar, there is a ‘cite in BibTeX’ command which allows you to quickly import the reference into whatever software you are using.

LaTeX is also pretty powerful when it comes to cross-referencing things within the document. Because every document has a very set implicit structure, it is very easy to create labels for tables, figures, equations, you name it, and then refer to them later in the document. Once you’ve done that, you can also get LaTeX to create an index of tables and figures, or put them in the table of contents, all automatically and all without fuss.

5. Templates

Although you can get these for Word too, you can find loads of nice free templates for document creation in LaTeX. Word templates tend to be much more geared around glossy brochure-like documents, whereas you can easily find a template to turn your LaTeX document into a fully fledged book, for example. The other nice thing about templates is that you can see the code that is used to generate the output. This makes them a very good learning tool, since you can then figure out how to incorporate certain elements for yourself in future documents. This level of transparency is generally missing in word processors (usually by design) unless you delve much deeper.

Any drawbacks?

I would argue that you can throw Word in the bin. LaTeX does have disadvantages, but none of those are really solved by Word. LaTeX is a document processor, largely for creating nice written documents. It’s not really designed for fancy graphics, like a brochure for example. For those situations, you actually do want a ‘what you see is what you get’ program. If you were creating something that involved though, I’d argue you’d be much better off using a desktop publisher like QuarkXPress, or at the very least, PowerPoint. Whilst it does make it relatively easy to input graphical elements, Word becomes a dog if you push it too far.

Aside from the graphics, sometimes you might want to create a quick note or something, where the time taken to set up a LaTeX document is probably equivalent to the time it takes you to type what you want. In that case, I’d also argue you shouldn’t use Word. You can do just as well with a simple editor that saves a .txt file or .rtf file. Windows has Word Pad, OS X has Text Editor and there are plenty of other free tools in this area you can download with extra features should you require. The advantage of this is that .txt files are much ‘lighter’ in terms of file size and complexity so there is less chance of anything going wrong. It’s also faster to open and edit them. Finally, and quite importantly, anyone with a computer can open them – you don’t have to worry about them having Word or an equivalent program that can handle .doc or .docx.

The only other ‘drawback’, which is not one really, is the initial learning curve associated with LaTeX. This isn’t really a disadvantage so much as a dislike by people to break old habits. It’s actually not as difficult as it looks, and most LaTeX editors will give you a lot of assistance with the code. A quick internet search usually also has the answer to any specific problem you might face in setting up your document, though I agree it may take a little bit of a time investment to get comfortable with the environment. It can take a little while before you get used to typing in an ‘editor’ and seeing the output separately.

How do I get started?

Firstly, you need to download a TeX distribution. If you’re on Mac, this will be MacTeX, otherwise you probably want TeX Live. These are fairly chunky in size – probably over 1 GB – so set aside some time for the download.

The TeX distribution is mainly the typesetting engine that is used to output documents and generate output from code. It’s the language or environment, if you will. To actually make a .tex document, you will want to use a LaTeX editor. The best free ones are TeX Maker and TeX Shop, and sometimes they are actually bundled with the distribution you download. There are also some cool paid editors (still a fraction of the price of MS Office), of which my favourite is Latexian for Mac. This allows you to preview the output next to the source code, and the output PDF is updated live so you can see exactly what the changes in code are doing to your final document in real time (as a side note, this is something that really needs to be adopted as a feature in all editors).

Latexian for OS X
Latexian for OS X. The source code is on the left and output is updated live on the right.

Most editors will have code suggestions that allow you to insert snippets of code, and highlight various bits of it in different colours so you can see what is going on in your document more clearly. They may also have document templates that fill in the essential bits of code in the preamble so that you can get started quickly. If not, the internet has a wealth of information on how to create LaTeX documents.

Some people like using LyX, which is a sort of hybrid of Word and LaTeX. Essentially, it is a processor like Word, not a text editor like Notepad. But it uses LaTeX in the background. The advantage of LyX is that it has a nice GUI for you to just be able to click on buttons to insert equations and other elements with relative ease, without knowing or editing any code directly.

However, personally, I think there is scope then to fall into the same types of formatting traps and difficulties as you would with Word (albeit not nearly as bad). It also means that when you want to add something which LyX doesn’t have built in, you’ll probably find it difficult to learn coding when you haven’t seen the source before. Good LaTeX editors give you help with the code but you still work on it directly, so it’s the best of both worlds. Plus you can see the output and source code side-by-side with many editors. I find LyX’s interface both sluggish and ugly.

Finally, LyX saves files in its own format. This is a pain because you need to have LyX installed to edit them, and if the file gets corrupted, as with a Word document, it’s very difficult to resolve the problem. Working on a .tex file directly is much more robust because it is just plain text and so you can open it with any text editor at any time from any computer.

Finally, you may want a reference management system that automates the BibTeX process if you’re creating an academic document or book. MacTeX comes with the excellent BibDesk, but there are equivalents for all platforms.

This is just a taster of the good things LaTeX has to offer. You could write a book on the subject, and indeed, there are many (written in LaTeX, no doubt!). I hope this gives you enough fodder for you to have a play around with it.

Leave a comment

Time limit is exhausted. Please reload CAPTCHA.