Images and figures

Include graphics with sizing, captions and cross-references.

Images need the graphicx package. Add it to the preamble:

\usepackage{graphicx}

Basic insertion

\includegraphics{chart.png}

This places the image at its original size. The file must be in your project, and the path is relative to the file that includes it.

Resizing and rotating

\includegraphics[width=0.5\textwidth, angle=45]{chart.png}

This scales the image to half the text width and rotates it by 45 degrees. Setting only width keeps the aspect ratio.

The figure environment

Wrap the image in a figure so LaTeX can place it where it fits, without leaving large gaps at the bottom of a page. A figure also gives you a caption and a label to reference.

\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.8\linewidth]{chart.png}
  \caption{Market Analysis 2024}
  \label{fig:market}
\end{figure}

As shown in Figure \ref{fig:market}, growth is up.

The optional [htbp] lists where LaTeX may put the figure: here, top, bottom or on a separate page. Use [h] to prefer "here", but LaTeX may still move it.

Put \label after \caption, so the reference picks up the figure number. \ref needs two compiles to resolve.