Skip to Main Content
It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.

LaTeX: Creating a LaTex Document

This topic guide was created to complement the Introduction to LaTeX workshop conducted by the Library and point users to resources and tips related to using LaTeX and Overleaf.

Creating a LaTex Document

  1. Overleaf is a on-line LaTeX editing tool that allows you to create LaTeX documents directly in your web browser. 

  2. Go to www.overleaf.com and register for a free account! 
    1. After you have signed in, go to Projects > New Projects > Example Project
    2. In the  Example Project, you will see a text box where you should enter the name of your new project (second image in this section), now click Create and you will be redirected to the editor where a sample document will open.
                                                            

Overleaf Interface

There are 3 columns

  • File tree
    • All files placed in here can be called in your document. E.g. data files, images, bibliography, etc.
  • Source code
    • Where you’ll do most of your work
    • Content goes here
  • PDF generated
    • When you compile your code, you can immediately see how the PDF will look like

undefined

Making sense of the code

In general, LaTeX documents (.tex file) have 4 distinct parts 

  • Preamble
    • Defines the document type
    • Includes packages 
  • Top Matter
    • \begin{document}
  • Sections
    • i.e. content
  • Bibliography
    • Includes bibliography and \end{document}

undefined

undefined

Packages

Packages are add-on features for LaTeX. Dozens of these are pre-installed with LaTeX and can be used in your documents immediately.

A package is a file or collection of files containing extra LaTeX commands and programming which add new styling features or modify those already existing.

Loads the package into LaTeX: 
\usepackage{ }


Example packages for Maths & equations: 
\usepackage{apacite}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}

Environments

Environments are used to format blocks of text in LaTeX documents.

Simple examples of environments:

\begin{center}
This text will be centred since it is inside a special 
environment. Environments provide a efficient way of modifying 
blocks of text within your document.
\end{center}
\begin{equation} 
x+y=67
\end{equation}