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:

  1. Begin a new document and load babel and blindtext 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
  2. Open a figure environment and declare centering:
    \begin{figure}
    \centering
  3. Use the command \includegraphics with the filename as the argument:
    \includegraphics{test}
    
  4. Declare a caption, close the figure environment, and end the document with filler text:
    \caption{Test figure} \end{figure} ...

Get LaTeX Beginners Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.