# TexLive Figures **Including images** requires the `graphicx` package. Use `\includegraphics{filename}` to embed a PNG, JPG, or PDF file. ```latex \usepackage{graphicx} \begin{document} \includegraphics{diagram.png} \includegraphics[width=8cm]{diagram.png} \includegraphics[height=5cm, width=8cm]{diagram.png} \end{document} ``` Width and height scale the image; if you specify only one, the other scales proportionally. Omit both to use the image's native size (which may be too large for a document). **The `figure` environment** wraps `\includegraphics` to add captions, labels, and automatic positioning. Figures float to the top of pages or to a dedicated figure page, keeping text around them. ```latex \begin{figure}[h] \centering \includegraphics[width=0.8\textwidth]{diagram.png} \caption{Example diagram} \label{fig:diagram} \end{figure} ``` The `[h]` positioning option means "here" (keep near the code); `[t]` is top of page, `[b]` is bottom, `[p]` is a dedicated figure page. LaTeX may move figures slightly to optimize page breaks. `\centering` centers the image. `\caption{...}` adds a numbered caption (Figure 1, Figure 2, etc.) that appears below the image. `\label{fig:diagram}` lets you reference it: write `Figure~\ref{fig:diagram}` in text (the `~` prevents a line break between "Figure" and its number). Captions are cross-referenced automatically. Compile twice for references to resolve. **Multiple images side-by-side** use `\begin{minipage}...\end{minipage}`: ```latex \begin{figure}[h] \begin{minipage}{0.45\textwidth} \centering \includegraphics[width=\textwidth]{left.png} \caption{Left image} \end{minipage} \hfill \begin{minipage}{0.45\textwidth} \centering \includegraphics[width=\textwidth]{right.png} \caption{Right image} \end{minipage} \end{figure} ``` Each minipage takes 45% of text width; `\hfill` adds space between them. Both sub-figures share the outer caption; to label them separately use sub-figures package. **Rotation:** Use `\rotatebox{90}{...}` or `\includegraphics[angle=90]{image}` to rotate 90 degrees. **Image formats:** LaTeX prefers PDF for vectors (sharp at all scales) and PNG/JPG for rasters. EPS (Encapsulated PostScript) works with older tools. Modern `pdflatex` handles PNG/JPG natively.