Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Inserting a figure in LaTeX

📅 2012-Jun-29 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ figure, latex ⬩ 📚 Archive

Inserting a figure or any image in LaTeX requires the graphicx package. The figure can be given a caption and a label. The label can be used to refer to the figure anywhere in the document and LaTeX will replace that reference with the figure number when it creates the output document.

% At the beginning of the document

% At the place you want a figure
\caption{This is a caption for the figure.}

% Refer to the figure when you want to
As shown in Figure \ref{foobar-figure}, the Foobar is a good choice.

Tried with: MikTeX 2.9 on Windows 7 64-bit