Skip to content
EasyLaTeXDocs

Captions, Labels, and Float Placement

Use figure to keep an image, caption, and label together. LaTeX places floats according to available space; use labels and references rather than handwritten figure numbers.

EasyLaTeX compiler setting: pdfLaTeX with article; load graphicx. The image files used below must exist in the project.

A Minimal Figure

Put the image, caption, and label in one environment:

latex
\begin{figure}[tbp]
  \centering
  \includegraphics[width=0.7\linewidth]{images/experiment-result.png}
  \caption{Illustration of experiment results}
  \label{fig:experiment-result}
\end{figure}

\centering aligns the content without the extra vertical spacing of center. \caption generates the number and caption; \label records a reference name.

Put the Label After the Caption

The caption advances the figure counter, so place the label after it:

latex
\caption{Illustration of experiment results}
\label{fig:experiment-result}

Prefixes such as fig:, tab:, and eq: distinguish types. They are a naming convention, not a requirement of LaTeX syntax.

Refer to the Figure

Use \ref in the body:

latex
As Figure  \ref{fig:experiment-result}  shows, the output changes over time.

Compile the complete main file in EasyLaTeX and wait for the job to finish. The platform manages reference passes. If ?? remains, check label placement and the first log error. Avoid fixed wording such as “Figure 2” or “the figure below,” since placement and numbering can change.

Understand Float Placement

The letters in tbp are placement suggestions:

OptionMeaning
tTop of a page
bBottom of a page
pA float page
hNear the current position when possible

[tbp] permits flexible placement, not an exact source position. Moving a figure can improve the page as a whole. [H] requires float and can create large gaps; use it only when appropriate to the document's requirements.

The Same Rules Apply to Tables

latex
\begin{table}[tbp]
  \centering
  \caption{Experimental parameters}
  \label{tab:parameters}
  \begin{tabular}{ll}
    Parameter & Value \\
    Temperature & \(25\,^{\circ}\mathrm{C}\) \\
  \end{tabular}
\end{table}

Follow the template's caption-placement rules. If none are specified, use one consistent convention for each object type.

Common Problems

A Reference Displays ??

Check that the label follows the caption inside the environment, then compile the complete main file and inspect the result.

The Image Is Far from Its Discussion

Try reducing its size, shortening the caption, or checking earlier queued floats before forcing placement.

The Caption Has No Number

Use \caption{...} rather than ordinary text below the image. Ordinary text creates neither a figure-list entry nor a numbered reference target.

Complete Example

The project needs images/experiment-result.png:

latex
\documentclass[a4paper,12pt]{article}
\usepackage{graphicx}

\begin{document}

As Figure  \ref{fig:experiment-result}  illustrates the experiment results.

\begin{figure}[tbp]
  \centering
  \includegraphics[width=0.7\linewidth]{images/experiment-result.png}
  \caption{Illustration of experiment results}
  \label{fig:experiment-result}
\end{figure}

\end{document}
Captions, Labels, and Float Placement | EasyLaTeX | EasyLaTeX