<listing>

The <listing> tag is a titled, numbered container for a code sample or terminal transcript. It wraps a <program> or <console> in the same way <figure> wraps an <image>.

Use <listing> when the code needs a caption, number, or cross-reference target instead of appearing as an unnamed snippet.

Syntax

Attributes

Attributes for <listing>
AttributeRequired?Values
component = "…"optionalstring
label = "…"optionalstring
landscape = "…"optional"yes""no"
xml:id = "…"optionalstring
xml:lang = "…"optionalstring

Children

The following may appear as children: <console> <idx> <plaintitle> <program> <shorttitle> <title>

Parents

This element may appear as an immediate child of the following elements: <activity> <algorithm> <answer> <appendix> <article> <case> <chapter> <claim> <computation> <conclusion> <convention> <corollary> <data> <example> <exercise> <exploration> <fact> <hint> <identity> <insight> <introduction> <investigation> <lemma> <li> <note> <observation> <page> <paragraphs> <problem> <project> <proof> <proposition> <question> <remark> <section> <sidebyside> <solution> <statement> <subsection> <subsubsection> <task> <technology> <theorem> <warning> <worksheet>

Examples