orgguide.texi 97 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689
  1. \input texinfo
  2. @c %**start of header
  3. @setfilename ../../info/orgguide
  4. @settitle The compact Org-mode Guide
  5. @include org-version.inc
  6. @c Use proper quote and backtick for code sections in PDF output
  7. @c Cf. Texinfo manual 14.2
  8. @set txicodequoteundirected
  9. @set txicodequotebacktick
  10. @c Version and Contact Info
  11. @set MAINTAINERSITE @uref{http://orgmode.org,maintainers webpage}
  12. @set AUTHOR Carsten Dominik
  13. @set MAINTAINER Carsten Dominik
  14. @set MAINTAINEREMAIL @email{carsten at orgmode dot org}
  15. @set MAINTAINERCONTACT @uref{mailto:carsten at orgmode dot org,contact the maintainer}
  16. @c %**end of header
  17. @finalout
  18. @c Macro definitions
  19. @iftex
  20. @c @hyphenation{time-stamp time-stamps time-stamp-ing time-stamp-ed}
  21. @end iftex
  22. @c Subheadings inside a table.
  23. @macro tsubheading{text}
  24. @ifinfo
  25. @subsubheading \text\
  26. @end ifinfo
  27. @ifnotinfo
  28. @item @b{\text\}
  29. @end ifnotinfo
  30. @end macro
  31. @macro seealso{text}
  32. @noindent @b{Further reading}@*@noindent \text\
  33. @end macro
  34. @copying
  35. Copyright @copyright{} 2010--2013 Free Software Foundation
  36. @quotation
  37. Permission is granted to copy, distribute and/or modify this document
  38. under the terms of the GNU Free Documentation License, Version 1.3 or
  39. any later version published by the Free Software Foundation; with no
  40. Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
  41. and with the Back-Cover Texts as in (a) below. A copy of the license
  42. is included in the section entitled ``GNU Free Documentation License''
  43. in the full Org manual, which is distributed together with the compact
  44. guide.
  45. (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
  46. modify this GNU manual.''
  47. @end quotation
  48. @end copying
  49. @dircategory Emacs
  50. @direntry
  51. * Org Mode Guide: (orgguide). Abbreviated Org-mode Manual
  52. @end direntry
  53. @titlepage
  54. @title The compact Org-mode Guide
  55. @subtitle Release @value{VERSION}
  56. @author by Carsten Dominik
  57. @c The following two commands start the copyright page.
  58. @page
  59. @vskip 0pt plus 1filll
  60. @insertcopying
  61. @end titlepage
  62. @c Output the table of contents at the beginning.
  63. @shortcontents
  64. @ifnottex
  65. @node Top, Introduction, (dir), (dir)
  66. @top Org Mode Guide
  67. @insertcopying
  68. @end ifnottex
  69. @menu
  70. * Introduction:: Getting started
  71. * Document Structure:: A tree works like your brain
  72. * Tables:: Pure magic for quick formatting
  73. * Hyperlinks:: Notes in context
  74. * TODO Items:: Every tree branch can be a TODO item
  75. * Tags:: Tagging headlines and matching sets of tags
  76. * Properties:: Properties
  77. * Dates and Times:: Making items useful for planning
  78. * Capture - Refile - Archive:: The ins and outs for projects
  79. * Agenda Views:: Collecting information into views
  80. * Markup:: Prepare text for rich export
  81. * Exporting:: Sharing and publishing of notes
  82. * Publishing:: Create a web site of linked Org files
  83. * Working With Source Code:: Source code snippets embedded in Org
  84. * Miscellaneous:: All the rest which did not fit elsewhere
  85. * GNU Free Documentation License:: This manual license.
  86. @detailmenu
  87. --- The Detailed Node Listing ---
  88. Introduction
  89. * Preface:: Welcome
  90. * Installation:: How to install a downloaded version of Org
  91. * Activation:: How to activate Org for certain buffers
  92. * Feedback:: Bug reports, ideas, patches etc.
  93. Document Structure
  94. * Outlines:: Org is based on Outline mode
  95. * Headlines:: How to typeset Org tree headlines
  96. * Visibility cycling:: Show and hide, much simplified
  97. * Motion:: Jumping to other headlines
  98. * Structure editing:: Changing sequence and level of headlines
  99. * Sparse trees:: Matches embedded in context
  100. * Plain lists:: Additional structure within an entry
  101. * Footnotes:: How footnotes are defined in Org's syntax
  102. Hyperlinks
  103. * Link format:: How links in Org are formatted
  104. * Internal links:: Links to other places in the current file
  105. * External links:: URL-like links to the world
  106. * Handling links:: Creating, inserting and following
  107. * Targeted links:: Point at a location in a file
  108. TODO Items
  109. * Using TODO states:: Setting and switching states
  110. * Multi-state workflows:: More than just on/off
  111. * Progress logging:: Dates and notes for progress
  112. * Priorities:: Some things are more important than others
  113. * Breaking down tasks:: Splitting a task into manageable pieces
  114. * Checkboxes:: Tick-off lists
  115. Progress logging
  116. * Closing items:: When was this entry marked DONE?
  117. * Tracking TODO state changes:: When did the status change?
  118. Tags
  119. * Tag inheritance:: Tags use the tree structure of the outline
  120. * Setting tags:: How to assign tags to a headline
  121. * Tag groups:: Use one tag to search for several tags
  122. * Tag searches:: Searching for combinations of tags
  123. Dates and Times
  124. * Timestamps:: Assigning a time to a tree entry
  125. * Creating timestamps:: Commands which insert timestamps
  126. * Deadlines and scheduling:: Planning your work
  127. * Clocking work time:: Tracking how long you spend on a task
  128. Capture - Refile - Archive
  129. * Capture:: Capturing new stuff
  130. * Refile and copy:: Moving a tree from one place to another
  131. * Archiving:: What to do with finished projects
  132. Capture
  133. * Setting up a capture location:: Where notes will be stored
  134. * Using capture:: Commands to invoke and terminate capture
  135. * Capture templates:: Define the outline of different note types
  136. Agenda Views
  137. * Agenda files:: Files being searched for agenda information
  138. * Agenda dispatcher:: Keyboard access to agenda views
  139. * Built-in agenda views:: What is available out of the box?
  140. * Agenda commands:: Remote editing of Org trees
  141. * Custom agenda views:: Defining special searches and views
  142. The built-in agenda views
  143. * Weekly/daily agenda:: The calendar page with current tasks
  144. * Global TODO list:: All unfinished action items
  145. * Matching tags and properties:: Structured information with fine-tuned search
  146. * Timeline:: Time-sorted view for single file
  147. * Search view:: Find entries by searching for text
  148. Markup for rich export
  149. * Structural markup elements:: The basic structure as seen by the exporter
  150. * Images and tables:: Images, tables and caption mechanism
  151. * Literal examples:: Source code examples with special formatting
  152. * Include files:: Include additional files into a document
  153. * Embedded @LaTeX{}:: @LaTeX{} can be freely used inside Org documents
  154. Structural markup elements
  155. * Document title:: Where the title is taken from
  156. * Headings and sections:: The document structure as seen by the exporter
  157. * Table of contents:: The if and where of the table of contents
  158. * Paragraphs:: Paragraphs
  159. * Emphasis and monospace:: Bold, italic, etc.
  160. * Comment lines:: What will *not* be exported
  161. Exporting
  162. * Export options:: Per-file export settings
  163. * The export dispatcher:: How to access exporter commands
  164. * ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding
  165. * HTML export:: Exporting to HTML
  166. * @LaTeX{} and PDF export:: Exporting to @LaTeX{}, and processing to PDF
  167. * iCalendar export:: Exporting to iCalendar
  168. Miscellaneous
  169. * Completion:: M-TAB knows what you need
  170. * Clean view:: Getting rid of leading stars in the outline
  171. * MobileOrg:: Org-mode on the iPhone
  172. @end detailmenu
  173. @end menu
  174. @node Introduction, Document Structure, Top, Top
  175. @chapter Introduction
  176. @menu
  177. * Preface:: Welcome
  178. * Installation:: How to install a downloaded version of Org
  179. * Activation:: How to activate Org for certain buffers
  180. * Feedback:: Bug reports, ideas, patches etc.
  181. @end menu
  182. @node Preface, Installation, Introduction, Introduction
  183. @section Preface
  184. Org is a mode for keeping notes, maintaining TODO lists, and doing project
  185. planning with a fast and effective plain-text system. It is also an
  186. authoring and publishing system, and it supports working with source code for
  187. literal programming and reproducible research.
  188. @i{This document is a much compressed derivative of the
  189. @uref{http://orgmode.org/index.html#sec-4_1, comprehensive Org-mode manual}.
  190. It contains all basic features and commands, along with important hints for
  191. customization. It is intended for beginners who would shy back from a 200
  192. page manual because of sheer size.}
  193. @node Installation, Activation, Preface, Introduction
  194. @section Installation
  195. @b{Important:} @i{If you are using a version of Org that is part of the Emacs
  196. distribution or an XEmacs package, please skip this section and go directly
  197. to @ref{Activation}.}
  198. If you have downloaded Org from the Web, either as a distribution @file{.zip}
  199. or @file{.tar} file, or as a Git archive, it is best to run it directly from
  200. the distribution directory. You need to add the @file{lisp} subdirectories
  201. to the Emacs load path. To do this, add the following line to @file{.emacs}:
  202. @smallexample
  203. (setq load-path (cons "~/path/to/orgdir/lisp" load-path))
  204. (setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
  205. @end smallexample
  206. @noindent If you have been using git or a tar ball to get Org, you need to
  207. run the following command to generate autoload information.
  208. command:
  209. @smallexample
  210. make autoloads
  211. @end smallexample
  212. @node Activation, Feedback, Installation, Introduction
  213. @section Activation
  214. Add the following lines to your @file{.emacs} file. The last four lines
  215. define @emph{global} keys for some commands --- please choose suitable keys
  216. yourself.
  217. @smalllisp
  218. ;; The following lines are always needed. Choose your own keys.
  219. (add-hook 'org-mode-hook 'turn-on-font-lock) ; not needed when global-font-lock-mode is on
  220. (global-set-key "\C-cl" 'org-store-link)
  221. (global-set-key "\C-ca" 'org-agenda)
  222. (global-set-key "\C-cb" 'org-iswitchb)
  223. (global-set-key "\C-cc" 'org-capture)
  224. @end smalllisp
  225. Files with extension @samp{.org} will be put into Org mode automatically.
  226. @node Feedback, , Activation, Introduction
  227. @section Feedback
  228. If you find problems with Org, or if you have questions, remarks, or ideas
  229. about it, please mail to the Org mailing list @email{emacs-orgmode@@gnu.org}.
  230. For information on how to submit bug reports, see the main manual.
  231. @node Document Structure, Tables, Introduction, Top
  232. @chapter Document Structure
  233. Org is based on Outline mode and provides flexible commands to
  234. edit the structure of the document.
  235. @menu
  236. * Outlines:: Org is based on Outline mode
  237. * Headlines:: How to typeset Org tree headlines
  238. * Visibility cycling:: Show and hide, much simplified
  239. * Motion:: Jumping to other headlines
  240. * Structure editing:: Changing sequence and level of headlines
  241. * Sparse trees:: Matches embedded in context
  242. * Plain lists:: Additional structure within an entry
  243. * Footnotes:: How footnotes are defined in Org's syntax
  244. @end menu
  245. @node Outlines, Headlines, Document Structure, Document Structure
  246. @section Outlines
  247. Org is implemented on top of Outline mode. Outlines allow a
  248. document to be organized in a hierarchical structure, which (at least
  249. for me) is the best representation of notes and thoughts. An overview
  250. of this structure is achieved by folding (hiding) large parts of the
  251. document to show only the general document structure and the parts
  252. currently being worked on. Org greatly simplifies the use of
  253. outlines by compressing the entire show/hide functionality into a single
  254. command, @command{org-cycle}, which is bound to the @key{TAB} key.
  255. @node Headlines, Visibility cycling, Outlines, Document Structure
  256. @section Headlines
  257. Headlines define the structure of an outline tree. The headlines in
  258. Org start with one or more stars, on the left margin@footnote{See
  259. the variable @code{org-special-ctrl-a/e} to configure special behavior
  260. of @kbd{C-a} and @kbd{C-e} in headlines.}. For example:
  261. @smallexample
  262. * Top level headline
  263. ** Second level
  264. *** 3rd level
  265. some text
  266. *** 3rd level
  267. more text
  268. * Another top level headline
  269. @end smallexample
  270. @noindent Some people find the many stars too noisy and would prefer an
  271. outline that has whitespace followed by a single star as headline
  272. starters. @ref{Clean view}, describes a setup to realize this.
  273. @node Visibility cycling, Motion, Headlines, Document Structure
  274. @section Visibility cycling
  275. Outlines make it possible to hide parts of the text in the buffer.
  276. Org uses just two commands, bound to @key{TAB} and
  277. @kbd{S-@key{TAB}} to change the visibility in the buffer.
  278. @table @kbd
  279. @item @key{TAB}
  280. @emph{Subtree cycling}: Rotate current subtree among the states
  281. @smallexample
  282. ,-> FOLDED -> CHILDREN -> SUBTREE --.
  283. '-----------------------------------'
  284. @end smallexample
  285. When called with a prefix argument (@kbd{C-u @key{TAB}}) or with the shift
  286. key, global cycling is invoked.
  287. @item S-@key{TAB} @r{and} C-u @key{TAB}
  288. @emph{Global cycling}: Rotate the entire buffer among the states
  289. @smallexample
  290. ,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
  291. '--------------------------------------'
  292. @end smallexample
  293. @item C-u C-u C-u @key{TAB}
  294. Show all, including drawers.
  295. @end table
  296. When Emacs first visits an Org file, the global state is set to
  297. OVERVIEW, i.e.@: only the top level headlines are visible. This can be
  298. configured through the variable @code{org-startup-folded}, or on a
  299. per-file basis by adding a startup keyword @code{overview}, @code{content},
  300. @code{showall}, like this:
  301. @smallexample
  302. #+STARTUP: content
  303. @end smallexample
  304. @node Motion, Structure editing, Visibility cycling, Document Structure
  305. @section Motion
  306. The following commands jump to other headlines in the buffer.
  307. @table @kbd
  308. @item C-c C-n
  309. Next heading.
  310. @item C-c C-p
  311. Previous heading.
  312. @item C-c C-f
  313. Next heading same level.
  314. @item C-c C-b
  315. Previous heading same level.
  316. @item C-c C-u
  317. Backward to higher level heading.
  318. @end table
  319. @node Structure editing, Sparse trees, Motion, Document Structure
  320. @section Structure editing
  321. @table @kbd
  322. @item M-@key{RET}
  323. Insert new heading with same level as current. If the cursor is in a plain
  324. list item, a new item is created (@pxref{Plain lists}). When this command is
  325. used in the middle of a line, the line is split and the rest of the line
  326. becomes the new headline@footnote{If you do not want the line to be split,
  327. customize the variable @code{org-M-RET-may-split-line}.}.
  328. @item M-S-@key{RET}
  329. Insert new TODO entry with same level as current heading.
  330. @item @key{TAB} @r{in new, empty entry}
  331. In a new entry with no text yet, @key{TAB} will cycle through reasonable
  332. levels.
  333. @item M-@key{left}@r{/}@key{right}
  334. Promote/demote current heading by one level.
  335. @item M-S-@key{left}@r{/}@key{right}
  336. Promote/demote the current subtree by one level.
  337. @item M-S-@key{up}@r{/}@key{down}
  338. Move subtree up/down (swap with previous/next subtree of same
  339. level).
  340. @item C-c C-w
  341. Refile entry or region to a different location. @xref{Refile and copy}.
  342. @item C-x n s/w
  343. Narrow buffer to current subtree / widen it again
  344. @end table
  345. When there is an active region (Transient Mark mode), promotion and
  346. demotion work on all headlines in the region.
  347. @node Sparse trees, Plain lists, Structure editing, Document Structure
  348. @section Sparse trees
  349. An important feature of Org mode is the ability to construct @emph{sparse
  350. trees} for selected information in an outline tree, so that the entire
  351. document is folded as much as possible, but the selected information is made
  352. visible along with the headline structure above it@footnote{See also the
  353. variables @code{org-show-hierarchy-above}, @code{org-show-following-heading},
  354. @code{org-show-siblings}, and @code{org-show-entry-below} for detailed
  355. control on how much context is shown around each match.}. Just try it out
  356. and you will see immediately how it works.
  357. Org mode contains several commands creating such trees, all these
  358. commands can be accessed through a dispatcher:
  359. @table @kbd
  360. @item C-c /
  361. This prompts for an extra key to select a sparse-tree creating command.
  362. @item C-c / r
  363. Occur. Prompts for a regexp and shows a sparse tree with all matches. Each
  364. match is also highlighted; the highlights disappear by pressing @kbd{C-c C-c}.
  365. @end table
  366. The other sparse tree commands select headings based on TODO keywords,
  367. tags, or properties and will be discussed later in this manual.
  368. @node Plain lists, Footnotes, Sparse trees, Document Structure
  369. @section Plain lists
  370. Within an entry of the outline tree, hand-formatted lists can provide
  371. additional structure. They also provide a way to create lists of
  372. checkboxes (@pxref{Checkboxes}). Org supports editing such lists,
  373. and the HTML exporter (@pxref{Exporting}) parses and formats them.
  374. Org knows ordered lists, unordered lists, and description lists.
  375. @itemize @bullet
  376. @item
  377. @emph{Unordered} list items start with @samp{-}, @samp{+}, or
  378. @samp{*} as bullets.
  379. @item
  380. @emph{Ordered} list items start with @samp{1.} or @samp{1)}.
  381. @item
  382. @emph{Description} list use @samp{ :: } to separate the @emph{term} from the
  383. description.
  384. @end itemize
  385. Items belonging to the same list must have the same indentation on the first
  386. line. An item ends before the next line that is indented like its
  387. bullet/number, or less. A list ends when all items are closed, or before two
  388. blank lines. An example:
  389. @smallexample
  390. @group
  391. ** Lord of the Rings
  392. My favorite scenes are (in this order)
  393. 1. The attack of the Rohirrim
  394. 2. Eowyn's fight with the witch king
  395. + this was already my favorite scene in the book
  396. + I really like Miranda Otto.
  397. Important actors in this film are:
  398. - @b{Elijah Wood} :: He plays Frodo
  399. - @b{Sean Austin} :: He plays Sam, Frodo's friend.
  400. @end group
  401. @end smallexample
  402. The following commands act on items when the cursor is in the first line of
  403. an item (the line with the bullet or number).
  404. @table @kbd
  405. @item @key{TAB}
  406. Items can be folded just like headline levels.
  407. @item M-@key{RET}
  408. Insert new item at current level. With a prefix argument, force a new
  409. heading (@pxref{Structure editing}).
  410. @item M-S-@key{RET}
  411. Insert a new item with a checkbox (@pxref{Checkboxes}).
  412. @item M-S-@key{up}@r{/}@key{down}
  413. Move the item including subitems up/down (swap with previous/next item
  414. of same indentation). If the list is ordered, renumbering is
  415. automatic.
  416. @item M-@key{left}@r{/}M-@key{right}
  417. Decrease/increase the indentation of an item, leaving children alone.
  418. @item M-S-@key{left}@r{/}@key{right}
  419. Decrease/increase the indentation of the item, including subitems.
  420. @item C-c C-c
  421. If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the
  422. state of the checkbox. Also verify bullets and indentation consistency in
  423. the whole list.
  424. @item C-c -
  425. Cycle the entire list level through the different itemize/enumerate bullets
  426. (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}).
  427. @end table
  428. @node Footnotes, , Plain lists, Document Structure
  429. @section Footnotes
  430. A footnote is defined in a paragraph that is started by a footnote marker in
  431. square brackets in column 0, no indentation allowed. The footnote reference
  432. is simply the marker in square brackets, inside text. For example:
  433. @smallexample
  434. The Org homepage[fn:1] now looks a lot better than it used to.
  435. ...
  436. [fn:1] The link is: http://orgmode.org
  437. @end smallexample
  438. @noindent The following commands handle footnotes:
  439. @table @kbd
  440. @item C-c C-x f
  441. The footnote action command. When the cursor is on a footnote reference,
  442. jump to the definition. When it is at a definition, jump to the (first)
  443. reference. Otherwise, create a new footnote. When this command is called
  444. with a prefix argument, a menu of additional options including renumbering is
  445. offered.
  446. @item C-c C-c
  447. Jump between definition and reference.
  448. @end table
  449. @seealso{
  450. @uref{http://orgmode.org/manual/Document-Structure.html#Document-Structure,
  451. Chapter 2 of the manual}@*
  452. @uref{http://sachachua.com/wp/2008/01/outlining-your-notes-with-org/,
  453. Sacha Chua's tutorial}}
  454. @node Tables, Hyperlinks, Document Structure, Top
  455. @chapter Tables
  456. Org comes with a fast and intuitive table editor. Spreadsheet-like
  457. calculations are supported in connection with the Emacs @file{calc}
  458. package
  459. @ifinfo
  460. (@pxref{Top,Calc,,Calc,Gnu Emacs Calculator Manual}).
  461. @end ifinfo
  462. @ifnotinfo
  463. (see the Emacs Calculator manual for more information about the Emacs
  464. calculator).
  465. @end ifnotinfo
  466. Org makes it easy to format tables in plain ASCII. Any line with
  467. @samp{|} as the first non-whitespace character is considered part of a
  468. table. @samp{|} is also the column separator. A table might look like
  469. this:
  470. @smallexample
  471. | Name | Phone | Age |
  472. |-------+-------+-----|
  473. | Peter | 1234 | 17 |
  474. | Anna | 4321 | 25 |
  475. @end smallexample
  476. A table is re-aligned automatically each time you press @key{TAB} or
  477. @key{RET} or @kbd{C-c C-c} inside the table. @key{TAB} also moves to
  478. the next field (@key{RET} to the next row) and creates new table rows
  479. at the end of the table or before horizontal lines. The indentation
  480. of the table is set by the first line. Any line starting with
  481. @samp{|-} is considered as a horizontal separator line and will be
  482. expanded on the next re-align to span the whole table width. So, to
  483. create the above table, you would only type
  484. @smallexample
  485. |Name|Phone|Age|
  486. |-
  487. @end smallexample
  488. @noindent and then press @key{TAB} to align the table and start filling in
  489. fields. Even faster would be to type @code{|Name|Phone|Age} followed by
  490. @kbd{C-c @key{RET}}.
  491. When typing text into a field, Org treats @key{DEL},
  492. @key{Backspace}, and all character keys in a special way, so that
  493. inserting and deleting avoids shifting other fields. Also, when
  494. typing @emph{immediately after the cursor was moved into a new field
  495. with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the
  496. field is automatically made blank.
  497. @table @kbd
  498. @tsubheading{Creation and conversion}
  499. @item C-c |
  500. Convert the active region to table. If every line contains at least one TAB
  501. character, the function assumes that the material is tab separated. If every
  502. line contains a comma, comma-separated values (CSV) are assumed. If not,
  503. lines are split at whitespace into fields.
  504. @*
  505. If there is no active region, this command creates an empty Org
  506. table. But it's easier just to start typing, like
  507. @kbd{|Name|Phone|Age C-c @key{RET}}.
  508. @tsubheading{Re-aligning and field motion}
  509. @item C-c C-c
  510. Re-align the table without moving the cursor.
  511. @c
  512. @item @key{TAB}
  513. Re-align the table, move to the next field. Creates a new row if
  514. necessary.
  515. @c
  516. @item S-@key{TAB}
  517. Re-align, move to previous field.
  518. @c
  519. @item @key{RET}
  520. Re-align the table and move down to next row. Creates a new row if
  521. necessary.
  522. @tsubheading{Column and row editing}
  523. @item M-@key{left}
  524. @itemx M-@key{right}
  525. Move the current column left/right.
  526. @c
  527. @item M-S-@key{left}
  528. Kill the current column.
  529. @c
  530. @item M-S-@key{right}
  531. Insert a new column to the left of the cursor position.
  532. @c
  533. @item M-@key{up}
  534. @itemx M-@key{down}
  535. Move the current row up/down.
  536. @c
  537. @item M-S-@key{up}
  538. Kill the current row or horizontal line.
  539. @c
  540. @item M-S-@key{down}
  541. Insert a new row above the current row. With a prefix argument, the line is
  542. created below the current one.
  543. @c
  544. @item C-c -
  545. Insert a horizontal line below current row. With a prefix argument, the line
  546. is created above the current line.
  547. @c
  548. @item C-c @key{RET}
  549. Insert a horizontal line below current row, and move the cursor into the row
  550. below that line.
  551. @c
  552. @item C-c ^
  553. Sort the table lines in the region. The position of point indicates the
  554. column to be used for sorting, and the range of lines is the range
  555. between the nearest horizontal separator lines, or the entire table.
  556. @end table
  557. @seealso{
  558. @uref{http://orgmode.org/manual/Tables.html#Tables, Chapter 3 of the
  559. manual}@*
  560. @uref{http://orgmode.org/worg/org-tutorials/tables.php, Bastien's
  561. table tutorial}@*
  562. @uref{http://orgmode.org/worg/org-tutorials/org-spreadsheet-intro.php,
  563. Bastien's spreadsheet tutorial}@*
  564. @uref{http://orgmode.org/worg/org-tutorials/org-plot.php, Eric's plotting tutorial}}
  565. @node Hyperlinks, TODO Items, Tables, Top
  566. @chapter Hyperlinks
  567. Like HTML, Org provides links inside a file, external links to
  568. other files, Usenet articles, emails, and much more.
  569. @menu
  570. * Link format:: How links in Org are formatted
  571. * Internal links:: Links to other places in the current file
  572. * External links:: URL-like links to the world
  573. * Handling links:: Creating, inserting and following
  574. * Targeted links:: Point at a location in a file
  575. @end menu
  576. @node Link format, Internal links, Hyperlinks, Hyperlinks
  577. @section Link format
  578. Org will recognize plain URL-like links and activate them as
  579. clickable links. The general link format, however, looks like this:
  580. @smallexample
  581. [[link][description]] @r{or alternatively} [[link]]
  582. @end smallexample
  583. @noindent
  584. Once a link in the buffer is complete (all brackets present), Org will change
  585. the display so that @samp{description} is displayed instead of
  586. @samp{[[link][description]]} and @samp{link} is displayed instead of
  587. @samp{[[link]]}. To edit the invisible @samp{link} part, use @kbd{C-c
  588. C-l} with the cursor on the link.
  589. @node Internal links, External links, Link format, Hyperlinks
  590. @section Internal links
  591. If the link does not look like a URL, it is considered to be internal in the
  592. current file. The most important case is a link like
  593. @samp{[[#my-custom-id]]} which will link to the entry with the
  594. @code{CUSTOM_ID} property @samp{my-custom-id}.
  595. Links such as @samp{[[My Target]]} or @samp{[[My Target][Find my target]]}
  596. lead to a text search in the current file for the corresponding target which
  597. looks like @samp{<<My Target>>}.
  598. Internal links will be used to reference their destination, through links or
  599. numbers, when possible.
  600. @node External links, Handling links, Internal links, Hyperlinks
  601. @section External links
  602. Org supports links to files, websites, Usenet and email messages,
  603. BBDB database entries and links to both IRC conversations and their
  604. logs. External links are URL-like locators. They start with a short
  605. identifying string followed by a colon. There can be no space after
  606. the colon. Here are some examples:
  607. @smallexample
  608. http://www.astro.uva.nl/~dominik @r{on the web}
  609. file:/home/dominik/images/jupiter.jpg @r{file, absolute path}
  610. /home/dominik/images/jupiter.jpg @r{same as above}
  611. file:papers/last.pdf @r{file, relative path}
  612. file:projects.org @r{another Org file}
  613. docview:papers/last.pdf::NNN @r{open file in doc-view mode at page NNN}
  614. id:B7423F4D-2E8A-471B-8810-C40F074717E9 @r{Link to heading by ID}
  615. news:comp.emacs @r{Usenet link}
  616. mailto:adent@@galaxy.net @r{Mail link}
  617. vm:folder @r{VM folder link}
  618. vm:folder#id @r{VM message link}
  619. wl:folder#id @r{WANDERLUST message link}
  620. mhe:folder#id @r{MH-E message link}
  621. rmail:folder#id @r{RMAIL message link}
  622. gnus:group#id @r{Gnus article link}
  623. bbdb:R.*Stallman @r{BBDB link (with regexp)}
  624. irc:/irc.com/#emacs/bob @r{IRC link}
  625. info:org:External%20links @r{Info node link (with encoded space)}
  626. @end smallexample
  627. A link should be enclosed in double brackets and may contain a
  628. descriptive text to be displayed instead of the URL (@pxref{Link
  629. format}), for example:
  630. @smallexample
  631. [[http://www.gnu.org/software/emacs/][GNU Emacs]]
  632. @end smallexample
  633. @noindent
  634. If the description is a file name or URL that points to an image, HTML export
  635. (@pxref{HTML export}) will inline the image as a clickable button. If there
  636. is no description at all and the link points to an image, that image will be
  637. inlined into the exported HTML file.
  638. @node Handling links, Targeted links, External links, Hyperlinks
  639. @section Handling links
  640. Org provides methods to create a link in the correct syntax, to
  641. insert it into an Org file, and to follow the link.
  642. @table @kbd
  643. @item C-c l
  644. Store a link to the current location. This is a @emph{global} command (you
  645. must create the key binding yourself) which can be used in any buffer to
  646. create a link. The link will be stored for later insertion into an Org
  647. buffer (see below).
  648. @c
  649. @item C-c C-l
  650. Insert a link. This prompts for a link to be inserted into the buffer. You
  651. can just type a link, or use history keys @key{up} and @key{down} to access
  652. stored links. You will be prompted for the description part of the link.
  653. When called with a @kbd{C-u} prefix argument, file name completion is used to
  654. link to a file.
  655. @c
  656. @item C-c C-l @r{(with cursor on existing link)}
  657. When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
  658. link and description parts of the link.
  659. @c
  660. @item C-c C-o @r{or} mouse-1 @r{or} mouse-2
  661. Open link at point.
  662. @item C-c &
  663. Jump back to a recorded position. A position is recorded by the
  664. commands following internal links, and by @kbd{C-c %}. Using this
  665. command several times in direct succession moves through a ring of
  666. previously recorded positions.
  667. @c
  668. @end table
  669. @node Targeted links, , Handling links, Hyperlinks
  670. @section Targeted links
  671. File links can contain additional information to make Emacs jump to a
  672. particular location in the file when following a link. This can be a
  673. line number or a search option after a double colon.
  674. Here is the syntax of the different ways to attach a search to a file
  675. link, together with an explanation:
  676. @smallexample
  677. [[file:~/code/main.c::255]] @r{Find line 255}
  678. [[file:~/xx.org::My Target]] @r{Find @samp{<<My Target>>}}
  679. [[file:~/xx.org::#my-custom-id]] @r{Find entry with custom id}
  680. @end smallexample
  681. @seealso{
  682. @uref{http://orgmode.org/manual/Hyperlinks.html#Hyperlinks, Chapter 4 of the
  683. manual}}
  684. @node TODO Items, Tags, Hyperlinks, Top
  685. @chapter TODO Items
  686. Org mode does not require TODO lists to live in separate documents. Instead,
  687. TODO items are part of a notes file, because TODO items usually
  688. come up while taking notes! With Org mode, simply mark any entry in a tree
  689. as being a TODO item. In this way, information is not duplicated, and TODO
  690. items remain in the context from which they emerged.
  691. Org mode providing methods to give you an overview of all the things that you
  692. have to do, collected from many files.
  693. @menu
  694. * Using TODO states:: Setting and switching states
  695. * Multi-state workflows:: More than just on/off
  696. * Progress logging:: Dates and notes for progress
  697. * Priorities:: Some things are more important than others
  698. * Breaking down tasks:: Splitting a task into manageable pieces
  699. * Checkboxes:: Tick-off lists
  700. @end menu
  701. @node Using TODO states, Multi-state workflows, TODO Items, TODO Items
  702. @section Using TODO states
  703. Any headline becomes a TODO item when it starts with the word
  704. @samp{TODO}, for example:
  705. @smallexample
  706. *** TODO Write letter to Sam Fortune
  707. @end smallexample
  708. @noindent
  709. The most important commands to work with TODO entries are:
  710. @table @kbd
  711. @item C-c C-t
  712. Rotate the TODO state of the current item among
  713. @smallexample
  714. (unmarked) -> TODO -> DONE -> (unmarked)
  715. @end smallexample
  716. The same rotation can also be done ``remotely'' from the timeline and
  717. agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
  718. @item S-@key{right}@r{/}@key{left}
  719. Select the following/preceding TODO state, similar to cycling.
  720. @item C-c / t
  721. View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}). Folds the
  722. buffer, but shows all TODO items and the headings hierarchy above
  723. them.
  724. @item C-c a t
  725. Show the global TODO list. Collects the TODO items from all agenda files
  726. (@pxref{Agenda Views}) into a single buffer. @xref{Global TODO list}, for
  727. more information.
  728. @item S-M-@key{RET}
  729. Insert a new TODO entry below the current one.
  730. @end table
  731. @noindent
  732. Changing a TODO state can also trigger tag changes. See the docstring of the
  733. option @code{org-todo-state-tags-triggers} for details.
  734. @node Multi-state workflows, Progress logging, Using TODO states, TODO Items
  735. @section Multi-state workflows
  736. You can use TODO keywords to indicate @emph{sequential} working progress
  737. states:
  738. @smalllisp
  739. (setq org-todo-keywords
  740. '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
  741. @end smalllisp
  742. The vertical bar separates the TODO keywords (states that @emph{need action})
  743. from the DONE states (which need @emph{no further action}). If you don't
  744. provide the separator bar, the last state is used as the DONE state. With
  745. this setup, the command @kbd{C-c C-t} will cycle an entry from TODO to
  746. FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED. Sometimes you
  747. may want to use different sets of TODO keywords in parallel. For example,
  748. you may want to have the basic @code{TODO}/@code{DONE}, but also a workflow
  749. for bug fixing. Your setup would then look like this:
  750. @smalllisp
  751. (setq org-todo-keywords
  752. '((sequence "TODO(t)" "|" "DONE(d)")
  753. (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)")))
  754. @end smalllisp
  755. The keywords should all be different, this helps Org mode to keep track of
  756. which subsequence should be used for a given entry. The example also shows
  757. how to define keys for fast access of a particular state, by adding a letter
  758. in parenthesis after each keyword---you will be prompted for the key after
  759. @kbd{C-c C-t}.
  760. To define TODO keywords that are valid only in a single file, use the
  761. following text anywhere in the file.
  762. @smallexample
  763. #+TODO: TODO(t) | DONE(d)
  764. #+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f)
  765. #+TODO: | CANCELED(c)
  766. @end smallexample
  767. After changing one of these lines, use @kbd{C-c C-c} with the cursor still in
  768. the line to make the changes known to Org mode.
  769. @node Progress logging, Priorities, Multi-state workflows, TODO Items
  770. @section Progress logging
  771. Org mode can automatically record a timestamp and possibly a note when
  772. you mark a TODO item as DONE, or even each time you change the state of
  773. a TODO item. This system is highly configurable; settings can be on a
  774. per-keyword basis and can be localized to a file or even a subtree. For
  775. information on how to clock working time for a task, see @ref{Clocking
  776. work time}.
  777. @menu
  778. * Closing items:: When was this entry marked DONE?
  779. * Tracking TODO state changes:: When did the status change?
  780. @end menu
  781. @node Closing items, Tracking TODO state changes, Progress logging, Progress logging
  782. @unnumberedsubsec Closing items
  783. The most basic logging is to keep track of @emph{when} a certain TODO
  784. item was finished. This is achieved with@footnote{The corresponding
  785. in-buffer setting is: @code{#+STARTUP: logdone}}.
  786. @smalllisp
  787. (setq org-log-done 'time)
  788. @end smalllisp
  789. @noindent
  790. Then each time you turn an entry from a TODO (not-done) state into any of the
  791. DONE states, a line @samp{CLOSED: [timestamp]} will be inserted just after
  792. the headline. If you want to record a note along with the timestamp,
  793. use@footnote{The corresponding in-buffer setting is: @code{#+STARTUP:
  794. lognotedone}}
  795. @smalllisp
  796. (setq org-log-done 'note)
  797. @end smalllisp
  798. @noindent
  799. You will then be prompted for a note, and that note will be stored below
  800. the entry with a @samp{Closing Note} heading.
  801. @node Tracking TODO state changes, , Closing items, Progress logging
  802. @unnumberedsubsec Tracking TODO state changes
  803. You might want to keep track of TODO state changes. You can either record
  804. just a timestamp, or a time-stamped note for a change. These records will be
  805. inserted after the headline as an itemized list. When taking a lot of notes,
  806. you might want to get the notes out of the way into a drawer. Customize the
  807. variable @code{org-log-into-drawer} to get this behavior.
  808. For state logging, Org mode expects configuration on a per-keyword basis.
  809. This is achieved by adding special markers @samp{!} (for a timestamp) and
  810. @samp{@@} (for a note) in parentheses after each keyword. For example:
  811. @smallexample
  812. #+TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@)
  813. @end smallexample
  814. @noindent
  815. will define TODO keywords and fast access keys, and also request that a time
  816. is recorded when the entry is set to DONE, and that a note is recorded when
  817. switching to WAIT or CANCELED. The same syntax works also when setting
  818. @code{org-todo-keywords}.
  819. @node Priorities, Breaking down tasks, Progress logging, TODO Items
  820. @section Priorities
  821. If you use Org mode extensively, you may end up with enough TODO items that
  822. it starts to make sense to prioritize them. Prioritizing can be done by
  823. placing a @emph{priority cookie} into the headline of a TODO item, like this
  824. @smallexample
  825. *** TODO [#A] Write letter to Sam Fortune
  826. @end smallexample
  827. @noindent
  828. Org mode supports three priorities: @samp{A}, @samp{B}, and @samp{C}.
  829. @samp{A} is the highest, @samp{B} the default if none is given. Priorities
  830. make a difference only in the agenda.
  831. @table @kbd
  832. @item @kbd{C-c ,}
  833. Set the priority of the current headline. Press @samp{A}, @samp{B} or
  834. @samp{C} to select a priority, or @key{SPC} to remove the cookie.
  835. @c
  836. @item S-@key{up}/@key{dwn}
  837. Increase/decrease priority of current headline
  838. @end table
  839. @node Breaking down tasks, Checkboxes, Priorities, TODO Items
  840. @section Breaking tasks down into subtasks
  841. It is often advisable to break down large tasks into smaller, manageable
  842. subtasks. You can do this by creating an outline tree below a TODO item,
  843. with detailed subtasks on the tree. To keep the overview over the fraction
  844. of subtasks that are already completed, insert either @samp{[/]} or
  845. @samp{[%]} anywhere in the headline. These cookies will be updated each time
  846. the TODO status of a child changes, or when pressing @kbd{C-c C-c} on the
  847. cookie. For example:
  848. @smallexample
  849. * Organize Party [33%]
  850. ** TODO Call people [1/2]
  851. *** TODO Peter
  852. *** DONE Sarah
  853. ** TODO Buy food
  854. ** DONE Talk to neighbor
  855. @end smallexample
  856. @node Checkboxes, , Breaking down tasks, TODO Items
  857. @section Checkboxes
  858. Every item in a plain list (@pxref{Plain lists}) can be made into a checkbox
  859. by starting it with the string @samp{[ ]}. Checkboxes are not included in
  860. the global TODO list, so they are often great to split a task into a number
  861. of simple steps.
  862. Here is an example of a checkbox list.
  863. @smallexample
  864. * TODO Organize party [1/3]
  865. - [-] call people [1/2]
  866. - [ ] Peter
  867. - [X] Sarah
  868. - [X] order food
  869. @end smallexample
  870. Checkboxes work hierarchically, so if a checkbox item has children that
  871. are checkboxes, toggling one of the children checkboxes will make the
  872. parent checkbox reflect if none, some, or all of the children are
  873. checked.
  874. @noindent The following commands work with checkboxes:
  875. @table @kbd
  876. @item C-c C-c
  877. Toggle checkbox status or (with prefix arg) checkbox presence at point.
  878. @item M-S-@key{RET}
  879. Insert a new item with a checkbox.
  880. This works only if the cursor is already in a plain list item
  881. (@pxref{Plain lists}).
  882. @end table
  883. @seealso{
  884. @uref{http://orgmode.org/manual/TODO-Items.html#TODO-Items, Chapter 5 of the manual}@*
  885. @uref{http://orgmode.org/worg/org-tutorials/orgtutorial_dto.php, David
  886. O'Toole's introductory tutorial}@*
  887. @uref{http://members.optusnet.com.au/~charles57/GTD/gtd_workflow.html,
  888. Charles Cave's GTD setup}}
  889. @node Tags, Properties, TODO Items, Top
  890. @chapter Tags
  891. An excellent way to implement labels and contexts for cross-correlating
  892. information is to assign @i{tags} to headlines. Org mode has extensive
  893. support for tags.
  894. Every headline can contain a list of tags; they occur at the end of the
  895. headline. Tags are normal words containing letters, numbers, @samp{_}, and
  896. @samp{@@}. Tags must be preceded and followed by a single colon, e.g.,
  897. @samp{:work:}. Several tags can be specified, as in @samp{:work:urgent:}.
  898. Tags will by default be in bold face with the same color as the headline.
  899. @menu
  900. * Tag inheritance:: Tags use the tree structure of the outline
  901. * Setting tags:: How to assign tags to a headline
  902. * Tag groups:: Use one tag to search for several tags
  903. * Tag searches:: Searching for combinations of tags
  904. @end menu
  905. @node Tag inheritance, Setting tags, Tags, Tags
  906. @section Tag inheritance
  907. @i{Tags} make use of the hierarchical structure of outline trees. If a
  908. heading has a certain tag, all subheadings will inherit the tag as
  909. well. For example, in the list
  910. @smallexample
  911. * Meeting with the French group :work:
  912. ** Summary by Frank :boss:notes:
  913. *** TODO Prepare slides for him :action:
  914. @end smallexample
  915. @noindent
  916. the final heading will have the tags @samp{:work:}, @samp{:boss:},
  917. @samp{:notes:}, and @samp{:action:} even though the final heading is not
  918. explicitly marked with those tags. You can also set tags that all entries in
  919. a file should inherit just as if these tags were defined in a hypothetical
  920. level zero that surrounds the entire file. Use a line like this@footnote{As
  921. with all these in-buffer settings, pressing @kbd{C-c C-c} activates any
  922. changes in the line.}:
  923. @smallexample
  924. #+FILETAGS: :Peter:Boss:Secret:
  925. @end smallexample
  926. @node Setting tags, Tag groups, Tag inheritance, Tags
  927. @section Setting tags
  928. Tags can simply be typed into the buffer at the end of a headline.
  929. After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is
  930. also a special command for inserting tags:
  931. @table @kbd
  932. @item C-c C-q
  933. Enter new tags for the current headline. Org mode will either offer
  934. completion or a special single-key interface for setting tags, see
  935. below. After pressing @key{RET}, the tags will be inserted and aligned
  936. to @code{org-tags-column}. When called with a @kbd{C-u} prefix, all
  937. tags in the current buffer will be aligned to that column, just to make
  938. things look nice.
  939. @item C-c C-c
  940. When the cursor is in a headline, this does the same as @kbd{C-c C-q}.
  941. @end table
  942. Org will support tag insertion based on a @emph{list of tags}. By
  943. default this list is constructed dynamically, containing all tags
  944. currently used in the buffer. You may also globally specify a hard list
  945. of tags with the variable @code{org-tag-alist}. Finally you can set
  946. the default tags for a given file with lines like
  947. @smallexample
  948. #+TAGS: @@work @@home @@tennisclub
  949. #+TAGS: laptop car pc sailboat
  950. @end smallexample
  951. By default Org mode uses the standard minibuffer completion facilities for
  952. entering tags. However, it also implements another, quicker, tag selection
  953. method called @emph{fast tag selection}. This allows you to select and
  954. deselect tags with just a single key press. For this to work well you should
  955. assign unique letters to most of your commonly used tags. You can do this
  956. globally by configuring the variable @code{org-tag-alist} in your
  957. @file{.emacs} file. For example, you may find the need to tag many items in
  958. different files with @samp{:@@home:}. In this case you can set something
  959. like:
  960. @smalllisp
  961. (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l)))
  962. @end smalllisp
  963. @noindent If the tag is only relevant to the file you are working on, then you
  964. can instead set the TAGS option line as:
  965. @smallexample
  966. #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p)
  967. @end smallexample
  968. @node Tag groups, Tag searches, Setting tags, Tags
  969. @section Tag groups
  970. @cindex group tags
  971. @cindex tags, groups
  972. In a set of mutually exclusive tags, the first tag can be defined as a
  973. @emph{group tag}. When you search for a group tag, it will return matches
  974. for all members in the group. In an agenda view, filtering by a group tag
  975. will display headlines tagged with at least one of the members of the
  976. group. This makes tag searches and filters even more flexible.
  977. You can set group tags by inserting a colon between the group tag and other
  978. tags, like this:
  979. @example
  980. #+TAGS: @{ @@read : @@read_book @@read_ebook @}
  981. @end example
  982. In this example, @samp{@@read} is a @emph{group tag} for a set of three
  983. tags: @samp{@@read}, @samp{@@read_book} and @samp{@@read_ebook}.
  984. You can also use the @code{:grouptags} keyword directly when setting
  985. @var{org-tag-alist}, see the documentation of that variable.
  986. @kindex C-c C-x q
  987. @vindex org-group-tags
  988. If you want to ignore group tags temporarily, toggle group tags support
  989. with @command{org-toggle-tags-groups}, bound to @kbd{C-c C-x q}. If you
  990. want to disable tag groups completely, set @var{org-group-tags} to nil.
  991. @node Tag searches, , Tag groups, Tags
  992. @section Tag searches
  993. Once a system of tags has been set up, it can be used to collect related
  994. information into special lists.
  995. @table @kbd
  996. @item C-c \
  997. @itemx C-c / m
  998. Create a sparse tree with all headlines matching a tags search. With a
  999. @kbd{C-u} prefix argument, ignore headlines that are not a TODO line.
  1000. @item C-c a m
  1001. Create a global list of tag matches from all agenda files.
  1002. @xref{Matching tags and properties}.
  1003. @item C-c a M
  1004. Create a global list of tag matches from all agenda files, but check
  1005. only TODO items and force checking subitems (see variable
  1006. @code{org-tags-match-list-sublevels}).
  1007. @end table
  1008. These commands all prompt for a match string which allows basic Boolean logic
  1009. like @samp{+boss+urgent-project1}, to find entries with tags @samp{boss} and
  1010. @samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find entries
  1011. which are tagged, like @samp{Kathy} or @samp{Sally}. The full syntax of the
  1012. search string is rich and allows also matching against TODO keywords, entry
  1013. levels and properties. For a complete description with many examples, see
  1014. @ref{Matching tags and properties}.
  1015. @seealso{
  1016. @uref{http://orgmode.org/manual/Tags.html#Tags, Chapter 6 of the manual}@*
  1017. @uref{http://sachachua.com/wp/2008/01/tagging-in-org-plus-bonus-code-for-timeclocks-and-tags/,
  1018. Sacha Chua's article about tagging in Org-mode}}
  1019. @node Properties, Dates and Times, Tags, Top
  1020. @chapter Properties
  1021. Properties are key-value pairs associated with an entry. They live in a
  1022. special drawer with the name @code{PROPERTIES}. Each
  1023. property is specified on a single line, with the key (surrounded by colons)
  1024. first, and the value after it:
  1025. @smallexample
  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 smallexample
  1036. You may define the allowed values for a particular property @samp{:Xyz:}
  1037. by setting a property @samp{:Xyz_ALL:}. This special property is
  1038. @emph{inherited}, so if you set it in a level 1 entry, it will apply to
  1039. the entire tree. When allowed values are defined, setting the
  1040. corresponding property becomes easier and is less prone to typing
  1041. errors. For the example with the CD collection, we can predefine
  1042. publishers and the number of disks in a box like this:
  1043. @smallexample
  1044. * CD collection
  1045. :PROPERTIES:
  1046. :NDisks_ALL: 1 2 3 4
  1047. :Publisher_ALL: "Deutsche Grammophon" Philips EMI
  1048. :END:
  1049. @end smallexample
  1050. or globally using @code{org-global-properties}, or file-wide like this:
  1051. @smallexample
  1052. #+PROPERTY: NDisks_ALL 1 2 3 4
  1053. @end smallexample
  1054. @table @kbd
  1055. @item C-c C-x p
  1056. Set a property. This prompts for a property name and a value.
  1057. @item C-c C-c d
  1058. Remove a property from the current entry.
  1059. @end table
  1060. To create sparse trees and special lists with selection based on properties,
  1061. the same commands are used as for tag searches (@pxref{Tag searches}). The
  1062. syntax for the search string is described in @ref{Matching tags and
  1063. properties}.
  1064. @table @kbd
  1065. @end table
  1066. @seealso{
  1067. @uref{http://orgmode.org/manual/Properties-and-Columns.html#Properties-and-Columns,
  1068. Chapter 7 of the manual}@*
  1069. @uref{http://orgmode.org/worg/org-tutorials/org-column-view-tutorial.php,Bastien
  1070. Guerry's column view tutorial}}
  1071. @node Dates and Times, Capture - Refile - Archive, Properties, Top
  1072. @chapter Dates and Times
  1073. To assist project planning, TODO items can be labeled with a date and/or
  1074. a time. The specially formatted string carrying the date and time
  1075. information is called a @emph{timestamp} in Org mode.
  1076. @menu
  1077. * Timestamps:: Assigning a time to a tree entry
  1078. * Creating timestamps:: Commands which insert timestamps
  1079. * Deadlines and scheduling:: Planning your work
  1080. * Clocking work time:: Tracking how long you spend on a task
  1081. @end menu
  1082. @node Timestamps, Creating timestamps, Dates and Times, Dates and Times
  1083. @section Timestamps
  1084. A timestamp is a specification of a date (possibly with a time or a range of
  1085. times) in a special format, either @samp{<2003-09-16 Tue>} or
  1086. @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue 12:00-12:30>}. A
  1087. timestamp can appear anywhere in the headline or body of an Org tree entry.
  1088. Its presence causes entries to be shown on specific dates in the agenda
  1089. (@pxref{Weekly/daily agenda}). We distinguish:
  1090. @noindent @b{Plain timestamp; Event; Appointment}@*
  1091. A simple timestamp just assigns a date/time to an item. This is just
  1092. like writing down an appointment or event in a paper agenda.
  1093. @smallexample
  1094. * Meet Peter at the movies
  1095. <2006-11-01 Wed 19:15>
  1096. * Discussion on climate change
  1097. <2006-11-02 Thu 20:00-22:00>
  1098. @end smallexample
  1099. @noindent @b{Timestamp with repeater interval}@*
  1100. A timestamp may contain a @emph{repeater interval}, indicating that it
  1101. applies not only on the given date, but again and again after a certain
  1102. interval of N days (d), weeks (w), months (m), or years (y). The
  1103. following will show up in the agenda every Wednesday:
  1104. @smallexample
  1105. * Pick up Sam at school
  1106. <2007-05-16 Wed 12:30 +1w>
  1107. @end smallexample
  1108. @noindent @b{Diary-style sexp entries}@*
  1109. For more complex date specifications, Org mode supports using the
  1110. special sexp diary entries implemented in the Emacs calendar/diary
  1111. package. For example
  1112. @smallexample
  1113. * The nerd meeting on every 2nd Thursday of the month
  1114. <%%(diary-float t 4 2)>
  1115. @end smallexample
  1116. @noindent @b{Time/Date range}@*
  1117. Two timestamps connected by @samp{--} denote a range.
  1118. @smallexample
  1119. ** Meeting in Amsterdam
  1120. <2004-08-23 Mon>--<2004-08-26 Thu>
  1121. @end smallexample
  1122. @noindent @b{Inactive timestamp}@*
  1123. Just like a plain timestamp, but with square brackets instead of
  1124. angular ones. These timestamps are inactive in the sense that they do
  1125. @emph{not} trigger an entry to show up in the agenda.
  1126. @smallexample
  1127. * Gillian comes late for the fifth time
  1128. [2006-11-01 Wed]
  1129. @end smallexample
  1130. @node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times
  1131. @section Creating timestamps
  1132. For Org mode to recognize timestamps, they need to be in the specific
  1133. format. All commands listed below produce timestamps in the correct
  1134. format.
  1135. @table @kbd
  1136. @item C-c .
  1137. Prompt for a date and insert a corresponding timestamp. When the cursor is
  1138. at an existing timestamp in the buffer, the command is used to modify this
  1139. timestamp instead of inserting a new one. When this command is used twice in
  1140. succession, a time range is inserted. With a prefix, also add the current
  1141. time.
  1142. @c
  1143. @item C-c !
  1144. Like @kbd{C-c .}, but insert an inactive timestamp that will not cause
  1145. an agenda entry.
  1146. @c
  1147. @item S-@key{left}@r{/}@key{right}
  1148. Change date at cursor by one day.
  1149. @c
  1150. @item S-@key{up}@r{/}@key{down}
  1151. Change the item under the cursor in a timestamp. The cursor can be on a
  1152. year, month, day, hour or minute. When the timestamp contains a time range
  1153. like @samp{15:30-16:30}, modifying the first time will also shift the second,
  1154. shifting the time block with constant length. To change the length, modify
  1155. the second time.
  1156. @end table
  1157. When Org mode prompts for a date/time, it will accept any string containing
  1158. some date and/or time information, and intelligently interpret the string,
  1159. deriving defaults for unspecified information from the current date and time.
  1160. You can also select a date in the pop-up calendar. See the manual for more
  1161. information on how exactly the date/time prompt works.
  1162. @node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times
  1163. @section Deadlines and scheduling
  1164. A timestamp may be preceded by special keywords to facilitate planning:
  1165. @noindent @b{DEADLINE}@*
  1166. Meaning: the task (most likely a TODO item, though not necessarily) is supposed
  1167. to be finished on that date.
  1168. @table @kbd
  1169. @item C-c C-d
  1170. Insert @samp{DEADLINE} keyword along with a stamp, in the line following the
  1171. headline.
  1172. @end table
  1173. On the deadline date, the task will be listed in the agenda. In
  1174. addition, the agenda for @emph{today} will carry a warning about the
  1175. approaching or missed deadline, starting
  1176. @code{org-deadline-warning-days} before the due date, and continuing
  1177. until the entry is marked DONE. An example:
  1178. @smallexample
  1179. *** TODO write article about the Earth for the Guide
  1180. The editor in charge is [[bbdb:Ford Prefect]]
  1181. DEADLINE: <2004-02-29 Sun>
  1182. @end smallexample
  1183. @noindent @b{SCHEDULED}@*
  1184. Meaning: you are @i{planning to start working} on that task on the given
  1185. date@footnote{This is quite different from what is normally understood by
  1186. @i{scheduling a meeting}, which is done in Org-mode by just inserting a time
  1187. stamp without keyword.}.
  1188. @table @kbd
  1189. @item C-c C-s
  1190. Insert @samp{SCHEDULED} keyword along with a stamp, in the line following the
  1191. headline.
  1192. @end table
  1193. The headline will be listed under the given date@footnote{It will still
  1194. be listed on that date after it has been marked DONE. If you don't like
  1195. this, set the variable @code{org-agenda-skip-scheduled-if-done}.}. In
  1196. addition, a reminder that the scheduled date has passed will be present
  1197. in the compilation for @emph{today}, until the entry is marked DONE.
  1198. I.e.@: the task will automatically be forwarded until completed.
  1199. @smallexample
  1200. *** TODO Call Trillian for a date on New Years Eve.
  1201. SCHEDULED: <2004-12-25 Sat>
  1202. @end smallexample
  1203. Some tasks need to be repeated again and again. Org mode helps to
  1204. organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED,
  1205. or plain timestamp. In the following example
  1206. @smallexample
  1207. ** TODO Pay the rent
  1208. DEADLINE: <2005-10-01 Sat +1m>
  1209. @end smallexample
  1210. @noindent
  1211. the @code{+1m} is a repeater; the intended interpretation is that the task
  1212. has a deadline on <2005-10-01> and repeats itself every (one) month starting
  1213. from that time.
  1214. @node Clocking work time, , Deadlines and scheduling, Dates and Times
  1215. @section Clocking work time
  1216. Org mode allows you to clock the time you spend on specific tasks in a
  1217. project.
  1218. @table @kbd
  1219. @item C-c C-x C-i
  1220. Start the clock on the current item (clock-in). This inserts the CLOCK
  1221. keyword together with a timestamp. When called with a @kbd{C-u} prefix
  1222. argument, select the task from a list of recently clocked tasks.
  1223. @c
  1224. @item C-c C-x C-o
  1225. Stop the clock (clock-out). This inserts another timestamp at the same
  1226. location where the clock was last started. It also directly computes
  1227. the resulting time in inserts it after the time range as @samp{=>
  1228. HH:MM}.
  1229. @item C-c C-x C-e
  1230. Update the effort estimate for the current clock task.
  1231. @item C-c C-x C-x
  1232. Cancel the current clock. This is useful if a clock was started by
  1233. mistake, or if you ended up working on something else.
  1234. @item C-c C-x C-j
  1235. Jump to the entry that contains the currently running clock. With a
  1236. @kbd{C-u} prefix arg, select the target task from a list of recently clocked
  1237. tasks.
  1238. @item C-c C-x C-r
  1239. Insert a dynamic block containing a clock
  1240. report as an Org-mode table into the current file. When the cursor is
  1241. at an existing clock table, just update it.
  1242. @smallexample
  1243. #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
  1244. #+END: clocktable
  1245. @end smallexample
  1246. @noindent
  1247. For details about how to customize this view, see @uref{http://orgmode.org/manual/Clocking-work-time.html#Clocking-work-time,the manual}.
  1248. @item C-c C-c
  1249. Update dynamic block at point. The cursor needs to be in the
  1250. @code{#+BEGIN} line of the dynamic block.
  1251. @end table
  1252. The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in
  1253. the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
  1254. worked on or closed during a day.
  1255. @seealso{
  1256. @uref{http://orgmode.org/manual/Dates-and-Times.html#Dates-and-Times,
  1257. Chapter 8 of the manual}@*
  1258. @uref{http://members.optusnet.com.au/~charles57/GTD/org_dates/, Charles
  1259. Cave's Date and Time tutorial}@*
  1260. @uref{http://doc.norang.ca/org-mode.html#Clocking, Bernt Hansen's clocking workflow}}
  1261. @node Capture - Refile - Archive, Agenda Views, Dates and Times, Top
  1262. @chapter Capture - Refile - Archive
  1263. An important part of any organization system is the ability to quickly
  1264. capture new ideas and tasks, and to associate reference material with them.
  1265. Org defines a capture process to create tasks. Once in the system, tasks and
  1266. projects need to be moved around. Moving completed project trees to an
  1267. archive file keeps the system compact and fast.
  1268. @menu
  1269. * Capture:: Capturing new stuff
  1270. * Refile and copy:: Moving a tree from one place to another
  1271. * Archiving:: What to do with finished projects
  1272. @end menu
  1273. @node Capture, Refile and copy, Capture - Refile - Archive, Capture - Refile - Archive
  1274. @section Capture
  1275. Org's lets you store quick notes with little interruption of your work flow.
  1276. You can define templates for new entries and associate them with different
  1277. targets for storing notes.
  1278. @menu
  1279. * Setting up a capture location:: Where notes will be stored
  1280. * Using capture:: Commands to invoke and terminate capture
  1281. * Capture templates:: Define the outline of different note types
  1282. @end menu
  1283. @node Setting up a capture location, Using capture, Capture, Capture
  1284. @unnumberedsubsec Setting up a capture location
  1285. The following customization sets a default target@footnote{Using capture
  1286. templates, you get finer control over capture locations, see
  1287. @ref{Capture templates}.} file for notes, and defines a global
  1288. key for capturing new stuff.
  1289. @example
  1290. (setq org-default-notes-file (concat org-directory "/notes.org"))
  1291. (define-key global-map "\C-cc" 'org-capture)
  1292. @end example
  1293. @node Using capture, Capture templates, Setting up a capture location, Capture
  1294. @unnumberedsubsec Using capture
  1295. @table @kbd
  1296. @item C-c c
  1297. Start a capture process, placing you into a narrowed indirect buffer to edit.
  1298. @item C-c C-c
  1299. Once you are done entering information into the capture buffer,
  1300. @kbd{C-c C-c} will return you to the window configuration before the capture
  1301. process, so that you can resume your work without further distraction.
  1302. @item C-c C-w
  1303. Finalize by moving the entry to a refile location (see section 9.2).
  1304. @item C-c C-k
  1305. Abort the capture process and return to the previous state.
  1306. @end table
  1307. @node Capture templates, , Using capture, Capture
  1308. @unnumberedsubsec Capture templates
  1309. You can use templates to generate different types of capture notes, and to
  1310. store them in different places. For example, if you would like
  1311. to store new tasks under a heading @samp{Tasks} in file @file{TODO.org}, and
  1312. journal entries in a date tree in @file{journal.org} you could
  1313. use:
  1314. @smallexample
  1315. (setq org-capture-templates
  1316. '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks")
  1317. "* TODO %?\n %i\n %a")
  1318. ("j" "Journal" entry (file+datetree "~/org/journal.org")
  1319. "* %?\nEntered on %U\n %i\n %a")))
  1320. @end smallexample
  1321. @noindent In these entries, the first string is the key to reach the
  1322. template, the second is a short description. Then follows the type of the
  1323. entry and a definition of the target location for storing the note. Finally,
  1324. the template itself, a string with %-escapes to fill in information based on
  1325. time and context.
  1326. When you call @kbd{M-x org-capture}, Org will prompt for a key to select the
  1327. template (if you have more than one template) and then prepare the buffer like
  1328. @smallexample
  1329. * TODO
  1330. [[file:@var{link to where you were when initiating capture}]]
  1331. @end smallexample
  1332. @noindent
  1333. During expansion of the template, special @kbd{%}-escapes@footnote{If you
  1334. need one of these sequences literally, escape the @kbd{%} with a backslash.}
  1335. allow dynamic insertion of content. Here is a small selection of the
  1336. possibilities, consult the manual for more.
  1337. @smallexample
  1338. %a @r{annotation, normally the link created with @code{org-store-link}}
  1339. %i @r{initial content, the region when capture is called with C-u.}
  1340. %t, %T @r{timestamp, date only, or date and time}
  1341. %u, %U @r{like above, but inactive timestamps}
  1342. @end smallexample
  1343. @node Refile and copy, Archiving, Capture, Capture - Refile - Archive
  1344. @section Refile and copy
  1345. When reviewing the captured data, you may want to refile or copy some of the
  1346. entries into a different list, for example into a project. Cutting, finding
  1347. the right location, and then pasting the note is cumbersome. To simplify
  1348. this process, use the following commands:
  1349. @table @kbd
  1350. @item C-c M-x
  1351. Copy the entry or region at point. This command behaves like
  1352. @code{org-refile}, except that the original note will not be deleted.
  1353. @item C-c C-w
  1354. Refile the entry or region at point. This command offers possible locations
  1355. for refiling the entry and lets you select one with completion. The item (or
  1356. all items in the region) is filed below the target heading as a subitem.@*
  1357. By default, all level 1 headlines in the current buffer are considered to be
  1358. targets, but you can have more complex definitions across a number of files.
  1359. See the variable @code{org-refile-targets} for details.
  1360. @item C-u C-c C-w
  1361. Use the refile interface to jump to a heading.
  1362. @item C-u C-u C-c C-w
  1363. Jump to the location where @code{org-refile} last moved a tree to.
  1364. @end table
  1365. @node Archiving, , Refile and copy, Capture - Refile - Archive
  1366. @section Archiving
  1367. When a project represented by a (sub)tree is finished, you may want
  1368. to move the tree out of the way and to stop it from contributing to the
  1369. agenda. Archiving is important to keep your working files compact and global
  1370. searches like the construction of agenda views fast.
  1371. The most common archiving action is to move a project tree to another file,
  1372. the archive file.
  1373. @table @kbd
  1374. @item C-c C-x C-a
  1375. Archive the current entry using @code{org-archive-default-command}.
  1376. @item C-c C-x C-s@ @r{or short} @ C-c $
  1377. Archive the subtree starting at the cursor position to the location
  1378. given by @code{org-archive-location}.
  1379. @end table
  1380. The default archive location is a file in the same directory as the
  1381. current file, with the name derived by appending @file{_archive} to the
  1382. current file name. For information and examples on how to change this,
  1383. see the documentation string of the variable
  1384. @code{org-archive-location}. There is also an in-buffer option for
  1385. setting this variable, for example
  1386. @smallexample
  1387. #+ARCHIVE: %s_done::
  1388. @end smallexample
  1389. @seealso{
  1390. @uref{http://orgmode.org/manual/Capture-_002d-Refile-_002d-Archive.html#Capture-_002d-Refile-_002d-Archive,
  1391. Chapter 9 of the manual}@*
  1392. @uref{http://orgmode.org/worg/org-tutorials/org-protocol-custom-handler.php,
  1393. Sebastian Rose's tutorial for capturing from a web browser}}@uref{}@*
  1394. @node Agenda Views, Markup, Capture - Refile - Archive, Top
  1395. @chapter Agenda Views
  1396. Due to the way Org works, TODO items, time-stamped items, and tagged
  1397. headlines can be scattered throughout a file or even a number of files. To
  1398. get an overview of open action items, or of events that are important for a
  1399. particular date, this information must be collected, sorted and displayed in
  1400. an organized way. There are several different views, see below.
  1401. The extracted information is displayed in a special @emph{agenda buffer}.
  1402. This buffer is read-only, but provides commands to visit the corresponding
  1403. locations in the original Org files, and even to edit these files remotely.
  1404. Remote editing from the agenda buffer means, for example, that you can
  1405. change the dates of deadlines and appointments from the agenda buffer.
  1406. The commands available in the Agenda buffer are listed in @ref{Agenda
  1407. commands}.
  1408. @menu
  1409. * Agenda files:: Files being searched for agenda information
  1410. * Agenda dispatcher:: Keyboard access to agenda views
  1411. * Built-in agenda views:: What is available out of the box?
  1412. * Agenda commands:: Remote editing of Org trees
  1413. * Custom agenda views:: Defining special searches and views
  1414. @end menu
  1415. @node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views
  1416. @section Agenda files
  1417. The information to be shown is normally collected from all @emph{agenda
  1418. files}, the files listed in the variable
  1419. @code{org-agenda-files}.
  1420. @table @kbd
  1421. @item C-c [
  1422. Add current file to the list of agenda files. The file is added to
  1423. the front of the list. If it was already in the list, it is moved to
  1424. the front. With a prefix argument, file is added/moved to the end.
  1425. @item C-c ]
  1426. Remove current file from the list of agenda files.
  1427. @item C-,
  1428. Cycle through agenda file list, visiting one file after the other.
  1429. @end table
  1430. @node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views
  1431. @section The agenda dispatcher
  1432. The views are created through a dispatcher, which should be bound to a
  1433. global key---for example @kbd{C-c a} (@pxref{Installation}). After
  1434. pressing @kbd{C-c a}, an additional letter is required to execute a
  1435. command:
  1436. @table @kbd
  1437. @item a
  1438. The calendar-like agenda (@pxref{Weekly/daily agenda}).
  1439. @item t @r{/} T
  1440. A list of all TODO items (@pxref{Global TODO list}).
  1441. @item m @r{/} M
  1442. A list of headlines matching a TAGS expression (@pxref{Matching
  1443. tags and properties}).
  1444. @item L
  1445. The timeline view for the current buffer (@pxref{Timeline}).
  1446. @item s
  1447. A list of entries selected by a boolean expression of keywords
  1448. and/or regular expressions that must or must not occur in the entry.
  1449. @end table
  1450. @node Built-in agenda views, Agenda commands, Agenda dispatcher, Agenda Views
  1451. @section The built-in agenda views
  1452. @menu
  1453. * Weekly/daily agenda:: The calendar page with current tasks
  1454. * Global TODO list:: All unfinished action items
  1455. * Matching tags and properties:: Structured information with fine-tuned search
  1456. * Timeline:: Time-sorted view for single file
  1457. * Search view:: Find entries by searching for text
  1458. @end menu
  1459. @node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views
  1460. @subsection The weekly/daily agenda
  1461. The purpose of the weekly/daily @emph{agenda} is to act like a page of a
  1462. paper agenda, showing all the tasks for the current week or day.
  1463. @table @kbd
  1464. @item C-c a a
  1465. Compile an agenda for the current week from a list of Org files. The agenda
  1466. shows the entries for each day.
  1467. @end table
  1468. Emacs contains the calendar and diary by Edward M. Reingold. Org-mode
  1469. understands the syntax of the diary and allows you to use diary sexp entries
  1470. directly in Org files:
  1471. @smallexample
  1472. * Birthdays and similar stuff
  1473. #+CATEGORY: Holiday
  1474. %%(org-calendar-holiday) ; special function for holiday names
  1475. #+CATEGORY: Ann
  1476. %%(diary-anniversary 5 14 1956)@footnote{Note that the order of the arguments (month, day, year) depends on the setting of @code{calendar-date-style}.} Arthur Dent is %d years old
  1477. %%(diary-anniversary 10 2 1869) Mahatma Gandhi would be %d years old
  1478. @end smallexample
  1479. Org can interact with Emacs appointments notification facility. To add all
  1480. the appointments of your agenda files, use the command
  1481. @code{org-agenda-to-appt}. See the docstring for details.
  1482. @node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views
  1483. @subsection The global TODO list
  1484. The global TODO list contains all unfinished TODO items formatted and
  1485. collected into a single place. Remote editing of TODO items lets you
  1486. can change the state of a TODO entry with a single key press. The commands
  1487. available in the TODO list are described in @ref{Agenda commands}.
  1488. @table @kbd
  1489. @item C-c a t
  1490. Show the global TODO list. This collects the TODO items from all
  1491. agenda files (@pxref{Agenda Views}) into a single buffer.
  1492. @item C-c a T
  1493. Like the above, but allows selection of a specific TODO keyword.
  1494. @end table
  1495. @node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views
  1496. @subsection Matching tags and properties
  1497. If headlines in the agenda files are marked with @emph{tags} (@pxref{Tags}),
  1498. or have properties (@pxref{Properties}), you can select headlines
  1499. based on this metadata and collect them into an agenda buffer. The match
  1500. syntax described here also applies when creating sparse trees with @kbd{C-c /
  1501. m}. The commands available in the tags list are described in @ref{Agenda
  1502. commands}.
  1503. @table @kbd
  1504. @item C-c a m
  1505. Produce a list of all headlines that match a given set of tags. The
  1506. command prompts for a selection criterion, which is a boolean logic
  1507. expression with tags, like @samp{+work+urgent-withboss} or
  1508. @samp{work|home} (@pxref{Tags}). If you often need a specific search,
  1509. define a custom command for it (@pxref{Agenda dispatcher}).
  1510. @item C-c a M
  1511. Like @kbd{C-c a m}, but only select headlines that are also TODO items.
  1512. @end table
  1513. @subsubheading Match syntax
  1514. A search string can use Boolean operators @samp{&} for AND and @samp{|} for
  1515. OR. @samp{&} binds more strongly than @samp{|}. Parentheses are currently
  1516. not implemented. Each element in the search is either a tag, a regular
  1517. expression matching tags, or an expression like @code{PROPERTY OPERATOR
  1518. VALUE} with a comparison operator, accessing a property value. Each element
  1519. may be preceded by @samp{-}, to select against it, and @samp{+} is syntactic
  1520. sugar for positive selection. The AND operator @samp{&} is optional when
  1521. @samp{+} or @samp{-} is present. Here are some examples, using only tags.
  1522. @table @samp
  1523. @item +work-boss
  1524. Select headlines tagged @samp{:work:}, but discard those also tagged
  1525. @samp{:boss:}.
  1526. @item work|laptop
  1527. Selects lines tagged @samp{:work:} or @samp{:laptop:}.
  1528. @item work|laptop+night
  1529. Like before, but require the @samp{:laptop:} lines to be tagged also
  1530. @samp{:night:}.
  1531. @end table
  1532. You may also test for properties at the same
  1533. time as matching tags, see the manual for more information.
  1534. @node Timeline, Search view, Matching tags and properties, Built-in agenda views
  1535. @subsection Timeline for a single file
  1536. The timeline summarizes all time-stamped items from a single Org mode
  1537. file in a @emph{time-sorted view}. The main purpose of this command is
  1538. to give an overview over events in a project.
  1539. @table @kbd
  1540. @item C-c a L
  1541. Show a time-sorted view of the Org file, with all time-stamped items.
  1542. When called with a @kbd{C-u} prefix, all unfinished TODO entries
  1543. (scheduled or not) are also listed under the current date.
  1544. @end table
  1545. @node Search view, , Timeline, Built-in agenda views
  1546. @subsection Search view
  1547. This agenda view is a general text search facility for Org mode entries.
  1548. It is particularly useful to find notes.
  1549. @table @kbd
  1550. @item C-c a s
  1551. This is a special search that lets you select entries by matching a substring
  1552. or specific words using a boolean logic.
  1553. @end table
  1554. For example, the search string @samp{computer equipment} will find entries
  1555. that contain @samp{computer equipment} as a substring.
  1556. Search view can also search for specific keywords in the entry, using Boolean
  1557. logic. The search string @samp{+computer +wifi -ethernet -@{8\.11[bg]@}}
  1558. will search for note entries that contain the keywords @code{computer}
  1559. and @code{wifi}, but not the keyword @code{ethernet}, and which are also
  1560. not matched by the regular expression @code{8\.11[bg]}, meaning to
  1561. exclude both 8.11b and 8.11g.
  1562. Note that in addition to the agenda files, this command will also search
  1563. the files listed in @code{org-agenda-text-search-extra-files}.
  1564. @node Agenda commands, Custom agenda views, Built-in agenda views, Agenda Views
  1565. @section Commands in the agenda buffer
  1566. Entries in the agenda buffer are linked back to the Org file or diary
  1567. file where they originate. Commands are provided to show and jump to the
  1568. original entry location, and to edit the Org files ``remotely'' from
  1569. the agenda buffer. This is just a selection of the many commands, explore
  1570. the @code{Agenda} menu and the manual for a complete list.
  1571. @table @kbd
  1572. @tsubheading{Motion}
  1573. @item n
  1574. Next line (same as @key{up} and @kbd{C-p}).
  1575. @item p
  1576. Previous line (same as @key{down} and @kbd{C-n}).
  1577. @tsubheading{View/Go to Org file}
  1578. @item mouse-3
  1579. @itemx @key{SPC}
  1580. Display the original location of the item in another window.
  1581. With prefix arg, make sure that the entire entry is made visible in the
  1582. outline, not only the heading.
  1583. @c
  1584. @itemx @key{TAB}
  1585. Go to the original location of the item in another window. Under Emacs
  1586. 22, @kbd{mouse-1} will also work for this.
  1587. @c
  1588. @itemx @key{RET}
  1589. Go to the original location of the item and delete other windows.
  1590. @c
  1591. @tsubheading{Change display}
  1592. @item o
  1593. Delete other windows.
  1594. @c
  1595. @item d @r{/} w
  1596. Switch to day/week view.
  1597. @c
  1598. @item f @r{and} b
  1599. Go forward/backward in time to display the following
  1600. @code{org-agenda-current-span} days. For example, if the display covers a
  1601. week, switch to the following/previous week.
  1602. @c
  1603. @item .
  1604. Go to today.
  1605. @c
  1606. @item j
  1607. Prompt for a date and go there.
  1608. @c
  1609. @item v l @ @r{or short} @ l
  1610. Toggle Logbook mode. In Logbook mode, entries that were marked DONE while
  1611. logging was on (variable @code{org-log-done}) are shown in the agenda, as are
  1612. entries that have been clocked on that day. When called with a @kbd{C-u}
  1613. prefix, show all possible logbook entries, including state changes.
  1614. @c
  1615. @item r @r{or} g
  1616. Recreate the agenda buffer, to reflect the changes.
  1617. @item s
  1618. Save all Org buffers in the current Emacs session, and also the locations of
  1619. IDs.
  1620. @tsubheading{Secondary filtering and query editing}
  1621. @item /
  1622. Filter the current agenda view with respect to a tag. You are prompted for a
  1623. letter to select a tag. Press @samp{-} first to select against the tag.
  1624. @item \
  1625. Narrow the current agenda filter by an additional condition.
  1626. @tsubheading{Remote editing (see the manual for many more commands)}
  1627. @item 0--9
  1628. Digit argument.
  1629. @c
  1630. @item t
  1631. Change the TODO state of the item, in the agenda and in the
  1632. org file.
  1633. @c
  1634. @item C-k
  1635. Delete the current agenda item along with the entire subtree belonging
  1636. to it in the original Org file.
  1637. @c
  1638. @item C-c C-w
  1639. Refile the entry at point.
  1640. @c
  1641. @item C-c C-x C-a @ @r{or short} @ a
  1642. Archive the subtree corresponding to the entry at point using the default
  1643. archiving command set in @code{org-archive-default-command}.
  1644. @c
  1645. @item C-c C-x C-s @ @r{or short} @ $
  1646. Archive the subtree corresponding to the current headline.
  1647. @c
  1648. @item C-c C-s
  1649. Schedule this item, with prefix arg remove the scheduling timestamp
  1650. @c
  1651. @item C-c C-d
  1652. Set a deadline for this item, with prefix arg remove the deadline.
  1653. @c
  1654. @item S-@key{right} @r{and} S-@key{left}
  1655. Change the timestamp associated with the current line by one day.
  1656. @c
  1657. @item I
  1658. Start the clock on the current item.
  1659. @c
  1660. @item O / X
  1661. Stop/cancel the previously started clock.
  1662. @item J
  1663. Jump to the running clock in another window.
  1664. @end table
  1665. @node Custom agenda views, , Agenda commands, Agenda Views
  1666. @section Custom agenda views
  1667. The main application of custom searches is the definition of keyboard
  1668. shortcuts for frequently used searches, either creating an agenda
  1669. buffer, or a sparse tree (the latter covering of course only the current
  1670. buffer).
  1671. Custom commands are configured in the variable
  1672. @code{org-agenda-custom-commands}. You can customize this variable, for
  1673. example by pressing @kbd{C-c a C}. You can also directly set it with
  1674. Emacs Lisp in @file{.emacs}. The following example contains all valid
  1675. search types:
  1676. @smalllisp
  1677. @group
  1678. (setq org-agenda-custom-commands
  1679. '(("w" todo "WAITING")
  1680. ("u" tags "+boss-urgent")
  1681. ("v" tags-todo "+boss-urgent")))
  1682. @end group
  1683. @end smalllisp
  1684. @noindent
  1685. The initial string in each entry defines the keys you have to press after the
  1686. dispatcher command @kbd{C-c a} in order to access the command. Usually this
  1687. will be just a single character. The second parameter is the search type,
  1688. followed by the string or regular expression to be used for the matching.
  1689. The example above will therefore define:
  1690. @table @kbd
  1691. @item C-c a w
  1692. as a global search for TODO entries with @samp{WAITING} as the TODO
  1693. keyword
  1694. @item C-c a u
  1695. as a global tags search for headlines marked @samp{:boss:} but not
  1696. @samp{:urgent:}
  1697. @item C-c a v
  1698. as the same search as @kbd{C-c a u}, but limiting the search to
  1699. headlines that are also TODO items
  1700. @end table
  1701. @seealso{
  1702. @uref{http://orgmode.org/manual/Agenda-Views.html#Agenda-Views, Chapter 10 of
  1703. the manual}@*
  1704. @uref{http://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.php,
  1705. Mat Lundin's tutorial about custom agenda commands}@*
  1706. @uref{http://www.newartisans.com/2007/08/using-org-mode-as-a-day-planner.html,
  1707. John Wiegley's setup}}
  1708. @node Markup, Exporting, Agenda Views, Top
  1709. @chapter Markup for rich export
  1710. When exporting Org-mode documents, the exporter tries to reflect the
  1711. structure of the document as accurately as possible in the backend. Since
  1712. export targets like HTML, @LaTeX{}, or DocBook allow much richer formatting,
  1713. Org mode has rules on how to prepare text for rich export. This section
  1714. summarizes the markup rules used in an Org-mode buffer.
  1715. @menu
  1716. * Structural markup elements:: The basic structure as seen by the exporter
  1717. * Images and tables:: Images, tables and caption mechanism
  1718. * Literal examples:: Source code examples with special formatting
  1719. * Include files:: Include additional files into a document
  1720. * Embedded @LaTeX{}:: @LaTeX{} can be freely used inside Org documents
  1721. @end menu
  1722. @node Structural markup elements, Images and tables, Markup, Markup
  1723. @section Structural markup elements
  1724. @menu
  1725. * Document title:: Where the title is taken from
  1726. * Headings and sections:: The document structure as seen by the exporter
  1727. * Table of contents:: The if and where of the table of contents
  1728. * Paragraphs:: Paragraphs
  1729. * Emphasis and monospace:: Bold, italic, etc.
  1730. * Comment lines:: What will *not* be exported
  1731. @end menu
  1732. @node Document title, Headings and sections, Structural markup elements, Structural markup elements
  1733. @subheading Document title
  1734. @noindent
  1735. The title of the exported document is taken from the special line
  1736. @smallexample
  1737. #+TITLE: This is the title of the document
  1738. @end smallexample
  1739. @node Headings and sections, Table of contents, Document title, Structural markup elements
  1740. @subheading Headings and sections
  1741. The outline structure of the document as described in @ref{Document
  1742. Structure}, forms the basis for defining sections of the exported document.
  1743. However, since the outline structure is also used for (for example) lists of
  1744. tasks, only the first three outline levels will be used as headings. Deeper
  1745. levels will become itemized lists. You can change the location of this
  1746. switch globally by setting the variable @code{org-export-headline-levels}, or on a
  1747. per-file basis with a line
  1748. @smallexample
  1749. #+OPTIONS: H:4
  1750. @end smallexample
  1751. @node Table of contents, Paragraphs, Headings and sections, Structural markup elements
  1752. @subheading Table of contents
  1753. The table of contents is normally inserted directly before the first headline
  1754. of the file.
  1755. @smallexample
  1756. #+OPTIONS: toc:2 (only to two levels in TOC)
  1757. #+OPTIONS: toc:nil (no TOC at all)
  1758. @end smallexample
  1759. @node Paragraphs, Emphasis and monospace, Table of contents, Structural markup elements
  1760. @subheading Paragraphs, line breaks, and quoting
  1761. Paragraphs are separated by at least one empty line. If you need to enforce
  1762. a line break within a paragraph, use @samp{\\} at the end of a line.
  1763. To keep the line breaks in a region, but otherwise use normal formatting, you
  1764. can use this construct, which can also be used to format poetry.
  1765. @smallexample
  1766. #+BEGIN_VERSE
  1767. Great clouds overhead
  1768. Tiny black birds rise and fall
  1769. Snow covers Emacs
  1770. -- AlexSchroeder
  1771. #+END_VERSE
  1772. @end smallexample
  1773. When quoting a passage from another document, it is customary to format this
  1774. as a paragraph that is indented on both the left and the right margin. You
  1775. can include quotations in Org-mode documents like this:
  1776. @smallexample
  1777. #+BEGIN_QUOTE
  1778. Everything should be made as simple as possible,
  1779. but not any simpler -- Albert Einstein
  1780. #+END_QUOTE
  1781. @end smallexample
  1782. If you would like to center some text, do it like this:
  1783. @smallexample
  1784. #+BEGIN_CENTER
  1785. Everything should be made as simple as possible, \\
  1786. but not any simpler
  1787. #+END_CENTER
  1788. @end smallexample
  1789. @node Emphasis and monospace, Comment lines, Paragraphs, Structural markup elements
  1790. @subheading Emphasis and monospace
  1791. You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=}
  1792. and @code{~verbatim~}, and, if you must, @samp{+strike-through+}. Text
  1793. in the code and verbatim string is not processed for Org-mode specific
  1794. syntax, it is exported verbatim. To insert a horizontal rules, use a line
  1795. consisting of only dashes, and at least 5 of them.
  1796. @node Comment lines, , Emphasis and monospace, Structural markup elements
  1797. @subheading Comment lines
  1798. Lines starting with zero or more whitespace characters followed by @samp{#}
  1799. and a whitespace are treated as comments and will never be exported. Also
  1800. entire subtrees starting with the word @samp{COMMENT} will never be exported.
  1801. Finally, regions surrounded by @samp{#+BEGIN_COMMENT}
  1802. ... @samp{#+END_COMMENT} will not be exported.
  1803. @table @kbd
  1804. @item C-c ;
  1805. Toggle the COMMENT keyword at the beginning of an entry.
  1806. @end table
  1807. @node Images and tables, Literal examples, Structural markup elements, Markup
  1808. @section Images and Tables
  1809. For Org mode tables, the lines before the first horizontal separator line
  1810. will become table header lines. You can use the following lines somewhere
  1811. before the table to assign a caption and a label for cross references, and in
  1812. the text you can refer to the object with @code{[[tab:basic-data]]}:
  1813. @smallexample
  1814. #+CAPTION: This is the caption for the next table (or link)
  1815. #+NAME: tbl:basic-data
  1816. | ... | ...|
  1817. |-----|----|
  1818. @end smallexample
  1819. Some backends allow you to directly include images into the exported
  1820. document. Org does this, if a link to an image files does not have
  1821. a description part, for example @code{[[./img/a.jpg]]}. If you wish to
  1822. define a caption for the image and maybe a label for internal cross
  1823. references, you sure that the link is on a line by itself precede it with:
  1824. @smallexample
  1825. #+CAPTION: This is the caption for the next figure link (or table)
  1826. #+NAME: fig:SED-HR4049
  1827. [[./img/a.jpg]]
  1828. @end smallexample
  1829. The same caption mechanism applies to other structures than images and tables
  1830. (e.g., @LaTeX{} equations, source code blocks), provided the chosen export
  1831. back-end supports them.
  1832. @node Literal examples, Include files, Images and tables, Markup
  1833. @section Literal examples
  1834. You can include literal examples that should not be subjected to
  1835. markup. Such examples will be typeset in monospace, so this is well suited
  1836. for source code and similar examples.
  1837. @smallexample
  1838. #+BEGIN_EXAMPLE
  1839. Some example from a text file.
  1840. #+END_EXAMPLE
  1841. @end smallexample
  1842. For simplicity when using small examples, you can also start the example
  1843. lines with a colon followed by a space. There may also be additional
  1844. whitespace before the colon:
  1845. @smallexample
  1846. Here is an example
  1847. : Some example from a text file.
  1848. @end smallexample
  1849. For source code from a programming language, or any other text
  1850. that can be marked up by font-lock in Emacs, you can ask for it to
  1851. look like the fontified Emacs buffer
  1852. @smallexample
  1853. #+BEGIN_SRC emacs-lisp
  1854. (defun org-xor (a b)
  1855. "Exclusive or."
  1856. (if a (not b) b))
  1857. #+END_SRC
  1858. @end smallexample
  1859. To edit the example in a special buffer supporting this language, use
  1860. @kbd{C-c '} to both enter and leave the editing buffer.
  1861. @node Include files, Embedded @LaTeX{}, Literal examples, Markup
  1862. @section Include files
  1863. During export, you can include the content of another file. For example, to
  1864. include your @file{.emacs} file, you could use:
  1865. @smallexample
  1866. #+INCLUDE: "~/.emacs" src emacs-lisp
  1867. @end smallexample
  1868. @noindent
  1869. The optional second and third parameter are the markup (e.g.@: @samp{quote},
  1870. @samp{example}, or @samp{src}), and, if the markup is @samp{src}, the
  1871. language for formatting the contents. The markup is optional, if it is not
  1872. given, the text will be assumed to be in Org mode format and will be
  1873. processed normally. @kbd{C-c '} will visit the included file.
  1874. @node Embedded @LaTeX{}, , Include files, Markup
  1875. @section Embedded @LaTeX{}
  1876. For scientific notes which need to be able to contain mathematical symbols
  1877. and the occasional formula, Org-mode supports embedding @LaTeX{} code into
  1878. its files. You can directly use TeX-like syntax for special symbols, enter
  1879. formulas and entire @LaTeX{} environments.
  1880. @smallexample
  1881. Angles are written as Greek letters \alpha, \beta and \gamma. The mass if
  1882. the sun is M_sun = 1.989 x 10^30 kg. The radius of the sun is R_@{sun@} =
  1883. 6.96 x 10^8 m. If $a^2=b$ and $b=2$, then the solution must be either
  1884. $a=+\sqrt@{2@}$ or $a=-\sqrt@{2@}$.
  1885. \begin@{equation@}
  1886. x=\sqrt@{b@}
  1887. \end@{equation@}
  1888. @end smallexample
  1889. @noindent With
  1890. @uref{http://orgmode.org/manual/LaTeX-fragments.html#LaTeX-fragments,special
  1891. setup}, @LaTeX{} snippets will be included as images when exporting to HTML.
  1892. @seealso{
  1893. @uref{http://orgmode.org/manual/Markup.html#Markup, Chapter 11 of the manual}}
  1894. @node Exporting, Publishing, Markup, Top
  1895. @chapter Exporting
  1896. Org-mode documents can be exported into a variety of other formats: ASCII
  1897. export for inclusion into emails, HTML to publish on the web, @LaTeX{}/PDF
  1898. for beautiful printed documents and DocBook to enter the world of many other
  1899. formats using DocBook tools. There is also export to iCalendar format so
  1900. that planning information can be incorporated into desktop calendars.
  1901. @menu
  1902. * Export options:: Per-file export settings
  1903. * The export dispatcher:: How to access exporter commands
  1904. * ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding
  1905. * HTML export:: Exporting to HTML
  1906. * @LaTeX{} and PDF export:: Exporting to @LaTeX{}, and processing to PDF
  1907. * iCalendar export:: Exporting to iCalendar
  1908. @end menu
  1909. @node Export options, The export dispatcher, Exporting, Exporting
  1910. @section Export options
  1911. The exporter recognizes special lines in the buffer which provide
  1912. additional information. These lines may be put anywhere in the file.
  1913. The whole set of lines can be inserted into the buffer with @kbd{C-c
  1914. C-e t}.
  1915. @table @kbd
  1916. @item C-c C-e t
  1917. Insert template with export options, see example below.
  1918. @end table
  1919. @smallexample
  1920. #+TITLE: the title to be shown (default is the buffer name)
  1921. #+AUTHOR: the author (default taken from @code{user-full-name})
  1922. #+DATE: a date, fixed, or an Org timestamp
  1923. #+EMAIL: his/her email address (default from @code{user-mail-address})
  1924. #+DESCRIPTION: the page description, e.g.@: for the XHTML meta tag
  1925. #+KEYWORDS: the page keywords, e.g.@: for the XHTML meta tag
  1926. #+LANGUAGE: language for HTML, e.g.@: @samp{en} (@code{org-export-default-language})
  1927. #+OPTIONS: H:2 num:t toc:t \n:nil ::t |:t ^:t f:t tex:t ...
  1928. @end smallexample
  1929. @node The export dispatcher, ASCII/Latin-1/UTF-8 export, Export options, Exporting
  1930. @section The export dispatcher
  1931. All export commands can be reached using the export dispatcher, which is
  1932. a prefix key that prompts for an additional key specifying the command.
  1933. Normally the entire file is exported, but if a region is active, it will be
  1934. exported instead.
  1935. @table @kbd
  1936. @item C-c C-e
  1937. Dispatcher for export and publishing commands.
  1938. @end table
  1939. @node ASCII/Latin-1/UTF-8 export, HTML export, The export dispatcher, Exporting
  1940. @section ASCII/Latin-1/UTF-8 export
  1941. ASCII export produces a simple and very readable version of an Org-mode
  1942. file, containing only plain ASCII. Latin-1 and UTF-8 export augment the file
  1943. with special characters and symbols available in these encodings.
  1944. @table @kbd
  1945. @item C-c C-e t a @ @ @r{and} @ @ C-c C-e t A
  1946. Export as ASCII file or temporary buffer.
  1947. @item C-c C-e t n @ @ @r{and} @ @ C-c C-e t N
  1948. Like the above commands, but use Latin-1 encoding.
  1949. @item C-c C-e t u @ @ @r{and} @ @ C-c C-e t U
  1950. Like the above commands, but use UTF-8 encoding.
  1951. @end table
  1952. @node HTML export, @LaTeX{} and PDF export, ASCII/Latin-1/UTF-8 export, Exporting
  1953. @section HTML export
  1954. @table @kbd
  1955. @item C-c C-e h h
  1956. Export as HTML file @file{myfile.html}.
  1957. @item C-c C-e h o
  1958. Export as HTML file and immediately open it with a browser.
  1959. @end table
  1960. To insert HTML that should be copied verbatim to
  1961. the exported file use either
  1962. @smallexample
  1963. #+HTML: Literal HTML code for export
  1964. @end smallexample
  1965. @noindent or
  1966. @smallexample
  1967. #+BEGIN_HTML
  1968. All lines between these markers are exported literally
  1969. #+END_HTML
  1970. @end smallexample
  1971. @node @LaTeX{} and PDF export, iCalendar export, HTML export, Exporting
  1972. @section @LaTeX{} and PDF export
  1973. @table @kbd
  1974. @item C-c C-e l l
  1975. Export as @LaTeX{} file @file{myfile.tex}.
  1976. @item C-c C-e l p
  1977. Export as @LaTeX{} and then process to PDF.
  1978. @item C-c C-e l o
  1979. Export as @LaTeX{} and then process to PDF, then open the resulting PDF file.
  1980. @end table
  1981. By default, the @LaTeX{} output uses the class @code{article}. You can
  1982. change this by adding an option like @code{#+LATEX_CLASS: myclass} in your
  1983. file. The class must be listed in @code{org-latex-classes}.
  1984. Embedded @LaTeX{} as described in @ref{Embedded @LaTeX{}}, will be correctly
  1985. inserted into the @LaTeX{} file. Similarly to the HTML exporter, you can use
  1986. @code{#+LATEX:} and @code{#+BEGIN_LATEX ... #+END_LATEX} construct to add
  1987. verbatim @LaTeX{} code.
  1988. @node iCalendar export, , @LaTeX{} and PDF export, Exporting
  1989. @section iCalendar export
  1990. @table @kbd
  1991. @item C-c C-e c f
  1992. Create iCalendar entries for the current file in a @file{.ics} file.
  1993. @item C-c C-e c c
  1994. Create a single large iCalendar file from all files in
  1995. @code{org-agenda-files} and write it to the file given by
  1996. @code{org-icalendar-combined-agenda-file}.
  1997. @end table
  1998. @seealso{
  1999. @uref{http://orgmode.org/manual/Exporting.html#Exporting, Chapter 12 of the manual}@*
  2000. @uref{http://orgmode.org/worg/org-tutorials/images-and-xhtml-export.php,
  2001. Sebastian Rose's image handling tutorial}@*
  2002. @uref{http://orgmode.org/worg/org-tutorials/org-latex-export.php, Thomas
  2003. Dye's LaTeX export tutorial}
  2004. @uref{http://orgmode.org/worg/org-tutorials/org-beamer/tutorial.php, Eric
  2005. Fraga's BEAMER presentation tutorial}}
  2006. @node Publishing, Working With Source Code, Exporting, Top
  2007. @chapter Publishing
  2008. Org includes a publishing management system that allows you to configure
  2009. automatic HTML conversion of @emph{projects} composed of interlinked org
  2010. files. You can also configure Org to automatically upload your exported HTML
  2011. pages and related attachments, such as images and source code files, to a web
  2012. server. For detailed instructions about setup, see the manual.
  2013. Here is an example:
  2014. @smalllisp
  2015. (setq org-publish-project-alist
  2016. '(("org"
  2017. :base-directory "~/org/"
  2018. :publishing-directory "~/public_html"
  2019. :section-numbers nil
  2020. :table-of-contents nil
  2021. :style "<link rel=\"stylesheet\"
  2022. href=\"../other/mystyle.css\"
  2023. type=\"text/css\"/>")))
  2024. @end smalllisp
  2025. @table @kbd
  2026. @item C-c C-e P x
  2027. Prompt for a specific project and publish all files that belong to it.
  2028. @item C-c C-e P p
  2029. Publish the project containing the current file.
  2030. @item C-c C-e P f
  2031. Publish only the current file.
  2032. @item C-c C-e P a
  2033. Publish every project.
  2034. @end table
  2035. Org uses timestamps to track when a file has changed. The above functions
  2036. normally only publish changed files. You can override this and force
  2037. publishing of all files by giving a prefix argument to any of the commands
  2038. above.
  2039. @seealso{
  2040. @uref{http://orgmode.org/manual/Publishing.html#Publishing, Chapter 13 of the
  2041. manual}@*
  2042. @uref{http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.php,
  2043. Sebastian Rose's publishing tutorial}@*
  2044. @uref{http://orgmode.org/worg/org-tutorials/org-jekyll.php, Ian Barton's
  2045. Jekyll/blogging setup}}
  2046. @node Working With Source Code, Miscellaneous, Publishing, Top
  2047. @chapter Working with source code
  2048. Org-mode provides a number of features for working with source code,
  2049. including editing of code blocks in their native major-mode, evaluation of
  2050. code blocks, tangling of code blocks, and exporting code blocks and their
  2051. results in several formats.
  2052. @subheading Structure of Code Blocks
  2053. The structure of code blocks is as follows:
  2054. @example
  2055. #+NAME: <name>
  2056. #+BEGIN_SRC <language> <switches> <header arguments>
  2057. <body>
  2058. #+END_SRC
  2059. @end example
  2060. Where @code{<name>} is a string used to name the code block,
  2061. @code{<language>} specifies the language of the code block
  2062. (e.g.@: @code{emacs-lisp}, @code{shell}, @code{R}, @code{python}, etc...),
  2063. @code{<switches>} can be used to control export of the code block,
  2064. @code{<header arguments>} can be used to control many aspects of code block
  2065. behavior as demonstrated below, and @code{<body>} contains the actual source
  2066. code.
  2067. @subheading Editing source code
  2068. Use @kbd{C-c '} to edit the current code block. This brings up a language
  2069. major-mode edit buffer containing the body of the code block. Saving this
  2070. buffer will write the new contents back to the Org buffer. Use @kbd{C-c '}
  2071. again to exit the edit buffer.
  2072. @subheading Evaluating code blocks
  2073. Use @kbd{C-c C-c} to evaluate the current code block and insert its results
  2074. in the Org-mode buffer. By default, evaluation is only turned on for
  2075. @code{emacs-lisp} code blocks, however support exists for evaluating blocks
  2076. in many languages. For a complete list of supported languages see the
  2077. manual. The following shows a code block and its results.
  2078. @example
  2079. #+BEGIN_SRC emacs-lisp
  2080. (+ 1 2 3 4)
  2081. #+END_SRC
  2082. #+RESULTS:
  2083. : 10
  2084. @end example
  2085. @subheading Extracting source code
  2086. Use @kbd{C-c C-v t} to create pure source code files by extracting code from
  2087. source blocks in the current buffer. This is referred to as ``tangling''---a
  2088. term adopted from the literate programming community. During ``tangling'' of
  2089. code blocks their bodies are expanded using @code{org-babel-expand-src-block}
  2090. which can expand both variable and ``noweb'' style references. In order to
  2091. tangle a code block it must have a @code{:tangle} header argument, see the
  2092. manual for details.
  2093. @subheading Library of Babel
  2094. Use @kbd{C-c C-v l} to load the code blocks from an Org-mode files into the
  2095. ``Library of Babel'', these blocks can then be evaluated from any Org-mode
  2096. buffer. A collection of generally useful code blocks is distributed with
  2097. Org-mode in @code{contrib/library-of-babel.org}.
  2098. @subheading Header Arguments
  2099. Many aspects of the evaluation and export of code blocks are controlled
  2100. through header arguments. These can be specified globally, at the file
  2101. level, at the outline subtree level, and at the individual code block level.
  2102. The following describes some of the header arguments.
  2103. @table @code
  2104. @item :var
  2105. The @code{:var} header argument is used to pass arguments to code blocks.
  2106. The values passed to arguments can be literal values, values from org-mode
  2107. tables and literal example blocks, or the results of other named code blocks.
  2108. @item :results
  2109. The @code{:results} header argument controls the @emph{collection},
  2110. @emph{type}, and @emph{handling} of code block results. Values of
  2111. @code{output} or @code{value} (the default) specify how results are collected
  2112. from a code block's evaluation. Values of @code{vector}, @code{scalar}
  2113. @code{file} @code{raw} @code{html} @code{latex} and @code{code} specify the
  2114. type of the results of the code block which dictates how they will be
  2115. incorporated into the Org-mode buffer. Values of @code{silent},
  2116. @code{replace}, @code{prepend}, and @code{append} specify handling of code
  2117. block results, specifically if and how the results should be inserted into
  2118. the Org-mode buffer.
  2119. @item :session
  2120. A header argument of @code{:session} will cause the code block to be
  2121. evaluated in a persistent interactive inferior process in Emacs. This allows
  2122. for persisting state between code block evaluations, and for manual
  2123. inspection of the results of evaluation.
  2124. @item :exports
  2125. Any combination of the @emph{code} or the @emph{results} of a block can be
  2126. retained on export, this is specified by setting the @code{:results} header
  2127. argument to @code{code} @code{results} @code{none} or @code{both}.
  2128. @item :tangle
  2129. A header argument of @code{:tangle yes} will cause a code block's contents to
  2130. be tangled to a file named after the filename of the Org-mode buffer. An
  2131. alternate file name can be specified with @code{:tangle filename}.
  2132. @item :cache
  2133. A header argument of @code{:cache yes} will cause associate a hash of the
  2134. expanded code block with the results, ensuring that code blocks are only
  2135. re-run when their inputs have changed.
  2136. @item :noweb
  2137. A header argument of @code{:noweb yes} will expand ``noweb'' style references
  2138. on evaluation and tangling.
  2139. @item :file
  2140. Code blocks which output results to files (e.g.@: graphs, diagrams and figures)
  2141. can accept a @code{:file filename} header argument in which case the results
  2142. are saved to the named file, and a link to the file is inserted into the
  2143. Org-mode buffer.
  2144. @end table
  2145. @seealso{
  2146. @uref{http://orgmode.org/manual/Literal-examples.html#Literal-examples,
  2147. Chapter 11.3 of the manual}@*
  2148. @uref{http://orgmode.org/worg/org-contrib/babel/index.php,
  2149. The Babel site on Worg}}
  2150. @node Miscellaneous, GNU Free Documentation License, Working With Source Code, Top
  2151. @chapter Miscellaneous
  2152. @menu
  2153. * Completion:: M-TAB knows what you need
  2154. * Clean view:: Getting rid of leading stars in the outline
  2155. * MobileOrg:: Org-mode on the iPhone
  2156. @end menu
  2157. @node Completion, Clean view, Miscellaneous, Miscellaneous
  2158. @section Completion
  2159. Org supports in-buffer completion with @kbd{M-@key{TAB}}. This type of
  2160. completion does not make use of the minibuffer. You simply type a few
  2161. letters into the buffer and use the key to complete text right there. For
  2162. example, this command will complete @TeX{} symbols after @samp{\}, TODO
  2163. keywords at the beginning of a headline, and tags after @samp{:} in a
  2164. headline.
  2165. @node Clean view, MobileOrg, Completion, Miscellaneous
  2166. @section A cleaner outline view
  2167. Some people find it noisy and distracting that the Org headlines start with a
  2168. potentially large number of stars, and that text below the headlines is not
  2169. indented. While this is no problem when writing a @emph{book-like} document
  2170. where the outline headings are really section headings, in a more
  2171. @emph{list-oriented} outline, indented structure is a lot cleaner:
  2172. @smallexample
  2173. @group
  2174. * Top level headline | * Top level headline
  2175. ** Second level | * Second level
  2176. *** 3rd level | * 3rd level
  2177. some text | some text
  2178. *** 3rd level | * 3rd level
  2179. more text | more text
  2180. * Another top level headline | * Another top level headline
  2181. @end group
  2182. @end smallexample
  2183. @noindent
  2184. If you are using at least Emacs 23.1.50.3 and version 6.29 of Org, this kind
  2185. of view can be achieved dynamically at display time using
  2186. @code{org-indent-mode}, which will prepend intangible space to each line.
  2187. You can turn on @code{org-indent-mode} for all files by customizing the
  2188. variable @code{org-startup-indented}, or you can turn it on for individual
  2189. files using
  2190. @smallexample
  2191. #+STARTUP: indent
  2192. @end smallexample
  2193. If you want a similar effect in earlier version of Emacs and/or Org, or if
  2194. you want the indentation to be hard space characters so that the plain text
  2195. file looks as similar as possible to the Emacs display, Org supports you by
  2196. helping to indent (with @key{TAB}) text below each headline, by hiding
  2197. leading stars, and by only using levels 1, 3, etc to get two characters
  2198. indentation for each level. To get this support in a file, use
  2199. @smallexample
  2200. #+STARTUP: hidestars odd
  2201. @end smallexample
  2202. @node MobileOrg, , Clean view, Miscellaneous
  2203. @section MobileOrg
  2204. @i{MobileOrg} is the name of the mobile companion app for Org mode, currently
  2205. available for iOS and for Android. @i{MobileOrg} offers offline viewing and
  2206. capture support for an Org mode system rooted on a ``real'' computer. It
  2207. does also allow you to record changes to existing entries.
  2208. The @uref{http://mobileorg.ncogni.to/, iOS implementation} for the
  2209. @i{iPhone/iPod Touch/iPad} series of devices, was developed by Richard
  2210. Moreland. Android users should check out
  2211. @uref{http://wiki.github.com/matburt/mobileorg-android/, MobileOrg Android}
  2212. by Matt Jones. The two implementations are not identical but offer similar
  2213. features.
  2214. @seealso{
  2215. @uref{http://orgmode.org/manual/Miscellaneous.html#Miscellaneous, Chapter 15
  2216. of the manual}@*
  2217. @uref{http://orgmode.org/manual/MobileOrg.html#MobileOrg, Appendix B of the
  2218. manual}@*
  2219. @uref{http://orgmode.org/orgcard.pdf,Key reference card}}
  2220. @c @node GNU Free Documentation License, , Miscellaneous, Top
  2221. @c @appendix GNU Free Documentation License
  2222. @c @include doclicense.texi
  2223. @bye
  2224. @c Local variables:
  2225. @c fill-column: 77
  2226. @c End:
  2227. @c LocalWords: webdavhost pre