Info Node: (texinfo)@example

CFHT HOME texinfo: @example


up: Quotations and Examples next: @verbatim prev: @indentedblock Back to Software Index

10.4 '@example': Example Text
=============================

The '@example' environment is used to indicate an example that is not
part of the running text, such as computer input or output.  Write an
'@example' command at the beginning of a line by itself.  Mark the end
of the example with an '@end example' command, also written at the
beginning of a line by itself.

  An '@example' environment has the following characteristics:

   * Each line in the input file is a line in the output; that is, the
     source text is not filled as it normally is.
   * Extra spaces and blank lines are significant.
   * The output is indented.
   * The output uses a fixed-width font.
   * Texinfo commands _are_ expanded; if you want the output to be the
     input verbatim, use the '@verbatim' environment instead (Note:
     @verbatim).

  For example,

     @example
     cp foo @var{dest1}; \
      cp foo @var{dest2}
     @end example

produces

     cp foo DEST1; \
      cp foo DEST2

  The lines containing '@example' and '@end example' will disappear from
the output.  To make the output look good, you should put a blank line
before the '@example' and another blank line after the '@end example'.
Blank lines inside the beginning '@example' and the ending '@end
example', on the other hand, do appear in the output.

     Caution: Do not use tabs in the lines of an example!  (Or anywhere
     else in Texinfo, except in verbatim environments.)  TeX treats tabs
     as single spaces, and that is not what they look like.  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 that continues afterwards should not be
indented, as in the example above.  The '@noindent' command prevents a
piece of text from being indented as if it were a new paragraph (Note:
@noindent.

  If you want to embed code fragments within sentences, instead of
displaying them, use the '@code' command or its relatives (Note:
@code).

  If you wish to write a "comment" on a line of an example in the normal
roman font, you can use the '@r' command (Note: Fonts).


automatically generated by info2www version 1.2