Table of Contents

Next: , Previous: Images and tables, Up: Markup


11.3 Literal examples

You can include literal examples that should not be subjected to markup. Such examples will be typeset in monospace, so this is well suited for source code and similar examples.

     #+BEGIN_EXAMPLE
     Some example from a text file.
     #+END_EXAMPLE

For simplicity when using small examples, you can also start the example lines with a colon followed by a space. There may also be additional whitespace before the colon:

     Here is an example
        : Some example from a text file.

For source code from a programming language, or any other text that can be marked up by font-lock in Emacs, you can ask for it to look like the fontified Emacs buffer

     #+BEGIN_SRC emacs-lisp
     (defun org-xor (a b)
        "Exclusive or."
        (if a (not b) b))
     #+END_SRC

To edit the example in a special buffer supporting this language, use C-c ' to both enter and leave the editing buffer.