Skip to Main Content

LaTeX document preparation system

Inserting Figures

To include images in LaTeX you need to include a new package in the preamble of your document: \usepackage{graphicx}. You will also need to add the path to your figures folder with \graphicspath{ {figures/} }.

  • Create a new folder in your Overleaf document named figures (upper left above main.tex). 
  • Add the image to your document by using the upload button (upper left above your figures folder). 
  • To include a figure we are going to use figure environment
  • To include a figure you just need to add \includegraphics{} argument.

It is useful, though, to include the image in a figure frame by creating a figure environment. In Overleaf, if you create a figure environment, Overleaf automatically creates the following code that centers your image with default caption and label as shown below:

Screenshot for figure environment

The size of the figure can be modified by specifying the width or height of the figure.

\includegraphics[width=150pt]{figures/figure1.jpg}

You can also use \textwidth and \paperwidth to specify relative sizes. Below, I show the screenshot where we can change the width of the image:

\includegraphics[width=0.5\paperwidth]{figures/figure1.jpg}

Screenshot of figure code, changing the width of the paper
 

Inserting Tables

Creating tables in LaTeX is straightforward and offers plenty of customization options.

  • To include a table we are going to use table environment.
  • To include a table you just need to add \begin{tabular} function.
  • To include columns we are going to use ampersand (&) in between each column content
  • We use double backslash \\ to indicate at the end of the row
  • Arguments like \hline adds a vertical line.

To create a simple table, we use the table environment. Below, I present a screenshot of how a table environment is utilized:

screenshot of Overleaf table environment