Sarmate.net Sarmate.net
Home Features Pricing Documentation Contact
Log in Sign up

Images and figures

A figure is a “floating” element with a caption and a number. You create it with the figure environment. The content can be an imported image or a drawing made in LaTeX.

The figure environment

\begin{figure}\end{figure}, with \centering to centre it and \caption{...} for the caption. Here, we draw directly with TikZ (no file to upload).

Compile Compile: a centred figure, with a drawing and an automatically numbered caption.
Modify Your turn: change the caption and the colour of the circle (e.g. red!30), then compile.
Show the solution
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{figure}[h]
  \centering
  \begin{tikzpicture}
    \draw[thick,fill=red!30] (0,0) circle (1);
  \end{tikzpicture}
  \caption{My red circle.}
\end{figure}
\end{document}

Inserting a real image

For an existing photo or diagram: \usepackage{graphicx} then \includegraphics[width=0.6\textwidth]{my-image}. The image file must be uploaded to your space — do this in the full editor.

Without coding: you can create your figures visually with our editors, then retrieve the LaTeX code. Discover the visual editors →
Key takeaway: figure = content + \caption + automatic number. Drawing in LaTeX (TikZ) or imported image (graphicx + \includegraphics, uploaded file).