Figure Floats and Captions
Introduction
Welcome to the seventh and final lesson in Document Structure and Layout! Over the past six lessons, you have built an impressive set of skills: document hierarchy, tables of contents, lists, page layout, tables, and image insertion. In the previous lesson, we learned how to bring images into a document with \includegraphics and control their size. The images we inserted, however, were fixed in place like ordinary text. In professional documents, images typically appear inside figure floats that carry captions, automatic numbering, and cross-references. That is exactly what this lesson covers.
Why Floats Matter
When you place an \includegraphics command directly in a paragraph, LaTeX treats the image like a large character glued to that exact spot. If the image does not fit on the current page, LaTeX may leave an awkward gap of white space and push both the image and the following text to the next page. This can make your document look unpolished.
A float solves this problem by letting LaTeX move the image slightly — perhaps to the top or bottom of a page — so that the surrounding text fills in naturally without ugly gaps. Think of a float as a flexible container: you tell LaTeX roughly where you want the image, and LaTeX fine-tunes the exact position to keep the page layout clean.

The Figure Environment
LaTeX provides the figure environment to create an image float. It wraps around the \includegraphics command you already know. Here is the simplest form:
Everything between \begin{figure} and \end{figure} becomes a floating element. LaTeX will decide where on the page to place it based on available space. Notice that we did not change the \includegraphics command at all — we simply placed it inside a new environment.
One common addition is the \centering command, which horizontally centers the image within the float. Without it, the image aligns to the left margin by default:
The \centering command applies to everything that follows it inside the environment, so it must appear before the \includegraphics line.




