Getting started with LaTeX
My postgraduate programme expects me to write a series of essays and reports. Although I got good results with MS Word for my bachelor thesis, it took a solid amount of fiddling and tweaking until the result looked right. The WYSIWYG editor of word just never gives me a feeling of being fully in control about my document.
I therefore decided to try out LaTeX, which is known to be popular for all kinds of academic writing.
This purpose of this post is to document my experiments and findings with LaTeX. I am using Windows 7, so the installation procedure and tools are probably exclusive to Windows systems. If you are on Linux or OSX you probably know what you are doing, anyways.
What you need
- some distribution of LaTex, I use proTeXt because it has everything you need nicely packaged
Setup
After running the proTeXt .exe, go to the folder that you installed it to. Inside you’ll find an “Install” folder with a PDF that should match your language. This interactive PDF is the installation procedure, so skip through it to install at least MiKTeX (the base system) and TeXnicCenter (the editor). The MiKTeX install can take pretty long, but make sure to finish the install before doing anything else.
Running TeXnicCenter
With MiKTeX and TeXnicCenter installed, the base setup is already complete. Start up TeXnicCenter (and admire the icon overload). Start out by creating a project (File > New project). I’m using the Basic English Report as template, with BibTeX and MakeIndex enabled. BibTeX is a literature management system, MakeIndex allows you to easily create indices.
After entering a project name and hitting OK, the editor window will contain the pre-made template. Before you do anything else, have a look at the document in its current state. In the first icon row, you’ll find the buttons for “Build current file” (hotkey Ctrl+F7) and “View output” (hotkey F5).
Hit the Build button and look at the log output below the edit window. It usually takes multiple runs to properly write a file, so try building again if you are getting errors or warnings. After that, View Output and have a look at the file in your standard PDF reader. Looks pretty good for straight out of the box, doesn’t it?
Back to the editor. The given template is a bit bloated in size, but it contains many commented options to configure the look of your document. Before diving into the template itself, this is the minimal skeleton of a LaTeX input file:
This is most basic structure of a LaTeX input file. You always start with a document class that defines the basic layout. In this example we chose an A4 paper format with 12pt font size in a report template. There are loads of options that are documented elsewhere. The area between \documentclass and \begin{document} is called preamble. The preamble is where all (or most) configuration settings are placed. The actual content of your document is placed between \begin{document} and \end{document}. Lines that start with a % are comments and will not be displayed in the final document. After understanding the basic structure of a LaTeX input file you should look at the template you created earlier and see what settings it contains. Most of them are well-documented with comments. These are some that I use for my writing:
References
To make use of references via BiBTeX, you need to add the following two commands not in the preamble, but right before \end{document}:
The first line defines the style of your references, the second line points to the filename of your .bib file. There isn’t one yet, so you should add a literature.bib file to your project folder. You can edit your .bib file with any text editor. Entries for books or other sources inside the .bib file should look like this:
Again, there are many options here, book is just an example. In this case, goossens93 is the short reference title that you can choose yourself. In the LaTeX input file, you can then refer to the title:
I used citep, which is the parenthesised reference: (Goossens et al., 1993). There is a tutorial that coveres referencing in more detail.
This entry was posted on Tuesday, October 6th, 2009 at 15:35 and is filed under How to, tools. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
3 Responses to “Getting started with LaTeX”
Leave a Reply

milan
6 October 2009 at 17:47 #SPLENDID report.
Nicely done my man, pretty impressive considering you went trough this only today.
Nice attitude that I’d like to see spreading some more; eventually this could lead to grumpy-me changing my mind about the usefulness and nutritive value of that thing called blogosphere.
My current (and yes, I admit slightly outdated) stance towards it is still indifferent and best described by the one of sid in that uf.org comic back from june 2004 http://ars.userfriendly.org/cartoons/?id=20040612
Time moves fast and old grumpy men usually don’t want to change. I believed the entire blogging thing to be no more that a cold that will eventually go away, a cheesy hype at most. Turns out there might actually be something to it since I am now reconsidering my stance. Not sure if I want my own log tho, I’m still a bit scared of the concept and hanging out in usenet and irc feels more like DTRT.
as usual, just my 2 cents,
– milan
milan
6 October 2009 at 16:55 #Oh, btw, I'd be grateful if you removed that divulging entry on pastie.org back from the dota openVPN tryout days, if possible. Call me paranoid but im simply not fond of this kind of information about my system freely accessible as first hit on google.
thanks
edelbert g.
7 October 2009 at 00:55 #thanks for the quick roundup of ready made latex commands.
always wanted to dive into t3h knowledge and this makes it even easier.
in reference to the above post: get a grip !?!