Skip to main content

Section 19.2 <figure>

To provide a number and caption for an <image>, the <figure> element is used. Notice that the <caption> is authored at the beginning of the <figure> but is displayed below the <figure>’s content.
Listing 19.2.1. Code to include a figure
<!--********************************************************************
Copyright (C) 2019-2026  Robert A. Beezer

This file is part of PreTeXt.

PreTeXt is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 or version 3 of the
License (at your option).

PreTeXt is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with PreTeXt.  If not, see <http://www.gnu.org/licenses/>.
*****************************************************************-->

<figure xml:id="fig-graph">
  <caption>A small graph (from <pubtitle>Applied
  Combinatorics</pubtitle> by Keller and
  Trotter)</caption>
  <image source="small-graph" width="20%"/>
</figure>
The code in Listing 19.2.1 produces the following output:
Figure 19.2.2. A small graph (from Applied Combinatorics by Keller and Trotter)