Skip to main content

The PreTeXt Guide

Section 3.16 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.14 the ampersand and left angle bracket will confuse the initial XML processing. So use the XML entities &amp; and &lt; to represent these characters to the PreTeXt conversion tool, the PreTeXt-CLI. See Section 4.4 for further details.
You have attempted of activities on this page.