Subsection 4.4.3 Blocks of Verbatim Text
If you want to isolate large chunks of verbatim text outside of paragraphs, the
<pre>
tag is the one to use. It can be used as a peer of paragraphs (and other structures) as a child of a division, or it can be placed into a <listing>
to receive a caption, title and number.You can structure the contents with
<cline>
in exactly the same manner as for <cd>
. But you may find this tedious. Instead, you can make the content of <pre>
a sequence of lines separated by newlines. So that you can preserve the indentation of your source, the line closest to the left margin is taken to actually be the left margin, and a corresponding amount of leading whitespace will be removed from every line. This will work well if you recognize two caveats. First, results will be unpredictable if you mix spaces and tabs for indentation. Sticking with spaces is best. Second, if your first characters of content immediately follow the <pre>
tag then there is no leading whitespace and it is as if that line is already at the left margin. Then subsequent indentation may seem too severe to you.As previously mentioned, Section 4.15 discusses the
<console>
and <program>
tags which are more specific, and hence more capable. Review the possibilities before you decide between <pre>
, <console>
, and <program>
.