<preformat>

Preformatted Text

Text in which spaces, tabs, and line feeds must be preserved. Content is typically displayed in monofont to preserve character alignment.

Remarks

Usage: The <preformat> element is typically used for machine-related communication such as ASCII art and error message reports, in which whitespace such as tabs, line feeds, and spaces should be preserved.
Position: The @position attribute may be used to indicate whether this element must be anchored at its exact location within the text, or whether it may float, for example, to the top of the next page, next column, to the end of a logical file, or within a separate window. For the typical <preformat> element, the “float or anchor” decision will be governed by the size of the object. For example, short preformat fragments are typically anchored whereas longer preformatted material is typically placed elsewhere such as in a separate window or at the end of the document.
Equations: The MathML elements to describe equations are not permitted within <preformat>. If equations are encountered within computer code, they can be tagged using the element <named-content> to preserve the fact that they were equations or the element <styled-content> to preserve the fact that they were set in a math font.
When Content is a Form: The @is-form attribute can be used to indicate that the preformatted text contains/is a form. What constitutes a “form” is not defined by NISO STS.

Related Elements

Best Practice: Although it is possible to use <preformat> to tag any format-preserving object, some of these objects have semantic elements that should be used in preference, for example:
  • Programming code, scripts, pseudo-code, DTDs and Schemas, and XML instances should be tagged with the <code> element, making full use of its attributes to identify the type of code.
  • Poetry and verse (uncommon in standards documents) should usually be tagged with the <verse-group> element, which may not preserve the exact indentation, but is more likely to be displayed in a proportional font.
  • Equations and math are typically tagged with <disp-formula> or <inline-formula>.

Attributes

Model Description

This element may be contained in:

Example

...
<fig id="fig1">
 <caption>
  <title>Security Gateway to Security Gateway Tunnel</title>
 </caption>
 <preformat><![CDATA[
             +-+-+-+-+-+            +-+-+-+-+-+
             |         | IPsec      |         |
Protected    |Tunnel   | tunnel     |Tunnel   |     Protected
Subnet   <-->|Endpoint |<---------->|Endpoint |<--> Subnet
             |         |            |         |
             +-+-+-+-+-+            +-+-+-+-+-+
]]></preformat>
</fig>
...