Skip to main content
\( \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

Section 3.13 Verbatim and Literal Text

Typesetting literal text, usually in a monospace font, can sometimes be tricky. For short bits of such text, as part of a sentence in a paragraph, or in a caption or title, use the <c> tag, which is short for “code.” For much longer blocks of literal text, with line breaks that are to be preserved, use the <cd> element within a paragraph (“code display”). Outside a paragraph, most anywhere you could place a regular paragraph, use the <pre> tag, which is short for “pre-formatted”.

For the content of a <pre> element, the indentation will be preserved, though an equal amount of leading whitespace will be stripped from every line, so as to keep the code shifted left as far as possible.

The behavior of these two tags is to preserve characters exactly. Certainly the ASCII character set will behave as expected, and Unicode characters will migrate successfully to output formats based on HTML. As mentioned in Section 3.12 the ampersand and left angle bracket will confuse the initial XML processing. So use the XML entities &amp;, &lt;, &gt; to represent these characters to the XML processor, xsltproc. See Section 6.4 for further details.