orgguide.texi 96 KB

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