Skip to content

The Beginner’s Guide to LaTeX

Posted in: Software and Online Tools
The Beginner's Guide to LaTeX

For those of you who read the previous post about LaTeX and are interested in giving it a go, but just don’t know where to start, this article should get you on your feet. I used LaTeX to write my thesis and was (mostly) self taught, so I know how scary it is to begin with. There are many different ways to use LaTeX, but I’ll show you the way that I did it.

Getting Started

To begin using LaTeX, you are going to need to install a few things on your computer (don’t worry, it’s all online and all free). Firstly you need download and install LaTeX. There are several different versions: I used a version known as MiKTeX. In addition to this, you will need an editor – the software that you will actually use to create your document. I used several different editors, although my favourite one is TeXmaker. Once you have these two things downloaded and installed, you are ready to go.

What is all this gibberish?

LaTeX is not like Microscoft Word. You don’t see the finished document as you go along: instead, you give commands explaining the layout of the document. The first part of your file is called the preamble, and this is where you determine what sort of document you are creating. There are many different types of documents you can choose from, including article, book, letter and report, to name a few. Each of these will come with their own particular settings, but all of these can be altered to suit your needs as you get more confident.

To say which document we want, we use the command \documentclass{report} (for a report). You can also alter thing like font size and style, page margins and pretty much anything you can think of in the preamble, but to start with all you need is the document class.

The document itself

Next you need to say you are ending the preamble and beginning the main part of the document. This is achieved with the command \begin{document}. Now you can get on with writing your document. To start a new chapter, you use the command \chapter{} with the title of the chapter within the brackets. Don’t worry about stating adding the word “chapter” to the title or the chapter number, LaTeX will do all that for you. To break your chapters up into smaller sections, you use the commands \section{}, \subsection{}, and \subsubsection{}, putting any titles within the brackets. Then you just need to write.

Ending the document

Once you are finished writing, you need to state that this is the end of your document, with the command \end{document}.

Creating the PDF

Once you have finished, you want to be able to create your final document. Make sure you save your file before continuing. To create a PDF of your document, you just need to select PDFLaTeX from the run menu and click run (the arrow).

The Beginner's Guide to LaTeX

Your PDF document will then be generated and will be found in the same folder as your saved LaTeX document.

Here is an example of a LaTeX document in TeXmaker:

The Beginner's Guide to LaTeX

And this is what the PDF document looks like.

The Beginner's Guide to LaTeX

One more important point. The nature of working in LaTeX means that there are going to be errors (mostly because you did something wrong – I spent the first six months of LaTeX use convinced it was riddled with bugs, until I finally realised that it was simply that I made a lot of errors). LaTeX will help you to figure out any errors in the document by informing you of them, telling you where in the document they are and what kind of error it is. For many errors, the error message is simple to understand and therefore easy to fix. For more ambiguous errors, a simple Google search will often shed light on the problem and how to correct it. In TeXmaker, errors are displayed below the document.

The Beginner's Guide to LaTeX

Here I have an error as I missed out a } after \subsection{This is the first subsection}, making LaTeX think that the title of the subsection never ended. The error message is very clear in this instance, as LaTeX states that it suspects I have forgotten a }, making it very easy to find and fix.

Those are the basics of LaTeX (simpler than you thought?).

Doing more complicated things (such as inserting figures, creating tables and adding references) is just a matter of finding the right commands. There are a ton of great websites explaining how to do pretty much anything in LaTeX, and I’ve included some of my favourites below. I found that one of the best ways to find out how to do something was to simply Google it!

 

Useful websites for LaTeX:

https://en.wikibooks.org/wiki/LaTeX/Basics ( a great guide to some of the basics of LaTeX).

https://www.latex-project.org/guides/ (a good link to a variety of guides).

https://www.bibtex.org/ (information about BibTeX – referencing software for LaTeX).

https://jabref.sourceforge.net/ (software to manage your BibTex references).

Share this to your network:

4 Comments

  1. Laure on December 6, 2012 at 5:24 pm

    Hey Laura,
    Thanks for posting about LaTeX! It made me eager to give it a try and quit WYSIWYG text programs.

    One question: is there a way to save the document in a text format that can be viewed and modified by other people (who would not be LaTeX users)? I.e, if someone writes an article or a thesis with LaTeX, how can other people bring modifications?

    • micronaut on December 6, 2012 at 8:05 pm

      This was a problem I had getting corrections. You can either provide pdf, which people can add comments to in adobe reader, but for document collaboration it’s hard if not everybody is using it. the latex files themselves are flat text files so easy to share, but they contain all the latex coding.

      LaTeX code is still quite human readable, and people can drop in plain text which would just need the formatting codes dropping in for references, bold, italics etc.

      not ideal though if everybody else is using Word.

  2. micronaut on December 5, 2012 at 9:58 am

    LaTeX was one of the most useful skills I picked up during my PhD. The learning curve is more of a vertical wall, but once crossed it’s so much quicker, and more reliable than using Office it’s not quantifiable. I would go as far as to say you cannot write a thesis in MS Word. It’s too big and complex.

    During my PhD I was working in the lab up until the last 6 weeks of the program, at which point I was throwing data into chapters as it was coming off the machines. I didn’t have to worry about dropping an image in, renaming all the figure numbers, re-formatting, paragraphs jumping around the pages, etc. Also, my colleagues spent the last month sorting out references. As I read articles over the years I dropped them into Mendeley, then referenced them in the text while writing. I never once considered formatting the index, references, lists of tables etc. I never wrote them.

    I literally wrote the last words 24 hours before submission in the lab, hit compile, and emailed the pdf to the printers for collection in the morning (I wouldn’t recommend this of course!).

    LaTeX makes writing about writing, and not about formatting and dragging things around a GUI that hates you. You just type, and type and type.

    I found the template over at Sunil’s Garden really useful to jump start into aLaTeX thesis: https://www.sunilpatel.co.uk/thesis-template/

    • LeBiochimiste on December 7, 2012 at 11:48 pm

      I used that template too for my PhD thesis. Very well done.

      Steep, but short learning curve to get started. Then everything went much simpler than for my colleagues who struggled constantly with the formatting in your regular word processor.

      Like mentioned below, document collaboration becomes more difficult if your PI only uses your regular word processor. Then take the challenge of convincing him to make the switch too!

Leave a Comment

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll To Top