Skip to content

Literal examples ​

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

orgmode
#+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.

If the example is source code from a programming language, or any other text that can be marked up by Font Lock in Emacs, you can ask for the example to look like the fontified Emacs buffer.

orgmode
#+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.