Go to the first, previous, next, last section, table of contents.

@example

The @example command is used to indicate an example that is not part of the running text, such as computer input or output.

This is an example of text written between an
@example command 
and an @end example command.
The text is indented but not filled.

In the printed manual, the text is typeset in a
fixed-width font, and extra spaces and blank lines are
significant.  In the Info file, an analogous result is
obtained by indenting each line with five spaces.

Write an @example command at the beginning of a line by itself. This line will disappear from the output. Mark the end of the example with an @end example command, also written at the beginning of a line by itself. The @end example will disappear from the output.

For example,

@example
mv foo bar
@end example

produces

mv foo bar

Since the lines containing @example and @end example will disappear, you should put a blank line before the @example and another blank line after the @end example. (Remember that blank lines between the beginning @example and the ending @end example will appear in the output.)

Caution: Do not use tabs in the lines of an example (or anywhere else in Texinfo, for that matter)! TeX treats tabs as single spaces, and that is not what they look like. This is a problem with TeX. (If necessary, in Emacs, you can use M-x untabify to convert tabs in a region to multiple spaces.)

Examples are often, logically speaking, "in the middle" of a paragraph, and the text continues after an example should not be indented. The @noindent command prevents a piece of text from being indented as if it were a new paragraph.

(The @code command is used for examples of code that are embedded within sentences, not set off from preceding and following text. See section @code{sample-code}.)


Go to the first, previous, next, last section, table of contents.