OpenPOWER Library

 2.1.7. Example of code citations and user input

When showing user input, you want a nice sceen-looking layout, a prompt, monospace text, and a way to differentiate input from output. Here's an example:

$ echo "Hello world"
Hello world

Docbook also allows for formatting and display of common languages, allowing for whitespace and line returns just as they are written. Here's a sample snippet of C code with line numbering enabled:

  1 #include<stdio.h>
        printf("Hello world\n");
  5 }

If code formatting is not quite what you need, simply displaying text "literally" may suffice as follows: This is my literal text. It ignores whitespace.

loading table of contents...