Quickstart | Org mode
Getting started with Org-mode
In its simplest form, Org is like any other markup language.
You can write Org syntax in any text editor.
However, to experience the full potential of Org you need an editor that transforms Org syntax into a living, interactive document.
Preamble
At the start of a file (before the first heading), it is common to set the title, author and other export options.
#+title: The glories of Org #+author: A. Org Writer
Heading
Lines that start with an asterisk *
are headings.
A single *
denotes a 1st-level heading, **
denotes a 2nd-level
heading, etc.
* Welcome to Org-mode ** Sub-heading Each extra ~*~ increases the depth by one level.
In their simplest form headings are just the start of a section. However, any heading can also become a TODO item.
TODO items are the basic building block that Org uses to track and organize all kinds of tasks.
To add a TODO item to a heading, start the heading with a TODO
keyword such as TODO
or HOLD
.
* TODO Promulgate Org to the world ** TODO Create a quickstart guide
Markup
To mark up text in Org, simply surround it with one or more marker
characters. Bold, italic and underline are fairly intuitive, and the
ability to use strikethrough is a plus. You can combine the basic
markup in any order, however code
and verbatim
need to be the
inner-most
markers if they are present since their contents are
interpreted _literally_
.
To markup text in Org, simply surround it with one or more marker characters. *Bold*, /italic/ and _underline_ are fairly intuitive, and the ability to use +strikethrough+ is a plus. You can _/*combine*/_ the basic markup in any order, however ~code~ and =verbatim= need to be the *_~inner-most~_* markers if they are present since their contents are interpreted =_literally_=.
See Emphasis Markers for more details.
Lists
Unordered lists start with +
, -
, or *
1. Ordered lists start with 1.
, 1)
,
A.
, or A)
. Ordered and unordered bullets can be nested in any order.
To buy: 1. Milk 2. Eggs - Organic 3. Cheese + Parmesan + Mozzarella
Lists can contain checkboxes [ ]
, [-]
, [X]
.
- [ ] not started - [-] in progress - [X] complete
Lists can contain tags (and checkboxes at the same time).
- [ ] fruits :: get apples - [X] veggies :: get carrots
Links
To create a link put the target between two square brackets, like so: [[target]]
.
You can include a description in square brackets after the target [[target][desc]]
.
The order is easy to remember because it is the same as an html <a>
tag <a href="target">desc</a>
and you can't mix up brackets and
parentheses because there are only square brackets!
Org supports a wide variety of types of link targets, and you can also
add your own.
Link types are indicated with a type:
prefix, i.e., [type:target]
.
If no type:
is provided, org searches the current file for a heading
that matches target
.
Some examples:
[[https://orgmode.org][a nice website]] [[file:~/Pictures/dank-meme.png]] [[earlier heading][an earlier heading in the document]]
More info
For more on links, see the manual sections for Internal Links and External Links.
Images
Org mode automatically recognizes and renders image links during
export. Just link to an image (don't include a description). That's
it.
[[https://upload.wikimedia.org/wikipedia/commons/5/5d/Konigsberg_bridges.png]]
Images located on your computer can also be rendered in the Emacs
buffer with C-c C-x C-v
.
Blocks
Org mode uses #+BEGIN
… #+END
blocks for many purposes.
Some of the basic blocks types quote, example, and src.
If all you need is monospace text, you can use an example block.
#+begin_example monospace #+end_example
However, example blocks do not give you the power of Org babel. For that you need a source block. Source blocks provide syntax highlighting, code execution, literate programming, and more.
#+begin_src emacs-lisp (message "Hello world") #+end_src
More info
A hello world example cannot even begin to scratch the surface Org mode's support for working with source code.
Tables
Org mode comes with a table editor complete with support cell references and formulas.
In its simplest form a table is text separated using pipes |
.
| I | am | a | table | | with | two | rows | ! |
A more useful example is this comparison of existing Literate programming / reproducible research tools (from Schulte et al. 2012).
| Tool | Literate programming? | Reproducible Research? | Languages | |--------------+-----------------------+------------------------+-----------| | Javadoc | partial | no | Java | | Haskell .lhs | partial | no | Haskell | | noweb | yes | no | any | | Sweave | partial | yes | R | | Org-mode | yes | yes | any |
Worried about aligning free text tables?
Org mode does it in a single keystroke – tab
.
Comments
Org mode has a variety of ways to add comments.
- Line comments start with
#
. - Inline comments wrap
@@comment:like so@@
. - Block comments are wrapped with
#+BEGIN_COMMENT
and#+END_COMMENT
. - Section comments can be created by adding the
COMMENT
keyword to a heading* COMMENT like so
2.
# A line comment Example of an @@comment:inline@@ comment. Inline comments are used for end of line comments. @@comment:~#~ won't work@@ Since # only only works if preceeded by a newline follow by whitespace. #+begin_comment This is a block comment. It can span multiple line. As well as other markup. #+begin_src emacs-lisp (+ 1 2) #+end_src #+end_comment * A top level heading ** COMMENT This section and subsections are commented out *** This heading inherits the =COMMENT= keyword This text is commented out ** This heading is not commented This text will be exported and code blocks will run.
Macros
Org has many more advanced features built into its syntax. To give only a single example, let's take a look at macros.
{{{attn(Attention! This text gets all the markup!)}}} Regular text. {{{red(This text will be red.)}}} More regular text.