What is the <fig> (figure) element used for in DITA?

In DITA, the <fig> element is used to represent visual content, typically including images, illustrations, charts, diagrams, or other non-textual elements. It provides a structured way to describe and label visual content within topics.

The <fig> element is typically accompanied by the <title> and <desc> elements.

<title>:

This element provides a brief title or label for the figure, helping users understand the content.

<desc>:

This element allows for a more detailed description or caption of the figure, providing additional context.

Figures in DITA are designed to be accessible. By using <title> and <desc> appropriately, screen readers and other assistive technologies can provide a meaningful description to users with disabilities.

Figures can be placed within various contexts, such as paragraphs or sections, allowing the structuring of visual content. Styling and formatting can also be applied to figures using DITA’s styling mechanisms.

Example:

The <fig> element is used in a DITA topic to include an image with a title and description:


<fig>
  <title>Product Components</title>
  <desc>This diagram shows the key components of our product.</desc>
  <image href="images/product_diagram.png" alt="Product Components"/>
</fig>

In this example, the <fig> element encapsulates both the <title> and <desc> elements along with an <image> element, which links to an image file. This creates a structured representation of a figure with a title and description, ensuring that the visual content is well-labeled and accessible.