Skip to Main Content

LaTeX

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.

Essential Packages

Adding Images

This is an example of a typical figure environment to load an image and what each line is used for: 

Command(s) Notes
\begin{figure}[htbp!] The beginning of the figure environment. The [htbp!] is explored in left section.

\centering

To make your image center-aligned

\includegraphics[scale=0.5]{universe}

This is the line that calls your image. Make sure you have uploaded your image into the file tree if you're using Overleaf. It is important that your image file name is only one word, you may use hyphens but no spaces.

Scaling is optional, do take note that if you scale it too large, it will not appear in your document at all.

\caption{The Universe}

Optional: If you want to add a caption

\label{fig:universe}

Optional: For easy cross-referencing, it's a good idea to add a label. This is an internal label and will not appear in the final document.
\end{figure} As "figure" is an environment, you have to begin and end it.

Wrapping text around a figure

Here's an example of how the code would look like if you wanted to wrap text around a figure. Note that you need to load the wrapfig package in the preamble.

Command(s) Notes

\begin{wrapfigure}{l}{0.3\textwidth}

\includegraphics[scale=0.4]{admgarden}
\caption{The School of Arts, Design and Media}
\label{fig:adm}

\end{wrapfigure}

Note that you do not have to contain this in a figure environment.

The {l} in the first line denotes the placement of the figure, in this case, to the left and {0.3\textwidth} denotes how much space it will take up in the available width of text.

Positioning of Figures

Positioning of figures in LaTeX can be very complicated and frustrating. Here's a brief overview of the various commands used to control positioning of figures.

Command(s) Notes
h Place the float here, i.e. approximately at the same point it occurs in the source text (however it may not appear exactly at the spot)
t Position at the top of the page
b Position at the bottom of the page
p Put on a special page for floats only.
! Use in conjunction with other parameters to override internal parameters LaTeX pre-programmed float positions
H Requires the float package. This works similar to h! but is better at implementing, it is prone to errors if used frequently though.