Skip to Main Content

Overleaf - LaTeX: Lists, Tables, Images, and Labelling

Bulleted lists

To create a bulleted list, use the itemize environment and the \item command.

\begin{itemize}
        \item Thing One
        \item Thing Two
        \item Thing Three
\end{itemize}

Numbered lists

To create a numbered list in LaTeX, you can use the \begin{enumerate} command along with the \item command.

\begin{enumerate}
        \item Thing One
        \item Thing Two
        \item Thing Three
\end{enumerate}

You can also create sub-levels of the numbered lists by adding a sub-command within the greater enumerate environment.

\begin{enumerate}
        \item Thing One
            \begin{enumerate}
                \item Sub One
                \item Sub Two
                \item Sub Three
            \end{enumerate}
        \item Thing Two
        \item Thing Three
\end{enumerate}

Tables

Tables in LaTeX can be generated using the tabular environment and the \begin{tabular} and \end{tabular} commands.

To generate your table, first include the table specifications in curly brackets next to the \begin{tabular} command.

\begin{tabular}{l c r }

\end{tabular}

In this example, LaTeX will generate a table with three columns as there are three letters specified within the curly brackets. The l stands for a column for which the contents are left justified, c stands for centered text , and r will result in right justified text. Lines between columns can be included by adding a vertical bar | between the letters specifying the columns. 

For each row, the text is separated into columns using an &. You indicate that the row has ended by using \\

\begin{tabular}{ l | c | r } 

cell 1 & cell 2 & cell 3 \\ 

cell 4 & cell 5 & cell 6 \\ 

\end{tabular}

To add lines between the rows, use the command \hline

\begin{tabular}{ l | c | r }

cell 1 & cell 2 & cell 3 \\

\hline

cell 4 & cell 5 & cell 6 \\

\end{tabular}

 

To specify the width of a particular column, you can use the letter p followed by the desired column width. 

\begin{tabular}{ l | c | r | p{4cm}} 

cell 1 & cell 2 & cell 3 & cell 4 \\ 

\hline 

cell 5 & cell 6 & cell 7 & cell 8 \\
 
\end{tabular}

 

TIP: Generating tables in LaTeX can be a tedious affair when working with a lot of data. Therefore, using a site such as tablesgenerator.com can also be useful. This website allows you to import your CSV file and generates a LaTeX table for you.

Go to tablesgenerator.com. Click on the File tab on the upper-left corner and select the import CSV file option. The site also offers other options to customize your table, for instance, you can select colors for your table, make the text bold, etc. You may add a caption and label in the caption and label sections, respectively.

When you're ready, click on the generate button and the LaTeX script for your table will be generated for you to use. Click on the copy to clipboard button on the right hand side to copy the script, and then paste it into your LaTeX file.

Adding images

You will first need to add the graphicx package to your preamble.

\usepackage{graphicx}

Next, upload the image you would like to include by clicking on the upload button in the upper hand corner.

 

The \includegraphics{..} command can be used to include your image in the text. The name of your file can be entered within the curly brackets.

The dimensions of the image can be changed by entering specifications of the height and width within the square brackets before the curly brackets, e.g., \includegraphics[width=4cm]{FileName.png}. You can choose to specify both height and width by adding a comma between the two dimensions, but this is discouraged as it will likely result in a distorted image.

To be able to control where you would like to place the image, the \includegraphics command must be used within the figure environment. To center the image, you can use the \centering command. There are six specifiers that you can use in LaTeX to control the placement of your image.

h

Image appears roughly where code is written

t

Places image on the top of the page

b

Places image on the bottom of the page

p

Places image on a separate page

!

Overrides LaTeX's placement of the image

H

Image appears exactly where code is written (requires "float" package)

To add a caption, use the \caption{..} command. You can add the \caption{..} command before or after the \includegraphics{..} command, depending on whether you would like the caption to appear above or below the image.

\begin{figure}[h]

\centering

        \includegraphics{FileName.png}

 \caption{Figure description.}

\end{figure}

Labelling

Figures and tables are numbered automatically. The labelling command in LaTeX can be used to index a figure or any other item (e.g., tables, examples, footnotes, etc.) in your document so that you can refer to it later. This command helps ensure that you refer to the right figure even if you add another figure before it.

Use the \label{..} command to label an item in LaTeX. To then refer back to the label, use the \ref{..} command.

\begin{figure}[h]

\centering

        \includegraphics{FileName.png}

 \caption{Figure description.}

 \label{FigureName}

 \end{figure}


As seen in Figure \ref{FigureName}, this result is extremely important.