Module 1: Common Structure and Elements

4. Non-Textual Phenomena

Textual documents often include non-textual phenomena such as images and graphics (illustrations, diagrams, drawings, artwork...) . These non-textual phenomena serve different purposes: some are an integral part of the text, e.g. in comic books and graphic novels, others just function as illustrations to the text; some are essential for a good understanding of the text, others add very little to that text. The decision how to encode these non-textual materials is once more up to the encoder and the encoding policy in force.
From a structural point of view, images and graphics may be anchored to a particular point in the text. This inline location can be indicated by using the empty element <graphic/>. Typically, a @url attribute will reference the location of the visual information outside the XML document. This can be a local path or a reference to an online image or graphical file.
<p>'Plenty of options', he thought, sat on a bench and opened the book he had taken from the Whoopledywhaaian National Library. <graphic url="http://www.whoopledywhaa.info/library/facade.png"/> It was titled 'While thou art here', by Sir Edmund Peckwood. <graphic url="wtatcover.jpg"/> While reading the first sentence, his placid expression turned to a certain je ne sais quoi: 'For the first time in twenty-five years, Dr Burt Diddledygook decided not to turn up to the annual meeting of the Royal Academy of Whoopledywhaa.</p>
Alternatively, encoded binary data representing an inline graphic or image may be embedded directly within the document. In this case the <binaryObject> element may be used containing some suitable binary format.
An image or a graphic will often be accompanied by associated text such as a caption, a label or a heading which may be encoded using <head>. More extensive comments or discussions on the figure or graphic may be given inside one or more <p> or <ab> elements. Both the graphic or figure <graphic/> and its associated text(s) (<head>, <p> or <ab>) are grouped in a wrapping <figure> element:
<figure>
<graphic url="http://www.whoopledywhaa.info/library/facade.png"/>
<head>The National Library of Whoopledywhaa.</head>
</figure>
<figure>
<graphic url="wtatcover.jpg"/>
<head>Figure 2:</head>
<p>The cover of the first print edition of "While thou art here" by Sir Edmund Peckwood from the rare books collection of the National Library of Whoopledywhaa.</p>
</figure>

Summary

The figure <figure> element is used to contain images, captions, and textual descriptions of the pictures. The images themselves are specified using the graphic <graphic/> element, whose @url attribute provides the location of an image and whose optional @n and @xml:id attribute provide numbering and identifying opportunities.
Figures consisting of several figures or sub-figures can be encoded with nesting <figure> elements:
<figure n="2">
<figure n="2a">
<graphic url="wtatcoverfront.jpg"/>
<head>Front</head>
</figure>
<figure n="2b">
<graphic url="wtatcoverback.jpg"/>
<head>Back</head>
</figure>
<head>Figure 2:</head>
<p>Front and back cover of the first print edition of "While thou art here" by Sir Edmund Peckwood from the rare books collection of the National Library of Whoopledywhaa.</p>
</figure>
Note, how in the previous example the different nesting figures are numbered in an @n attribute. This is one of the global attributes available to all TEI elements. For a discussion of this and other global attributes, see 1.5. Global Attributes.
For the purpose of reading devices that cannot represent images, e.g. reading software for the visually impaired, a description of the figure or graphic may be supplied in a <figDesc> element:
<figure>
<graphic url="http://www.whoopledywhaa.info/library/facade.png"/>
<head>The National Library of Whoopledywhaa.</head>
<figDesc>The figure shows the front of the National Library of Whoopledywhaa with the two typical towers in the so called Whooply-Gothic style. The towers are 145 metres high and the facade of the building is 48 metres wide. The 16 windows in the front are made of recycled stained glass windows of the nearby Saint-Morkel's church which now serves as a swimming pool. </figDesc>
</figure>

Note:

It's, again, up to the encoder to decide whether graphics consisting of large amounts of text, should be encoded as graphics containing the text or as text in which the graphic appears.

Note:

For more information on the treatment of non-textual phenomena in TEI, see TBE Module 3 -- 4.2 Figures , and 14 Tables, Formulæ, and Graphics in the TEI Guidelines.