Time for action – including a picture
We shall create a short document. Between two paragraphs, we would like to insert a picture. If there's no picture file available, we will use the demo mode of graphicx
:
Begin a new document and load
babel
andblindtext
to print some filler text:\documentclass[a5paper]{article} \usepackage[english]{babel} \usepackage{blindtext} \usepackage[demo]{graphicx} \pagestyle{empty} \begin{document} \section{Including a picture} \blindtext
Open a
figure
environment and declarecentering
:\begin{figure} \centering
Use the command
\includegraphics
with the filename as the argument:\includegraphics{test}
Declare a caption, close the
figure
environment, and end the document with filler text:\caption{Test figure} \end{figure} \blindtext \end{document}
Typeset and have a look at the output:
What just happened?
The most important command is \includegraphics
. We specified a filename. This file would be loaded if it exists. Otherwise an error would occur. LaTeX supports the...