Arindam Basu
Notebook and Pencil
4 min readJul 24, 2016

--

How to use Overleaf to Write your papers: Part II: Tables, Figures, Bibliography

You can easily create tables and insert figures like this in an Overleaf document (screenshot of a draft paper)

Part I of this series
Part III of this series

In the first article of this series, I started with a basic Overleaf document. In this series, my intention is to show you that you can write in Overleaf with some very basic knowledge or practically knowing nothing about LaTeX and essentially using a wysiwyg interface. If you followed part I, I showed that you can use the rich text editor of Overleaf to pretty much get started and get your work done. There I barely wrote about three parts that distinguish a scholarly document (tables, figures, and references).

How to use Tables in Overleaf

LaTeX is plain text based, intuitive and easy to learn. An interesting and somewhat time consuming aspect of learning LaTeX is how to format tables and that often daunts people. I know I feel daunted by LaTeX tables. It is an art to correctly format tables in LaTeX. Having said that, there are a number of different websites where you can format tables for LaTeX and then copy and paste the code into Overleaf. Here are the steps:

  1. Prepare your tabular data in the form of spreadsheets, ideally in a csv (‘’comma separated value’’) file. You can also keep your tabular in the form of a spreadsheet. If you work with spreadsheets such as Apple Numbers, Microsoft Excel, LibreOffice Calc, Google Sheets, and other similar apps, all of these will allow you to take data from the spreadsheet in the form of csv.
  2. If you work with R or another statistical data analysis software, most software will let you export your tables from the app to a csv file format.
  3. Once you have your data in the form of csv file, head over to tablesgenerator.com, below:
  1. Read the csv file in that webpage, and create a table. I recommend you use the booktabs style of table creation. For more information about booktabs package in LaTeX, read their user manual (PDF)
  2. Then generate the code and copy it to ‘’clipboard’’
  3. Return to your Overleaf document and paste. Remember to add a proper caption and a label for the table. Each label must be unique for each table; else Overleaf will complain during compilation.

These six steps will be sufficient for most tables. You can also put the tables in a special file, call it tables.tex in the file manager and subsequently copy and paste the table codes to the relevant sections of the document. Remember to add the following code next to each table environment:

[ht]

This is needed so that the table will be sited where you want to place it, or at least at the top of the page. Also, make sure to add a nice caption to each table.

How to add figures in Overleaf

If you want to figures in an Overleaf document, do:

  1. First upload the figure to the filespace. Use only jpg or png (or pdf) extensions for your figures.
  2. Then copy and paste the following code:
\begin{figure}\[ht]
\centering
\includegraphics[width=\textwidth]{imagefile.jpg}\caption{\label{fig:image} Write your caption here}
\end{figure}
Notes:
imagefile.jpg = the filename and extension of the image

Remember to include a proper caption and a proper label for the image. Each label must be unique to each image.

How to add citations and references in an Overleaf document

In Overleaf, citations are stored in a bibtex file. A bibtex file is a plain text file that contains information about your references (the title of the paper, the author names, the issue, the journal title, the pages, abstract, etc). Each reference, depending on the type of the resource, will have a different entry, and the specific information that you should enter for each type of entry is different as well. For more information about bibtex, please see “How to Use Bibtex

Essentially, most academic search engines, and reference management software can provide you with a copy of their reference libraries in the bibtex format. The bibtex file ends in a .bib file format. I recommend that you start with an empty ‘references.bib’ file in your file manager where you will store your references. This is a plain text file and will contain the bibliographic entries as you go on conducting your research. Every bibliography entry in the bibtex file has an identifier. For example, see the following code (taken from the bibtex site), see:

@misc{Nobody06,
author = “Nobody Jr”,
title = “My Article”,
year = “2006” }

Here, ‘Nobody06’ is the ID for this entry. When you type to insert a specific bibliographic information as a citation to a fact, use the following code to enter the data

\cite{ID code}Note:
Where ID code is the ID code of the specific entry of the bibliographic entry. For example, if you wanted to insert the Nobody06 citation in a LaTeX document, you’d simply type \cite{Nobody06} and so on.

You must also place the following two entries in the main.tex file in Overleaf just above the

\end{document}\bibliography{name of the bib file}
\bibliographystyle{name of the style}

That’s it. LaTeX will then insert the citations and the reference list correctly at the end of the document. If you want to see the list of citation styles, see this nice resource by ShareLaTeX.

In the next part, I will show you how you can use Markdown to write in Overleaf without using LaTeX.

--

--

Arindam Basu
Notebook and Pencil

Medical Doctor and an Associate Professor of Epidemiology and Environmental Health at the University of Canterbury. Founder of TwinMe,