<monospace> Monospace Text (Typewriter Text)

Used to mark text that should appear in a non-proportional font, such as courier.

Usage/Remarks

Usage

The <monospace> is only for monospaced words that are inline with other text, for example, user-interface examples or equation-based variables, parameters, and operators. The very similar element <inline-code> differs semantically, and should be used for computer code or encoded fragments such as short XML phrases or program operators and parameters.
For block monospace elements, particularly where spaces and line breaks also need to be preserved, use either:
  • the generic block structural element <preformat> (which can hold ASCII art, man-machine dialogs, or shape poetry), or
  • the semantically explicit element <code> (which holds script or computer code examples. XML tagging, XML DTD and schema fragments, pseudo-code, etc.).
Emphasis as a Toggle Switch
The @toggle attribute controls the behavior of this element. When the value of @toggle is set to “no”, the emphasized text remains in the requested style, no matter what the surrounding text does. When the value of @toggle is “yes”, if the surrounding text is set to the same emphasis style, the text within this element will change to another emphasis style, so that the text will always be typographically distinct from its surroundings.
Using the element <italic> as an example, setting the @toggle attribute to “no” would mean that material marked as italics will always be italics, even in an italic context. In contrast, if the @toggle attribute was set to “yes” on the <italic> element, if the formatting context imposes italics (whether due to another <italic> element, a stylesheet, some CSS, or other means), then the italics would be turned off within that context, making the emphasized text emphasized by contrast, but not italic. The <italic> element would still produce italics everywhere else.
Attributes

Base Attributes

Models and Context
May be contained in
Description
Any combination of:
Content Model
<!ELEMENT  monospace    (#PCDATA %emphasized-text;)*                 >
Expanded Content Model

(#PCDATA | email | ext-link | uri | inline-supplementary-material | related-article | related-object | citation-alternatives | element-citation | mixed-citation | std | bold | fixed-case | italic | monospace | num | overline | roman | sans-serif | sc | strike | underline | ruby | alternatives | inline-code | inline-graphic | inline-media | private-char | chem-struct | inline-formula | tex-math | mml:math | abbrev | index-term | index-term-range-end | milestone-end | milestone-start | named-content | styled-content | fn | target | tbx:entailedTerm | xref | std-ref | sub | sup)*

Tagged Samples
Where monofont is preferred
...
<p>There are three ways of forming subkeys: subkeys formed 
using the &ldquo;<monospace>forward</monospace>&rdquo; 
processing parameter, subkeys formed using the 
&ldquo;<monospace>backward</monospace>&rdquo; processing 
parameter, and subkeys formed using ...</p>
...
For inline code within text
...
<non-normative-note>
 <label>NOTE</label>
 <p>A well-formed <italic>symbol_range</italic> is of a form 
  form such as <monospace>&lt;S4E00&gt;..&lt;S9FA5&gt;</monospace>, 
  where the common prefix is &ldquo;S&rdquo;, and the rest 
  of the <italic>identifier</italic> portion of each 
  <italic>symbol</italic> is ...</p>
</non-normative-note>
...