orgguide.texi 97 KB

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