orgguide.texi 97 KB

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