Figure in LaTeX
An image is inserted with \includegraphics from the graphicx package. The figure environment adds a caption and a number, and lets LaTeX place the figure wherever it fits on the page.
Figure with a caption
\begin{figure}[h]
\centering
\includegraphics[width=0.7\textwidth]{chart.png}
\caption{Period as a function of pendulum length}
\label{fig:chart}
\end{figure}Common mistakes
- Width in pixels: give it relative to the page, e.g. 0.7\textwidth, so the figure stays within the margins.
- \label before \caption: the reference then points to the section instead of the figure.
See also
Don't want to memorize commands?
Draw a formula or paste a screenshot, and CamteX turns it into ready LaTeX.