Including an image
For including images, the standard package is called graphicx
. The x
in the name means it's extending the original, but outdated, graphics
package.
We will create a short document, and between two paragraphs, we would like to insert a picture. We can do so with the help of the following steps:
- Begin a new document and load
babel
andblindtext
to print some filler text, as follows:\documentclass[a5paper]{article} \usepackage[english]{babel} \usepackage{blindtext} \usepackage{graphicx} \pagestyle{empty} \begin{document} \section{Including a picture} \blindtext
- Open a
figure
environment and declare\centering
, as follows:\begin{figure} \centering
- Use the
\includegraphics
command with the filename as the argument. We will useexample-image
as the filename since that's a sample image included with TeX Live. The code is illustrated in the following snippet:\includegraphics[width=4cm]{example-image}
- Set a caption...