Skip to main content

The PreTeXt Guide

Section 3.10 Programs and Consoles

If you are writing about computer science, or more general scientific or engineering topics, you may wish to include sample computer programs, or command-line sessions. A <program> will contain a complete computer program, or a portion of the code from a program. Some <program> can execute in an online output format, while others are both editable and executable. This behavior depends on the language used and the host employed. A <console> holds a command-line session. These elements feature monospace fonts, preservation of whitespace, and syntax highlighting. These may also be placed in a <listing> to be more prominent, or as the target of a cross-reference. See Section 4.16 for details.