lisp/org-table.el: fix table alignment
[org-mode/org-tableheadings.git] / doc / org-guide.org
blobdfdee16a319eefca264cfbada3291baee0280130
1 #+title: Org Mode Compact Guide
2 #+subtitle:  Release {{{version}}}
3 #+author: The Org Mode Developers
4 #+language: en
6 #+texinfo: @insertcopying
8 * Copying
9 :PROPERTIES:
10 :copying:  t
11 :END:
13 Copyright \copy 2004--2019  Free Software Foundation, Inc.
15 #+begin_quote
16 Permission is granted to copy, distribute and/or modify this document
17 under the terms of the GNU Free Documentation License, Version 1.3 or
18 any later version published by the Free Software Foundation; with no
19 Invariant Sections, with the Front-Cover Texts being "A GNU Manual,"
20 and with the Back-Cover Texts as in (a) below.  A copy of the license
21 is included in the section entitled "GNU Free Documentation License."
22 in the full Org manual, which is distributed together with this
23 compact guide.
25 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
26 modify this GNU manual."
27 #+end_quote
29 * Introduction
30 :PROPERTIES:
31 :DESCRIPTION: Welcome!
32 :END:
34 Org is a mode for keeping notes, maintaining TODO lists, and doing
35 project planning with a fast and effective plain-text system.  It is
36 also an authoring and publishing system, and it supports working with
37 source code for literal programming and reproducible research.
39 This document is a much compressed derivative of the [[info:org][comprehensive Org
40 mode manual]].  It contains all basic features and commands, along with
41 important hints for customization.  It is intended for beginners who
42 would shy back from a 200 pages manual because of sheer size.
44 ** Installation
45 :PROPERTIES:
46 :UNNUMBERED: notoc
47 :END:
49 #+attr_texinfo: :tag Important
50 #+begin_quote
51 If you are using a version of Org that is part of the Emacs
52 distribution, please skip this section and go directly to [[*Activation]].
53 #+end_quote
55 If you have downloaded Org from the web, either as a distribution
56 =.zip= or =.tar= file, or as a Git archive, it is best to run it
57 directly from the distribution directory.  You need to add the =lisp/=
58 subdirectories to the Emacs load path.  To do this, add the following
59 line to your Emacs init file:
61 : (add-to-list 'load-path "~/path/to/orgdir/lisp")
62 : (add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t)
64 #+texinfo: @noindent
65 If you have been using git or a tar ball to get Org, you need to run
66 the following command to generate autoload information.
68 : make autoloads
70 ** Activation
71 :PROPERTIES:
72 :UNNUMBERED: notoc
73 :END:
75 Add the following lines to your Emacs init file.  The last four lines
76 define /global/ keys for some commands---please choose suitable keys
77 yourself.
79 #+begin_src emacs-lisp
80 ;; The following lines are always needed.  Choose your own keys.
81 (global-set-key (kbd "C-l") 'org-store-link)
82 (global-set-key (kbd "C-a") 'org-agenda)
83 (global-set-key (kbd "C-c") 'org-capture)
84 (global-set-key (kbd "C-b") 'org-switchb)
85 #+end_src
87 Files with extension =.org= will be put into Org mode automatically.
89 ** Feedback
90 :PROPERTIES:
91 :UNNUMBERED: notoc
92 :END:
94 If you find problems with Org, or if you have questions, remarks, or
95 ideas about it, please mail to the Org mailing list
96 mailto:emacs-orgmode@gnu.org.  For information on how to submit bug
97 reports, see the main manual.
99 * Document Structure
100 :PROPERTIES:
101 :DESCRIPTION: A tree works like your brain.
102 :END:
104 Org is an outliner.  Outlines allow a document to be organized in
105 a hierarchical structure, which, least for me, is the best
106 representation of notes and thoughts.  An overview of this structure
107 is achieved by folding, i.e., hiding large parts of the document to
108 show only the general document structure and the parts currently being
109 worked on.  Org greatly simplifies the use of outlines by compressing
110 the entire show and hide functionalities into a single command,
111 ~org-cycle~, which is bound to the {{{kbd(TAB)}}} key.
113 ** Headlines
114 :PROPERTIES:
115 :DESCRIPTION: How to typeset Org tree nodes.
116 :END:
118 Headlines define the structure of an outline tree.  The headlines in
119 Org start with one or more stars, on the left margin[fn:1].  For
120 example:
122 #+begin_example
123 ,* Top level headline
124 ,** Second level
125 ,*** Third level
126     some text
127 ,*** Third level
128     more text
129 ,* Another top level headline
130 #+end_example
132 Note that a headline named after ~org-footnote-section~, which
133 defaults to =Footnotes=, is considered as special.  A subtree with
134 this headline will be silently ignored by exporting functions.
136 Some people find the many stars too noisy and would prefer an outline
137 that has whitespace followed by a single star as headline starters.
138 See [[*Miscellaneous]] for a setup to realize this.
140 ** Visibility Cycling
141 :PROPERTIES:
142 :DESCRIPTION: Show and hide, much simplified.
143 :END:
145 Outlines make it possible to hide parts of the text in the buffer.
146 Org uses just two commands, bound to {{{kbd(TAB)}}} and
147 {{{kbd{S-TAB)}}} to change the visibility in the buffer.
149 #+attr_texinfo: :sep ,
150 - {{{kbd(TAB)}}} ::
152   /Subtree cycling/: Rotate current subtree among the states
154  : ,-> FOLDED -> CHILDREN -> SUBTREE --.
155  : '-----------------------------------'
157   When called with a prefix argument ({{{kbd(C-u TAB)}}}), or with the
158   Shift key, global cycling is invoked.
160 - {{{kbd(S-TAB)}}}, {{{kbd(C-u TAB)}}} ::
162   /Global cycling/: Rotate the entire buffer among the states
164   : ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
165   : '--------------------------------------'
167 - {{{kbd(C-u C-u C-u TAB)}}} ::
169   Show all, including drawers.
171 When Emacs first visits an Org file, the global state is set to
172 OVERVIEW, i.e., only the top level headlines are visible.  This can be
173 configured through the variable ~org-startup-folded~, or on a per-file
174 basis by adding a =STARTUP= keyword to =overview=, =content=, or
175 =showall=, like this:
177 : #+STARTUP: content
179 ** Motion
180 :PROPERTIES:
181 :DESCRIPTION: Jumping to other headlines.
182 :END:
184 The following commands jump to other headlines in the buffer.
186 - {{{kbd(C-c C-n)}}} :: Next heading.
188 - {{{kbd(C-c C-p)}}} :: Previous heading.
190 - {{{kbd(C-c C-f)}}} :: Next heading same level.
192 - {{{kbd(C-c C-b)}}} :: Previous heading same level.
194 - {{{kbd(C-c C-u)}}} :: Backward to higher level heading.
196 ** Structure Editing
197 :PROPERTIES:
198 :DESCRIPTION: Changing sequence and level of headlines.
199 :END:
201 #+attr_texinfo: :sep ,
202 - {{{kbd(M-RET)}}} ::
204   Insert new heading with same level as current.  If point is in
205   a plain list item, a new item is created (see [[Plain Lists]]).  When
206   this command is used in the middle of a line, the line is split and
207   the rest of the line becomes the new headline[fn:2].
209 - {{{kbd(M-S-RET)}}} ::
211   Insert new TODO entry with same level as current heading.
213 - {{{kbd(TAB)}}} in new, empty entry ::
215   In a new entry with no text yet, {{{kbd(TAB)}}} cycles through
216   reasonable levels.
218 - {{{kbd(M-LEFT)}}}, {{{kbd(M-RIGHT)}}} ::
220   Promote or demote current heading by one level.
222 - {{{kbd(M-UP)}}}, {{{kbd(M-DOWN)}}} ::
224   Move subtree up or down, i.e., swap with previous or next subtree of
225   same level.
227 - {{{kbd(C-c C-w)}}} ::
229   Refile entry or region to a different location.  See [[*Refile and
230   Copy]].
232 - {{{kbd(C-x n s)}}}, {{{kbd(C-x n w)}}} ::
234   Narrow buffer to current subtree and widen it again.
236 When there is an active region (Transient Mark mode), promotion and
237 demotion work on all headlines in the region.
239 ** Sparse Trees
240 :PROPERTIES:
241 :DESCRIPTION: Matches embedded in context.
242 :END:
244 An important feature of Org mode is the ability to construct /sparse
245 trees/ for selected information in an outline tree, so that the entire
246 document is folded as much as possible, but the selected information
247 is made visible along with the headline structure above it[fn:3].
248 Just try it out and you will see immediately how it works.
250 Org mode contains several commands creating such trees, all these
251 commands can be accessed through a dispatcher:
253 - {{{kbd(C-c /)}}} ::
255   This prompts for an extra key to select a sparse-tree creating
256   command.
258 - {{{kbd(C-c / r)}}} ::
260   Occur.  Prompts for a regexp and shows a sparse tree with all
261   matches.  Each match is also highlighted; the highlights disappear
262   by pressing {{{kbd(C-c C-c)}}}.
264   The other sparse tree commands select headings based on TODO
265   keywords, tags, or properties and will be discussed later in this
266   manual.
268 ** Plain Lists
269 :PROPERTIES:
270 :DESCRIPTION: Additional structure within an entry.
271 :END:
273 Within an entry of the outline tree, hand-formatted lists can provide
274 additional structure.  They also provide a way to create lists of
275 checkboxes (see [[*Checkboxes]]).  Org supports editing such lists, and
276 every exporter (see [[*Exporting]]) can parse and format them.
278 Org knows ordered lists, unordered lists, and description lists.
280 #+attr_texinfo: :indic @bullet
281 - /Unordered/ list items start with =-=, =+=, or =*= as bullets.
283 - /Ordered/ list items start with =1.=, or =1)=.
285 - /Description/ list use =::= to separate the /term/ from the
286   description.
288 Items belonging to the same list must have the same indentation on the
289 first line.  An item ends before the next line that is indented like
290 its bullet/number, or less.  A list ends when all items are closed, or
291 before two blank lines.  An example:
293 #+begin_example
294 ,* Lord of the Rings
295   My favorite scenes are (in this order)
296   1. The attack of the Rohirrim
297   2. Eowyn's fight with the witch king
298      + this was already my favorite scene in the book
299      + I really like Miranda Otto.
300   Important actors in this film are:
301   - Elijah Wood :: He plays Frodo
302   - Sean Astin :: He plays Sam, Frodo's friend.
303 #+end_example
305 The following commands act on items when point is in the first line of
306 an item (the line with the bullet or number).
308 #+attr_texinfo: :sep ,
309 - {{{kbd(TAB)}}} ::
311   Items can be folded just like headline levels.
313 - {{{kbd(M-RET)}}} ::
315   Insert new item at current level.  With a prefix argument, force
316   a new heading (see [[*Structure Editing]]).
318 - {{{kbd(M-S-RET)}}} ::
320   Insert a new item with a checkbox (see [[*Checkboxes]]).
322 - {{{kbd(M-S-UP)}}}, {{{kbd(M-S-DOWN)}}} ::
324   Move the item including subitems up/down (swap with previous/next
325   item of same indentation).  If the list is ordered, renumbering is
326   automatic.
328 - {{{kbd(M-LEFT)}}}, {{{kbd(M-RIGHT)}}} ::
330   Decrease/increase the indentation of an item, leaving children
331   alone.
333 - {{{kbd(M-S-LEFT)}}}, {{{kbd(M-S-RIGHT)}}} ::
335   Decrease/increase the indentation of the item, including subitems.
337 - {{{kbd(C-c C-c)}}} ::
339   If there is a checkbox (see [[*Checkboxes]]) in the item line, toggle
340   the state of the checkbox.  Also verify bullets and indentation
341   consistency in the whole list.
343 - {{{kbd(C-c -)}}} ::
345   Cycle the entire list level through the different itemize/enumerate
346   bullets (=-=, =+=, =*=, =1.=, =1)=).
348 * Tables
349 :PROPERTIES:
350 :DESCRIPTION: Pure magic for quick formatting.
351 :END:
353 Org comes with a fast and intuitive table editor.  Spreadsheet-like
354 calculations are supported in connection with the Emacs Calc package
355 (see [[info:calc][GNU Emacs Calculator Manual]]).
357 Org makes it easy to format tables in plain ASCII.  Any line with =|=
358 as the first non-whitespace character is considered part of a table.
359 =|= is also the column separator.  A table might look like this:
361 #+begin_example
362 | Name  | Phone | Age |
363 |-------+-------+-----|
364 | Peter |  1234 |  17 |
365 | Anna  |  4321 |  25 |
366 #+end_example
368 A table is re-aligned automatically each time you press {{{kbd(TAB)}}}
369 or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} inside the table.
370 {{{kbd(TAB)}}} also moves to the next field ({{{kbd(RET)}}} to the
371 next row) and creates new table rows at the end of the table or before
372 horizontal lines.  The indentation of the table is set by the first
373 line.  Any line starting with =|-= is considered as a horizontal
374 separator line and will be expanded on the next re-align to span the
375 whole table width.  So, to create the above table, you would only type
377 : |Name|Phone|Age|
378 : |-
380 #+texinfo: @noindent
381 and then press {{{kbd(TAB)}}} to align the table and start filling in
382 fields.  Even faster would be to type =|Name|Phone|Age= followed by
383 {{{kbd(C-c RET)}}}.
385 When typing text into a field, Org treats {{{kbd(DEL)}}},
386 {{{kbd(Backspace)}}}, and all character keys in a special way, so that
387 inserting and deleting avoids shifting other fields.  Also, when
388 typing /immediately after point was moved into a new field with
389 {{{kbd(TAB)}}}, {{{kbd(S-TAB)}}} or {{{kbd(RET)}}}/, the field is
390 automatically made blank.
392 ** Creation and conversion
393 :PROPERTIES:
394 :UNNUMBERED: notoc
395 :END:
397 - {{{kbd(C-c |)}}} ::
399   Convert the active region to table.  If every line contains at least
400   one {{{kbd(TAB)}}} character, the function assumes that the material
401   is tab separated.  If every line contains a comma, comma-separated
402   values (CSV) are assumed.  If not, lines are split at whitespace
403   into fields.
405   If there is no active region, this command creates an empty Org
406   table.  But it is easier just to start typing, like {{{kbd(|
407   N a m e | P h o n e | A g e RET | - TAB)}}}.
409 ** Re-aligning and field motion
410 :PROPERTIES:
411 :UNNUMBERED: notoc
412 :END:
414 #+attr_texinfo: :sep ,
415 - {{{kbd(C-c C-c)}}} ::
417   Re-align the table without moving point.
419 - {{{kbd(TAB)}}} ::
421   Re-align the table, move to the next field.  Creates a new row if
422   necessary.
424 - {{{kbd(S-TAB)}}} ::
426   Re-align, move to previous field.
428 - {{{kbd(RET)}}} ::
430   Re-align the table and move down to next row.  Creates a new row if
431   necessary.
433 - {{{kbd(S-UP)}}}, {{{kbd(S-DOWN)}}}, {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} ::
435   Move a cell up, down, left, and right by swapping with adjacent
436   cell.
438 ** Column and row editing
439 :PROPERTIES:
440 :UNNUMBERED: notoc
441 :END:
443 - {{{kbd(M-LEFT)}}}, {{{kbd(M-RIGHT)}}} ::
445   Move the current column left/right.
447 - {{{kbd(M-S-LEFT)}}} ::
449   Kill the current column.
451 - {{{kbd(M-S-RIGHT)}}} ::
453   Insert a new column to the left of point position.
455 - {{{kbd(M-UP)}}}, {{{kbd(M-DOWN)}}} ::
457   Move the current row up/down.
459 - {{{kbd(M-S-UP)}}} ::
461   Kill the current row or horizontal line.
463 - {{{kbd(M-S-DOWN)}}} ::
465   Insert a new row above the current row.  With a prefix argument, the
466   line is created below the current one.
468 - {{{kbd(C-c -)}}} ::
470   Insert a horizontal line below current row.  With a prefix argument,
471   the line is created above the current line.
473 - {{{kbd(C-c RET)}}} ::
475   Insert a horizontal line below current row, and move the point into
476   the row below that line.
478 - {{{kbd(C-c ^)}}} ::
480   Sort the table lines in the region.  The position of point indicates
481   the column to be used for sorting, and the range of lines is the
482   range between the nearest horizontal separator lines, or the entire
483   table.
485 * Hyperlinks
486 :PROPERTIES:
487 :DESCRIPTION: Notes in context.
488 :END:
490 Like HTML, Org provides links inside a file, external links to other
491 files, Usenet articles, emails, and much more.
493 Org recognizes plain URIs, possibly wrapped within angle brackets, and
494 activate them as clickable links.  The general link format, however,
495 looks like this:
497 : [[LINK][DESCRIPTION]]
499 #+texinfo: @noindent
500 or alternatively
502 : [[LINK]]
504 Once a link in the buffer is complete, with all brackets present, Org
505 changes the display so that =DESCRIPTION= is displayed instead of
506 =[[LINK][DESCRIPTION]]= and =LINK= is displayed instead of =[[LINK]]=.
507 To edit the invisible {{{var(LINK)}}} part, use {{{kbd(C-c C-l)}}}
508 with the point on the link.
510 ** Internal links
511 :PROPERTIES:
512 :UNNUMBERED: notoc
513 :END:
515 If the link does not look like a URL, it is considered to be internal
516 in the current file.  The most important case is a link like
517 =[[#my-custom-id]]= which links to the entry with the =CUSTOM_ID= property
518 =my-custom-id=.
520 Links such as =[[My Target]]= or =[[My Target][Find my target]]= lead
521 to a text search in the current file for the corresponding target,
522 which looks like =<<My Target>>=.
524 ** External Links
525 :PROPERTIES:
526 :UNNUMBERED: notoc
527 :END:
529 Org supports links to files, websites, Usenet and email messages, BBDB
530 database entries and links to both IRC conversations and their logs.
531 External links are URL-like locators.  They start with a short
532 identifying string followed by a colon.  There can be no space after
533 the colon.  Here are some examples:
535 | =http://www.astro.uva.nl/=dominik=        | on the web                                  |
536 | =file:/home/dominik/images/jupiter.jpg=   | file, absolute path                         |
537 | =/home/dominik/images/jupiter.jpg=        | same as above                               |
538 | =file:papers/last.pdf=                    | file, relative path                         |
539 | =./papers/last.pdf=                       | same as above                               |
540 | =file:projects.org=                       | another Org file                            |
541 | =docview:papers/last.pdf::NNN=            | open in DocView mode at page {{{var(NNN)}}} |
542 | =id:B7423F4D-2E8A-471B-8810-C40F074717E9= | link to heading by ID                       |
543 | =news:comp.emacs=                         | Usenet link                                 |
544 | =mailto:adent@galaxy.net=                 | mail link                                   |
545 | =mhe:folder#id=                           | MH-E message link                           |
546 | =rmail:folder#id=                         | Rmail message link                          |
547 | =gnus:group#id=                           | Gnus article link                           |
548 | =bbdb:R.*Stallman=                        | BBDB link (with regexp)                     |
549 | =irc:/irc.com/#emacs/bob=                 | IRC link                                    |
550 | =info:org#Hyperlinks=                     | Info node link                              |
552 File links can contain additional information to make Emacs jump to
553 a particular location in the file when following a link. This can be
554 a line number or a search option after a double colon. Here are a few
555 examples,, together with an explanation:
557 | =file:~/code/main.c::255=          | Find line 255               |
558 | =file:~/xx.org::My Target=         | Find =<<My Target>>=        |
559 | =[[file:~/xx.org::#my-custom-id]]= | Find entry with a custom ID |
561 ** Handling Links
562 :PROPERTIES:
563 :UNNUMBERED: notoc
564 :END:
566 Org provides methods to create a link in the correct syntax, to insert
567 it into an Org file, and to follow the link.
569 The main function is ~org-store-link~, called with {{{kbd(M-x
570 org-store-link)}}}.  Because of its importance, we suggest to bind it
571 to a widely available key (see [[*Activation]]).  It stores a link to the
572 current location.  The link is stored for later insertion into an Org
573 buffer---see below.
575 From an Org buffer, the following commands create, navigate or, more
576 generally, act on links.
578 #+attr_texinfo: :sep ,
579 - {{{kbd(C-c C-l)}}} ::
581   Insert a link.  This prompts for a link to be inserted into the
582   buffer.  You can just type a link, or use history keys {{{kbd(UP)}}}
583   and {{{kbd(DOWN)}}} to access stored links.  You will be prompted
584   for the description part of the link.
586   When called with a {{{kbd(C-u)}}} prefix argument, file name
587   completion is used to link to a file.
589 - {{{kbd(C-c C-l)}}} (with point on existing link) ::
591   When point is on an existing link, {{{kbd(C-c C-l)}}} allows you to
592   edit the link and description parts of the link.
594 - {{{kbd(C-c C-o)}}} ::
596   Open link at point.
598 - {{{kbd(C-c &)}}} ::
600   Jump back to a recorded position.  A position is recorded by the
601   commands following internal links, and by {{{kbd(C-c %)}}}.  Using
602   this command several times in direct succession moves through a ring
603   of previously recorded positions.
605 * TODO Items
606 :PROPERTIES:
607 :DESCRIPTION: Every tree branch can be a TODO item.
608 :END:
610 Org mode does not require TODO lists to live in separate documents.
611 Instead, TODO items are part of a notes file, because TODO items
612 usually come up while taking notes!  With Org mode, simply mark any
613 entry in a tree as being a TODO item.  In this way, information is not
614 duplicated, and TODO items remain in the context from which they
615 emerged.
617 Org mode provides methods to give you an overview of all the things
618 that you have to do, collected from many files.
620 ** Basic TODO Functionality
621 :PROPERTIES:
622 :DESCRIPTION: Marking and displaying TODO entries.
623 :ALT_TITLE: TODO Basics
624 :END:
626 Any headline becomes a TODO item when it starts with the word =TODO=,
627 for example:
629 : *** TODO Write letter to Sam Fortune
631 The most important commands to work with TODO entries are:
633 #+attr_texinfo: :sep ,
634 - {{{kbd(C-c C-t)}}} ::
636   Rotate the TODO state of the current item among
638   : ,-> (unmarked) -> TODO -> DONE --.
639   : '--------------------------------'
641   The same rotation can also be done "remotely" from the agenda buffer
642   with the {{{kbd(t)}}} command key (see [[*Commands in the Agenda
643   Buffer]]).
645 - {{{kbd(S-RIGHT)}}}, {{{kbd(S-LEFT)}}} ::
647   Select the following/preceding TODO state, similar to cycling.
649 - {{{kbd(C-c / t)}}} ::
651   View TODO items in a /sparse tree/ (see [[*Sparse Trees]]).  Folds the
652   entire buffer, but shows all TODO items---with not-DONE state---and
653   the headings hierarchy above them.
655 - {{{kbd(M-x org-agenda t)}}} ::
657   Show the global TODO list.  Collects the TODO items (with not-DONE
658   states) from all agenda files (see [[*Agenda Views]]) into a single
659   buffer.  See [[*The Global TODO List]], for more information.
661 - {{{kbd(S-M-RET)}}} ::
663   Insert a new TODO entry below the current one.
665 Changing a TODO state can also trigger tag changes.  See the docstring
666 of the option ~org-todo-state-tags-triggers~ for details.
668 ** Multi-state Workflow
669 :PROPERTIES:
670 :DESCRIPTION: More than just on/off.
671 :END:
673 You can use TODO keywords to indicate @emph{sequential} working progress
674 states:
676 #+begin_src emacs-lisp
677 (setq org-todo-keywords
678       '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
679 #+end_src
681 #+texinfo: @noindent
682 The vertical bar separates the =TODO= keywords (states that /need
683 action/) from the =DONE= states (which need /no further action/).  If
684 you do not provide the separator bar, the last state is used as the
685 =DONE= state.  With this setup, the command {{{kbd(C-c C-t)}}} cycles
686 an entry from =TODO= to =FEEDBACK=, then to =VERIFY=, and finally to
687 =DONE= and =DELEGATED=.
689 Sometimes you may want to use different sets of TODO keywords in
690 parallel.  For example, you may want to have the basic =TODO=/=DONE=,
691 but also a workflow for bug fixing.  Your setup would then look like
692 this:
694 #+begin_src emacs-lisp
695 (setq org-todo-keywords
696       '((sequence "TODO(t)" "|" "DONE(d)")
697         (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")))
698 #+end_src
700 #+texinfo: @noindent
701 The keywords should all be different, this helps Org mode to keep
702 track of which subsequence should be used for a given entry.  The
703 example also shows how to define keys for fast access of a particular
704 state, by adding a letter in parenthesis after each keyword---you will
705 be prompted for the key after {{{kbd(C-c C-t)}}}.
707 To define TODO keywords that are valid only in a single file, use the
708 following text anywhere in the file.
710 #+begin_example
711 ,#+TODO: TODO(t) | DONE(d)
712 ,#+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f)
713 ,#+TODO: | CANCELED(c)
714 #+end_example
716 After changing one of these lines, use {{{kbd(C-c C-c)}}} with the
717 cursor still in the line to make the changes known to Org mode.
719 ** Progress Logging
720 :PROPERTIES:
721 :DESCRIPTION: Dates and notes for progress.
722 :END:
724 Org mode can automatically record a timestamp and optionally a note
725 when you mark a TODO item as DONE, or even each time you change the
726 state of a TODO item.  This system is highly configurable, settings
727 can be on a per-keyword basis and can be localized to a file or even
728 a subtree.  For information on how to clock working time for a task,
729 see [[*Clocking Work Time]].
731 *** Closing items
732 :PROPERTIES:
733 :UNNUMBERED: notoc
734 :END:
736 The most basic logging is to keep track of /when/ a certain TODO item
737 was marked as done.  This can be achieved with[fn:4]
739 #+begin_src emacs-lisp
740 (setq org-log-done 'time)
741 #+end_src
743 #+texinfo: @noindent
744 Then each time you turn an entry from a TODO (not-done) state into any
745 of the DONE states, a line =CLOSED: [timestamp]= is inserted just
746 after the headline.
748 If you want to record a note along with the timestamp, use[fn:5]
750 #+begin_src emacs-lisp
751 (setq org-log-done 'note)
752 #+end_src
754 #+texinfo: @noindent
755 You are then be prompted for a note, and that note is stored below the
756 entry with a =Closing Note= heading.
758 *** Tracking TODO state changes
759 :PROPERTIES:
760 :UNNUMBERED: notoc
761 :END:
763 You might want to keep track of TODO state changes.  You can either
764 record just a timestamp, or a time-stamped note for a change.  These
765 records are inserted after the headline as an itemized list.  When
766 taking a lot of notes, you might want to get the notes out of the way
767 into a drawer.  Customize the variable ~org-log-into-drawer~ to get
768 this behavior.
770 For state logging, Org mode expects configuration on a per-keyword
771 basis.  This is achieved by adding special markers =!= (for
772 a timestamp) and =@= (for a note) in parentheses after each keyword.
773 For example:
775 : #+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@)
777 #+texinfo: @noindent
778 defines TODO keywords and fast access keys, and also request that
779 a time is recorded when the entry is set to =DONE=, and that a note is
780 recorded when switching to =WAIT= or =CANCELED=.  The same syntax
781 works also when setting ~org-todo-keywords~.
783 ** Priorities
784 :PROPERTIES:
785 :DESCRIPTION: Some things are more important than others.
786 :END:
788 If you use Org mode extensively, you may end up with enough TODO items
789 that it starts to make sense to prioritize them.  Prioritizing can be
790 done by placing a /priority cookie/ into the headline of a TODO item,
791 like this
793 : *** TODO [#A] Write letter to Sam Fortune
795 Org mode supports three priorities: =A=, =B=, and =C=.  =A= is the
796 highest, =B= the default if none is given.  Priorities make
797 a difference only in the agenda.
799 #+attr_texinfo: :sep ;
800 - {{{kbd(C-c \,)}}} ::
802   Set the priority of the current headline.  Pres {{{kbd(A)}}},
803   {{{kbd(B)}}} or {{{kbd(C)}}} to select a priority, or {{{kbd(SPC)}}}
804   to remove the cookie.
806 - {{{kbd(S-UP)}}} (~org-priority-up~); {{{kbd(S-DOWN)}}} (~org-priority-down~) ::
808   Increase/decrease the priority of the current headline.
810 ** Breaking Tasks Down into Subtasks
811 :PROPERTIES:
812 :DESCRIPTION: Splitting a task into manageable pieces.
813 :ALT_TITLE: Breaking Down Tasks
814 :END:
816 It is often advisable to break down large tasks into smaller,
817 manageable subtasks.  You can do this by creating an outline tree
818 below a TODO item, with detailed subtasks on the tree.  To keep an
819 overview of the fraction of subtasks that have already been marked
820 as done, insert either =[/]= or =[%]= anywhere in the headline.  These
821 cookies are updated each time the TODO status of a child changes, or
822 when pressing {{{kbd(C-c C-c)}}} on the cookie.  For example:
824 #+begin_example
825 ,* Organize Party [33%]
826 ,** TODO Call people [1/2]
827 ,*** TODO Peter
828 ,*** DONE Sarah
829 ,** TODO Buy food
830 ,** DONE Talk to neighbor
831 #+end_example
833 ** Checkboxes
834 :PROPERTIES:
835 :DESCRIPTION: Tick-off lists.
836 :END:
838 Every item in a plain list (see [[*Plain Lists]]) can be made into
839 a checkbox by starting it with the string =[ ]=.  Checkboxes are not
840 included into the global TODO list, so they are often great to split
841 a task into a number of simple steps.
843 Here is an example of a checkbox list.
845 #+begin_example
846 ,* TODO Organize party [2/4]
847   - [-] call people [1/2]
848     - [ ] Peter
849     - [X] Sarah
850   - [X] order food
851 #+end_example
853 Checkboxes work hierarchically, so if a checkbox item has children
854 that are checkboxes, toggling one of the children checkboxes makes the
855 parent checkbox reflect if none, some, or all of the children are
856 checked.
858 The following commands work with checkboxes:
860 - {{{kbd(C-c C-c)}}} ::
862   Toggle checkbox status or---with prefix argument---checkbox presence
863   at point.
865 - {{{kbd(M-S-RET)}}} ::
867   Insert a new item with a checkbox.  This works only if point is
868   already in a plain list item (see [[*Plain Lists]]).
870 * Tags
871 :PROPERTIES:
872 :DESCRIPTION: Tagging headlines and matching sets of tags.
873 :END:
875 An excellent way to implement labels and contexts for
876 cross-correlating information is to assign /tags/ to headlines.  Org
877 mode has extensive support for tags.
879 Every headline can contain a list of tags; they occur at the end of
880 the headline.  Tags are normal words containing letters, numbers, =_=,
881 and =@=.  Tags must be preceded and followed by a single colon, e.g.,
882 =:work:=.  Several tags can be specified, as in =:work:urgent:=.  Tags
883 by default are in bold face with the same color as the headline.
885 ** Tag inheritance
886 :PROPERTIES:
887 :UNNUMBERED: notoc
888 :END:
890 Tags make use of the hierarchical structure of outline trees.  If
891 a heading has a certain tag, all subheadings inherit the tag as well.
892 For example, in the list
894 #+begin_example
895 ,* Meeting with the French group      :work:
896 ,** Summary by Frank                  :boss:notes:
897 ,*** TODO Prepare slides for him      :action:
898 #+end_example
900 #+texinfo: @noindent
901 the final heading has the tags =work=, =boss=, =notes=, and =action=
902 even though the final heading is not explicitly marked with those
903 tags.
905 You can also set tags that all entries in a file should inherit just
906 as if these tags were defined in a hypothetical level zero that
907 surrounds the entire file.  Use a line like this[fn:6]:
909 : #+FILETAGS: :Peter:Boss:Secret:
911 ** Setting tags
912 :PROPERTIES:
913 :UNNUMBERED: notoc
914 :END:
916 Tags can simply be typed into the buffer at the end of a headline.
917 After a colon, {{{kbd(M-TAB)}}} offers completion on tags.  There is
918 also a special command for inserting tags:
920 - {{{kbd(C-c C-q)}}} ::
922   Enter new tags for the current headline.  Org mode either offers
923   completion or a special single-key interface for setting tags, see
924   below.
926 - {{{kbd(C-c C-c)}}} ::
928   When point is in a headline, this does the same as {{{kbd(C-c
929   C-q)}}}.
931 Org supports tag insertion based on a /list of tags/.  By default this
932 list is constructed dynamically, containing all tags currently used in
933 the buffer.  You may also globally specify a hard list of tags with
934 the variable ~org-tag-alist~.  Finally you can set the default tags
935 for a given file using the =TAGS= keyword, like
937 : #+TAGS: @work @home @tennisclub
938 : #+TAGS: laptop car pc sailboat
940 By default Org mode uses the standard minibuffer completion facilities
941 for entering tags.  However, it also implements another, quicker, tag
942 selection method called /fast tag selection/.  This allows you to
943 select and deselect tags with just a single key press.  For this to
944 work well you should assign unique letters to most of your commonly
945 used tags.  You can do this globally by configuring the variable
946 ~org-tag-alist~ in your Emacs init file.  For example, you may find
947 the need to tag many items in different files with =@home=.  In this
948 case you can set something like:
950 #+begin_src emacs-lisp
951 (setq org-tag-alist '(("@work" . ?w) ("@home" . ?h) ("laptop" . ?l)))
952 #+end_src
954 If the tag is only relevant to the file you are working on, then you
955 can instead set the =TAGS= keyword as:
957 : #+TAGS: @work(w)  @home(h)  @tennisclub(t)  laptop(l)  pc(p)
959 ** Tag groups
960 :PROPERTIES:
961 :UNNUMBERED: notoc
962 :END:
964 A tag can be defined as a /group tag/ for a set of other tags.  The
965 group tag can be seen as the "broader term" for its set of tags.
967 You can set group tags by using brackets and inserting a colon between
968 the group tag and its related tags:
970 : #+TAGS: [ GTD : Control Persp ]
972 #+texinfo: @noindent
973 or, if tags in the group should be mutually exclusive:
975 : #+TAGS: { Context : @Home @Work }
977 When you search for a group tag, it return matches for all members in
978 the group and its subgroups.  In an agenda view, filtering by a group
979 tag displays or hide headlines tagged with at least one of the members
980 of the group or any of its subgroups.
982 If you want to ignore group tags temporarily, toggle group tags
983 support with ~org-toggle-tags-groups~, bound to {{{kbd(C-c C-x q)}}}.
985 ** Tag searches
986 :PROPERTIES:
987 :UNNUMBERED: notoc
988 :END:
990 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} ::
992   Create a sparse tree with all headlines matching a tags search.
993   With a {{{kbd(C-u)}}} prefix argument, ignore headlines that are not
994   a TODO line.
996 - {{{kbd(M-x org-agenda m)}}} ::
998   Create a global list of tag matches from all agenda files.  See
999   [[*Matching Tags and Properties]].
1001 - {{{kbd(M-x org-agenda M)}}} ::
1003   Create a global list of tag matches from all agenda files, but check
1004   only TODO items and force checking subitems (see the option
1005   ~org-tags-match-list-sublevels~).
1007 These commands all prompt for a match string which allows basic
1008 Boolean logic like =+boss+urgent-project1=, to find entries with tags
1009 =boss= and =urgent=, but not =project1=, or =Kathy|Sally= to find
1010 entries which are tagged, like =Kathy= or =Sally=.  The full syntax of
1011 the search string is rich and allows also matching against TODO
1012 keywords, entry levels and properties.  For a more detailed description
1013 with many examples, see [[*Matching Tags and Properties]].
1015 * Properties
1016 :PROPERTIES:
1017 :DESCRIPTION: Storing information about an entry.
1018 :END:
1020 Properties are key-value pairs associated with an entry.  They live in
1021 a special drawer with the name =PROPERTIES=.  Each property is
1022 specified on a single line, with the key (surrounded by colons) first,
1023 and the value after it:
1025 #+begin_example
1026 ,* CD collection
1027 ,** Classic
1028 ,*** Goldberg Variations
1029     :PROPERTIES:
1030     :Title:     Goldberg Variations
1031     :Composer:  J.S. Bach
1032     :Publisher: Deutsche Grammophon
1033     :NDisks:    1
1034     :END:
1035 #+end_example
1037 You may define the allowed values for a particular property =Xyz= by
1038 setting a property =Xyz_ALL=.  This special property is /inherited/,
1039 so if you set it in a level 1 entry, it applies to the entire tree.
1040 When allowed values are defined, setting the corresponding property
1041 becomes easier and is less prone to typing errors.  For the example
1042 with the CD collection, we can pre-define publishers and the number of
1043 disks in a box like this:
1045 #+begin_example
1046 ,* CD collection
1047   :PROPERTIES:
1048   :NDisks_ALL:  1 2 3 4
1049   :Publisher_ALL: "Deutsche Grammophon" Philips EMI
1050   :END:
1051 #+end_example
1053 If you want to set properties that can be inherited by any entry in
1054 a file, use a line like:
1056 : #+PROPERTY: NDisks_ALL 1 2 3 4
1058 The following commands help to work with properties:
1060 - {{{kbd(C-c C-x p)}}} ::
1062   Set a property.  This prompts for a property name and a value.
1064 - {{{kbd(C-c C-c d)}}} ::
1066   Remove a property from the current entry.
1068 To create sparse trees and special lists with selection based on
1069 properties, the same commands are used as for tag searches (see
1070 [[*Tags]]). The syntax for the search string is described in [[*Matching
1071 Tags and Properties]].
1073 * Dates and Times
1074 :PROPERTIES:
1075 :DESCRIPTION: Making items useful for planning.
1076 :END:
1078 To assist project planning, TODO items can be labeled with a date
1079 and/or a time.  The specially formatted string carrying the date and
1080 time information is called a /timestamp/ in Org mode.
1082 ** Timestamps
1083 :PROPERTIES:
1084 :DESCRIPTION: Assigning a time to a tree entry.
1085 :END:
1087 A timestamp is a specification of a date---possibly with a time or
1088 a range of times---in a special format, either =<2003-09-16 Tue>= or
1089 =<2003-09-16 Tue 09:39>= or =<2003-09-16 Tue 12:00-12:30>=.
1090 A timestamp can appear anywhere in the headline or body of an Org tree
1091 entry.  Its presence causes entries to be shown on specific dates in
1092 the agenda (see [[*The Weekly/daily Agenda]]).  We distinguish:
1094 - Plain timestamp; Event; Appointment ::
1096   A simple timestamp just assigns a date/time to an item.  This is
1097   just like writing down an appointment or event in a paper agenda.
1099   #+begin_example
1100   ,* Meet Peter at the movies
1101     <2006-11-01 Wed 19:15>
1102   ,* Discussion on climate change
1103     <2006-11-02 Thu 20:00-22:00>
1104   #+end_example
1106 - Timestamp with repeater interval ::
1108   A timestamp may contain a /repeater interval/, indicating that it
1109   applies not only on the given date, but again and again after
1110   a certain interval of N days (d), weeks (w), months (m), or years
1111   (y).  The following shows up in the agenda every Wednesday:
1113   #+begin_example
1114   ,* Pick up Sam at school
1115     <2007-05-16 Wed 12:30 +1w>
1116   #+end_example
1118 - Diary-style expression entries ::
1120   #+cindex: diary style timestamps
1121   #+cindex: sexp timestamps
1122   For more complex date specifications, Org mode supports using the
1123   special expression diary entries implemented in the Emacs Calendar
1124   package.  For example, with optional time:
1126   #+begin_example
1127   ,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month
1128     <%%(diary-float t 4 2)>
1129   #+end_example
1131 - Time/Date range ::
1133   Two timestamps connected by =--= denote a range.
1135   #+begin_example
1136   ,** Meeting in Amsterdam
1137      <2004-08-23 Mon>--<2004-08-26 Thu>
1138   #+end_example
1140 - Inactive timestamp ::
1142   Just like a plain timestamp, but with square brackets instead of
1143   angular ones.  These timestamps are inactive in the sense that they
1144   do /not/ trigger an entry to show up in the agenda.
1146   #+begin_example
1147   ,* Gillian comes late for the fifth time
1148     [2006-11-01 Wed]
1149   #+end_example
1151 ** Creating Timestamps
1152 :PROPERTIES:
1153 :DESCRIPTION: Commands that insert timestamps.
1154 :END:
1156 For Org mode to recognize timestamps, they need to be in the specific
1157 format.  All commands listed below produce timestamps in the correct
1158 format.
1160 #+attr_texinfo: :sep ,
1161 - {{{kbd(C-c .)}}} ::
1163   Prompt for a date and insert a corresponding timestamp.  When point
1164   is at an existing timestamp in the buffer, the command is used to
1165   modify this timestamp instead of inserting a new one.  When this
1166   command is used twice in succession, a time range is inserted.  With
1167   a prefix argument, it also adds the current time.
1169 - {{{kbd(C-c !)}}} ::
1171   Like {{{kbd(C-c .)}}}, but insert an inactive timestamp that does
1172   not cause an agenda entry.
1174 - {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} ::
1176   Change date at point by one day.
1178 - {{{kbd(S-UP)}}}, {{{kbd(S-DOWN)}}} ::
1180   On the beginning or enclosing bracket of a timestamp, change its
1181   type.  Within a timestamp, change the item under point.  Point can
1182   be on a year, month, day, hour or minute.  When the timestamp
1183   contains a time range like =15:30-16:30=, modifying the first time
1184   also shifts the second, shifting the time block with constant
1185   length.  To change the length, modify the second time.
1188 When Org mode prompts for a date/time, it accepts any string
1189 containing some date and/or time information, and intelligently
1190 interprets the string, deriving defaults for unspecified information
1191 from the current date and time.  You can also select a date in the
1192 pop-up calendar.  See the manual for more information on how exactly
1193 the date/time prompt works.
1195 ** Deadlines and Scheduling
1196 :PROPERTIES:
1197 :DESCRIPTION: Planning your work.
1198 :END:
1200 A timestamp may be preceded by special keywords to facilitate
1201 planning:
1203 - {{{kbd(C-c C-d)}}} ::
1205   Insert =DEADLINE= keyword along with a time stamp, in the line
1206   following the headline.
1208   Meaning: the task---most likely a TODO item, though not
1209   necessarily---is supposed to be finished on that date.
1211   On the deadline date, the task is listed in the agenda.  In
1212   addition, the agenda for /today/ carries a warning about the
1213   approaching or missed deadline, starting ~org-deadline-warning-days~
1214   before the due date, and continuing until the entry is marked as
1215   done.  An example:
1217   #+begin_example
1218   ,*** TODO write article about the Earth for the Guide
1219       DEADLINE: <2004-02-29 Sun>
1220       The editor in charge is [[bbdb:Ford Prefect]]
1221   #+end_example
1223 - {{{kbd(C-c C-s)}}} ::
1225   Insert =SCHEDULED= keyword along with a stamp, in the line following
1226   the headline.
1228   Meaning: you are planning to start working on that task on the given
1229   date[fn:7].
1231   The headline is listed under the given date[fn:8].  In addition,
1232   a reminder that the scheduled date has passed is present in the
1233   compilation for /today/, until the entry is marked as done, i.e.,
1234   the task is automatically forwarded until completed.
1236   #+begin_example
1237   ,*** TODO Call Trillian for a date on New Years Eve.
1238       SCHEDULED: <2004-12-25 Sat>
1239   #+end_example
1241 Some tasks need to be repeated again and again.  Org mode helps to
1242 organize such tasks using a so-called repeater in a =DEADLINE=,
1243 =SCHEDULED=, or plain timestamps.  In the following example:
1245 #+begin_example
1246 ,** TODO Pay the rent
1247    DEADLINE: <2005-10-01 Sat +1m>
1248 #+end_example
1250 #+texinfo: @noindent
1251 the =+1m= is a repeater; the intended interpretation is that the task
1252 has a deadline on =<2005-10-01>= and repeats itself every (one) month
1253 starting from that time.
1255 ** Clocking Work Time
1256 :PROPERTIES:
1257 :DESCRIPTION: Tracking how long you spent on a task.
1258 :END:
1260 Org mode allows you to clock the time you spend on specific tasks in
1261 a project.
1263 #+attr_texinfo: :sep ,
1264 - {{{kbd(C-c C-x C-i)}}} ::
1266   Start the clock on the current item (clock-in).  This inserts the
1267   =CLOCK= keyword together with a timestamp.  When called with
1268   a {{{kbd(C-u)}}} prefix argument, select the task from a list of
1269   recently clocked tasks.
1271 - {{{kbd(C-c C-x C-o)}}} ::
1273   Stop the clock (clock-out).  This inserts another timestamp at the
1274   same location where the clock was last started.  It also directly
1275   computes the resulting time in inserts it after the time range as
1276   ==>HH:MM=.
1278 - {{{kbd(C-c C-x C-e)}}} ::
1280   Update the effort estimate for the current clock task.
1282 - {{{kbd(C-c C-x C-q)}}} ::
1284   Cancel the current clock.  This is useful if a clock was started by
1285   mistake, or if you ended up working on something else.
1287 - {{{kbd(C-c C-x C-j)}}} ::
1289   Jump to the headline of the currently clocked in task.  With
1290   a {{{kbd(C-u)}}} prefix argument, select the target task from a list
1291   of recently clocked tasks.
1293 The {{{kbd(l)}}} key may be used in the agenda (see [[*The Weekly/daily
1294 Agenda]]) to show which tasks have been worked on or closed during
1295 a day.
1297 * Capture, Refile, Archive
1298 :PROPERTIES:
1299 :DESCRIPTION: The ins and outs for projects.
1300 :END:
1302 An important part of any organization system is the ability to quickly
1303 capture new ideas and tasks, and to associate reference material with
1304 them.  Org does this using a process called /capture/.  It also can
1305 store files related to a task (/attachments/) in a special directory.
1306 Once in the system, tasks and projects need to be moved around.
1307 Moving completed project trees to an archive file keeps the system
1308 compact and fast.
1310 ** Capture
1311 :PROPERTIES:
1312 :DESCRIPTION: Capturing new stuff.
1313 :END:
1315 Capture lets you quickly store notes with little interruption of your
1316 work flow.  You can define templates for new entries and associate
1317 them with different targets for storing notes.
1319 *** Setting up capture
1320 :PROPERTIES:
1321 :UNNUMBERED: notoc
1322 :END:
1324 The following customization sets a default target[fn:9] file for notes.
1326 #+begin_src emacs-lisp
1327 (setq org-default-notes-file (concat org-directory "/notes.org"))
1328 #+end_src
1330 You may also define a global key for capturing new material (see
1331 [[*Activation]]).
1333 *** Using capture
1334 :PROPERTIES:
1335 :UNNUMBERED: notoc
1336 :END:
1338 - {{{kbd(M-x org-capture)}}} ::
1340   Start a capture process, placing you into a narrowed indirect buffer
1341   to edit.
1343 - {{{kbd(C-c C-c)}}} ::
1345   Once you have finished entering information into the capture buffer,
1346   {{{kbd(C-c C-c)}}} returns you to the window configuration before
1347   the capture process, so that you can resume your work without
1348   further distraction.
1350 - {{{kbd(C-c C-w)}}} ::
1352   Finalize the capture process by refiling the note to a different
1353   place (see [[*Refile and Copy]]).
1355 - {{{kbd(C-c C-k)}}} ::
1357   Abort the capture process and return to the previous state.
1359 *** Capture templates
1360 :PROPERTIES:
1361 :UNNUMBERED: notoc
1362 :END:
1364 You can use templates for different types of capture items, and for
1365 different target locations.  Say you would like to use one template to
1366 create general TODO entries, and you want to put these entries under
1367 the heading =Tasks= in your file =~/org/gtd.org=.  Also, a date tree
1368 in the file =journal.org= should capture journal entries.  A possible
1369 configuration would look like:
1371 #+begin_src emacs-lisp
1372 (setq org-capture-templates
1373       '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
1374          "* TODO %?\n  %i\n  %a")
1375         ("j" "Journal" entry (file+datetree "~/org/journal.org")
1376          "* %?\nEntered on %U\n  %i\n  %a")))
1377 #+end_src
1379 If you then press {{{kbd(t)}}} from the capture menu, Org will prepare
1380 the template for you like this:
1382 : * TODO
1383 :   [[file:LINK TO WHERE YOU INITIATED CAPTURE]]
1385 #+texinfo: @noindent
1386 During expansion of the template, special %-escapes[fn:10] allow
1387 dynamic insertion of content.  Here is a small selection of the
1388 possibilities, consult the manual for more.
1390 | =%a=       | annotation, normally the link created with ~org-store-link~            |
1391 | =%i=       | initial content, the region when capture is called with {{{kbd(C-u)}}} |
1392 | =%t=, =%T= | timestamp, date only, or date and time                                 |
1393 | =%u=, =%U= | like above, but inactive timestamps                                    |
1394 | =%?=       | after completing the template, position point here                                                                       |
1396 ** Refile and Copy
1397 :PROPERTIES:
1398 :DESCRIPTION: Moving/copying a tree from one place to another.
1399 :END:
1401 When reviewing the captured data, you may want to refile or to copy
1402 some of the entries into a different list, for example into a project.
1403 Cutting, finding the right location, and then pasting the note is
1404 cumbersome.  To simplify this process, you can use the following
1405 special command:
1407 - {{{kbd(C-c C-w)}}} ::
1409   Refile the entry or region at point.  This command offers possible
1410   locations for refiling the entry and lets you select one with
1411   completion.  The item (or all items in the region) is filed below
1412   the target heading as a subitem.
1414   By default, all level 1 headlines in the current buffer are
1415   considered to be targets, but you can have more complex definitions
1416   across a number of files.  See the variable ~org-refile-targets~ for
1417   details.
1419 - {{{kbd(C-u C-c C-w)}}} ::
1421   Use the refile interface to jump to a heading.
1423 - {{{kbd(C-u C-u C-c C-w)}}} ::
1425   Jump to the location where ~org-refile~ last moved a tree to.
1427 - {{{kbd(C-c M-w)}}} ::
1429   Copying works like refiling, except that the original note is not
1430   deleted.
1432 ** Archiving
1433 :PROPERTIES:
1434 :DESCRIPTION: What to do with finished products.
1435 :END:
1437 When a project represented by a (sub)tree is finished, you may want to
1438 move the tree out of the way and to stop it from contributing to the
1439 agenda.  Archiving is important to keep your working files compact and
1440 global searches like the construction of agenda views fast.
1442 The most common archiving action is to move a project tree to another
1443 file, the archive file.
1445 - {{{kbd(C-c C-x C-a)}}} ::
1447   Archive the current entry using the command specified in the
1448   variable ~org-archive-default-command~.
1450 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd(C-c $)}}} ::
1452   Archive the subtree starting at point position to the location given
1453   by ~org-archive-location~.
1455 The default archive location is a file in the same directory as the
1456 current file, with the name derived by appending =_archive= to the
1457 current file name.  You can also choose what heading to file archived
1458 items under, with the possibility to add them to a datetree in a file.
1459 For information and examples on how to specify the file and the
1460 heading, see the documentation string of the variable
1461 ~org-archive-location~.
1463 There is also an in-buffer option for setting this variable, for
1464 example:
1466 : #+ARCHIVE: %s_done::
1468 * Agenda Views
1469 :PROPERTIES:
1470 :DESCRIPTION: Collecting information into views.
1471 :END:
1473 Due to the way Org works, TODO items, time-stamped items, and tagged
1474 headlines can be scattered throughout a file or even a number of
1475 files.  To get an overview of open action items, or of events that are
1476 important for a particular date, this information must be collected,
1477 sorted and displayed in an organized way.
1479 The extracted information is displayed in a special /agenda buffer/.
1480 This buffer is read-only, but provides commands to visit the
1481 corresponding locations in the original Org files, and even to edit
1482 these files remotely.  Remote editing from the agenda buffer means,
1483 for example, that you can change the dates of deadlines and
1484 appointments from the agenda buffer.  For commands available in the
1485 Agenda buffer, see [[*Commands in the Agenda Buffer]].
1487 ** Agenda Files
1488 :PROPERTIES:
1489 :DESCRIPTION: Files being searched for agenda information.
1490 :END:
1492 The information to be shown is normally collected from all /agenda
1493 files/, the files listed in the variable ~org-agenda-files~.
1495 #+attr_texinfo: :sep or
1496 - {{{kbd(C-c [)}}} ::
1498   Add current file to the list of agenda files.  The file is added to
1499   the front of the list.  If it was already in the list, it is moved
1500   to the front.  With a prefix argument, file is added/moved to the
1501   end.
1503 - {{{kbd(C-c ])}}} ::
1505   Remove current file from the list of agenda files.
1507 - {{{kbd(C-')}}} or {{{kbd(C-\,)}}} ::
1509   Cycle through agenda file list, visiting one file after the other.
1511 ** The Agenda Dispatcher
1512 :PROPERTIES:
1513 :DESCRIPTION: Keyboard access to agenda views.
1514 :ALT_TITLE: Agenda Dispatcher
1515 :END:
1517 The views are created through a dispatcher, accessible with {{{kbd(M-x
1518 org-agenda)}}}, or, better, bound to a global key (see [[*Activation]]).
1519 It displays a menu from which an additional letter is required to
1520 execute a command.  The dispatcher offers the following default
1521 commands:
1523 #+attr_texinfo: :sep ,
1524 - {{{kbd(a)}}} ::
1526   Create the calendar-like agenda (see [[*The Weekly/daily Agenda]]).
1528 - {{{kbd(t)}}}, {{{kbd(T)}}} ::
1530   Create a list of all TODO items (see [[*The Global TODO List]]).
1532 - {{{kbd(m)}}}, {{{kbd(M)}}} ::
1534   Create a list of headlines matching a given expression (see
1535   [[*Matching Tags and Properties]]).
1537 - {{{kbd(s)}}} ::
1539   #+kindex: s @r{(Agenda dispatcher)}
1540   Create a list of entries selected by a boolean expression of
1541   keywords and/or regular expressions that must or must not occur in
1542   the entry.
1544 ** The Weekly/daily Agenda
1545 :PROPERTIES:
1546 :DESCRIPTION: What is available out of the box?
1547 :ALT_TITLE: Built-in Agenda Views
1548 :END:
1550 The purpose of the weekly/daily /agenda/ is to act like a page of
1551 a paper agenda, showing all the tasks for the current week or day.
1553 - {{{kbd(M-x org-agenda a)}}} ::
1555   Compile an agenda for the current week from a list of Org files.
1556   The agenda shows the entries for each day.
1558 Org mode understands the syntax of the diary and allows you to use
1559 diary expression entries directly in Org files:
1561 #+begin_example
1562 ,* Holidays
1563   :PROPERTIES:
1564   :CATEGORY: Holiday
1565   :END:
1566 %%(org-calendar-holiday)   ; special function for holiday names
1568 ,* Birthdays
1569   :PROPERTIES:
1570   :CATEGORY: Ann
1571   :END:
1572 %%(org-anniversary 1956  5 14) Arthur Dent is %d years old
1573 %%(org-anniversary 1869 10  2) Mahatma Gandhi would be %d years old
1574 #+end_example
1576 Org can interact with Emacs appointments notification facility.  To
1577 add the appointments of your agenda files, use the command
1578 ~org-agenda-to-appt~.
1580 ** The Global TODO List
1581 :PROPERTIES:
1582 :DESCRIPTION: All unfinished action items.
1583 :ALT_TITLE: Global TODO List
1584 :END:
1586 The global TODO list contains all unfinished TODO items formatted and
1587 collected into a single place.  Remote editing of TODO items lets you
1588 can change the state of a TODO entry with a single key press.  Forr
1589 commands available in the TODO list, see [[*Commands in the Agenda
1590 Buffer]].
1592 - {{{kbd(M-x org-agenda t)}}} ::
1594   Show the global TODO list.  This collects the TODO items from all
1595   agenda files (see [[*Agenda Views]]) into a single buffer.
1597 - {{{kbd(M-x org-agenda T)}}} ::
1599   Like the above, but allows selection of a specific TODO keyword.
1601 ** Matching Tags and Properties
1602 :PROPERTIES:
1603 :DESCRIPTION: Structured information with fine-tuned search.
1604 :END:
1606 If headlines in the agenda files are marked with /tags/ (see [[*Tags]]),
1607 or have properties (see [[*Properties]]), you can select headlines based
1608 on this metadata and collect them into an agenda buffer.  The match
1609 syntax described here also applies when creating sparse trees with
1610 {{{kbd(C-c / m)}}}.
1612 - {{{kbd(M-x org-agenda m)}}} ::
1614   Produce a list of all headlines that match a given set of tags.  The
1615   command prompts for a selection criterion, which is a boolean logic
1616   expression with tags, like =+work+urgent-withboss= or =work|home=
1617   (see [[*Tags]]).  If you often need a specific search, define a custom
1618   command for it (see [[*The Agenda Dispatcher]]).
1620 - {{{kbd(M-x org-agenda M)}}} ::
1622   Like {{{kbd(m)}}}, but only select headlines that are also TODO
1623   items.
1625 A search string can use Boolean operators =&= for AND and =|= for OR.
1626 =&= binds more strongly than =|=.  Parentheses are currently not
1627 implemented.  Each element in the search is either a tag, a regular
1628 expression matching tags, or an expression like =PROPERTY OPERATOR
1629 VALUE= with a comparison operator, accessing a property value.  Each
1630 element may be preceded by =-= to select against it, and =+= is
1631 syntactic sugar for positive selection.  The AND operator =&= is
1632 optional when =+= or =-= is present.  Here are some examples, using
1633 only tags.
1635 - =+work-boss= ::
1637   Select headlines tagged =work=, but discard those also tagged
1638   =boss=.
1640 - =work|laptop= ::
1642   Selects lines tagged =work= or =laptop=.
1644 - =work|laptop+night= ::
1646   Like before, but require the =laptop= lines to be tagged also
1647   =night=.
1649 You may also test for properties at the same time as matching tags,
1650 see the manual for more information.
1652 ** Search View
1653 :PROPERTIES:
1654 :DESCRIPTION: Find entries by searching for text.
1655 :END:
1657 This agenda view is a general text search facility for Org mode
1658 entries.  It is particularly useful to find notes.
1660 - {{{kbd(M-x org-agenda s)}}} (~org-search-view~) ::
1662   #+kindex: s @r{(Agenda dispatcher)}
1663   #+findex: org-search-view
1664   This is a special search that lets you select entries by matching
1665   a substring or specific words using a boolean logic.
1667 For example, the search string =computer equipment= matches entries
1668 that contain =computer equipment= as a substring.
1670 Search view can also search for specific keywords in the entry, using
1671 Boolean logic.  The search string =+computer
1672 +wifi -ethernet -{8\.11[bg]}= matches note entries that contain the
1673 keywords =computer= and =wifi=, but not the keyword =ethernet=, and
1674 which are also not matched by the regular expression =8\.11[bg]=,
1675 meaning to exclude both =8.11b= and =8.11g=.
1677 Note that in addition to the agenda files, this command also searches
1678 the files listed in ~org-agenda-text-search-extra-files~.
1680 ** Commands in the Agenda Buffer
1681 :PROPERTIES:
1682 :DESCRIPTION: Remote editing of Org trees.
1683 :ALT_TITLE: Agenda Commands
1684 :END:
1686 Entries in the agenda buffer are linked back to the Org file or diary
1687 file where they originate.  You are not allowed to edit the agenda
1688 buffer itself, but commands are provided to show and jump to the
1689 original entry location, and to edit the Org files "remotely" from the
1690 agenda buffer.  This is just a selection of the many commands, explore
1691 the agenda menu and the manual for a complete list.
1693 *** Motion
1694 :PROPERTIES:
1695 :UNNUMBERED: notoc
1696 :END:
1698 - {{{kbd(n)}}} ::
1700   Next line (same as {{{kbd(DOWN)}}} and {{{kbd(C-n)}}}).
1702 - {{{kbd(p)}}} ::
1704   Previous line (same as {{{kbd(UP)}}} and {{{kbd(C-p)}}}).
1706 *** View/Go to Org file
1707 :PROPERTIES:
1708 :UNNUMBERED: notoc
1709 :END:
1711 - {{{kbd(SPC)}}} ::
1713   Display the original location of the item in another window.
1714   With a prefix argument, make sure that drawers stay folded.
1716 - {{{kbd(TAB)}}} ::
1718   Go to the original location of the item in another window.
1720 - {{{kbd(RET)}}} ::
1722   Go to the original location of the item and delete other windows.
1724 *** Change display
1725 :PROPERTIES:
1726 :UNNUMBERED: notoc
1727 :END:
1728 #+attr_texinfo: :sep ,
1729 - {{{kbd(o)}}} ::
1731   Delete other windows.
1733 - {{{kbd(v d)}}} or short {{{kbd(d)}}} ::
1735   Switch to day view.
1737 - {{{kbd(v w)}}} or short {{{kbd(w)}}} ::
1739   Switch to week view.
1741 - {{{kbd(f)}}} ::
1743   Go forward in time to display the span following the current one.
1744   For example, if the display covers a week, switch to the following
1745   week.
1747 - {{{kbd(b)}}} ::
1749   Go backward in time to display earlier dates.
1751 - {{{kbd(.)}}} ::
1753   Go to today.
1755 - {{{kbd(j)}}} ::
1757   Prompt for a date and go there.
1759 - {{{kbd(v l)}}} or {{{kbd(v L)}}} or short {{{kbd(l)}}} ::
1761   Toggle Logbook mode.  In Logbook mode, entries that were marked as
1762   done while logging was on (see the variable ~org-log-done~) are
1763   shown in the agenda, as are entries that have been clocked on that
1764   day.  When called with a {{{kbd(C-u)}}} prefix argument, show all
1765   possible logbook entries, including state changes.
1767 - {{{kbd(r)}}}, {{{kbd(g)}}} ::
1769   Recreate the agenda buffer, for example to reflect the changes after
1770   modification of the timestamps of items.
1772 - {{{kbd(s)}}} ::
1774   #+kindex: C-x C-s
1775   #+findex: org-save-all-org-buffers
1776   #+kindex: s
1777   Save all Org buffers in the current Emacs session, and also the
1778   locations of IDs.
1780 *** Remote editing
1781 :PROPERTIES:
1782 :UNNUMBERED: notoc
1783 :END:
1785 - {{{kbd(0--9)}}} ::
1787   Digit argument.
1789 - {{{kbd(t)}}} ::
1791   Change the TODO state of the item, both in the agenda and in the
1792   original Org file.
1794 - {{{kbd(C-k)}}} ::
1796   Delete the current agenda item along with the entire subtree
1797   belonging to it in the original Org file.
1799 - {{{kbd(C-c C-w)}}} ::
1801   Refile the entry at point.
1803 - {{{kbd(a)}}} ::
1805   Archive the subtree corresponding to the entry at point using the
1806   default archiving command set in ~org-archive-default-command~.
1808 - {{{kbd($)}}} ::
1810   Archive the subtree corresponding to the current headline.
1812 - {{{kbd(C-c C-s)}}} ::
1814   Schedule this item.  With a prefix argument, remove the
1815   scheduling timestamp
1817 - {{{kbd(C-c C-d)}}} ::
1819   Set a deadline for this item.  With a prefix argument, remove the
1820   deadline.
1822 - {{{kbd(S-RIGHT)}}} ::
1824   Change the timestamp associated with the current line by one day
1825   into the future.
1827 - {{{kbd(S-LEFT)}}} ::
1829   Change the timestamp associated with the current line by one day
1830   into the past.
1832 - {{{kbd(I)}}} ::
1834   Start the clock on the current item.
1836 - {{{kbd(O)}}} ::
1838   Stop the previously started clock.
1840 - {{{kbd(X)}}} ::
1842   Cancel the currently running clock.
1844 - {{{kbd(J)}}} ::
1846   Jump to the running clock in another window.
1848 *** Quit and exit
1849 :PROPERTIES:
1850 :UNNUMBERED: notoc
1851 :END:
1853 - {{{kbd(q)}}} ::
1855   Quit agenda, remove the agenda buffer.
1857 - {{{kbd(x)}}} ::
1859   Exit agenda, remove the agenda buffer and all buffers loaded by
1860   Emacs for the compilation of the agenda.
1862 ** Custom Agenda Views
1863 :PROPERTIES:
1864 :DESCRIPTION: Defining special searches and views.
1865 :END:
1867 The first application of custom searches is the definition of keyboard
1868 shortcuts for frequently used searches, either creating an agenda
1869 buffer, or a sparse tree (the latter covering of course only the
1870 current buffer).
1872 Custom commands are configured in the variable
1873 ~org-agenda-custom-commands~.  You can customize this variable, for
1874 example by pressing {{{kbd(C)}}} from the agenda dispatcher (see [[*The
1875 Agenda Dispatcher]]).  You can also directly set it with Emacs Lisp in
1876 the Emacs init file.  The following example contains all valid agenda
1877 views:
1879 #+begin_src emacs-lisp
1880 (setq org-agenda-custom-commands
1881       '(("w" todo "WAITING")
1882         ("u" tags "+boss-urgent")
1883         ("v" tags-todo "+boss-urgent")))
1884 #+end_src
1886 The initial string in each entry defines the keys you have to press
1887 after the dispatcher command in order to access the command.  Usually
1888 this is just a single character.  The second parameter is the search
1889 type, followed by the string or regular expression to be used for the
1890 matching.  The example above will therefore define:
1892 - {{{kbd(w)}}} ::
1894   as a global search for TODO entries with =WAITING= as the TODO
1895   keyword.
1897 - {{{kbd(u)}}} ::
1899   as a global tags search for headlines tagged =boss= but not
1900   =urgent=.
1902 - {{{kbd(v)}}} ::
1904   The same search, but limiting it to headlines that are also TODO
1905   items.
1907 * Markup for Rich Contents
1908 :PROPERTIES:
1909 :DESCRIPTION: Compose beautiful documents.
1910 :ALT_TITLE: Markup
1911 :END:
1913 Org is primarily about organizing and searching through your
1914 plain-text notes.  However, it also provides a lightweight yet robust
1915 markup language for rich text formatting and more.  Used in
1916 conjunction with the export framework (see [[*Exporting]]), you can author
1917 beautiful documents in Org.
1919 ** Paragraphs
1920 :PROPERTIES:
1921 :DESCRIPTION: The basic unit of text.
1922 :END:
1924 Paragraphs are separated by at least one empty line.  If you need to
1925 enforce a line break within a paragraph, use =\\= at the end of
1926 a line.
1928 To preserve the line breaks, indentation and blank lines in a region,
1929 but otherwise use normal formatting, you can use this construct, which
1930 can also be used to format poetry.
1932 #+begin_example
1933 ,#+BEGIN_VERSE
1934  Great clouds overhead
1935  Tiny black birds rise and fall
1936  Snow covers Emacs
1938     ---AlexSchroeder
1939 ,#+END_VERSE
1940 #+end_example
1942 When quoting a passage from another document, it is customary to
1943 format this as a paragraph that is indented on both the left and the
1944 right margin.  You can include quotations in Org documents like this:
1946 #+begin_example
1947 ,#+BEGIN_QUOTE
1948 Everything should be made as simple as possible,
1949 but not any simpler ---Albert Einstein
1950 ,#+END_QUOTE
1951 #+end_example
1953 If you would like to center some text, do it like this:
1955 #+begin_example
1956 ,#+BEGIN_CENTER
1957 Everything should be made as simple as possible, \\
1958 but not any simpler
1959 ,#+END_CENTER
1960 #+end_example
1962 ** Emphasis and Monospace
1963 :PROPERTIES:
1964 :DESCRIPTION: Bold, italic, etc.
1965 :END:
1967 You can make words =*bold*=, =/italic/=, =_underlined_=, ==verbatim==
1968 and =~code~=, and, if you must, =+strike-through+=.  Text in the code
1969 and verbatim string is not processed for Org specific syntax; it is
1970 exported verbatim.
1972 ** Embedded LaTeX
1973 :PROPERTIES:
1974 :DESCRIPTION: LaTeX can be freely used inside Org documents.
1975 :END:
1977 For scientific notes which need to be able to contain mathematical
1978 symbols and the occasional formula, Org mode supports embedding LaTeX
1979 code into its files.  You can directly use TeX-like syntax for special
1980 symbols, enter formulas and entire LaTeX environments.
1982 #+begin_example
1983 The radius of the sun is R_sun = 6.96 x 10^8 m.  On the other hand,
1984 the radius of Alpha Centauri is R_{Alpha Centauri} = 1.28 x R_{sun}.
1986 \begin{equation}                        % arbitrary environments,
1987 x=\sqrt{b}                              % even tables, figures
1988 \end{equation}                          % etc
1990 If $a^2=b$ and \( b=2 \), then the solution must be
1991 either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].
1992 #+end_example
1994 ** Literal examples
1995 :PROPERTIES:
1996 :DESCRIPTION: Source code examples with special formatting.
1997 :END:
1999 You can include literal examples that should not be subjected to
2000 markup.  Such examples are typeset in monospace, so this is well
2001 suited for source code and similar examples.
2003 #+begin_example
2004 ,#+BEGIN_EXAMPLE
2005   Some example from a text file.
2006 ,#+END_EXAMPLE
2007 #+end_example
2009 For simplicity when using small examples, you can also start the
2010 example lines with a colon followed by a space.  There may also be
2011 additional whitespace before the colon:
2013 #+begin_example
2014 Here is an example
2015    : Some example from a text file.
2016 #+end_example
2018 If the example is source code from a programming language, or any
2019 other text that can be marked up by Font Lock in Emacs, you can ask
2020 for the example to look like the fontified Emacs buffer.
2022 #+begin_example
2023 ,#+BEGIN_SRC emacs-lisp
2024   (defun org-xor (a b)
2025     "Exclusive or."
2026     (if a (not b) b))
2027  ,#+END_SRC
2028 #+end_example
2030 To edit the example in a special buffer supporting this language, use
2031 {{{kbd(C-c ')}}} to both enter and leave the editing buffer.
2033 ** Images
2034 :PROPERTIES:
2035 :DESCRIPTION: Display an image.
2036 :END:
2038 An image is a link to an image file that does not have a description
2039 part, for example
2041 : ./img/cat.jpg
2043 If you wish to define a caption for the image and maybe a label for
2044 internal cross references (see [[*Hyperlinks]]), make sure that the
2045 link is on a line by itself and precede it with =CAPTION= and =NAME=
2046 keywords as follows:
2048 #+begin_example
2049 ,#+CAPTION: This is the caption for the next figure link (or table)
2050 ,#+NAME:   fig:SED-HR4049
2051 [[./img/a.jpg]]
2052 #+end_example
2054 ** Creating Footnotes
2055 :PROPERTIES:
2056 :DESCRIPTION: Edit and read footnotes.
2057 :END:
2059 A footnote is defined in a paragraph that is started by a footnote
2060 marker in square brackets in column 0, no indentation allowed.  The
2061 footnote reference is simply the marker in square brackets, inside
2062 text.  For example:
2064 #+begin_example
2065 The Org homepage[fn:1] now looks a lot better than it used to.
2067 [fn:1] The link is: https://orgmode.org
2068 #+end_example
2070 The following commands handle footnotes:
2072 - {{{kbd(C-c C-x f)}}} ::
2074   The footnote action command.  When point is on a footnote reference,
2075   jump to the definition.  When it is at a definition, jump to the
2076   (first) reference.  Otherwise, create a new footnote.  When this
2077   command is called with a prefix argument, a menu of additional
2078   options including renumbering is offered.
2080 - {{{kbd(C-c C-c)}}} ::
2082   Jump between definition and reference.
2084 * Exporting
2085 :PROPERTIES:
2086 :DESCRIPTION: Sharing and publishing notes.
2087 :END:
2089 Org can convert and export documents to a variety of other formats
2090 while retaining as much structure (see [[*Document Structure]]) and markup
2091 (see [[*Markup for Rich Contents]]) as possible.
2093 ** The Export Dispatcher
2094 :PROPERTIES:
2095 :DESCRIPTION: The main interface.
2096 :END:
2098 The export dispatcher is the main interface for Org's exports.
2099 A hierarchical menu presents the currently configured export formats.
2100 Options are shown as easy toggle switches on the same screen.
2102 - {{{kbd(C-c C-e)}}} ::
2104   Invokes the export dispatcher interface.
2106 Org exports the entire buffer by default.  If the Org buffer has an
2107 active region, then Org exports just that region.
2109 ** Export Settings
2110 :PROPERTIES:
2111 :DESCRIPTION: Common export settings.
2112 :END:
2114 The exporter recognizes special lines in the buffer which provide
2115 additional information.  These lines may be put anywhere in the file:
2117 : #+TITLE: I'm in the Mood for Org
2119 Most proeminent export options include:
2121 | =TITLE=    | the title to be shown                            |
2122 | =AUTHOR=   | the author (default taken from ~user-full-name~) |
2123 | =DATE=     | a date, fixed, or an Org timestamp               |
2124 | =EMAIL=    | email address (default from ~user-mail-address~) |
2125 | =LANGUAGE= | language code, e.g., =en=                        |
2127 Option keyword sets can be inserted from the export dispatcher (see
2128 [[*The Export Dispatcher]]) using the =Insert template= command by
2129 pressing {{{kbd(#)}}}.
2131 ** Table of Contents
2132 :PROPERTIES:
2133 :DESCRIPTION: The if and where of the table of contents.
2134 :END:
2136 The table of contents includes all headlines in the document.  Its
2137 depth is therefore the same as the headline levels in the file.  If
2138 you need to use a different depth, or turn it off entirely, set the
2139 ~org-export-with-toc~ variable accordingly.  You can achieve the same
2140 on a per file basis, using the following =toc= item in =OPTIONS=
2141 keyword:
2143 #+begin_example
2144 ,#+OPTIONS: toc:2          (only include two levels in TOC)
2145 ,#+OPTIONS: toc:nil        (no default TOC at all)
2146 #+end_example
2148 Org normally inserts the table of contents directly before the first
2149 headline of the file.
2151 ** Include Files
2152 :PROPERTIES:
2153 :DESCRIPTION: Include additional files into a document.
2154 :END:
2156 During export, you can include the content of another file.  For
2157 example, to include your =.emacs= file, you could use:
2159 : #+INCLUDE: "~/.emacs" src emacs-lisp
2161 #+texinfo: @noindent
2162 The first parameter is the file name to include.  The optional second
2163 parameter specifies the block type: =example=, =export= or =src=.  The
2164 optional third parameter specifies the source code language to use for
2165 formatting the contents.  This is relevant to both =export= and =src=
2166 block types.
2168 You can visit the included file with {{{kbd(C-c ')}}}.
2170 ** Comment Lines
2171 :PROPERTIES:
2172 :DESCRIPTION: What will not be exported.
2173 :END:
2175 Lines starting with zero or more whitespace characters followed by one
2176 =#= and a whitespace are treated as comments and, as such, are not
2177 exported.
2179 Likewise, regions surrounded by =#+BEGIN_COMMENT= ... =#+END_COMMENT=
2180 are not exported.
2182 Finally, a =COMMENT= keyword at the beginning of an entry, but after
2183 any other keyword or priority cookie, comments out the entire subtree.
2184 The command below helps changing the comment status of a headline.
2186 - {{{kbd(C-c ;)}}} ::
2188   Toggle the =COMMENT= keyword at the beginning of an entry.
2190 ** ASCII/UTF-8 Export
2191 :PROPERTIES:
2192 :DESCRIPTION: Exporting to flat files with encoding.
2193 :END:
2195 ASCII export produces an output file containing only plain ASCII
2196 characters.  This is the simplest and most direct text output.  It
2197 does not contain any Org markup.  UTF-8 export uses additional
2198 characters and symbols available in this encoding standards.
2200 #+attr_texinfo: :sep ,
2201 - {{{kbd(C-c C-e t a)}}}, {{{kbd(C-c C-e t u)}}} ::
2203   Export as an ASCII file with a =.txt= extension.  For =myfile.org=,
2204   Org exports to =myfile.txt=, overwriting without warning.  For
2205   =myfile.txt=, Org exports to =myfile.txt.txt= in order to prevent
2206   data loss.
2208 ** HTML Export
2209 :PROPERTIES:
2210 :DESCRIPTION: Exporting to HTML.
2211 :END:
2213 Org mode contains an HTML exporter with extensive HTML formatting
2214 compatible with XHTML 1.0 strict standard.
2216 - {{{kbd(C-c C-e h h)}}} ::
2218   Export as HTML file with a =.html= extension.  For =myfile.org=, Org
2219   exports to =myfile.html=, overwriting without warning.  {{{kbd{C-c
2220   C-e h o)}}} exports to HTML and opens it in a web browser.
2222 The HTML export back-end transforms =<= and =>= to =&lt;= and =&gt;=.
2223 To include raw HTML code in the Org file so the HTML export back-end
2224 can insert that HTML code in the output, use this inline syntax:
2225 =@@html:...@@=.  For example:
2227 : @@html:<b>@@bold text@@html:</b>@@
2229 For larger raw HTML code blocks, use these HTML export code blocks:
2231 #+begin_example
2232 ,#+HTML: Literal HTML code for export
2234 ,#+BEGIN_EXPORT html
2235   All lines between these markers are exported literally
2236 ,#+END_EXPORT
2237 #+end_example
2239 ** LaTeX Export
2240 :PROPERTIES:
2241 :DESCRIPTION: Exporting to @LaTeX{} and processing to PDF.
2242 :END:
2244 The LaTeX export back-end can handle complex documents, incorporate
2245 standard or custom LaTeX document classes, generate documents using
2246 alternate LaTeX engines, and produce fully linked PDF files with
2247 indexes, bibliographies, and tables of contents, destined for
2248 interactive online viewing or high-quality print publication.
2250 By default, the LaTeX output uses the /article/ class.  You can change
2251 this by adding an option like =#+LATEX_CLASS: myclass= in your file.
2252 The class must be listed in ~org-latex-classes~.
2254 - {{{kbd(C-c C-e l l)}}} ::
2256   Export to a LaTeX file with a =.tex= extension.  For =myfile.org=,
2257   Org exports to =myfile.tex=, overwriting without warning.
2259 - {{{kbd(C-c C-e l p)}}} ::
2261   Export as LaTeX file and convert it to PDF file.
2263 - {{{kbd(C-c C-e l o)}}} ::
2265   Export as LaTeX file and convert it to PDF, then open the PDF using
2266   the default viewer.
2268 The LaTeX export back-end can insert any arbitrary LaTeX code, see
2269 [[*Embedded LaTeX]].  There are three ways to embed such code in the Org
2270 file and they all use different quoting syntax.
2272 Inserting in-line quoted with @ symbols:
2274 : Code embedded in-line @@latex:any arbitrary LaTeX code@@ in a paragraph.
2276 Inserting as one or more keyword lines in the Org file:
2278 : #+LATEX: any arbitrary LaTeX code
2280 Inserting as an export block in the Org file, where the back-end
2281 exports any code between begin and end markers:
2283 #+begin_example
2284 ,#+BEGIN_EXPORT latex
2285   any arbitrary LaTeX code
2286 ,#+END_EXPORT
2287 #+end_example
2289 ** iCalendar Export
2290 :PROPERTIES:
2291 :DESCRIPTION: Exporting to iCalendar.
2292 :END:
2294 A large part of Org mode's interoperability success is its ability to
2295 easily export to or import from external applications.  The iCalendar
2296 export back-end takes calendar data from Org files and exports to the
2297 standard iCalendar format.
2299 - {{{kbd(C-c C-e c f)}}} ::
2301   Create iCalendar entries from the current Org buffer and store them
2302   in the same directory, using a file extension =.ics=.
2304 - {{{kbd(C-c C-e c c)}}} ::
2306   Create a combined iCalendar file from Org files in
2307   ~org-agenda-files~ and write it to
2308   ~org-icalendar-combined-agenda-file~ file name.
2310 * Publishing
2311 :PROPERTIES:
2312 :DESCRIPTION: Create a web site of linked Org files.
2313 :END:
2315 Org includes a publishing management system that allows you to
2316 configure automatic HTML conversion of /projects/ composed of
2317 interlinked Org files.  You can also configure Org to automatically
2318 upload your exported HTML pages and related attachments, such as
2319 images and source code files, to a web server.
2321 You can also use Org to convert files into PDF, or even combine HTML
2322 and PDF conversion so that files are available in both formats on the
2323 server.
2325 For detailed instructions about setup, see the manual. Here is an
2326 example:
2328 #+begin_src emacs-lisp
2329 (setq org-publish-project-alist
2330       '(("org"
2331          :base-directory "~/org/"
2332          :publishing-directory "~/public_html"
2333          :section-numbers nil
2334          :table-of-contents nil
2335          :style "<link rel=\"stylesheet\"
2336                 href=\"../other/mystyle.css\"
2337                 type=\"text/css\"/>")))
2338 #+end_src
2340 - {{{kbd(C-c C-e P x)}}} ::
2342   Prompt for a specific project and publish all files that belong to
2343   it.
2345 - {{{kbd(C-c C-e P p)}}} ::
2347   Publish the project containing the current file.
2349 - {{{kbd(C-c C-e P f)}}} ::
2351   Publish only the current file.
2353 - {{{kbd(C-c C-e P a)}}} ::
2355   Publish every project.
2357 Org uses timestamps to track when a file has changed.  The above
2358 functions normally only publish changed files.  You can override this
2359 and force publishing of all files by giving a prefix argument to any
2360 of the commands above.
2362 * Working with Source Code
2363 :PROPERTIES:
2364 :DESCRIPTION: Export, evaluate, and tangle code blocks.
2365 :END:
2367 Org mode provides a number of features for working with source code,
2368 including editing of code blocks in their native major mode,
2369 evaluation of code blocks, tangling of code blocks, and exporting code
2370 blocks and their results in several formats.
2372 A source code block conforms to this structure:
2374 #+begin_example
2375 ,#+NAME: <name>
2376 ,#+BEGIN_SRC <language> <switches> <header arguments>
2377   <body>
2378 ,#+END_SRC
2379 #+end_example
2381 #+texinfo: @noindent
2382 where:
2384 - =<name>= is a string used to uniquely name the code block,
2386 - =<language>= specifies the language of the code block, e.g.,
2387   =emacs-lisp=, =shell=, =R=, =python=, etc.,
2389 - =<switches>= can be used to control export of the code block,
2391 - =<header arguments>= can be used to control many aspects of code
2392   block behavior as demonstrated below,
2394 - =<body>= contains the actual source code.
2396 Use {{{kbd(C-c ')}}} to edit the current code block.  It opens a new
2397 major mode edit buffer containing the body of the source code block,
2398 ready for any edits.  Use {{{kbd(C-c ')}}} again to close the buffer
2399 and return to the Org buffer.
2401 ** Using header arguments
2402 :PROPERTIES:
2403 :UNNUMBERED: notoc
2404 :END:
2406 A header argument is specified with an initial colon followed by the
2407 argument's name in lowercase.
2409 Header arguments can be set in several ways; Org prioritizes them in
2410 case of overlaps or conflicts by giving local settings a higher
2411 priority.
2413 - System-wide header arguments ::
2415   Those are specified by customizing ~org-babel-default-header-args~
2416   variable, or, for a specific language {{{var(LANG)}}}
2417   ~org-babel-default-header-args:LANG~.
2419 - Header arguments in properties ::
2421   You can set them using =header-args= property (see [[*Properties]])---or
2422   =header-args:LANG= for language {{{var(LANG)}}}.  Header arguments
2423   set through properties drawers apply at the sub-tree level on down.
2425 - Header arguments in code blocks ::
2427   Header arguments are most commonly set at the source code block
2428   level, on the =BEGIN_SRC= line:
2430   #+begin_example
2431   ,#+NAME: factorial
2432   ,#+BEGIN_SRC haskell :results silent :exports code :var n=0
2433     fac 0 = 1
2434     fac n = n * fac (n-1)
2435   ,#+END_SRC
2436   #+end_example
2438   Code block header arguments can span multiple lines using =HEADER=
2439   keyword on each line.
2441 ** Evaluating code blocks
2442 :PROPERTIES:
2443 :UNNUMBERED: notoc
2444 :END:
2446 Use {{{kbd(C-c C-c)}}} to evaluate the current code block and insert
2447 its results in the Org document.  By default, evaluation is only
2448 turned on for =emacs-lisp= code blocks, however support exists for
2449 evaluating blocks in many languages.  For a complete list of supported
2450 languages see the manual.  The following shows a code block and its
2451 results.
2453 #+begin_example
2454 ,#+BEGIN_SRC emacs-lisp
2455   (+ 1 2 3 4)
2456 ,#+END_SRC
2458 ,#+RESULTS:
2459 : 10
2460 #+end_example
2462 The following syntax is used to pass arguments to code blocks using
2463 the =var= header argument.
2465 : :var NAME=ASSIGN
2467 #+texinfo: @noindent
2468 {{{var(NAME)}}} is the name of the variable bound in the code block
2469 body.  {{{var(ASSIGN)}}} is a literal value, such as a string,
2470 a number, a reference to a table, a list, a literal example, another
2471 code block---with or without arguments---or the results of evaluating
2472 a code block.
2474 ** Results of evaluation
2475 :PROPERTIES:
2476 :UNNUMBERED: notoc
2477 :END:
2479 How Org handles results of a code block execution depends on many
2480 header arguments working together.  The primary determinant, however,
2481 is the =results= header argument.  It controls the /collection/,
2482 /type/, /format/, and /handling/ of code block results.
2484 - Collection ::
2486   How the results should be collected from the code block.  You may
2487   choose either =output= or =value= (the default).
2489 - Type ::
2491   What result types to expect from the execution of the code block.
2492   You may choose among =table=, =list=, =scalar=, and =file=.  Org
2493   tries to guess it if you do not provide it.
2495 - Format ::
2497   How Org processes results.  Some possible values are =code=,
2498   =drawer=, =html=, =latex=, =link=, and =raw=.
2500 - Handling ::
2502   How to insert the results once properly formatted.  Allowed values
2503   are =silent=, =replace= (the default), =append=, or =prepend=.
2505 Code blocks which output results to files---e.g.: graphs, diagrams and
2506 figures---can accept a =:file FILENAME= header argument, in which case
2507 the results are saved to the named file, and a link to the file is
2508 inserted into the buffer.
2510 ** Exporting code blocks
2511 :PROPERTIES:
2512 :UNNUMBERED: notoc
2513 :END:
2515 It is possible to export the /code/ of code blocks, the /results/ of
2516 code block evaluation, /both/ the code and the results of code block
2517 evaluation, or /none/.  Org defaults to exporting /code/ for most
2518 languages.
2520 The =exports= header argument is to specify if that part of the Org
2521 file is exported to, say, HTML or LaTeX formats.  It can be set to
2522 either =code=, =results=, =both= or =none=.
2524 ** Extracting source code
2525 :PROPERTIES:
2526 :UNNUMBERED: notoc
2527 :END:
2529 Use {{{kbd(C-c C-v t)}}} to create pure source code files by
2530 extracting code from source blocks in the current buffer.  This is
2531 referred to as "tangling"---a term adopted from the literate
2532 programming community.  During tangling of code blocks their bodies
2533 are expanded using ~org-babel-expand-src-block~, which can expand both
2534 variable and "Noweb" style references.  In order to tangle a code
2535 block it must have a =tangle= header argument, see the manual for
2536 details.
2538 * Miscellaneous
2539 :PROPERTIES:
2540 :DESCRIPTION: All the rest which did not fit elsewhere.
2541 :END:
2543 ** Completion
2544 :PROPERTIES:
2545 :UNNUMBERED: notoc
2546 :END:
2548 Org has in-buffer completions with {{{kbd(M-TAB)}}}.  No minibuffer is
2549 involved.  Type one or more letters and invoke the hot key to complete
2550 the text in-place.
2552 For example, this command will complete TeX symbols after =\=, TODO
2553 keywords at the beginning of a headline, and tags after =:= in
2554 a headline.
2556 ** Clean view
2557 :PROPERTIES:
2558 :UNNUMBERED: notoc
2559 :END:
2561 Org's default outline with stars and no indents can become too
2562 cluttered for short documents.  For /book-like/ long documents, the
2563 effect is not as noticeable.  Org provides an alternate stars and
2564 indentation scheme, as shown on the right in the following table.  It
2565 uses only one star and indents text to line with the heading:
2567 #+begin_example
2568 ,* Top level headline             |    * Top level headline
2569 ,** Second level                  |      * Second level
2570 ,*** Third level                  |        * Third level
2571     some text                    |          some text
2572 ,*** Third level                  |        * Third level
2573     more text                    |          more text
2574 ,* Another top level headline     |    * Another top level headline
2575 #+end_example
2577 This kind of view can be achieved dynamically at display time using
2578 Org Indent mode, which prepends intangible space to each line.  You
2579 can turn on Org Indent mode for all files by customizing the variable
2580 ~org-startup-indented~, or you can turn it on for individual files
2581 using
2583 : #+STARTUP: indent
2585 If you want the indentation to be hard space characters so that the
2586 plain text file looks as similar as possible to the Emacs display, Org
2587 supports you by helping to indent (with {{{kbd(TAB)}}}) text below
2588 each headline, by hiding leading stars, and by only using levels 1, 3,
2589 etc to get two characters indentation for each level.  To get this
2590 support in a file, use
2592 : #+STARTUP: hidestars odd
2594 * Export Setup                                                          :noexport:
2596 #+setupfile: doc-setup.org
2598 #+export_file_name: orgguide.texi
2600 #+texinfo_dir_category: Emacs
2601 #+texinfo_dir_title: Org Guide: (orgguide)
2602 #+texinfo_dir_desc: Abbreviated Org mode manual
2604 * Footnotes
2606 [fn:1] See the variable ~org-special-ctrl-a/e~ to configure special
2607 behavior of {{{kbd(C-a)}}} and {{{kbd(C-e)}}} in headlines.
2609 [fn:2] If you do not want the line to be split, customize the variable
2610 ~org-M-RET-may-split-line~.
2612 [fn:3] See also the variable ~org-show-context-detail~ to decide how
2613 much context is shown around each match.
2615 [fn:4] The corresponding in-buffer setting is =#+STARTUP: logdone=.
2617 [fn:5] The corresponding in-buffer setting is =#+STARTUP:
2618 logenotedone=.
2620 [fn:6] As with all these in-buffer settings, pressing {{{kbd(C-c
2621 C-c)}}} activates any changes in the line.
2623 [fn:7] This is quite different from what is normally understood by
2624 /scheduling a meeting/, which is done in Org by just inserting a time
2625 stamp without keyword.
2627 [fn:8] It will still be listed on that date after it has been marked
2628 as done.  If you do not like this, set the variable
2629 ~org-agenda-skip-scheduled-if-done~.
2631 [fn:9] Using capture templates, you get finer control over capture
2632 locations.  See [[*Capture templates]].
2634 [fn:10] If you need one of these sequences literally, escape the =%=
2635 with a backslash.