org-manual.org (821473B)
1 #+title: The Org Manual 2 #+subtitle: Release {{{version}}} 3 #+author: The Org Mode Developers 4 #+language: en 5 6 7 #+texinfo: @insertcopying 8 9 * Introduction 10 :PROPERTIES: 11 :DESCRIPTION: Getting started. 12 :END: 13 #+cindex: introduction 14 15 ** Summary 16 :PROPERTIES: 17 :DESCRIPTION: Brief summary of what Org does. 18 :END: 19 #+cindex: summary 20 21 Org Mode is an authoring tool and a TODO lists manager for GNU Emacs. 22 It relies on a lightweight plain-text markup language used in files 23 with the =.org= extension. 24 25 As an authoring tool, Org helps you write structured documents and 26 provides exporting facilities. Org files can also be used for literate 27 programming and reproducible research. As a TODO lists manager, Org 28 helps you organize your tasks in a flexible way, from daily needs to 29 detailed project-planning, allowing logging, multiple views on your 30 tasks, exporting your agendas, etc. 31 32 Org mode is implemented on top of Outline mode, which makes it 33 possible to keep the content of large files well structured. 34 Visibility cycling and structure editing help to work with the tree. 35 Tables are easily created with a built-in table editor. Plain text 36 URL-like links connect to websites, emails, Usenet messages, BBDB 37 entries, and any files related to the projects. 38 39 Org develops organizational tasks around notes files that contain 40 lists or information about projects as plain text. Project planning 41 and task management make use of metadata which is part of an outline 42 node. Based on this data, specific entries can be extracted in 43 queries and create dynamic /agenda views/ that also integrate the Emacs 44 calendar and diary. Org can be used to implement many different 45 project planning schemes, such as David Allen's GTD system. 46 47 Org files can serve as a single source authoring system with export to 48 many different formats such as HTML, LaTeX, Open Document, and 49 Markdown. New export backends can be derived from existing ones, or 50 defined from scratch. 51 52 Org files can include source code blocks, which makes Org uniquely 53 suited for authoring technical documents with code examples. Org 54 source code blocks are fully functional; they can be evaluated in 55 place and their results can be captured in the file. This makes it 56 possible to create a single file reproducible research compendium. 57 58 Org keeps simple things simple. When first fired up, it should feel 59 like a straightforward, easy to use outliner. Complexity is not 60 imposed, but a large amount of functionality is available when needed. 61 Org is a toolbox. Many users actually run only a---very 62 personal---fraction of Org's capabilities, and know that there is more 63 whenever they need it. 64 65 All of this is achieved with strictly plain text files, the most 66 portable and future-proof file format. Org runs in Emacs. Emacs is 67 one of the most widely ported programs, so that Org mode is available 68 on every major platform. 69 70 #+cindex: FAQ 71 There is a website for Org which provides links to the newest version 72 of Org, as well as additional information, frequently asked questions 73 (FAQ), links to tutorials, etc. This page is located at 74 [[https://orgmode.org]]. 75 76 #+cindex: print edition 77 An earlier version (7.3) of this manual was available as a paperback 78 book from the Network Theory Ltd. publishing company, closed in 2009. 79 80 ** Installation 81 :PROPERTIES: 82 :DESCRIPTION: Installing Org. 83 :END: 84 #+cindex: installation 85 86 Org is included in distributions of GNU Emacs, you probably do not 87 need to install it. Most users will simply activate Org and begin 88 exploring its features. 89 90 If, for one reason or another, you want to install Org on top of this 91 pre-packaged version, you can use the Emacs package system or clone 92 Org's git repository. We *strongly recommend* sticking to a single 93 installation method. 94 95 When installing Org on top of the pre-packaged version, please note 96 that Org stable versions are meant to be fully compatible with the 97 last three stable versions of Emacs but not with older Emacsen. 98 99 *** Using Emacs packaging system 100 :PROPERTIES: 101 :UNNUMBERED: notoc 102 :END: 103 104 Recent Emacs distributions include a packaging system which lets you 105 install Elisp libraries. You can install Org from the "package menu", 106 with {{{kbd(M-x list-packages)}}}. See [[info:emacs::Package Menu][Package Menu]]. 107 108 #+attr_texinfo: :tag Important 109 #+begin_quote 110 You need to do this in a session where no =.org= file has been 111 visited, i.e., where no Org built-in function have been loaded. 112 Otherwise autoload Org functions will mess up the installation. 113 #+end_quote 114 115 *** Using Org's git repository 116 :PROPERTIES: 117 :UNNUMBERED: notoc 118 :END: 119 120 You can clone Org's repository and install Org like this: 121 122 #+begin_example 123 $ cd ~/src/ 124 $ git clone https://git.savannah.gnu.org/git/emacs/org-mode.git 125 $ cd org-mode/ 126 $ make autoloads 127 #+end_example 128 129 Note that in this case, =make autoloads= is mandatory: it defines 130 Org's version in =org-version.el= and Org's autoloads in 131 =org-loaddefs.el=. 132 133 Make sure you set the load path correctly in your Emacs init file: 134 135 #+begin_src emacs-lisp 136 (add-to-list 'load-path "~/src/org-mode/lisp") 137 #+end_src 138 139 You can also compile with =make=, generate the documentation with 140 =make doc=, create a local configuration with =make config= and 141 install Org with =make install=. Please run =make help= to get the 142 list of compilation/installation options. 143 144 For more detailed explanations on Org's build system, please check the 145 Org Build System page on [[https://orgmode.org/worg/dev/org-build-system.html][Worg]]. 146 147 *** Installing Org's contributed packages 148 :PROPERTIES: 149 :UNNUMBERED: notoc 150 :END: 151 152 Org's repository used to contain =contrib/= directory for add-ons 153 contributed by others. As of Org 9.5, the directory has been moved to 154 the dedicated org-contrib [[https://git.sr.ht/~bzg/org-contrib][repository]], which you can install 155 separately as a [[https://elpa.nongnu.org/nongnu/org-contrib.html][package]] from NonGNU ELPA. 156 157 There are enough valuable packages maintained outside of the Org repository. 158 Worg has a list of [[https://orgmode.org/worg/org-contrib/index.html][org-contrib and external packages]], certainly it is not 159 exhaustive. 160 161 ** Activation 162 :PROPERTIES: 163 :DESCRIPTION: How to activate Org for certain buffers. 164 :END: 165 #+cindex: activation 166 #+cindex: autoload 167 #+cindex: ELPA 168 #+cindex: global key bindings 169 #+cindex: key bindings, global 170 171 Org mode buffers need Font Lock to be turned on: this is the default 172 in Emacs[fn:: If you do not use Font Lock globally turn it on in Org 173 buffer with =(add-hook 'org-mode-hook #'turn-on-font-lock)=.]. 174 175 There are compatibility issues between Org mode and some other Elisp 176 packages (see [[*Packages that conflict with Org mode]]). Please take the 177 time to check the list. 178 179 #+findex: org-agenda 180 #+findex: org-capture 181 #+findex: org-store-link 182 For a better experience, the three Org commands ~org-store-link~, 183 ~org-capture~ and ~org-agenda~ ought to be accessible anywhere in 184 Emacs, not just in Org buffers. To that effect, you need to bind them 185 to globally available keys, like the ones reserved for users (see 186 [[info:elisp::Key Binding Conventions]]). Here are suggested bindings, 187 please modify the keys to your own liking. 188 189 #+begin_src emacs-lisp 190 (global-set-key (kbd "C-c l") #'org-store-link) 191 (global-set-key (kbd "C-c a") #'org-agenda) 192 (global-set-key (kbd "C-c c") #'org-capture) 193 #+end_src 194 195 #+cindex: Org mode, turning on 196 Files with the =.org= extension use Org mode by default. To turn on 197 Org mode in a file that does not have the extension =.org=, make the 198 first line of a file look like this: 199 200 : MY PROJECTS -*- mode: org; -*- 201 202 #+vindex: org-insert-mode-line-in-empty-file 203 #+texinfo: @noindent 204 which selects Org mode for this buffer no matter what the file's name 205 is. See also the variable ~org-insert-mode-line-in-empty-file~. 206 207 Many commands in Org work on the region if the region is /active/. To 208 make use of this, you need to have Transient Mark mode turned on, 209 which is the default. If you do not like it, you can create an active 210 region by using the mouse to select a region, or pressing 211 {{{kbd(C-SPC)}}} twice before moving point. 212 213 ** Feedback 214 :PROPERTIES: 215 :DESCRIPTION: Bug reports, ideas, patches, etc. 216 :END: 217 #+cindex: feedback 218 #+cindex: bug reports 219 #+cindex: reporting a bug 220 #+cindex: maintainer 221 #+cindex: author 222 223 If you find problems with Org, or if you have questions, remarks, or 224 ideas about it, please send an email to the Org mailing list 225 [[mailto:emacs-orgmode@gnu.org]]. You can subscribe to the list 226 [[https://lists.gnu.org/mailman/listinfo/emacs-orgmode][from this web 227 page]]. If you are not a member of the mailing list, your mail will 228 be passed to the list after a moderator has approved it[fn:: Please 229 consider subscribing to the mailing list in order to minimize the work 230 the mailing list moderators have to do.]. We ask you to read and 231 respect the 232 [[https://www.gnu.org/philosophy/kind-communication.html][GNU Kind 233 Communications Guidelines]] when sending messages on this mailing 234 list. Please allow up to one month for the response and followup if 235 no response is received on the bug report. 236 237 #+findex: org-version 238 #+findex: org-submit-bug-report 239 For bug reports, please first try to reproduce the bug with the latest 240 version of Org available---if you are running an outdated version, it 241 is quite possible that the bug has been fixed already. If the bug 242 persists, prepare a report and provide as much information as 243 possible, including the version information of Emacs ({{{kbd(M-x 244 emacs-version)}}}) and Org ({{{kbd(M-x org-version)}}}), as well as 245 the Org related setup in the Emacs init file. The easiest way to do 246 this is to use the command 247 248 : M-x org-submit-bug-report <RET> 249 250 #+texinfo: @noindent 251 which puts all this information into an Emacs mail buffer so that you 252 only need to add your description. If you are not sending the Email 253 from within Emacs, please copy and paste the content into your Email 254 program. 255 256 Sometimes you might face a problem due to an error in your Emacs or 257 Org mode setup. Before reporting a bug, it is very helpful to start 258 Emacs with minimal customizations and reproduce the problem. Doing so 259 often helps you determine if the problem is with your customization or 260 with Org mode itself. You can start a typical minimal session with 261 a command like the example below. 262 263 : $ emacs -Q -l /path/to/minimal-org.el 264 265 However if you are using Org mode as distributed with Emacs, a minimal 266 setup is not necessary. In that case it is sufficient to start Emacs 267 as =emacs -Q=. The =minimal-org.el= setup file can have contents as 268 shown below. 269 270 #+begin_src emacs-lisp 271 ;;; Minimal setup to load latest `org-mode'. 272 273 ;; Activate debugging. 274 (setq debug-on-error t 275 debug-on-signal nil 276 debug-on-quit nil) 277 278 ;; Add latest Org mode to load path. 279 (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp")) 280 #+end_src 281 282 If you are using Org mode version from Git repository, you can start 283 minimal session using make. 284 285 : # Bare Emacs 286 : make repro 287 : # or pass extra arguments 288 : make repro REPRO_ARGS="-l /path/to/minimal/config.el /tmp/bug.org" 289 290 If an error occurs, a "backtrace" can be very useful---see below on 291 how to create one. Often a small example file helps, along with clear 292 information about: 293 294 1. What exactly did you do? 295 2. What did you expect to happen? 296 3. What happened instead? 297 298 Thank you for helping to improve this program. 299 300 *** How to create a useful backtrace 301 :PROPERTIES: 302 :UNNUMBERED: notoc 303 :END: 304 305 #+cindex: backtrace of an error 306 If working with Org produces an error with a message you do not 307 understand, you may have hit a bug. The best way to report this is by 308 providing, in addition to what was mentioned above, a backtrace. This 309 is information from the built-in debugger about where and how the 310 error occurred. Here is how to produce a useful backtrace: 311 312 1. Reload uncompiled versions of all Org mode Lisp files. The 313 backtrace contains much more information if it is produced with 314 uncompiled code. To do this, use 315 316 : C-u M-x org-reload <RET> 317 318 #+texinfo: @noindent 319 or, from the menu: Org \rarr Refresh/Reload \rarr Reload Org uncompiled. 320 321 2. Then, activate the debugger: 322 323 : M-x toggle-debug-on-error <RET> 324 325 #+texinfo: @noindent 326 or, from the menu: Options \rarr Enter Debugger on Error. 327 328 3. Do whatever you have to do to hit the error. Do not forget to 329 document the steps you take. 330 331 4. When you hit the error, a =*Backtrace*= buffer appears on the 332 screen. Save this buffer to a file---for example using {{{kbd(C-x 333 C-w)}}}---and attach it to your bug report. 334 335 ** Typesetting Conventions Used in this Manual 336 :PROPERTIES: 337 :DESCRIPTION: Typesetting conventions used in this manual. 338 :ALT_TITLE: Conventions 339 :END: 340 341 *** TODO keywords, tags, properties, etc. 342 :PROPERTIES: 343 :UNNUMBERED: notoc 344 :END: 345 346 Org uses various syntactical elements: TODO keywords, tags, property 347 names, keywords, blocks, etc. In this manual we use the following 348 conventions: 349 350 #+attr_texinfo: :sep , 351 - =TODO=, =WAITING= :: 352 353 TODO keywords are written with all capitals, even if they are 354 user-defined. 355 356 - =boss=, =ARCHIVE= :: 357 358 Tags are case-sensitive. User-defined tags are usually written in 359 lowercase; built-in tags with special meaning are written as they 360 should appear in the document, usually with all capitals. 361 362 - =Release=, =PRIORITY= :: 363 364 User-defined properties are capitalized; built-in properties with 365 special meaning are written with all capitals. 366 367 - =TITLE=, =BEGIN= ... =END= :: 368 369 Keywords and blocks are written in uppercase to enhance their 370 readability, but you can use lowercase in your Org files. 371 372 *** Key bindings and commands 373 :PROPERTIES: 374 :UNNUMBERED: notoc 375 :END: 376 377 The manual lists both the keys and the corresponding commands for 378 accessing a functionality. Org mode often uses the same key for 379 different functions, depending on context. The command that is bound 380 to such keys has a generic name, like ~org-metaright~. In the manual 381 we will, wherever possible, give the function that is internally 382 called by the generic command. For example, in the chapter on 383 document structure, {{{kbd(M-RIGHT)}}} will be listed to call 384 ~org-do-demote~, while in the chapter on tables, it will be listed to 385 call ~org-table-move-column-right~. 386 387 * Document Structure 388 :PROPERTIES: 389 :DESCRIPTION: A tree works like your brain. 390 :END: 391 392 #+cindex: document structure 393 #+cindex: structure of document 394 Org is an outliner. Outlines allow a document to be organized in 395 a hierarchical structure, which, least for me, is the best 396 representation of notes and thoughts. An overview of this structure 397 is achieved by folding, i.e., hiding large parts of the document to 398 show only the general document structure and the parts currently being 399 worked on. Org greatly simplifies the use of outlines by compressing 400 the entire show and hide functionalities into a single command, 401 ~org-cycle~, which is bound to the {{{kbd(TAB)}}} key. 402 403 ** Headlines 404 :PROPERTIES: 405 :DESCRIPTION: How to typeset Org tree headlines. 406 :END: 407 #+cindex: headlines 408 #+cindex: outline tree 409 #+vindex: org-special-ctrl-a/e 410 #+vindex: org-special-ctrl-k 411 #+vindex: org-ctrl-k-protect-subtree 412 413 Headlines define the structure of an outline tree. Org headlines 414 start on the left margin[fn:1] with one or more stars followed by 415 a space. For example: 416 417 #+begin_example 418 ,* Top level headline 419 ,** Second level 420 ,*** Third level 421 some text 422 ,*** Third level 423 more text 424 ,* Another top level headline 425 #+end_example 426 427 #+vindex: org-footnote-section 428 The name defined in ~org-footnote-section~ is reserved. Do not use it 429 as a title for your own headings. 430 431 Some people find the many stars too noisy and would prefer an outline 432 that has whitespace followed by a single star as headline starters. 433 This can be achieved using a Org Indent minor mode. See [[*A Cleaner 434 Outline View]] for more information. 435 436 Headlines are not numbered. However, you may want to dynamically 437 number some, or all, of them. See [[*Dynamic Headline Numbering]]. 438 439 #+vindex: org-cycle-separator-lines 440 An empty line after the end of a subtree is considered part of it and 441 is hidden when the subtree is folded. However, if you leave at least 442 two empty lines, one empty line remains visible after folding the 443 subtree, in order to structure the collapsed view. See the variable 444 ~org-cycle-separator-lines~ to modify this behavior. 445 446 ** Visibility Cycling 447 :PROPERTIES: 448 :DESCRIPTION: Show and hide, much simplified. 449 :END: 450 #+cindex: cycling, visibility 451 #+cindex: visibility cycling 452 #+cindex: trees, visibility 453 #+cindex: show hidden text 454 #+cindex: hide text 455 456 *** Global and local cycling 457 :PROPERTIES: 458 :DESCRIPTION: Cycling through various visibility states. 459 :END: 460 #+cindex: subtree visibility states 461 #+cindex: subtree cycling 462 #+cindex: folded, subtree visibility state 463 #+cindex: children, subtree visibility state 464 #+cindex: subtree, subtree visibility state 465 466 Outlines make it possible to hide parts of the text in the buffer. 467 Org uses just two commands, bound to {{{kbd(TAB)}}} and 468 {{{kbd(S-TAB)}}} to change the visibility in the buffer. 469 470 #+attr_texinfo: :sep , 471 - {{{kbd(TAB)}}} (~org-cycle~) :: 472 473 #+kindex: TAB 474 #+findex: org-cycle 475 /Subtree cycling/: Rotate current subtree among the states 476 477 #+begin_example 478 ,-> FOLDED -> CHILDREN -> SUBTREE --. 479 '-----------------------------------' 480 #+end_example 481 482 #+vindex: org-cycle-emulate-tab 483 Point must be on a headline for this to work[fn:: See, however, the 484 option ~org-cycle-emulate-tab~.]. 485 486 - {{{kbd(S-TAB)}}} (~org-global-cycle~), {{{kbd(C-u TAB)}}} :: 487 488 #+cindex: global visibility states 489 #+cindex: global cycling 490 #+cindex: overview, global visibility state 491 #+cindex: contents, global visibility state 492 #+cindex: show all, global visibility state 493 #+kindex: C-u TAB 494 #+kindex: S-TAB 495 #+findex: org-global-cycle 496 /Global cycling/: Rotate the entire buffer among the states 497 498 #+begin_example 499 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --. 500 '--------------------------------------' 501 #+end_example 502 503 When {{{kbd(S-TAB)}}} is called with a numeric prefix argument 504 {{{var(N)}}}, view contents only up to headlines of level 505 {{{var(N)}}}. 506 507 Note that inside tables (see [[*Tables]]), {{{kbd(S-TAB)}}} jumps to the 508 previous field instead. 509 510 #+vindex: org-cycle-global-at-bob 511 You can run global cycling using {{{kbd(TAB)}}} only if point is at 512 the very beginning of the buffer, but not on a headline, and 513 ~org-cycle-global-at-bob~ is set to a non-~nil~ value. 514 515 - {{{kbd(C-u C-u TAB)}}} (~org-set-startup-visibility~) :: 516 517 #+cindex: startup visibility 518 #+kindex: C-u C-u TAB 519 #+findex: org-set-startup-visibility 520 Switch back to the startup visibility of the buffer (see [[*Initial 521 visibility]]). 522 523 - {{{kbd(C-u C-u C-u TAB)}}} (~org-show-all~) :: 524 525 #+cindex: show all, command 526 #+kindex: C-u C-u C-u TAB 527 #+findex: org-show-all 528 Show all, including drawers. 529 530 - {{{kbd(C-c C-r)}}} (~org-reveal~) :: 531 532 #+cindex: revealing context 533 #+kindex: C-c C-r 534 #+findex: org-reveal 535 Reveal context around point, showing the current entry, the 536 following heading and the hierarchy above. It is useful for working 537 near a location that has been exposed by a sparse tree command (see 538 [[*Sparse Trees]]) or an agenda command (see [[*Commands in the Agenda 539 Buffer]]). With a prefix argument, show, on each level, all sibling 540 headings. With a double prefix argument, also show the entire 541 subtree of the parent. 542 543 - {{{kbd(C-c C-k)}}} (~org-show-branches~) :: 544 545 #+cindex: show branches, command 546 #+kindex: C-c C-k 547 #+findex: org-show-branches 548 Expose all the headings of the subtree, but not their bodies. 549 550 - {{{kbd(C-c TAB)}}} (~org-show-children~) :: 551 552 #+cindex: show children, command 553 #+kindex: C-c TAB 554 #+findex: org-show-children 555 Expose all direct children of the subtree. With a numeric prefix 556 argument {{{var(N)}}}, expose all children down to level 557 {{{var(N)}}}. 558 559 - {{{kbd(C-c C-x b)}}} (~org-tree-to-indirect-buffer~) :: 560 561 #+kindex: C-c C-x b 562 #+findex: org-tree-to-indirect-buffer 563 Show the current subtree in an indirect buffer[fn:2]. With 564 a numeric prefix argument {{{var(N)}}}, go up to level {{{var(N)}}} 565 and then take that tree. If {{{var(N)}}} is negative then go up 566 that many levels. With a {{{kbd(C-u)}}} prefix, do not remove the 567 previously used indirect buffer. 568 569 - {{{kbd(C-c C-x v)}}} (~org-copy-visible~) :: 570 571 #+kindex: C-c C-x v 572 #+findex: org-copy-visible 573 Copy the /visible/ text in the region into the kill ring. 574 575 *** Initial visibility 576 :PROPERTIES: 577 :DESCRIPTION: Setting the initial visibility state. 578 :END: 579 580 #+vindex: org-startup-folded 581 When Emacs first visits an Org file, the global state is set to 582 ~showeverything~, i.e., all file content is visible[fn:: When 583 ~org-agenda-inhibit-startup~ is non-~nil~, Org does not honor the 584 default visibility state when first opening a file for the agenda (see 585 [[*Speeding Up Your Agendas]]).]. This can be configured through the 586 variable ~org-startup-folded~, or on a per-file basis by adding one of 587 the following lines anywhere in the buffer: 588 589 #+cindex: @samp{STARTUP}, keyword 590 #+begin_example 591 ,#+STARTUP: overview 592 ,#+STARTUP: content 593 ,#+STARTUP: showall 594 ,#+STARTUP: show2levels 595 ,#+STARTUP: show3levels 596 ,#+STARTUP: show4levels 597 ,#+STARTUP: show5levels 598 ,#+STARTUP: showeverything 599 #+end_example 600 601 #+cindex: @samp{VISIBILITY}, property 602 Furthermore, any entries with a =VISIBILITY= property (see [[*Properties 603 and Columns]]) get their visibility adapted accordingly. Allowed values 604 for this property are =folded=, =children=, =content=, and =all=. 605 606 - {{{kbd(C-u C-u TAB)}}} (~org-set-startup-visibility~) :: 607 608 #+kindex: C-u C-u TAB 609 #+findex: org-set-startup-visibility 610 Switch back to the startup visibility of the buffer, i.e., whatever 611 is requested by startup options and =VISIBILITY= properties in 612 individual entries. 613 614 *** Catching invisible edits 615 :PROPERTIES: 616 :DESCRIPTION: Preventing mistakes when editing invisible parts. 617 :END: 618 #+cindex: edits, catching invisible 619 620 #+vindex: org-fold-catch-invisible-edits 621 Sometimes you may inadvertently edit an invisible part of the buffer 622 and be confused on what has been edited and how to undo the mistake. 623 Setting ~org-fold-catch-invisible-edits~ to non-~nil~ helps preventing 624 this. See the docstring of this option on how Org should catch 625 invisible edits and process them. 626 627 ** Motion 628 :PROPERTIES: 629 :DESCRIPTION: Jumping to other headlines. 630 :END: 631 #+cindex: motion, between headlines 632 #+cindex: jumping, to headlines 633 #+cindex: headline navigation 634 635 The following commands jump to other headlines in the buffer. 636 637 - {{{kbd(C-c C-n)}}} (~org-next-visible-heading~) :: 638 639 #+kindex: C-c C-n 640 #+findex: org-next-visible-heading 641 Next heading. 642 643 - {{{kbd(C-c C-p)}}} (~org-previous-visible-heading~) :: 644 645 #+kindex: C-c C-p 646 #+findex: org-previous-visible-heading 647 Previous heading. 648 649 - {{{kbd(C-c C-f)}}} (~org-forward-heading-same-level~) :: 650 651 #+kindex: C-c C-f 652 #+findex: org-forward-heading-same-level 653 Next heading same level. 654 655 - {{{kbd(C-c C-b)}}} (~org-backward-heading-same-level~) :: 656 657 #+kindex: C-c C-b 658 #+findex: org-backward-heading-same-level 659 Previous heading same level. 660 661 - {{{kbd(C-c C-u)}}} (~outline-up-heading~) :: 662 663 #+kindex: C-c C-u 664 #+findex: outline-up-heading 665 Backward to higher level heading. 666 667 - {{{kbd(C-c C-j)}}} (~org-goto~) :: 668 669 #+kindex: C-c C-j 670 #+findex: org-goto 671 #+vindex: org-goto-auto-isearch 672 Jump to a different place without changing the current outline 673 visibility. Shows the document structure in a temporary buffer, 674 where you can use the following keys to find your destination: 675 676 #+attr_texinfo: :columns 0.3 0.7 677 | {{{kbd(TAB)}}} | Cycle visibility. | 678 | {{{kbd(DOWN)}}} / {{{kbd(UP)}}} | Next/previous visible headline. | 679 | {{{kbd(RET)}}} | Select this location. | 680 | {{{kbd(/)}}} | Do a Sparse-tree search | 681 682 #+texinfo: @noindent 683 The following keys work if you turn off ~org-goto-auto-isearch~ 684 685 #+attr_texinfo: :columns 0.3 0.7 686 | {{{kbd(n)}}} / {{{kbd(p)}}} | Next/previous visible headline. | 687 | {{{kbd(f)}}} / {{{kbd(b)}}} | Next/previous headline same level. | 688 | {{{kbd(u)}}} | One level up. | 689 | {{{kbd(0)}}} ... {{{kbd(9)}}} | Digit argument. | 690 | {{{kbd(q)}}} | Quit. | 691 692 #+vindex: org-goto-interface 693 #+texinfo: @noindent 694 See also the variable ~org-goto-interface~. 695 696 ** Structure Editing 697 :PROPERTIES: 698 :DESCRIPTION: Changing sequence and level of headlines. 699 :END: 700 #+cindex: structure editing 701 #+cindex: headline, promotion and demotion 702 #+cindex: promotion, of subtrees 703 #+cindex: demotion, of subtrees 704 #+cindex: subtree, cut and paste 705 #+cindex: pasting, of subtrees 706 #+cindex: cutting, of subtrees 707 #+cindex: copying, of subtrees 708 #+cindex: sorting, of subtrees 709 #+cindex: subtrees, cut and paste 710 711 #+attr_texinfo: :sep , 712 - {{{kbd(M-RET)}}} (~org-meta-return~) :: 713 714 #+kindex: M-RET 715 #+findex: org-meta-return 716 #+vindex: org-M-RET-may-split-line 717 Insert a new heading, item or row. 718 719 If the command is used at the /beginning/ of a line, and if there is 720 a heading or a plain list item (see [[*Plain Lists]]) at point, the new 721 heading/item is created /before/ the current line. When used at the 722 beginning of a regular line of text, turn that line into a heading. 723 724 When this command is used in the middle of a line, the line is split 725 and the rest of the line becomes the new item or headline. If you 726 do not want the line to be split, customize 727 ~org-M-RET-may-split-line~. 728 729 Calling the command with a {{{kbd(C-u)}}} prefix unconditionally 730 inserts a new heading at the end of the current subtree, thus 731 preserving its contents. With a double {{{kbd(C-u C-u)}}} prefix, 732 the new heading is created at the end of the parent subtree instead. 733 734 - {{{kbd(C-RET)}}} (~org-insert-heading-respect-content~) :: 735 736 #+kindex: C-RET 737 #+findex: org-insert-heading-respect-content 738 Insert a new heading at the end of the current subtree. 739 740 - {{{kbd(M-S-RET)}}} (~org-insert-todo-heading~) :: 741 742 #+kindex: M-S-RET 743 #+findex: org-insert-todo-heading 744 #+vindex: org-treat-insert-todo-heading-as-state-change 745 Insert new TODO entry with same level as current heading. See also 746 the variable ~org-treat-insert-todo-heading-as-state-change~. 747 748 - {{{kbd(C-S-RET)}}} (~org-insert-todo-heading-respect-content~) :: 749 750 #+kindex: C-S-RET 751 #+findex: org-insert-todo-heading-respect-content 752 Insert new TODO entry with same level as current heading. Like 753 {{{kbd(C-RET)}}}, the new headline is inserted after the current 754 subtree. 755 756 - {{{kbd(TAB)}}} (~org-cycle~) :: 757 758 #+kindex: TAB 759 #+findex: org-cycle 760 In a new entry with no text yet, the first {{{kbd(TAB)}}} demotes 761 the entry to become a child of the previous one. The next 762 {{{kbd(TAB)}}} makes it a parent, and so on, all the way to top 763 level. Yet another {{{kbd(TAB)}}}, and you are back to the initial 764 level. 765 766 - {{{kbd(M-LEFT)}}} (~org-do-promote~), {{{kbd(M-RIGHT)}}} (~org-do-demote~) :: 767 768 #+kindex: M-LEFT 769 #+findex: org-do-promote 770 #+kindex: M-RIGHT 771 #+findex: org-do-demote 772 Promote or demote current heading by one level. 773 774 #+cindex: region, active 775 #+cindex: active region 776 #+cindex: transient mark mode 777 When there is an active region---i.e., when Transient Mark mode is 778 active---promotion and demotion work on all headlines in the region. 779 To select a region of headlines, it is best to place both point and 780 mark at the beginning of a line, mark at the beginning of the first 781 headline, and point at the line just after the last headline to 782 change. 783 784 - {{{kbd(M-S-LEFT)}}} (~org-promote-subtree~) :: 785 786 #+kindex: M-S-LEFT 787 #+findex: org-promote-subtree 788 Promote the current subtree by one level. 789 790 - {{{kbd(M-S-RIGHT)}}} (~org-demote-subtree~) :: 791 792 #+kindex: M-S-RIGHT 793 #+findex: org-demote-subtree 794 Demote the current subtree by one level. 795 796 - {{{kbd(M-UP)}}} (~org-move-subtree-up~) :: 797 798 #+kindex: M-UP 799 #+findex: org-move-subtree-up 800 Move subtree up, i.e., swap with previous subtree of same level. 801 802 - {{{kbd(M-DOWN)}}} (~org-move-subtree-down~) :: 803 804 #+kindex: M-DOWN 805 #+findex: org-move-subtree-down 806 Move subtree down, i.e., swap with next subtree of same level. 807 808 - {{{kbd(C-c @)}}} (~org-mark-subtree~) :: 809 810 #+kindex: C-c @@ 811 #+findex: org-mark-subtree 812 Mark the subtree at point. Hitting repeatedly marks subsequent 813 subtrees of the same level as the marked subtree. 814 815 - {{{kbd(C-c C-x C-w)}}} (~org-cut-subtree~) :: 816 817 #+kindex: C-c C-x C-w 818 #+findex: org-cut-subtree 819 Kill subtree, i.e., remove it from buffer but save in kill ring. 820 With a numeric prefix argument N, kill N sequential subtrees. 821 822 - {{{kbd(C-c C-x M-w)}}} (~org-copy-subtree~) :: 823 824 #+kindex: C-c C-x M-w 825 #+findex: org-copy-subtree 826 Copy subtree to kill ring. With a numeric prefix argument N, copy 827 the N sequential subtrees. 828 829 - {{{kbd(C-c C-x C-y)}}} (~org-paste-subtree~) :: 830 831 #+kindex: C-c C-x C-y 832 #+findex: org-paste-subtree 833 Yank subtree from kill ring. This does modify the level of the 834 subtree to make sure the tree fits in nicely at the yank position. 835 The yank level can also be specified with a numeric prefix argument, 836 or by yanking after a headline marker like =****=. 837 838 - {{{kbd(C-y)}}} (~org-yank~) :: 839 840 #+kindex: C-y 841 #+findex: org-yank 842 #+vindex: org-yank-adjusted-subtrees 843 #+vindex: org-yank-folded-subtrees 844 Depending on the variables ~org-yank-adjusted-subtrees~ and 845 ~org-yank-folded-subtrees~, Org's internal ~yank~ command pastes 846 subtrees folded and in a clever way, using the same command as 847 {{{kbd(C-c C-x C-y)}}}. With the default settings, no level 848 adjustment takes place, but the yanked tree is folded unless doing 849 so would swallow text previously visible. Any prefix argument to 850 this command forces a normal ~yank~ to be executed, with the prefix 851 passed along. A good way to force a normal yank is {{{kbd(C-u 852 C-y)}}}. If you use ~yank-pop~ after a yank, it yanks previous kill 853 items plainly, without adjustment and folding. 854 855 - {{{kbd(C-c C-x c)}}} (~org-clone-subtree-with-time-shift~) :: 856 857 #+kindex: C-c C-x c 858 #+findex: org-clone-subtree-with-time-shift 859 Clone a subtree by making a number of sibling copies of it. You are 860 prompted for the number of copies to make, and you can also specify 861 if any timestamps in the entry should be shifted. This can be 862 useful, for example, to create a number of tasks related to a series 863 of lectures to prepare. For more details, see the docstring of the 864 command ~org-clone-subtree-with-time-shift~. 865 866 - {{{kbd(C-c C-w)}}} (~org-refile~) :: 867 868 #+kindex: C-c C-w 869 #+findex: org-refile 870 Refile entry or region to a different location. See [[*Refile and 871 Copy]]. 872 873 - {{{kbd(C-c ^)}}} (~org-sort~) :: 874 875 #+kindex: C-c ^ 876 #+findex: org-sort 877 Sort same-level entries. When there is an active region, all 878 entries in the region are sorted. Otherwise the children of the 879 current headline are sorted. The command prompts for the sorting 880 method, which can be alphabetically, numerically, by time---first 881 timestamp with active preferred, creation time, scheduled time, 882 deadline time---by priority, by TODO keyword---in the sequence the 883 keywords have been defined in the setup---or by the value of 884 a property. Reverse sorting is possible as well. You can also 885 supply your own function to extract the sorting key. With 886 a {{{kbd(C-u)}}} prefix, sorting is case-sensitive. 887 888 - {{{kbd(C-x n s)}}} (~org-narrow-to-subtree~) :: 889 890 #+kindex: C-x n s 891 #+findex: org-narrow-to-subtree 892 Narrow buffer to current subtree. 893 894 - {{{kbd(C-x n b)}}} (~org-narrow-to-block~) :: 895 896 #+kindex: C-x n b 897 #+findex: org-narrow-to-block 898 Narrow buffer to current block. 899 900 - {{{kbd(C-x n w)}}} (~widen~) :: 901 902 #+kindex: C-x n w 903 #+findex: widen 904 Widen buffer to remove narrowing. 905 906 - {{{kbd(C-c *)}}} (~org-toggle-heading~) :: 907 908 #+kindex: C-c * 909 #+findex: org-toggle-heading 910 Turn a normal line or plain list item into a headline---so that it 911 becomes a subheading at its location. Also turn a headline into 912 a normal line by removing the stars. If there is an active region, 913 turn all lines in the region into headlines. If the first line in 914 the region was an item, turn only the item lines into headlines. 915 Finally, if the first line is a headline, remove the stars from all 916 headlines in the region. 917 918 Note that when point is inside a table (see [[*Tables]]), the Meta-Cursor 919 keys have different functionality. 920 921 ** Sparse Trees 922 :PROPERTIES: 923 :DESCRIPTION: Matches embedded in context. 924 :END: 925 #+cindex: sparse trees 926 #+cindex: trees, sparse 927 #+cindex: folding, sparse trees 928 #+cindex: occur, command 929 930 #+vindex: org-show-context-detail 931 An important feature of Org mode is the ability to construct /sparse 932 trees/ for selected information in an outline tree, so that the entire 933 document is folded as much as possible, but the selected information 934 is made visible along with the headline structure above it[fn:: See 935 also the variable ~org-show-context-detail~ to decide how much context 936 is shown around each match.]. Just try it out and you will see 937 immediately how it works. 938 939 Org mode contains several commands creating such trees, all these 940 commands can be accessed through a dispatcher: 941 942 - {{{kbd(C-c /)}}} (~org-sparse-tree~) :: 943 944 #+kindex: C-c / 945 #+findex: org-sparse-tree 946 This prompts for an extra key to select a sparse-tree creating 947 command. 948 949 - {{{kbd(C-c / r)}}} or {{{kbd(C-c / /)}}} (~org-occur~) :: 950 951 #+kindex: C-c / r 952 #+kindex: C-c / / 953 #+findex: org-occur 954 #+vindex: org-remove-highlights-with-change 955 Prompts for a regexp (see [[*Regular Expressions]]) and shows a 956 sparse tree with all matches. If the match is in a headline, the 957 headline is made visible. If the match is in the body of an entry, 958 headline and body are made visible. In order to provide minimal 959 context, also the full hierarchy of headlines above the match is 960 shown, as well as the headline following the match. Each match is 961 also highlighted; the highlights disappear when the buffer is 962 changed by an editing command, or by pressing {{{kbd(C-c 963 C-c)}}}[fn:: This depends on the option 964 ~org-remove-highlights-with-change~.]. When called with a 965 {{{kbd(C-u)}}} prefix argument, previous highlights are kept, so 966 several calls to this command can be stacked. 967 968 - {{{kbd(M-g n)}}} or {{{kbd(M-g M-n)}}} (~next-error~) :: 969 970 #+kindex: M-g n 971 #+kindex: M-g M-n 972 #+findex: next-error 973 Jump to the next sparse tree match in this buffer. 974 975 - {{{kbd(M-g p)}}} or {{{kbd(M-g M-p)}}} (~previous-error~) :: 976 977 #+kindex: M-g p 978 #+kindex: M-g M-p 979 #+findex: previous-error 980 Jump to the previous sparse tree match in this buffer. 981 982 #+vindex: org-agenda-custom-commands 983 For frequently used sparse trees of specific search strings, you can 984 use the variable ~org-agenda-custom-commands~ to define fast keyboard 985 access to specific sparse trees. These commands will then be 986 accessible through the agenda dispatcher (see [[*The Agenda Dispatcher]]). 987 For example: 988 989 #+begin_src emacs-lisp 990 (setq org-agenda-custom-commands 991 '(("f" occur-tree "FIXME"))) 992 #+end_src 993 994 #+texinfo: @noindent 995 defines the key {{{kbd(f)}}} as a shortcut for creating a sparse tree 996 matching the string =FIXME=. 997 998 The other sparse tree commands select headings based on TODO keywords, 999 tags, or properties and are discussed later in this manual. 1000 1001 #+kindex: C-c C-e C-v 1002 #+cindex: printing sparse trees 1003 #+cindex: visible text, printing 1004 To print a sparse tree, you can use the Emacs command 1005 ~ps-print-buffer-with-faces~ which does not print invisible parts of 1006 the document. Or you can use the command {{{kbd(C-c C-e C-v)}}} to 1007 export only the visible part of the document and print the resulting 1008 file. 1009 1010 ** Plain Lists 1011 :PROPERTIES: 1012 :DESCRIPTION: Additional structure within an entry. 1013 :END: 1014 #+cindex: plain lists 1015 #+cindex: lists, plain 1016 #+cindex: lists, ordered 1017 #+cindex: ordered lists 1018 1019 Within an entry of the outline tree, hand-formatted lists can provide 1020 additional structure. They also provide a way to create lists of 1021 checkboxes (see [[*Checkboxes]]). Org supports editing such lists, and 1022 every exporter (see [[*Exporting]]) can parse and format them. 1023 1024 Org knows ordered lists, unordered lists, and description lists. 1025 1026 #+attr_texinfo: :indic @bullet 1027 - /Unordered/ list items start with =-=, =+=, or =*=[fn:3] as bullets. 1028 1029 - 1030 #+vindex: org-plain-list-ordered-item-terminator 1031 #+vindex: org-alphabetical-lists 1032 /Ordered/ list items start with a numeral followed by either a 1033 period or a right parenthesis[fn:: You can filter out any of them by 1034 configuring ~org-plain-list-ordered-item-terminator~.], such as =1.= 1035 or =1)=[fn:4] If you want a list to start with a different 1036 value---e.g., 20---start the text of the item with =[@20]=[fn:5]. 1037 Those constructs can be used in any item of the list in order to 1038 enforce a particular numbering. 1039 1040 - /Description/ list items are unordered list items, and contain the 1041 separator =::= to distinguish the description /term/ from the 1042 description. 1043 1044 Items belonging to the same list must have the same indentation on the 1045 first line. In particular, if an ordered list reaches number =10.=, 1046 then the 2-digit numbers must be written left-aligned with the other 1047 numbers in the list. An item ends before the next line that is less 1048 or equally indented than its bullet/number. 1049 1050 A list ends whenever every item has ended, which means before any line 1051 less or equally indented than items at top level. It also ends before 1052 two blank lines. In that case, all items are closed. Here is an 1053 example: 1054 1055 #+begin_example 1056 ,* Lord of the Rings 1057 My favorite scenes are (in this order) 1058 1. The attack of the Rohirrim 1059 2. Eowyn's fight with the witch king 1060 + this was already my favorite scene in the book 1061 + I really like Miranda Otto. 1062 3. Peter Jackson being shot by Legolas 1063 - on DVD only 1064 He makes a really funny face when it happens. 1065 But in the end, no individual scenes matter but the film as a whole. 1066 Important actors in this film are: 1067 - Elijah Wood :: He plays Frodo 1068 - Sean Astin :: He plays Sam, Frodo's friend. I still remember him 1069 very well from his role as Mikey Walsh in /The Goonies/. 1070 #+end_example 1071 1072 Org supports these lists by tuning filling and wrapping commands to 1073 deal with them correctly, and by exporting them properly (see 1074 [[*Exporting]]). Since indentation is what governs the structure of these 1075 lists, many structural constructs like =#+BEGIN_= blocks can be 1076 indented to signal that they belong to a particular item. 1077 1078 #+vindex: org-list-demote-modify-bullet 1079 #+vindex: org-list-indent-offset 1080 If you find that using a different bullet for a sub-list---than that 1081 used for the current list-level---improves readability, customize the 1082 variable ~org-list-demote-modify-bullet~. To get a greater difference 1083 of indentation between items and theirs sub-items, customize 1084 ~org-list-indent-offset~. 1085 1086 #+vindex: org-list-automatic-rules 1087 The following commands act on items when point is in the first line of 1088 an item---the line with the bullet or number. Some of them imply the 1089 application of automatic rules to keep list structure intact. If some 1090 of these actions get in your way, configure ~org-list-automatic-rules~ 1091 to disable them individually. 1092 1093 #+attr_texinfo: :sep , 1094 - {{{kbd(TAB)}}} (~org-cycle~) :: 1095 1096 #+cindex: cycling, in plain lists 1097 #+kindex: TAB 1098 #+findex: org-cycle 1099 #+vindex: org-cycle-include-plain-lists 1100 Items can be folded just like headline levels. Normally this works 1101 only if point is on a plain list item. For more details, see the 1102 variable ~org-cycle-include-plain-lists~. If this variable is set 1103 to ~integrate~, plain list items are treated like low-level 1104 headlines. The level of an item is then given by the indentation of 1105 the bullet/number. Items are always subordinate to real headlines, 1106 however; the hierarchies remain completely separated. In a new item 1107 with no text yet, the first {{{kbd(TAB)}}} demotes the item to 1108 become a child of the previous one. Subsequent {{{kbd(TAB)}}}s move 1109 the item to meaningful levels in the list and eventually get it back 1110 to its initial position. 1111 1112 - {{{kbd(M-RET)}}} (~org-insert-heading~) :: 1113 1114 #+kindex: M-RET 1115 #+findex: org-insert-heading 1116 #+vindex: org-M-RET-may-split-line 1117 Insert new item at current level. With a prefix argument, force a 1118 new heading (see [[*Structure Editing]]). If this command is used 1119 in the middle of an item, that item is /split/ in two, and the 1120 second part becomes the new item[fn:: If you do not want the item to 1121 be split, customize the variable ~org-M-RET-may-split-line~.]. If 1122 this command is executed /before item's body/, the new item is 1123 created /before/ the current one. 1124 1125 - {{{kbd(M-S-RET)}}} :: 1126 1127 #+kindex: M-S-RET 1128 Insert a new item with a checkbox (see [[*Checkboxes]]). 1129 1130 - {{{kbd(S-UP)}}}, {{{kbd(S-DOWN)}}} :: 1131 1132 #+kindex: S-UP 1133 #+kindex: S-DOWN 1134 #+cindex: shift-selection-mode 1135 #+vindex: org-support-shift-select 1136 #+vindex: org-list-use-circular-motion 1137 Jump to the previous/next item in the current list, but only if 1138 ~org-support-shift-select~ is off[fn:: If you want to cycle around 1139 items that way, you may customize ~org-list-use-circular-motion~.]. 1140 If not, you can still use paragraph jumping commands like 1141 {{{kbd(C-UP)}}} and {{{kbd(C-DOWN)}}} to quite similar effect. 1142 1143 - {{{kbd(M-UP)}}}, {{{kbd(M-DOWN)}}} :: 1144 1145 #+kindex: M-UP 1146 #+kindex: M-DOWN 1147 Move the item including subitems up/down[fn:: See 1148 ~org-list-use-circular-motion~ for a cyclic behavior.], i.e., swap 1149 with previous/next item of same indentation. If the list is 1150 ordered, renumbering is automatic. 1151 1152 - {{{kbd(M-LEFT)}}}, {{{kbd(M-RIGHT)}}} :: 1153 1154 #+kindex: M-LEFT 1155 #+kindex: M-RIGHT 1156 Decrease/increase the indentation of an item, leaving children 1157 alone. 1158 1159 - {{{kbd(M-S-LEFT)}}}, {{{kbd(M-S-RIGHT)}}} :: 1160 1161 #+kindex: M-S-LEFT 1162 #+kindex: M-S-RIGHT 1163 Decrease/increase the indentation of the item, including subitems. 1164 Initially, the item tree is selected based on current indentation. 1165 When these commands are executed several times in direct succession, 1166 the initially selected region is used, even if the new indentation 1167 would imply a different hierarchy. To use the new hierarchy, break 1168 the command chain by moving point. 1169 1170 As a special case, using this command on the very first item of 1171 a list moves the whole list. This behavior can be disabled by 1172 configuring ~org-list-automatic-rules~. The global indentation of 1173 a list has no influence on the text /after/ the list. 1174 1175 - {{{kbd(C-c C-c)}}} :: 1176 1177 #+kindex: C-c C-c 1178 If there is a checkbox (see [[*Checkboxes]]) in the item line, toggle 1179 the state of the checkbox. In any case, verify bullets and 1180 indentation consistency in the whole list. 1181 1182 - {{{kbd(C-c -)}}} :: 1183 1184 #+kindex: C-c - 1185 #+vindex: org-plain-list-ordered-item-terminator 1186 Cycle the entire list level through the different itemize/enumerate 1187 bullets (=-=, =+=, =*=, =1.=, =1)=) or a subset of them, depending 1188 on ~org-plain-list-ordered-item-terminator~, the type of list, and 1189 its indentation. With a numeric prefix argument N, select the Nth 1190 bullet from this list. If there is an active region when calling 1191 this, all lines are converted to list items. With a prefix 1192 argument, the selected text is changed into a single item. If the 1193 first line already was a list item, any item marker is removed from 1194 the list. Finally, even without an active region, a normal line is 1195 converted into a list item. 1196 1197 - {{{kbd(C-c *)}}} :: 1198 1199 #+kindex: C-c * 1200 Turn a plain list item into a headline---so that it becomes 1201 a subheading at its location. See [[*Structure Editing]], for 1202 a detailed explanation. 1203 1204 - {{{kbd(C-c C-*)}}} :: 1205 1206 #+kindex: C-c C-* 1207 Turn the whole plain list into a subtree of the current heading. 1208 Checkboxes (see [[*Checkboxes]]) become =TODO=, respectively =DONE=, 1209 keywords when unchecked, respectively checked. 1210 1211 - {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} :: 1212 1213 #+vindex: org-support-shift-select 1214 #+kindex: S-LEFT 1215 #+kindex: S-RIGHT 1216 This command also cycles bullet styles when point is in on the 1217 bullet or anywhere in an item line, details depending on 1218 ~org-support-shift-select~. 1219 1220 - {{{kbd(C-c ^)}}} :: 1221 1222 #+kindex: C-c ^ 1223 #+cindex: sorting, of plain list 1224 Sort the plain list. Prompt for the sorting method: numerically, 1225 alphabetically, by time, or by custom function. 1226 1227 ** Drawers 1228 :PROPERTIES: 1229 :DESCRIPTION: Tucking stuff away. 1230 :END: 1231 #+cindex: drawers 1232 #+cindex: visibility cycling, drawers 1233 1234 Sometimes you want to keep information associated with an entry, but 1235 you normally do not want to see it. For this, Org mode has /drawers/. 1236 They can contain anything but a headline and another drawer. Drawers 1237 look like this: 1238 1239 #+begin_example 1240 ,** This is a headline 1241 Still outside the drawer 1242 :DRAWERNAME: 1243 This is inside the drawer. 1244 :END: 1245 After the drawer. 1246 #+end_example 1247 1248 #+kindex: C-c C-x d 1249 #+findex: org-insert-drawer 1250 You can interactively insert a drawer at point by calling 1251 ~org-insert-drawer~, which is bound to {{{kbd(C-c C-x d)}}}. With an 1252 active region, this command puts the region inside the drawer. With a 1253 prefix argument, this command calls non-interactive function 1254 ~org-insert-property-drawer~, which creates a =PROPERTIES= drawer 1255 right below the current headline. Org mode uses this special drawer 1256 for storing properties (see [[*Properties and Columns]]). You cannot use 1257 it for anything else. 1258 1259 Completion over drawer keywords is also possible using 1260 {{{kbd(M-TAB)}}}[fn:6]. 1261 1262 Visibility cycling (see [[*Visibility Cycling]]) on the headline hides and 1263 shows the entry, but keep the drawer collapsed to a single line. In 1264 order to look inside the drawer, you need to move point to the drawer 1265 line and press {{{kbd(TAB)}}} there. 1266 1267 You can also arrange for state change notes (see [[Tracking TODO state 1268 changes]]) and clock times (see [[*Clocking Work Time]]) to be stored in 1269 a =LOGBOOK= drawer. If you want to store a quick note there, in 1270 a similar way to state changes, use 1271 1272 - {{{kbd(C-c C-z)}}} :: 1273 1274 #+kindex: C-c C-z 1275 Add a time-stamped note to the =LOGBOOK= drawer. 1276 1277 ** Blocks 1278 :PROPERTIES: 1279 :DESCRIPTION: Folding blocks. 1280 :END: 1281 #+vindex: org-hide-block-startup 1282 #+cindex: blocks, folding 1283 1284 Org mode uses =#+BEGIN= ... =#+END= blocks for various purposes from 1285 including source code examples (see [[*Literal Examples]]) to capturing 1286 time logging information (see [[*Clocking Work Time]]). These blocks can 1287 be folded and unfolded by pressing {{{kbd(TAB)}}} in the =#+BEGIN= 1288 line. You can also get all blocks folded at startup by configuring 1289 the variable ~org-hide-block-startup~ or on a per-file basis by using 1290 1291 #+cindex: STARTUP, keyword 1292 #+begin_example 1293 ,#+STARTUP: hideblocks 1294 ,#+STARTUP: nohideblocks 1295 #+end_example 1296 1297 * Tables 1298 :PROPERTIES: 1299 :DESCRIPTION: Pure magic for quick formatting. 1300 :END: 1301 #+cindex: tables 1302 #+cindex: editing tables 1303 1304 Org comes with a fast and intuitive table editor. Spreadsheet-like 1305 calculations are supported using the Emacs Calc package (see [[info:calc][GNU Emacs 1306 Calculator Manual]]). 1307 1308 ** Built-in Table Editor 1309 :PROPERTIES: 1310 :DESCRIPTION: Simple tables. 1311 :END: 1312 #+cindex: table editor, built-in 1313 1314 #+cindex: header lines, in tables 1315 #+cindex: horizontal rule, in tables 1316 #+cindex: row separator, in tables 1317 #+cindex: table syntax 1318 Org makes it easy to format tables in plain ASCII. Any line with =|= 1319 as the first non-whitespace character is considered part of a table. 1320 =|= is also the column separator[fn:: To insert a vertical bar into a 1321 table field, use =\vert= or, inside a word =abc\vert{}def=.]. 1322 Moreover, a line starting with =|-= is a horizontal rule. It 1323 separates rows explicitly. Rows before the first horizontal rule are 1324 header lines. A table might look like this: 1325 1326 #+begin_example 1327 | Name | Phone | Age | 1328 |-------+-------+-----| 1329 | Peter | 1234 | 17 | 1330 | Anna | 4321 | 25 | 1331 #+end_example 1332 1333 A table is re-aligned automatically each time you press 1334 {{{kbd(TAB)}}}, {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} inside the table. 1335 {{{kbd(TAB)}}} also moves to the next field---{{{kbd(RET)}}} to the 1336 next row---and creates new table rows at the end of the table or 1337 before horizontal lines. The indentation of the table is set by the 1338 first line. Horizontal rules are automatically expanded on every 1339 re-align to span the whole table width. So, to create the above 1340 table, you would only type 1341 1342 #+begin_example 1343 |Name|Phone|Age| 1344 |- 1345 #+end_example 1346 1347 #+texinfo: @noindent 1348 and then press {{{kbd(TAB)}}} to align the table and start filling in 1349 fields. Even faster would be to type =|Name|Phone|Age= followed by 1350 {{{kbd(C-c RET)}}}. 1351 1352 When typing text into a field, Org treats {{{kbd(DEL)}}}, 1353 {{{kbd(Backspace)}}}, and all character keys in a special way, so that 1354 inserting and deleting avoids shifting other fields. Also, when 1355 typing /immediately/ after point was moved into a new field with 1356 {{{kbd(TAB)}}}, {{{kbd(S-TAB)}}} or {{{kbd(RET)}}}, the field is 1357 automatically made blank. If this behavior is too unpredictable for 1358 you, configure the option ~org-table-auto-blank-field~. 1359 1360 *** Creation and conversion 1361 :PROPERTIES: 1362 :UNNUMBERED: notoc 1363 :END: 1364 1365 - {{{kbd(C-c |)}}} (~org-table-create-or-convert-from-region~) :: 1366 1367 #+kindex: C-c | 1368 #+findex: org-table-create-or-convert-from-region 1369 Convert the active region to table. If every line contains at least 1370 one {{{kbd(TAB)}}} character, the function assumes that the material 1371 is tab separated. If every line contains a comma, comma-separated 1372 values (CSV) are assumed. If not, lines are split at whitespace 1373 into fields. You can use a prefix argument to force a specific 1374 separator: {{{kbd(C-u)}}} forces CSV, {{{kbd(C-u C-u)}}} forces 1375 {{{kbd(TAB)}}}, {{{kbd(C-u C-u C-u)}}} prompts for a regular 1376 expression to match the separator, and a numeric argument 1377 N indicates that at least N consecutive spaces, or alternatively 1378 a {{{kbd(TAB)}}} will be the separator. 1379 1380 If there is no active region, this command creates an empty Org 1381 table. But it is easier just to start typing, like {{{kbd(| 1382 N a m e | P h o n e | A g e RET | - TAB)}}}. 1383 1384 *** Re-aligning and field motion 1385 :PROPERTIES: 1386 :UNNUMBERED: notoc 1387 :END: 1388 1389 - {{{kbd(C-c C-c)}}} (~org-table-align~) :: 1390 1391 #+kindex: C-c C-c 1392 #+findex: org-table-align 1393 Re-align the table without moving point. 1394 1395 - {{{kbd(TAB)}}} (~org-table-next-field~) :: 1396 1397 #+kindex: TAB 1398 #+findex: org-table-next-field 1399 Re-align the table, move to the next field. Creates a new row if 1400 necessary. 1401 1402 - {{{kbd(M-x org-table-blank-field)}}} :: 1403 1404 #+findex: org-table-blank-field 1405 Blank the current table field or active region. 1406 1407 - {{{kbd(S-TAB)}}} (~org-table-previous-field~) :: 1408 1409 #+kindex: S-TAB 1410 #+findex: org-table-previous-field 1411 Re-align, move to previous field. 1412 1413 - {{{kbd(RET)}}} (~org-table-next-row~) :: 1414 1415 #+kindex: RET 1416 #+findex: org-table-next-row 1417 Re-align the table and move down to next row. Creates a new row if 1418 necessary. At the beginning or end of a line, {{{kbd(RET)}}} still 1419 inserts a new line, so it can be used to split a table. 1420 1421 - {{{kbd(M-a)}}} (~org-table-beginning-of-field~) :: 1422 1423 #+kindex: M-a 1424 #+findex: org-table-beginning-of-field 1425 Move to beginning of the current table field, or on to the previous 1426 field. 1427 1428 - {{{kbd(M-e)}}} (~org-table-end-of-field~) :: 1429 1430 #+kindex: M-e 1431 #+findex: org-table-end-of-field 1432 Move to end of the current table field, or on to the next field. 1433 1434 *** Column and row editing 1435 :PROPERTIES: 1436 :UNNUMBERED: notoc 1437 :END: 1438 1439 - {{{kbd(M-LEFT)}}} (~org-table-move-column-left~) :: 1440 1441 #+kindex: M-LEFT 1442 #+findex: org-table-move-column-left 1443 Move the current column left. 1444 1445 - {{{kbd(M-RIGHT)}}} (~org-table-move-column-right~) :: 1446 1447 #+kindex: M-RIGHT 1448 #+findex: org-table-move-column-right 1449 Move the current column right. 1450 1451 - {{{kbd(M-S-LEFT)}}} (~org-table-delete-column~) :: 1452 1453 #+kindex: M-S-LEFT 1454 #+findex: org-table-delete-column 1455 Kill the current column. 1456 1457 - {{{kbd(M-S-RIGHT)}}} (~org-table-insert-column~) :: 1458 1459 #+kindex: M-S-RIGHT 1460 #+findex: org-table-insert-column 1461 Insert a new column at point position. Move the recent column and 1462 all cells to the right of this column to the right. 1463 1464 - {{{kbd(M-UP)}}} (~org-table-move-row-up~) :: 1465 1466 #+kindex: M-UP 1467 #+findex: org-table-move-row-up 1468 Move the current row up. 1469 1470 - {{{kbd(M-DOWN)}}} (~org-table-move-row-down~) :: 1471 1472 #+kindex: M-DOWN 1473 #+findex: org-table-move-row-down 1474 Move the current row down. 1475 1476 - {{{kbd(M-S-UP)}}} (~org-table-kill-row~) :: 1477 1478 #+kindex: M-S-UP 1479 #+findex: org-table-kill-row 1480 Kill the current row or horizontal line. 1481 1482 - {{{kbd(S-UP)}}} (~org-table-move-cell-up~) :: 1483 1484 #+kindex: S-UP 1485 #+findex: org-table-move-cell-up 1486 Move cell up by swapping with adjacent cell. 1487 1488 - {{{kbd(S-DOWN)}}} (~org-table-move-cell-down~) :: 1489 1490 #+kindex: S-DOWN 1491 #+findex: org-table-move-cell-down 1492 Move cell down by swapping with adjacent cell. 1493 1494 - {{{kbd(S-LEFT)}}} (~org-table-move-cell-left~) :: 1495 1496 #+kindex: S-LEFT 1497 #+findex: org-table-move-cell-left 1498 Move cell left by swapping with adjacent cell. 1499 1500 - {{{kbd(S-RIGHT)}}} (~org-table-move-cell-right~) :: 1501 1502 #+kindex: S-RIGHT 1503 #+findex: org-table-move-cell-right 1504 Move cell right by swapping with adjacent cell. 1505 1506 - {{{kbd(M-S-DOWN)}}} (~org-table-insert-row~) :: 1507 1508 #+kindex: M-S-DOWN 1509 #+findex: org-table-insert-row 1510 Insert a new row above the current row. With a prefix argument, the 1511 line is created below the current one. 1512 1513 - {{{kbd(C-c -)}}} (~org-table-insert-hline~) :: 1514 1515 #+kindex: C-c - 1516 #+findex: org-table-insert-hline 1517 Insert a horizontal line below current row. With a prefix argument, 1518 the line is created above the current line. 1519 1520 - {{{kbd(C-c RET)}}} (~org-table-hline-and-move~) :: 1521 1522 #+kindex: C-c RET 1523 #+findex: org-table-hline-and-move 1524 Insert a horizontal line below current row, and move point into the 1525 row below that line. 1526 1527 - {{{kbd(C-c ^)}}} (~org-table-sort-lines~) :: 1528 1529 #+kindex: C-c ^ 1530 #+findex: org-table-sort-lines 1531 Sort the table lines in the region. The position of point indicates 1532 the column to be used for sorting, and the range of lines is the 1533 range between the nearest horizontal separator lines, or the entire 1534 table. If point is before the first column, you are prompted for 1535 the sorting column. If there is an active region, the mark 1536 specifies the first line and the sorting column, while point should 1537 be in the last line to be included into the sorting. The command 1538 prompts for the sorting type, alphabetically, numerically, or by 1539 time. You can sort in normal or reverse order. You can also supply 1540 your own key extraction and comparison functions. When called with 1541 a prefix argument, alphabetic sorting is case-sensitive. 1542 1543 *** Regions 1544 :PROPERTIES: 1545 :UNNUMBERED: notoc 1546 :END: 1547 1548 - {{{kbd(C-c C-x M-w)}}} (~org-table-copy-region~) :: 1549 1550 #+kindex: C-c C-x M-w 1551 #+findex: org-table-copy-region 1552 Copy a rectangular region from a table to a special clipboard. 1553 Point and mark determine edge fields of the rectangle. If there is 1554 no active region, copy just the current field. The process ignores 1555 horizontal separator lines. 1556 1557 - {{{kbd(C-c C-x C-w)}}} (~org-table-cut-region~) :: 1558 1559 #+kindex: C-c C-x C-w 1560 #+findex: org-table-cut-region 1561 Copy a rectangular region from a table to a special clipboard, and 1562 blank all fields in the rectangle. So this is the "cut" operation. 1563 1564 - {{{kbd(C-c C-x C-y)}}} (~org-table-paste-rectangle~) :: 1565 1566 #+kindex: C-c C-x C-y 1567 #+findex: org-table-paste-rectangle 1568 Paste a rectangular region into a table. The upper left corner ends 1569 up in the current field. All involved fields are overwritten. If 1570 the rectangle does not fit into the present table, the table is 1571 enlarged as needed. The process ignores horizontal separator lines. 1572 1573 - {{{kbd(M-RET)}}} (~org-table-wrap-region~) :: 1574 1575 #+kindex: M-RET 1576 #+findex: org-table-wrap-region 1577 Split the current field at point position and move the rest to the 1578 line below. If there is an active region, and both point and mark 1579 are in the same column, the text in the column is wrapped to minimum 1580 width for the given number of lines. A numeric prefix argument may 1581 be used to change the number of desired lines. If there is no 1582 region, but you specify a prefix argument, the current field is made 1583 blank, and the content is appended to the field above. 1584 1585 *** Calculations 1586 :PROPERTIES: 1587 :UNNUMBERED: notoc 1588 :END: 1589 1590 #+cindex: formula, in tables 1591 #+cindex: calculations, in tables 1592 1593 - {{{kbd(C-c +)}}} (~org-table-sum~) :: 1594 1595 #+kindex: C-c + 1596 #+findex: org-table-sum 1597 Sum the numbers in the current column, or in the rectangle defined 1598 by the active region. The result is shown in the echo area and can 1599 be inserted with {{{kbd(C-y)}}}. 1600 1601 - {{{kbd(S-RET)}}} (~org-table-copy-down~) :: 1602 1603 #+kindex: S-RET 1604 #+findex: org-table-copy-down 1605 #+vindex: org-table-copy-increment 1606 When current field is empty, copy from first non-empty field above. 1607 When not empty, copy current field down to next row and move point 1608 along with it. 1609 1610 Depending on the variable ~org-table-copy-increment~, integer and 1611 time stamp field values, and fields prefixed or suffixed with 1612 a whole number, can be incremented during copy. Also, a ~0~ prefix 1613 argument temporarily disables the increment. 1614 1615 This key is also used by shift-selection and related modes (see 1616 [[*Packages that conflict with Org mode]]). 1617 1618 *** Miscellaneous 1619 :PROPERTIES: 1620 :UNNUMBERED: notoc 1621 :END: 1622 1623 - {{{kbd(C-c `)}}} (~org-table-edit-field~) :: 1624 1625 #+kindex: C-c ` 1626 #+findex: org-table-edit-field 1627 Edit the current field in a separate window. This is useful for 1628 fields that are not fully visible (see [[*Column Width and Alignment]]). 1629 When called with a {{{kbd(C-u)}}} prefix, just make the full field 1630 visible, so that it can be edited in place. When called with two 1631 {{{kbd(C-u)}}} prefixes, make the editor window follow point through 1632 the table and always show the current field. The follow mode exits 1633 automatically when point leaves the table, or when you repeat this 1634 command with {{{kbd(C-u C-u C-c `)}}}. 1635 1636 - {{{kbd(M-x org-table-import)}}} :: 1637 1638 #+findex: org-table-import 1639 Import a file as a table. The table should be TAB or whitespace 1640 separated. Use, for example, to import a spreadsheet table or data 1641 from a database, because these programs generally can write 1642 TAB-separated text files. This command works by inserting the file 1643 into the buffer and then converting the region to a table. Any 1644 prefix argument is passed on to the converter, which uses it to 1645 determine the separator. 1646 1647 - {{{kbd(C-c |)}}} (~org-table-create-or-convert-from-region~) :: 1648 1649 #+kindex: C-c | 1650 #+findex: org-table-create-or-convert-from-region 1651 Tables can also be imported by pasting tabular text into the Org 1652 buffer, selecting the pasted text with {{{kbd(C-x C-x)}}} and then 1653 using the {{{kbd(C-c |)}}} command (see [[*Creation and conversion]]). 1654 1655 - {{{kbd(M-x org-table-export)}}} :: 1656 1657 #+findex: org-table-export 1658 #+vindex: org-table-export-default-format 1659 Export the table, by default as a TAB-separated file. Use for data 1660 exchange with, for example, spreadsheet or database programs. The 1661 format used to export the file can be configured in the variable 1662 ~org-table-export-default-format~. You may also use properties 1663 =TABLE_EXPORT_FILE= and =TABLE_EXPORT_FORMAT= to specify the file 1664 name and the format for table export in a subtree. Org supports 1665 quite general formats for exported tables. The exporter format is 1666 the same as the format used by Orgtbl radio tables, see [[*Translator 1667 functions]], for a detailed description. 1668 1669 - {{{kbd(M-x org-table-header-line-mode)}}} :: 1670 1671 #+findex: org-table-header-line-mode 1672 #+vindex: org-table-header-line-p 1673 Turn on the display of the first data row of the table at point in 1674 the window header line when this first row is not visible anymore in 1675 the buffer. You can activate this minor mode by default by setting 1676 the option ~org-table-header-line-p~ to ~t~. 1677 1678 - {{{kbd(M-x org-table-transpose-table-at-point)}}} :: 1679 1680 #+findex: org-table-transpose-table-at-point 1681 Transpose the table at point and eliminate hlines. 1682 1683 ** Column Width and Alignment 1684 :PROPERTIES: 1685 :DESCRIPTION: Overrule the automatic settings. 1686 :END: 1687 #+cindex: narrow columns in tables 1688 #+cindex: alignment in tables 1689 1690 The width of columns is automatically determined by the table editor. 1691 The alignment of a column is determined automatically from the 1692 fraction of number-like versus non-number fields in the column. 1693 1694 #+vindex: org-table-automatic-realign 1695 Editing a field may modify alignment of the table. Moving 1696 a contiguous row or column---i.e., using {{{kbd(TAB)}}} or 1697 {{{kbd(RET)}}}---automatically re-aligns it. If you want to disable 1698 this behavior, set ~org-table-automatic-realign~ to ~nil~. In any 1699 case, you can always align manually a table: 1700 1701 - {{{kbd(C-c C-c)}}} (~org-table-align~) :: 1702 1703 #+kindex: C-c C-c 1704 #+findex: org-table-align 1705 Align the current table. 1706 1707 #+vindex: org-startup-align-all-tables 1708 Setting the option ~org-startup-align-all-tables~ re-aligns all tables 1709 in a file upon visiting it. You can also set this option on 1710 a per-file basis with: 1711 1712 #+begin_example 1713 ,#+STARTUP: align 1714 ,#+STARTUP: noalign 1715 #+end_example 1716 1717 Sometimes a single field or a few fields need to carry more text, 1718 leading to inconveniently wide columns. Maybe you want to hide away 1719 several columns or display them with a fixed width, regardless of 1720 content, as shown in the following example. 1721 1722 #+begin_example 1723 |---+---------------------+--------| |---+-------…+…| 1724 | | <6> | | | | <6> …|…| 1725 | 1 | one | some | ----\ | 1 | one …|…| 1726 | 2 | two | boring | ----/ | 2 | two …|…| 1727 | 3 | This is a long text | column | | 3 | This i…|…| 1728 |---+---------------------+--------| |---+-------…+…| 1729 #+end_example 1730 1731 To set the width of a column, one field anywhere in the column may 1732 contain just the string =<N>= where {{{var(N)}}} specifies the width 1733 as a number of characters. You control displayed width of columns 1734 with the following tools: 1735 1736 - {{{kbd(C-c TAB)}}} (~org-table-toggle-column-width~) :: 1737 1738 #+kindex: C-c TAB 1739 #+findex: org-table-toggle-column-width 1740 Shrink or expand current column. 1741 1742 If a width cookie specifies a width W for the column, shrinking it 1743 displays the first W visible characters only. Otherwise, the column 1744 is shrunk to a single character. 1745 1746 When called before the first column or after the last one, ask for 1747 a list of column ranges to operate on. 1748 1749 - {{{kbd(C-u C-c TAB)}}} (~org-table-shrink~) :: 1750 1751 #+kindex: C-u C-c TAB 1752 #+findex: org-table-shrink 1753 Shrink all columns with a column width. Expand the others. 1754 1755 - {{{kbd(C-u C-u C-c TAB)}}} (~org-table-expand~) :: 1756 1757 #+kindex: C-u C-u C-c TAB 1758 #+findex: org-table-expand 1759 Expand all columns. 1760 1761 To see the full text of a shrunk field, hold the mouse over it: 1762 a tool-tip window then shows the full contents of the field. 1763 Alternatively, {{{kbd(C-h .)}}} (~display-local-help~) reveals them, 1764 too. For convenience, any change near the shrunk part of a column 1765 expands it. 1766 1767 #+vindex: org-startup-shrink-all-tables 1768 Setting the option ~org-startup-shrink-all-tables~ shrinks all columns 1769 containing a width cookie in a file the moment it is visited. You can 1770 also set this option on a per-file basis with: 1771 1772 : #+STARTUP: shrink 1773 1774 If you would like to overrule the automatic alignment of number-rich 1775 columns to the right and of string-rich columns to the left, you can 1776 use =<r>=, =<c>= or =<l>= in a similar fashion. You may also combine 1777 alignment and field width like this: =<r10>=. 1778 1779 Lines which only contain these formatting cookies are removed 1780 automatically upon exporting the document. 1781 1782 ** Column Groups 1783 :PROPERTIES: 1784 :DESCRIPTION: Grouping to trigger vertical lines. 1785 :END: 1786 #+cindex: grouping columns in tables 1787 1788 When Org exports tables, it does so by default without vertical lines 1789 because that is visually more satisfying in general. Occasionally 1790 however, vertical lines can be useful to structure a table into groups 1791 of columns, much like horizontal lines can do for groups of rows. In 1792 order to specify column groups, you can use a special row where the 1793 first field contains only =/=. The further fields can either contain 1794 =<= to indicate that this column should start a group, =>= to indicate 1795 the end of a column, or =<>= (no space between =<= and =>=) to make 1796 a column a group of its own. Upon export, boundaries between column 1797 groups are marked with vertical lines. Here is an example: 1798 1799 #+begin_example 1800 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | 1801 |---+-----+-----+-----+---------+------------| 1802 | / | < | | > | < | > | 1803 | 1 | 1 | 1 | 1 | 1 | 1 | 1804 | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 | 1805 | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 | 1806 |---+-----+-----+-----+---------+------------| 1807 ,#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1))) 1808 #+end_example 1809 1810 It is also sufficient to just insert the column group starters after 1811 every vertical line you would like to have: 1812 1813 #+begin_example 1814 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | 1815 |---+-----+-----+-----+---------+------------| 1816 | / | < | | | < | | 1817 #+end_example 1818 1819 ** The Orgtbl Minor Mode 1820 :PROPERTIES: 1821 :DESCRIPTION: The table editor as minor mode. 1822 :ALT_TITLE: Orgtbl Mode 1823 :END: 1824 #+cindex: Orgtbl mode 1825 #+cindex: minor mode for tables 1826 1827 #+findex: orgtbl-mode 1828 If you like the intuitive way the Org table editor works, you might 1829 also want to use it in other modes like Text mode or Mail mode. The 1830 minor mode Orgtbl mode makes this possible. You can always toggle the 1831 mode with {{{kbd(M-x orgtbl-mode)}}}. To turn it on by default, for 1832 example in Message mode, use 1833 1834 #+begin_src emacs-lisp 1835 (add-hook 'message-mode-hook #'turn-on-orgtbl) 1836 #+end_src 1837 1838 Furthermore, with some special setup, it is possible to maintain 1839 tables in arbitrary syntax with Orgtbl mode. For example, it is 1840 possible to construct LaTeX tables with the underlying ease and power 1841 of Orgtbl mode, including spreadsheet capabilities. For details, see 1842 [[*Tables in Arbitrary Syntax]]. 1843 1844 ** The Spreadsheet 1845 :PROPERTIES: 1846 :DESCRIPTION: The table editor has spreadsheet capabilities. 1847 :END: 1848 #+cindex: calculations, in tables 1849 #+cindex: spreadsheet capabilities 1850 #+cindex: Calc package 1851 1852 The table editor makes use of the Emacs Calc package to implement 1853 spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms 1854 to derive fields from other fields. While fully featured, Org's 1855 implementation is not identical to other spreadsheets. For example, 1856 Org knows the concept of a /column formula/ that will be applied to 1857 all non-header fields in a column without having to copy the formula 1858 to each relevant field. There is also a formula debugger, and a 1859 formula editor with features for highlighting fields in the table 1860 corresponding to the references at point in the formula, moving these 1861 references by arrow keys. 1862 1863 *** References 1864 :PROPERTIES: 1865 :DESCRIPTION: How to refer to another field or range. 1866 :END: 1867 #+cindex: references 1868 1869 To compute fields in the table from other fields, formulas must 1870 reference other fields or ranges. In Org, fields can be referenced by 1871 name, by absolute coordinates, and by relative coordinates. To find 1872 out what the coordinates of a field are, press {{{kbd(C-c ?)}}} in 1873 that field, or press {{{kbd(C-c })}}} to toggle the display of a grid. 1874 1875 **** Field references 1876 :PROPERTIES: 1877 :UNNUMBERED: notoc 1878 :END: 1879 1880 #+cindex: field references 1881 #+cindex: references, to fields 1882 Formulas can reference the value of another field in two ways. Like 1883 in any other spreadsheet, you may reference fields with 1884 a letter/number combination like =B3=, meaning the second field in the 1885 third row. However, Org prefers to use another, more general 1886 representation that looks like this:[fn:7] 1887 1888 : @ROW$COLUMN 1889 1890 Column specifications can be absolute like =$1=, =$2=, ..., =$N=, or 1891 relative to the current column, i.e., the column of the field which is 1892 being computed, like =$+1= or =$-2=. =$<= and =$>= are immutable 1893 references to the first and last column, respectively, and you can use 1894 =$>>>= to indicate the third column from the right. 1895 1896 The row specification only counts data lines and ignores horizontal 1897 separator lines, or "hlines". Like with columns, you can use absolute 1898 row numbers =@1=, =@2=, ..., =@N=, and row numbers relative to the 1899 current row like =@+3= or =@-1=. =@<= and =@>= are immutable 1900 references the first and last row in the table, respectively. You may 1901 also specify the row relative to one of the hlines: =@I= refers to the 1902 first hline, =@II= to the second, etc. =@-I= refers to the first such 1903 line above the current line, =@+I= to the first such line below the 1904 current line. You can also write =@III+2= which is the second data 1905 line after the third hline in the table. 1906 1907 =@0= and =$0= refer to the current row and column, respectively, i.e., 1908 to the row/column for the field being computed. Also, if you omit 1909 either the column or the row part of the reference, the current 1910 row/column is implied. 1911 1912 Org's references with /unsigned/ numbers are fixed references in the 1913 sense that if you use the same reference in the formula for two 1914 different fields, the same field is referenced each time. Org's 1915 references with /signed/ numbers are floating references because the 1916 same reference operator can reference different fields depending on 1917 the field being calculated by the formula. 1918 1919 Here are a few examples: 1920 1921 #+attr_texinfo: :columns 0.2 0.8 1922 | =@2$3= | 2nd row, 3rd column (same as =C2=) | 1923 | =$5= | column 5 in the current row (same as =E&=) | 1924 | =@2= | current column, row 2 | 1925 | =@-1$-3= | field one row up, three columns to the left | 1926 | =@-I$2= | field just under hline above current row, column 2 | 1927 | =@>$5= | field in the last row, in column 5 | 1928 1929 **** Range references 1930 :PROPERTIES: 1931 :UNNUMBERED: notoc 1932 :END: 1933 1934 #+cindex: range references 1935 #+cindex: references, to ranges 1936 You may reference a rectangular range of fields by specifying two 1937 field references connected by two dots =..=. The ends are included in 1938 the range. If both fields are in the current row, you may simply use 1939 =$2..$7=, but if at least one field is in a different row, you need to 1940 use the general =@ROW$COLUMN= format at least for the first field, 1941 i.e., the reference must start with =@= in order to be interpreted 1942 correctly. Examples: 1943 1944 #+attr_texinfo: :columns 0.2 0.8 1945 | =$1..$3= | first three fields in the current row | 1946 | =$P..$Q= | range, using column names (see [[*Advanced features]]) | 1947 | =$<<<..$>>= | start in third column, continue to the last but one | 1948 | =@2$1..@4$3= | nine fields between these two fields (same as =A2..C4=) | 1949 | =@-1$-2..@-1= | 3 fields in the row above, starting from 2 columns on the left | 1950 | =@I..II= | between first and second hline, short for =@I..@II= | 1951 1952 #+texinfo: @noindent 1953 Range references return a vector of values that can be fed into Calc 1954 vector functions. Empty fields in ranges are normally suppressed, so 1955 that the vector contains only the non-empty fields. For other options 1956 with the mode switches =E=, =N= and examples, see [[*Formula syntax for 1957 Calc]]. 1958 1959 **** Field coordinates in formulas 1960 :PROPERTIES: 1961 :UNNUMBERED: notoc 1962 :END: 1963 1964 #+cindex: field coordinates 1965 #+cindex: coordinates, of field 1966 #+cindex: row, of field coordinates 1967 #+cindex: column, of field coordinates 1968 #+vindex: org-table-current-column 1969 #+vindex: org-table-current-dline 1970 One of the very first actions during evaluation of Calc formulas and 1971 Lisp formulas is to substitute =@#= and =$#= in the formula with the 1972 row or column number of the field where the current result will go to. 1973 The traditional Lisp formula equivalents are ~org-table-current-dline~ 1974 and ~org-table-current-column~. Examples: 1975 1976 - =if(@# % 2, $#, string(""))= :: 1977 1978 Insert column number on odd rows, set field to empty on even rows. 1979 1980 - =$2 = '(identity remote(FOO, @@#$1))= :: 1981 1982 Copy text or values of each row of column 1 of the table named 1983 {{{var(FOO)}}} into column 2 of the current table. 1984 1985 - =@3 = 2 * remote(FOO, @1$$#)= :: 1986 1987 Insert the doubled value of each column of row 1 of the table 1988 named {{{var(FOO)}}} into row 3 of the current table. 1989 1990 #+texinfo: @noindent 1991 For the second and third examples, table {{{var(FOO)}}} must have at 1992 least as many rows or columns as the current table. Note that this is 1993 inefficient[fn:: The computation time scales as O(N^2) because table 1994 {{{var(FOO)}}} is parsed for each field to be copied.] for large 1995 number of rows. 1996 1997 **** Named references 1998 :PROPERTIES: 1999 :UNNUMBERED: notoc 2000 :END: 2001 #+cindex: named references 2002 #+cindex: references, named 2003 #+cindex: name, of column or field 2004 #+cindex: constants, in calculations 2005 #+cindex: @samp{CONSTANTS}, keyword 2006 #+vindex: org-table-formula-constants 2007 2008 =$name= is interpreted as the name of a column, parameter or constant. 2009 Constants are defined globally through the variable 2010 ~org-table-formula-constants~, and locally---for the file---through 2011 a line like this example: 2012 2013 : #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6 2014 2015 #+vindex: constants-unit-system 2016 #+pindex: constants.el 2017 Also, properties (see [[*Properties and Columns]]) can be used as 2018 constants in table formulas: for a property =Xyz= use the name 2019 =$PROP_Xyz=, and the property will be searched in the current outline 2020 entry and in the hierarchy above it. If you have the =constants.el= 2021 package, it will also be used to resolve constants, including natural 2022 constants like =$h= for Planck's constant, and units like =$km= for 2023 kilometers[fn:8]. Column names and parameters can be specified in 2024 special table lines. These are described below, see [[*Advanced 2025 features]]. All names must start with a letter, and further consist 2026 of letters and numbers. 2027 2028 **** Remote references 2029 :PROPERTIES: 2030 :UNNUMBERED: notoc 2031 :END: 2032 2033 #+cindex: remote references 2034 #+cindex: references, remote 2035 #+cindex: references, to a different table 2036 #+cindex: name, of column or field 2037 #+cindex: @samp{NAME}, keyword 2038 You may also reference constants, fields and ranges from a different 2039 table, either in the current file or even in a different file. The 2040 syntax is 2041 2042 : remote(NAME,REF) 2043 2044 #+texinfo: @noindent 2045 where {{{var(NAME)}}} can be the name of a table in the current file 2046 as set by a =#+NAME:= line before the table. It can also be the ID of 2047 an entry, even in a different file, and the reference then refers to 2048 the first table in that entry. {{{var(REF)}}} is an absolute field or 2049 range reference as described above for example =@3$3= or =$somename=, 2050 valid in the referenced table. 2051 2052 #+cindex: table indirection 2053 When {{{var(NAME)}}} has the format =@ROW$COLUMN=, it is substituted 2054 with the name or ID found in this field of the current table. For 2055 example =remote($1, @@>$2)= \Rightarrow =remote(year_2013, @@>$1)=. The format 2056 =B3= is not supported because it can not be distinguished from a plain 2057 table name or ID. 2058 2059 *** Formula syntax for Calc 2060 :PROPERTIES: 2061 :DESCRIPTION: Using Calc to compute stuff. 2062 :END: 2063 #+cindex: formula syntax, Calc 2064 #+cindex: syntax, of formulas 2065 2066 A formula can be any algebraic expression understood by the Emacs Calc 2067 package. Note that Calc has the non-standard convention that =/= has 2068 lower precedence than =*=, so that =a/b*c= is interpreted as 2069 =(a/(b*c))=. Before evaluation by ~calc-eval~ (see [[info:calc#Calling Calc from Your Programs][Calling Calc from 2070 Your Lisp Programs]]), variable substitution takes place according to 2071 the rules described above. 2072 2073 #+cindex: vectors, in table calculations 2074 The range vectors can be directly fed into the Calc vector functions 2075 like ~vmean~ and ~vsum~. 2076 2077 #+cindex: format specifier, in spreadsheet 2078 #+cindex: mode, for Calc 2079 #+vindex: org-calc-default-modes 2080 A formula can contain an optional mode string after a semicolon. This 2081 string consists of flags to influence Calc and other modes during 2082 execution. By default, Org uses the standard Calc modes (precision 2083 12, angular units degrees, fraction and symbolic modes off). The 2084 display format, however, has been changed to =(float 8)= to keep 2085 tables compact. The default settings can be configured using the 2086 variable ~org-calc-default-modes~. 2087 2088 - =p20= :: 2089 2090 Set the internal Calc calculation precision to 20 digits. 2091 2092 - =n3=, =s3=, =e2=, =f4= :: 2093 2094 Normal, scientific, engineering or fixed format of the result of 2095 Calc passed back to Org. Calc formatting is unlimited in precision 2096 as long as the Calc calculation precision is greater. 2097 2098 - =D=, =R= :: 2099 2100 Degree and radian angle modes of Calc. 2101 2102 - =F=, =S= :: 2103 2104 Fraction and symbolic modes of Calc. 2105 2106 - =u= :: 2107 2108 Units simplification mode of Calc. Calc is also a symbolic 2109 calculator and is capable of working with values having a unit, 2110 represented with numerals followed by a unit string in Org table 2111 cells. This mode instructs Calc to simplify the units in the 2112 computed expression before returning the result. 2113 2114 - =T=, =t=, =U= :: 2115 2116 Duration computations in Calc or Lisp, [[*Durations and time values]]. 2117 2118 - =E= :: 2119 2120 If and how to consider empty fields. Without =E= empty fields in 2121 range references are suppressed so that the Calc vector or Lisp list 2122 contains only the non-empty fields. With =E= the empty fields are 2123 kept. For empty fields in ranges or empty field references the 2124 value =nan= (not a number) is used in Calc formulas and the empty 2125 string is used for Lisp formulas. Add =N= to use 0 instead for both 2126 formula types. For the value of a field the mode =N= has higher 2127 precedence than =E=. 2128 2129 - =N= :: 2130 2131 Interpret all fields as numbers, use 0 for non-numbers. See the 2132 next section to see how this is essential for computations with Lisp 2133 formulas. In Calc formulas it is used only occasionally because 2134 there number strings are already interpreted as numbers without =N=. 2135 2136 - =L= :: 2137 2138 Literal, for Lisp formulas only. See the next section. 2139 2140 Unless you use large integer numbers or high-precision calculation and 2141 display for floating point numbers you may alternatively provide 2142 a ~printf~ format specifier to reformat the Calc result after it has 2143 been passed back to Org instead of letting Calc already do the 2144 formatting[fn:9]. A few examples: 2145 2146 | =$1+$2= | Sum of first and second field | 2147 | =$1+$2;%.2f= | Same, format result to two decimals | 2148 | =exp($2)+exp($1)= | Math functions can be used | 2149 | =$0;%.1f= | Reformat current cell to 1 decimal | 2150 | =($3-32)*5/9= | Degrees F \to C conversion | 2151 | =$c/$1/$cm= | Hz \to cm conversion, using =constants.el= | 2152 | =tan($1);Dp3s1= | Compute in degrees, precision 3, display SCI 1 | 2153 | =sin($1);Dp3%.1e= | Same, but use ~printf~ specifier for display | 2154 | =vmean($2..$7)= | Compute column range mean, using vector function | 2155 | =vmean($2..$7);EN= | Same, but treat empty fields as 0 | 2156 | =taylor($3,x=7,2)= | Taylor series of $3, at x=7, second degree | 2157 2158 Calc also contains a complete set of logical operations (see [[info:calc#Logical Operations][Logical 2159 Operations]]). For example 2160 2161 - =if($1 < 20, teen, string(""))= :: 2162 2163 ="teen"= if age =$1= is less than 20, else the Org table result 2164 field is set to empty with the empty string. 2165 2166 - =if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E f-1= :: 2167 2168 Sum of the first two columns. When at least one of the input fields 2169 is empty the Org table result field is set to empty. =E= is 2170 required to not convert empty fields to 0. =f-1= is an optional 2171 Calc format string similar to =%.1f= but leaves empty results empty. 2172 2173 - =if(typeof(vmean($1..$7)) == 12, string(""), vmean($1..$7)); E= :: 2174 2175 Mean value of a range unless there is any empty field. Every field 2176 in the range that is empty is replaced by =nan= which lets =vmean= 2177 result in =nan=. Then =typeof == 12= detects the =nan= from ~vmean~ 2178 and the Org table result field is set to empty. Use this when the 2179 sample set is expected to never have missing values. 2180 2181 - =if("$1..$7" == "[]", string(""), vmean($1..$7))= :: 2182 2183 Mean value of a range with empty fields skipped. Every field in the 2184 range that is empty is skipped. When all fields in the range are 2185 empty the mean value is not defined and the Org table result field 2186 is set to empty. Use this when the sample set can have a variable 2187 size. 2188 2189 - =vmean($1..$7); EN= :: 2190 2191 To complete the example before: Mean value of a range with empty 2192 fields counting as samples with value 0. Use this only when 2193 incomplete sample sets should be padded with 0 to the full size. 2194 2195 You can add your own Calc functions defined in Emacs Lisp with 2196 ~defmath~ and use them in formula syntax for Calc. 2197 2198 *** Emacs Lisp forms as formulas 2199 :PROPERTIES: 2200 :DESCRIPTION: Writing formulas in Emacs Lisp. 2201 :ALT_TITLE: Formula syntax for Lisp 2202 :END: 2203 #+cindex: Lisp forms, as table formulas 2204 2205 It is also possible to write a formula in Emacs Lisp. This can be 2206 useful for string manipulation and control structures, if Calc's 2207 functionality is not enough. 2208 2209 A formula is evaluated as a Lisp form when it starts with a 2210 single-quote followed by an opening parenthesis. Cell table 2211 references are interpolated into the Lisp form before execution. The 2212 evaluation should return either a string or a number. Evaluation 2213 modes and a ~printf~ format used to render the returned values can be 2214 specified after a semicolon. 2215 2216 By default, references are interpolated as literal Lisp strings: the 2217 field content is replaced in the Lisp form stripped of leading and 2218 trailing white space and surrounded in double-quotes. For example: 2219 2220 : '(concat $1 $2) 2221 2222 #+texinfo: @noindent 2223 concatenates the content of columns 1 and column 2. 2224 2225 When the =N= flag is used, all referenced elements are parsed as 2226 numbers and interpolated as Lisp numbers, without quotes. Fields that 2227 cannot be parsed as numbers are interpolated as zeros. For example: 2228 2229 : '(+ $1 $2);N 2230 2231 #+texinfo: @noindent 2232 adds columns 1 and 2, equivalent to Calc's =$1+$2=. Ranges are 2233 inserted as space-separated fields, so they can be embedded in list or 2234 vector syntax. For example: 2235 2236 : '(apply '+ '($1..$4));N 2237 2238 #+texinfo: @noindent 2239 computes the sum of columns 1 to 4, like Calc's =vsum($1..$4)=. 2240 2241 When the =L= flag is used, all fields are interpolated literally: the 2242 cell content is replaced in the Lisp form stripped of leading and 2243 trailing white space and without quotes. If a reference is intended 2244 to be interpreted as a string by the Lisp form, the reference operator 2245 itself should be enclosed in double-quotes, like ="$3"=. The =L= flag 2246 is useful when strings and numbers are used in the same Lisp form. For 2247 example: 2248 2249 : '(substring "$1" $2 $3);L 2250 2251 #+texinfo: @noindent 2252 extracts the part of the string in column 1 between the character 2253 positions specified in the integers in column 2 and 3 and it is easier 2254 to read than the equivalent: 2255 2256 : '(substring $1 (string-to-number $2) (string-to-number $3)) 2257 2258 *** Durations and time values 2259 :PROPERTIES: 2260 :DESCRIPTION: How to compute durations and time values. 2261 :END: 2262 #+cindex: duration, computing 2263 #+cindex: time, computing 2264 #+vindex: org-table-duration-custom-format 2265 2266 If you want to compute time values use the =T=, =t=, or =U= flag, 2267 either in Calc formulas or Elisp formulas: 2268 2269 #+begin_example 2270 | Task 1 | Task 2 | Total | 2271 |---------+----------+----------| 2272 | 2:12 | 1:47 | 03:59:00 | 2273 | 2:12 | 1:47 | 03:59 | 2274 | 3:02:20 | -2:07:00 | 0.92 | 2275 ,#+TBLFM: @2$3=$1+$2;T::@3$3=$1+$2;U::@4$3=$1+$2;t 2276 #+end_example 2277 2278 Input duration values must be of the form =HH:MM[:SS]=, where seconds 2279 are optional. With the =T= flag, computed durations are displayed as 2280 =HH:MM:SS= (see the first formula above). With the =U= flag, seconds 2281 are omitted so that the result is only =HH:MM= (see second formula 2282 above). Zero-padding of the hours field depends upon the value of the 2283 variable ~org-table-duration-hour-zero-padding~. 2284 2285 With the =t= flag, computed durations are displayed according to the 2286 value of the option ~org-table-duration-custom-format~, which defaults 2287 to ~hours~ and displays the result as a fraction of hours (see the 2288 third formula in the example above). 2289 2290 Negative duration values can be manipulated as well, and integers are 2291 considered as seconds in addition and subtraction. 2292 2293 *** Field and range formulas 2294 :PROPERTIES: 2295 :DESCRIPTION: Formula for specific (ranges of) fields. 2296 :END: 2297 #+cindex: field formula 2298 #+cindex: range formula 2299 #+cindex: formula, for individual table field 2300 #+cindex: formula, for range of fields 2301 2302 To assign a formula to a particular field, type it directly into the 2303 field, preceded by =:==, for example =vsum(@II..III)=. When you press 2304 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} with point 2305 still in the field, the formula is stored as the formula for this 2306 field, evaluated, and the current field is replaced with the result. 2307 2308 #+cindex: @samp{TBLFM}, keyword 2309 Formulas are stored in a special =TBLFM= keyword located directly 2310 below the table. If you type the equation in the fourth field of the 2311 third data line in the table, the formula looks like =@3$4=$1+$2=. 2312 When inserting/deleting/swapping column and rows with the appropriate 2313 commands, /absolute references/ (but not relative ones) in stored 2314 formulas are modified in order to still reference the same field. To 2315 avoid this from happening, in particular in range references, anchor 2316 ranges at the table borders (using =@<=, =@>=, =$<=, =$>=), or at 2317 hlines using the =@I= notation. Automatic adaptation of field 2318 references does not happen if you edit the table structure with normal 2319 editing commands---you must fix the formulas yourself. 2320 2321 Instead of typing an equation into the field, you may also use the 2322 following command 2323 2324 - {{{kbd(C-u C-c =)}}} (~org-table-eval-formula~) :: 2325 2326 #+kindex: C-u C-c = 2327 #+findex: org-table-eval-formula 2328 Install a new formula for the current field. The command prompts 2329 for a formula with default taken from the =TBLFM= keyword, 2330 applies it to the current field, and stores it. 2331 2332 The left-hand side of a formula can also be a special expression in 2333 order to assign the formula to a number of different fields. There is 2334 no keyboard shortcut to enter such range formulas. To add them, use 2335 the formula editor (see [[*Editing and debugging formulas]]) or edit 2336 the =TBLFM= keyword directly. 2337 2338 - =$2== :: 2339 2340 Column formula, valid for the entire column. This is so common that 2341 Org treats these formulas in a special way, see [[*Column formulas]]. 2342 2343 - =@3== :: 2344 2345 Row formula, applies to all fields in the specified row. =@>== 2346 means the last row. 2347 2348 - =@1$2..@4$3== :: 2349 2350 Range formula, applies to all fields in the given rectangular range. 2351 This can also be used to assign a formula to some but not all fields 2352 in a row. 2353 2354 - =$NAME== :: 2355 2356 Named field, see [[*Advanced features]]. 2357 2358 *** Column formulas 2359 :PROPERTIES: 2360 :DESCRIPTION: Formulas valid for an entire column. 2361 :END: 2362 #+cindex: column formula 2363 #+cindex: formula, for table column 2364 2365 When you assign a formula to a simple column reference like =$3==, the 2366 same formula is used in all fields of that column, with the following 2367 very convenient exceptions: (i) If the table contains horizontal 2368 separator hlines with rows above and below, everything before the 2369 first such hline is considered part of the table /header/ and is not 2370 modified by column formulas. Therefore a header is mandatory when you 2371 use column formulas and want to add hlines to group rows, like for 2372 example to separate a total row at the bottom from the summand rows 2373 above. (ii) Fields that already get a value from a field/range 2374 formula are left alone by column formulas. These conditions make 2375 column formulas very easy to use. 2376 2377 To assign a formula to a column, type it directly into any field in 2378 the column, preceded by an equal sign, like ==$1+$2=. When you press 2379 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(C-c C-c)}}} with point 2380 still in the field, the formula is stored as the formula for the 2381 current column, evaluated and the current field replaced with the 2382 result. If the field contains only ===, the previously stored formula 2383 for this column is used. For each column, Org only remembers the most 2384 recently used formula. In the =TBLFM= keyword, column formulas look 2385 like =$4=$1+$2=. The left-hand side of a column formula can not be 2386 the name of column, it must be the numeric column reference or =$>=. 2387 2388 Instead of typing an equation into the field, you may also use the 2389 following command: 2390 2391 - {{{kbd(C-c =)}}} (~org-table-eval-formula~) :: 2392 2393 #+kindex: C-c = 2394 #+findex: org-table-eval-formula 2395 Install a new formula for the current column and replace current 2396 field with the result of the formula. The command prompts for 2397 a formula, with default taken from the =TBLFM= keyword, applies it 2398 to the current field and stores it. With a numeric prefix argument, 2399 e.g., {{{kbd(C-5 C-c =)}}}, the command applies it to that many 2400 consecutive fields in the current column. 2401 2402 *** Lookup functions 2403 :PROPERTIES: 2404 :DESCRIPTION: Lookup functions for searching tables. 2405 :END: 2406 #+cindex: lookup functions in tables 2407 #+cindex: table lookup functions 2408 2409 Org has three predefined Emacs Lisp functions for lookups in tables. 2410 2411 - =(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)= :: 2412 2413 #+findex: org-lookup-first 2414 Searches for the first element {{{var(S)}}} in list 2415 {{{var(S-LIST)}}} for which 2416 #+begin_src emacs-lisp 2417 (PREDICATE VAL S) 2418 #+end_src 2419 is non-~nil~; returns the value from the corresponding position in 2420 list {{{var(R-LIST)}}}. The default {{{var(PREDICATE)}}} is 2421 ~equal~. Note that the parameters {{{var(VAL)}}} and {{{var(S)}}} 2422 are passed to {{{var(PREDICATE)}}} in the same order as the 2423 corresponding parameters are in the call to ~org-lookup-first~, 2424 where {{{var(VAL)}}} precedes {{{var(S-LIST)}}}. If 2425 {{{var(R-LIST)}}} is ~nil~, the matching element {{{var(S)}}} of 2426 {{{var(S-LIST)}}} is returned. 2427 2428 - =(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)= :: 2429 2430 #+findex: org-lookup-last 2431 Similar to ~org-lookup-first~ above, but searches for the /last/ 2432 element for which {{{var(PREDICATE)}}} is non-~nil~. 2433 2434 - =(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)= :: 2435 2436 #+findex: org-lookup-all 2437 Similar to ~org-lookup-first~, but searches for /all/ elements for 2438 which {{{var(PREDICATE)}}} is non-~nil~, and returns /all/ 2439 corresponding values. This function can not be used by itself in 2440 a formula, because it returns a list of values. However, powerful 2441 lookups can be built when this function is combined with other Emacs 2442 Lisp functions. 2443 2444 If the ranges used in these functions contain empty fields, the =E= 2445 mode for the formula should usually be specified: otherwise empty 2446 fields are not included in {{{var(S-LIST)}}} and/or {{{var(R-LIST)}}} 2447 which can, for example, result in an incorrect mapping from an element 2448 of {{{var(S-LIST)}}} to the corresponding element of 2449 {{{var(R-LIST)}}}. 2450 2451 These three functions can be used to implement associative arrays, 2452 count matching cells, rank results, group data, etc. For practical 2453 examples see [[https://orgmode.org/worg/org-tutorials/org-lookups.html][this tutorial on Worg]]. 2454 2455 *** Editing and debugging formulas 2456 :PROPERTIES: 2457 :DESCRIPTION: Fixing formulas. 2458 :END: 2459 #+cindex: formula editing 2460 #+cindex: editing, of table formulas 2461 2462 #+vindex: org-table-use-standard-references 2463 You can edit individual formulas in the minibuffer or directly in the 2464 field. Org can also prepare a special buffer with all active formulas 2465 of a table. When offering a formula for editing, Org converts 2466 references to the standard format (like =B3= or =D&=) if possible. If 2467 you prefer to only work with the internal format (like =@3$2= or 2468 =$4=), configure the variable ~org-table-use-standard-references~. 2469 2470 - {{{kbd(C-c =)}}} or {{{kbd(C-u C-c =)}}} (~org-table-eval-formula~) :: 2471 2472 #+kindex: C-c = 2473 #+kindex: C-u C-c = 2474 #+findex: org-table-eval-formula 2475 Edit the formula associated with the current column/field in the 2476 minibuffer. See [[*Column formulas]], and [[*Field and range formulas]]. 2477 2478 - {{{kbd(C-u C-u C-c =)}}} (~org-table-eval-formula~) :: 2479 2480 #+kindex: C-u C-u C-c = 2481 #+findex: org-table-eval-formula 2482 Re-insert the active formula (either a field formula, or a column 2483 formula) into the current field, so that you can edit it directly in 2484 the field. The advantage over editing in the minibuffer is that you 2485 can use the command {{{kbd(C-c ?)}}}. 2486 2487 - {{{kbd(C-c ?)}}} (~org-table-field-info~) :: 2488 2489 #+kindex: C-c ? 2490 #+findex: org-table-field-info 2491 While editing a formula in a table field, highlight the field(s) 2492 referenced by the reference at point position in the formula. 2493 2494 - {{{kbd(C-c })}}} (~org-table-toggle-coordinate-overlays~) :: 2495 2496 #+kindex: C-c @} 2497 #+findex: org-table-toggle-coordinate-overlays 2498 Toggle the display of row and column numbers for a table, using 2499 overlays. These are updated each time the table is aligned; you can 2500 force it with {{{kbd(C-c C-c)}}}. 2501 2502 - {{{kbd(C-c {)}}} (~org-table-toggle-formula-debugger~) :: 2503 2504 #+kindex: C-c @{ 2505 #+findex: org-table-toggle-formula-debugger 2506 Toggle the formula debugger on and off. See below. 2507 2508 - {{{kbd(C-c ')}}} (~org-table-edit-formulas~) :: 2509 2510 #+kindex: C-c ' 2511 #+findex: org-table-edit-formulas 2512 Edit all formulas for the current table in a special buffer, where 2513 the formulas are displayed one per line. If the current field has 2514 an active formula, point in the formula editor marks it. While 2515 inside the special buffer, Org automatically highlights any field or 2516 range reference at point position. You may edit, remove and add 2517 formulas, and use the following commands: 2518 2519 - {{{kbd(C-c C-c)}}} or {{{kbd(C-x C-s)}}} (~org-table-fedit-finish~) :: 2520 2521 #+kindex: C-x C-s 2522 #+kindex: C-c C-c 2523 #+findex: org-table-fedit-finish 2524 Exit the formula editor and store the modified formulas. With 2525 {{{kbd(C-u)}}} prefix, also apply the new formulas to the 2526 entire table. 2527 2528 - {{{kbd(C-c C-q)}}} (~org-table-fedit-abort~) :: 2529 2530 #+kindex: C-c C-q 2531 #+findex: org-table-fedit-abort 2532 Exit the formula editor without installing changes. 2533 2534 - {{{kbd(C-c C-r)}}} (~org-table-fedit-toggle-ref-type~) :: 2535 2536 #+kindex: C-c C-r 2537 #+findex: org-table-fedit-toggle-ref-type 2538 Toggle all references in the formula editor between standard (like 2539 =B3=) and internal (like =@3$2=). 2540 2541 - {{{kbd(TAB)}}} (~org-table-fedit-lisp-indent~) :: 2542 2543 #+kindex: TAB 2544 #+findex: org-table-fedit-lisp-indent 2545 Pretty-print or indent Lisp formula at point. When in a line 2546 containing a Lisp formula, format the formula according to Emacs 2547 Lisp rules. Another {{{kbd(TAB)}}} collapses the formula back 2548 again. In the open formula, {{{kbd(TAB)}}} re-indents just like 2549 in Emacs Lisp mode. 2550 2551 - {{{kbd(M-TAB)}}} (~lisp-complete-symbol~) :: 2552 2553 #+kindex: M-TAB 2554 #+findex: lisp-complete-symbol 2555 Complete Lisp symbols, just like in Emacs Lisp mode. 2556 2557 - {{{kbd(S-UP)}}}, {{{kbd(S-DOWN)}}}, {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} :: 2558 2559 #+kindex: S-UP 2560 #+kindex: S-DOWN 2561 #+kindex: S-LEFT 2562 #+kindex: S-RIGHT 2563 #+findex: org-table-fedit-ref-up 2564 #+findex: org-table-fedit-ref-down 2565 #+findex: org-table-fedit-ref-left 2566 #+findex: org-table-fedit-ref-right 2567 Shift the reference at point. For example, if the reference is 2568 =B3= and you press {{{kbd(S-RIGHT)}}}, it becomes =C3=. This also 2569 works for relative references and for hline references. 2570 2571 - {{{kbd(M-S-UP)}}} (~org-table-fedit-line-up~) :: 2572 2573 #+kindex: M-S-UP 2574 #+findex: org-table-fedit-line-up 2575 Move the test line for column formulas up in the Org buffer. 2576 2577 - {{{kbd(M-S-DOWN)}}} (~org-table-fedit-line-down~) :: 2578 2579 #+kindex: M-S-DOWN 2580 #+findex: org-table-fedit-line-down 2581 Move the test line for column formulas down in the Org buffer. 2582 2583 - {{{kbd(M-UP)}}} (~org-table-fedit-scroll-up~) :: 2584 2585 #+kindex: M-UP 2586 #+findex: org-table-fedit-scroll-up 2587 Scroll up the window displaying the table. 2588 2589 - {{{kbd(M-DOWN)}}} (~org-table-fedit-scroll-down~) :: 2590 2591 #+kindex: M-DOWN 2592 #+findex: org-table-fedit-scroll-down 2593 Scroll down the window displaying the table. 2594 2595 - {{{kbd(C-c })}}} :: 2596 2597 #+kindex: C-c @} 2598 #+findex: org-table-toggle-coordinate-overlays 2599 Turn the coordinate grid in the table on and off. 2600 2601 Making a table field blank does not remove the formula associated with 2602 the field, because that is stored in a different line---the =TBLFM= 2603 keyword line. During the next recalculation, the field will be filled 2604 again. To remove a formula from a field, you have to give an empty 2605 reply when prompted for the formula, or to edit the =TBLFM= keyword. 2606 2607 #+kindex: C-c C-c 2608 You may edit the =TBLFM= keyword directly and re-apply the changed 2609 equations with {{{kbd(C-c C-c)}}} in that line or with the normal 2610 recalculation commands in the table. 2611 2612 **** Using multiple =TBLFM= lines 2613 :PROPERTIES: 2614 :UNNUMBERED: notoc 2615 :END: 2616 #+cindex: multiple formula lines 2617 #+cindex: @samp{TBLFM} keywords, multiple 2618 #+cindex: @samp{TBLFM}, switching 2619 2620 #+kindex: C-c C-c 2621 You may apply the formula temporarily. This is useful when you want 2622 to switch the formula applied to the table. Place multiple =TBLFM= 2623 keywords right after the table, and then press {{{kbd(C-c C-c)}}} on 2624 the formula to apply. Here is an example: 2625 2626 #+begin_example 2627 | x | y | 2628 |---+---| 2629 | 1 | | 2630 | 2 | | 2631 ,#+TBLFM: $2=$1*1 2632 ,#+TBLFM: $2=$1*2 2633 #+end_example 2634 2635 #+texinfo: @noindent 2636 Pressing {{{kbd(C-c C-c)}}} in the line of =#+TBLFM: $2=$1*2= yields: 2637 2638 #+begin_example 2639 | x | y | 2640 |---+---| 2641 | 1 | 2 | 2642 | 2 | 4 | 2643 ,#+TBLFM: $2=$1*1 2644 ,#+TBLFM: $2=$1*2 2645 #+end_example 2646 2647 #+texinfo: @noindent 2648 If you recalculate this table, with {{{kbd(C-u C-c *)}}}, for example, 2649 you get the following result from applying only the first =TBLFM= 2650 keyword. 2651 2652 #+begin_example 2653 | x | y | 2654 |---+---| 2655 | 1 | 1 | 2656 | 2 | 2 | 2657 ,#+TBLFM: $2=$1*1 2658 ,#+TBLFM: $2=$1*2 2659 #+end_example 2660 2661 **** Debugging formulas 2662 :PROPERTIES: 2663 :UNNUMBERED: notoc 2664 :END: 2665 #+cindex: formula debugging 2666 #+cindex: debugging, of table formulas 2667 2668 When the evaluation of a formula leads to an error, the field content 2669 becomes the string =#ERROR=. If you want to see what is going on 2670 during variable substitution and calculation in order to find a bug, 2671 turn on formula debugging in the Tbl menu and repeat the calculation, 2672 for example by pressing {{{kbd(C-u C-u C-c = RET)}}} in a field. 2673 Detailed information are displayed. 2674 2675 *** Updating the table 2676 :PROPERTIES: 2677 :DESCRIPTION: Recomputing all dependent fields. 2678 :END: 2679 #+cindex: recomputing table fields 2680 #+cindex: updating, table 2681 2682 Recalculation of a table is normally not automatic, but needs to be 2683 triggered by a command. To make recalculation at least 2684 semi-automatic, see [[*Advanced features]]. 2685 2686 In order to recalculate a line of a table or the entire table, use the 2687 following commands: 2688 2689 - {{{kbd(C-c *)}}} (~org-table-recalculate~) :: 2690 2691 #+kindex: C-c * 2692 #+findex: org-table-recalculate 2693 Recalculate the current row by first applying the stored column 2694 formulas from left to right, and all field/range formulas in the 2695 current row. 2696 2697 - {{{kbd(C-u C-c *)}}} or {{{kbd(C-u C-c C-c)}}} :: 2698 2699 #+kindex: C-u C-c * 2700 #+kindex: C-u C-c C-c 2701 Recompute the entire table, line by line. Any lines before the 2702 first hline are left alone, assuming that these are part of the 2703 table header. 2704 2705 - {{{kbd(C-u C-u C-c *)}}} or {{{kbd(C-u C-u C-c C-c)}}} (~org-table-iterate~) :: 2706 2707 #+kindex: C-u C-u C-c * 2708 #+kindex: C-u C-u C-c C-c 2709 #+findex: org-table-iterate 2710 Iterate the table by recomputing it until no further changes occur. 2711 This may be necessary if some computed fields use the value of other 2712 fields that are computed /later/ in the calculation sequence. 2713 2714 - {{{kbd(M-x org-table-recalculate-buffer-tables)}}} :: 2715 2716 #+findex: org-table-recalculate-buffer-tables 2717 Recompute all tables in the current buffer. 2718 2719 - {{{kbd(M-x org-table-iterate-buffer-tables)}}} :: 2720 2721 #+findex: org-table-iterate-buffer-tables 2722 Iterate all tables in the current buffer, in order to converge 2723 table-to-table dependencies. 2724 2725 *** Advanced features 2726 :PROPERTIES: 2727 :DESCRIPTION: Field and column names, automatic recalculation... 2728 :END: 2729 2730 If you want the recalculation of fields to happen automatically, or if 2731 you want to be able to assign /names/[fn:: Such names must start with 2732 an alphabetic character and use only alphanumeric/underscore 2733 characters.] to fields and columns, you need to reserve the first 2734 column of the table for special marking characters. 2735 2736 - {{{kbd(C-#)}}} (~org-table-rotate-recalc-marks~) :: 2737 2738 #+kindex: C-# 2739 #+findex: org-table-rotate-recalc-marks 2740 Rotate the calculation mark in first column through the states =#=, 2741 =*=, =!=, =$=. When there is an active region, change all marks in 2742 the region. 2743 2744 Here is an example of a table that collects exam results of students 2745 and makes use of these features: 2746 2747 #+begin_example 2748 |---+---------+--------+--------+--------+-------+------| 2749 | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note | 2750 |---+---------+--------+--------+--------+-------+------| 2751 | ! | | P1 | P2 | P3 | Tot | | 2752 | # | Maximum | 10 | 15 | 25 | 50 | 10.0 | 2753 | ^ | | m1 | m2 | m3 | mt | | 2754 |---+---------+--------+--------+--------+-------+------| 2755 | # | Peter | 10 | 8 | 23 | 41 | 8.2 | 2756 | # | Sam | 2 | 4 | 3 | 9 | 1.8 | 2757 |---+---------+--------+--------+--------+-------+------| 2758 | | Average | | | | 25.0 | | 2759 | ^ | | | | | at | | 2760 | $ | max=50 | | | | | | 2761 |---+---------+--------+--------+--------+-------+------| 2762 ,#+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@-II..@-I);%.1f 2763 #+end_example 2764 2765 #+attr_texinfo: :tag Important 2766 #+begin_quote 2767 Please note that for these special tables, recalculating the table 2768 with {{{kbd(C-u C-c *)}}} only affects rows that are marked =#= or 2769 =*=, and fields that have a formula assigned to the field itself. The 2770 column formulas are not applied in rows with empty first field. 2771 #+end_quote 2772 2773 #+cindex: marking characters, tables 2774 The marking characters have the following meaning: 2775 2776 - =!= :: 2777 2778 The fields in this line define names for the columns, so that you 2779 may refer to a column as =$Tot= instead of =$6=. 2780 2781 - =^= :: 2782 2783 This row defines names for the fields /above/ the row. With such 2784 a definition, any formula in the table may use =$m1= to refer to the 2785 value =10=. Also, if you assign a formula to a names field, it is 2786 stored as =$name = ...=. 2787 2788 - =_= :: 2789 2790 Similar to =^=, but defines names for the fields in the row /below/. 2791 2792 - =$= :: 2793 2794 Fields in this row can define /parameters/ for formulas. For 2795 example, if a field in a =$= row contains =max=50=, then formulas in 2796 this table can refer to the value 50 using =$max=. Parameters work 2797 exactly like constants, only that they can be defined on a per-table 2798 basis. 2799 2800 - =#= :: 2801 2802 Fields in this row are automatically recalculated when pressing 2803 {{{kbd(TAB)}}} or {{{kbd(RET)}}} or {{{kbd(S-TAB)}}} in this row. 2804 Also, this row is selected for a global recalculation with 2805 {{{kbd(C-u C-c *)}}}. Unmarked lines are left alone by this 2806 command. 2807 2808 - =*= :: 2809 2810 Selects this line for global recalculation with {{{kbd(C-u C-c 2811 *)}}}, but not for automatic recalculation. Use this when automatic 2812 recalculation slows down editing too much. 2813 2814 - =/= :: 2815 2816 Do not export this line. Useful for lines that contain the 2817 narrowing =<N>= markers or column group markers. 2818 2819 Finally, just to whet your appetite for what can be done with the 2820 fantastic Calc package, here is a table that computes the Taylor 2821 series of degree n at location x for a couple of functions. 2822 2823 #+begin_example 2824 |---+-------------+---+-----+--------------------------------------| 2825 | | Func | n | x | Result | 2826 |---+-------------+---+-----+--------------------------------------| 2827 | # | exp(x) | 1 | x | 1 + x | 2828 | # | exp(x) | 2 | x | 1 + x + x^2 / 2 | 2829 | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 | 2830 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 | 2831 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 | 2832 | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 | 2833 |---+-------------+---+-----+--------------------------------------| 2834 ,#+TBLFM: $5=taylor($2,$4,$3);n3 2835 #+end_example 2836 2837 ** Org Plot 2838 :PROPERTIES: 2839 :DESCRIPTION: Plotting from Org tables. 2840 :END: 2841 #+cindex: graph, in tables 2842 #+cindex: plot tables using Gnuplot 2843 2844 Org Plot can produce graphs of information stored in Org tables, 2845 either graphically or in ASCII art. 2846 2847 *** Graphical plots using Gnuplot 2848 :PROPERTIES: 2849 :UNNUMBERED: notoc 2850 :END: 2851 2852 #+cindex: @samp{PLOT}, keyword 2853 Org Plot can produce 2D and 3D graphs of information stored in Org 2854 tables using [[https://www.gnuplot.info/][Gnuplot]] and [[http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html][Gnuplot mode]]. To see this in action, ensure 2855 that you have both Gnuplot and Gnuplot mode installed on your system, 2856 then call {{{kbd(C-c \quot g)}}} or {{{kbd(M-x org-plot/gnuplot)}}} on the 2857 following table. 2858 2859 #+begin_example 2860 ,#+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]" 2861 | Sede | Max cites | H-index | 2862 |-----------+-----------+---------| 2863 | Chile | 257.72 | 21.39 | 2864 | Leeds | 165.77 | 19.68 | 2865 | Sao Paolo | 71.00 | 11.50 | 2866 | Stockholm | 134.19 | 14.33 | 2867 | Morelia | 257.56 | 17.67 | 2868 #+end_example 2869 2870 Org Plot supports a range of plot types, and provides the ability to add more. 2871 For example, a radar plot can be generated like so: 2872 #+begin_example 2873 ,#+PLOT: title:"An evaluation of plaintext document formats" transpose:yes type:radar min:0 max:4 2874 | Format | Fine-grained-control | Initial Effort | Syntax simplicity | Editor Support | Integrations | Ease-of-referencing | Versatility | 2875 |-------------------+----------------------+----------------+-------------------+----------------+--------------+---------------------+-------------| 2876 | Word | 2 | 4 | 4 | 2 | 3 | 2 | 2 | 2877 | LaTeX | 4 | 1 | 1 | 3 | 2 | 4 | 3 | 2878 | Org Mode | 4 | 2 | 3.5 | 1 | 4 | 4 | 4 | 2879 | Markdown | 1 | 3 | 3 | 4 | 3 | 3 | 1 | 2880 | Markdown + Pandoc | 2.5 | 2.5 | 2.5 | 3 | 3 | 3 | 2 | 2881 #+end_example 2882 2883 Notice that Org Plot is smart enough to apply the table's headers as 2884 labels. Further control over the labels, type, content, and 2885 appearance of plots can be exercised through the =PLOT= keyword 2886 preceding a table. See below for a complete list of Org Plot options. 2887 For more information and examples see the [[https://orgmode.org/worg/org-tutorials/org-plot.html][Org Plot tutorial]]. 2888 2889 **** Plot options 2890 :PROPERTIES: 2891 :UNNUMBERED: notoc 2892 :END: 2893 2894 - =set= :: 2895 2896 Specify any Gnuplot option to be set when graphing. 2897 2898 - =title= :: 2899 2900 Specify the title of the plot. 2901 2902 - =ind= :: 2903 2904 Specify which column of the table to use as the =x= axis. 2905 2906 - =deps= :: 2907 2908 Specify the columns to graph as a Lisp style list, surrounded by 2909 parentheses and separated by spaces for example =dep:(3 4)= to graph 2910 the third and fourth columns. Defaults to graphing all other 2911 columns aside from the =ind= column. 2912 2913 - transpose :: 2914 2915 When =y=, =yes=, or =t= attempt to transpose the table data before 2916 plotting. Also recognizes the shorthand option =trans=. 2917 2918 - =type= :: 2919 2920 Specify the type of the plot, by default one of =2d=, =3d=, =radar=, or =grid=. 2921 Available types can be customized with ~org-plot/preset-plot-types~. 2922 2923 - =with= :: 2924 2925 Specify a =with= option to be inserted for every column being 2926 plotted, e.g., =lines=, =points=, =boxes=, =impulses=. Defaults to 2927 =lines=. 2928 2929 - =file= :: 2930 2931 If you want to plot to a file, specify 2932 ="path/to/desired/output-file"=. 2933 2934 - =labels= :: 2935 2936 List of labels to be used for the =deps=. Defaults to the column 2937 headers if they exist. 2938 2939 - =line= :: 2940 2941 Specify an entire line to be inserted in the Gnuplot script. 2942 2943 - =map= :: 2944 2945 When plotting =3d= or =grid= types, set this to =t= to graph a flat 2946 mapping rather than a =3d= slope. 2947 2948 - min :: 2949 2950 Provides a minimum axis value that may be used by a plot type. 2951 Implicitly assumes the =y= axis is being referred to. Can 2952 explicitly provide a value for a either the =x= or =y= axis with 2953 =xmin= and =ymin=. 2954 2955 - max :: 2956 2957 Provides a maximum axis value that may be used by a plot type. 2958 Implicitly assumes the =y= axis is being referred to. Can 2959 explicitly provide a value for a either the =x= or =y= axis with 2960 =xmax= and =ymax=. 2961 2962 - ticks :: 2963 2964 Provides a desired number of axis ticks to display, that may be used 2965 by a plot type. If none is given a plot type that requires ticks 2966 will use ~org--plot/sensible-tick-num~ to try to determine a good 2967 value. 2968 2969 - =timefmt= :: 2970 2971 Specify format of Org mode timestamps as they will be parsed by 2972 Gnuplot. Defaults to =%Y-%m-%d-%H:%M:%S=. 2973 2974 - =script= :: 2975 2976 If you want total control, you can specify a script file---place the 2977 file name between double-quotes---which will be used to plot. 2978 Before plotting, every instance of =$datafile= in the specified 2979 script will be replaced with the path to the generated data file. 2980 Note: even if you set this option, you may still want to specify the 2981 plot type, as that can impact the content of the data file. 2982 2983 *** ASCII bar plots 2984 :PROPERTIES: 2985 :UNNUMBERED: notoc 2986 :END: 2987 2988 While point is on a column, typing {{{kbd(C-c " a)}}} or {{{kbd(M-x 2989 orgtbl-ascii-plot)}}} create a new column containing an ASCII-art bars 2990 plot. The plot is implemented through a regular column formula. When 2991 the source column changes, the bar plot may be updated by refreshing 2992 the table, for example typing {{{kbd(C-u C-c *)}}}. 2993 2994 #+begin_example 2995 | Sede | Max cites | | 2996 |---------------+-----------+--------------| 2997 | Chile | 257.72 | WWWWWWWWWWWW | 2998 | Leeds | 165.77 | WWWWWWWh | 2999 | Sao Paolo | 71.00 | WWW; | 3000 | Stockholm | 134.19 | WWWWWW: | 3001 | Morelia | 257.56 | WWWWWWWWWWWH | 3002 | Rochefourchat | 0.00 | | 3003 ,#+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12) 3004 #+end_example 3005 3006 The formula is an Elisp call. 3007 3008 #+attr_texinfo: :options orgtbl-ascii-draw value min max &optional width 3009 #+begin_defun 3010 Draw an ASCII bar in a table. 3011 3012 {{{var(VALUE)}}} is the value to plot. 3013 3014 {{{var(MIN)}}} is the value displayed as an empty bar. {{{var(MAX)}}} 3015 is the value filling all the {{{var(WIDTH)}}}. Sources values outside 3016 this range are displayed as =too small= or =too large=. 3017 3018 {{{var(WIDTH)}}} is the number of characters of the bar plot. It 3019 defaults to =12=. 3020 #+end_defun 3021 3022 * Hyperlinks 3023 :PROPERTIES: 3024 :DESCRIPTION: Notes in context. 3025 :END: 3026 #+cindex: hyperlinks 3027 3028 Like HTML, Org provides support for links inside a file, external 3029 links to other files, Usenet articles, emails, and much more. 3030 3031 ** Link Format 3032 :PROPERTIES: 3033 :DESCRIPTION: How links in Org are formatted. 3034 :END: 3035 #+cindex: link format 3036 #+cindex: format, of links 3037 3038 #+cindex: angle bracket links 3039 #+cindex: plain links 3040 Org recognizes plain URIs, possibly wrapped within angle 3041 brackets[fn:10], and activate them as clickable links. 3042 3043 #+cindex: bracket links 3044 The general link format, however, looks like this: 3045 3046 : [[LINK][DESCRIPTION]] 3047 3048 #+texinfo: @noindent 3049 or alternatively 3050 3051 : [[LINK]] 3052 3053 #+cindex: escape syntax, for links 3054 #+cindex: backslashes, in links 3055 Some =\=, =[= and =]= characters in the {{{var(LINK)}}} part need to 3056 be "escaped", i.e., preceded by another =\= character. More 3057 specifically, the following characters, and only them, must be 3058 escaped: 3059 3060 1. all =[= and =]= characters, 3061 2. every =\= character preceding either =]= or =[=, 3062 3. every =\= character at the end of the link. 3063 3064 #+findex: org-link-escape 3065 Functions inserting links (see [[*Handling Links]]) properly escape 3066 ambiguous characters. You only need to bother about the rules above 3067 when inserting directly, or yanking, a URI within square brackets. 3068 When in doubt, you may use the function ~org-link-escape~, which turns 3069 a link string into its escaped form. 3070 3071 Once a link in the buffer is complete, with all brackets present, Org 3072 changes the display so that =DESCRIPTION= is displayed instead of 3073 =[[LINK][DESCRIPTION]]= and =LINK= is displayed instead of =[[LINK]]=. 3074 Links are highlighted in the ~org-link~ face, which, by default, is an 3075 underlined face. 3076 3077 You can directly edit the visible part of a link. This can be either 3078 the {{{var(LINK)}}} part, if there is no description, or the 3079 {{{var(DESCRIPTION)}}} part otherwise. To also edit the invisible 3080 {{{var(LINK)}}} part, use {{{kbd(C-c C-l)}}} with point on the link 3081 (see [[*Handling Links]]). 3082 3083 If you place point at the beginning or just behind the end of the 3084 displayed text and press {{{kbd(BS)}}}, you remove 3085 the---invisible---bracket at that location[fn:: More accurately, the 3086 precise behavior depends on how point arrived there---see 3087 [[info:elisp#Invisible Text][Invisible Text]].]. This makes the link 3088 incomplete and the internals are again displayed as plain text. 3089 Inserting the missing bracket hides the link internals again. To show 3090 the internal structure of all links, use the menu: Org \rarr 3091 Hyperlinks \rarr Literal links. 3092 3093 ** Internal Links 3094 :PROPERTIES: 3095 :DESCRIPTION: Links to other places in the current file. 3096 :END: 3097 #+cindex: internal links 3098 #+cindex: links, internal 3099 3100 A link that does not look like a URL---i.e., does not start with 3101 a known scheme or a file name---refers to the current document. You 3102 can follow it with {{{kbd(C-c C-o)}}} when point is on the link, or 3103 with a mouse click (see [[*Handling Links]]). 3104 3105 #+cindex: @samp{CUSTOM_ID}, property 3106 Org provides several refinements to internal navigation within 3107 a document. Most notably, a construct like =[[#my-custom-id]]= 3108 specifically targets the entry with the =CUSTOM_ID= property set to 3109 =my-custom-id=. Also, an internal link looking like =[[*Some 3110 section]]= points to a headline with the name =Some section=[fn:11]. 3111 3112 #+cindex: targets, for links 3113 When the link does not belong to any of the cases above, Org looks for 3114 a /dedicated target/: the same string in double angular brackets, like 3115 =<<My Target>>=. 3116 3117 #+cindex: @samp{NAME}, keyword 3118 If no dedicated target exists, the link tries to match the exact name 3119 of an element within the buffer. Naming is done, unsurprisingly, with 3120 the =NAME= keyword, which has to be put in the line before the element 3121 it refers to, as in the following example 3122 3123 #+begin_example 3124 ,#+NAME: My Target 3125 | a | table | 3126 |----+------------| 3127 | of | four cells | 3128 #+end_example 3129 3130 #+vindex: org-link-search-must-match-exact-headline 3131 Ultimately, if none of the above succeeds, Org searches for a headline 3132 that is exactly the link text but may also include a TODO keyword and 3133 tags, or initiates a plain text search, according to the value of 3134 ~org-link-search-must-match-exact-headline~. 3135 3136 Note that you must make sure custom IDs, dedicated targets, and names 3137 are unique throughout the document. Org provides a linter to assist 3138 you in the process, if needed. See [[*Org Syntax]]. 3139 3140 During export, internal links are used to mark objects and assign them 3141 a number. Marked objects are then referenced by links pointing to 3142 them. In particular, links without a description appear as the number 3143 assigned to the marked object[fn:: When targeting a =NAME= keyword, 3144 the =CAPTION= keyword is mandatory in order to get proper numbering 3145 (see [[*Captions]]).]. In the following excerpt from an Org buffer 3146 3147 #+begin_example 3148 1. one item 3149 2. <<target>>another item 3150 Here we refer to item [[target]]. 3151 #+end_example 3152 3153 #+texinfo: @noindent 3154 The last sentence will appear as =Here we refer to item 2= when 3155 exported. 3156 3157 In non-Org files, the search looks for the words in the link text. In 3158 the above example the search would be for =target=. 3159 3160 Following a link pushes a mark onto Org's own mark ring. You can 3161 return to the previous position with {{{kbd(C-c &)}}}. Using this 3162 command several times in direct succession goes back to positions 3163 recorded earlier. 3164 3165 ** Radio Targets 3166 :PROPERTIES: 3167 :DESCRIPTION: Make targets trigger links in plain text. 3168 :END: 3169 #+cindex: radio targets 3170 #+cindex: targets, radio 3171 #+cindex: links, radio targets 3172 3173 Org can automatically turn any occurrences of certain target names in 3174 normal text into a link. So without explicitly creating a link, the 3175 text connects to the target radioing its position. Radio targets are 3176 enclosed by triple angular brackets. For example, a target =<<<My 3177 Target>>>= causes each occurrence of =my target= in normal text to 3178 become activated as a link. The Org file is scanned automatically for 3179 radio targets only when the file is first loaded into Emacs. To 3180 update the target list during editing, press {{{kbd(C-c C-c)}}} with 3181 point on or at a target. 3182 3183 ** External Links 3184 :PROPERTIES: 3185 :DESCRIPTION: URL-like links to the world. 3186 :END: 3187 #+cindex: links, external 3188 #+cindex: external links 3189 #+cindex: attachment links 3190 #+cindex: BBDB links 3191 #+cindex: Elisp links 3192 #+cindex: file links 3193 #+cindex: Gnus links 3194 #+cindex: Help links 3195 #+cindex: IRC links 3196 #+cindex: Info links 3197 #+cindex: MH-E links 3198 #+cindex: Rmail links 3199 #+cindex: shell links 3200 #+cindex: URL links 3201 #+cindex: Usenet links 3202 3203 Org supports links to files, websites, Usenet and email messages, BBDB 3204 database entries and links to both IRC conversations and their logs. 3205 External links are URL-like locators. They start with a short 3206 identifying string followed by a colon. There can be no space after 3207 the colon. 3208 3209 Here is the full set of built-in link types: 3210 3211 - =file= :: 3212 3213 File links. File name may be remote, absolute, or relative. 3214 3215 Additionally, you can specify a line number, or a text search. 3216 In Org files, you may link to a headline name, a custom ID, or a 3217 code reference instead. 3218 3219 As a special case, "file" prefix may be omitted if the file name 3220 is complete, e.g., it starts with =./=, or =/=. 3221 3222 - =attachment= :: 3223 3224 Same as file links but for files and folders attached to the current 3225 node (see [[*Attachments]]). Attachment links are intended to behave 3226 exactly as file links but for files relative to the attachment 3227 directory. 3228 3229 - =bbdb= :: 3230 3231 Link to a BBDB record, with possible regexp completion. 3232 3233 - =docview= :: 3234 3235 Link to a document opened with DocView mode. You may specify a page 3236 number. 3237 3238 - =doi= :: 3239 3240 Link to an electronic resource, through its handle. 3241 3242 - =elisp= :: 3243 3244 Execute an Elisp command upon activation. 3245 3246 - =gnus=, =rmail=, =mhe= :: 3247 3248 Link to messages or folders from a given Emacs' MUA. 3249 3250 - =help= :: 3251 3252 Display documentation of a symbol in =*Help*= buffer. 3253 3254 - =http=, =https= :: 3255 3256 Web links. 3257 3258 - =id= :: 3259 3260 Link to a specific headline by its ID property, in an Org file. 3261 3262 - =info= :: 3263 3264 Link to an Info manual, or to a specific node. 3265 3266 - =irc= :: 3267 3268 Link to an IRC channel. 3269 3270 - =mailto= :: 3271 3272 Link to message composition. 3273 3274 - =news= :: 3275 3276 Usenet links. 3277 3278 - =shell= :: 3279 3280 Execute a shell command upon activation. 3281 3282 The following table illustrates the link types above, along with their 3283 options: 3284 3285 | Link Type | Example | 3286 |------------+----------------------------------------------------------| 3287 | http | =http://staff.science.uva.nl/c.dominik/= | 3288 | https | =https://orgmode.org/= | 3289 | doi | =doi:10.1000/182= | 3290 | file | =file:/home/dominik/images/jupiter.jpg= | 3291 | | =/home/dominik/images/jupiter.jpg= (same as above) | 3292 | | =file:papers/last.pdf= | 3293 | | =./papers/last.pdf= (same as above) | 3294 | | =file:/ssh:me@some.where:papers/last.pdf= (remote) | 3295 | | =/ssh:me@some.where:papers/last.pdf= (same as above) | 3296 | | =file:sometextfile::NNN= (jump to line number) | 3297 | | =file:projects.org= | 3298 | | =file:projects.org::some words= (text search)[fn:12] | 3299 | | =file:projects.org::*task title= (headline search) | 3300 | | =file:projects.org::#custom-id= (headline search) | 3301 | attachment | =attachment:projects.org= | 3302 | | =attachment:projects.org::some words= (text search) | 3303 | docview | =docview:papers/last.pdf::NNN= | 3304 | id | =id:B7423F4D-2E8A-471B-8810-C40F074717E9= | 3305 | news | =news:comp.emacs= | 3306 | mailto | =mailto:adent@galaxy.net= | 3307 | mhe | =mhe:folder= (folder link) | 3308 | | =mhe:folder#id= (message link) | 3309 | rmail | =rmail:folder= (folder link) | 3310 | | =rmail:folder#id= (message link) | 3311 | gnus | =gnus:group= (group link) | 3312 | | =gnus:group#id= (article link) | 3313 | bbdb | =bbdb:R.*Stallman= (record with regexp) | 3314 | irc | =irc:/irc.com/#emacs/bob= | 3315 | help | =help:org-store-link= | 3316 | info | =info:org#External links= | 3317 | shell | =shell:ls *.org= | 3318 | elisp | =elisp:(find-file "Elisp.org")= (Elisp form to evaluate) | 3319 | | =elisp:org-agenda= (interactive Elisp command) | 3320 3321 #+cindex: VM links 3322 #+cindex: Wanderlust links 3323 On top of these built-in link types, additional ones are available 3324 through the =org-contrib= repository (see [[*Installation]]). For 3325 example, these links to VM or Wanderlust messages are available when 3326 you load the corresponding libraries from the =org-contrib= 3327 repository: 3328 3329 | =vm:folder= | VM folder link | 3330 | =vm:folder#id= | VM message link | 3331 | =vm://myself@some.where.org/folder#id= | VM on remote machine | 3332 | =vm-imap:account:folder= | VM IMAP folder link | 3333 | =vm-imap:account:folder#id= | VM IMAP message link | 3334 | =wl:folder= | Wanderlust folder link | 3335 | =wl:folder#id= | Wanderlust message link | 3336 3337 For information on customizing Org to add new link types, see [[*Adding 3338 Hyperlink Types]]. 3339 3340 A link should be enclosed in double brackets and may contain 3341 descriptive text to be displayed instead of the URL (see [[*Link 3342 Format]]), for example: 3343 3344 : [[https://www.gnu.org/software/emacs/][GNU Emacs]] 3345 3346 If the description is a file name or URL that points to an image, HTML 3347 export (see [[*HTML Export]]) inlines the image as a clickable button. If 3348 there is no description at all and the link points to an image, that 3349 image is inlined into the exported HTML file. 3350 3351 #+cindex: square brackets, around links 3352 #+cindex: angular brackets, around links 3353 #+cindex: plain text external links 3354 Org also recognizes external links amid normal text and activates them 3355 as links. If spaces must be part of the link (for example in 3356 =bbdb:R.*Stallman=), or if you need to remove ambiguities about the 3357 end of the link, enclose the link in square or angular brackets. 3358 3359 ** Handling Links 3360 :PROPERTIES: 3361 :DESCRIPTION: Creating, inserting and following. 3362 :END: 3363 #+cindex: links, handling 3364 3365 Org provides methods to create a link in the correct syntax, to insert 3366 it into an Org file, and to follow the link. 3367 3368 #+findex: org-store-link 3369 #+cindex: storing links 3370 The main function is ~org-store-link~, called with {{{kbd(M-x 3371 org-store-link)}}}. Because of its importance, we suggest to bind it 3372 to a widely available key (see [[*Activation]]). It stores a link to the 3373 current location. The link is stored for later insertion into an Org 3374 buffer---see below. The kind of link that is created depends on the 3375 current buffer: 3376 3377 - /Org mode buffers/ :: 3378 3379 For Org files, if there is a =<<target>>= at point, the link points 3380 to the target. Otherwise it points to the current headline, which 3381 is also the description. 3382 3383 #+vindex: org-id-link-to-org-use-id 3384 #+cindex: @samp{CUSTOM_ID}, property 3385 #+cindex: @samp{ID}, property 3386 If the headline has a =CUSTOM_ID= property, store a link to this 3387 custom ID. In addition or alternatively, depending on the value of 3388 ~org-id-link-to-org-use-id~, create and/or use a globally unique 3389 =ID= property for the link[fn:: The Org Id library must first be 3390 loaded, either through ~org-customize~, by enabling ~id~ in 3391 ~org-modules~, or by adding =(require 'org-id)= in your Emacs init 3392 file.]. So using this command in Org buffers potentially creates 3393 two links: a human-readable link from the custom ID, and one that is 3394 globally unique and works even if the entry is moved from file to 3395 file. The =ID= property can be either a UUID (default) or a 3396 timestamp, depending on ~org-id-method~. Later, when inserting the 3397 link, you need to decide which one to use. 3398 3399 - /Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus/ :: 3400 3401 #+vindex: org-link-email-description-format 3402 Pretty much all Emacs mail clients are supported. The link points 3403 to the current article, or, in some Gnus buffers, to the group. The 3404 description is constructed according to the variable 3405 ~org-link-email-description-format~. By default, it refers to the 3406 addressee and the subject. 3407 3408 - /Web browsers: W3M and EWW/ :: 3409 3410 Here the link is the current URL, with the page title as the 3411 description. 3412 3413 - /Contacts: BBDB/ :: 3414 3415 Links created in a BBDB buffer point to the current entry. 3416 3417 - /Chat: IRC/ :: 3418 3419 #+vindex: org-irc-links-to-logs 3420 For IRC links, if the variable ~org-irc-link-to-logs~ is non-~nil~, 3421 create a =file= style link to the relevant point in the logs for the 3422 current conversation. Otherwise store an =irc= style link to the 3423 user/channel/server under the point. 3424 3425 - /Other files/ :: 3426 3427 For any other file, the link points to the file, with a search 3428 string (see [[*Search Options in File Links]]) pointing to the contents 3429 of the current line. If there is an active region, the selected 3430 words form the basis of the search string. You can write custom Lisp 3431 functions to select the search string and perform the search for 3432 particular file types (see [[*Custom Searches]]). 3433 3434 You can also define dedicated links to other files. See [[*Adding 3435 Hyperlink Types]]. 3436 3437 - /Agenda view/ :: 3438 3439 When point is in an agenda view, the created link points to the 3440 entry referenced by the current line. 3441 3442 From an Org buffer, the following commands create, navigate or, more 3443 generally, act on links. 3444 3445 #+attr_texinfo: :sep , 3446 - {{{kbd(C-c C-l)}}} (~org-insert-link~) :: 3447 3448 #+kindex: C-c C-l 3449 #+findex: org-insert-link 3450 #+cindex: link completion 3451 #+cindex: completion, of links 3452 #+cindex: inserting links 3453 #+vindex: org-link-keep-stored-after-insertion 3454 Insert a link[fn:13]. This prompts for a link to be inserted into 3455 the buffer. You can just type a link, using text for an internal 3456 link, or one of the link type prefixes mentioned in the examples 3457 above. The link is inserted into the buffer, along with 3458 a descriptive text[fn:14]. If some text was selected at this time, 3459 it becomes the default description. 3460 3461 - /Inserting stored links/ :: 3462 3463 All links stored during the current session are part of the 3464 history for this prompt, so you can access them with {{{kbd(UP)}}} 3465 and {{{kbd(DOWN)}}} (or {{{kbd(M-p)}}}, {{{kbd(M-n)}}}). 3466 3467 - /Completion support/ :: 3468 3469 Completion with {{{kbd(TAB)}}} helps you to insert valid link 3470 prefixes like =http= or =ftp=, including the prefixes defined 3471 through link abbreviations (see [[*Link Abbreviations]]). If you 3472 press {{{kbd(RET)}}} after inserting only the prefix, Org offers 3473 specific completion support for some link types[fn:: This works if 3474 a function has been defined in the ~:complete~ property of a link 3475 in ~org-link-parameters~.]. For example, if you type {{{kbd(f i l 3476 e RET)}}}---alternative access: {{{kbd(C-u C-c C-l)}}}, see 3477 below---Org offers file name completion, and after {{{kbd(b b d b 3478 RET)}}} you can complete contact names. 3479 3480 - {{{kbd(C-u C-c C-l)}}} :: 3481 3482 #+cindex: file name completion 3483 #+cindex: completion, of file names 3484 #+kindex: C-u C-c C-l 3485 When {{{kbd(C-c C-l)}}} is called with a {{{kbd(C-u)}}} prefix 3486 argument, insert a link to a file. You may use file name completion 3487 to select the name of the file. The path to the file is inserted 3488 relative to the directory of the current Org file, if the linked 3489 file is in the current directory or in a sub-directory of it, or if 3490 the path is written relative to the current directory using =../=. 3491 Otherwise an absolute path is used, if possible with =~/= for your 3492 home directory. You can force an absolute path with two 3493 {{{kbd(C-u)}}} prefixes. 3494 3495 - {{{kbd(C-c C-l)}}} (with point on existing link) :: 3496 3497 #+cindex: following links 3498 When point is on an existing link, {{{kbd(C-c C-l)}}} allows you to 3499 edit the link and description parts of the link. 3500 3501 - {{{kbd(C-c C-o)}}} (~org-open-at-point~) :: 3502 3503 #+kindex: C-c C-o 3504 #+findex: org-open-at-point 3505 #+vindex: org-file-apps 3506 Open link at point. This launches a web browser for URL (using 3507 ~browse-url-at-point~), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for 3508 the corresponding links, and execute the command in a shell link. 3509 When point is on an internal link, this command runs the 3510 corresponding search. When point is on the tags part of a headline, 3511 it creates the corresponding tags view (see [[*Matching tags and 3512 properties]]). If point is on a timestamp, it compiles the agenda for 3513 that date. Furthermore, it visits text and remote files in =file= 3514 links with Emacs and select a suitable application for local 3515 non-text files. Classification of files is based on file extension 3516 only. See option ~org-file-apps~. If you want to override the 3517 default application and visit the file with Emacs, use 3518 a {{{kbd(C-u)}}} prefix. If you want to avoid opening in Emacs, use 3519 a {{{kbd(C-u C-u)}}} prefix. 3520 3521 #+vindex: org-link-frame-setup 3522 If point is on a headline, but not on a link, offer all links in the 3523 headline and entry text. If you want to setup the frame 3524 configuration for following links, customize ~org-link-frame-setup~. 3525 3526 - {{{kbd(RET)}}} :: 3527 3528 #+vindex: org-return-follows-link 3529 #+kindex: RET 3530 When ~org-return-follows-link~ is set, {{{kbd(RET)}}} also follows 3531 the link at point. 3532 3533 - {{{kbd(mouse-2)}}} or {{{kbd(mouse-1)}}} :: 3534 3535 #+kindex: mouse-2 3536 #+kindex: mouse-1 3537 On links, {{{kbd(mouse-1)}}} and {{{kbd(mouse-2)}}} opens the link 3538 just as {{{kbd(C-c C-o)}}} does. 3539 3540 - {{{kbd(mouse-3)}}} :: 3541 3542 #+vindex: org-link-use-indirect-buffer-for-internals 3543 #+kindex: mouse-3 3544 Like {{{kbd(mouse-2)}}}, but force file links to be opened with 3545 Emacs, and internal links to be displayed in another window[fn:: See 3546 the variable ~org-link-use-indirect-buffer-for-internals~.]. 3547 3548 - {{{kbd(C-c %)}}} (~org-mark-ring-push~) :: 3549 3550 #+kindex: C-c % 3551 #+findex: org-mark-ring-push 3552 #+cindex: mark ring 3553 Push the current position onto the Org mark ring, to be able to 3554 return easily. Commands following an internal link do this 3555 automatically. 3556 3557 - {{{kbd(C-c &)}}} (~org-mark-ring-goto~) :: 3558 3559 #+kindex: C-c & 3560 #+findex: org-mark-ring-goto 3561 #+cindex: links, returning to 3562 Jump back to a recorded position. A position is recorded by the 3563 commands following internal links, and by {{{kbd(C-c %)}}}. Using 3564 this command several times in direct succession moves through a ring 3565 of previously recorded positions. 3566 3567 - {{{kbd(C-c C-x C-n)}}} (~org-next-link~), {{{kbd(C-c C-x C-p)}}} (~org-previous-link~) :: 3568 3569 #+kindex: C-c C-x C-p 3570 #+findex: org-previous-link 3571 #+kindex: C-c C-x C-n 3572 #+findex: org-next-link 3573 #+cindex: links, finding next/previous 3574 Move forward/backward to the next link in the buffer. At the limit 3575 of the buffer, the search fails once, and then wraps around. The 3576 key bindings for this are really too long; you might want to bind 3577 this also to {{{kbd(M-n)}}} and {{{kbd(M-p)}}}. 3578 3579 #+begin_src emacs-lisp 3580 (with-eval-after-load 'org 3581 (define-key org-mode-map (kbd "M-n") #'org-next-link) 3582 (define-key org-mode-map (kbd "M-p") #'org-previous-link)) 3583 #+end_src 3584 3585 ** Using Links Outside Org 3586 :PROPERTIES: 3587 :DESCRIPTION: Linking from my C source code? 3588 :END: 3589 3590 #+findex: org-insert-link-global 3591 #+findex: org-open-at-point-global 3592 You can insert and follow links that have Org syntax not only in Org, 3593 but in any Emacs buffer. For this, Org provides two functions: 3594 ~org-insert-link-global~ and ~org-open-at-point-global~. 3595 3596 You might want to bind them to globally available keys. See 3597 [[*Activation]] for some advice. 3598 3599 ** Link Abbreviations 3600 :PROPERTIES: 3601 :DESCRIPTION: Shortcuts for writing complex links. 3602 :END: 3603 #+cindex: link abbreviations 3604 #+cindex: abbreviation, links 3605 3606 Long URL can be cumbersome to type, and often many similar links are 3607 needed in a document. For this you can use link abbreviations. An 3608 abbreviated link looks like this 3609 3610 : [[linkword:tag][description]] 3611 3612 #+texinfo: @noindent 3613 #+vindex: org-link-abbrev-alist 3614 where the tag is optional. The /linkword/ must be a word, starting 3615 with a letter, followed by letters, numbers, =-=, and =_=. 3616 Abbreviations are resolved according to the information in the 3617 variable ~org-link-abbrev-alist~ that relates the linkwords to 3618 replacement text. Here is an example: 3619 3620 #+begin_src emacs-lisp 3621 (setq org-link-abbrev-alist 3622 '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=") 3623 ("Nu Html Checker" . "https://validator.w3.org/nu/?doc=%h") 3624 ("duckduckgo" . "https://duckduckgo.com/?q=%s") 3625 ("omap" . "https://nominatim.openstreetmap.org/search?q=%s&polygon=1") 3626 ("ads" . "https://ui.adsabs.harvard.edu/search/q=%20author%3A\"%s\""))) 3627 #+end_src 3628 3629 If the replacement text contains the string =%s=, it is replaced with 3630 the tag. Using =%h= instead of =%s= percent-encodes the tag (see the 3631 example above, where we need to encode the URL parameter). Using 3632 =%(my-function)= passes the tag to a custom Lisp function, and replace 3633 it by the resulting string. 3634 3635 If the replacement text do not contain any specifier, it is simply 3636 appended to the string in order to create the link. 3637 3638 Instead of a string, you may also specify a Lisp function to create 3639 the link. Such a function will be called with the tag as the only 3640 argument. 3641 3642 With the above setting, you could link to a specific bug with 3643 =[[bugzilla:129]]=, search the web for =OrgMode= with =[[duckduckgo:OrgMode]]=, 3644 show the map location of the Free Software Foundation =[[gmap:51 3645 Franklin Street, Boston]]= or of Carsten office =[[omap:Science Park 904, 3646 Amsterdam, The Netherlands]]= and find out what the Org author is doing 3647 besides Emacs hacking with =[[ads:Dominik,C]]=. 3648 3649 If you need special abbreviations just for a single Org buffer, you 3650 can define them in the file with 3651 3652 #+cindex: @samp{LINK}, keyword 3653 #+begin_example 3654 ,#+LINK: bugzilla https://10.1.2.9/bugzilla/show_bug.cgi?id= 3655 ,#+LINK: duckduckgo https://duckduckgo.com/?q=%s 3656 ,#+LINK: "Nu Html Checker" https://validator.w3.org/nu/?doc=%h 3657 #+end_example 3658 3659 The abbreviations containing spaces must be quoted. 3660 3661 In-buffer completion (see [[*Completion]]) can be used after =[= to 3662 complete link abbreviations. You may also define a Lisp function that 3663 implements special (e.g., completion) support for inserting such a 3664 link with {{{kbd(C-c C-l)}}}. Such a function should not accept any 3665 arguments, and should return the full link with a prefix. You can set 3666 the link completion function like this: 3667 3668 #+begin_src emacs-lisp 3669 (org-link-set-parameter "type" :complete #'some-completion-function) 3670 #+end_src 3671 3672 ** Search Options in File Links 3673 :PROPERTIES: 3674 :DESCRIPTION: Linking to a specific location. 3675 :ALT_TITLE: Search Options 3676 :END: 3677 #+cindex: search option in file links 3678 #+cindex: file links, searching 3679 #+cindex: attachment links, searching 3680 3681 File links can contain additional information to make Emacs jump to a 3682 particular location in the file when following a link. This can be a 3683 line number or a search option after a double colon[fn:: For backward 3684 compatibility, line numbers can also follow a single colon.]. For 3685 example, when the command ~org-store-link~ creates a link (see 3686 [[*Handling Links]]) to a file, it encodes the words in the current 3687 line as a search string that can be used to find this line back later 3688 when following the link with {{{kbd(C-c C-o)}}}. 3689 3690 Note that all search options apply for Attachment links in the same 3691 way that they apply for File links. 3692 3693 Here is the syntax of the different ways to attach a search to a file 3694 link, together with explanations for each: 3695 3696 #+begin_example 3697 [[file:~/code/main.c::255]] 3698 [[file:~/xx.org::My Target]] 3699 [[file:~/xx.org::*My Target]] 3700 [[file:~/xx.org::#my-custom-id]] 3701 [[file:~/xx.org::/regexp/]] 3702 [[attachment:main.c::255]] 3703 #+end_example 3704 3705 - =255= :: 3706 3707 Jump to line 255. 3708 3709 - =My Target= :: 3710 3711 Search for a link target =<<My Target>>=, or do a text search for 3712 =my target=, similar to the search in internal links, see [[*Internal 3713 Links]]. In HTML export (see [[*HTML Export]]), such a file link becomes 3714 a HTML reference to the corresponding named anchor in the linked 3715 file. 3716 3717 - =*My Target= :: 3718 3719 In an Org file, restrict search to headlines. 3720 3721 - =#my-custom-id= :: 3722 3723 Link to a heading with a =CUSTOM_ID= property 3724 3725 - =/REGEXP/= :: 3726 3727 Do a regular expression search for {{{var(REGEXP)}}} (see [[*Regular 3728 Expressions]]). This uses the Emacs command ~occur~ to list all 3729 matches in a separate window. If the target file is in Org mode, 3730 ~org-occur~ is used to create a sparse tree with the matches. 3731 3732 As a degenerate case, a file link with an empty file name can be used 3733 to search the current file. For example, =[[file:::find me]]= does 3734 a search for =find me= in the current file, just as =[[find me]]= 3735 would. 3736 3737 ** Custom Searches 3738 :PROPERTIES: 3739 :DESCRIPTION: When the default search is not enough. 3740 :END: 3741 #+cindex: custom search strings 3742 #+cindex: search strings, custom 3743 3744 The default mechanism for creating search strings and for doing the 3745 actual search related to a file link may not work correctly in all 3746 cases. For example, BibTeX database files have many entries like 3747 ~year="1993"~ which would not result in good search strings, because 3748 the only unique identification for a BibTeX entry is the citation key. 3749 3750 #+vindex: org-create-file-search-functions 3751 #+vindex: org-execute-file-search-functions 3752 If you come across such a problem, you can write custom functions to 3753 set the right search string for a particular file type, and to do the 3754 search for the string in the file. Using ~add-hook~, these functions 3755 need to be added to the hook variables 3756 ~org-create-file-search-functions~ and 3757 ~org-execute-file-search-functions~. See the docstring for these 3758 variables for more information. Org actually uses this mechanism for 3759 BibTeX database files, and you can use the corresponding code as an 3760 implementation example. See the file =ol-bibtex.el=. 3761 3762 * TODO Items 3763 :PROPERTIES: 3764 :DESCRIPTION: Every tree branch can be a TODO item. 3765 :END: 3766 #+cindex: TODO items 3767 3768 Org mode does not maintain TODO lists as separate documents[fn:: Of 3769 course, you can make a document that contains only long lists of TODO 3770 items, but this is not required.]. Instead, TODO items are an 3771 integral part of the notes file, because TODO items usually come up 3772 while taking notes! With Org mode, simply mark any entry in a tree as 3773 being a TODO item. In this way, information is not duplicated, and 3774 the entire context from which the TODO item emerged is always present. 3775 3776 Of course, this technique for managing TODO items scatters them 3777 throughout your notes file. Org mode compensates for this by 3778 providing methods to give you an overview of all the things that you 3779 have to do. 3780 3781 ** Basic TODO Functionality 3782 :PROPERTIES: 3783 :DESCRIPTION: Marking and displaying TODO entries. 3784 :ALT_TITLE: TODO Basics 3785 :END: 3786 3787 Any headline becomes a TODO item when it starts with the word =TODO=, 3788 for example: 3789 3790 : *** TODO Write letter to Sam Fortune 3791 3792 The most important commands to work with TODO entries are: 3793 3794 - {{{kbd(C-c C-t)}}} (~org-todo~) :: 3795 3796 #+kindex: C-c C-t 3797 #+cindex: cycling, of TODO states 3798 Rotate the TODO state of the current item among 3799 3800 #+begin_example 3801 ,-> (unmarked) -> TODO -> DONE --. 3802 '--------------------------------' 3803 #+end_example 3804 3805 If TODO keywords have fast access keys (see [[*Fast access to TODO 3806 states]]), prompt for a TODO keyword through the fast selection 3807 interface; this is the default behavior when 3808 ~org-use-fast-todo-selection~ is non-~nil~. 3809 3810 The same state changing can also be done "remotely" from the agenda 3811 buffer with the {{{kbd(t)}}} command key (see [[*Commands in the 3812 Agenda Buffer]]). 3813 3814 - {{{kbd(S-RIGHT)}}} {{{kbd(S-LEFT)}}} :: 3815 3816 #+kindex: S-RIGHT 3817 #+kindex: S-LEFT 3818 #+vindex: org-treat-S-cursor-todo-selection-as-state-change 3819 Select the following/preceding TODO state, similar to cycling. 3820 Useful mostly if more than two TODO states are possible (see 3821 [[*Extended Use of TODO Keywords]]). See also [[*Packages that conflict 3822 with Org mode]], for a discussion of the interaction with 3823 shift-selection. See also the variable 3824 ~org-treat-S-cursor-todo-selection-as-state-change~. 3825 3826 - {{{kbd(C-c / t)}}} (~org-show-todo-tree~) :: 3827 3828 #+kindex: C-c / t 3829 #+cindex: sparse tree, for TODO 3830 #+vindex: org-todo-keywords 3831 #+findex: org-show-todo-tree 3832 View TODO items in a /sparse tree/ (see [[*Sparse Trees]]). Folds the 3833 entire buffer, but shows all TODO items---with not-DONE state---and 3834 the headings hierarchy above them. With a prefix argument, or by 3835 using {{{kbd(C-c / T)}}}, search for a specific TODO. You are 3836 prompted for the keyword, and you can also give a list of keywords 3837 like =KWD1|KWD2|...= to list entries that match any one of these 3838 keywords. With a numeric prefix argument N, show the tree for the 3839 Nth keyword in the variable ~org-todo-keywords~. With two prefix 3840 arguments, find all TODO states, both un-done and done. 3841 3842 - {{{kbd(M-x org-agenda t)}}} (~org-todo-list~) :: 3843 3844 #+kindex: t @r{(Agenda dispatcher)} 3845 Show the global TODO list. Collects the TODO items (with not-DONE 3846 states) from all agenda files (see [[*Agenda Views]]) into a single 3847 buffer. The new buffer is in Org Agenda mode, which provides 3848 commands to examine and manipulate the TODO entries from the new 3849 buffer (see [[*Commands in the Agenda Buffer]]). See [[*The global TODO 3850 list]], for more information. 3851 3852 - {{{kbd(S-M-RET)}}} (~org-insert-todo-heading~) :: 3853 3854 #+kindex: S-M-RET 3855 #+findex: org-insert-todo-heading 3856 Insert a new TODO entry below the current one. 3857 3858 #+vindex: org-todo-state-tags-triggers 3859 Changing a TODO state can also trigger tag changes. See the docstring 3860 of the option ~org-todo-state-tags-triggers~ for details. 3861 3862 ** Extended Use of TODO Keywords 3863 :PROPERTIES: 3864 :DESCRIPTION: Workflow and assignments. 3865 :ALT_TITLE: TODO Extensions 3866 :END: 3867 #+cindex: extended TODO keywords 3868 3869 #+vindex: org-todo-keywords 3870 By default, marked TODO entries have one of only two states: TODO and 3871 DONE. Org mode allows you to classify TODO items in more complex ways 3872 with /TODO keywords/ (stored in ~org-todo-keywords~). With special 3873 setup, the TODO keyword system can work differently in different 3874 files. 3875 3876 Note that /tags/ are another way to classify headlines in general and 3877 TODO items in particular (see [[*Tags]]). 3878 3879 *** TODO keywords as workflow states 3880 :PROPERTIES: 3881 :DESCRIPTION: From TODO to DONE in steps. 3882 :ALT_TITLE: Workflow states 3883 :END: 3884 #+cindex: TODO workflow 3885 #+cindex: workflow states as TODO keywords 3886 3887 You can use TODO keywords to indicate different, possibly /sequential/ 3888 states in the process of working on an item, for example[fn:: Changing 3889 the variable ~org-todo-keywords~ only becomes effective after 3890 restarting Org mode in a buffer.]: 3891 3892 #+begin_src emacs-lisp 3893 (setq org-todo-keywords 3894 '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED"))) 3895 #+end_src 3896 3897 The vertical bar separates the TODO keywords (states that /need 3898 action/) from the DONE states (which need /no further action/). If 3899 you do not provide the separator bar, the last state is used as the 3900 DONE state. 3901 3902 #+cindex: completion, of TODO keywords 3903 With this setup, the command {{{kbd(C-c C-t)}}} cycles an entry from 3904 =TODO= to =FEEDBACK=, then to =VERIFY=, and finally to =DONE= and 3905 =DELEGATED=. You may also use a numeric prefix argument to quickly 3906 select a specific state. For example {{{kbd(C-3 C-c C-t)}}} changes 3907 the state immediately to =VERIFY=. Or you can use {{{kbd(S-RIGHT)}}} 3908 and {{{kbd(S-LEFT)}}} to go forward and backward through the states. 3909 If you define many keywords, you can use in-buffer completion (see 3910 [[*Completion]]) or a special one-key selection scheme (see [[*Fast 3911 access to TODO states]]) to insert these words into the buffer. 3912 Changing a TODO state can be logged with a timestamp, see [[*Tracking 3913 TODO state changes]], for more information. 3914 3915 *** TODO keywords as types 3916 :PROPERTIES: 3917 :DESCRIPTION: I do this, Fred does the rest. 3918 :ALT_TITLE: TODO types 3919 :END: 3920 #+cindex: TODO types 3921 #+cindex: names as TODO keywords 3922 #+cindex: types as TODO keywords 3923 3924 The second possibility is to use TODO keywords to indicate different 3925 /types/ of action items. For example, you might want to indicate that 3926 items are for "work" or "home". Or, when you work with several people 3927 on a single project, you might want to assign action items directly to 3928 persons, by using their names as TODO keywords. This type of 3929 functionality is actually much better served by using tags (see 3930 [[*Tags]]), so the TODO implementation is kept just for backward 3931 compatibility. 3932 3933 Using TODO types, it would be set up like this: 3934 3935 #+begin_src emacs-lisp 3936 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE"))) 3937 #+end_src 3938 3939 In this case, different keywords do not indicate states, but rather 3940 different types. So the normal work flow would be to assign a task to 3941 a person, and later to mark it DONE. Org mode supports this style by 3942 adapting the workings of the command {{{kbd(C-c C-t)}}}[fn:: This is 3943 also true for the {{{kbd(t)}}} command in the agenda buffer.]. When 3944 used several times in succession, it still cycles through all names, 3945 in order to first select the right type for a task. But when you 3946 return to the item after some time and execute {{{kbd(C-c C-t)}}} 3947 again, it will switch from any name directly to =DONE=. Use prefix 3948 arguments or completion to quickly select a specific name. You can 3949 also review the items of a specific TODO type in a sparse tree by 3950 using a numeric prefix to {{{kbd(C-c / t)}}}. For example, to see all 3951 things Lucy has to do, you would use {{{kbd(C-3 C-c / t)}}}. To 3952 collect Lucy's items from all agenda files into a single buffer, you 3953 would use the numeric prefix argument as well when creating the global 3954 TODO list: {{{kbd(C-3 M-x org-agenda t)}}}. 3955 3956 *** Multiple keyword sets in one file 3957 :PROPERTIES: 3958 :DESCRIPTION: Mixing it all, still finding your way. 3959 :ALT_TITLE: Multiple sets in one file 3960 :END: 3961 #+cindex: TODO keyword sets 3962 3963 Sometimes you may want to use different sets of TODO keywords in 3964 parallel. For example, you may want to have the basic TODO/DONE, but 3965 also a workflow for bug fixing, and a separate state indicating that 3966 an item has been canceled---so it is not DONE, but also does not 3967 require action. Your setup would then look like this: 3968 3969 #+begin_src emacs-lisp 3970 (setq org-todo-keywords 3971 '((sequence "TODO" "|" "DONE") 3972 (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED") 3973 (sequence "|" "CANCELED"))) 3974 #+end_src 3975 3976 The keywords should all be different, this helps Org mode keep track 3977 of which subsequence should be used for a given entry. In this setup, 3978 {{{kbd(C-c C-t)}}} only operates within a sub-sequence, so it switches 3979 from =DONE= to (nothing) to =TODO=, and from =FIXED= to (nothing) to 3980 =REPORT=. Therefore you need a mechanism to initially select the 3981 correct sequence. In addition to typing a keyword or using completion 3982 (see [[*Completion]]), you may also apply the following commands: 3983 3984 #+attr_texinfo: :sep , 3985 - {{{kbd(C-u C-u C-c C-t)}}}, {{{kbd(C-S-RIGHT)}}}, {{{kbd(C-S-LEFT)}}} :: 3986 3987 #+kindex: C-S-RIGHT 3988 #+kindex: C-S-LEFT 3989 #+kindex: C-u C-u C-c C-t 3990 These keys jump from one TODO sub-sequence to the next. In the 3991 above example, {{{kbd(C-u C-u C-c C-t)}}} or {{{kbd(C-S-RIGHT)}}} 3992 would jump from =TODO= or =DONE= to =REPORT=, and any of the words 3993 in the second row to =CANCELED=. Note that the {{{kbd(C-S-)}}} key 3994 binding conflict with shift-selection (see [[*Packages that conflict 3995 with Org mode]]). 3996 3997 - {{{kbd(S-RIGHT)}}}, {{{kbd(S-LEFT)}}} :: 3998 3999 #+kindex: S-RIGHT 4000 #+kindex: S-LEFT 4001 {{{kbd(S-LEFT)}}} and {{{kbd(S-RIGHT)}}} walk through /all/ keywords 4002 from all sub-sequences, so for example {{{kbd(S-RIGHT)}}} would 4003 switch from =DONE= to =REPORT= in the example above. For 4004 a discussion of the interaction with shift-selection, see [[*Packages 4005 that conflict with Org mode]]. 4006 4007 *** Fast access to TODO states 4008 :PROPERTIES: 4009 :DESCRIPTION: Single letter selection of state. 4010 :END: 4011 4012 If you would like to quickly change an entry to an arbitrary TODO 4013 state instead of cycling through the states, you can set up keys for 4014 single-letter access to the states. This is done by adding the 4015 selection character after each keyword, in parentheses[fn:: All 4016 characters are allowed except =@=, =^= and =!=, which have a special 4017 meaning here.]. For example: 4018 4019 #+begin_src emacs-lisp 4020 (setq org-todo-keywords 4021 '((sequence "TODO(t)" "|" "DONE(d)") 4022 (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)") 4023 (sequence "|" "CANCELED(c)"))) 4024 #+end_src 4025 4026 #+vindex: org-fast-tag-selection-include-todo 4027 If you then press {{{kbd(C-c C-t)}}} followed by the selection key, 4028 the entry is switched to this state. {{{kbd(SPC)}}} can be used to 4029 remove any TODO keyword from an entry[fn:15]. 4030 4031 *** Setting up keywords for individual files 4032 :PROPERTIES: 4033 :DESCRIPTION: Different files, different requirements. 4034 :ALT_TITLE: Per-file keywords 4035 :END: 4036 #+cindex: keyword options 4037 #+cindex: per-file keywords 4038 #+cindex: @samp{TODO}, keyword 4039 #+cindex: @samp{TYP_TODO}, keyword 4040 #+cindex: @samp{SEQ_TODO}, keyword 4041 4042 It can be very useful to use different aspects of the TODO mechanism 4043 in different files. For file-local settings, you need to add special 4044 lines to the file which set the keywords and interpretation for that 4045 file only. For example, to set one of the two examples discussed 4046 above, you need one of the following lines, starting in column zero 4047 anywhere in the file: 4048 4049 : #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED 4050 4051 You may also write =#+SEQ_TODO= to be explicit about the 4052 interpretation, but it means the same as =#+TODO=, or 4053 4054 : #+TYP_TODO: Fred Sara Lucy Mike | DONE 4055 4056 A setup for using several sets in parallel would be: 4057 4058 #+begin_example 4059 ,#+TODO: TODO(t) | DONE(d) 4060 ,#+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f) 4061 ,#+TODO: | CANCELED(c) 4062 #+end_example 4063 4064 #+cindex: completion, of option keywords 4065 #+kindex: M-TAB 4066 To make sure you are using the correct keyword, type =#+= into the 4067 buffer and then use {{{kbd(M-TAB)}}} to complete it (see [[*Completion]]). 4068 4069 #+cindex: DONE, final TODO keyword 4070 Remember that the keywords after the vertical bar---or the last 4071 keyword if no bar is there---must always mean that the item is DONE, 4072 although you may use a different word. After changing one of these 4073 lines, use {{{kbd(C-c C-c)}}} with point still in the line to make the 4074 changes known to Org mode[fn:: Org mode parses these lines only when 4075 Org mode is activated after visiting a file. {{{kbd(C-c C-c)}}} with 4076 point in a line starting with =#+= is simply restarting Org mode for 4077 the current buffer.]. 4078 4079 *** Faces for TODO keywords 4080 :PROPERTIES: 4081 :DESCRIPTION: Highlighting states. 4082 :END: 4083 #+cindex: faces, for TODO keywords 4084 4085 #+vindex: org-todo, face 4086 #+vindex: org-done, face 4087 #+vindex: org-todo-keyword-faces 4088 Org mode highlights TODO keywords with special faces: ~org-todo~ for 4089 keywords indicating that an item still has to be acted upon, and 4090 ~org-done~ for keywords indicating that an item is finished. If you 4091 are using more than two different states, you might want to use 4092 special faces for some of them. This can be done using the variable 4093 ~org-todo-keyword-faces~. For example: 4094 4095 #+begin_src emacs-lisp 4096 (setq org-todo-keyword-faces 4097 '(("TODO" . org-warning) ("STARTED" . "yellow") 4098 ("CANCELED" . (:foreground "blue" :weight bold)))) 4099 #+end_src 4100 4101 #+vindex: org-faces-easy-properties 4102 While using a list with face properties as shown for =CANCELED= 4103 /should/ work, this does not always seem to be the case. If 4104 necessary, define a special face and use that. A string is 4105 interpreted as a color. The variable ~org-faces-easy-properties~ 4106 determines if that color is interpreted as a foreground or 4107 a background color. 4108 4109 *** TODO dependencies 4110 :PROPERTIES: 4111 :DESCRIPTION: When one task needs to wait for others. 4112 :END: 4113 #+cindex: TODO dependencies 4114 #+cindex: dependencies, of TODO states 4115 4116 #+vindex: org-enforce-todo-dependencies 4117 #+cindex: @samp{ORDERED}, property 4118 The structure of Org files---hierarchy and lists---makes it easy to 4119 define TODO dependencies. Usually, a parent TODO task should not be 4120 marked as done until all TODO subtasks, or children tasks, are marked 4121 as done. Sometimes there is a logical sequence to (sub)tasks, so that 4122 one subtask cannot be acted upon before all siblings above it have 4123 been marked as done. If you customize the variable 4124 ~org-enforce-todo-dependencies~, Org blocks entries from changing 4125 state to DONE while they have TODO children that are not DONE. 4126 Furthermore, if an entry has a property =ORDERED=, each of its TODO 4127 children is blocked until all earlier siblings are marked as done. 4128 Here is an example: 4129 4130 #+begin_example 4131 ,* TODO Blocked until (two) is done 4132 ,** DONE one 4133 ,** TODO two 4134 4135 ,* Parent 4136 :PROPERTIES: 4137 :ORDERED: t 4138 :END: 4139 ,** TODO a 4140 ,** TODO b, needs to wait for (a) 4141 ,** TODO c, needs to wait for (a) and (b) 4142 #+end_example 4143 4144 #+cindex: TODO dependencies, @samp{NOBLOCKING} 4145 #+cindex: @samp{NOBLOCKING}, property 4146 You can ensure an entry is never blocked by using the =NOBLOCKING= 4147 property (see [[*Properties and Columns]]): 4148 4149 #+begin_example 4150 ,* This entry is never blocked 4151 :PROPERTIES: 4152 :NOBLOCKING: t 4153 :END: 4154 #+end_example 4155 4156 - {{{kbd(C-c C-x o)}}} (~org-toggle-ordered-property~) :: 4157 4158 #+kindex: C-c C-x o 4159 #+findex: org-toggle-ordered-property 4160 #+vindex: org-track-ordered-property-with-tag 4161 Toggle the =ORDERED= property of the current entry. A property is 4162 used for this behavior because this should be local to the current 4163 entry, not inherited from entries above like a tag (see [[*Tags]]). 4164 However, if you would like to /track/ the value of this property 4165 with a tag for better visibility, customize the variable 4166 ~org-track-ordered-property-with-tag~. 4167 4168 - {{{kbd(C-u C-u C-u C-c C-t)}}} :: 4169 4170 #+kindex: C-u C-u C-u C-u C-c C-t 4171 Change TODO state, regardless of any state blocking. 4172 4173 #+vindex: org-agenda-dim-blocked-tasks 4174 If you set the variable ~org-agenda-dim-blocked-tasks~, TODO entries 4175 that cannot be marked as done because of unmarked children are shown 4176 in a dimmed font or even made invisible in agenda views (see [[*Agenda 4177 Views]]). 4178 4179 #+cindex: checkboxes and TODO dependencies 4180 #+vindex: org-enforce-todo-dependencies 4181 You can also block changes of TODO states by using checkboxes (see 4182 [[*Checkboxes]]). If you set the variable 4183 ~org-enforce-todo-checkbox-dependencies~, an entry that has unchecked 4184 checkboxes is blocked from switching to DONE. 4185 4186 If you need more complex dependency structures, for example 4187 dependencies between entries in different trees or files, check out 4188 the module =org-depend.el= in the =org-contrib= repository. 4189 4190 ** Progress Logging 4191 :PROPERTIES: 4192 :DESCRIPTION: Dates and notes for progress. 4193 :END: 4194 #+cindex: progress logging 4195 #+cindex: logging, of progress 4196 4197 To record a timestamp and a note when changing a TODO state, call the 4198 command ~org-todo~ with a prefix argument. 4199 4200 - {{{kbd(C-u C-c C-t)}}} (~org-todo~) :: 4201 4202 #+kindex: C-u C-c C-t 4203 Prompt for a note and record a the time of the TODO state change. 4204 The note is inserted as a list item below the headline, but can also 4205 be placed into a drawer, see [[*Tracking TODO state changes]]. 4206 4207 If you want to be more systematic, Org mode can automatically record a 4208 timestamp and optionally a note when you mark a TODO item as DONE, or 4209 even each time you change the state of a TODO item. This system is 4210 highly configurable, settings can be on a per-keyword basis and can be 4211 localized to a file or even a subtree. For information on how to 4212 clock working time for a task, see [[*Clocking Work Time]]. 4213 4214 *** Closing items 4215 :PROPERTIES: 4216 :DESCRIPTION: When was this entry marked as done? 4217 :END: 4218 4219 The most basic automatic logging is to keep track of /when/ a certain 4220 TODO item was marked as done. This can be achieved with[fn:: The 4221 corresponding in-buffer setting is: =#+STARTUP: logdone=.] 4222 4223 #+begin_src emacs-lisp 4224 (setq org-log-done 'time) 4225 #+end_src 4226 4227 #+vindex: org-closed-keep-when-no-todo 4228 #+texinfo: @noindent 4229 Then each time you turn an entry from a TODO (not-done) state into any 4230 of the DONE states, a line =CLOSED: [timestamp]= is inserted just 4231 after the headline. If you turn the entry back into a TODO item 4232 through further state cycling, that line is removed again. If you 4233 turn the entry back to a non-TODO state (by pressing {{{kbd(C-c C-t 4234 SPC)}}} for example), that line is also removed, unless you set 4235 ~org-closed-keep-when-no-todo~ to non-~nil~. If you want to record a 4236 note along with the timestamp, use[fn:: The corresponding in-buffer 4237 setting is: =#+STARTUP: lognotedone=.] 4238 4239 #+begin_src emacs-lisp 4240 (setq org-log-done 'note) 4241 #+end_src 4242 4243 #+texinfo: @noindent 4244 You are then prompted for a note, and that note is stored below the 4245 entry with a =Closing Note= heading. 4246 4247 *** Tracking TODO state changes 4248 :PROPERTIES: 4249 :DESCRIPTION: When did the status change? 4250 :END: 4251 #+cindex: drawer, for state change recording 4252 4253 #+vindex: org-log-states-order-reversed 4254 #+vindex: org-log-into-drawer 4255 #+cindex: @samp{LOG_INTO_DRAWER}, property 4256 You might want to automatically keep track of when a state change 4257 occurred and maybe take a note about this change. You can either 4258 record just a timestamp, or a time-stamped note. These records are 4259 inserted after the headline as an itemized list, newest first[fn:: See 4260 the variable ~org-log-states-order-reversed~.]. When taking a lot of 4261 notes, you might want to get the notes out of the way into a drawer 4262 (see [[*Drawers]]). Customize the variable ~org-log-into-drawer~ to 4263 get this behavior---the recommended drawer for this is called 4264 =LOGBOOK=[fn:: Note that the =LOGBOOK= drawer is unfolded when 4265 pressing {{{kbd(SPC)}}} in the agenda to show an entry---use 4266 {{{kbd(C-u SPC)}}} to keep it folded here.]. You can also overrule 4267 the setting of this variable for a subtree by setting a 4268 =LOG_INTO_DRAWER= property. 4269 4270 Since it is normally too much to record a note for every state, Org 4271 mode expects configuration on a per-keyword basis for this. This is 4272 achieved by adding special markers =!= (for a timestamp) or =@= (for 4273 a note with timestamp) in parentheses after each keyword. For 4274 example, with the setting 4275 4276 #+begin_src emacs-lisp 4277 (setq org-todo-keywords 4278 '((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)"))) 4279 #+end_src 4280 4281 #+vindex: org-log-done 4282 You not only define global TODO keywords and fast access keys, but 4283 also request that a time is recorded when the entry is set to =DONE=, 4284 and that a note is recorded when switching to =WAIT= or 4285 =CANCELED=[fn:16]. The setting for =WAIT= is even more special: the 4286 =!= after the slash means that in addition to the note taken when 4287 entering the state, a timestamp should be recorded when /leaving/ the 4288 =WAIT= state, if and only if the /target/ state does not configure 4289 logging for entering it. So it has no effect when switching from 4290 =WAIT= to =DONE=, because =DONE= is configured to record a timestamp 4291 only. But when switching from =WAIT= back to =TODO=, the =/!= in the 4292 =WAIT= setting now triggers a timestamp even though =TODO= has no 4293 logging configured. 4294 4295 You can use the exact same syntax for setting logging preferences local 4296 to a buffer: 4297 4298 : #+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@) 4299 4300 To record a timestamp without a note for TODO keywords configured with 4301 =@=, just type {{{kbd(C-c C-c)}}} to enter a blank note when prompted. 4302 4303 #+cindex: @samp{LOGGING}, property 4304 In order to define logging settings that are local to a subtree or 4305 a single item, define a =LOGGING= property in this entry. Any 4306 non-empty =LOGGING= property resets all logging settings to ~nil~. 4307 You may then turn on logging for this specific tree using =STARTUP= 4308 keywords like =lognotedone= or =logrepeat=, as well as adding state 4309 specific settings like =TODO(!)=. For example: 4310 4311 #+begin_example 4312 ,* TODO Log each state with only a time 4313 :PROPERTIES: 4314 :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!) 4315 :END: 4316 ,* TODO Only log when switching to WAIT, and when repeating 4317 :PROPERTIES: 4318 :LOGGING: WAIT(@) logrepeat 4319 :END: 4320 ,* TODO No logging at all 4321 :PROPERTIES: 4322 :LOGGING: nil 4323 :END: 4324 #+end_example 4325 4326 *** Tracking your habits 4327 :PROPERTIES: 4328 :DESCRIPTION: How consistent have you been? 4329 :END: 4330 #+cindex: habits 4331 #+cindex: @samp{STYLE}, property 4332 4333 Org has the ability to track the consistency of a special category of 4334 TODO, called "habits." To use habits, you have to enable the ~habit~ 4335 module by customizing the variable ~org-modules~. 4336 4337 A habit has the following properties: 4338 4339 1. The habit is a TODO item, with a TODO keyword representing an open 4340 state. 4341 4342 2. The property =STYLE= is set to the value =habit= (see [[*Properties 4343 and Columns]]). 4344 4345 3. The TODO has a scheduled date, usually with a =.+= style repeat 4346 interval. A =++= style may be appropriate for habits with time 4347 constraints, e.g., must be done on weekends, or a =+= style for an 4348 unusual habit that can have a backlog, e.g., weekly reports. 4349 4350 4. The TODO may also have minimum and maximum ranges specified by 4351 using the syntax =.+2d/3d=, which says that you want to do the task 4352 at least every three days, but at most every two days. 4353 4354 5. State logging for the DONE state is enabled (see [[*Tracking TODO 4355 state changes]]), in order for historical data to be represented in 4356 the consistency graph. If it is not enabled it is not an error, 4357 but the consistency graphs are largely meaningless. 4358 4359 To give you an idea of what the above rules look like in action, here's an 4360 actual habit with some history: 4361 4362 #+begin_example 4363 ,** TODO Shave 4364 SCHEDULED: <2009-10-17 Sat .+2d/4d> 4365 :PROPERTIES: 4366 :STYLE: habit 4367 :LAST_REPEAT: [2009-10-19 Mon 00:36] 4368 :END: 4369 - State "DONE" from "TODO" [2009-10-15 Thu] 4370 - State "DONE" from "TODO" [2009-10-12 Mon] 4371 - State "DONE" from "TODO" [2009-10-10 Sat] 4372 - State "DONE" from "TODO" [2009-10-04 Sun] 4373 - State "DONE" from "TODO" [2009-10-02 Fri] 4374 - State "DONE" from "TODO" [2009-09-29 Tue] 4375 - State "DONE" from "TODO" [2009-09-25 Fri] 4376 - State "DONE" from "TODO" [2009-09-19 Sat] 4377 - State "DONE" from "TODO" [2009-09-16 Wed] 4378 - State "DONE" from "TODO" [2009-09-12 Sat] 4379 #+end_example 4380 4381 What this habit says is: I want to shave at most every 2 days---given 4382 by the =SCHEDULED= date and repeat interval---and at least every 4383 4 days. If today is the 15th, then the habit first appears in the 4384 agenda (see [[*Agenda Views]]) on Oct 17, after the minimum of 2 days has 4385 elapsed, and will appear overdue on Oct 19, after four days have 4386 elapsed. 4387 4388 What's really useful about habits is that they are displayed along 4389 with a consistency graph, to show how consistent you've been at 4390 getting that task done in the past. This graph shows every day that 4391 the task was done over the past three weeks, with colors for each day. 4392 The colors used are: 4393 4394 - Blue :: If the task was not to be done yet on that day. 4395 - Green :: If the task could have been done on that day. 4396 - Yellow :: If the task was going to be overdue the next day. 4397 - Red :: If the task was overdue on that day. 4398 4399 In addition to coloring each day, the day is also marked with an 4400 asterisk if the task was actually done that day, and an exclamation 4401 mark to show where the current day falls in the graph. 4402 4403 There are several configuration variables that can be used to change 4404 the way habits are displayed in the agenda. 4405 4406 - ~org-habit-graph-column~ :: 4407 4408 #+vindex: org-habit-graph-column 4409 The buffer column at which the consistency graph should be drawn. 4410 This overwrites any text in that column, so it is a good idea to 4411 keep your habits' titles brief and to the point. 4412 4413 - ~org-habit-preceding-days~ :: 4414 4415 #+vindex: org-habit-preceding-days 4416 The amount of history, in days before today, to appear in 4417 consistency graphs. 4418 4419 - ~org-habit-following-days~ :: 4420 4421 #+vindex: org-habit-following-days 4422 The number of days after today that appear in consistency graphs. 4423 4424 - ~org-habit-show-habits-only-for-today~ :: 4425 4426 #+vindex: org-habit-show-habits-only-for-today 4427 If non-~nil~, only show habits in today's agenda view. The default 4428 value is ~t~. Pressing {{{kbd(C-u K)}}} in the agenda toggles this 4429 variable. 4430 4431 Lastly, pressing {{{kbd(K)}}} in the agenda buffer causes habits to 4432 temporarily be disabled and do not appear at all. Press {{{kbd(K)}}} 4433 again to bring them back. They are also subject to tag filtering, if 4434 you have habits which should only be done in certain contexts, for 4435 example. 4436 4437 ** Priorities 4438 :PROPERTIES: 4439 :DESCRIPTION: Some things are more important than others. 4440 :END: 4441 #+cindex: priorities 4442 #+cindex: priority cookie 4443 4444 If you use Org mode extensively, you may end up with enough TODO items 4445 that it starts to make sense to prioritize them. Prioritizing can be 4446 done by placing a /priority cookie/ into the headline of a TODO item 4447 right after the TODO keyword, like this: 4448 4449 : *** TODO [#A] Write letter to Sam Fortune 4450 4451 #+vindex: org-priority-faces 4452 By default, Org mode supports three priorities: =A=, =B=, and =C=. 4453 =A= is the highest priority. An entry without a cookie is treated as 4454 equivalent if it had priority =B=. Priorities make a difference only 4455 for sorting in the agenda (see [[*Weekly/daily agenda]]). Outside the 4456 agenda, they have no inherent meaning to Org mode. The cookies are 4457 displayed with the face defined by the variable ~org-priority-faces~, 4458 which can be customized. 4459 4460 You can also use numeric values for priorities, such as 4461 4462 : *** TODO [#1] Write letter to Sam Fortune 4463 4464 When using numeric priorities, you need to set ~org-priority-highest~, 4465 ~org-priority-lowest~ and ~org-priority-default~ to integers, which 4466 must all be strictly inferior to 65. 4467 4468 Priorities can be attached to any outline node; they do not need to be 4469 TODO items. 4470 4471 #+attr_texinfo: :sep ; 4472 - {{{kbd(C-c \,)}}} (~org-priority~) :: 4473 4474 #+kindex: C-c , 4475 #+findex: org-priority 4476 Set the priority of the current headline. The command prompts for 4477 a priority character =A=, =B= or =C=. When you press {{{kbd(SPC)}}} 4478 instead, the priority cookie, if one is set, is removed from the 4479 headline. The priorities can also be changed "remotely" from the 4480 agenda buffer with the {{{kbd(\,)}}} command (see [[*Commands in the 4481 Agenda Buffer]]). 4482 4483 - {{{kbd(S-UP)}}} (~org-priority-up~); {{{kbd(S-DOWN)}}} (~org-priority-down~) :: 4484 4485 #+kindex: S-UP 4486 #+kindex: S-DOWN 4487 #+findex: org-priority-up 4488 #+findex: org-priority-down 4489 #+vindex: org-priority-start-cycle-with-default 4490 Increase/decrease the priority of the current headline[fn:: See also 4491 the option ~org-priority-start-cycle-with-default~.]. Note that 4492 these keys are also used to modify timestamps (see [[*Creating 4493 Timestamps]]). See also [[*Packages that conflict with Org mode]], 4494 for a discussion of the interaction with shift-selection. 4495 4496 #+vindex: org-priority-highest 4497 #+vindex: org-priority-lowest 4498 #+vindex: org-priority-default 4499 You can change the range of allowed priorities by setting the 4500 variables ~org-priority-highest~, ~org-priority-lowest~, and 4501 ~org-priority-default~. For an individual buffer, you may set these 4502 values (highest, lowest, default) like this (please make sure that the 4503 highest priority is earlier in the alphabet than the lowest priority): 4504 4505 #+cindex: @samp{PRIORITIES}, keyword 4506 : #+PRIORITIES: A C B 4507 4508 Or, using numeric values: 4509 4510 : #+PRIORITIES: 1 10 5 4511 4512 ** Breaking Down Tasks into Subtasks 4513 :PROPERTIES: 4514 :DESCRIPTION: Splitting a task into manageable pieces. 4515 :ALT_TITLE: Breaking Down Tasks 4516 :END: 4517 #+cindex: tasks, breaking down 4518 #+cindex: statistics, for TODO items 4519 4520 #+vindex: org-agenda-todo-list-sublevels 4521 It is often advisable to break down large tasks into smaller, 4522 manageable subtasks. You can do this by creating an outline tree 4523 below a TODO item, with detailed subtasks on the tree[fn:: To keep 4524 subtasks out of the global TODO list, see the option 4525 ~org-agenda-todo-list-sublevels~.]. To keep an overview of the 4526 fraction of subtasks that have already been marked as done, insert 4527 either =[/]= or =[%]= anywhere in the headline. These cookies are 4528 updated each time the TODO status of a child changes, or when pressing 4529 {{{kbd(C-c C-c)}}} on the cookie. For example: 4530 4531 #+begin_example 4532 ,* Organize Party [33%] 4533 ,** TODO Call people [1/2] 4534 ,*** TODO Peter 4535 ,*** DONE Sarah 4536 ,** TODO Buy food 4537 ,** DONE Talk to neighbor 4538 #+end_example 4539 4540 #+cindex: @samp{COOKIE_DATA}, property 4541 If a heading has both checkboxes and TODO children below it, the 4542 meaning of the statistics cookie become ambiguous. Set the property 4543 =COOKIE_DATA= to either =checkbox= or =todo= to resolve this issue. 4544 4545 #+vindex: org-hierarchical-todo-statistics 4546 If you would like to have the statistics cookie count any TODO entries 4547 in the subtree (not just direct children), configure the variable 4548 ~org-hierarchical-todo-statistics~. To do this for a single subtree, 4549 include the word =recursive= into the value of the =COOKIE_DATA= 4550 property. 4551 4552 #+begin_example 4553 ,* Parent capturing statistics [2/20] 4554 :PROPERTIES: 4555 :COOKIE_DATA: todo recursive 4556 :END: 4557 #+end_example 4558 4559 If you would like a TODO entry to automatically change to DONE when 4560 all children are done, you can use the following setup: 4561 4562 #+begin_src emacs-lisp 4563 (defun org-summary-todo (n-done n-not-done) 4564 "Switch entry to DONE when all subentries are done, to TODO otherwise." 4565 (let (org-log-done org-log-states) ; turn off logging 4566 (org-todo (if (= n-not-done 0) "DONE" "TODO")))) 4567 4568 (add-hook 'org-after-todo-statistics-hook #'org-summary-todo) 4569 #+end_src 4570 4571 Another possibility is the use of checkboxes to identify (a hierarchy 4572 of) a large number of subtasks (see [[*Checkboxes]]). 4573 4574 ** Checkboxes 4575 :PROPERTIES: 4576 :DESCRIPTION: Tick-off lists. 4577 :END: 4578 #+cindex: checkboxes 4579 4580 #+vindex: org-list-automatic-rules 4581 Every item in a plain list[fn:17] (see [[*Plain Lists]]) can be made into 4582 a checkbox by starting it with the string =[ ]=. This feature is 4583 similar to TODO items (see [[*TODO Items]]), but is more lightweight. 4584 Checkboxes are not included into the global TODO list, so they are 4585 often great to split a task into a number of simple steps. Or you can 4586 use them in a shopping list. 4587 4588 Here is an example of a checkbox list. 4589 4590 #+begin_example 4591 ,* TODO Organize party [2/4] 4592 - [-] call people [1/3] 4593 - [ ] Peter 4594 - [X] Sarah 4595 - [ ] Sam 4596 - [X] order food 4597 - [ ] think about what music to play 4598 - [X] talk to the neighbors 4599 #+end_example 4600 4601 Checkboxes work hierarchically, so if a checkbox item has children 4602 that are checkboxes, toggling one of the children checkboxes makes the 4603 parent checkbox reflect if none, some, or all of the children are 4604 checked. 4605 4606 #+cindex: statistics, for checkboxes 4607 #+cindex: checkbox statistics 4608 #+cindex: @samp{COOKIE_DATA}, property 4609 #+vindex: org-hierarchical-checkbox-statistics 4610 The =[2/4]= and =[1/3]= in the first and second line are cookies 4611 indicating how many checkboxes present in this entry have been checked 4612 off, and the total number of checkboxes present. This can give you an 4613 idea on how many checkboxes remain, even without opening a folded 4614 entry. The cookies can be placed into a headline or into (the first 4615 line of) a plain list item. Each cookie covers checkboxes of direct 4616 children structurally below the headline/item on which the cookie 4617 appears[fn:: Set the variable ~org-hierarchical-checkbox-statistics~ 4618 if you want such cookies to count all checkboxes below the cookie, not 4619 just those belonging to direct children.]. You have to insert the 4620 cookie yourself by typing either =[/]= or =[%]=. With =[/]= you get 4621 an =n out of m= result, as in the examples above. With =[%]= you get 4622 information about the percentage of checkboxes checked (in the above 4623 example, this would be =[50%]= and =[33%]=, respectively). In a 4624 headline, a cookie can count either checkboxes below the heading or 4625 TODO states of children, and it displays whatever was changed last. 4626 Set the property =COOKIE_DATA= to either =checkbox= or =todo= to 4627 resolve this issue. 4628 4629 #+cindex: blocking, of checkboxes 4630 #+cindex: checkbox blocking 4631 #+cindex: @samp{ORDERED}, property 4632 If the current outline node has an =ORDERED= property, checkboxes must 4633 be checked off in sequence, and an error is thrown if you try to check 4634 off a box while there are unchecked boxes above it. 4635 4636 The following commands work with checkboxes: 4637 4638 - {{{kbd(C-c C-c)}}} (~org-toggle-checkbox~) :: 4639 4640 #+kindex: C-c C-c 4641 #+findex: org-toggle-checkbox 4642 Toggle checkbox status or---with prefix argument---checkbox presence 4643 at point. With a single prefix argument, add an empty checkbox or 4644 remove the current one[fn:: {{{kbd(C-u C-c C-c)}}} on the /first/ 4645 item of a list with no checkbox adds checkboxes to the rest of the 4646 list.]. With a double prefix argument, set it to =[-]=, which is 4647 considered to be an intermediate state. 4648 4649 - {{{kbd(C-c C-x C-b)}}} (~org-toggle-checkbox~) :: 4650 4651 #+kindex: C-c C-x C-b 4652 Toggle checkbox status or---with prefix argument---checkbox presence 4653 at point. With double prefix argument, set it to =[-]=, which is 4654 considered to be an intermediate state. 4655 4656 - If there is an active region, toggle the first checkbox in the 4657 region and set all remaining boxes to the same status as the 4658 first. With a prefix argument, add or remove the checkbox for all 4659 items in the region. 4660 4661 - If point is in a headline, toggle checkboxes in the region between 4662 this headline and the next---so /not/ the entire subtree. 4663 4664 - If there is no active region, just toggle the checkbox at point. 4665 4666 - {{{kbd(C-c C-x C-r)}}} (~org-toggle-radio-button~) :: 4667 4668 #+kindex: C-c C-x C-r 4669 #+findex: org-toggle-radio-button 4670 #+cindex: radio button, checkbox as 4671 Toggle checkbox status by using the checkbox of the item at point as 4672 a radio button: when the checkbox is turned on, all other checkboxes 4673 on the same level will be turned off. With a universal prefix 4674 argument, toggle the presence of the checkbox. With a double prefix 4675 argument, set it to =[-]=. 4676 4677 #+findex: org-list-checkbox-radio-mode 4678 {{{kbd(C-c C-c)}}} can be told to consider checkboxes as radio buttons by 4679 setting =#+ATTR_ORG: :radio t= right before the list or by calling 4680 {{{kbd(M-x org-list-checkbox-radio-mode)}}} to activate this minor mode. 4681 4682 - {{{kbd(M-S-RET)}}} (~org-insert-todo-heading~) :: 4683 4684 #+kindex: M-S-RET 4685 #+findex: org-insert-todo-heading 4686 Insert a new item with a checkbox. This works only if point is 4687 already in a plain list item (see [[*Plain Lists]]). 4688 4689 - {{{kbd(C-c C-x o)}}} (~org-toggle-ordered-property~) :: 4690 4691 #+kindex: C-c C-x o 4692 #+findex: org-toggle-ordered-property 4693 #+vindex: org-track-ordered-property-with-tag 4694 Toggle the =ORDERED= property of the entry, to toggle if checkboxes 4695 must be checked off in sequence. A property is used for this 4696 behavior because this should be local to the current entry, not 4697 inherited like a tag. However, if you would like to /track/ the 4698 value of this property with a tag for better visibility, customize 4699 ~org-track-ordered-property-with-tag~. 4700 4701 - {{{kbd(C-c #)}}} (~org-update-statistics-cookies~) :: 4702 4703 #+kindex: C-c # 4704 #+findex: org-update-statistics-cookies 4705 Update the statistics cookie in the current outline entry. When 4706 called with a {{{kbd(C-u)}}} prefix, update the entire file. 4707 Checkbox statistic cookies are updated automatically if you toggle 4708 checkboxes with {{{kbd(C-c C-c)}}} and make new ones with 4709 {{{kbd(M-S-RET)}}}. TODO statistics cookies update when changing 4710 TODO states. If you delete boxes/entries or add/change them by 4711 hand, use this command to get things back into sync. 4712 4713 * Tags 4714 :PROPERTIES: 4715 :DESCRIPTION: Tagging headlines and matching sets of tags. 4716 :END: 4717 #+cindex: tags 4718 #+cindex: headline tagging 4719 #+cindex: matching, tags 4720 #+cindex: sparse tree, tag based 4721 4722 An excellent way to implement labels and contexts for 4723 cross-correlating information is to assign /tags/ to headlines. Org 4724 mode has extensive support for tags. 4725 4726 #+vindex: org-tag-faces 4727 Every headline can contain a list of tags; they occur at the end of 4728 the headline. Tags are normal words containing letters, numbers, =_=, 4729 and =@=. Tags must be preceded and followed by a single colon, e.g., 4730 =:work:=. Several tags can be specified, as in =:work:urgent:=. Tags 4731 by default are in bold face with the same color as the headline. You 4732 may specify special faces for specific tags using the variable 4733 ~org-tag-faces~, in much the same way as you can for TODO keywords 4734 (see [[*Faces for TODO keywords]]). 4735 4736 ** Tag Inheritance 4737 :PROPERTIES: 4738 :DESCRIPTION: Tags use the tree structure of an outline. 4739 :END: 4740 #+cindex: tag inheritance 4741 #+cindex: inheritance, of tags 4742 #+cindex: sublevels, inclusion into tags match 4743 4744 /Tags/ make use of the hierarchical structure of outline trees. If 4745 a heading has a certain tag, all subheadings inherit the tag as well. 4746 For example, in the list 4747 4748 #+begin_example 4749 ,* Meeting with the French group :work: 4750 ,** Summary by Frank :boss:notes: 4751 ,*** TODO Prepare slides for him :action: 4752 #+end_example 4753 4754 #+texinfo: @noindent 4755 the final heading has the tags =work=, =boss=, =notes=, and =action= 4756 even though the final heading is not explicitly marked with those 4757 tags. You can also set tags that all entries in a file should inherit 4758 just as if these tags were defined in a hypothetical level zero that 4759 surrounds the entire file. Use a line like this[fn:: As with all 4760 these in-buffer settings, pressing {{{kbd(C-c C-c)}}} activates any 4761 changes in the line.] 4762 4763 #+cindex: @samp{FILETAGS}, keyword 4764 : #+FILETAGS: :Peter:Boss:Secret: 4765 4766 #+vindex: org-use-tag-inheritance 4767 #+vindex: org-tags-exclude-from-inheritance 4768 To limit tag inheritance to specific tags, or to turn it off entirely, 4769 use the variables ~org-use-tag-inheritance~ and 4770 ~org-tags-exclude-from-inheritance~. 4771 4772 #+vindex: org-tags-match-list-sublevels 4773 When a headline matches during a tags search while tag inheritance is 4774 turned on, all the sublevels in the same tree---for a simple match 4775 form---match as well[fn:: This is only true if the search does not 4776 involve more complex tests including properties (see [[*Property 4777 Searches]]).]. The list of matches may then become very long. If you 4778 only want to see the first tags match in a subtree, configure the 4779 variable ~org-tags-match-list-sublevels~ (not recommended). 4780 4781 #+vindex: org-agenda-use-tag-inheritance 4782 Tag inheritance is relevant when the agenda search tries to match 4783 a tag, either in the ~tags~ or ~tags-todo~ agenda types. In other 4784 agenda types, ~org-use-tag-inheritance~ has no effect. Still, you may 4785 want to have your tags correctly set in the agenda, so that tag 4786 filtering works fine, with inherited tags. Set 4787 ~org-agenda-use-tag-inheritance~ to control this: the default value 4788 includes all agenda types, but setting this to ~nil~ can really speed 4789 up agenda generation. 4790 4791 ** Setting Tags 4792 :PROPERTIES: 4793 :DESCRIPTION: How to assign tags to a headline. 4794 :END: 4795 #+cindex: setting tags 4796 #+cindex: tags, setting 4797 4798 #+kindex: M-TAB 4799 Tags can simply be typed into the buffer at the end of a headline. 4800 After a colon, {{{kbd(M-TAB)}}} offers completion on tags. There is 4801 also a special command for inserting tags: 4802 4803 - {{{kbd(C-c C-q)}}} (~org-set-tags-command~) :: 4804 4805 #+kindex: C-c C-q 4806 #+findex: org-set-tags-command 4807 #+cindex: completion, of tags 4808 #+vindex: org-tags-column 4809 Enter new tags for the current headline. Org mode either offers 4810 completion or a special single-key interface for setting tags, see 4811 below. After pressing {{{kbd(RET)}}}, the tags are inserted and 4812 aligned to ~org-tags-column~. When called with a {{{kbd(C-u)}}} 4813 prefix, all tags in the current buffer are aligned to that column, 4814 just to make things look nice. Tags are automatically realigned 4815 after promotion, demotion, and TODO state changes (see [[*Basic TODO 4816 Functionality]]). 4817 4818 - {{{kbd(C-c C-c)}}} (~org-set-tags-command~) :: 4819 4820 #+kindex: C-c C-c 4821 When point is in a headline, this does the same as {{{kbd(C-c 4822 C-q)}}}. 4823 4824 #+vindex: org-complete-tags-always-offer-all-agenda-tags 4825 #+vindex: org-tag-alist 4826 #+cindex: @samp{TAGS}, keyword 4827 Org supports tag insertion based on a /list of tags/. By default this 4828 list is constructed dynamically, containing all tags currently used in 4829 the buffer[fn:: To extend this default list to all tags used in all 4830 agenda files (see [[*Agenda Views]]), customize the variable 4831 ~org-complete-tags-always-offer-all-agenda-tags~.]. You may also 4832 globally specify a hard list of tags with the variable 4833 ~org-tag-alist~. Finally you can set the default tags for a given 4834 file using the =TAGS= keyword, like 4835 4836 #+begin_example 4837 ,#+TAGS: @work @home @tennisclub 4838 ,#+TAGS: laptop car pc sailboat 4839 #+end_example 4840 4841 If you have globally defined your preferred set of tags using the 4842 variable ~org-tag-alist~, but would like to use a dynamic tag list in 4843 a specific file, add an empty =TAGS= keyword to that file: 4844 4845 : #+TAGS: 4846 4847 #+vindex: org-tag-persistent-alist 4848 If you have a preferred set of tags that you would like to use in 4849 every file, in addition to those defined on a per-file basis by =TAGS= 4850 keyword, then you may specify a list of tags with the variable 4851 ~org-tag-persistent-alist~. You may turn this off on a per-file basis 4852 by adding a =STARTUP= keyword to that file: 4853 4854 : #+STARTUP: noptag 4855 4856 By default Org mode uses the standard minibuffer completion facilities 4857 for entering tags. However, it also implements another, quicker, tag 4858 selection method called /fast tag selection/. This allows you to 4859 select and deselect tags with just a single key press. For this to 4860 work well you should assign unique letters to most of your commonly 4861 used tags. You can do this globally by configuring the variable 4862 ~org-tag-alist~ in your Emacs init file. For example, you may find 4863 the need to tag many items in different files with =@home=. In this 4864 case you can set something like: 4865 4866 #+begin_src emacs-lisp 4867 (setq org-tag-alist '(("@work" . ?w) ("@home" . ?h) ("laptop" . ?l))) 4868 #+end_src 4869 4870 If the tag is only relevant to the file you are working on, then you 4871 can instead set the =TAGS= keyword as: 4872 4873 : #+TAGS: @work(w) @home(h) @tennisclub(t) laptop(l) pc(p) 4874 4875 The tags interface shows the available tags in a splash window. If 4876 you want to start a new line after a specific tag, insert =\n= into 4877 the tag list 4878 4879 : #+TAGS: @work(w) @home(h) @tennisclub(t) \n laptop(l) pc(p) 4880 4881 #+texinfo: @noindent 4882 or write them in two lines: 4883 4884 #+begin_example 4885 ,#+TAGS: @work(w) @home(h) @tennisclub(t) 4886 ,#+TAGS: laptop(l) pc(p) 4887 #+end_example 4888 4889 You can also group together tags that are mutually exclusive by using 4890 braces, as in: 4891 4892 : #+TAGS: { @work(w) @home(h) @tennisclub(t) } laptop(l) pc(p) 4893 4894 #+texinfo: @noindent 4895 you indicate that at most one of =@work=, =@home=, and =@tennisclub= 4896 should be selected. Multiple such groups are allowed. 4897 4898 Do not forget to press {{{kbd(C-c C-c)}}} with point in one of these 4899 lines to activate any changes. 4900 4901 To set these mutually exclusive groups in the variable 4902 ~org-tags-alist~, you must use the dummy tags ~:startgroup~ and 4903 ~:endgroup~ instead of the braces. Similarly, you can use ~:newline~ 4904 to indicate a line break. The previous example would be set globally 4905 by the following configuration: 4906 4907 #+begin_src emacs-lisp 4908 (setq org-tag-alist '((:startgroup . nil) 4909 ("@work" . ?w) ("@home" . ?h) 4910 ("@tennisclub" . ?t) 4911 (:endgroup . nil) 4912 ("laptop" . ?l) ("pc" . ?p))) 4913 #+end_src 4914 4915 If at least one tag has a selection key then pressing {{{kbd(C-c 4916 C-c)}}} automatically presents you with a special interface, listing 4917 inherited tags, the tags of the current headline, and a list of all 4918 valid tags with corresponding keys[fn:: Keys are automatically 4919 assigned to tags that have no configured keys.]. 4920 4921 Pressing keys assigned to tags adds or removes them from the list of 4922 tags in the current line. Selecting a tag in a group of mutually 4923 exclusive tags turns off any other tag from that group. 4924 4925 In this interface, you can also use the following special keys: 4926 4927 - {{{kbd(TAB)}}} :: 4928 4929 #+kindex: TAB 4930 Enter a tag in the minibuffer, even if the tag is not in the 4931 predefined list. You can complete on all tags present in the buffer 4932 and globally pre-defined tags from ~org-tag-alist~ and 4933 ~org-tag-persistent-alist~. You can also add several tags: just 4934 separate them with a comma. 4935 4936 - {{{kbd(SPC)}}} :: 4937 4938 #+kindex: SPC 4939 Clear all tags for this line. 4940 4941 - {{{kbd(RET)}}} :: 4942 4943 #+kindex: RET 4944 Accept the modified set. 4945 4946 - {{{kbd(C-g)}}} :: 4947 4948 #+kindex: C-g 4949 Abort without installing changes. 4950 4951 - {{{kbd(q)}}} :: 4952 4953 #+kindex: q 4954 If {{{kbd(q)}}} is not assigned to a tag, it aborts like 4955 {{{kbd(C-g)}}}. 4956 4957 - {{{kbd(!)}}} :: 4958 4959 #+kindex: ! 4960 Turn off groups of mutually exclusive tags. Use this to (as an 4961 exception) assign several tags from such a group. 4962 4963 - {{{kbd(C-c)}}} :: 4964 4965 #+kindex: C-c C-c 4966 Toggle auto-exit after the next change (see below). If you are 4967 using expert mode, the first {{{kbd(C-c)}}} displays the selection 4968 window. 4969 4970 This method lets you assign tags to a headline with very few keys. 4971 With the above setup, you could clear the current tags and set 4972 =@home=, =laptop= and =pc= tags with just the following keys: 4973 {{{kbd(C-c C-c SPC h l p RET)}}}. Switching from =@home= to =@work= 4974 would be done with {{{kbd(C-c C-c w RET)}}} or alternatively with 4975 {{{kbd(C-c C-c C-c w)}}}. Adding the non-predefined tag =sarah= could 4976 be done with {{{kbd(C-c C-c TAB s a r a h RET)}}}. 4977 4978 #+vindex: org-fast-tag-selection-single-key 4979 If you find that most of the time you need only a single key press to 4980 modify your list of tags, set the variable 4981 ~org-fast-tag-selection-single-key~. Then you no longer have to press 4982 {{{kbd(RET)}}} to exit fast tag selection---it exits after the first 4983 change. If you then occasionally need more keys, press {{{kbd(C-c)}}} 4984 to turn off auto-exit for the current tag selection process (in 4985 effect: start selection with {{{kbd(C-c C-c C-c)}}} instead of 4986 {{{kbd(C-c C-c)}}}). If you set the variable to the value ~expert~, 4987 the special window is not even shown for single-key tag selection, it 4988 comes up only when you press an extra {{{kbd(C-c)}}}. 4989 4990 ** Tag Hierarchy 4991 :PROPERTIES: 4992 :DESCRIPTION: Create a hierarchy of tags. 4993 :END: 4994 #+cindex: group tags 4995 #+cindex: tags, groups 4996 #+cindex: tags hierarchy 4997 4998 Tags can be defined in hierarchies. A tag can be defined as a /group 4999 tag/ for a set of other tags. The group tag can be seen as the 5000 "broader term" for its set of tags. Defining multiple group tags and 5001 nesting them creates a tag hierarchy. 5002 5003 One use-case is to create a taxonomy of terms (tags) that can be used 5004 to classify nodes in a document or set of documents. 5005 5006 When you search for a group tag, it return matches for all members in 5007 the group and its subgroups. In an agenda view, filtering by a group 5008 tag displays or hide headlines tagged with at least one of the members 5009 of the group or any of its subgroups. This makes tag searches and 5010 filters even more flexible. 5011 5012 You can set group tags by using brackets and inserting a colon between 5013 the group tag and its related tags---beware that all whitespaces are 5014 mandatory so that Org can parse this line correctly: 5015 5016 : #+TAGS: [ GTD : Control Persp ] 5017 5018 In this example, =GTD= is the group tag and it is related to two other 5019 tags: =Control=, =Persp=. Defining =Control= and =Persp= as group 5020 tags creates a hierarchy of tags: 5021 5022 #+begin_example 5023 ,#+TAGS: [ Control : Context Task ] 5024 ,#+TAGS: [ Persp : Vision Goal AOF Project ] 5025 #+end_example 5026 5027 That can conceptually be seen as a hierarchy of tags: 5028 5029 - =GTD= 5030 - =Persp= 5031 - =Vision= 5032 - =Goal= 5033 - =AOF= 5034 - =Project= 5035 - =Control= 5036 - =Context= 5037 - =Task= 5038 5039 You can use the ~:startgrouptag~, ~:grouptags~ and ~:endgrouptag~ 5040 keyword directly when setting ~org-tag-alist~ directly: 5041 5042 #+begin_src emacs-lisp 5043 (setq org-tag-alist '((:startgrouptag) 5044 ("GTD") 5045 (:grouptags) 5046 ("Control") 5047 ("Persp") 5048 (:endgrouptag) 5049 (:startgrouptag) 5050 ("Control") 5051 (:grouptags) 5052 ("Context") 5053 ("Task") 5054 (:endgrouptag))) 5055 #+end_src 5056 5057 The tags in a group can be mutually exclusive if using the same group 5058 syntax as is used for grouping mutually exclusive tags together; using 5059 curly brackets. 5060 5061 : #+TAGS: { Context : @Home @Work @Call } 5062 5063 When setting ~org-tag-alist~ you can use ~:startgroup~ and ~:endgroup~ 5064 instead of ~:startgrouptag~ and ~:endgrouptag~ to make the tags 5065 mutually exclusive. 5066 5067 Furthermore, the members of a group tag can also be regular 5068 expressions, creating the possibility of a more dynamic and rule-based 5069 tag structure (see [[*Regular Expressions]]). The regular expressions in 5070 the group must be specified within curly brackets. Here is an 5071 expanded example: 5072 5073 #+begin_example 5074 ,#+TAGS: [ Vision : {V@.+} ] 5075 ,#+TAGS: [ Goal : {G@.+} ] 5076 ,#+TAGS: [ AOF : {AOF@.+} ] 5077 ,#+TAGS: [ Project : {P@.+} ] 5078 #+end_example 5079 5080 Searching for the tag =Project= now lists all tags also including 5081 regular expression matches for =P@.+=, and similarly for tag searches 5082 on =Vision=, =Goal= and =AOF=. For example, this would work well for 5083 a project tagged with a common project-identifier, e.g., 5084 =P@2014_OrgTags=. 5085 5086 #+kindex: C-c C-x q 5087 #+findex: org-toggle-tags-groups 5088 #+vindex: org-group-tags 5089 If you want to ignore group tags temporarily, toggle group tags 5090 support with ~org-toggle-tags-groups~, bound to {{{kbd(C-c C-x q)}}}. 5091 If you want to disable tag groups completely, set ~org-group-tags~ to 5092 ~nil~. 5093 5094 ** Tag Searches 5095 :PROPERTIES: 5096 :DESCRIPTION: Searching for combinations of tags. 5097 :END: 5098 #+cindex: tag searches 5099 #+cindex: searching for tags 5100 5101 Once a system of tags has been set up, it can be used to collect 5102 related information into special lists. 5103 5104 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} (~org-match-sparse-tree~) :: 5105 5106 #+kindex: C-c / m 5107 #+kindex: C-c \ 5108 #+findex: org-match-sparse-tree 5109 Create a sparse tree with all headlines matching a tags search. 5110 With a {{{kbd(C-u)}}} prefix argument, ignore headlines that are not 5111 a TODO line. 5112 5113 - {{{kbd(M-x org-agenda m)}}} (~org-tags-view~) :: 5114 5115 #+kindex: m @r{(Agenda dispatcher)} 5116 #+findex: org-tags-view 5117 Create a global list of tag matches from all agenda files. See 5118 [[*Matching tags and properties]]. 5119 5120 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) :: 5121 5122 #+kindex: M @r{(Agenda dispatcher)} 5123 #+vindex: org-tags-match-list-sublevels 5124 Create a global list of tag matches from all agenda files, but check 5125 only TODO items and force checking subitems (see the option 5126 ~org-tags-match-list-sublevels~). 5127 5128 These commands all prompt for a match string which allows basic 5129 Boolean logic like =+boss+urgent-project1=, to find entries with tags 5130 =boss= and =urgent=, but not =project1=, or =Kathy|Sally= to find 5131 entries which are tagged, like =Kathy= or =Sally=. The full syntax of 5132 the search string is rich and allows also matching against TODO 5133 keywords, entry levels and properties. For a complete description 5134 with many examples, see [[*Matching tags and properties]]. 5135 5136 * Properties and Columns 5137 :PROPERTIES: 5138 :DESCRIPTION: Storing information about an entry. 5139 :END: 5140 #+cindex: properties 5141 5142 A property is a key-value pair associated with an entry. Properties 5143 can be set so they are associated with a single entry, with every 5144 entry in a tree, or with the whole buffer. 5145 5146 There are two main applications for properties in Org mode. First, 5147 properties are like tags, but with a value. Imagine maintaining 5148 a file where you document bugs and plan releases for a piece of 5149 software. Instead of using tags like =release_1=, =release_2=, you 5150 can use a property, say =Release=, that in different subtrees has 5151 different values, such as =1.0= or =2.0=. Second, you can use 5152 properties to implement (very basic) database capabilities in an Org 5153 buffer. Imagine keeping track of your music CDs, where properties 5154 could be things such as the album, artist, date of release, number of 5155 tracks, and so on. 5156 5157 Properties can be conveniently edited and viewed in column view (see 5158 [[*Column View]]). 5159 5160 ** Property Syntax 5161 :PROPERTIES: 5162 :DESCRIPTION: How properties are spelled out. 5163 :END: 5164 #+cindex: property syntax 5165 #+cindex: drawer, for properties 5166 5167 Properties are key--value pairs. When they are associated with 5168 a single entry or with a tree they need to be inserted into a special 5169 drawer (see [[*Drawers]]) with the name =PROPERTIES=, which has to be 5170 located right below a headline, and its planning line (see [[*Deadlines 5171 and Scheduling]]) when applicable. Each property is specified on 5172 a single line, with the key---surrounded by colons---first, and the 5173 value after it. Keys are case-insensitive. Here is an example: 5174 5175 #+begin_example 5176 ,* CD collection 5177 ,** Classic 5178 ,*** Goldberg Variations 5179 :PROPERTIES: 5180 :Title: Goldberg Variations 5181 :Composer: J.S. Bach 5182 :Artist: Glenn Gould 5183 :Publisher: Deutsche Grammophon 5184 :NDisks: 1 5185 :END: 5186 #+end_example 5187 5188 Depending on the value of ~org-use-property-inheritance~, a property 5189 set this way is associated either with a single entry, or with the 5190 subtree defined by the entry, see [[*Property Inheritance]]. 5191 5192 You may define the allowed values for a particular property =Xyz= by 5193 setting a property =Xyz_ALL=. This special property is /inherited/, 5194 so if you set it in a level 1 entry, it applies to the entire tree. 5195 When allowed values are defined, setting the corresponding property 5196 becomes easier and is less prone to typing errors. For the example 5197 with the CD collection, we can pre-define publishers and the number of 5198 disks in a box like this: 5199 5200 #+begin_example 5201 ,* CD collection 5202 :PROPERTIES: 5203 :NDisks_ALL: 1 2 3 4 5204 :Publisher_ALL: "Deutsche Grammophon" Philips EMI 5205 :END: 5206 #+end_example 5207 5208 Properties can be inserted on buffer level. That means they apply 5209 before the first headline and can be inherited by all entries in a 5210 file. Property blocks defined before first headline needs to be 5211 located at the top of the buffer, allowing only comments above. 5212 5213 Properties can also be defined using lines like: 5214 5215 #+cindex: @samp{_ALL} suffix, in properties 5216 #+cindex: @samp{PROPERTY}, keyword 5217 : #+PROPERTY: NDisks_ALL 1 2 3 4 5218 5219 #+cindex: @samp{+} suffix, in properties 5220 If you want to add to the value of an existing property, append a =+= 5221 to the property name. The following results in the property =var= 5222 having the value =foo=1 bar=2=. 5223 5224 #+begin_example 5225 ,#+PROPERTY: var foo=1 5226 ,#+PROPERTY: var+ bar=2 5227 #+end_example 5228 5229 It is also possible to add to the values of inherited properties. The 5230 following results in the =Genres= property having the value =Classic 5231 Baroque= under the =Goldberg Variations= subtree. 5232 5233 #+begin_example 5234 ,* CD collection 5235 ,** Classic 5236 :PROPERTIES: 5237 :Genres: Classic 5238 :END: 5239 ,*** Goldberg Variations 5240 :PROPERTIES: 5241 :Title: Goldberg Variations 5242 :Composer: J.S. Bach 5243 :Artist: Glenn Gould 5244 :Publisher: Deutsche Grammophon 5245 :NDisks: 1 5246 :Genres+: Baroque 5247 :END: 5248 #+end_example 5249 5250 Note that a property can only have one entry per drawer. 5251 5252 #+vindex: org-global-properties 5253 Property values set with the global variable ~org-global-properties~ 5254 can be inherited by all entries in all Org files. 5255 5256 The following commands help to work with properties: 5257 5258 #+attr_texinfo: :sep , 5259 - {{{kbd(M-TAB)}}} (~pcomplete~) :: 5260 5261 #+kindex: M-TAB 5262 #+findex: pcomplete 5263 After an initial colon in a line, complete property keys. All keys 5264 used in the current file are offered as possible completions. 5265 5266 - {{{kbd(C-c C-x p)}}} (~org-set-property~) :: 5267 5268 #+kindex: C-c C-x p 5269 #+findex: org-set-property 5270 Set a property. This prompts for a property name and a value. If 5271 necessary, the property drawer is created as well. 5272 5273 - {{{kbd(C-u M-x org-insert-drawer)}}} :: 5274 5275 #+findex: org-insert-drawer 5276 Insert a property drawer into the current entry. The drawer is 5277 inserted early in the entry, but after the lines with planning 5278 information like deadlines. If before first headline the drawer is 5279 inserted at the top of the drawer after any potential comments. 5280 5281 - {{{kbd(C-c C-c)}}} (~org-property-action~) :: 5282 5283 #+kindex: C-c C-c 5284 #+findex: org-property-action 5285 With point in a property drawer, this executes property commands. 5286 5287 - {{{kbd(C-c C-c s)}}} (~org-set-property~) :: 5288 5289 #+kindex: C-c C-c s 5290 #+findex: org-set-property 5291 Set a property in the current entry. Both the property and the 5292 value can be inserted using completion. 5293 5294 - {{{kbd(S-RIGHT)}}} (~org-property-next-allowed-values~), {{{kbd(S-LEFT)}}} (~org-property-previous-allowed-value~) :: 5295 5296 #+kindex: S-RIGHT 5297 #+kindex: S-LEFT 5298 Switch property at point to the next/previous allowed value. 5299 5300 - {{{kbd(C-c C-c d)}}} (~org-delete-property~) :: 5301 5302 #+kindex: C-c C-c d 5303 #+findex: org-delete-property 5304 Remove a property from the current entry. 5305 5306 - {{{kbd(C-c C-c D)}}} (~org-delete-property-globally~) :: 5307 5308 #+kindex: C-c C-c D 5309 #+findex: org-delete-property-globally 5310 Globally remove a property, from all entries in the current file. 5311 5312 - {{{kbd(C-c C-c c)}}} (~org-compute-property-at-point~) :: 5313 5314 #+kindex: C-c C-c c 5315 #+findex: org-compute-property-at-point 5316 Compute the property at point, using the operator and scope from the 5317 nearest column format definition. 5318 5319 ** Special Properties 5320 :PROPERTIES: 5321 :DESCRIPTION: Access to other Org mode features. 5322 :END: 5323 #+cindex: properties, special 5324 5325 Special properties provide an alternative access method to Org mode 5326 features, like the TODO state or the priority of an entry, discussed 5327 in the previous chapters. This interface exists so that you can 5328 include these states in a column view (see [[*Column View]]), or to use 5329 them in queries. The following property names are special and should 5330 not be used as keys in the properties drawer: 5331 5332 #+cindex: @samp{ALLTAGS}, special property 5333 #+cindex: @samp{BLOCKED}, special property 5334 #+cindex: @samp{CLOCKSUM}, special property 5335 #+cindex: @samp{CLOCKSUM_T}, special property 5336 #+cindex: @samp{CLOSED}, special property 5337 #+cindex: @samp{DEADLINE}, special property 5338 #+cindex: @samp{FILE}, special property 5339 #+cindex: @samp{ITEM}, special property 5340 #+cindex: @samp{PRIORITY}, special property 5341 #+cindex: @samp{SCHEDULED}, special property 5342 #+cindex: @samp{TAGS}, special property 5343 #+cindex: @samp{TIMESTAMP}, special property 5344 #+cindex: @samp{TIMESTAMP_IA}, special property 5345 #+cindex: @samp{TODO}, special property 5346 | =ALLTAGS= | All tags, including inherited ones. | 5347 | =BLOCKED= | ~t~ if task is currently blocked by children or siblings. | 5348 | =CATEGORY= | The category of an entry. | 5349 | =CLOCKSUM= | The sum of CLOCK intervals in the subtree. ~org-clock-sum~ | 5350 | | must be run first to compute the values in the current buffer. | 5351 | =CLOCKSUM_T= | The sum of CLOCK intervals in the subtree for today. | 5352 | | ~org-clock-sum-today~ must be run first to compute the | 5353 | | values in the current buffer. | 5354 | =CLOSED= | When was this entry closed? | 5355 | =DEADLINE= | The deadline timestamp. | 5356 | =FILE= | The filename the entry is located in. | 5357 | =ITEM= | The headline of the entry. | 5358 | =PRIORITY= | The priority of the entry, a string with a single letter. | 5359 | =SCHEDULED= | The scheduling timestamp. | 5360 | =TAGS= | The tags defined directly in the headline. | 5361 | =TIMESTAMP= | The first keyword-less timestamp in the entry. | 5362 | =TIMESTAMP_IA= | The first inactive timestamp in the entry. | 5363 | =TODO= | The TODO keyword of the entry. | 5364 5365 ** Property Searches 5366 :PROPERTIES: 5367 :DESCRIPTION: Matching property values. 5368 :END: 5369 #+cindex: properties, searching 5370 #+cindex: searching, of properties 5371 5372 To create sparse trees and special lists with selection based on 5373 properties, the same commands are used as for tag searches (see [[*Tag 5374 Searches]]). 5375 5376 - {{{kbd(C-c / m)}}} or {{{kbd(C-c \)}}} (~org-match-sparse-tree~) :: 5377 5378 #+kindex: C-c / m 5379 #+kindex: C-c \ 5380 #+findex: org-match-sparse-tree 5381 Create a sparse tree with all matching entries. With 5382 a {{{kbd(C-u)}}} prefix argument, ignore headlines that are not 5383 a TODO line. 5384 5385 - {{{kbd(M-x org-agenda m)}}} (~org-tags-view~) :: 5386 5387 #+kindex: m @r{(Agenda dispatcher)} 5388 #+findex: org-tags-view 5389 Create a global list of tag/property matches from all agenda files. 5390 5391 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) :: 5392 5393 #+kindex: M @r{(Agenda dispatcher)} 5394 #+vindex: org-tags-match-list-sublevels 5395 Create a global list of tag matches from all agenda files, but check 5396 only TODO items and force checking of subitems (see the option 5397 ~org-tags-match-list-sublevels~). 5398 5399 The syntax for the search string is described in [[*Matching tags and 5400 properties]]. 5401 5402 There is also a special command for creating sparse trees based on a 5403 single property: 5404 5405 - {{{kbd(C-c / p)}}} :: 5406 5407 #+kindex: C-c / p 5408 Create a sparse tree based on the value of a property. This first 5409 prompts for the name of a property, and then for a value. A sparse 5410 tree is created with all entries that define this property with the 5411 given value. If you enclose the value in curly braces, it is 5412 interpreted as a regular expression and matched against the property 5413 values (see [[*Regular Expressions]]). 5414 5415 ** Property Inheritance 5416 :PROPERTIES: 5417 :DESCRIPTION: Passing values down a tree. 5418 :END: 5419 #+cindex: properties, inheritance 5420 #+cindex: inheritance, of properties 5421 5422 #+vindex: org-use-property-inheritance 5423 The outline structure of Org documents lends itself to an inheritance 5424 model of properties: if the parent in a tree has a certain property, 5425 the children can inherit this property. Org mode does not turn this 5426 on by default, because it can slow down property searches 5427 significantly and is often not needed. However, if you find 5428 inheritance useful, you can turn it on by setting the variable 5429 ~org-use-property-inheritance~. It may be set to ~t~ to make all 5430 properties inherited from the parent, to a list of properties that 5431 should be inherited, or to a regular expression that matches inherited 5432 properties. If a property has the value ~nil~, this is interpreted as 5433 an explicit un-define of the property, so that inheritance search 5434 stops at this value and returns ~nil~. 5435 5436 Org mode has a few properties for which inheritance is hard-coded, at 5437 least for the special applications for which they are used: 5438 5439 - ~COLUMNS~ :: 5440 5441 #+cindex: @samp{COLUMNS}, property 5442 The =COLUMNS= property defines the format of column view (see 5443 [[*Column View]]). It is inherited in the sense that the level where 5444 a =COLUMNS= property is defined is used as the starting point for 5445 a column view table, independently of the location in the subtree 5446 from where columns view is turned on. 5447 5448 - ~CATEGORY~ :: 5449 5450 #+cindex: @samp{CATEGORY}, property 5451 For agenda view, a category set through a =CATEGORY= property 5452 applies to the entire subtree. 5453 5454 - ~ARCHIVE~ :: 5455 5456 #+cindex: @samp{ARCHIVE}, property 5457 For archiving, the =ARCHIVE= property may define the archive 5458 location for the entire subtree (see [[*Moving a tree to an archive 5459 file]]). 5460 5461 - ~LOGGING~ :: 5462 5463 #+cindex: @samp{LOGGING}, property 5464 The =LOGGING= property may define logging settings for an entry or 5465 a subtree (see [[*Tracking TODO state changes]]). 5466 5467 ** Column View 5468 :PROPERTIES: 5469 :DESCRIPTION: Tabular viewing and editing. 5470 :END: 5471 5472 A great way to view and edit properties in an outline tree is /column 5473 view/. In column view, each outline node is turned into a table row. 5474 Columns in this table provide access to properties of the entries. 5475 Org mode implements columns by overlaying a tabular structure over the 5476 headline of each item. While the headlines have been turned into 5477 a table row, you can still change the visibility of the outline tree. 5478 For example, you get a compact table by switching to "contents" 5479 view---{{{kbd(S-TAB)}}} {{{kbd(S-TAB)}}}, or simply {{{kbd(c)}}} 5480 while column view is active---but you can still open, read, and edit 5481 the entry below each headline. Or, you can switch to column view 5482 after executing a sparse tree command and in this way get a table only 5483 for the selected items. Column view also works in agenda buffers (see 5484 [[*Agenda Views]]) where queries have collected selected items, possibly 5485 from a number of files. 5486 5487 *** Defining columns 5488 :PROPERTIES: 5489 :DESCRIPTION: The COLUMNS format property. 5490 :END: 5491 #+cindex: column view, for properties 5492 #+cindex: properties, column view 5493 5494 Setting up a column view first requires defining the columns. This is 5495 done by defining a column format line. 5496 5497 **** Scope of column definitions 5498 :PROPERTIES: 5499 :DESCRIPTION: Where defined, where valid? 5500 :END: 5501 5502 To specify a format that only applies to a specific tree, add 5503 a =COLUMNS= property to the top node of that tree, for example: 5504 5505 #+begin_example 5506 ,** Top node for columns view 5507 :PROPERTIES: 5508 :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO 5509 :END: 5510 #+end_example 5511 5512 A =COLUMNS= property within a property drawer before first headline 5513 will apply to the entire file. As an addition to property drawers, 5514 keywords can also be defined for an entire file using a line like: 5515 5516 #+cindex: @samp{COLUMNS}, keyword 5517 : #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO 5518 5519 If a =COLUMNS= property is present in an entry, it defines columns for 5520 the entry itself, and for the entire subtree below it. Since the 5521 column definition is part of the hierarchical structure of the 5522 document, you can define columns on level 1 that are general enough 5523 for all sublevels, and more specific columns further down, when you 5524 edit a deeper part of the tree. 5525 5526 **** Column attributes 5527 :PROPERTIES: 5528 :DESCRIPTION: Appearance and content of a column. 5529 :END: 5530 5531 A column definition sets the attributes of a column. The general 5532 definition looks like this: 5533 5534 : %[WIDTH]PROPERTY[(TITLE)][{SUMMARY-TYPE}] 5535 5536 #+texinfo: @noindent 5537 Except for the percent sign and the property name, all items are 5538 optional. The individual parts have the following meaning: 5539 5540 - {{{var(WIDTH)}}} :: 5541 5542 An integer specifying the width of the column in characters. If 5543 omitted, the width is determined automatically. 5544 5545 - {{{var(PROPERTY)}}} :: 5546 5547 The property that should be edited in this column. Special 5548 properties representing meta data are allowed here as well (see 5549 [[*Special Properties]]). 5550 5551 - {{{var(TITLE)}}} :: 5552 5553 The header text for the column. If omitted, the property name is 5554 used. 5555 5556 - {{{var(SUMMARY-TYPE)}}} :: 5557 5558 The summary type. If specified, the column values for parent nodes 5559 are computed from the children[fn:: If more than one summary type 5560 applies to the same property, the parent values are computed 5561 according to the first of them.]. 5562 5563 Supported summary types are: 5564 5565 | =+= | Sum numbers in this column. | 5566 | =+;%.1f= | Like =+=, but format result with =%.1f=. | 5567 | =$= | Currency, short for =+;%.2f=. | 5568 | =min= | Smallest number in column. | 5569 | =max= | Largest number. | 5570 | =mean= | Arithmetic mean of numbers. | 5571 | =X= | Checkbox status, =[X]= if all children are =[X]=. | 5572 | =X/= | Checkbox status, =[n/m]=. | 5573 | =X%= | Checkbox status, =[n%]=. | 5574 | =:= | Sum times, HH:MM, plain numbers are minutes. | 5575 | =:min= | Smallest time value in column. | 5576 | =:max= | Largest time value. | 5577 | =:mean= | Arithmetic mean of time values. | 5578 | =@min= | Minimum age[fn:18] (in days/hours/mins/seconds). | 5579 | =@max= | Maximum age (in days/hours/mins/seconds). | 5580 | =@mean= | Arithmetic mean of ages (in days/hours/mins/seconds). | 5581 | =est+= | Add low-high estimates. | 5582 5583 #+vindex: org-columns-summary-types 5584 You can also define custom summary types by setting 5585 ~org-columns-summary-types~. 5586 5587 The =est+= summary type requires further explanation. It is used for 5588 combining estimates, expressed as low-high ranges. For example, 5589 instead of estimating a particular task will take 5 days, you might 5590 estimate it as 5--6 days if you're fairly confident you know how much 5591 work is required, or 1--10 days if you do not really know what needs 5592 to be done. Both ranges average at 5.5 days, but the first represents 5593 a more predictable delivery. 5594 5595 When combining a set of such estimates, simply adding the lows and 5596 highs produces an unrealistically wide result. Instead, =est+= adds 5597 the statistical mean and variance of the subtasks, generating a final 5598 estimate from the sum. For example, suppose you had ten tasks, each 5599 of which was estimated at 0.5 to 2 days of work. Straight addition 5600 produces an estimate of 5 to 20 days, representing what to expect if 5601 everything goes either extremely well or extremely poorly. In 5602 contrast, =est+= estimates the full job more realistically, at 10--15 5603 days. 5604 5605 Here is an example for a complete columns definition, along with 5606 allowed values[fn:: Please note that the =COLUMNS= definition must be 5607 on a single line; it is wrapped here only because of formatting 5608 constraints.]. 5609 5610 #+begin_example 5611 :COLUMNS: %25ITEM %9Approved(Approved?){X} %Owner %11Status \ 5612 %10Time_Estimate{:} %CLOCKSUM %CLOCKSUM_T 5613 :Owner_ALL: Tammy Mark Karl Lisa Don 5614 :Status_ALL: "In progress" "Not started yet" "Finished" "" 5615 :Approved_ALL: "[ ]" "[X]" 5616 #+end_example 5617 5618 #+texinfo: @noindent 5619 The first column, =%25ITEM=, means the first 25 characters of the item 5620 itself, i.e., of the headline. You probably always should start the 5621 column definition with the =ITEM= specifier. The other specifiers 5622 create columns =Owner= with a list of names as allowed values, for 5623 =Status= with four different possible values, and for a checkbox field 5624 =Approved=. When no width is given after the =%= character, the 5625 column is exactly as wide as it needs to be in order to fully display 5626 all values. The =Approved= column does have a modified title 5627 (=Approved?=, with a question mark). Summaries are created for the 5628 =Time_Estimate= column by adding time duration expressions like HH:MM, 5629 and for the =Approved= column, by providing an =[X]= status if all 5630 children have been checked. The =CLOCKSUM= and =CLOCKSUM_T= columns 5631 are special, they lists the sums of CLOCK intervals in the subtree, 5632 either for all clocks or just for today. 5633 5634 *** Using column view 5635 :PROPERTIES: 5636 :DESCRIPTION: How to create and use column view. 5637 :END: 5638 5639 **** Turning column view on or off 5640 :PROPERTIES: 5641 :UNNUMBERED: notoc 5642 :END: 5643 5644 - {{{kbd(C-c C-x C-c)}}} (~org-columns~) :: 5645 5646 #+kindex: C-c C-x C-c 5647 #+vindex: org-columns 5648 #+vindex: org-columns-default-format 5649 Turn on column view. If point is before the first headline in the 5650 file, column view is turned on for the entire file, using the 5651 =#+COLUMNS= definition. If point is somewhere inside the outline, 5652 this command searches the hierarchy, up from point, for a =COLUMNS= 5653 property that defines a format. When one is found, the column view 5654 table is established for the tree starting at the entry that 5655 contains the =COLUMNS= property. If no such property is found, the 5656 format is taken from the =#+COLUMNS= line or from the variable 5657 ~org-columns-default-format~, and column view is established for the 5658 current entry and its subtree. 5659 5660 - {{{kbd(r)}}} or {{{kbd(g)}}} on a columns view line (~org-columns-redo~) :: 5661 5662 #+kindex: r 5663 #+kindex: g 5664 #+findex: org-columns-redo 5665 Recreate the column view, to include recent changes made in the 5666 buffer. 5667 5668 - {{{kbd(C-c C-c)}}} or {{{kbd(q)}}} on a columns view line (~org-columns-quit~) :: 5669 5670 #+kindex: q 5671 #+kindex: C-c C-c 5672 #+findex: org-columns-quit 5673 Exit column view. 5674 5675 **** Editing values 5676 :PROPERTIES: 5677 :UNNUMBERED: notoc 5678 :END: 5679 5680 #+attr_texinfo: :sep and 5681 - {{{kbd(LEFT)}}}, {{{kbd(RIGHT)}}}, {{{kbd(UP)}}}, {{{kbd(DOWN)}}} :: 5682 5683 Move through the column view from field to field. 5684 5685 - {{{kbd(1..9\,0)}}} :: 5686 5687 #+kindex: 1..9,0 5688 Directly select the Nth allowed value, {{{kbd(0)}}} selects the 5689 10th value. 5690 5691 - {{{kbd(n)}}} or {{{kbd(S-RIGHT)}}} (~org-columns-next-allowed-value~) and {{{kbd(p)}}} or {{{kbd(S-LEFT)}}} (~org-columns-previous-allowed-value~) :: 5692 5693 #+kindex: n 5694 #+kindex: S-RIGHT 5695 #+kindex: p 5696 #+kindex: S-LEFT 5697 #+findex: org-columns-next-allowed-value 5698 #+findex: org-columns-previous-allowed-value 5699 Switch to the next/previous allowed value of the field. For this, 5700 you have to have specified allowed values for a property. 5701 5702 - {{{kbd(e)}}} (~org-columns-edit-value~) :: 5703 5704 #+kindex: e 5705 #+findex: org-columns-edit-value 5706 Edit the property at point. For the special properties, this 5707 invokes the same interface that you normally use to change that 5708 property. For example, the tag completion or fast selection 5709 interface pops up when editing a =TAGS= property. 5710 5711 - {{{kbd(C-c C-c)}}} (~org-columns-toggle-or-columns-quit~) :: 5712 5713 #+kindex: C-c C-c 5714 #+findex: org-columns-toggle-or-columns-quit 5715 When there is a checkbox at point, toggle it. Else exit column 5716 view. 5717 5718 - {{{kbd(v)}}} (~org-columns-show-value~) :: 5719 5720 #+kindex: v 5721 #+findex: org-columns-show-value 5722 View the full value of this property. This is useful if the width 5723 of the column is smaller than that of the value. 5724 5725 - {{{kbd(a)}}} (~org-columns-edit-allowed~) :: 5726 5727 #+kindex: a 5728 #+findex: org-columns-edit-allowed 5729 Edit the list of allowed values for this property. If the list is 5730 found in the hierarchy, the modified values is stored there. If no 5731 list is found, the new value is stored in the first entry that is 5732 part of the current column view. 5733 5734 **** Modifying column view on-the-fly 5735 :PROPERTIES: 5736 :UNNUMBERED: notoc 5737 :END: 5738 5739 #+attr_texinfo: :sep and 5740 - {{{kbd(<)}}} (~org-columns-narrow~) and {{{kbd(>)}}} (~org-columns-widen~) :: 5741 5742 #+kindex: < 5743 #+kindex: > 5744 #+findex: org-columns-narrow 5745 #+findex: org-columns-widen 5746 Make the column narrower/wider by one character. 5747 5748 - {{{kbd(S-M-RIGHT)}}} (~org-columns-new~) :: 5749 5750 #+kindex: S-M-RIGHT 5751 #+findex: org-columns-new 5752 Insert a new column, to the left of the current column. 5753 5754 - {{{kbd(S-M-LEFT)}}} (~org-columns-delete~) :: 5755 5756 #+kindex: S-M-LEFT 5757 #+findex: org-columns-delete 5758 Delete the current column. 5759 5760 *** Capturing column view 5761 :PROPERTIES: 5762 :DESCRIPTION: A dynamic block for column view. 5763 :END: 5764 5765 Since column view is just an overlay over a buffer, it cannot be 5766 exported or printed directly. If you want to capture a column view, 5767 use a =columnview= dynamic block (see [[*Dynamic Blocks]]). The frame of 5768 this block looks like this: 5769 5770 #+cindex: @samp{BEGIN columnview} 5771 #+begin_example 5772 ,* The column view 5773 ,#+BEGIN: columnview :hlines 1 :id "label" 5774 5775 ,#+END: 5776 #+end_example 5777 5778 This dynamic block has the following parameters: 5779 5780 - =:id= :: 5781 5782 This is the most important parameter. Column view is a feature that 5783 is often localized to a certain (sub)tree, and the capture block 5784 might be at a different location in the file. To identify the tree 5785 whose view to capture, you can use four values: 5786 5787 - =local= :: 5788 5789 Use the tree in which the capture block is located. 5790 5791 - =global= :: 5792 5793 Make a global view, including all headings in the file. 5794 5795 - =file:FILENAME= :: 5796 5797 Run column view at the top of the {{{var(FILENAME)}}} file. 5798 5799 - =LABEL= :: 5800 5801 #+cindex: @samp{ID}, property 5802 Call column view in the tree that has an =ID= property with the 5803 value {{{var(LABEL)}}}. You can use {{{kbd(M-x org-id-copy)}}} to 5804 create a globally unique ID for the current entry and copy it to 5805 the kill-ring. 5806 5807 - =:match= :: 5808 5809 When set to a string, use this as a tags/property match filter to 5810 select only a subset of the headlines in the scope set by the ~:id~ 5811 parameter. 5812 5813 5814 - =:hlines= :: 5815 5816 When ~t~, insert an hline after every line. When a number N, insert 5817 an hline before each headline with level ~<= N~. 5818 5819 - =:vlines= :: 5820 5821 When non-~nil~, force column groups to get vertical lines. 5822 5823 - =:maxlevel= :: 5824 5825 When set to a number, do not capture entries below this level. 5826 5827 - =:skip-empty-rows= :: 5828 5829 When non-~nil~, skip rows where the only non-empty specifier of 5830 the column view is =ITEM=. 5831 5832 - =:exclude-tags= :: 5833 5834 List of tags to exclude from column view table: entries with these 5835 tags will be excluded from the column view. 5836 5837 - =:indent= :: 5838 5839 When non-~nil~, indent each =ITEM= field according to its level. 5840 5841 - =:format= :: 5842 5843 Specify a column attribute (see [[*Column attributes]]) for the dynamic 5844 block. 5845 5846 The following commands insert or update the dynamic block: 5847 5848 - ~org-columns-insert-dblock~ :: 5849 5850 #+kindex: C-c C-x x 5851 #+findex: org-columns-insert-dblock 5852 Insert a dynamic block capturing a column view. Prompt for the 5853 scope or ID of the view. 5854 5855 This command can be invoked by calling 5856 ~org-dynamic-block-insert-dblock~ ({{{kbd(C-c C-x x)}}}) and 5857 selecting "columnview" (see [[*Dynamic Blocks]]). 5858 5859 - {{{kbd(C-c C-c)}}} {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) :: 5860 5861 #+kindex: C-c C-c 5862 #+kindex: C-c C-x C-u 5863 #+findex: org-dblock-update 5864 Update dynamic block at point. point needs to be in the =#+BEGIN= 5865 line of the dynamic block. 5866 5867 - {{{kbd(C-u C-c C-x C-u)}}} (~org-update-all-dblocks~) :: 5868 5869 #+kindex: C-u C-c C-x C-u 5870 Update all dynamic blocks (see [[*Dynamic Blocks]]). This is useful if 5871 you have several clock table blocks, column-capturing blocks or 5872 other dynamic blocks in a buffer. 5873 5874 You can add formulas to the column view table and you may add plotting 5875 instructions in front of the table---these survive an update of the 5876 block. If there is a =TBLFM= keyword after the table, the table is 5877 recalculated automatically after an update. 5878 5879 An alternative way to capture and process property values into a table 5880 is provided by Eric Schulte's =org-collector.el=, which is a package 5881 in =org-contrib=[fn:: Contributed packages are not part of Emacs, but 5882 are distributed with the main distribution of Org---visit 5883 [[https://orgmode.org]].]. It provides a general API to collect 5884 properties from entries in a certain scope, and arbitrary Lisp 5885 expressions to process these values before inserting them into a table 5886 or a dynamic block. 5887 5888 * Dates and Times 5889 :PROPERTIES: 5890 :DESCRIPTION: Making items useful for planning. 5891 :END: 5892 #+cindex: dates 5893 #+cindex: times 5894 #+cindex: timestamp 5895 #+cindex: date stamp 5896 5897 To assist project planning, TODO items can be labeled with a date 5898 and/or a time. The specially formatted string carrying the date and 5899 time information is called a /timestamp/ in Org mode. This may be 5900 a little confusing because timestamp is often used as indicating when 5901 something was created or last changed. However, in Org mode this term 5902 is used in a much wider sense. 5903 5904 ** Timestamps 5905 :PROPERTIES: 5906 :DESCRIPTION: Assigning a time to a tree entry. 5907 :END: 5908 #+cindex: timestamps 5909 #+cindex: ranges, time 5910 #+cindex: date stamps 5911 #+cindex: deadlines 5912 #+cindex: scheduling 5913 5914 A timestamp is a specification of a date (possibly with a time or 5915 a range of times) in a special format, either =<2003-09-16 Tue>= or 5916 =<2003-09-16 Tue 09:39>= or =<2003-09-16 Tue 12:00-12:30>=[fn:19]. 5917 A timestamp can appear anywhere in the headline or body of an Org tree 5918 entry. Its presence causes entries to be shown on specific dates in 5919 the agenda (see [[*Weekly/daily agenda]]). We distinguish: 5920 5921 - Plain timestamp; Event; Appointment :: 5922 5923 #+cindex: timestamp 5924 #+cindex: appointment 5925 A simple timestamp just assigns a date/time to an item. This is 5926 just like writing down an appointment or event in a paper agenda. 5927 In the agenda display, the headline of an entry associated with 5928 a plain timestamp is shown exactly on that date. 5929 5930 #+begin_example 5931 ,* Meet Peter at the movies 5932 <2006-11-01 Wed 19:15> 5933 ,* Discussion on climate change 5934 <2006-11-02 Thu 20:00-22:00> 5935 #+end_example 5936 5937 - Timestamp with repeater interval :: 5938 5939 #+cindex: timestamp, with repeater interval 5940 A timestamp may contain a /repeater interval/, indicating that it 5941 applies not only on the given date, but again and again after 5942 a certain interval of N hours (h), days (d), weeks (w), months (m), 5943 or years (y). The following shows up in the agenda every Wednesday: 5944 5945 #+begin_example 5946 ,* Pick up Sam at school 5947 <2007-05-16 Wed 12:30 +1w> 5948 #+end_example 5949 5950 - Diary-style expression entries :: 5951 5952 #+cindex: diary style timestamps 5953 #+cindex: sexp timestamps 5954 # Mentioned inside the footnote. 5955 #+findex: org-date 5956 #+findex: org-anniversary 5957 #+findex: org-cyclic 5958 #+findex: org-block 5959 5960 For more complex date specifications, Org mode supports using the 5961 special expression diary entries implemented in the Emacs Calendar 5962 package[fn:20]. For example, with optional time: 5963 5964 #+begin_example 5965 ,* 22:00-23:00 The nerd meeting on every 2nd Thursday of the month 5966 <%%(diary-float t 4 2)> 5967 #+end_example 5968 5969 - Time/Date range :: 5970 5971 #+cindex: timerange 5972 #+cindex: date range 5973 Two timestamps connected by =--= denote a range. The headline is 5974 shown on the first and last day of the range, and on any dates that 5975 are displayed and fall in the range. Here is an example: 5976 5977 #+begin_example 5978 ,** Meeting in Amsterdam 5979 <2004-08-23 Mon>--<2004-08-26 Thu> 5980 #+end_example 5981 5982 - Inactive timestamp :: 5983 5984 #+cindex: timestamp, inactive 5985 #+cindex: inactive timestamp 5986 Just like a plain timestamp, but with square brackets instead of 5987 angular ones. These timestamps are inactive in the sense that they 5988 do /not/ trigger an entry to show up in the agenda. 5989 5990 #+begin_example 5991 ,* Gillian comes late for the fifth time 5992 [2006-11-01 Wed] 5993 #+end_example 5994 5995 ** Creating Timestamps 5996 :PROPERTIES: 5997 :DESCRIPTION: Commands to insert timestamps. 5998 :END: 5999 6000 For Org mode to recognize timestamps, they need to be in the specific 6001 format. All commands listed below produce timestamps in the correct 6002 format. 6003 6004 #+attr_texinfo: :sep , 6005 - {{{kbd(C-c .)}}} (~org-time-stamp~) :: 6006 6007 #+kindex: C-c . 6008 #+findex: org-time-stamp 6009 Prompt for a date and insert a corresponding timestamp. When point 6010 is at an existing timestamp in the buffer, the command is used to 6011 modify this timestamp instead of inserting a new one. When this 6012 command is used twice in succession, a time range is inserted. 6013 6014 #+kindex: C-u C-c . 6015 #+vindex: org-time-stamp-rounding-minutes 6016 When called with a prefix argument, use the alternative format which 6017 contains date and time. The default time can be rounded to 6018 multiples of 5 minutes. See the option 6019 ~org-time-stamp-rounding-minutes~. 6020 6021 #+kindex: C-u C-u C-c . 6022 With two prefix arguments, insert an active timestamp with the 6023 current time without prompting. 6024 6025 - {{{kbd(C-c !)}}} (~org-time-stamp-inactive~) :: 6026 6027 #+kindex: C-c ! 6028 #+kindex: C-u C-c ! 6029 #+kindex: C-u C-u C-c ! 6030 #+findex: org-time-stamp-inactive 6031 Like {{{kbd(C-c .)}}}, but insert an inactive timestamp that does 6032 not cause an agenda entry. 6033 6034 - {{{kbd(C-c C-c)}}} :: 6035 6036 #+kindex: C-c C-c 6037 Normalize timestamp, insert or fix day name if missing or wrong. 6038 6039 - {{{kbd(C-c <)}}} (~org-date-from-calendar~) :: 6040 6041 #+kindex: C-c < 6042 #+findex: org-date-from-calendar 6043 Insert a timestamp corresponding to point date in the calendar. 6044 6045 - {{{kbd(C-c >)}}} (~org-goto-calendar~) :: 6046 6047 #+kindex: C-c > 6048 #+findex: org-goto-calendar 6049 Access the Emacs calendar for the current date. If there is 6050 a timestamp in the current line, go to the corresponding date 6051 instead. 6052 6053 - {{{kbd(C-c C-o)}}} (~org-open-at-point~) :: 6054 6055 #+kindex: C-c C-o 6056 #+findex: org-open-at-point 6057 Access the agenda for the date given by the timestamp or -range at 6058 point (see [[*Weekly/daily agenda]]). 6059 6060 - {{{kbd(S-LEFT)}}} (~org-timestamp-down-day~), {{{kbd(S-RIGHT)}}} (~org-timestamp-up-day~) :: 6061 6062 #+kindex: S-LEFT 6063 #+kindex: S-RIGHT 6064 #+findex: org-timestamp-down-day 6065 #+findex: org-timestamp-up-day 6066 Change date at point by one day. These key bindings conflict with 6067 shift-selection and related modes (see [[*Packages that conflict with 6068 Org mode]]). 6069 6070 - {{{kbd(S-UP)}}} (~org-timestamp-up~), {{{kbd(S-DOWN)}}} (~org-timestamp-down~) :: 6071 6072 #+kindex: S-UP 6073 #+kindex: S-DOWN 6074 On the beginning or enclosing bracket of a timestamp, change its 6075 type. Within a timestamp, change the item under point. Point can 6076 be on a year, month, day, hour or minute. When the timestamp 6077 contains a time range like =15:30-16:30=, modifying the first time 6078 also shifts the second, shifting the time block with constant 6079 length. To change the length, modify the second time. Note that if 6080 point is in a headline and not at a timestamp, these same keys 6081 modify the priority of an item (see [[*Priorities]]). The key bindings 6082 also conflict with shift-selection and related modes (see [[*Packages 6083 that conflict with Org mode]]). 6084 6085 - {{{kbd(C-c C-y)}}} (~org-evaluate-time-range~) :: 6086 6087 #+kindex: C-c C-y 6088 #+findex: org-evaluate-time-range 6089 #+cindex: evaluate time range 6090 Evaluate a time range by computing the difference between start and 6091 end. With a prefix argument, insert result after the time range (in 6092 a table: into the following column). 6093 6094 *** The date/time prompt 6095 :PROPERTIES: 6096 :DESCRIPTION: How Org mode helps you enter dates and times. 6097 :END: 6098 #+cindex: date, reading in minibuffer 6099 #+cindex: time, reading in minibuffer 6100 6101 #+vindex: org-read-date-prefer-future 6102 When Org mode prompts for a date/time, the default is shown in default 6103 date/time format, and the prompt therefore seems to ask for a specific 6104 format. But it in fact accepts date/time information in a variety of 6105 formats. Generally, the information should start at the beginning of 6106 the string. Org mode finds whatever information is in there and 6107 derives anything you have not specified from the /default date and 6108 time/. The default is usually the current date and time, but when 6109 modifying an existing timestamp, or when entering the second stamp of 6110 a range, it is taken from the stamp in the buffer. When filling in 6111 information, Org mode assumes that most of the time you want to enter 6112 a date in the future: if you omit the month/year and the given 6113 day/month is /before/ today, it assumes that you mean a future 6114 date[fn:21]. If the date has been automatically shifted into the 6115 future, the time prompt shows this with =(=>F)=. 6116 6117 For example, let's assume that today is *June 13, 2006*. Here is how 6118 various inputs are interpreted, the items filled in by Org mode are in 6119 *bold*. 6120 6121 | =3-2-5= | \rArr{} 2003-02-05 | 6122 | =2/5/3= | \rArr{} 2003-02-05 | 6123 | =14= | \rArr{} *2006*-*06*-14 | 6124 | =12= | \rArr{} *2006*-*07*-12 | 6125 | =2/5= | \rArr{} *2007*-02-05 | 6126 | =Fri= | \rArr{} nearest Friday (default date or later) | 6127 | =sep 15= | \rArr{} *2006*-09-15 | 6128 | =feb 15= | \rArr{} *2007*-02-15 | 6129 | =sep 12 9= | \rArr{} 2009-09-12 | 6130 | =12:45= | \rArr{} *2006*-*06*-*13* 12:45 | 6131 | =22 sept 0:34= | \rArr{} *2006*-09-22 0:34 | 6132 | =w4= | \rArr{} ISO week for of the current year *2006* | 6133 | =2012 w4 fri= | \rArr{} Friday of ISO week 4 in 2012 | 6134 | =2012-w04-5= | \rArr{} Same as above | 6135 6136 Furthermore you can specify a relative date by giving, as the /first/ 6137 thing in the input: a plus/minus sign, a number and a letter---=h=, 6138 =d=, =w=, =m= or =y=---to indicate a change in hours, days, weeks, 6139 months, or years. With =h= the date is relative to the current time, 6140 with the other letters and a single plus or minus, the date is 6141 relative to today at 00:00. With a double plus or minus, it is 6142 relative to the default date. If instead of a single letter, you use 6143 the abbreviation of day name, the date is the Nth such day, e.g.: 6144 6145 | =+0= | \rArr{} today | 6146 | =.= | \rArr{} today | 6147 | =+2h= | \rArr{} two hours from now | 6148 | =+4d= | \rArr{} four days from today | 6149 | =+4= | \rArr{} same as +4d | 6150 | =+2w= | \rArr{} two weeks from today | 6151 | =++5= | \rArr{} five days from default date | 6152 | =+2tue= | \rArr{} second Tuesday from now | 6153 6154 #+vindex: parse-time-months 6155 #+vindex: parse-time-weekdays 6156 The function understands English month and weekday abbreviations. If 6157 you want to use un-abbreviated names and/or other languages, configure 6158 the variables ~parse-time-months~ and ~parse-time-weekdays~. 6159 6160 #+vindex: org-read-date-force-compatible-dates 6161 Not all dates can be represented in a given Emacs implementation. By 6162 default Org mode forces dates into the compatibility range 1970--2037 6163 which works on all Emacs implementations. If you want to use dates 6164 outside of this range, read the docstring of the variable 6165 ~org-read-date-force-compatible-dates~. 6166 6167 You can specify a time range by giving start and end times or by 6168 giving a start time and a duration (in HH:MM format). Use one or two 6169 dash(es) as the separator in the former case and use =+= as the 6170 separator in the latter case, e.g.: 6171 6172 | =11am-1:15pm= | \rArr{} 11:00-13:15 | 6173 | =11h-13h15= | \rArr{} same as above | 6174 | =11am--1:15pm= | \rArr{} same as above | 6175 | =11am+2:15= | \rArr{} same as above | 6176 6177 #+cindex: calendar, for selecting date 6178 #+vindex: org-popup-calendar-for-date-prompt 6179 Parallel to the minibuffer prompt, a calendar is popped up[fn:: If you 6180 do not need/want the calendar, configure the variable 6181 ~org-popup-calendar-for-date-prompt~.]. When you exit the date 6182 prompt, either by clicking on a date in the calendar, or by pressing 6183 {{{kbd(RET)}}}, the date selected in the calendar is combined with the 6184 information entered at the prompt. You can control the calendar fully 6185 from the minibuffer: 6186 6187 #+kindex: < 6188 #+kindex: > 6189 #+kindex: M-v 6190 #+kindex: C-v 6191 #+kindex: mouse-1 6192 #+kindex: S-RIGHT 6193 #+kindex: S-LEFT 6194 #+kindex: S-DOWN 6195 #+kindex: S-UP 6196 #+kindex: M-S-RIGHT 6197 #+kindex: M-S-LEFT 6198 #+kindex: RET 6199 #+kindex: . 6200 #+kindex: C-. 6201 #+attr_texinfo: :columns 0.25 0.55 6202 | {{{kbd(RET)}}} | Choose date at point in calendar. | 6203 | {{{kbd(mouse-1)}}} | Select date by clicking on it. | 6204 | {{{kbd(S-RIGHT)}}} | One day forward. | 6205 | {{{kbd(S-LEFT)}}} | One day backward. | 6206 | {{{kbd(S-DOWN)}}} | One week forward. | 6207 | {{{kbd(S-UP)}}} | One week backward. | 6208 | {{{kbd(M-S-RIGHT)}}} | One month forward. | 6209 | {{{kbd(M-S-LEFT)}}} | One month backward. | 6210 | {{{kbd(>)}}} | Scroll calendar forward by one month. | 6211 | {{{kbd(<)}}} | Scroll calendar backward by one month. | 6212 | {{{kbd(M-v)}}} | Scroll calendar forward by 3 months. | 6213 | {{{kbd(C-v)}}} | Scroll calendar backward by 3 months. | 6214 | {{{kbd(C-.)}}} | Select today's date[fn:22] | 6215 6216 #+vindex: org-read-date-display-live 6217 The actions of the date/time prompt may seem complex, but I assure you 6218 they will grow on you, and you will start getting annoyed by pretty 6219 much any other way of entering a date/time out there. To help you 6220 understand what is going on, the current interpretation of your input 6221 is displayed live in the minibuffer[fn:: If you find this distracting, 6222 turn off the display with ~org-read-date-display-live~.]. 6223 6224 *** Custom time format 6225 :PROPERTIES: 6226 :DESCRIPTION: Making dates look different. 6227 :END: 6228 #+cindex: custom date/time format 6229 #+cindex: time format, custom 6230 #+cindex: date format, custom 6231 6232 #+vindex: org-display-custom-times 6233 #+vindex: org-time-stamp-custom-formats 6234 Org mode uses the standard ISO notation for dates and times as it is 6235 defined in ISO 8601. If you cannot get used to this and require 6236 another representation of date and time to keep you happy, you can get 6237 it by customizing the variables ~org-display-custom-times~ and 6238 ~org-time-stamp-custom-formats~. 6239 6240 - {{{kbd(C-c C-x C-t)}}} (~org-toggle-time-stamp-overlays~) :: 6241 6242 #+kindex: C-c C-x C-t 6243 #+findex: org-toggle-time-stamp-overlays 6244 Toggle the display of custom formats for dates and times. 6245 6246 Org mode needs the default format for scanning, so the custom 6247 date/time format does not /replace/ the default format. Instead, it 6248 is put /over/ the default format using text properties. This has the 6249 following consequences: 6250 6251 - You cannot place point onto a timestamp anymore, only before or 6252 after. 6253 6254 - The {{{kbd(S-UP)}}} and {{{kbd(S-DOWN)}}} keys can no longer be used 6255 to adjust each component of a timestamp. If point is at the 6256 beginning of the stamp, {{{kbd(S-UP)}}} and {{{kbd(S-DOWN)}}} change 6257 the stamp by one day, just like {{{kbd(S-LEFT)}}} 6258 {{{kbd(S-RIGHT)}}}. At the end of the stamp, change the time by one 6259 minute. 6260 6261 - If the timestamp contains a range of clock times or a repeater, 6262 these are not overlaid, but remain in the buffer as they were. 6263 6264 - When you delete a timestamp character-by-character, it only 6265 disappears from the buffer after /all/ (invisible) characters 6266 belonging to the ISO timestamp have been removed. 6267 6268 - If the custom timestamp format is longer than the default and you 6269 are using dates in tables, table alignment will be messed up. If 6270 the custom format is shorter, things do work as expected. 6271 6272 ** Deadlines and Scheduling 6273 :PROPERTIES: 6274 :DESCRIPTION: Planning your work. 6275 :END: 6276 6277 A timestamp may be preceded by special keywords to facilitate 6278 planning. Both the timestamp and the keyword have to be positioned 6279 immediately after the task they refer to. 6280 6281 - =DEADLINE= :: 6282 6283 #+cindex: @samp{DEADLINE} marker 6284 Meaning: the task---most likely a TODO item, though not 6285 necessarily---is supposed to be finished on that date. 6286 6287 #+vindex: org-deadline-warning-days 6288 On the deadline date, the task is listed in the agenda. In 6289 addition, the agenda for /today/ carries a warning about the 6290 approaching or missed deadline, starting ~org-deadline-warning-days~ 6291 before the due date, and continuing until the entry is marked as 6292 done. An example: 6293 6294 #+begin_example 6295 ,*** TODO write article about the Earth for the Guide 6296 DEADLINE: <2004-02-29 Sun> 6297 The editor in charge is [[bbdb:Ford Prefect]] 6298 #+end_example 6299 6300 #+vindex: org-agenda-skip-deadline-prewarning-if-scheduled 6301 You can specify a different lead time for warnings for a specific 6302 deadlines using the following syntax. Here is an example with 6303 a warning period of 5 days =DEADLINE: <2004-02-29 Sun -5d>=. This 6304 warning is deactivated if the task gets scheduled and you set 6305 ~org-agenda-skip-deadline-prewarning-if-scheduled~ to ~t~. 6306 6307 - =SCHEDULED= :: 6308 6309 #+cindex: @samp{SCHEDULED} marker 6310 Meaning: you are planning to start working on that task on the given 6311 date. 6312 6313 #+vindex: org-agenda-skip-scheduled-if-done 6314 The headline is listed under the given date[fn:23]. In addition, 6315 a reminder that the scheduled date has passed is present in the 6316 compilation for /today/, until the entry is marked as done, i.e., 6317 the task is automatically forwarded until completed. 6318 6319 #+begin_example 6320 ,*** TODO Call Trillian for a date on New Years Eve. 6321 SCHEDULED: <2004-12-25 Sat> 6322 #+end_example 6323 6324 #+vindex: org-scheduled-delay-days 6325 #+vindex: org-agenda-skip-scheduled-delay-if-deadline 6326 If you want to /delay/ the display of this task in the agenda, use 6327 =SCHEDULED: <2004-12-25 Sat -2d>=: the task is still scheduled on 6328 the 25th but will appear two days later. In case the task contains 6329 a repeater, the delay is considered to affect all occurrences; if 6330 you want the delay to only affect the first scheduled occurrence of 6331 the task, use =--2d= instead. See ~org-scheduled-delay-days~ and 6332 ~org-agenda-skip-scheduled-delay-if-deadline~ for details on how to 6333 control this globally or per agenda. 6334 6335 #+attr_texinfo: :tag Important 6336 #+begin_quote 6337 Scheduling an item in Org mode should /not/ be understood in the 6338 same way that we understand /scheduling a meeting/. Setting a date 6339 for a meeting is just a simple appointment, you should mark this 6340 entry with a simple plain timestamp, to get this item shown on the 6341 date where it applies. This is a frequent misunderstanding by Org 6342 users. In Org mode, /scheduling/ means setting a date when you want 6343 to start working on an action item. 6344 #+end_quote 6345 6346 You may use timestamps with repeaters in scheduling and deadline 6347 entries. Org mode issues early and late warnings based on the 6348 assumption that the timestamp represents the /nearest instance/ of the 6349 repeater. However, the use of diary expression entries like 6350 6351 : <%%(diary-float t 42)> 6352 6353 #+texinfo: @noindent 6354 in scheduling and deadline timestamps is limited. Org mode does not 6355 know enough about the internals of each function to issue early and 6356 late warnings. However, it shows the item on each day where the 6357 expression entry matches. 6358 6359 *** Inserting deadlines or schedules 6360 :PROPERTIES: 6361 :DESCRIPTION: Planning items. 6362 :ALT_TITLE: Inserting deadline/schedule 6363 :END: 6364 6365 The following commands allow you to quickly insert a deadline or to 6366 schedule an item:[fn:24] 6367 6368 - {{{kbd(C-c C-d)}}} (~org-deadline~) :: 6369 6370 #+kindex: C-c C-d 6371 #+findex: org-deadline 6372 #+vindex: org-log-redeadline 6373 Insert =DEADLINE= keyword along with a stamp. The insertion happens 6374 in the line directly following the headline. Remove any =CLOSED= 6375 timestamp . When called with a prefix argument, also remove any 6376 existing deadline from the entry. Depending on the variable 6377 ~org-log-redeadline~, take a note when changing an existing 6378 deadline[fn:: Note the corresponding =STARTUP= options 6379 =logredeadline=, =lognoteredeadline=, and =nologredeadline=.]. 6380 6381 - {{{kbd(C-c C-s)}}} (~org-schedule~) :: 6382 6383 #+kindex: C-c C-s 6384 #+findex: org-schedule 6385 #+vindex: org-log-reschedule 6386 Insert =SCHEDULED= keyword along with a stamp. The insertion 6387 happens in the line directly following the headline. Remove any 6388 =CLOSED= timestamp. When called with a prefix argument, also remove 6389 the scheduling date from the entry. Depending on the variable 6390 ~org-log-reschedule~, take a note when changing an existing 6391 scheduling time[fn:: Note the corresponding =STARTUP= options 6392 =logreschedule=, =lognotereschedule=, and =nologreschedule=.]. 6393 6394 - {{{kbd(C-c / d)}}} (~org-check-deadlines~) :: 6395 6396 #+kindex: C-c / d 6397 #+findex: org-check-deadlines 6398 #+cindex: sparse tree, for deadlines 6399 #+vindex: org-deadline-warning-days 6400 Create a sparse tree with all deadlines that are either past-due, or 6401 which will become due within ~org-deadline-warning-days~. With 6402 {{{kbd(C-u)}}} prefix, show all deadlines in the file. With 6403 a numeric prefix, check that many days. For example, {{{kbd(C-1 C-c 6404 / d)}}} shows all deadlines due tomorrow. 6405 6406 - {{{kbd(C-c / b)}}} (~org-check-before-date~) :: 6407 6408 #+kindex: C-c / b 6409 #+findex: org-check-before-date 6410 Sparse tree for deadlines and scheduled items before a given date. 6411 6412 - {{{kbd(C-c / a)}}} (~org-check-after-date~) :: 6413 6414 #+kindex: C-c / a 6415 #+findex: org-check-after-date 6416 Sparse tree for deadlines and scheduled items after a given date. 6417 6418 Note that ~org-schedule~ and ~org-deadline~ supports setting the date 6419 by indicating a relative time e.g., =+1d= sets the date to the next 6420 day after today, and =--1w= sets the date to the previous week before 6421 any current timestamp. 6422 6423 *** Repeated tasks 6424 :PROPERTIES: 6425 :DESCRIPTION: Items that show up again and again. 6426 :END: 6427 #+cindex: tasks, repeated 6428 #+cindex: repeated tasks 6429 6430 Some tasks need to be repeated again and again. Org mode helps to 6431 organize such tasks using a so-called repeater in a =DEADLINE=, 6432 =SCHEDULED=, or plain timestamps[fn:25]. In the following example: 6433 6434 #+begin_example 6435 ,** TODO Pay the rent 6436 DEADLINE: <2005-10-01 Sat +1m> 6437 #+end_example 6438 6439 #+texinfo: @noindent 6440 the =+1m= is a repeater; the intended interpretation is that the task 6441 has a deadline on =<2005-10-01>= and repeats itself every (one) month 6442 starting from that time. You can use yearly, monthly, weekly, daily 6443 and hourly repeat cookies by using the =y=, =m=, =w=, =d= and =h= 6444 letters. If you need both a repeater and a special warning period in 6445 a deadline entry, the repeater should come first and the warning 6446 period last 6447 6448 : DEADLINE: <2005-10-01 Sat +1m -3d> 6449 6450 #+vindex: org-todo-repeat-to-state 6451 Deadlines and scheduled items produce entries in the agenda when they 6452 are over-due, so it is important to be able to mark such an entry as 6453 done once you have done so. When you mark a =DEADLINE= or a 6454 =SCHEDULED= with the TODO keyword =DONE=, it no longer produces 6455 entries in the agenda. The problem with this is, however, is that 6456 then also the /next/ instance of the repeated entry will not be 6457 active. Org mode deals with this in the following way: when you try 6458 to mark such an entry as done, using {{{kbd(C-c C-t)}}}, it shifts the 6459 base date of the repeating timestamp by the repeater interval, and 6460 immediately sets the entry state back to TODO[fn:: In fact, the target 6461 state is taken from, in this sequence, the =REPEAT_TO_STATE= property, 6462 the variable ~org-todo-repeat-to-state~ if it is a string, the 6463 previous TODO state if ~org-todo-repeat-to-state~ is ~t~, or the first 6464 state of the TODO state sequence.]. In the example above, setting the 6465 state to =DONE= would actually switch the date like this: 6466 6467 #+begin_example 6468 ,** TODO Pay the rent 6469 DEADLINE: <2005-11-01 Tue +1m> 6470 #+end_example 6471 6472 To mark a task with a repeater as DONE, use {{{kbd(C-- 1 C-c C-t)}}}, 6473 i.e., ~org-todo~ with a numeric prefix argument of =-1=. 6474 6475 #+vindex: org-log-repeat 6476 A timestamp[fn:26] is added under the deadline, to keep a record that 6477 you actually acted on the previous instance of this deadline. 6478 6479 As a consequence of shifting the base date, this entry is no longer 6480 visible in the agenda when checking past dates, but all future 6481 instances will be visible. 6482 6483 With the =+1m= cookie, the date shift is always exactly one month. So 6484 if you have not paid the rent for three months, marking this entry 6485 DONE still keeps it as an overdue deadline. Depending on the task, 6486 this may not be the best way to handle it. For example, if you forgot 6487 to call your father for 3 weeks, it does not make sense to call him 6488 3 times in a single day to make up for it. Finally, there are tasks, 6489 like changing batteries, which should always repeat a certain time 6490 /after/ the last time you did it. For these tasks, Org mode has 6491 special repeaters =++= and =.+=. For example: 6492 6493 #+begin_example 6494 ,** TODO Call Father 6495 DEADLINE: <2008-02-10 Sun ++1w> 6496 Marking this DONE shifts the date by at least one week, but also 6497 by as many weeks as it takes to get this date into the future. 6498 However, it stays on a Sunday, even if you called and marked it 6499 done on Saturday. 6500 6501 ,** TODO Empty kitchen trash 6502 DEADLINE: <2008-02-08 Fri 20:00 ++1d> 6503 Marking this DONE shifts the date by at least one day, and also 6504 by as many days as it takes to get the timestamp into the future. 6505 Since there is a time in the timestamp, the next deadline in the 6506 future will be on today's date if you complete the task before 6507 20:00. 6508 6509 ,** TODO Check the batteries in the smoke detectors 6510 DEADLINE: <2005-11-01 Tue .+1m> 6511 Marking this DONE shifts the date to one month after today. 6512 6513 ,** TODO Wash my hands 6514 DEADLINE: <2019-04-05 08:00 Fri .+1h> 6515 Marking this DONE shifts the date to exactly one hour from now. 6516 #+end_example 6517 6518 #+vindex: org-agenda-skip-scheduled-if-deadline-is-shown 6519 You may have both scheduling and deadline information for a specific 6520 task. If the repeater is set for the scheduling information only, you 6521 probably want the repeater to be ignored after the deadline. If so, 6522 set the variable ~org-agenda-skip-scheduled-if-deadline-is-shown~ to 6523 ~repeated-after-deadline~. However, any scheduling information 6524 without a repeater is no longer relevant once the task is done, and 6525 thus, removed upon repeating the task. If you want both scheduling 6526 and deadline information to repeat after the same interval, set the 6527 same repeater for both timestamps. 6528 6529 An alternative to using a repeater is to create a number of copies of 6530 a task subtree, with dates shifted in each copy. The command 6531 {{{kbd(C-c C-x c)}}} was created for this purpose; it is described in 6532 [[*Structure Editing]]. 6533 6534 ** Clocking Work Time 6535 :PROPERTIES: 6536 :DESCRIPTION: Tracking how long you spend on a task. 6537 :END: 6538 #+cindex: clocking time 6539 #+cindex: time clocking 6540 6541 Org mode allows you to clock the time you spend on specific tasks in 6542 a project. When you start working on an item, you can start the 6543 clock. When you stop working on that task, or when you mark the task 6544 done, the clock is stopped and the corresponding time interval is 6545 recorded. It also computes the total time spent on each 6546 subtree[fn:27] of a project. And it remembers a history or tasks 6547 recently clocked, so that you can jump quickly between a number of 6548 tasks absorbing your time. 6549 6550 To save the clock history across Emacs sessions, use: 6551 6552 #+begin_src emacs-lisp 6553 (setq org-clock-persist 'history) 6554 (org-clock-persistence-insinuate) 6555 #+end_src 6556 6557 #+vindex: org-clock-persist 6558 When you clock into a new task after resuming Emacs, the incomplete 6559 clock[fn:: To resume the clock under the assumption that you have 6560 worked on this task while outside Emacs, use =(setq org-clock-persist 6561 t)=.] is retrieved (see [[*Resolving idle time]]) and you are prompted 6562 about what to do with it. 6563 6564 *** Clocking commands 6565 :PROPERTIES: 6566 :DESCRIPTION: Starting and stopping a clock. 6567 :END: 6568 6569 #+attr_texinfo: :sep , 6570 - {{{kbd(C-c C-x C-i)}}} (~org-clock-in~) :: 6571 6572 #+kindex: C-c C-x C-i 6573 #+findex: org-clock-in 6574 #+vindex: org-clock-into-drawer 6575 #+vindex: org-clock-continuously 6576 #+cindex: @samp{LOG_INTO_DRAWER}, property 6577 Start the clock on the current item (clock-in). This inserts the 6578 =CLOCK= keyword together with a timestamp. If this is not the first 6579 clocking of this item, the multiple =CLOCK= lines are wrapped into 6580 a =LOGBOOK= drawer (see also the variable ~org-clock-into-drawer~). 6581 You can also overrule the setting of this variable for a subtree by 6582 setting a =CLOCK_INTO_DRAWER= or =LOG_INTO_DRAWER= property. When 6583 called with a {{{kbd(C-u)}}} prefix argument, select the task from 6584 a list of recently clocked tasks. With two {{{kbd(C-u C-u)}}} 6585 prefixes, clock into the task at point and mark it as the default 6586 task; the default task is always be available with letter 6587 {{{kbd(d)}}} when selecting a clocking task. With three {{{kbd(C-u 6588 C-u C-u)}}} prefixes, force continuous clocking by starting the 6589 clock when the last clock stopped. 6590 6591 #+cindex: @samp{CLOCK_MODELINE_TOTAL}, property 6592 #+cindex: @samp{LAST_REPEAT}, property 6593 #+vindex: org-clock-mode-line-total 6594 #+vindex: org-clock-in-prepare-hook 6595 While the clock is running, Org shows the current clocking time in 6596 the mode line, along with the title of the task. The clock time 6597 shown is all time ever clocked for this task and its children. If 6598 the task has an effort estimate (see [[*Effort Estimates]]), the 6599 mode line displays the current clocking time against it[fn:: To add 6600 an effort estimate "on the fly", hook a function doing this to 6601 ~org-clock-in-prepare-hook~.]. If the task is a repeating one (see 6602 [[*Repeated tasks]]), show only the time since the last reset of the 6603 task[fn:: The last reset of the task is recorded by the 6604 =LAST_REPEAT= property.]. You can exercise more control over show 6605 time with the =CLOCK_MODELINE_TOTAL= property. It may have the 6606 values =current= to show only the current clocking instance, =today= 6607 to show all time clocked on this tasks today---see also the variable 6608 ~org-extend-today-until~, ~all~ to include all time, or ~auto~ which 6609 is the default[fn:: See also the variable 6610 ~org-clock-mode-line-total~.]. Clicking with {{{kbd(mouse-1)}}} 6611 onto the mode line entry pops up a menu with clocking options. 6612 6613 - {{{kbd(C-c C-x C-o)}}} (~org-clock-out~) :: 6614 6615 #+kindex: C-c C-x C-o 6616 #+findex: org-clock-out 6617 #+vindex: org-log-note-clock-out 6618 Stop the clock (clock-out). This inserts another timestamp at the 6619 same location where the clock was last started. It also directly 6620 computes the resulting time in inserts it after the time range as 6621 ==>HH:MM=. See the variable ~org-log-note-clock-out~ for the 6622 possibility to record an additional note together with the clock-out 6623 timestamp[fn:: The corresponding in-buffer setting is: =#+STARTUP: 6624 lognoteclock-out=.]. 6625 6626 - {{{kbd(C-c C-x C-x)}}} (~org-clock-in-last~) :: 6627 6628 #+kindex: C-c C-x C-x 6629 #+findex: org-clock-in-last 6630 #+vindex: org-clock-continuously 6631 Re-clock the last clocked task. With one {{{kbd(C-u)}}} prefix 6632 argument, select the task from the clock history. With two 6633 {{{kbd(C-u)}}} prefixes, force continuous clocking by starting the 6634 clock when the last clock stopped. 6635 6636 - {{{kbd(C-c C-x C-e)}}} (~org-clock-modify-effort-estimate~) :: 6637 6638 #+kindex: C-c C-x C-e 6639 #+findex: org-clock-modify-effort-estimate 6640 Update the effort estimate for the current clock task. 6641 6642 - {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-y)}}} (~org-evaluate-time-range~) :: 6643 6644 #+kindex: C-c C-c 6645 #+kindex: C-c C-y 6646 #+findex: org-evaluate-time-range 6647 Recompute the time interval after changing one of the timestamps. 6648 This is only necessary if you edit the timestamps directly. If you 6649 change them with {{{kbd(S-<cursor>)}}} keys, the update is 6650 automatic. 6651 6652 - {{{kbd(C-S-UP)}}} (~org-clock-timestamps-up~), {{{kbd(C-S-DOWN)}}} (~org-clock-timestamps-down~) :: 6653 6654 #+kindex: C-S-UP 6655 #+findex: org-clock-timestamps-up 6656 #+kindex: C-S-DOWN 6657 #+findex: org-clock-timestamps-down 6658 On CLOCK log lines, increase/decrease both timestamps so that the 6659 clock duration keeps the same value. 6660 6661 - {{{kbd(S-M-UP)}}} (~org-timestamp-up~), {{{kbd(S-M-DOWN)}}} (~org-timestamp-down~) :: 6662 6663 #+kindex: S-M-UP 6664 #+findex: org-clock-timestamp-up 6665 #+kindex: S-M-DOWN 6666 #+findex: org-clock-timestamp-down 6667 On =CLOCK= log lines, increase/decrease the timestamp at point and 6668 the one of the previous, or the next, clock timestamp by the same 6669 duration. For example, if you hit {{{kbd(S-M-UP)}}} to increase 6670 a clocked-out timestamp by five minutes, then the clocked-in 6671 timestamp of the next clock is increased by five minutes. 6672 6673 - {{{kbd(C-c C-t)}}} (~org-todo~) :: 6674 6675 #+kindex: C-c C-t 6676 #+findex: org-todo 6677 Changing the TODO state of an item to DONE automatically stops the 6678 clock if it is running in this same item. 6679 6680 - {{{kbd(C-c C-x C-q)}}} (~org-clock-cancel~) :: 6681 6682 #+kindex: C-c C-x C-q 6683 #+findex: org-clock-cancel 6684 Cancel the current clock. This is useful if a clock was started by 6685 mistake, or if you ended up working on something else. 6686 6687 - {{{kbd(C-c C-x C-j)}}} (~org-clock-goto~) :: 6688 6689 #+kindex: C-c C-x C-j 6690 #+findex: or-clock-goto 6691 Jump to the headline of the currently clocked in task. With 6692 a {{{kbd(C-u)}}} prefix argument, select the target task from a list 6693 of recently clocked tasks. 6694 6695 - {{{kbd(C-c C-x C-d)}}} (~org-clock-display~) :: 6696 6697 #+kindex: C-c C-x C-d 6698 #+findex: org-clock-display 6699 #+vindex: org-remove-highlights-with-change 6700 Display time summaries for each subtree in the current buffer. This 6701 puts overlays at the end of each headline, showing the total time 6702 recorded under that heading, including the time of any subheadings. 6703 You can use visibility cycling to study the tree, but the overlays 6704 disappear when you change the buffer (see variable 6705 ~org-remove-highlights-with-change~) or press {{{kbd(C-c C-c)}}}. 6706 6707 The {{{kbd(l)}}} key may be used in the agenda (see [[*Weekly/daily 6708 agenda]]) to show which tasks have been worked on or closed during 6709 a day. 6710 6711 *Important:* note that both ~org-clock-out~ and ~org-clock-in-last~ 6712 can have a global keybinding and do not modify the window disposition. 6713 6714 *** The clock table 6715 :PROPERTIES: 6716 :DESCRIPTION: Detailed reports. 6717 :END: 6718 #+cindex: clocktable, dynamic block 6719 #+cindex: report, of clocked time 6720 6721 Org mode can produce quite complex reports based on the time clocking 6722 information. Such a report is called a /clock table/, because it is 6723 formatted as one or several Org tables. 6724 6725 #+attr_texinfo: :sep , 6726 - ~org-clock-report~ :: 6727 6728 #+kindex: C-c C-x x 6729 #+findex: org-clock-report 6730 Insert or update a clock table. When called with a prefix argument, 6731 jump to the first clock table in the current document and update it. 6732 The clock table includes archived trees. 6733 6734 This command can be invoked by calling 6735 ~org-dynamic-block-insert-dblock~ ({{{kbd(C-c C-x x)}}}) and 6736 selecting "clocktable" (see [[*Dynamic Blocks]]). 6737 6738 - {{{kbd(C-c C-c)}}} or {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) :: 6739 6740 #+kindex: C-c C-c 6741 #+kindex: C-c C-x C-u 6742 #+findex: org-dblock-update 6743 Update dynamic block at point. Point needs to be in the =BEGIN= 6744 line of the dynamic block. 6745 6746 - {{{kbd(C-u C-c C-x C-u)}}} :: 6747 6748 #+kindex: C-u C-c C-x C-u 6749 Update all dynamic blocks (see [[*Dynamic Blocks]]). This is useful if 6750 you have several clock table blocks in a buffer. 6751 6752 - {{{kbd(S-LEFT)}}}, {{{kbd(S-RIGHT)}}} (~org-clocktable-try-shift~) :: 6753 6754 #+kindex: S-LEFT 6755 #+kindex: S-RIGHT 6756 #+findex: org-clocktable-try-shift 6757 Shift the current =:block= interval and update the table. Point 6758 needs to be in the =#+BEGIN: clocktable= line for this command. If 6759 =:block= is =today=, it is shifted to =today-1=, etc. 6760 6761 Here is an example of the frame for a clock table as it is inserted 6762 into the buffer by ~org-clock-report~: 6763 6764 #+cindex: @samp{BEGIN clocktable} 6765 #+begin_example 6766 ,#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file 6767 ,#+END: 6768 #+end_example 6769 6770 #+vindex: org-clocktable-defaults 6771 The =#+BEGIN= line contains options to define the scope, structure, 6772 and formatting of the report. Defaults for all these options can be 6773 configured in the variable ~org-clocktable-defaults~. 6774 6775 First there are options that determine which clock entries are to 6776 be selected: 6777 6778 - =:maxlevel= :: 6779 6780 Maximum level depth to which times are listed in the table. Clocks 6781 at deeper levels are summed into the upper level. 6782 6783 - =:scope= :: 6784 6785 The scope to consider. This can be any of the following: 6786 6787 | =nil= | the current buffer or narrowed region | 6788 | =file= | the full current buffer | 6789 | =subtree= | the subtree where the clocktable is located | 6790 | =treeN= | the surrounding level N tree, for example =tree3= | 6791 | =tree= | the surrounding level 1 tree | 6792 | =agenda= | all agenda files | 6793 | =("file" ...)= | scan these files | 6794 | =FUNCTION= | scan files returned by calling {{{var(FUNCTION)}}} with no argument | 6795 | =file-with-archives= | current file and its archives | 6796 | =agenda-with-archives= | all agenda files, including archives | 6797 6798 - =:block= :: 6799 6800 The time block to consider. This block is specified either 6801 absolutely, or relative to the current time and may be any of these 6802 formats: 6803 6804 | =2007-12-31= | New year eve 2007 | 6805 | =2007-12= | December 2007 | 6806 | =2007-W50= | ISO-week 50 in 2007 | 6807 | =2007-Q2= | 2nd quarter in 2007 | 6808 | =2007= | the year 2007 | 6809 | =today=, =yesterday=, =today-N= | a relative day | 6810 | =thisweek=, =lastweek=, =thisweek-N= | a relative week | 6811 | =thismonth=, =lastmonth=, =thismonth-N= | a relative month | 6812 | =thisyear=, =lastyear=, =thisyear-N= | a relative year | 6813 | =untilnow=[fn:: When using ~:step~, ~untilnow~ starts from the beginning of 2003, not the beginning of time.] | all clocked time ever | 6814 6815 #+vindex: org-clock-display-default-range 6816 When this option is not set, Org falls back to the value in 6817 ~org-clock-display-default-range~, which defaults to the current 6818 year. 6819 6820 Use {{{kbd(S-LEFT)}}} or {{{kbd(S-RIGHT)}}} to shift the time 6821 interval. 6822 6823 - =:tstart= :: 6824 6825 A time string specifying when to start considering times. Relative 6826 times like ="<-2w>"= can also be used. See [[*Matching tags and 6827 properties]] for relative time syntax. 6828 6829 - =:tend= :: 6830 6831 A time string specifying when to stop considering times. Relative 6832 times like ="<now>"= can also be used. See [[*Matching tags and 6833 properties]] for relative time syntax. 6834 6835 - =:wstart= :: 6836 6837 The starting day of the week. The default is 1 for Monday. 6838 6839 - =:mstart= :: 6840 6841 The starting day of the month. The default is 1 for the first. 6842 6843 - =:step= :: 6844 6845 Set to =day=, =week=, =semimonth=, =month=, =quarter=, or =year= to split the 6846 table into chunks. To use this, either =:block=, or =:tstart= and 6847 =:tend= are required. 6848 6849 - =:stepskip0= :: 6850 6851 When non-~nil~, do not show steps that have zero time. 6852 6853 - =:fileskip0= :: 6854 6855 When non-~nil~, do not show table sections from files which did not 6856 contribute. 6857 6858 - =:match= :: 6859 6860 A tags match to select entries that should contribute. See 6861 [[*Matching tags and properties]] for the match syntax. 6862 6863 #+findex: org-clocktable-write-default 6864 Then there are options that determine the formatting of the table. 6865 There options are interpreted by the function 6866 ~org-clocktable-write-default~, but you can specify your own function 6867 using the =:formatter= parameter. 6868 6869 - =:emphasize= :: 6870 6871 When non-~nil~, emphasize level one and level two items. 6872 6873 - =:lang= :: 6874 6875 Language[fn:: Language terms can be set through the variable 6876 ~org-clock-clocktable-language-setup~.] to use for descriptive cells 6877 like "Task". 6878 6879 - =:link= :: 6880 6881 Link the item headlines in the table to their origins. 6882 6883 - =:narrow= :: 6884 6885 An integer to limit the width of the headline column in the Org 6886 table. If you write it like =50!=, then the headline is also 6887 shortened in export. 6888 6889 - =:indent= :: 6890 6891 Indent each headline field according to its level. 6892 6893 - =:filetitle= :: 6894 6895 Show title in the file column if the file has a =#+title=. 6896 6897 - =:hidefiles= :: 6898 6899 Hide the file column when multiple files are used to produce the 6900 table. 6901 6902 - =:tcolumns= :: 6903 6904 Number of columns to be used for times. If this is smaller than 6905 =:maxlevel=, lower levels are lumped into one column. 6906 6907 - =:level= :: 6908 6909 Should a level number column be included? 6910 6911 - =:sort= :: 6912 6913 A cons cell containing the column to sort and a sorting type. E.g., 6914 =:sort (1 . ?a)= sorts the first column alphabetically. 6915 6916 - =:compact= :: 6917 6918 Abbreviation for =:level nil :indent t :narrow 40! :tcolumns 1=. 6919 All are overwritten except if there is an explicit =:narrow=. 6920 6921 - =:timestamp= :: 6922 6923 A timestamp for the entry, when available. Look for =SCHEDULED=, 6924 =DEADLINE=, =TIMESTAMP= and =TIMESTAMP_IA= special properties (see 6925 [[*Special Properties]]), in this order. 6926 6927 - =:tags= :: 6928 6929 When this flag is non-~nil~, show the headline's tags. 6930 6931 - =:properties= :: 6932 6933 List of properties shown in the table. Each property gets its own 6934 column. 6935 6936 - =:inherit-props= :: 6937 6938 When this flag is non-~nil~, the values for =:properties= are 6939 inherited. 6940 6941 - =:formula= :: 6942 6943 Content of a =TBLFM= keyword to be added and evaluated. As 6944 a special case, =:formula %= adds a column with % time. If you do 6945 not specify a formula here, any existing formula below the clock 6946 table survives updates and is evaluated. 6947 6948 - =:formatter= :: 6949 6950 A function to format clock data and insert it into the buffer. 6951 6952 To get a clock summary of the current level 1 tree, for the current 6953 day, you could write: 6954 6955 #+begin_example 6956 ,#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t 6957 ,#+END: 6958 #+end_example 6959 6960 #+texinfo: @noindent 6961 To use a specific time range you could write[fn:: Note that all 6962 parameters must be specified in a single line---the line is broken 6963 here only to fit it into the manual.] 6964 6965 #+begin_example 6966 ,#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>" 6967 :tend "<2006-08-10 Thu 12:00>" 6968 ,#+END: 6969 #+end_example 6970 6971 #+texinfo: @noindent 6972 A range starting a week ago and ending right now could be written as 6973 6974 #+begin_example 6975 ,#+BEGIN: clocktable :tstart "<-1w>" :tend "<now>" 6976 ,#+END: 6977 #+end_example 6978 6979 #+texinfo: @noindent 6980 A summary of the current subtree with % times would be 6981 6982 #+begin_example 6983 ,#+BEGIN: clocktable :scope subtree :link t :formula % 6984 ,#+END: 6985 #+end_example 6986 6987 #+texinfo: @noindent 6988 A horizontally compact representation of everything clocked during 6989 last week would be 6990 6991 #+begin_example 6992 ,#+BEGIN: clocktable :scope agenda :block lastweek :compact t 6993 ,#+END: 6994 #+end_example 6995 6996 *** Resolving idle time and continuous clocking 6997 :PROPERTIES: 6998 :DESCRIPTION: Resolving time when you've been idle. 6999 :ALT_TITLE: Resolving idle time 7000 :END: 7001 7002 **** Resolving idle time 7003 :PROPERTIES: 7004 :UNNUMBERED: notoc 7005 :END: 7006 7007 #+cindex: resolve idle time 7008 #+cindex: idle, resolve, dangling 7009 7010 If you clock in on a work item, and then walk away from your 7011 computer---perhaps to take a phone call---you often need to 7012 "resolve" the time you were away by either subtracting it from the 7013 current clock, or applying it to another one. 7014 7015 #+vindex: org-clock-idle-time 7016 #+vindex: org-clock-x11idle-program-name 7017 By customizing the variable ~org-clock-idle-time~ to some integer, 7018 such as 10 or 15, Emacs can alert you when you get back to your 7019 computer after being idle for that many minutes[fn:28], and ask what 7020 you want to do with the idle time. There will be a question waiting 7021 for you when you get back, indicating how much idle time has passed 7022 constantly updated with the current amount, as well as a set of 7023 choices to correct the discrepancy: 7024 7025 - {{{kbd(k)}}} :: 7026 7027 #+kindex: k 7028 To keep some or all of the minutes and stay clocked in, press 7029 {{{kbd(k)}}}. Org asks how many of the minutes to keep. Press 7030 {{{kbd(RET)}}} to keep them all, effectively changing nothing, or 7031 enter a number to keep that many minutes. 7032 7033 - {{{kbd(K)}}} :: 7034 7035 #+kindex: K 7036 If you use the shift key and press {{{kbd(K)}}}, it keeps however 7037 many minutes you request and then immediately clock out of that 7038 task. If you keep all of the minutes, this is the same as just 7039 clocking out of the current task. 7040 7041 - {{{kbd(s)}}} :: 7042 7043 #+kindex: s 7044 To keep none of the minutes, use {{{kbd(s)}}} to subtract all the 7045 away time from the clock, and then check back in from the moment you 7046 returned. 7047 7048 - {{{kbd(S)}}} :: 7049 7050 #+kindex: S 7051 To keep none of the minutes and just clock out at the start of the 7052 away time, use the shift key and press {{{kbd(S)}}}. Remember that 7053 using shift always leave you clocked out, no matter which option you 7054 choose. 7055 7056 - {{{kbd(C)}}} :: 7057 7058 #+kindex: C 7059 To cancel the clock altogether, use {{{kbd(C)}}}. Note that if 7060 instead of canceling you subtract the away time, and the resulting 7061 clock amount is less than a minute, the clock is still canceled 7062 rather than cluttering up the log with an empty entry. 7063 7064 What if you subtracted those away minutes from the current clock, and 7065 now want to apply them to a new clock? Simply clock in to any task 7066 immediately after the subtraction. Org will notice that you have 7067 subtracted time "on the books", so to speak, and will ask if you want 7068 to apply those minutes to the next task you clock in on. 7069 7070 There is one other instance when this clock resolution magic occurs. 7071 Say you were clocked in and hacking away, and suddenly your cat chased 7072 a mouse who scared a hamster that crashed into your UPS's power 7073 button! You suddenly lose all your buffers, but thanks to auto-save 7074 you still have your recent Org mode changes, including your last clock 7075 in. 7076 7077 If you restart Emacs and clock into any task, Org will notice that you 7078 have a dangling clock which was never clocked out from your last 7079 session. Using that clock's starting time as the beginning of the 7080 unaccounted-for period, Org will ask how you want to resolve that 7081 time. The logic and behavior is identical to dealing with away time 7082 due to idleness; it is just happening due to a recovery event rather 7083 than a set amount of idle time. 7084 7085 You can also check all the files visited by your Org agenda for 7086 dangling clocks at any time using {{{kbd(M-x org-resolve-clocks 7087 RET)}}} (or {{{kbd(C-c C-x C-z)}}}). 7088 7089 **** Continuous clocking 7090 :PROPERTIES: 7091 :UNNUMBERED: notoc 7092 :END: 7093 #+cindex: continuous clocking 7094 7095 #+vindex: org-clock-continuously 7096 You may want to start clocking from the time when you clocked out the 7097 previous task. To enable this systematically, set 7098 ~org-clock-continuously~ to non-~nil~. Each time you clock in, Org 7099 retrieves the clock-out time of the last clocked entry for this 7100 session, and start the new clock from there. 7101 7102 If you only want this from time to time, use three universal prefix 7103 arguments with ~org-clock-in~ and two {{{kbd(C-u C-u)}}} with 7104 ~org-clock-in-last~. 7105 7106 **** Clocking out automatically after some idle time 7107 :PROPERTIES: 7108 :UNNUMBERED: notoc 7109 :END: 7110 #+cindex: auto clocking out after idle time 7111 7112 #+vindex: org-clock-auto-clockout-timer 7113 When you often forget to clock out before being idle and you don't 7114 want to manually set the clocking time to take into account, you can 7115 set ~org-clock-auto-clockout-timer~ to a number of seconds and add 7116 =(org-clock-auto-clockout-insinuate)= to your =.emacs= file. 7117 7118 When the clock is running and Emacs is idle for more than this number 7119 of seconds, the clock will be clocked out automatically. 7120 7121 Use =M-x org-clock-toggle-auto-clockout RET= to temporarily turn this 7122 on or off. 7123 7124 ** Effort Estimates 7125 :PROPERTIES: 7126 :DESCRIPTION: Planning work effort in advance. 7127 :END: 7128 #+cindex: effort estimates 7129 #+cindex: @samp{EFFORT}, property 7130 #+vindex: org-effort-property 7131 7132 If you want to plan your work in a very detailed way, or if you need 7133 to produce offers with quotations of the estimated work effort, you 7134 may want to assign effort estimates to entries. If you are also 7135 clocking your work, you may later want to compare the planned effort 7136 with the actual working time, a great way to improve planning 7137 estimates. 7138 7139 Effort estimates are stored in a special property =EFFORT=. Multiple 7140 formats are supported, such as =3:12=, =1:23:45=, or =1d3h5min=; see 7141 the file =org-duration.el= for more detailed information about the 7142 format. 7143 7144 You can set the effort for an entry with the following commands: 7145 7146 - {{{kbd(C-c C-x e)}}} (~org-set-effort~) :: 7147 7148 #+kindex: C-c C-x e 7149 #+findex: org-set-effort 7150 Set the effort estimate for the current entry. With a prefix 7151 argument, set it to the next allowed value---see below. This 7152 command is also accessible from the agenda with the {{{kbd(e)}}} 7153 key. 7154 7155 - {{{kbd(C-c C-x C-e)}}} (~org-clock-modify-effort-estimate~) :: 7156 7157 #+kindex: C-c C-x C-e 7158 #+findex: org-clock-modify-effort-estimate 7159 Modify the effort estimate of the item currently being clocked. 7160 7161 Clearly the best way to work with effort estimates is through column 7162 view (see [[*Column View]]). You should start by setting up discrete 7163 values for effort estimates, and a =COLUMNS= format that displays 7164 these values together with clock sums---if you want to clock your 7165 time. For a specific buffer you can use: 7166 7167 #+begin_example 7168 ,#+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 7169 ,#+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort){:} %CLOCKSUM 7170 #+end_example 7171 7172 #+texinfo: @noindent 7173 #+vindex: org-global-properties 7174 #+vindex: org-columns-default-format 7175 or, even better, you can set up these values globally by customizing 7176 the variables ~org-global-properties~ and 7177 ~org-columns-default-format~. In particular if you want to use this 7178 setup also in the agenda, a global setup may be advised. 7179 7180 The way to assign estimates to individual items is then to switch to 7181 column mode, and to use {{{kbd(S-RIGHT)}}} and {{{kbd(S-LEFT)}}} to 7182 change the value. The values you enter are immediately summed up in 7183 the hierarchy. In the column next to it, any clocked time is 7184 displayed. 7185 7186 #+vindex: org-agenda-columns-add-appointments-to-effort-sum 7187 If you switch to column view in the daily/weekly agenda, the effort 7188 column summarizes the estimated work effort for each day[fn:: Please 7189 note the pitfalls of summing hierarchical data in a flat list (see 7190 [[*Using Column View in the Agenda]]).], and you can use this to find 7191 space in your schedule. To get an overview of the entire part of the 7192 day that is committed, you can set the option 7193 ~org-agenda-columns-add-appointments-to-effort-sum~. The appointments 7194 on a day that take place over a specified time interval are then also 7195 added to the load estimate of the day. 7196 7197 Effort estimates can be used in secondary agenda filtering that is 7198 triggered with the {{{kbd(/)}}} key in the agenda (see [[*Commands in 7199 the Agenda Buffer]]). If you have these estimates defined consistently, 7200 two or three key presses narrow down the list to stuff that fits into 7201 an available time slot. 7202 7203 ** Taking Notes with a Relative Timer 7204 :PROPERTIES: 7205 :DESCRIPTION: Notes with a running timer. 7206 :ALT_TITLE: Timers 7207 :END: 7208 #+cindex: relative timer 7209 #+cindex: countdown timer 7210 7211 Org provides two types of timers. There is a relative timer that 7212 counts up, which can be useful when taking notes during, for example, 7213 a meeting or a video viewing. There is also a countdown timer. 7214 7215 The relative and countdown are started with separate commands. 7216 7217 - {{{kbd(C-c C-x 0)}}} (~org-timer-start~) :: 7218 7219 #+kindex: C-c C-x 0 7220 #+findex: org-timer-start 7221 Start or reset the relative timer. By default, the timer is set 7222 to 0. When called with a {{{kbd(C-u)}}} prefix, prompt the user for 7223 a starting offset. The prompt will default to a timer string at 7224 point (if any), providing a convenient way to restart taking notes 7225 after a break in the process. When called with a double prefix 7226 argument {{{kbd(C-u C-u)}}}, change all timer strings in the active 7227 region by a certain amount. This can be used to fix timer strings 7228 if the timer was not started at exactly the right moment. 7229 7230 - {{{kbd(C-c C-x ;)}}} (~org-timer-set-timer~) :: 7231 7232 #+kindex: C-c C-x ; 7233 #+findex: org-timer-set-timer 7234 #+vindex: org-timer-default-timer 7235 Start a countdown timer. The user is prompted for a duration. 7236 ~org-timer-default-timer~ sets the default countdown value. Giving 7237 a numeric prefix argument overrides this default value. This 7238 command is available as {{{kbd(;)}}} in agenda buffers. 7239 7240 Once started, relative and countdown timers are controlled with the 7241 same commands. 7242 7243 - {{{kbd(C-c C-x .)}}} (~org-timer~) :: 7244 7245 #+kindex: C-c C-x . 7246 #+findex: org-timer 7247 Insert a relative time into the buffer. The first time you use 7248 this, the timer starts. Using a prefix argument restarts it. 7249 7250 - {{{kbd(C-c C-x -)}}} (~org-timer-item~) :: 7251 7252 #+kindex: C-c C-x - 7253 #+findex: org-timer-item 7254 Insert a description list item with the current relative time. With 7255 a prefix argument, first reset the timer to 0. 7256 7257 - {{{kbd(M-RET)}}} (~org-insert-heading~) :: 7258 7259 #+kindex: M-RET 7260 #+findex: org-insert-heading 7261 Once the timer list is started, you can also use {{{kbd(M-RET)}}} to 7262 insert new timer items. 7263 7264 - {{{kbd(C-c C-x \,)}}} (~org-timer-pause-or-continue~) :: 7265 7266 #+kindex: C-c C-x , 7267 #+findex: org-timer-pause-or-continue 7268 Pause the timer, or continue it if it is already paused. 7269 7270 - {{{kbd(C-c C-x _)}}} (~org-timer-stop~) :: 7271 7272 #+kindex: C-c C-x _ 7273 #+findex: org-timer-stop 7274 Stop the timer. After this, you can only start a new timer, not 7275 continue the old one. This command also removes the timer from the 7276 mode line. 7277 7278 * Refiling and Archiving 7279 :PROPERTIES: 7280 :DESCRIPTION: Moving and copying information with ease. 7281 :END: 7282 #+cindex: refiling notes 7283 #+cindex: copying notes 7284 #+cindex: archiving 7285 7286 Once information is in the system, it may need to be moved around. 7287 Org provides Refile, Copy and Archive commands for this. Refile and 7288 Copy helps with moving and copying outlines. Archiving helps to keep 7289 the system compact and fast. 7290 7291 ** Refile and Copy 7292 :PROPERTIES: 7293 :DESCRIPTION: Moving/copying a tree from one place to another. 7294 :END: 7295 #+cindex: refiling notes 7296 #+cindex: copying notes 7297 7298 When reviewing the captured data, you may want to refile or to copy 7299 some of the entries into a different list, for example into a project. 7300 Cutting, finding the right location, and then pasting the note is 7301 cumbersome. To simplify this process, you can use the following 7302 special command: 7303 7304 - {{{kbd(C-c C-w)}}} (~org-refile~) :: 7305 7306 #+kindex: C-c C-w 7307 #+findex: org-refile 7308 #+vindex: org-reverse-note-order 7309 #+vindex: org-refile-targets 7310 #+vindex: org-refile-use-outline-path 7311 #+vindex: org-outline-path-complete-in-steps 7312 #+vindex: org-refile-allow-creating-parent-nodes 7313 #+vindex: org-log-refile 7314 Refile the entry or region at point. This command offers possible 7315 locations for refiling the entry and lets you select one with 7316 completion. The item (or all items in the region) is filed below 7317 the target heading as a subitem. Depending on 7318 ~org-reverse-note-order~, it is either the first or last subitem. 7319 7320 By default, all level 1 headlines in the current buffer are 7321 considered to be targets, but you can have more complex definitions 7322 across a number of files. See the variable ~org-refile-targets~ for 7323 details. If you would like to select a location via a 7324 file-path-like completion along the outline path, see the variables 7325 ~org-refile-use-outline-path~ and 7326 ~org-outline-path-complete-in-steps~. If you would like to be able 7327 to create new nodes as new parents for refiling on the fly, check 7328 the variable ~org-refile-allow-creating-parent-nodes~. When the 7329 variable ~org-log-refile~[fn:: Note the corresponding =STARTUP= 7330 options =logrefile=, =lognoterefile=, and =nologrefile=.] is set, a 7331 timestamp or a note is recorded whenever an entry is refiled. 7332 7333 - {{{kbd(C-u C-c C-w)}}} :: 7334 7335 #+kindex: C-u C-c C-w 7336 Use the refile interface to jump to a heading. 7337 7338 - {{{kbd(C-u C-u C-c C-w)}}} (~org-refile-goto-last-stored~) :: 7339 7340 #+kindex: C-u C-u C-c C-w 7341 #+findex: org-refile-goto-last-stored 7342 Jump to the location where ~org-refile~ last moved a tree to. 7343 7344 - {{{kbd(C-2 C-c C-w)}}} :: 7345 7346 #+kindex: C-2 C-c C-w 7347 Refile as the child of the item currently being clocked. 7348 7349 - {{{kbd(C-3 C-c C-w)}}} :: 7350 7351 #+kindex: C-3 C-c C-w 7352 #+vindex: org-refile-keep 7353 Refile and keep the entry in place. Also see ~org-refile-keep~ to 7354 make this the default behavior, and beware that this may result in 7355 duplicated =ID= properties. 7356 7357 - {{{kbd(C-0 C-c C-w)}}} or {{{kbd(C-u C-u C-u C-c C-w)}}} (~org-refile-cache-clear~) :: 7358 7359 #+kindex: C-u C-u C-u C-c C-w 7360 #+kindex: C-0 C-c C-w 7361 #+findex: org-refile-cache-clear 7362 #+vindex: org-refile-use-cache 7363 Clear the target cache. Caching of refile targets can be turned on 7364 by setting ~org-refile-use-cache~. To make the command see new 7365 possible targets, you have to clear the cache with this command. 7366 7367 - {{{kbd(C-c M-w)}}} (~org-refile-copy~) :: 7368 7369 #+kindex: C-c M-w 7370 #+findex: org-refile-copy 7371 Copying works like refiling, except that the original note is not 7372 deleted. 7373 7374 - {{{kbd(C-c C-M-w)}}} (~org-refile-reverse~) :: 7375 7376 #+kindex: C-c C-M-w 7377 #+findex: org-refile-reverse 7378 Works like refiling, except that it temporarily toggles how the 7379 value of ~org-reverse-note-order~ applies to the current buffer. So 7380 if ~org-refile~ would append the entry as the last entry under the 7381 target header, ~org-refile-reverse~ will prepend it as the first 7382 entry, and vice-versa. 7383 7384 ** Archiving 7385 :PROPERTIES: 7386 :DESCRIPTION: What to do with finished products. 7387 :END: 7388 #+cindex: archiving 7389 7390 When a project represented by a (sub)tree is finished, you may want to 7391 move the tree out of the way and to stop it from contributing to the 7392 agenda. Archiving is important to keep your working files compact and 7393 global searches like the construction of agenda views fast. 7394 7395 - {{{kbd(C-c C-x C-a)}}} (~org-archive-subtree-default~) :: 7396 7397 #+kindex: C-c C-x C-a 7398 #+findex: org-archive-subtree-default 7399 #+vindex: org-archive-default-command 7400 Archive the current entry using the command specified in the 7401 variable ~org-archive-default-command~. 7402 7403 *** Moving a tree to an archive file 7404 :PROPERTIES: 7405 :DESCRIPTION: Moving a tree to an archive file. 7406 :ALT_TITLE: Moving subtrees 7407 :END: 7408 #+cindex: external archiving 7409 7410 The most common archiving action is to move a project tree to another 7411 file, the archive file. 7412 7413 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd(C-c $)}}} (~org-archive-subtree~) :: 7414 7415 #+kindex: C-c C-x C-s 7416 #+kindex: C-c $ 7417 #+findex: org-archive-subtree 7418 #+vindex: org-archive-location 7419 Archive the subtree starting at point position to the location given 7420 by ~org-archive-location~. 7421 7422 - {{{kbd(C-u C-c C-x C-s)}}} :: 7423 7424 #+kindex: C-u C-c C-x C-s 7425 Check if any direct children of the current headline could be moved 7426 to the archive. To do this, check each subtree for open TODO 7427 entries. If none is found, the command offers to move it to the 7428 archive location. If point is /not/ on a headline when this command 7429 is invoked, check level 1 trees. 7430 7431 - {{{kbd(C-u C-u C-c C-x C-s)}}} :: 7432 7433 #+kindex: C-u C-u C-c C-x C-s 7434 As above, but check subtree for timestamps instead of TODO entries. 7435 The command offers to archive the subtree if it /does/ contain 7436 a timestamp, and that timestamp is in the past. 7437 7438 #+cindex: archive locations 7439 The default archive location is a file in the same directory as the 7440 current file, with the name derived by appending =_archive= to the 7441 current file name. You can also choose what heading to file archived 7442 items under, with the possibility to add them to a datetree in a file. 7443 For information and examples on how to specify the file and the 7444 heading, see the documentation string of the variable 7445 ~org-archive-location~. 7446 7447 There is also an in-buffer option for setting this variable, for 7448 example: 7449 7450 #+cindex: @samp{ARCHIVE}, keyword 7451 : #+ARCHIVE: %s_done:: 7452 7453 #+cindex: ARCHIVE, property 7454 If you would like to have a special archive location for a single 7455 entry or a (sub)tree, give the entry an =ARCHIVE= property with the 7456 location as the value (see [[*Properties and Columns]]). 7457 7458 #+vindex: org-archive-save-context-info 7459 When a subtree is moved, it receives a number of special properties 7460 that record context information like the file from where the entry 7461 came, its outline path the archiving time etc. Configure the variable 7462 ~org-archive-save-context-info~ to adjust the amount of information 7463 added. 7464 7465 #+vindex: org-archive-subtree-save-file-p 7466 When ~org-archive-subtree-save-file-p~ is non-~nil~, save the target 7467 archive buffer. 7468 7469 *** Internal archiving 7470 :PROPERTIES: 7471 :DESCRIPTION: Switch off a tree but keep it in the file. 7472 :END: 7473 7474 #+cindex: @samp{ARCHIVE}, tag 7475 If you want to just switch off---for agenda views---certain subtrees 7476 without moving them to a different file, you can use the =ARCHIVE= 7477 tag. 7478 7479 A headline that is marked with the =ARCHIVE= tag (see [[*Tags]]) stays at 7480 its location in the outline tree, but behaves in the following way: 7481 7482 - 7483 #+vindex: org-cycle-open-archived-trees 7484 It does not open when you attempt to do so with a visibility cycling 7485 command (see [[*Visibility Cycling]]). You can force cycling archived 7486 subtrees with {{{kbd(C-c C-TAB)}}}, or by setting the option 7487 ~org-cycle-open-archived-trees~. Also normal outline commands, like 7488 ~org-show-all~, open archived subtrees. 7489 7490 - 7491 #+vindex: org-sparse-tree-open-archived-trees 7492 During sparse tree construction (see [[*Sparse Trees]]), matches in 7493 archived subtrees are not exposed, unless you configure the option 7494 ~org-sparse-tree-open-archived-trees~. 7495 7496 - 7497 #+vindex: org-agenda-skip-archived-trees 7498 During agenda view construction (see [[*Agenda Views]]), the content of 7499 archived trees is ignored unless you configure the option 7500 ~org-agenda-skip-archived-trees~, in which case these trees are 7501 always included. In the agenda you can press {{{kbd(v a)}}} to get 7502 archives temporarily included. 7503 7504 - 7505 #+vindex: org-export-with-archived-trees 7506 Archived trees are not exported (see [[*Exporting]]), only the headline 7507 is. Configure the details using the variable 7508 ~org-export-with-archived-trees~. 7509 7510 - 7511 #+vindex: org-columns-skip-archived-trees 7512 Archived trees are excluded from column view unless the variable 7513 ~org-columns-skip-archived-trees~ is configured to ~nil~. 7514 7515 The following commands help manage the =ARCHIVE= tag: 7516 7517 - {{{kbd(C-c C-x a)}}} (~org-toggle-archive-tag~) :: 7518 7519 #+kindex: C-c C-x a 7520 #+findex: org-toggle-archive-tag 7521 Toggle the archive tag for the current headline. When the tag is 7522 set, the headline changes to a shadowed face, and the subtree below 7523 it is hidden. 7524 7525 - {{{kbd(C-u C-c C-x a)}}} :: 7526 7527 #+kindex: C-u C-c C-x a 7528 Check if any direct children of the current headline should be 7529 archived. To do this, check each subtree for open TODO entries. If 7530 none is found, the command offers to set the =ARCHIVE= tag for the 7531 child. If point is /not/ on a headline when this command is 7532 invoked, check the level 1 trees. 7533 7534 - {{{kbd(C-c C-TAB)}}} (~org-cycle-force-archived~) :: 7535 7536 #+kindex: C-c C-TAB 7537 Cycle a tree even if it is tagged with =ARCHIVE=. 7538 7539 - {{{kbd(C-c C-x A)}}} (~org-archive-to-archive-sibling~) :: 7540 7541 #+kindex: C-c C-x A 7542 #+findex: org-archive-to-archive-sibling 7543 Move the current entry to the /Archive Sibling/. This is a sibling 7544 of the entry with the heading =Archive= and the archive tag. The 7545 entry becomes a child of that sibling and in this way retains a lot 7546 of its original context, including inherited tags and approximate 7547 position in the outline. 7548 7549 * Capture and Attachments 7550 :PROPERTIES: 7551 :DESCRIPTION: Dealing with external data. 7552 :END: 7553 #+cindex: capture 7554 #+cindex: attachments 7555 #+cindex: RSS feeds 7556 #+cindex: Atom feeds 7557 #+cindex: protocols, for external access 7558 7559 An important part of any organization system is the ability to quickly 7560 capture new ideas and tasks, and to associate reference material with 7561 them. Org does this using a process called /capture/. It also can 7562 store files related to a task (/attachments/) in a special directory. 7563 Finally, it can parse RSS feeds for information. To learn how to let 7564 external programs (for example a web browser) trigger Org to capture 7565 material, see [[*Protocols for External Access]]. 7566 7567 ** Capture 7568 :PROPERTIES: 7569 :DESCRIPTION: Capturing new stuff. 7570 :END: 7571 #+cindex: capture 7572 7573 Capture lets you quickly store notes with little interruption of your 7574 work flow. Org's method for capturing new items is heavily inspired 7575 by John Wiegley's excellent Remember package. 7576 7577 *** Setting up capture 7578 :PROPERTIES: 7579 :DESCRIPTION: Where notes will be stored. 7580 :END: 7581 7582 The following customization sets a default target file for notes. 7583 7584 #+vindex: org-default-notes-file 7585 #+begin_src emacs-lisp 7586 (setq org-default-notes-file (concat org-directory "/notes.org")) 7587 #+end_src 7588 7589 You may also define a global key for capturing new material (see 7590 [[*Activation]]). 7591 7592 *** Using capture 7593 :PROPERTIES: 7594 :DESCRIPTION: Commands to invoke and terminate capture. 7595 :END: 7596 7597 - {{{kbd(M-x org-capture)}}} (~org-capture~) :: 7598 7599 #+findex: org-capture 7600 Display the capture templates menu. If you have templates defined 7601 (see [[*Capture templates]]), it offers these templates for selection or 7602 use a new Org outline node as the default template. It inserts the 7603 template into the target file and switch to an indirect buffer 7604 narrowed to this new node. You may then insert the information you 7605 want. 7606 7607 - {{{kbd(C-c C-c)}}} (~org-capture-finalize~) :: 7608 7609 #+kindex: C-c C-c @r{(Capture buffer)} 7610 #+findex: org-capture-finalize 7611 Once you have finished entering information into the capture buffer, 7612 {{{kbd(C-c C-c)}}} returns you to the window configuration before 7613 the capture process, so that you can resume your work without 7614 further distraction. When called with a prefix argument, finalize 7615 and then jump to the captured item. 7616 7617 - {{{kbd(C-c C-w)}}} (~org-capture-refile~) :: 7618 7619 #+kindex: C-c C-w @r{(Capture buffer)} 7620 #+findex: org-capture-refile 7621 Finalize the capture process by refiling the note to a different 7622 place (see [[*Refile and Copy]]). Please realize that this is a normal 7623 refiling command that will be executed---so point position at the 7624 moment you run this command is important. If you have inserted 7625 a tree with a parent and children, first move point back to the 7626 parent. Any prefix argument given to this command is passed on to 7627 the ~org-refile~ command. 7628 7629 - {{{kbd(C-c C-k)}}} (~org-capture-kill~) :: 7630 7631 #+kindex: C-c C-k @r{(Capture buffer)} 7632 #+findex: org-capture-kill 7633 Abort the capture process and return to the previous state. 7634 7635 #+kindex: k c @r{(Agenda)} 7636 You can also call ~org-capture~ in a special way from the agenda, 7637 using the {{{kbd(k c)}}} key combination. With this access, any 7638 timestamps inserted by the selected capture template defaults to the 7639 date at point in the agenda, rather than to the current date. 7640 7641 To find the locations of the last stored capture, use ~org-capture~ 7642 with prefix commands: 7643 7644 - {{{kbd(C-u M-x org-capture)}}} :: 7645 7646 Visit the target location of a capture template. You get to select 7647 the template in the usual way. 7648 7649 - {{{kbd(C-u C-u M-x org-capture)}}} :: 7650 7651 Visit the last stored capture item in its buffer. 7652 7653 #+vindex: org-capture-bookmark 7654 #+vindex: org-capture-last-stored 7655 You can also jump to the bookmark ~org-capture-last-stored~, which is 7656 automatically created unless you set ~org-capture-bookmark~ to ~nil~. 7657 7658 To insert the capture at point in an Org buffer, call ~org-capture~ 7659 with a {{{kbd(C-0)}}} prefix argument. 7660 7661 *** Capture templates 7662 :PROPERTIES: 7663 :DESCRIPTION: Define the outline of different note types. 7664 :END: 7665 #+cindex: templates, for Capture 7666 7667 You can use templates for different types of capture items, and for 7668 different target locations. The easiest way to create such templates 7669 is through the customize interface. 7670 7671 - {{{kbd(C)}}} :: 7672 7673 #+kindex: C @r{(Capture menu} 7674 #+vindex: org-capture-templates 7675 Customize the variable ~org-capture-templates~. 7676 7677 Before we give the formal description of template definitions, let's 7678 look at an example. Say you would like to use one template to create 7679 general TODO entries, and you want to put these entries under the 7680 heading =Tasks= in your file =~/org/gtd.org=. Also, a date tree in 7681 the file =journal.org= should capture journal entries. A possible 7682 configuration would look like: 7683 7684 #+begin_src emacs-lisp 7685 (setq org-capture-templates 7686 '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks") 7687 "* TODO %?\n %i\n %a") 7688 ("j" "Journal" entry (file+datetree "~/org/journal.org") 7689 "* %?\nEntered on %U\n %i\n %a"))) 7690 #+end_src 7691 7692 If you then press {{{kbd(t)}}} from the capture menu, Org will prepare 7693 the template for you like this: 7694 7695 #+begin_example 7696 ,* TODO 7697 [[file:LINK TO WHERE YOU INITIATED CAPTURE]] 7698 #+end_example 7699 7700 #+texinfo: @noindent 7701 During expansion of the template, =%a= has been replaced by a link to 7702 the location from where you called the capture command. This can be 7703 extremely useful for deriving tasks from emails, for example. You 7704 fill in the task definition, press {{{kbd(C-c C-c)}}} and Org returns 7705 you to the same place where you started the capture process. 7706 7707 To define special keys to capture to a particular template without 7708 going through the interactive template selection, you can create your 7709 key binding like this: 7710 7711 #+begin_src emacs-lisp 7712 (define-key global-map (kbd "C-c x") 7713 (lambda () (interactive) (org-capture nil "x"))) 7714 #+end_src 7715 7716 **** Template elements 7717 :PROPERTIES: 7718 :DESCRIPTION: What is needed for a complete template entry. 7719 :END: 7720 7721 Now lets look at the elements of a template definition. Each entry in 7722 ~org-capture-templates~ is a list with the following items: 7723 7724 - keys :: 7725 7726 The keys that selects the template, as a string, characters only, 7727 for example ="a"=, for a template to be selected with a single key, 7728 or ="bt"= for selection with two keys. When using several keys, 7729 keys using the same prefix key must be sequential in the list and 7730 preceded by a 2-element entry explaining the prefix key, for 7731 example: 7732 7733 #+begin_src emacs-lisp 7734 ("b" "Templates for marking stuff to buy") 7735 #+end_src 7736 7737 If you do not define a template for the {{{kbd(C)}}} key, this key 7738 opens the Customize buffer for this complex variable. 7739 7740 - description :: 7741 7742 A short string describing the template, shown during selection. 7743 7744 - type :: 7745 7746 The type of entry, a symbol. Valid values are: 7747 7748 - ~entry~ :: 7749 7750 An Org mode node, with a headline. Will be filed as the child of 7751 the target entry or as a top-level entry. The target file should 7752 be an Org file. 7753 7754 - ~item~ :: 7755 7756 A plain list item, placed in the first plain list at the target 7757 location. Again the target file should be an Org file. 7758 7759 - ~checkitem~ :: 7760 7761 A checkbox item. This only differs from the plain list item by 7762 the default template. 7763 7764 - ~table-line~ :: 7765 7766 A new line in the first table at the target location. Where 7767 exactly the line will be inserted depends on the properties 7768 ~:prepend~ and ~:table-line-pos~ (see below). 7769 7770 - ~plain~ :: 7771 7772 Text to be inserted as it is. 7773 7774 - target :: 7775 7776 #+vindex: org-default-notes-file 7777 #+vindex: org-directory 7778 #+cindex: date tree 7779 Specification of where the captured item should be placed. In Org 7780 files, targets usually define a node. Entries will become children 7781 of this node. Other types will be added to the table or list in the 7782 body of this node. Most target specifications contain a file name. 7783 If that file name is the empty string, it defaults to 7784 ~org-default-notes-file~. A file can also be given as a variable or 7785 as a function called with no argument. When an absolute path is not 7786 specified for a target, it is taken as relative to ~org-directory~. 7787 7788 Valid values are: 7789 7790 - =(file "path/to/file")= :: 7791 7792 Text will be placed at the beginning or end of that file. 7793 7794 - =(id "id of existing org entry")= :: 7795 7796 Filing as child of this entry, or in the body of the entry. 7797 7798 - =(file+headline "filename" "node headline")= :: 7799 7800 Fast configuration if the target heading is unique in the file. 7801 7802 - =(file+olp "filename" "Level 1 heading" "Level 2" ...)= :: 7803 7804 For non-unique headings, the full path is safer. 7805 7806 - =(file+regexp "filename" "regexp to find location")= :: 7807 7808 Use a regular expression to position point. 7809 7810 - =(file+olp+datetree "filename" [ "Level 1 heading" ...])= :: 7811 7812 This target[fn:29] creates a heading in a date tree[fn:30] for 7813 today's date. If the optional outline path is given, the tree 7814 will be built under the node it is pointing to, instead of at top 7815 level. Check out the ~:time-prompt~ and ~:tree-type~ properties 7816 below for additional options. 7817 7818 - =(file+function "filename" function-finding-location)= :: 7819 7820 A function to find the right location in the file. 7821 7822 - =(clock)= :: 7823 7824 File to the entry that is currently being clocked. 7825 7826 - =(function function-finding-location)= :: 7827 7828 Most general way: write your own function which both visits the 7829 file and moves point to the right location. 7830 7831 - template :: 7832 7833 The template for creating the capture item. If you leave this 7834 empty, an appropriate default template will be used. Otherwise this 7835 is a string with escape codes, which will be replaced depending on 7836 time and context of the capture call. You may also get this 7837 template string from a file[fn:: When the file name is not absolute, 7838 Org assumes it is relative to ~org-directory~.], or dynamically, 7839 from a function using either syntax: 7840 7841 : (file "/path/to/template-file") 7842 : (function FUNCTION-RETURNING-THE-TEMPLATE) 7843 7844 - properties :: 7845 7846 The rest of the entry is a property list of additional options. 7847 Recognized properties are: 7848 7849 - ~:prepend~ :: 7850 7851 Normally new captured information will be appended at the target 7852 location (last child, last table line, last list item, ...). 7853 Setting this property changes that. 7854 7855 - ~:immediate-finish~ :: 7856 7857 When set, do not offer to edit the information, just file it away 7858 immediately. This makes sense if the template only needs 7859 information that can be added automatically. 7860 7861 - ~:jump-to-captured~ :: 7862 7863 When set, jump to the captured entry when finished. 7864 7865 - ~:empty-lines~ :: 7866 7867 Set this to the number of lines to insert before and after the new 7868 item. Default 0, and the only other common value is 1. 7869 7870 - ~:empty-lines-after~ :: 7871 7872 Set this to the number of lines that should be inserted after the 7873 new item. Overrides ~:empty-lines~ for the number of lines 7874 inserted after. 7875 7876 - ~:empty-lines-before~ :: 7877 7878 Set this to the number of lines that should be inserted before the 7879 new item. Overrides ~:empty-lines~ for the number lines inserted 7880 before. 7881 7882 - ~:clock-in~ :: 7883 7884 Start the clock in this item. 7885 7886 - ~:clock-keep~ :: 7887 7888 Keep the clock running when filing the captured entry. 7889 7890 - ~:clock-resume~ :: 7891 7892 If starting the capture interrupted a clock, restart that clock 7893 when finished with the capture. Note that ~:clock-keep~ has 7894 precedence over ~:clock-resume~. When setting both to non-~nil~, 7895 the current clock will run and the previous one will not be 7896 resumed. 7897 7898 - ~:time-prompt~ :: 7899 7900 Prompt for a date/time to be used for date/week trees and when 7901 filling the template. Without this property, capture uses the 7902 current date and time. Even if this property has not been set, 7903 you can force the same behavior by calling ~org-capture~ with 7904 a {{{kbd(C-1)}}} prefix argument. 7905 7906 - ~:tree-type~ :: 7907 7908 Use ~week~ to make a week tree instead of the month-day tree, 7909 i.e., place the headings for each day under a heading with the 7910 current ISO week. Use ~month~ to group entries by month 7911 only. Default is to group entries by day. 7912 7913 - ~:unnarrowed~ :: 7914 7915 Do not narrow the target buffer, simply show the full buffer. 7916 Default is to narrow it so that you only see the new material. 7917 7918 - ~:table-line-pos~ :: 7919 7920 Specification of the location in the table where the new line 7921 should be inserted. It should be a string like =II-3= meaning 7922 that the new line should become the third line before the second 7923 horizontal separator line. 7924 7925 - ~:kill-buffer~ :: 7926 7927 If the target file was not yet visited when capture was invoked, 7928 kill the buffer again after capture is completed. 7929 7930 - ~:no-save~ :: 7931 7932 Do not save the target file after finishing the capture. 7933 7934 - ~:refile-targets~ :: Temporarily set ~org-refile-targets~ to the 7935 value of this property. 7936 7937 - ~:hook~ :: 7938 7939 A nullary function or list of nullary functions run before 7940 ~org-capture-mode-hook~ when the template is selected. 7941 7942 - ~:prepare-finalize~ :: 7943 7944 A nullary function or list of nullary functions run before 7945 ~org-capture-prepare-finalize-hook~ when the template is selected. 7946 7947 - ~:before-finalize~ :: 7948 7949 A nullary function or list of nullary functions run before 7950 ~org-capture-before-finalize-hook~ when the template is selected. 7951 7952 - ~:after-finalize~ :: 7953 7954 A nullary function or list of nullary functions run before 7955 ~org-capture-after-finalize-hook~ when the template is selected. 7956 7957 **** Template expansion 7958 :PROPERTIES: 7959 :DESCRIPTION: Filling in information about time and context. 7960 :END: 7961 7962 In the template itself, special "%-escapes"[fn:: If you need one of 7963 these sequences literally, escape the =%= with a backslash.] allow 7964 dynamic insertion of content. The templates are expanded in the order 7965 given here: 7966 7967 - =%[FILE]= :: 7968 7969 Insert the contents of the file given by {{{var(FILE)}}}. 7970 7971 - =%(EXP)= :: 7972 7973 Evaluate Elisp expression {{{var(EXP)}}} and replace it with the 7974 result. The {{{var(EXP)}}} form must return a string. Only 7975 placeholders pre-existing within the template, or introduced with 7976 =%[file]=, are expanded this way. Since this happens after 7977 expanding non-interactive "%-escapes", those can be used to fill the 7978 expression. 7979 7980 - =%<FORMAT>= :: 7981 7982 The result of format-time-string on the {{{var(FORMAT)}}} 7983 specification. 7984 7985 - =%t= :: 7986 7987 Timestamp, date only. 7988 7989 - =%T= :: 7990 7991 Timestamp, with date and time. 7992 7993 - =%u=, =%U= :: 7994 7995 Like =%t=, =%T= above, but inactive timestamps. 7996 7997 - =%i= :: 7998 7999 Initial content, the region when capture is called while the region 8000 is active. If there is text before =%i= on the same line, such as 8001 indentation, and =%i= is not inside a =%(exp)= form, that prefix is 8002 added before every line in the inserted text. 8003 8004 - =%a= :: 8005 8006 Annotation, normally the link created with ~org-store-link~. 8007 8008 - =%A= :: 8009 8010 Like =%a=, but prompt for the description part. 8011 8012 - =%l= :: 8013 8014 Like =%a=, but only insert the literal link. 8015 8016 - =%L= :: 8017 8018 Like =%l=, but without brackets (the link content itself). 8019 8020 - =%c= :: 8021 8022 Current kill ring head. 8023 8024 - =%x= :: 8025 8026 Content of the X clipboard. 8027 8028 - =%k= :: 8029 8030 Title of the currently clocked task. 8031 8032 - =%K= :: 8033 8034 Link to the currently clocked task. 8035 8036 - =%n= :: 8037 8038 User name (taken from ~user-full-name~). 8039 8040 - =%f= :: 8041 8042 File visited by current buffer when org-capture was called. 8043 8044 - =%F= :: 8045 8046 Full path of the file or directory visited by current buffer. 8047 8048 - =%:keyword= :: 8049 8050 Specific information for certain link types, see below. 8051 8052 - =%^g= :: 8053 8054 Prompt for tags, with completion on tags in target file. 8055 8056 - =%^G= :: 8057 8058 Prompt for tags, with completion all tags in all agenda files. 8059 8060 - =%^t= :: 8061 8062 Like =%t=, but prompt for date. Similarly =%^T=, =%^u=, =%^U=. You 8063 may define a prompt like =%^{Birthday}t=. 8064 8065 - =%^C= :: 8066 8067 Interactive selection of which kill or clip to use. 8068 8069 - =%^L= :: 8070 8071 Like =%^C=, but insert as link. 8072 8073 - =%^{PROP}p= :: 8074 8075 Prompt the user for a value for property {{{var(PROP)}}}. You may 8076 specify a default value with =%^{PROP|default}=. 8077 8078 - =%^{PROMPT}= :: 8079 8080 Prompt the user for a string and replace this sequence with it. You 8081 may specify a default value and a completion table with 8082 =%^{prompt|default|completion2|completion3...}=. The arrow keys 8083 access a prompt-specific history. 8084 8085 - =%\N= :: 8086 8087 Insert the text entered at the {{{var(N)}}}th =%^{PROMPT}=, where 8088 {{{var(N)}}} is a number, starting from 1. 8089 8090 - =%?= :: 8091 8092 After completing the template, position point here. 8093 8094 #+vindex: org-store-link-props 8095 For specific link types, the following keywords are defined[fn:: If 8096 you define your own link types (see [[*Adding Hyperlink Types]]), any 8097 property you store with ~org-store-link-props~ can be accessed in 8098 capture templates in a similar way.]: 8099 8100 #+vindex: org-link-from-user-regexp 8101 | Link type | Available keywords | 8102 |--------------+----------------------------------------------------------| 8103 | bbdb | =%:name=, =%:company= | 8104 | irc | =%:server=, =%:port=, =%:nick= | 8105 | mh, rmail | =%:type=, =%:subject=, =%:message-id= | 8106 | | =%:from=, =%:fromname=, =%:fromaddress= | 8107 | | =%:to=, =%:toname=, =%:toaddress= | 8108 | | =%:date= (message date header field) | 8109 | | =%:date-timestamp= (date as active timestamp) | 8110 | | =%:date-timestamp-inactive= (date as inactive timestamp) | 8111 | | =%:fromto= (either "to NAME" or "from NAME")[fn:31] | 8112 | gnus | =%:group=, for messages also all email fields | 8113 | w3, w3m | =%:url= | 8114 | info | =%:file=, =%:node= | 8115 | calendar | =%:date= | 8116 | org-protocol | =%:link=, =%:description=, =%:annotation= | 8117 8118 **** Templates in contexts 8119 :PROPERTIES: 8120 :DESCRIPTION: Only show a template in a specific context. 8121 :END: 8122 8123 #+vindex: org-capture-templates-contexts 8124 To control whether a capture template should be accessible from 8125 a specific context, you can customize 8126 ~org-capture-templates-contexts~. Let's say, for example, that you 8127 have a capture template "p" for storing Gnus emails containing 8128 patches. Then you would configure this option like this: 8129 8130 #+begin_src emacs-lisp 8131 (setq org-capture-templates-contexts 8132 '(("p" ((in-mode . "message-mode"))))) 8133 #+end_src 8134 8135 You can also tell that the command key {{{kbd(p)}}} should refer to 8136 another template. In that case, add this command key like this: 8137 8138 #+begin_src emacs-lisp 8139 (setq org-capture-templates-contexts 8140 '(("p" "q" ((in-mode . "message-mode"))))) 8141 #+end_src 8142 8143 See the docstring of the variable for more information. 8144 8145 ** Attachments 8146 :PROPERTIES: 8147 :DESCRIPTION: Attach files to outlines. 8148 :END: 8149 #+cindex: attachments 8150 8151 It is often useful to associate reference material with an outline 8152 node. Small chunks of plain text can simply be stored in the subtree 8153 of a project. Hyperlinks (see [[*Hyperlinks]]) can establish associations 8154 with files that live elsewhere on a local, or even remote, computer, 8155 like emails or source code files belonging to a project. 8156 8157 Another method is /attachments/, which are files located in a 8158 directory belonging to an outline node. Org uses directories either 8159 named by a unique ID of each entry, or by a =DIR= property. 8160 8161 *** Attachment defaults and dispatcher 8162 :PROPERTIES: 8163 :DESCRIPTION: How to access attachment commands 8164 :END: 8165 8166 By default, Org attach uses ID properties when adding attachments to 8167 outline nodes. This makes working with attachments fully automated. 8168 There is no decision needed for folder-name or location. ID-based 8169 directories are by default located in the =data/= directory, which 8170 lives in the same directory where your Org file lives[fn:: If you move 8171 entries or Org files from one directory to another, you may want to 8172 configure ~org-attach-id-dir~ to contain an absolute path.]. 8173 8174 When attachments are made using ~org-attach~ a default tag =ATTACH= is 8175 added to the node that gets the attachments. 8176 8177 For more control over the setup, see [[*Attachment options]]. 8178 8179 The following commands deal with attachments: 8180 8181 - {{{kbd(C-c C-a)}}} (~org-attach~) :: 8182 8183 #+kindex: C-c C-a 8184 #+findex: org-attach 8185 The dispatcher for commands related to the attachment system. After 8186 these keys, a list of commands is displayed and you must press an 8187 additional key to select a command: 8188 8189 - {{{kbd(a)}}} (~org-attach-attach~) :: 8190 8191 #+kindex: C-c C-a a 8192 #+findex: org-attach-attach 8193 #+vindex: org-attach-method 8194 Select a file and move it into the task's attachment directory. 8195 The file is copied, moved, or linked, depending on 8196 ~org-attach-method~. Note that hard links are not supported on 8197 all systems. 8198 8199 - {{{kbd(c)}}}/{{{kbd(m)}}}/{{{kbd(l)}}} :: 8200 8201 #+kindex: C-c C-a c 8202 #+kindex: C-c C-a m 8203 #+kindex: C-c C-a l 8204 Attach a file using the copy/move/link method. Note that hard 8205 links are not supported on all systems. 8206 8207 - {{{kbd(b)}}} (~org-attach-buffer~) :: 8208 8209 #+kindex: C-c C-a b 8210 #+findex: org-attach-buffer 8211 Select a buffer and save it as a file in the task's attachment 8212 directory. 8213 8214 - {{{kbd(n)}}} (~org-attach-new~) :: 8215 8216 #+kindex: C-c C-a n 8217 #+findex: org-attach-new 8218 Create a new attachment as an Emacs buffer. 8219 8220 - {{{kbd(z)}}} (~org-attach-sync~) :: 8221 8222 #+kindex: C-c C-a z 8223 #+findex: org-attach-sync 8224 Synchronize the current task with its attachment directory, in 8225 case you added attachments yourself. 8226 8227 - {{{kbd(o)}}} (~org-attach-open~) :: 8228 8229 #+kindex: C-c C-a o 8230 #+findex: org-attach-open 8231 #+vindex: org-file-apps 8232 Open current task's attachment. If there is more than one, prompt 8233 for a file name first. Opening follows the rules set by 8234 ~org-file-apps~. For more details, see the information on 8235 following hyperlinks (see [[*Handling Links]]). 8236 8237 - {{{kbd(O)}}} (~org-attach-open-in-emacs~) :: 8238 8239 #+kindex: C-c C-a O 8240 #+findex: org-attach-open-in-emacs 8241 Also open the attachment, but force opening the file in Emacs. 8242 8243 - {{{kbd(f)}}} (~org-attach-reveal~) :: 8244 8245 #+kindex: C-c C-a f 8246 #+findex: org-attach-reveal 8247 Open the current task's attachment directory. 8248 8249 - {{{kbd(F)}}} (~org-attach-reveal-in-emacs~) :: 8250 8251 #+kindex: C-c C-a F 8252 #+findex: org-attach-reveal-in-emacs 8253 Also open the directory, but force using Dired in Emacs. 8254 8255 - {{{kbd(d)}}} (~org-attach-delete-one~) :: 8256 8257 #+kindex: C-c C-a d 8258 Select and delete a single attachment. 8259 8260 - {{{kbd(D)}}} (~org-attach-delete-all~) :: 8261 8262 #+kindex: C-c C-a D 8263 Delete all of a task's attachments. A safer way is to open the 8264 directory in Dired and delete from there. 8265 8266 - {{{kbd(s)}}} (~org-attach-set-directory~) :: 8267 8268 #+kindex: C-c C-a s 8269 #+cindex: @samp{DIR}, property 8270 Set a specific directory as the entry's attachment directory. 8271 This works by putting the directory path into the =DIR= 8272 property. 8273 8274 - {{{kbd(S)}}} (~org-attach-unset-directory~) :: 8275 8276 #+kindex: C-c C-a S 8277 #+cindex: @samp{DIR}, property 8278 Remove the attachment directory. This command removes the =DIR= 8279 property and asks the user to either move content inside that 8280 folder, if an =ID= property is set, delete the content, or to 8281 leave the attachment directory as is but no longer attached to the 8282 outline node. 8283 8284 *** Attachment options 8285 :PROPERTIES: 8286 :DESCRIPTION: Configuring the attachment system 8287 :END: 8288 8289 There are a couple of options for attachments that are worth 8290 mentioning. 8291 8292 - ~org-attach-id-dir~ :: 8293 #+vindex: org-attach-id-dir 8294 The directory where attachments are stored when =ID= is used as 8295 method. 8296 8297 - ~org-attach-dir-relative~ :: 8298 #+vindex: org-attach-dir-relative 8299 When setting the =DIR= property on a node using {{{kbd(C-c C-a s)}}} 8300 (~org-attach-set-directory~), absolute links are entered by default. 8301 This option changes that to relative links. 8302 8303 - ~org-attach-use-inheritance~ :: 8304 #+vindex: org-attach-use-inheritance 8305 By default folders attached to an outline node are inherited from 8306 parents according to ~org-use-property-inheritance~. If one instead 8307 want to set inheritance specifically for Org attach that can be done 8308 using ~org-attach-use-inheritance~. Inheriting documents through 8309 the node hierarchy makes a lot of sense in most cases. Especially 8310 when using attachment links (see [[*Attachment links]]). The following 8311 example shows one use case for attachment inheritance: 8312 8313 #+begin_example 8314 ,* Chapter A ... 8315 :PROPERTIES: 8316 :DIR: Chapter A/ 8317 :END: 8318 ,** Introduction 8319 Some text 8320 8321 #+NAME: Image 1 8322 [[attachment:image 1.jpg]] 8323 #+end_example 8324 8325 Without inheritance one would not be able to resolve the link to 8326 =image 1.jpg=, since the link is inside a sub-heading to =Chapter 8327 A=. 8328 8329 Inheritance works the same way for both =ID= and =DIR= property. If 8330 both properties are defined on the same headline then =DIR= takes 8331 precedence. This is also true if inheritance is enabled. If =DIR= 8332 is inherited from a parent node in the outline, that property still 8333 takes precedence over an =ID= property defined on the node itself. 8334 8335 - ~org-attach-method~ :: 8336 #+vindex: org-attach-method 8337 When attaching files using the dispatcher {{{kbd(C-c C-a)}}} it 8338 defaults to copying files. The behavior can be changed by 8339 customizing ~org-attach-method~. Options are Copy, Move/Rename, 8340 Hard link or Symbolic link. 8341 8342 - ~org-attach-preferred-new-method~ :: 8343 #+vindex: org-attach-preferred-new-method 8344 This customization lets you choose the default way to attach to 8345 nodes without existing =ID= and =DIR= property. It defaults to ~id~ 8346 but can also be set to ~dir~, ~ask~ or ~nil~. 8347 8348 - ~org-attach-archive-delete~ :: 8349 #+vindex: org-attach-archive-delete 8350 Configure this to determine if attachments should be deleted or not 8351 when a subtree that has attachments is archived. 8352 8353 - ~org-attach-auto-tag~ :: 8354 #+vindex: org-attach-auto-tag 8355 When attaching files to a heading it will be assigned a tag 8356 according to what is set here. 8357 8358 - ~org-attach-id-to-path-function-list~ :: 8359 #+vindex: org-attach-id-to-path-function-list 8360 When =ID= is used for attachments, the ID is parsed into a part of a 8361 directory-path. See ~org-attach-id-uuid-folder-format~ for the 8362 default function. Define a new one and add it as first element in 8363 ~org-attach-id-to-path-function-list~ if you want the folder 8364 structure in any other way. All functions in this list will be 8365 tried when resolving existing ID's into paths, to maintain backward 8366 compatibility with existing folders in your system. 8367 8368 - ~org-attach-store-link-p~ :: 8369 #+vindex: org-attach-store-link-p 8370 Stores a link to the file that is being attached. The link is 8371 stored in ~org-stored-links~ for later insertion with {{{kbd(C-c 8372 C-l)}}} (see [[*Handling Links]]). Depending on what option is set in 8373 ~org-attach-store-link-p~, the link is stored to either the original 8374 location as a file link, the attachment location as an attachment 8375 link or to the attachment location as a file link. 8376 8377 - ~org-attach-commands~ :: 8378 #+vindex: org-attach-commands 8379 List of all commands used in the attach dispatcher. 8380 8381 - ~org-attach-expert~ :: 8382 #+vindex: org-attach-expert 8383 Do not show the splash buffer with the attach dispatcher when 8384 ~org-attach-expert~ is set to non-~nil~. 8385 8386 See customization group =Org Attach= if you want to change the 8387 default settings. 8388 8389 *** Attachment links 8390 :PROPERTIES: 8391 :DESCRIPTION: Hyperlink access to attachments 8392 :END: 8393 8394 Attached files and folders can be referenced using attachment links. 8395 This makes it easy to refer to the material added to an outline node. 8396 Especially if it was attached using the unique ID of the entry! 8397 8398 #+begin_example 8399 ,* TODO Some task 8400 :PROPERTIES: 8401 :ID: 95d50008-c12e-479f-a4f2-cc0238205319 8402 :END: 8403 See attached document for more information: [[attachment:info.org]] 8404 #+end_example 8405 8406 See [[*External Links]] for more information about these links. 8407 8408 *** Automatic version-control with Git 8409 :PROPERTIES: 8410 :DESCRIPTION: Everything safely stored away 8411 :END: 8412 8413 If the directory attached to an outline node is a Git repository, Org 8414 can be configured to automatically commit changes to that repository 8415 when it sees them. 8416 8417 To make Org mode take care of versioning of attachments for you, add 8418 the following to your Emacs config: 8419 8420 #+begin_src emacs-lisp 8421 (require 'org-attach-git) 8422 #+end_src 8423 8424 *** Attach from Dired 8425 :PROPERTIES: 8426 :DESCRIPTION: Using dired to select an attachment 8427 :END: 8428 #+cindex: attach from Dired 8429 #+findex: org-attach-dired-to-subtree 8430 8431 It is possible to attach files to a subtree from a Dired buffer. To 8432 use this feature, have one window in Dired mode containing the file(s) 8433 to be attached and another window with point in the subtree that shall 8434 get the attachments. In the Dired window, with point on a file, 8435 {{{kbd(M-x org-attach-dired-to-subtree)}}} attaches the file to the 8436 subtree using the attachment method set by variable 8437 ~org-attach-method~. When files are marked in the Dired window then 8438 all marked files get attached. 8439 8440 Add the following lines to the Emacs init file to have {{{kbd(C-c C-x 8441 a)}}} attach files in Dired buffers. 8442 8443 #+begin_src emacs-lisp 8444 (add-hook 'dired-mode-hook 8445 (lambda () 8446 (define-key dired-mode-map 8447 (kbd "C-c C-x a") 8448 #'org-attach-dired-to-subtree))) 8449 #+end_src 8450 8451 The following code shows how to bind the previous command with 8452 a specific attachment method. 8453 8454 #+begin_src emacs-lisp 8455 (add-hook 'dired-mode-hook 8456 (lambda () 8457 (define-key dired-mode-map (kbd "C-c C-x c") 8458 (lambda () 8459 (interactive) 8460 (let ((org-attach-method 'cp)) 8461 (call-interactively #'org-attach-dired-to-subtree)))))) 8462 #+end_src 8463 8464 ** RSS Feeds 8465 :PROPERTIES: 8466 :DESCRIPTION: Getting input from RSS feeds. 8467 :END: 8468 #+cindex: RSS feeds 8469 #+cindex: Atom feeds 8470 8471 Org can add and change entries based on information found in RSS feeds 8472 and Atom feeds. You could use this to make a task out of each new 8473 podcast in a podcast feed. Or you could use a phone-based 8474 note-creating service on the web to import tasks into Org. To access 8475 feeds, configure the variable ~org-feed-alist~. The docstring of this 8476 variable has detailed information. With the following 8477 8478 #+begin_src emacs-lisp 8479 (setq org-feed-alist 8480 '(("Slashdot" 8481 "https://rss.slashdot.org/Slashdot/slashdot" 8482 "~/txt/org/feeds.org" "Slashdot Entries"))) 8483 #+end_src 8484 8485 #+texinfo: @noindent 8486 new items from the feed provided by =rss.slashdot.org= result in new 8487 entries in the file =~/org/feeds.org= under the heading =Slashdot 8488 Entries=, whenever the following command is used: 8489 8490 - {{{kbd(C-c C-x g)}}} (~org-feed-update-all~) :: 8491 8492 #+kindex: C-c C-x g 8493 Collect items from the feeds configured in ~org-feed-alist~ and act 8494 upon them. 8495 8496 - {{{kbd(C-c C-x G)}}} (~org-feed-goto-inbox~) :: 8497 8498 #+kindex: C-c C-x G 8499 Prompt for a feed name and go to the inbox configured for this feed. 8500 8501 Under the same headline, Org creates a drawer =FEEDSTATUS= in which it 8502 stores information about the status of items in the feed, to avoid 8503 adding the same item several times. 8504 8505 For more information, including how to read atom feeds, see 8506 =org-feed.el= and the docstring of ~org-feed-alist~. 8507 8508 * Agenda Views 8509 :PROPERTIES: 8510 :DESCRIPTION: Collecting information into views. 8511 :END: 8512 #+cindex: agenda views 8513 8514 Due to the way Org works, TODO items, time-stamped items, and tagged 8515 headlines can be scattered throughout a file or even a number of 8516 files. To get an overview of open action items, or of events that are 8517 important for a particular date, this information must be collected, 8518 sorted and displayed in an organized way. 8519 8520 Org can select items based on various criteria and display them in 8521 a separate buffer. Six different view types are provided: 8522 8523 - an /agenda/ that is like a calendar and shows information for 8524 specific dates, 8525 8526 - a /TODO list/ that covers all unfinished action items, 8527 8528 - a /match view/, showings headlines based on the tags, properties, 8529 and TODO state associated with them, 8530 8531 - a /text search view/ that shows all entries from multiple files that 8532 contain specified keywords, 8533 8534 - a /stuck projects view/ showing projects that currently do not move 8535 along, and 8536 8537 - /custom views/ that are special searches and combinations of 8538 different views. 8539 8540 The extracted information is displayed in a special /agenda buffer/. 8541 This buffer is read-only, but provides commands to visit the 8542 corresponding locations in the original Org files, and even to edit 8543 these files remotely. 8544 8545 #+vindex: org-agenda-skip-comment-trees 8546 #+vindex: org-agenda-skip-archived-trees 8547 #+cindex: commented entries, in agenda views 8548 #+cindex: archived entries, in agenda views 8549 By default, the report ignores commented (see [[*Comment Lines]]) and 8550 archived (see [[*Internal archiving]]) entries. You can override this by 8551 setting ~org-agenda-skip-comment-trees~ and 8552 ~org-agenda-skip-archived-trees~ to ~nil~. 8553 8554 #+vindex: org-agenda-window-setup 8555 #+vindex: org-agenda-restore-windows-after-quit 8556 Two variables control how the agenda buffer is displayed and whether 8557 the window configuration is restored when the agenda exits: 8558 ~org-agenda-window-setup~ and ~org-agenda-restore-windows-after-quit~. 8559 8560 ** Agenda Files 8561 :PROPERTIES: 8562 :DESCRIPTION: Files being searched for agenda information. 8563 :END: 8564 #+cindex: agenda files 8565 #+cindex: files for agenda 8566 8567 #+vindex: org-agenda-files 8568 The information to be shown is normally collected from all /agenda 8569 files/, the files listed in the variable ~org-agenda-files~[fn:: If 8570 the value of that variable is not a list, but a single file name, then 8571 the list of agenda files in maintained in that external file.]. If a 8572 directory is part of this list, all files with the extension =.org= in 8573 this directory are part of the list. 8574 8575 Thus, even if you only work with a single Org file, that file should 8576 be put into the list[fn:: When using the dispatcher, pressing 8577 {{{kbd(<)}}} before selecting a command actually limits the command to 8578 the current file, and ignores ~org-agenda-files~ until the next 8579 dispatcher command.]. You can customize ~org-agenda-files~, but the 8580 easiest way to maintain it is through the following commands 8581 8582 #+attr_texinfo: :sep and 8583 - {{{kbd(C-c [)}}} (~org-agenda-file-to-front~) :: 8584 8585 #+kindex: C-c [ 8586 #+findex: org-agenda-file-to-front 8587 #+cindex: files, adding to agenda list 8588 Add current file to the list of agenda files. The file is added to 8589 the front of the list. If it was already in the list, it is moved 8590 to the front. With a prefix argument, file is added/moved to the 8591 end. 8592 8593 - {{{kbd(C-c ])}}} (~org-remove-file~) :: 8594 8595 #+kindex: C-c ] 8596 #+findex: org-remove-file 8597 Remove current file from the list of agenda files. 8598 8599 - {{{kbd(C-')}}} and {{{kbd(C-\,)}}} (~org-cycle-agenda-files~) :: 8600 8601 #+kindex: C-' 8602 #+kindex: C-, 8603 #+findex: org-cycle-agenda-files 8604 #+cindex: cycling, of agenda files 8605 Cycle through agenda file list, visiting one file after the other. 8606 8607 - {{{kbd(M-x org-switchb)}}} :: 8608 8609 #+findex: org-switchb 8610 Command to use an Iswitchb-like interface to switch to and between 8611 Org buffers. 8612 8613 #+texinfo: @noindent 8614 The Org menu contains the current list of files and can be used to 8615 visit any of them. 8616 8617 If you would like to focus the agenda temporarily on a file not in 8618 this list, or on just one file in the list, or even on only a subtree 8619 in a file, then this can be done in different ways. For a single 8620 agenda command, you may press {{{kbd(<)}}} once or several times in 8621 the dispatcher (see [[*The Agenda Dispatcher]]). To restrict the agenda 8622 scope for an extended period, use the following commands: 8623 8624 - {{{kbd(C-c C-x <)}}} (~org-agenda-set-restriction-lock~) :: 8625 8626 #+kindex: C-c C-x < 8627 #+findex: org-agenda-set-restriction-lock 8628 Restrict the agenda to the current subtree. If there already is 8629 a restriction at point, remove it. When called with a universal 8630 prefix argument or with point before the first headline in a file, 8631 set the agenda scope to the entire file. This restriction remains 8632 in effect until removed with {{{kbd(C-c C-x >)}}}, or by typing 8633 either {{{kbd(<)}}} or {{{kbd(>)}}} in the agenda dispatcher. If 8634 there is a window displaying an agenda view, the new restriction 8635 takes effect immediately. 8636 8637 - {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) :: 8638 8639 #+kindex: C-c C-x > 8640 #+findex: org-agenda-remove-restriction-lock 8641 Remove the restriction created by {{{kbd(C-c C-x <)}}}. 8642 8643 When working with Speedbar, you can use the following commands in the 8644 Speedbar frame: 8645 8646 - {{{kbd(<)}}} (~org-speedbar-set-agenda-restriction~) :: 8647 8648 #+findex: org-speedbar-set-agenda-restriction 8649 Restrict the agenda to the item---either an Org file or a subtree in 8650 such a file---at point in the Speedbar frame. If agenda is already 8651 restricted there, remove the restriction. If there is a window 8652 displaying an agenda view, the new restriction takes effect 8653 immediately. 8654 8655 - {{{kbd(>)}}} (~org-agenda-remove-restriction-lock~) :: 8656 8657 #+findex: org-agenda-remove-restriction-lock 8658 Remove the restriction. 8659 8660 ** The Agenda Dispatcher 8661 :PROPERTIES: 8662 :DESCRIPTION: Keyboard access to agenda views. 8663 :ALT_TITLE: Agenda Dispatcher 8664 :END: 8665 #+cindex: agenda dispatcher 8666 #+cindex: dispatching agenda commands 8667 8668 The views are created through a dispatcher, accessible with {{{kbd(M-x 8669 org-agenda)}}}, or, better, bound to a global key (see [[*Activation]]). 8670 It displays a menu from which an additional letter is required to 8671 execute a command. The dispatcher offers the following default 8672 commands: 8673 8674 #+attr_texinfo: :sep , 8675 - {{{kbd(a)}}} :: 8676 8677 Create the calendar-like agenda (see [[*Weekly/daily agenda]]). 8678 8679 - {{{kbd(t)}}}, {{{kbd(T)}}} :: 8680 8681 Create a list of all TODO items (see [[*The global TODO list]]). 8682 8683 - {{{kbd(m)}}}, {{{kbd(M)}}} :: 8684 8685 Create a list of headlines matching a given expression (see 8686 [[*Matching tags and properties]]). 8687 8688 - {{{kbd(s)}}} :: 8689 8690 #+kindex: s @r{(Agenda dispatcher)} 8691 Create a list of entries selected by a boolean expression of 8692 keywords and/or regular expressions that must or must not occur in 8693 the entry. 8694 8695 - {{{kbd(/)}}} :: 8696 8697 #+kindex: / @r{(Agenda dispatcher)} 8698 #+vindex: org-agenda-text-search-extra-files 8699 Search for a regular expression in all agenda files and additionally 8700 in the files listed in ~org-agenda-text-search-extra-files~. This 8701 uses the Emacs command ~multi-occur~. A prefix argument can be used 8702 to specify the number of context lines for each match, the default 8703 is 1. 8704 8705 - {{{kbd(#)}}} :: 8706 8707 Create a list of stuck projects (see [[*Stuck projects]]). 8708 8709 - {{{kbd(!)}}} :: 8710 8711 Configure the list of stuck projects (see [[*Stuck projects]]). 8712 8713 - {{{kbd(<)}}} :: 8714 8715 #+kindex: < @r{(Agenda dispatcher)} 8716 Restrict an agenda command to the current buffer[fn:: For backward 8717 compatibility, you can also press {{{kbd(1)}}} to restrict to the 8718 current buffer.]. If narrowing is in effect restrict to the 8719 narrowed part of the buffer. After pressing {{{kbd(<)}}}, you still 8720 need to press the character selecting the command. 8721 8722 - {{{kbd(< <)}}} :: 8723 8724 #+kindex: < < @r{(Agenda dispatcher)} 8725 If there is an active region, restrict the following agenda command 8726 to the region. Otherwise, restrict it to the current subtree[fn:: 8727 For backward compatibility, you can also press {{{kbd(0)}}} to 8728 restrict to the current region/subtree.]. After pressing {{{kbd(< 8729 <)}}}, you still need to press the character selecting the command. 8730 8731 - {{{kbd(*)}}} :: 8732 8733 #+kindex: * @r{(Agenda dispatcher)} 8734 #+vindex: org-agenda-sticky 8735 #+findex: org-toggle-sticky-agenda 8736 Toggle sticky agenda views. By default, Org maintains only a single 8737 agenda buffer and rebuilds it each time you change the view, to make 8738 sure everything is always up to date. If you switch between views 8739 often and the build time bothers you, you can turn on sticky agenda 8740 buffers (make this the default by customizing the variable 8741 ~org-agenda-sticky~). With sticky agendas, the dispatcher only 8742 switches to the selected view, you need to update it by hand with 8743 {{{kbd(r)}}} or {{{kbd(g)}}}. You can toggle sticky agenda view any 8744 time with ~org-toggle-sticky-agenda~. 8745 8746 You can also define custom commands that are accessible through the 8747 dispatcher, just like the default commands. This includes the 8748 possibility to create extended agenda buffers that contain several 8749 blocks together, for example the weekly agenda, the global TODO list 8750 and a number of special tags matches. See [[*Custom Agenda Views]]. 8751 8752 ** The Built-in Agenda Views 8753 :PROPERTIES: 8754 :DESCRIPTION: What is available out of the box? 8755 :ALT_TITLE: Built-in Agenda Views 8756 :END: 8757 8758 In this section we describe the built-in views. 8759 8760 *** Weekly/daily agenda 8761 :PROPERTIES: 8762 :DESCRIPTION: The calendar page with current tasks. 8763 :END: 8764 #+cindex: agenda 8765 #+cindex: weekly agenda 8766 #+cindex: daily agenda 8767 8768 The purpose of the weekly/daily /agenda/ is to act like a page of 8769 a paper agenda, showing all the tasks for the current week or day. 8770 8771 - {{{kbd(M-x org-agenda a)}}} (~org-agenda-list~) :: 8772 8773 #+kindex: a @r{(Agenda dispatcher)} 8774 #+findex: org-agenda-list 8775 #+cindex: org-agenda, command 8776 Compile an agenda for the current week from a list of Org files. 8777 The agenda shows the entries for each day. With a numeric prefix 8778 argument[fn:32]---like {{{kbd(C-u 2 1 M-x org-agenda a)}}}---you may 8779 set the number of days to be displayed. 8780 8781 #+vindex: org-agenda-span 8782 #+vindex: org-agenda-start-day 8783 #+vindex: org-agenda-start-on-weekday 8784 The default number of days displayed in the agenda is set by the 8785 variable ~org-agenda-span~. This variable can be set to any number of 8786 days you want to see by default in the agenda, or to a span name, such 8787 a ~day~, ~week~, ~month~ or ~year~. For weekly agendas, the default 8788 is to start on the previous Monday (see 8789 ~org-agenda-start-on-weekday~). You can also set the start date using 8790 a date shift: =(setq org-agenda-start-day "+10d")= starts the agenda 8791 ten days from today in the future. 8792 8793 Remote editing from the agenda buffer means, for example, that you can 8794 change the dates of deadlines and appointments from the agenda buffer. 8795 The commands available in the Agenda buffer are listed in [[*Commands in 8796 the Agenda Buffer]]. 8797 8798 **** Calendar/Diary integration 8799 :PROPERTIES: 8800 :UNNUMBERED: notoc 8801 :END: 8802 #+cindex: calendar integration 8803 #+cindex: diary integration 8804 8805 Emacs contains the calendar and diary by Edward\nbsp{}M.\nbsp{}Reingold. The 8806 calendar displays a three-month calendar with holidays from different 8807 countries and cultures. The diary allows you to keep track of 8808 anniversaries, lunar phases, sunrise/set, recurrent appointments 8809 (weekly, monthly) and more. In this way, it is quite complementary to 8810 Org. It can be very useful to combine output from Org with the diary. 8811 8812 In order to include entries from the Emacs diary into Org mode's 8813 agenda, you only need to customize the variable 8814 8815 #+begin_src emacs-lisp 8816 (setq org-agenda-include-diary t) 8817 #+end_src 8818 8819 #+texinfo: @noindent 8820 After that, everything happens automatically. All diary entries 8821 including holidays, anniversaries, etc., are included in the agenda 8822 buffer created by Org mode. {{{kbd(SPC)}}}, {{{kbd(TAB)}}}, and 8823 {{{kbd(RET)}}} can be used from the agenda buffer to jump to the diary 8824 file in order to edit existing diary entries. The {{{kbd(i)}}} 8825 command to insert new entries for the current date works in the agenda 8826 buffer, as well as the commands {{{kbd(S)}}}, {{{kbd(M)}}}, and 8827 {{{kbd(C)}}} to display Sunrise/Sunset times, show lunar phases and to 8828 convert to other calendars, respectively. {{{kbd(c)}}} can be used to 8829 switch back and forth between calendar and agenda. 8830 8831 If you are using the diary only for expression entries and holidays, 8832 it is faster to not use the above setting, but instead to copy or even 8833 move the entries into an Org file. Org mode evaluates diary-style 8834 expression entries, and does it faster because there is no overhead 8835 for first creating the diary display. Note that the expression 8836 entries must start at the left margin, no whitespace is allowed before 8837 them, as seen in the following segment of an Org file:[fn:: The 8838 variable ~org-anniversary~ used in the example is just like 8839 ~diary-anniversary~, but the argument order is always according to ISO 8840 and therefore independent of the value of ~calendar-date-style~.] 8841 8842 #+begin_example 8843 ,* Holidays 8844 :PROPERTIES: 8845 :CATEGORY: Holiday 8846 :END: 8847 %%(org-calendar-holiday) ; special function for holiday names 8848 8849 ,* Birthdays 8850 :PROPERTIES: 8851 :CATEGORY: Ann 8852 :END: 8853 %%(org-anniversary 1956 5 14) Arthur Dent is %d years old 8854 %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old 8855 #+end_example 8856 8857 **** Anniversaries from BBDB 8858 :PROPERTIES: 8859 :UNNUMBERED: notoc 8860 :END: 8861 #+cindex: BBDB, anniversaries 8862 #+cindex: anniversaries, from BBDB 8863 8864 #+findex: org-bbdb-anniversaries 8865 If you are using the Insidious Big Brother Database to store your 8866 contacts, you very likely prefer to store anniversaries in BBDB rather 8867 than in a separate Org or diary file. Org supports this and can show 8868 BBDB anniversaries as part of the agenda. All you need to do is to 8869 add the following to one of your agenda files: 8870 8871 #+begin_example 8872 ,* Anniversaries 8873 :PROPERTIES: 8874 :CATEGORY: Anniv 8875 :END: 8876 %%(org-bbdb-anniversaries) 8877 #+end_example 8878 8879 You can then go ahead and define anniversaries for a BBDB record. 8880 Basically, you need a field named =anniversary= for the BBDB record 8881 which contains the date in the format =YYYY-MM-DD= or =MM-DD=, 8882 followed by a space and the class of the anniversary (=birthday=, 8883 =wedding=, or a format string). If you omit the class, it defaults to 8884 =birthday=. Here are a few examples, the header for the file 8885 =ol-bbdb.el= contains more detailed information. 8886 8887 #+begin_example 8888 1973-06-22 8889 06-22 8890 1955-08-02 wedding 8891 2008-04-14 %s released version 6.01 of Org mode, %d years ago 8892 #+end_example 8893 8894 After a change to BBDB, or for the first agenda display during an 8895 Emacs session, the agenda display suffers a short delay as Org updates 8896 its hash with anniversaries. However, from then on things will be 8897 very fast, much faster in fact than a long list of 8898 =%%(diary-anniversary)= entries in an Org or Diary file. 8899 8900 #+findex: org-bbdb-anniversaries-future 8901 If you would like to see upcoming anniversaries with a bit of 8902 forewarning, you can use the following instead: 8903 8904 #+begin_example 8905 ,* Anniversaries 8906 :PROPERTIES: 8907 :CATEGORY: Anniv 8908 :END: 8909 %%(org-bbdb-anniversaries-future 3) 8910 #+end_example 8911 8912 That will give you three days' warning: on the anniversary date itself 8913 and the two days prior. The argument is optional: if omitted, it 8914 defaults to 7. 8915 8916 **** Appointment reminders 8917 :PROPERTIES: 8918 :UNNUMBERED: notoc 8919 :END: 8920 #+cindex: @file{appt.el} 8921 #+cindex: appointment reminders 8922 #+cindex: appointment 8923 #+cindex: reminders 8924 8925 #+cindex: APPT_WARNTIME, keyword 8926 Org can interact with Emacs appointments notification facility. To 8927 add the appointments of your agenda files, use the command 8928 ~org-agenda-to-appt~. This command lets you filter through the list 8929 of your appointments and add only those belonging to a specific 8930 category or matching a regular expression. It also reads 8931 a =APPT_WARNTIME= property which overrides the value of 8932 ~appt-message-warning-time~ for this appointment. See the docstring 8933 for details. 8934 8935 *** The global TODO list 8936 :PROPERTIES: 8937 :DESCRIPTION: All unfinished action items. 8938 :ALT_TITLE: Global TODO list 8939 :END: 8940 #+cindex: global TODO list 8941 #+cindex: TODO list, global 8942 8943 The global TODO list contains all unfinished TODO items formatted and 8944 collected into a single place. 8945 8946 - {{{kbd(M-x org-agenda t)}}} (~org-todo-list~) :: 8947 8948 #+kindex: t @r{(Agenda dispatcher)} 8949 #+findex: org-todo-list 8950 Show the global TODO list. This collects the TODO items from all 8951 agenda files (see [[*Agenda Views]]) into a single buffer. By default, 8952 this lists items with a state that is not a DONE state. The buffer 8953 is in Agenda mode, so there are commands to examine and manipulate 8954 the TODO entries directly from that buffer (see [[*Commands in the 8955 Agenda Buffer]]). 8956 8957 - {{{kbd(M-x org-agenda T)}}} (~org-todo-list~) :: 8958 8959 #+kindex: T @r{(Agenda dispatcher)} 8960 #+findex: org-todo-list 8961 #+cindex: TODO keyword matching 8962 #+vindex: org-todo-keywords 8963 Like the above, but allows selection of a specific TODO keyword. 8964 You can also do this by specifying a prefix argument to 8965 {{{kbd(t)}}}. You are prompted for a keyword, and you may also 8966 specify several keywords by separating them with =|= as the boolean 8967 OR operator. With a numeric prefix, the Nth keyword in 8968 ~org-todo-keywords~ is selected. 8969 8970 #+kindex: r 8971 The {{{kbd(r)}}} key in the agenda buffer regenerates it, and you 8972 can give a prefix argument to this command to change the selected 8973 TODO keyword, for example {{{kbd(3 r)}}}. If you often need 8974 a search for a specific keyword, define a custom command for it (see 8975 [[*The Agenda Dispatcher]]). 8976 8977 Matching specific TODO keywords can also be done as part of a tags 8978 search (see [[*Tag Searches]]). 8979 8980 Remote editing of TODO items means that you can change the state of 8981 a TODO entry with a single key press. The commands available in the 8982 TODO list are described in [[*Commands in the Agenda Buffer]]. 8983 8984 #+cindex: sublevels, inclusion into TODO list 8985 Normally the global TODO list simply shows all headlines with TODO 8986 keywords. This list can become very long. There are two ways to keep 8987 it more compact: 8988 8989 - 8990 #+vindex: org-agenda-todo-ignore-scheduled 8991 #+vindex: org-agenda-todo-ignore-deadlines 8992 #+vindex: org-agenda-todo-ignore-timestamp 8993 #+vindex: org-agenda-todo-ignore-with-date 8994 Some people view a TODO item that has been /scheduled/ for execution 8995 or have a /deadline/ (see [[*Timestamps]]) as no longer /open/. 8996 Configure the variables ~org-agenda-todo-ignore-scheduled~ to 8997 exclude some or all scheduled items from the global TODO list, 8998 ~org-agenda-todo-ignore-deadlines~ to exclude some or all items with 8999 a deadline set, ~org-agenda-todo-ignore-timestamp~ to exclude some 9000 or all items with an active timestamp other than a DEADLINE or 9001 a SCHEDULED timestamp and/or ~org-agenda-todo-ignore-with-date~ to 9002 exclude items with at least one active timestamp. 9003 9004 - 9005 #+vindex: org-agenda-todo-list-sublevels 9006 TODO items may have sublevels to break up the task into subtasks. 9007 In such cases it may be enough to list only the highest level TODO 9008 headline and omit the sublevels from the global list. Configure the 9009 variable ~org-agenda-todo-list-sublevels~ to get this behavior. 9010 9011 *** Matching tags and properties 9012 :PROPERTIES: 9013 :DESCRIPTION: Structured information with fine-tuned search. 9014 :END: 9015 #+cindex: matching, of tags 9016 #+cindex: matching, of properties 9017 #+cindex: tags view 9018 #+cindex: match view 9019 9020 If headlines in the agenda files are marked with /tags/ (see [[*Tags]]), 9021 or have properties (see [[*Properties and Columns]]), you can select 9022 headlines based on this metadata and collect them into an agenda 9023 buffer. The match syntax described here also applies when creating 9024 sparse trees with {{{kbd(C-c / m)}}}. 9025 9026 - {{{kbd(M-x org-agenda m)}}} (~org-tags-view~) :: 9027 9028 #+kindex: m @r{(Agenda dispatcher)} 9029 #+findex: org-tags-view 9030 Produce a list of all headlines that match a given set of tags. The 9031 command prompts for a selection criterion, which is a boolean logic 9032 expression with tags, like =+work+urgent-withboss= or =work|home= 9033 (see [[*Tags]]). If you often need a specific search, define a custom 9034 command for it (see [[*The Agenda Dispatcher]]). 9035 9036 - {{{kbd(M-x org-agenda M)}}} (~org-tags-view~) :: 9037 9038 #+kindex: M @r{(Agenda dispatcher)} 9039 #+findex: org-tags-view 9040 #+vindex: org-tags-match-list-sublevels 9041 #+vindex: org-agenda-tags-todo-honor-ignore-options 9042 Like {{{kbd(m)}}}, but only select headlines that are also TODO 9043 items and force checking subitems (see the variable 9044 ~org-tags-match-list-sublevels~). To exclude scheduled/deadline 9045 items, see the variable ~org-agenda-tags-todo-honor-ignore-options~. 9046 Matching specific TODO keywords together with a tags match is also 9047 possible, see [[*Tag Searches]]. 9048 9049 The commands available in the tags list are described in [[*Commands in 9050 the Agenda Buffer]]. 9051 9052 #+cindex: boolean logic, for agenda searches 9053 A search string can use Boolean operators =&= for AND and =|= for OR. 9054 =&= binds more strongly than =|=. Parentheses are currently not 9055 implemented. Each element in the search is either a tag, a regular 9056 expression matching tags, or an expression like =PROPERTY OPERATOR 9057 VALUE= with a comparison operator, accessing a property value. Each 9058 element may be preceded by =-= to select against it, and =+= is 9059 syntactic sugar for positive selection. The AND operator =&= is 9060 optional when =+= or =-= is present. Here are some examples, using 9061 only tags. 9062 9063 - =+work-boss= :: 9064 9065 Select headlines tagged =work=, but discard those also tagged 9066 =boss=. 9067 9068 - =work|laptop= :: 9069 9070 Selects lines tagged =work= or =laptop=. 9071 9072 - =work|laptop+night= :: 9073 9074 Like before, but require the =laptop= lines to be tagged also 9075 =night=. 9076 9077 #+cindex: regular expressions, with tags search 9078 Instead of a tag, you may also specify a regular expression enclosed 9079 in curly braces (see [[*Regular Expressions]]). For example, 9080 =work+{^boss.*}= matches headlines that contain the tag =:work:= and 9081 any tag /starting/ with =boss=. 9082 9083 #+cindex: group tags, as regular expressions 9084 Group tags (see [[*Tag Hierarchy]]) are expanded as regular expressions. 9085 E.g., if =work= is a group tag for the group =:work:lab:conf:=, then 9086 searching for =work= also searches for ={\(?:work\|lab\|conf\)}= and 9087 searching for =-work= searches for all headlines but those with one of 9088 the tags in the group (i.e., =-{\(?:work\|lab\|conf\)}=). 9089 9090 #+cindex: TODO keyword matching, with tags search 9091 #+cindex: level, for tags/property match 9092 #+cindex: category, for tags/property match 9093 #+vindex: org-odd-levels-only 9094 You may also test for properties (see [[*Properties and Columns]]) at the 9095 same time as matching tags. The properties may be real properties, or 9096 special properties that represent other metadata (see [[*Special 9097 Properties]]). For example, the property =TODO= represents the TODO 9098 keyword of the entry. Or, the property =LEVEL= represents the level 9099 of an entry. So searching =+LEVEL=3+boss-TODO="DONE"= lists all level 9100 three headlines that have the tag =boss= and are /not/ marked with the 9101 TODO keyword =DONE=. In buffers with ~org-odd-levels-only~ set, 9102 =LEVEL= does not count the number of stars, but =LEVEL=2= corresponds 9103 to 3 stars etc. 9104 9105 Here are more examples: 9106 9107 - =work+TODO="WAITING"= :: 9108 9109 Select =work=-tagged TODO lines with the specific TODO keyword 9110 =WAITING=. 9111 9112 - =work+TODO="WAITING"|home+TODO="WAITING"= :: 9113 9114 Waiting tasks both at work and at home. 9115 9116 When matching properties, a number of different operators can be used 9117 to test the value of a property. Here is a complex example: 9118 9119 #+begin_example 9120 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<2 9121 +With={Sarah\|Denny}+SCHEDULED>="<2008-10-11>" 9122 #+end_example 9123 9124 #+texinfo: @noindent 9125 The type of comparison depends on how the comparison value is written: 9126 9127 - If the comparison value is a plain number, a numerical comparison is 9128 done, and the allowed operators are =<=, ===, =>=, =<==, =>==, and 9129 =<>=. 9130 9131 - If the comparison value is enclosed in double-quotes, a string 9132 comparison is done, and the same operators are allowed. 9133 9134 - If the comparison value is enclosed in double-quotes /and/ angular 9135 brackets (like =DEADLINE<="<2008-12-24 18:30>"=), both values are 9136 assumed to be date/time specifications in the standard Org way, and 9137 the comparison is done accordingly. Valid values also include 9138 ="<now>"= for now (including time), ="<today>"=, and ="<tomorrow>"= 9139 for these days at 0:00 hours, i.e., without a time specification. 9140 You can also use strings like ="<+5d>"= or ="<-2m>"= with units =d=, 9141 =w=, =m=, and =y= for day, week, month, and year, respectively. 9142 9143 - If the comparison value is enclosed in curly braces, a regexp match 9144 is performed, with === meaning that the regexp matches the property 9145 value, and =<>= meaning that it does not match. 9146 9147 So the search string in the example finds entries tagged =work= but 9148 not =boss=, which also have a priority value =A=, a =Coffee= property 9149 with the value =unlimited=, an =EFFORT= property that is numerically 9150 smaller than 2, a =With= property that is matched by the regular 9151 expression =Sarah\|Denny=, and that are scheduled on or after October 9152 11, 2008. 9153 9154 You can configure Org mode to use property inheritance during 9155 a search, but beware that this can slow down searches considerably. 9156 See [[*Property Inheritance]], for details. 9157 9158 For backward compatibility, and also for typing speed, there is also 9159 a different way to test TODO states in a search. For this, terminate 9160 the tags/property part of the search string (which may include several 9161 terms connected with =|=) with a =/= and then specify a Boolean 9162 expression just for TODO keywords. The syntax is then similar to that 9163 for tags, but should be applied with care: for example, a positive 9164 selection on several TODO keywords cannot meaningfully be combined 9165 with boolean AND. However, /negative selection/ combined with AND can 9166 be meaningful. To make sure that only lines are checked that actually 9167 have any TODO keyword (resulting in a speed-up), use {{{kbd(M-x 9168 org-agenda M)}}}, or equivalently start the TODO part after the slash 9169 with =!=. Using {{{kbd(M-x org-agenda M)}}} or =/!= does not match 9170 TODO keywords in a DONE state. Examples: 9171 9172 - =work/WAITING= :: 9173 9174 Same as =work+TODO="WAITING"=. 9175 9176 - =work/!-WAITING-NEXT= :: 9177 9178 Select =work=-tagged TODO lines that are neither =WAITING= nor 9179 =NEXT=. 9180 9181 - =work/!+WAITING|+NEXT= :: 9182 9183 Select =work=-tagged TODO lines that are either =WAITING= or =NEXT=. 9184 9185 *** Search view 9186 :PROPERTIES: 9187 :DESCRIPTION: Find entries by searching for text. 9188 :END: 9189 #+cindex: search view 9190 #+cindex: text search 9191 #+cindex: searching, for text 9192 9193 This agenda view is a general text search facility for Org mode 9194 entries. It is particularly useful to find notes. 9195 9196 - {{{kbd(M-x org-agenda s)}}} (~org-search-view~) :: 9197 9198 #+kindex: s @r{(Agenda dispatcher)} 9199 #+findex: org-search-view 9200 This is a special search that lets you select entries by matching 9201 a substring or specific words using a boolean logic. 9202 9203 For example, the search string =computer equipment= matches entries 9204 that contain =computer equipment= as a substring, even if the two 9205 words are separated by more space or a line break. 9206 9207 Search view can also search for specific keywords in the entry, using 9208 Boolean logic. The search string =+computer 9209 +wifi -ethernet -{8\.11[bg]}= matches note entries that contain the 9210 keywords =computer= and =wifi=, but not the keyword =ethernet=, and 9211 which are also not matched by the regular expression =8\.11[bg]=, 9212 meaning to exclude both =8.11b= and =8.11g=. The first =+= is 9213 necessary to turn on boolean search, other =+= characters are 9214 optional. For more details, see the docstring of the command 9215 ~org-search-view~. 9216 9217 You can incrementally and conveniently adjust a boolean search from 9218 the agenda search view with the following keys 9219 9220 #+attr_texinfo: :columns 0.1 0.6 9221 | {{{kbd([)}}} | Add a positive search word | 9222 | {{{kbd(])}}} | Add a negative search word | 9223 | {{{kbd({)}}} | Add a positive regular expression | 9224 | {{{kbd(})}}} | Add a negative regular expression | 9225 9226 #+vindex: org-agenda-text-search-extra-files 9227 Note that in addition to the agenda files, this command also searches 9228 the files listed in ~org-agenda-text-search-extra-files~. 9229 9230 *** Stuck projects 9231 :PROPERTIES: 9232 :DESCRIPTION: Find projects you need to review. 9233 :END: 9234 #+pindex: GTD, Getting Things Done 9235 9236 If you are following a system like David Allen's GTD to organize your 9237 work, one of the "duties" you have is a regular review to make sure 9238 that all projects move along. A /stuck/ project is a project that has 9239 no defined next actions, so it never shows up in the TODO lists Org 9240 mode produces. During the review, you need to identify such projects 9241 and define next actions for them. 9242 9243 - {{{kbd(M-x org-agenda #)}}} (~org-agenda-list-stuck-projects~) :: 9244 9245 #+kindex: # @r{(Agenda dispatcher)} 9246 #+findex: org-agenda-list-stuck-projects 9247 List projects that are stuck. 9248 9249 - {{{kbd(M-x org-agenda !)}}} :: 9250 9251 #+kindex: ! @r{(Agenda dispatcher)} 9252 #+vindex: org-stuck-projects 9253 Customize the variable ~org-stuck-projects~ to define what a stuck 9254 project is and how to find it. 9255 9256 You almost certainly need to configure this view before it works for 9257 you. The built-in default assumes that all your projects are level-2 9258 headlines, and that a project is not stuck if it has at least one 9259 entry marked with a TODO keyword =TODO= or =NEXT= or =NEXTACTION=. 9260 9261 Let's assume that you, in your own way of using Org mode, identify 9262 projects with a tag =:PROJECT:=, and that you use a TODO keyword 9263 =MAYBE= to indicate a project that should not be considered yet. 9264 Let's further assume that the TODO keyword =DONE= marks finished 9265 projects, and that =NEXT= and =TODO= indicate next actions. The tag 9266 =:@shop:= indicates shopping and is a next action even without the 9267 NEXT tag. Finally, if the project contains the special word =IGNORE= 9268 anywhere, it should not be listed either. In this case you would 9269 start by identifying eligible projects with a tags/TODO match (see 9270 [[*Tag Searches]]) =+PROJECT/-MAYBE-DONE=, and then check for =TODO=, 9271 =NEXT=, =@shop=, and =IGNORE= in the subtree to identify projects that 9272 are not stuck. The correct customization for this is: 9273 9274 #+begin_src emacs-lisp 9275 (setq org-stuck-projects 9276 '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@shop") 9277 "\\<IGNORE\\>")) 9278 #+end_src 9279 9280 Note that if a project is identified as non-stuck, the subtree of this 9281 entry is searched for stuck projects. 9282 9283 ** Presentation and Sorting 9284 :PROPERTIES: 9285 :DESCRIPTION: How agenda items are prepared for display. 9286 :END: 9287 #+cindex: presentation, of agenda items 9288 9289 #+vindex: org-agenda-prefix-format 9290 #+vindex: org-agenda-tags-column 9291 Before displaying items in an agenda view, Org mode visually prepares 9292 the items and sorts them. Each item occupies a single line. The line 9293 starts with a /prefix/ that contains the /category/ (see [[*Categories]]) 9294 of the item and other important information. You can customize in 9295 which column tags are displayed through ~org-agenda-tags-column~. You 9296 can also customize the prefix using the option 9297 ~org-agenda-prefix-format~. This prefix is followed by a cleaned-up 9298 version of the outline headline associated with the item. 9299 9300 *** Categories 9301 :PROPERTIES: 9302 :DESCRIPTION: Not all tasks are equal. 9303 :END: 9304 #+cindex: category 9305 #+cindex: @samp{CATEGORY}, keyword 9306 9307 The category is a broad label assigned to each agenda item. By 9308 default, the category is simply derived from the file name, but you 9309 can also specify it with a special line in the buffer, like 9310 this: 9311 9312 : #+CATEGORY: Thesis 9313 9314 #+cindex: @samp{CATEGORY}, property 9315 If you would like to have a special category for a single entry or 9316 a (sub)tree, give the entry a =CATEGORY= property with the special 9317 category you want to apply as the value. 9318 9319 #+vindex: org-agenda-category-icon-alist 9320 The display in the agenda buffer looks best if the category is not 9321 longer than 10 characters. You can set up icons for category by 9322 customizing the ~org-agenda-category-icon-alist~ variable. 9323 9324 *** Time-of-day specifications 9325 :PROPERTIES: 9326 :DESCRIPTION: How the agenda knows the time. 9327 :END: 9328 #+cindex: time-of-day specification 9329 9330 Org mode checks each agenda item for a time-of-day specification. The 9331 time can be part of the timestamp that triggered inclusion into the 9332 agenda, for example 9333 9334 : <2005-05-10 Tue 19:00> 9335 9336 #+texinfo: @noindent 9337 Time ranges can be specified with two timestamps: 9338 9339 : <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15> 9340 9341 #+vindex: org-agenda-search-headline-for-time 9342 In the headline of the entry itself, a time(range)---like =12:45= or a 9343 =8:30-1pm=---may also appear as plain text[fn:: You can, however, 9344 disable this by setting ~org-agenda-search-headline-for-time~ variable 9345 to a ~nil~ value.]. 9346 9347 If the agenda integrates the Emacs diary (see [[*Weekly/daily agenda]]), 9348 time specifications in diary entries are recognized as well. 9349 9350 For agenda display, Org mode extracts the time and displays it in 9351 a standard 24 hour format as part of the prefix. The example times in 9352 the previous paragraphs would end up in the agenda like this: 9353 9354 #+begin_example 9355 8:30-13:00 Arthur Dent lies in front of the bulldozer 9356 12:45...... Ford Prefect arrives and takes Arthur to the pub 9357 19:00...... The Vogon reads his poem 9358 20:30-22:15 Marvin escorts the Hitchhikers to the bridge 9359 #+end_example 9360 9361 #+cindex: time grid 9362 If the agenda is in single-day mode, or for the display of today, the 9363 timed entries are embedded in a time grid, like 9364 9365 #+begin_example 9366 8:00...... ------------------ 9367 8:30-13:00 Arthur Dent lies in front of the bulldozer 9368 10:00...... ------------------ 9369 12:00...... ------------------ 9370 12:45...... Ford Prefect arrives and takes Arthur to the pub 9371 14:00...... ------------------ 9372 16:00...... ------------------ 9373 18:00...... ------------------ 9374 19:00...... The Vogon reads his poem 9375 20:00...... ------------------ 9376 20:30-22:15 Marvin escorts the Hitchhikers to the bridge 9377 #+end_example 9378 9379 #+vindex: org-agenda-use-time-grid 9380 #+vindex: org-agenda-time-grid 9381 The time grid can be turned on and off with the variable 9382 ~org-agenda-use-time-grid~, and can be configured with 9383 ~org-agenda-time-grid~. 9384 9385 *** Sorting of agenda items 9386 :PROPERTIES: 9387 :DESCRIPTION: The order of things. 9388 :END: 9389 #+cindex: sorting, of agenda items 9390 #+cindex: priorities, of agenda items 9391 9392 Before being inserted into a view, the items are sorted. How this is 9393 done depends on the type of view. 9394 9395 - 9396 #+vindex: org-agenda-files 9397 For the daily/weekly agenda, the items for each day are sorted. The 9398 default order is to first collect all items containing an explicit 9399 time-of-day specification. These entries are shown at the beginning 9400 of the list, as a /schedule/ for the day. After that, items remain 9401 grouped in categories, in the sequence given by ~org-agenda-files~. 9402 Within each category, items are sorted by priority (see 9403 [[*Priorities]]), which is composed of the base priority (2000 for 9404 priority =A=, 1000 for =B=, and 0 for =C=), plus additional 9405 increments for overdue scheduled or deadline items. 9406 9407 - For the TODO list, items remain in the order of categories, but 9408 within each category, sorting takes place according to priority (see 9409 [[*Priorities]]). The priority used for sorting derives from the 9410 priority cookie, with additions depending on how close an item is to 9411 its due or scheduled date. 9412 9413 - For tags matches, items are not sorted at all, but just appear in 9414 the sequence in which they are found in the agenda files. 9415 9416 #+vindex: org-agenda-sorting-strategy 9417 Sorting can be customized using the variable 9418 ~org-agenda-sorting-strategy~, and may also include criteria based on 9419 the estimated effort of an entry (see [[*Effort Estimates]]). 9420 9421 *** Filtering/limiting agenda items 9422 :PROPERTIES: 9423 :DESCRIPTION: Dynamically narrow the agenda. 9424 :END: 9425 9426 #+vindex: org-agenda-category-filter-preset 9427 #+vindex: org-agenda-tag-filter-preset 9428 #+vindex: org-agenda-effort-filter-preset 9429 #+vindex: org-agenda-regexp-filter-preset 9430 Agenda built-in or custom commands are statically defined. Agenda 9431 filters and limits allow to flexibly narrow down the list of agenda 9432 entries. 9433 9434 /Filters/ only change the visibility of items, are very fast and are 9435 mostly used interactively[fn:33]. You can switch quickly between 9436 different filters without having to recreate the agenda. /Limits/ on 9437 the other hand take effect before the agenda buffer is populated, so 9438 they are mostly useful when defined as local variables within custom 9439 agenda commands. 9440 9441 **** Filtering in the agenda 9442 :PROPERTIES: 9443 :UNNUMBERED: notoc 9444 :END: 9445 #+cindex: agenda filtering 9446 #+cindex: filtering entries, in agenda 9447 #+cindex: tag filtering, in agenda 9448 #+cindex: category filtering, in agenda 9449 #+cindex: top headline filtering, in agenda 9450 #+cindex: effort filtering, in agenda 9451 #+cindex: query editing, in agenda 9452 9453 The general filtering command is ~org-agenda-filter~, bound to 9454 {{{kbd(/)}}}. Before we introduce it, we describe commands for 9455 individual filter types. All filtering commands handle prefix 9456 arguments in the same way: A single {{{kbd(C-u)}}} prefix negates the 9457 filter, so it removes lines selected by the filter. A double prefix 9458 adds the new filter condition to the one(s) already in place, so 9459 filter elements are accumulated. 9460 9461 - {{{kbd(\)}}} (~org-agenda-filter-by-tag~) :: 9462 9463 #+findex: org-agenda-filter-by-tag 9464 Filter the agenda view with respect to a tag. You are prompted for 9465 a tag selection letter; {{{kbd(SPC)}}} means any tag at all. 9466 Pressing {{{kbd(TAB)}}} at that prompt offers completion to select a 9467 tag, including any tags that do not have a selection character. The 9468 command then hides all entries that do not contain or inherit this 9469 tag. Pressing {{{kbd(+)}}} or {{{kbd(-)}}} at the prompt switches 9470 between filtering for and against the next tag. To clear the 9471 filter, press {{{kbd(\)}}} twice (once to call the command again, 9472 and once at the prompt). 9473 9474 - {{{kbd(<)}}} (~org-agenda-filter-by-category~) :: 9475 9476 #+findex: org-agenda-filter-by-category 9477 Filter by category of the line at point, and show only entries with 9478 this category. When called with a prefix argument, hide all entries 9479 with the category at point. To clear the filter, call this command 9480 again by pressing {{{kbd(<)}}}. 9481 9482 - {{{kbd(=)}}} (~org-agenda-filter-by-regexp~) :: 9483 9484 #+findex: org-agenda-filter-by-regexp 9485 Filter the agenda view by a regular expression: only show agenda 9486 entries matching the regular expression the user entered. To clear 9487 the filter, call the command again by pressing {{{kbd(=)}}}. 9488 9489 - {{{kbd(_)}}} (~org-agenda-filter-by-effort~) :: 9490 9491 #+findex: org-agenda-filter-by-effort 9492 Filter the agenda view with respect to effort estimates, so select 9493 tasks that take the right amount of time. You first need to set up 9494 a list of efforts globally, for example 9495 9496 #+begin_src emacs-lisp 9497 (setq org-global-properties 9498 '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00"))) 9499 #+end_src 9500 9501 #+vindex: org-sort-agenda-noeffort-is-high 9502 You can then filter for an effort by first typing an operator, one 9503 of {{{kbd(<)}}}, {{{kbd(>)}}} and {{{kbd(=)}}}, and then the 9504 one-digit index of an effort estimate in your array of allowed 9505 values, where {{{kbd(0)}}} means the 10th value. The filter then 9506 restricts to entries with effort smaller-or-equal, equal, or 9507 larger-or-equal than the selected value. For application of the 9508 operator, entries without a defined effort are treated according to 9509 the value of ~org-sort-agenda-noeffort-is-high~. To clear the 9510 filter, press {{{kbd(_)}}} twice (once to call the command again, 9511 and once at the first prompt). 9512 9513 - {{{kbd(^)}}} (~org-agenda-filter-by-top-headline~) :: 9514 9515 #+findex: org-agenda-filter-by-top-headline 9516 Filter the current agenda view and only display items that fall 9517 under the same top-level headline as the current entry. To clear 9518 the filter, call this command again by pressing {{{kbd(^)}}}. 9519 9520 - {{{kbd(/)}}} (~org-agenda-filter~) :: 9521 9522 #+findex: org-agenda-filter 9523 This is the unified interface to four of the five filter methods 9524 described above. At the prompt, specify different filter elements 9525 in a single string, with full completion support. For example, 9526 9527 : +work-John+<0:10-/plot/ 9528 9529 selects entries with category =work= and effort estimates below 10 9530 minutes, and deselects entries with tag =John= or matching the 9531 regexp =plot= (see [[*Regular Expressions]]). You can leave =+= out if 9532 that does not lead to ambiguities. The sequence of elements is 9533 arbitrary. The filter syntax assumes that there is no overlap 9534 between categories and tags. Otherwise, tags take priority. If you 9535 reply to the prompt with the empty string, all filtering is removed. 9536 If a filter is specified, it replaces all current filters. But if 9537 you call the command with a double prefix argument, or if you add an 9538 additional =+= (e.g., =++work=) to the front of the string, the new 9539 filter elements are added to the active ones. A single prefix 9540 argument applies the entire filter in a negative sense. 9541 9542 - {{{kbd(|)}}} (~org-agenda-filter-remove-all~) :: 9543 9544 Remove all filters in the current agenda view. 9545 9546 **** Computed tag filtering 9547 :PROPERTIES: 9548 :UNNUMBERED: notoc 9549 :END: 9550 9551 #+vindex: org-agenda-auto-exclude-function 9552 If the variable ~org-agenda-auto-exclude-function~ is set to 9553 a user-defined function, that function can select tags that should be 9554 used as a tag filter when requested. The function will be called with 9555 lower-case versions of all tags represented in the current view. The 9556 function should return ="-tag"= if the filter should remove 9557 entries with that tag, ="+tag"= if only entries with this tag should 9558 be kept, or =nil= if that tag is irrelevant. For example, let's say 9559 you use a =Net= tag to identify tasks which need network access, an 9560 =Errand= tag for errands in town, and a =Call= tag for making phone 9561 calls. You could auto-exclude these tags based on the availability of 9562 the Internet, and outside of business hours, with something like this: 9563 9564 #+begin_src emacs-lisp 9565 (defun my-auto-exclude-fn (tag) 9566 (when (cond ((string= tag "net") 9567 (/= 0 (call-process "/sbin/ping" nil nil nil 9568 "-c1" "-q" "-t1" "mail.gnu.org"))) 9569 ((member tag '("errand" "call")) 9570 (let ((hr (nth 2 (decode-time)))) 9571 (or (< hr 8) (> hr 21))))) 9572 (concat "-" tag))) 9573 9574 (setq org-agenda-auto-exclude-function #'my-auto-exclude-fn) 9575 #+end_src 9576 9577 You can apply this self-adapting filter by using a triple prefix 9578 argument to ~org-agenda-filter~, i.e.\nbsp{}press {{{kbd(C-u C-u C-u /)}}}, 9579 or by pressing {{{kbd(RET)}}} in ~org-agenda-filter-by-tag~. 9580 9581 **** Setting limits for the agenda 9582 :PROPERTIES: 9583 :UNNUMBERED: notoc 9584 :END: 9585 #+cindex: limits, in agenda 9586 9587 Here is a list of options that you can set, either globally, or 9588 locally in your custom agenda views (see [[*Custom Agenda Views]]). 9589 9590 - ~org-agenda-max-entries~ :: 9591 9592 #+vindex: org-agenda-max-entries 9593 Limit the number of entries. 9594 9595 - ~org-agenda-max-effort~ :: 9596 9597 #+vindex: org-agenda-max-effort 9598 Limit the duration of accumulated efforts (as minutes). 9599 9600 - ~org-agenda-max-todos~ :: 9601 9602 #+vindex: org-agenda-max-todos 9603 Limit the number of entries with TODO keywords. 9604 9605 - ~org-agenda-max-tags~ :: 9606 9607 #+vindex: org-agenda-max-tags 9608 Limit the number of tagged entries. 9609 9610 When set to a positive integer, each option excludes entries from 9611 other categories: for example, =(setq org-agenda-max-effort 100)= 9612 limits the agenda to 100 minutes of effort and exclude any entry that 9613 has no effort property. If you want to include entries with no effort 9614 property, use a negative value for ~org-agenda-max-effort~. One 9615 useful setup is to use ~org-agenda-max-entries~ locally in a custom 9616 command. For example, this custom command displays the next five 9617 entries with a =NEXT= TODO keyword. 9618 9619 #+begin_src emacs-lisp 9620 (setq org-agenda-custom-commands 9621 '(("n" todo "NEXT" 9622 ((org-agenda-max-entries 5))))) 9623 #+end_src 9624 9625 Once you mark one of these five entry as DONE, rebuilding the agenda 9626 will again the next five entries again, including the first entry that 9627 was excluded so far. 9628 9629 You can also dynamically set temporary limits, which are lost when 9630 rebuilding the agenda: 9631 9632 - {{{kbd(~ )}}} (~org-agenda-limit-interactively~) :: 9633 9634 #+findex: org-agenda-limit-interactively 9635 This prompts for the type of limit to apply and its value. 9636 9637 ** Commands in the Agenda Buffer 9638 :PROPERTIES: 9639 :DESCRIPTION: Remote editing of Org trees. 9640 :ALT_TITLE: Agenda Commands 9641 :END: 9642 #+cindex: commands, in agenda buffer 9643 9644 Entries in the agenda buffer are linked back to the Org file or diary 9645 file where they originate. You are not allowed to edit the agenda 9646 buffer itself, but commands are provided to show and jump to the 9647 original entry location, and to edit the Org files "remotely" from the 9648 agenda buffer. In this way, all information is stored only once, 9649 removing the risk that your agenda and note files may diverge. 9650 9651 Some commands can be executed with mouse clicks on agenda lines. For 9652 the other commands, point needs to be in the desired line. 9653 9654 *** Motion 9655 :PROPERTIES: 9656 :UNNUMBERED: notoc 9657 :END: 9658 #+cindex: motion commands in agenda 9659 9660 - {{{kbd(n)}}} (~org-agenda-next-line~) :: 9661 9662 #+kindex: n 9663 #+findex: org-agenda-next-line 9664 Next line (same as {{{kbd(DOWN)}}} and {{{kbd(C-n)}}}). 9665 9666 - {{{kbd(p)}}} (~org-agenda-previous-line~) :: 9667 9668 #+kindex: p 9669 #+findex: org-agenda-previous-line 9670 Previous line (same as {{{kbd(UP)}}} and {{{kbd(C-p)}}}). 9671 9672 *** View/Go to Org file 9673 :PROPERTIES: 9674 :UNNUMBERED: notoc 9675 :END: 9676 #+cindex: view file commands in agenda 9677 9678 - {{{kbd(SPC)}}} or {{{kbd(mouse-3)}}} (~org-agenda-show-and-scroll-up~) :: 9679 9680 #+kindex: SPC 9681 #+kindex: mouse-3 9682 #+findex: org-agenda-show-and-scroll-up 9683 Display the original location of the item in another window. 9684 With a prefix argument, make sure that drawers stay folded. 9685 9686 - {{{kbd(L)}}} (~org-agenda-recenter~) :: 9687 9688 #+findex: org-agenda-recenter 9689 Display original location and recenter that window. 9690 9691 - {{{kbd(TAB)}}} or {{{kbd(mouse-2)}}} (~org-agenda-goto~) :: 9692 9693 #+kindex: TAB 9694 #+kindex: mouse-2 9695 #+findex: org-agenda-goto 9696 Go to the original location of the item in another window. 9697 9698 - {{{kbd(RET)}}} (~org-agenda-switch-to~) :: 9699 9700 #+kindex: RET 9701 #+findex: org-agenda-switch-to 9702 Go to the original location of the item and delete other windows. 9703 9704 - {{{kbd(F)}}} (~org-agenda-follow-mode~) :: 9705 9706 #+kindex: F 9707 #+findex: org-agenda-follow-mode 9708 #+vindex: org-agenda-start-with-follow-mode 9709 Toggle Follow mode. In Follow mode, as you move point through the 9710 agenda buffer, the other window always shows the corresponding 9711 location in the Org file. The initial setting for this mode in new 9712 agenda buffers can be set with the variable 9713 ~org-agenda-start-with-follow-mode~. 9714 9715 - {{{kbd(C-c C-x b)}}} (~org-agenda-tree-to-indirect-buffer~) :: 9716 9717 #+kindex: C-c C-x b 9718 #+findex: org-agenda-tree-to-indirect-buffer 9719 Display the entire subtree of the current item in an indirect 9720 buffer. With a numeric prefix argument N, go up to level N and then 9721 take that tree. If N is negative, go up that many levels. With 9722 a {{{kbd(C-u)}}} prefix, do not remove the previously used indirect 9723 buffer. 9724 9725 - {{{kbd(C-c C-o)}}} (~org-agenda-open-link~) :: 9726 9727 #+kindex: C-c C-o 9728 #+findex: org-agenda-open-link 9729 Follow a link in the entry. This offers a selection of any links in 9730 the text belonging to the referenced Org node. If there is only one 9731 link, follow it without a selection prompt. 9732 9733 *** Change display 9734 :PROPERTIES: 9735 :UNNUMBERED: notoc 9736 :END: 9737 #+cindex: change agenda display 9738 #+cindex: display changing, in agenda 9739 9740 #+attr_texinfo: :sep , 9741 - {{{kbd(A)}}} :: 9742 9743 #+kindex: A 9744 Interactively select another agenda view and append it to the 9745 current view. 9746 9747 - {{{kbd(o)}}} :: 9748 9749 #+kindex: o 9750 Delete other windows. 9751 9752 - {{{kbd(v d)}}} or short {{{kbd(d)}}} (~org-agenda-day-view~) :: 9753 9754 #+kindex: v d 9755 #+kindex: d 9756 #+findex: org-agenda-day-view 9757 Switch to day view. When switching to day view, this setting 9758 becomes the default for subsequent agenda refreshes. A numeric 9759 prefix argument may be used to jump directly to a specific day of 9760 the year. For example, {{{kbd(32 d)}}} jumps to February 1st. When 9761 setting day view, a year may be encoded in the prefix argument as 9762 well. For example, {{{kbd(200712 d)}}} jumps to January 12, 2007. 9763 If such a year specification has only one or two digits, it is 9764 expanded into one of the 30 next years or the last 69 years. 9765 9766 - {{{kbd(v w)}}} or short {{{kbd(w)}}} (~org-agenda-week-view~) :: 9767 9768 #+kindex: v w 9769 #+kindex: w 9770 #+findex: org-agenda-week-view 9771 Switch to week view. When switching week view, this setting becomes 9772 the default for subsequent agenda refreshes. A numeric prefix 9773 argument may be used to jump directly to a specific day of the ISO 9774 week. For example {{{kbd(9 w)}}} to ISO week number 9. When 9775 setting week view, a year may be encoded in the prefix argument as 9776 well. For example, {{{kbd(200712 w)}}} jumps to week 12 in 2007. 9777 If such a year specification has only one or two digits, it is 9778 expanded into one of the 30 next years or the last 69 years. 9779 9780 - {{{kbd(v m)}}} (~org-agenda-month-view~) :: 9781 9782 #+kindex: v m 9783 #+findex: org-agenda-month-view 9784 Switch to month view. Because month views are slow to create, they 9785 do not become the default for subsequent agenda refreshes. 9786 A numeric prefix argument may be used to jump directly to a specific 9787 day of the month. When setting month view, a year may be encoded in 9788 the prefix argument as well. For example, {{{kbd(200712 m)}}} jumps 9789 to December, 2007. If such a year specification has only one or two 9790 digits, it is expanded into one of the 30 next years or the last 69 9791 years. 9792 9793 - {{{kbd(v y)}}} (~org-agenda-year-view~) :: 9794 9795 #+kindex: v y 9796 #+findex: org-agenda-year-view 9797 Switch to year view. Because year views are slow to create, they do 9798 not become the default for subsequent agenda refreshes. A numeric 9799 prefix argument may be used to jump directly to a specific day of 9800 the year. 9801 9802 - {{{kbd(v SPC)}}} (~org-agenda-reset-view~) :: 9803 9804 #+kindex: v SPC 9805 #+findex: org-agenda-reset-view 9806 #+vindex: org-agenda-span 9807 Reset the current view to ~org-agenda-span~. 9808 9809 - {{{kbd(f)}}} (~org-agenda-later~) :: 9810 9811 #+kindex: f 9812 #+findex: org-agenda-later 9813 Go forward in time to display the span following the current one. 9814 For example, if the display covers a week, switch to the following 9815 week. With a prefix argument, repeat that many times. 9816 9817 - {{{kbd(b)}}} (~org-agenda-earlier~) :: 9818 9819 #+kindex: b 9820 #+findex: org-agenda-earlier 9821 Go backward in time to display earlier dates. 9822 9823 - {{{kbd(.)}}} (~org-agenda-goto-today~) :: 9824 9825 #+kindex: . 9826 #+findex: org-agenda-goto-today 9827 Go to today. 9828 9829 - {{{kbd(j)}}} (~org-agenda-goto-date~) :: 9830 9831 #+kindex: j 9832 #+findex: org-agenda-goto-date 9833 Prompt for a date and go there. 9834 9835 - {{{kbd(J)}}} (~org-agenda-clock-goto~) :: 9836 9837 #+kindex: J 9838 #+findex: org-agenda-clock-goto 9839 Go to the currently clocked-in task /in the agenda buffer/. 9840 9841 - {{{kbd(D)}}} (~org-agenda-toggle-diary~) :: 9842 9843 #+kindex: D 9844 #+findex: org-agenda-toggle-diary 9845 Toggle the inclusion of diary entries. See [[*Weekly/daily agenda]]. 9846 9847 - {{{kbd(v l)}}} or {{{kbd(v L)}}} or short {{{kbd(l)}}} (~org-agenda-log-mode~) :: 9848 9849 #+kindex: v l 9850 #+kindex: l 9851 #+kindex: v L 9852 #+findex: org-agenda-log-mode 9853 #+vindex: org-log-done 9854 #+vindex: org-agenda-log-mode-items 9855 Toggle Logbook mode. In Logbook mode, entries that were marked as 9856 done while logging was on (see the variable ~org-log-done~) are 9857 shown in the agenda, as are entries that have been clocked on that 9858 day. You can configure the entry types that should be included in 9859 log mode using the variable ~org-agenda-log-mode-items~. When 9860 called with a {{{kbd(C-u)}}} prefix argument, show all possible 9861 logbook entries, including state changes. When called with two 9862 prefix arguments {{{kbd(C-u C-u)}}}, show only logging information, 9863 nothing else. {{{kbd(v L)}}} is equivalent to {{{kbd(C-u v l)}}}. 9864 9865 - {{{kbd(v [)}}} or short {{{kbd([)}}} (~org-agenda-manipulate-query-add~) :: 9866 9867 #+kindex: v [ 9868 #+kindex: [ 9869 #+findex: org-agenda-manipulate-query-add 9870 Include inactive timestamps into the current view. Only for 9871 weekly/daily agenda. 9872 9873 - {{{kbd(v a)}}} (~org-agenda-archives-mode~) :: 9874 9875 #+kindex: v a 9876 #+findex: org-agenda-archives-mode 9877 Toggle Archives mode. In Archives mode, trees that are archived 9878 (see [[*Internal archiving]]) are also scanned when producing the 9879 agenda. To exit archives mode, press {{{kbd(v a)}}} again. 9880 9881 - {{{kbd(v A)}}} :: 9882 9883 #+kindex: v A 9884 Toggle Archives mode. Include all archive files as well. 9885 9886 - {{{kbd(v R)}}} or short {{{kbd(R)}}} (~org-agenda-clockreport-mode~) :: 9887 9888 #+kindex: v R 9889 #+kindex: R 9890 #+findex: org-agenda-clockreport-mode 9891 #+vindex: org-agenda-start-with-clockreport-mode 9892 #+vindex: org-clock-report-include-clocking-task 9893 Toggle Clockreport mode. In Clockreport mode, the daily/weekly 9894 agenda always shows a table with the clocked times for the time span 9895 and file scope covered by the current agenda view. The initial 9896 setting for this mode in new agenda buffers can be set with the 9897 variable ~org-agenda-start-with-clockreport-mode~. By using a 9898 prefix argument when toggling this mode (i.e., {{{kbd(C-u R)}}}), 9899 the clock table does not show contributions from entries that are 9900 hidden by agenda filtering[fn:: Only tags filtering is respected 9901 here, effort filtering is ignored.]. See also the variables 9902 ~org-clock-report-include-clocking-task~ and 9903 ~org-agenda-clock-report-header~. 9904 9905 - {{{kbd(v c)}}} :: 9906 9907 #+kindex: v c 9908 #+vindex: org-agenda-clock-consistency-checks 9909 Show overlapping clock entries, clocking gaps, and other clocking 9910 problems in the current agenda range. You can then visit clocking 9911 lines and fix them manually. See the variable 9912 ~org-agenda-clock-consistency-checks~ for information on how to 9913 customize the definition of what constituted a clocking problem. To 9914 return to normal agenda display, press {{{kbd(l)}}} to exit Logbook 9915 mode. 9916 9917 - {{{kbd(v E)}}} or short {{{kbd(E)}}} (~org-agenda-entry-text-mode~) :: 9918 9919 #+kindex: v E 9920 #+kindex: E 9921 #+findex: org-agenda-entry-text-mode 9922 #+vindex: org-agenda-start-with-entry-text-mode 9923 #+vindex: org-agenda-entry-text-maxlines 9924 Toggle entry text mode. In entry text mode, a number of lines from 9925 the Org outline node referenced by an agenda line are displayed 9926 below the line. The maximum number of lines is given by the 9927 variable ~org-agenda-entry-text-maxlines~. Calling this command 9928 with a numeric prefix argument temporarily modifies that number to 9929 the prefix value. 9930 9931 - {{{kbd(G)}}} (~org-agenda-toggle-time-grid~) :: 9932 9933 #+kindex: G 9934 #+vindex: org-agenda-use-time-grid 9935 #+vindex: org-agenda-time-grid 9936 Toggle the time grid on and off. See also the variables 9937 ~org-agenda-use-time-grid~ and ~org-agenda-time-grid~. 9938 9939 - {{{kbd(r)}}} (~org-agenda-redo~), {{{kbd(g)}}} :: 9940 9941 #+kindex: r 9942 #+kindex: g 9943 #+findex: org-agenda-redo 9944 Recreate the agenda buffer, for example to reflect the changes after 9945 modification of the timestamps of items with {{{kbd(S-LEFT)}}} and 9946 {{{kbd(S-RIGHT)}}}. When the buffer is the global TODO list, 9947 a prefix argument is interpreted to create a selective list for 9948 a specific TODO keyword. 9949 9950 - {{{kbd(C-x C-s)}}} or short {{{kbd(s)}}} (~org-save-all-org-buffers~) :: 9951 9952 #+kindex: C-x C-s 9953 #+findex: org-save-all-org-buffers 9954 #+kindex: s 9955 Save all Org buffers in the current Emacs session, and also the 9956 locations of IDs. 9957 9958 - {{{kbd(C-c C-x C-c)}}} (~org-agenda-columns~) :: 9959 9960 #+kindex: C-c C-x C-c 9961 #+findex: org-agenda-columns 9962 #+vindex: org-columns-default-format 9963 Invoke column view (see [[*Column View]]) in the agenda buffer. The 9964 column view format is taken from the entry at point, or, if there is 9965 no entry at point, from the first entry in the agenda view. So 9966 whatever the format for that entry would be in the original buffer 9967 (taken from a property, from a =COLUMNS= keyword, or from the 9968 default variable ~org-columns-default-format~) is used in the 9969 agenda. 9970 9971 - {{{kbd(C-c C-x >)}}} (~org-agenda-remove-restriction-lock~) :: 9972 9973 #+kindex: C-c C-x > 9974 #+findex: org-agenda-remove-restriction-lock 9975 Remove the restriction lock on the agenda, if it is currently 9976 restricted to a file or subtree (see [[*Agenda Files]]). 9977 9978 - {{{kbd(M-UP)}}} (~org-agenda-drag-line-backward~) :: 9979 9980 #+kindex: M-UP 9981 #+findex: org-agenda-drag-line-backward 9982 Drag the line at point backward one line. With a numeric prefix 9983 argument, drag backward by that many lines. 9984 9985 Moving agenda lines does not persist after an agenda refresh and 9986 does not modify the contributing Org files. 9987 9988 - {{{kbd(M-DOWN)}}} (~org-agenda-drag-line-forward~) :: 9989 9990 #+kindex: M-DOWN 9991 #+findex: org-agenda-drag-line-forward 9992 Drag the line at point forward one line. With a numeric prefix 9993 argument, drag forward by that many lines. 9994 9995 *** Remote editing 9996 :PROPERTIES: 9997 :UNNUMBERED: notoc 9998 :END: 9999 #+cindex: remote editing, from agenda 10000 10001 - {{{kbd(0--9)}}} :: 10002 10003 Digit argument. 10004 10005 - {{{kbd(C-_)}}} (~org-agenda-undo~) :: 10006 10007 #+kindex: C-_ 10008 #+findex: org-agenda-undo 10009 #+cindex: undoing remote-editing events 10010 #+cindex: remote editing, undo 10011 Undo a change due to a remote editing command. The change is undone 10012 both in the agenda buffer and in the remote buffer. 10013 10014 - {{{kbd(t)}}} (~org-agenda-todo~) :: 10015 10016 #+kindex: t 10017 #+findex: org-agenda-todo 10018 Change the TODO state of the item, both in the agenda and in the 10019 original Org file. A prefix arg is passed through to the ~org-todo~ 10020 command, so for example a {{{kbd(C-u)}}} prefix are will trigger 10021 taking a note to document the state change. 10022 10023 - {{{kbd(C-S-RIGHT)}}} (~org-agenda-todo-nextset~) :: 10024 10025 #+kindex: C-S-RIGHT 10026 #+findex: org-agenda-todo-nextset 10027 Switch to the next set of TODO keywords. 10028 10029 - {{{kbd(C-S-LEFT)}}}, ~org-agenda-todo-previousset~ :: 10030 10031 #+kindex: C-S-LEFT 10032 Switch to the previous set of TODO keywords. 10033 10034 - {{{kbd(C-k)}}} (~org-agenda-kill~) :: 10035 10036 #+kindex: C-k 10037 #+findex: org-agenda-kill 10038 #+vindex: org-agenda-confirm-kill 10039 Delete the current agenda item along with the entire subtree 10040 belonging to it in the original Org file. If the text to be deleted 10041 remotely is longer than one line, the kill needs to be confirmed by 10042 the user. See variable ~org-agenda-confirm-kill~. 10043 10044 - {{{kbd(C-c C-w)}}} (~org-agenda-refile~) :: 10045 10046 #+kindex: C-c C-w 10047 #+findex: org-agenda-refile 10048 Refile the entry at point. 10049 10050 - {{{kbd(C-c C-x C-a)}}} or short {{{kbd(a)}}} (~org-agenda-archive-default-with-confirmation~) :: 10051 10052 #+kindex: C-c C-x C-a 10053 #+kindex: a 10054 #+findex: org-agenda-archive-default-with-confirmation 10055 #+vindex: org-archive-default-command 10056 Archive the subtree corresponding to the entry at point using the 10057 default archiving command set in ~org-archive-default-command~. 10058 When using the {{{kbd(a)}}} key, confirmation is required. 10059 10060 - {{{kbd(C-c C-x a)}}} (~org-agenda-toggle-archive-tag~) :: 10061 10062 #+kindex: C-c C-x a 10063 #+findex: org-agenda-toggle-archive-tag 10064 Toggle the archive tag (see [[*Internal archiving]]) for the current 10065 headline. 10066 10067 - {{{kbd(C-c C-x A)}}} (~org-agenda-archive-to-archive-sibling~) :: 10068 10069 #+kindex: C-c C-x A 10070 #+findex: org-agenda-archive-to-archive-sibling 10071 Move the subtree corresponding to the current entry to its /archive 10072 sibling/. 10073 10074 - {{{kbd(C-c C-x C-s)}}} or short {{{kbd($)}}} (~org-agenda-archive~) :: 10075 10076 #+kindex: C-c C-x C-s 10077 #+kindex: $ 10078 #+findex: org-agenda-archive 10079 Archive the subtree corresponding to the current headline. This 10080 means the entry is moved to the configured archive location, most 10081 likely a different file. 10082 10083 - {{{kbd(T)}}} (~org-agenda-show-tags~) :: 10084 10085 #+kindex: T 10086 #+findex: org-agenda-show-tags 10087 #+vindex: org-agenda-show-inherited-tags 10088 Show all tags associated with the current item. This is useful if 10089 you have turned off ~org-agenda-show-inherited-tags~, but still want 10090 to see all tags of a headline occasionally. 10091 10092 - {{{kbd(:)}}} (~org-agenda-set-tags~) :: 10093 10094 #+kindex: : 10095 #+findex: org-agenda-set-tags 10096 Set tags for the current headline. If there is an active region in 10097 the agenda, change a tag for all headings in the region. 10098 10099 - {{{kbd(\,)}}} (~org-agenda-priority~) :: 10100 10101 #+kindex: , 10102 #+findex: org-agenda-priority 10103 Set the priority for the current item. Org mode prompts for the 10104 priority character. If you reply with {{{kbd(SPC)}}}, the priority 10105 cookie is removed from the entry. 10106 10107 - {{{kbd(+)}}} or {{{kbd(S-UP)}}} (~org-agenda-priority-up~) :: 10108 10109 #+kindex: + 10110 #+kindex: S-UP 10111 #+findex: org-agenda-priority-up 10112 Increase the priority of the current item. The priority is changed 10113 in the original buffer, but the agenda is not resorted. Use the 10114 {{{kbd(r)}}} key for this. 10115 10116 - {{{kbd(-)}}} or {{{kbd(S-DOWN)}}} (~org-agenda-priority-down~) :: 10117 10118 #+kindex: - 10119 #+kindex: S-DOWN 10120 #+findex: org-agenda-priority-down 10121 Decrease the priority of the current item. 10122 10123 - {{{kbd(C-c C-x e)}}} or short {{{kbd(e)}}} (~org-agenda-set-effort~) :: 10124 10125 #+kindex: e 10126 #+kindex: C-c C-x e 10127 #+findex: org-agenda-set-effort 10128 Set the effort property for the current item. 10129 10130 - {{{kbd(C-c C-z)}}} or short {{{kbd(z)}}} (~org-agenda-add-note~) :: 10131 10132 #+kindex: z 10133 #+kindex: C-c C-z 10134 #+findex: org-agenda-add-note 10135 #+vindex: org-log-into-drawer 10136 Add a note to the entry. This note is recorded, and then filed to 10137 the same location where state change notes are put. Depending on 10138 ~org-log-into-drawer~, this may be inside a drawer. 10139 10140 - {{{kbd(C-c C-a)}}} (~org-attach~) :: 10141 10142 #+kindex: C-c C-a 10143 #+findex: org-attach 10144 Dispatcher for all command related to attachments. 10145 10146 - {{{kbd(C-c C-s)}}} (~org-agenda-schedule~) :: 10147 10148 #+kindex: C-c C-s 10149 #+findex: org-agenda-schedule 10150 Schedule this item. With a prefix argument, remove the 10151 scheduling timestamp 10152 10153 - {{{kbd(C-c C-d)}}} (~org-agenda-deadline~) :: 10154 10155 #+kindex: C-c C-d 10156 #+findex: org-agenda-deadline 10157 Set a deadline for this item. With a prefix argument, remove the 10158 deadline. 10159 10160 - {{{kbd(S-RIGHT)}}} (~org-agenda-do-date-later~) :: 10161 10162 #+kindex: S-RIGHT 10163 #+findex: org-agenda-do-date-later 10164 Change the timestamp associated with the current line by one day 10165 into the future. If the date is in the past, the first call to this 10166 command moves it to today. With a numeric prefix argument, change 10167 it by that many days. For example, {{{kbd(3 6 5 S-RIGHT)}}} changes 10168 it by a year. With a {{{kbd(C-u)}}} prefix, change the time by one 10169 hour. If you immediately repeat the command, it will continue to 10170 change hours even without the prefix argument. With a double 10171 {{{kbd(C-u C-u)}}} prefix, do the same for changing minutes. The 10172 stamp is changed in the original Org file, but the change is not 10173 directly reflected in the agenda buffer. Use {{{kbd(r)}}} or 10174 {{{kbd(g)}}} to update the buffer. 10175 10176 - {{{kbd(S-LEFT)}}} (~org-agenda-do-date-earlier~) :: 10177 10178 #+kindex: S-LEFT 10179 #+findex: org-agenda-do-date-earlier 10180 Change the timestamp associated with the current line by one day 10181 into the past. 10182 10183 - {{{kbd(>)}}} (~org-agenda-date-prompt~) :: 10184 10185 #+kindex: > 10186 #+findex: org-agenda-date-prompt 10187 Change the timestamp associated with the current line. The key 10188 {{{kbd(>)}}} has been chosen, because it is the same as 10189 {{{kbd(S-.)}}} on my keyboard. 10190 10191 - {{{kbd(I)}}} (~org-agenda-clock-in~) :: 10192 10193 #+kindex: I 10194 #+findex: org-agenda-clock-in 10195 Start the clock on the current item. If a clock is running already, 10196 it is stopped first. 10197 10198 - {{{kbd(O)}}} (~org-agenda-clock-out~) :: 10199 10200 #+kindex: O 10201 #+findex: org-agenda-clock-out 10202 Stop the previously started clock. 10203 10204 - {{{kbd(X)}}} (~org-agenda-clock-cancel~) :: 10205 10206 #+kindex: X 10207 #+findex: org-agenda-clock-cancel 10208 Cancel the currently running clock. 10209 10210 - {{{kbd(J)}}} (~org-agenda-clock-goto~) :: 10211 10212 #+kindex: J 10213 #+findex: org-agenda-clock-goto 10214 Jump to the running clock in another window. 10215 10216 - {{{kbd(k)}}} (~org-agenda-capture~) :: 10217 10218 #+kindex: k 10219 #+findex: org-agenda-capture 10220 #+cindex: capturing, from agenda 10221 #+vindex: org-capture-use-agenda-date 10222 Like ~org-capture~, but use the date at point as the default date 10223 for the capture template. See ~org-capture-use-agenda-date~ to make 10224 this the default behavior of ~org-capture~. 10225 10226 *** Bulk remote editing selected entries 10227 :PROPERTIES: 10228 :UNNUMBERED: notoc 10229 :END: 10230 #+cindex: remote editing, bulk, from agenda 10231 #+vindex: org-agenda-bulk-custom-functions 10232 10233 - {{{kbd(m)}}} (~org-agenda-bulk-mark~) :: 10234 #+kindex: m 10235 #+findex: org-agenda-bulk-mark 10236 10237 Mark the entry at point for bulk action. If there is an active 10238 region in the agenda, mark the entries in the region. With numeric 10239 prefix argument, mark that many successive entries. 10240 10241 - {{{kbd(*)}}} (~org-agenda-bulk-mark-all~) :: 10242 #+kindex: * 10243 #+findex: org-agenda-bulk-mark-all 10244 10245 Mark all visible agenda entries for bulk action. 10246 10247 - {{{kbd(u)}}} (~org-agenda-bulk-unmark~) :: 10248 #+kindex: u 10249 #+findex: org-agenda-bulk-unmark 10250 10251 Unmark entry for bulk action. 10252 10253 - {{{kbd(U)}}} (~org-agenda-bulk-remove-all-marks~) :: 10254 #+kindex: U 10255 #+findex: org-agenda-bulk-remove-all-marks 10256 10257 Unmark all marked entries for bulk action. 10258 10259 - {{{kbd(M-m)}}} (~org-agenda-bulk-toggle~) :: 10260 #+kindex: M-m 10261 #+findex: org-agenda-bulk-toggle 10262 10263 Toggle mark of the entry at point for bulk action. 10264 10265 - {{{kbd(M-*)}}} (~org-agenda-bulk-toggle-all~) :: 10266 #+kindex: M-* 10267 #+findex: org-agenda-bulk-toggle-all 10268 10269 Toggle mark of every entry for bulk action. 10270 10271 - {{{kbd(%)}}} (~org-agenda-bulk-mark-regexp~) :: 10272 #+kindex: % 10273 #+findex: org-agenda-bulk-mark-regexp 10274 10275 Mark entries matching a regular expression for bulk action. 10276 10277 - {{{kbd(B)}}} (~org-agenda-bulk-action~) :: 10278 #+kindex: B 10279 #+findex: org-agenda-bulk-action 10280 #+vindex: org-agenda-bulk-persistent-marks 10281 10282 Bulk action: act on all marked entries in the agenda. This prompts 10283 for another key to select the action to be applied. The prefix 10284 argument to {{{kbd(B)}}} is passed through to the {{{kbd(s)}}} and 10285 {{{kbd(d)}}} commands, to bulk-remove these special timestamps. By 10286 default, marks are removed after the bulk. If you want them to 10287 persist, set ~org-agenda-bulk-persistent-marks~ to ~t~ or hit 10288 {{{kbd(p)}}} at the prompt. 10289 10290 - {{{kbd(p)}}} :: 10291 10292 Toggle persistent marks. 10293 10294 - {{{kbd($)}}} :: 10295 10296 Archive all selected entries. 10297 10298 - {{{kbd(A)}}} :: 10299 10300 Archive entries by moving them to their respective archive 10301 siblings. 10302 10303 - {{{kbd(t)}}} :: 10304 10305 Change TODO state. This prompts for a single TODO keyword and 10306 changes the state of all selected entries, bypassing blocking and 10307 suppressing logging notes---but not timestamps. 10308 10309 - {{{kbd(+)}}} :: 10310 10311 Add a tag to all selected entries. 10312 10313 - {{{kbd(-)}}} :: 10314 10315 Remove a tag from all selected entries. 10316 10317 - {{{kbd(s)}}} :: 10318 10319 Schedule all items to a new date. To shift existing schedule 10320 dates by a fixed number of days, use something starting with 10321 double plus at the prompt, for example =++8d= or =++2w=. 10322 10323 - {{{kbd(d)}}} :: 10324 10325 Set deadline to a specific date. 10326 10327 - {{{kbd(r)}}} :: 10328 10329 Prompt for a single refile target and move all entries. The 10330 entries are no longer in the agenda; refresh ({{{kbd(g)}}}) to 10331 bring them back. 10332 10333 - {{{kbd(S)}}} :: 10334 10335 Reschedule randomly into the coming N days. N is prompted for. 10336 With a prefix argument ({{{kbd(C-u B S)}}}), scatter only across 10337 weekdays. 10338 10339 - {{{kbd(f)}}} :: 10340 10341 #+vindex: org-agenda-bulk-custom-functions 10342 Apply a function[fn:: You can also create persistent custom 10343 functions through ~org-agenda-bulk-custom-functions~.] to marked 10344 entries. For example, the function below sets the =CATEGORY= 10345 property of the entries to =web=. 10346 10347 #+begin_src emacs-lisp 10348 (defun set-category () 10349 (interactive "P") 10350 (let ((marker (or (org-get-at-bol 'org-hd-marker) 10351 (org-agenda-error)))) 10352 (org-with-point-at marker 10353 (org-back-to-heading t) 10354 (org-set-property "CATEGORY" "web")))) 10355 #+end_src 10356 10357 *** Calendar commands 10358 :PROPERTIES: 10359 :UNNUMBERED: notoc 10360 :END: 10361 #+cindex: calendar commands, from agenda 10362 10363 - {{{kbd(c)}}} (~org-agenda-goto-calendar~) :: 10364 10365 #+kindex: c 10366 #+findex: org-agenda-goto-calendar 10367 Open the Emacs calendar and go to the date at point in the agenda. 10368 10369 - {{{kbd(c)}}} (~org-calendar-goto-agenda~) :: 10370 10371 #+kindex: c 10372 #+findex: org-calendar-goto-agenda 10373 When in the calendar, compute and show the Org agenda for the date 10374 at point. 10375 10376 - {{{kbd(i)}}} (~org-agenda-diary-entry~) :: 10377 #+kindex: i 10378 #+findex: org-agenda-diary-entry 10379 10380 #+cindex: diary entries, creating from agenda 10381 Insert a new entry into the diary, using the date at point and (for 10382 block entries) the date at the mark. This adds to the Emacs diary 10383 file[fn:: This file is parsed for the agenda when 10384 ~org-agenda-include-diary~ is set.], in a way similar to the 10385 {{{kbd(i)}}} command in the calendar. The diary file pops up in 10386 another window, where you can add the entry. 10387 10388 #+vindex: org-agenda-diary-file 10389 If you configure ~org-agenda-diary-file~ to point to an Org file, 10390 Org creates entries in that file instead. Most entries are stored 10391 in a date-based outline tree that will later make it easy to archive 10392 appointments from previous months/years. The tree is built under an 10393 entry with a =DATE_TREE= property, or else with years as top-level 10394 entries. Emacs prompts you for the entry text---if you specify it, 10395 the entry is created in ~org-agenda-diary-file~ without further 10396 interaction. If you directly press {{{kbd(RET)}}} at the prompt 10397 without typing text, the target file is shown in another window for 10398 you to finish the entry there. See also the {{{kbd(k r)}}} command. 10399 10400 - {{{kbd(M)}}} (~org-agenda-phases-of-moon~) :: 10401 10402 #+kindex: M 10403 #+findex: org-agenda-phases-of-moon 10404 Show the phases of the moon for the three months around current 10405 date. 10406 10407 - {{{kbd(S)}}} (~org-agenda-sunrise-sunset~) :: 10408 10409 #+kindex: S 10410 #+findex: org-agenda-sunrise-sunset 10411 Show sunrise and sunset times. The geographical location must be 10412 set with calendar variables, see the documentation for the Emacs 10413 calendar. 10414 10415 - {{{kbd(C)}}} (~org-agenda-convert-date~) :: 10416 10417 #+kindex: C 10418 #+findex: org-agenda-convert-date 10419 Convert the date at point into many other cultural and historic 10420 calendars. 10421 10422 - {{{kbd(H)}}} (~org-agenda-holidays~) :: 10423 10424 #+kindex: H 10425 #+findex: org-agenda-holidays 10426 Show holidays for three months around point date. 10427 10428 *** Quit and exit 10429 :PROPERTIES: 10430 :UNNUMBERED: notoc 10431 :END: 10432 10433 - {{{kbd(q)}}} (~org-agenda-quit~) :: 10434 #+kindex: q 10435 #+findex: org-agenda-quit 10436 10437 Quit agenda, remove the agenda buffer. 10438 10439 - {{{kbd(x)}}} (~org-agenda-exit~) :: 10440 #+kindex: x 10441 #+findex: org-agenda-exit 10442 10443 #+cindex: agenda files, removing buffers 10444 Exit agenda, remove the agenda buffer and all buffers loaded by 10445 Emacs for the compilation of the agenda. Buffers created by the 10446 user to visit Org files are not removed. 10447 10448 ** Custom Agenda Views 10449 :PROPERTIES: 10450 :DESCRIPTION: Defining special searches and views. 10451 :END: 10452 #+cindex: custom agenda views 10453 #+cindex: agenda views, custom 10454 10455 Custom agenda commands serve two purposes: to store and quickly access 10456 frequently used TODO and tags searches, and to create special 10457 composite agenda buffers. Custom agenda commands are accessible 10458 through the dispatcher (see [[*The Agenda Dispatcher]]), just like the 10459 default commands. 10460 10461 *** Storing searches 10462 :PROPERTIES: 10463 :DESCRIPTION: Type once, use often. 10464 :END: 10465 10466 The first application of custom searches is the definition of keyboard 10467 shortcuts for frequently used searches, either creating an agenda 10468 buffer, or a sparse tree (the latter covering of course only the 10469 current buffer). 10470 10471 #+kindex: C @r{(Agenda dispatcher)} 10472 #+vindex: org-agenda-custom-commands 10473 #+cindex: agenda views, main example 10474 #+cindex: agenda, as an agenda views 10475 #+cindex: agenda*, as an agenda views 10476 #+cindex: tags, as an agenda view 10477 #+cindex: todo, as an agenda view 10478 #+cindex: tags-todo 10479 #+cindex: todo-tree 10480 #+cindex: occur-tree 10481 #+cindex: tags-tree 10482 Custom commands are configured in the variable 10483 ~org-agenda-custom-commands~. You can customize this variable, for 10484 example by pressing {{{kbd(C)}}} from the agenda dispatcher (see [[*The 10485 Agenda Dispatcher]]). You can also directly set it with Emacs Lisp in 10486 the Emacs init file. The following example contains all valid agenda 10487 views: 10488 10489 #+begin_src emacs-lisp 10490 (setq org-agenda-custom-commands 10491 '(("x" agenda) 10492 ("y" agenda*) 10493 ("w" todo "WAITING") 10494 ("W" todo-tree "WAITING") 10495 ("u" tags "+boss-urgent") 10496 ("v" tags-todo "+boss-urgent") 10497 ("U" tags-tree "+boss-urgent") 10498 ("f" occur-tree "\\<FIXME\\>") 10499 ("h" . "HOME+Name tags searches") ;description for "h" prefix 10500 ("hl" tags "+home+Lisa") 10501 ("hp" tags "+home+Peter") 10502 ("hk" tags "+home+Kim"))) 10503 #+end_src 10504 10505 The initial string in each entry defines the keys you have to press 10506 after the dispatcher command in order to access the command. Usually 10507 this is just a single character, but if you have many similar 10508 commands, you can also define two-letter combinations where the first 10509 character is the same in several combinations and serves as a prefix 10510 key[fn:: You can provide a description for a prefix key by inserting a 10511 cons cell with the prefix and the description.]. The second parameter 10512 is the search type, followed by the string or regular expression to be 10513 used for the matching. The example above will therefore define: 10514 10515 - {{{kbd(x)}}} :: 10516 10517 as a global search for agenda entries planned[fn:34] this week/day. 10518 10519 - {{{kbd(y)}}} :: 10520 10521 as the same search, but only for entries with an hour specification 10522 like =[h]h:mm=---think of them as appointments. 10523 10524 - {{{kbd(w)}}} :: 10525 10526 as a global search for TODO entries with =WAITING= as the TODO 10527 keyword. 10528 10529 - {{{kbd(W)}}} :: 10530 10531 as the same search, but only in the current buffer and displaying 10532 the results as a sparse tree. 10533 10534 - {{{kbd(u)}}} :: 10535 10536 as a global tags search for headlines tagged =boss= but not 10537 =urgent=. 10538 10539 - {{{kbd(v)}}} :: 10540 10541 The same search, but limiting it to headlines that are also TODO 10542 items. 10543 10544 - {{{kbd(U)}}} :: 10545 10546 as the same search, but only in the current buffer and displaying 10547 the result as a sparse tree. 10548 10549 - {{{kbd(f)}}} :: 10550 10551 to create a sparse tree (again, current buffer only) with all 10552 entries containing the word =FIXME=. 10553 10554 - {{{kbd(h)}}} :: 10555 10556 as a prefix command for a =HOME= tags search where you have to press 10557 an additional key ({{{kbd(l)}}}, {{{kbd(p)}}} or {{{kbd(k)}}}) to 10558 select a name (Lisa, Peter, or Kim) as additional tag to match. 10559 10560 Note that ~*-tree~ agenda views need to be called from an Org buffer 10561 as they operate on the current buffer only. 10562 10563 *** Block agenda 10564 :PROPERTIES: 10565 :DESCRIPTION: All the stuff you need in a single buffer. 10566 :END: 10567 #+cindex: block agenda 10568 #+cindex: agenda, with block views 10569 10570 Another possibility is the construction of agenda views that comprise 10571 the results of /several/ commands, each of which creates a block in 10572 the agenda buffer. The available commands include ~agenda~ for the 10573 daily or weekly agenda (as created with {{{kbd(a)}}}) , ~alltodo~ for 10574 the global TODO list (as constructed with {{{kbd(t)}}}), ~stuck~ for 10575 the list of stuck projects (as obtained with {{{kbd(#)}}}) and the 10576 matching commands discussed above: ~todo~, ~tags~, and ~tags-todo~. 10577 10578 Here are two examples: 10579 10580 #+begin_src emacs-lisp 10581 (setq org-agenda-custom-commands 10582 '(("h" "Agenda and Home-related tasks" 10583 ((agenda "") 10584 (tags-todo "home") 10585 (tags "garden"))) 10586 ("o" "Agenda and Office-related tasks" 10587 ((agenda "") 10588 (tags-todo "work") 10589 (tags "office"))))) 10590 #+end_src 10591 10592 #+texinfo: @noindent 10593 This defines {{{kbd(h)}}} to create a multi-block view for stuff you 10594 need to attend to at home. The resulting agenda buffer contains your 10595 agenda for the current week, all TODO items that carry the tag =home=, 10596 and also all lines tagged with =garden=. Finally the command 10597 {{{kbd(o)}}} provides a similar view for office tasks. 10598 10599 *** Setting options for custom commands 10600 :PROPERTIES: 10601 :DESCRIPTION: Changing the rules. 10602 :ALT_TITLE: Setting options 10603 :END: 10604 #+cindex: options, for custom agenda views 10605 10606 #+vindex: org-agenda-custom-commands 10607 Org mode contains a number of variables regulating agenda construction 10608 and display. The global variables define the behavior for all agenda 10609 commands, including the custom commands. However, if you want to 10610 change some settings just for a single custom view, you can do so. 10611 Setting options requires inserting a list of variable names and values 10612 at the right spot in ~org-agenda-custom-commands~. For example: 10613 10614 #+begin_src emacs-lisp 10615 (setq org-agenda-custom-commands 10616 '(("w" todo "WAITING" 10617 ((org-agenda-sorting-strategy '(priority-down)) 10618 (org-agenda-prefix-format " Mixed: "))) 10619 ("U" tags-tree "+boss-urgent" 10620 ((org-show-context-detail 'minimal))) 10621 ("N" search "" 10622 ((org-agenda-files '("~org/notes.org")) 10623 (org-agenda-text-search-extra-files nil))))) 10624 #+end_src 10625 10626 #+texinfo: @noindent 10627 Now the {{{kbd(w)}}} command sorts the collected entries only by 10628 priority, and the prefix format is modified to just say =Mixed:= 10629 instead of giving the category of the entry. The sparse tags tree of 10630 {{{kbd(U)}}} now turns out ultra-compact, because neither the headline 10631 hierarchy above the match, nor the headline following the match are 10632 shown. The command {{{kbd(N)}}} does a text search limited to only 10633 a single file. 10634 10635 For command sets creating a block agenda, ~org-agenda-custom-commands~ 10636 has two separate spots for setting options. You can add options that 10637 should be valid for just a single command in the set, and options that 10638 should be valid for all commands in the set. The former are just 10639 added to the command entry; the latter must come after the list of 10640 command entries. Going back to the block agenda example (see [[*Block 10641 agenda]]), let's change the sorting strategy for the {{{kbd(h)}}} 10642 commands to ~priority-down~, but let's sort the results for =garden= 10643 tags query in the opposite order, ~priority-up~. This would look like 10644 this: 10645 10646 #+begin_src emacs-lisp 10647 (setq org-agenda-custom-commands 10648 '(("h" "Agenda and Home-related tasks" 10649 ((agenda) 10650 (tags-todo "home") 10651 (tags "garden" 10652 ((org-agenda-sorting-strategy '(priority-up))))) 10653 ((org-agenda-sorting-strategy '(priority-down)))) 10654 ("o" "Agenda and Office-related tasks" 10655 ((agenda) 10656 (tags-todo "work") 10657 (tags "office"))))) 10658 #+end_src 10659 10660 As you see, the values and parentheses setting is a little complex. 10661 When in doubt, use the customize interface to set this variable---it 10662 fully supports its structure. Just one caveat: when setting options 10663 in this interface, the /values/ are just Lisp expressions. So if the 10664 value is a string, you need to add the double-quotes around the value 10665 yourself. 10666 10667 #+vindex: org-agenda-custom-commands-contexts 10668 To control whether an agenda command should be accessible from 10669 a specific context, you can customize 10670 ~org-agenda-custom-commands-contexts~. Let's say for example that you 10671 have an agenda command {{{kbd(o)}}} displaying a view that you only 10672 need when reading emails. Then you would configure this option like 10673 this: 10674 10675 #+begin_src emacs-lisp 10676 (setq org-agenda-custom-commands-contexts 10677 '(("o" (in-mode . "message-mode")))) 10678 #+end_src 10679 10680 You can also tell that the command key {{{kbd(o)}}} should refer to 10681 another command key {{{kbd(r)}}}. In that case, add this command key 10682 like this: 10683 10684 #+begin_src emacs-lisp 10685 (setq org-agenda-custom-commands-contexts 10686 '(("o" "r" (in-mode . "message-mode")))) 10687 #+end_src 10688 10689 See the docstring of the variable for more information. 10690 10691 ** Exporting Agenda Views 10692 :PROPERTIES: 10693 :DESCRIPTION: Writing a view to a file. 10694 :END: 10695 #+cindex: agenda views, exporting 10696 10697 If you are away from your computer, it can be very useful to have a 10698 printed version of some agenda views to carry around. Org mode can 10699 export custom agenda views as plain text, HTML[fn:: For HTML you need 10700 to install Hrvoje Nikšić's =htmlize.el= as an Emacs package from 10701 [[https://elpa.nongnu.org/][NonGNU ELPA]] or from 10702 [[https://github.com/hniksic/emacs-htmlize][Hrvoje Nikšić's repository]].], 10703 Postscript, PDF[fn:35], and iCalendar files. If you 10704 want to do this only occasionally, use the following command: 10705 10706 - {{{kbd(C-x C-w)}}} (~org-agenda-write~) :: 10707 #+kindex: C-x C-w 10708 #+findex: org-agenda-write 10709 #+cindex: exporting agenda views 10710 #+cindex: agenda views, exporting 10711 10712 #+vindex: org-agenda-exporter-settings 10713 Write the agenda view to a file. 10714 10715 If you need to export certain agenda views frequently, you can 10716 associate any custom agenda command with a list of output file 10717 names[fn:: If you want to store standard views like the weekly agenda 10718 or the global TODO list as well, you need to define custom commands 10719 for them in order to be able to specify file names.]. Here is an 10720 example that first defines custom commands for the agenda and the 10721 global TODO list, together with a number of files to which to export 10722 them. Then we define two block agenda commands and specify file names 10723 for them as well. File names can be relative to the current working 10724 directory, or absolute. 10725 10726 #+begin_src emacs-lisp 10727 (setq org-agenda-custom-commands 10728 '(("X" agenda "" nil ("agenda.html" "agenda.ps")) 10729 ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps")) 10730 ("h" "Agenda and Home-related tasks" 10731 ((agenda "") 10732 (tags-todo "home") 10733 (tags "garden")) 10734 nil 10735 ("~/views/home.html")) 10736 ("o" "Agenda and Office-related tasks" 10737 ((agenda) 10738 (tags-todo "work") 10739 (tags "office")) 10740 nil 10741 ("~/views/office.ps" "~/calendars/office.ics")))) 10742 #+end_src 10743 10744 The extension of the file name determines the type of export. If it 10745 is =.html=, Org mode uses the htmlize package to convert the buffer to 10746 HTML and save it to this file name. If the extension is =.ps=, 10747 ~ps-print-buffer-with-faces~ is used to produce Postscript output. If 10748 the extension is =.ics=, iCalendar export is run export over all files 10749 that were used to construct the agenda, and limit the export to 10750 entries listed in the agenda. Any other extension produces a plain 10751 ASCII file. 10752 10753 The export files are /not/ created when you use one of those 10754 commands interactively because this might use too much overhead. 10755 Instead, there is a special command to produce /all/ specified 10756 files in one step: 10757 10758 - {{{kbd(e)}}} (~org-store-agenda-views~) :: 10759 10760 #+kindex: e @r{(Agenda dispatcher)} 10761 #+findex: org-store-agenda-views 10762 Export all agenda views that have export file names associated with 10763 them. 10764 10765 You can use the options section of the custom agenda commands to also 10766 set options for the export commands. For example: 10767 10768 #+begin_src emacs-lisp 10769 (setq org-agenda-custom-commands 10770 '(("X" agenda "" 10771 ((ps-number-of-columns 2) 10772 (ps-landscape-mode t) 10773 (org-agenda-prefix-format " [ ] ") 10774 (org-agenda-with-colors nil) 10775 (org-agenda-remove-tags t)) 10776 ("theagenda.ps")))) 10777 #+end_src 10778 10779 #+texinfo: @noindent 10780 #+vindex: org-agenda-exporter-settings 10781 This command sets two options for the Postscript exporter, to make it 10782 print in two columns in landscape format---the resulting page can be 10783 cut in two and then used in a paper agenda. The remaining settings 10784 modify the agenda prefix to omit category and scheduling information, 10785 and instead include a checkbox to check off items. We also remove the 10786 tags to make the lines compact, and we do not want to use colors for 10787 the black-and-white printer. Settings specified in 10788 ~org-agenda-exporter-settings~ also apply, e.g., 10789 10790 #+begin_src emacs-lisp 10791 (setq org-agenda-exporter-settings 10792 '((ps-number-of-columns 2) 10793 (ps-landscape-mode t) 10794 (org-agenda-add-entry-text-maxlines 5) 10795 (htmlize-output-type 'css))) 10796 #+end_src 10797 10798 #+texinfo: @noindent 10799 but the settings in ~org-agenda-custom-commands~ take precedence. 10800 10801 From the command line you may also use: 10802 10803 #+begin_src shell 10804 emacs -eval (org-batch-store-agenda-views) -kill 10805 #+end_src 10806 10807 #+texinfo: @noindent 10808 or, if you need to modify some parameters[fn:: Quoting depends on the 10809 system you use, please check the FAQ for examples.] 10810 10811 #+begin_src shell 10812 emacs -eval '(org-batch-store-agenda-views \ 10813 org-agenda-span (quote month) \ 10814 org-agenda-start-day "2007-11-01" \ 10815 org-agenda-include-diary nil \ 10816 org-agenda-files (quote ("~/org/project.org")))' \ 10817 -kill 10818 #+end_src 10819 10820 #+texinfo: @noindent 10821 which creates the agenda views restricted to the file 10822 =~/org/project.org=, without diary entries and with a 30-day extent. 10823 10824 You can also extract agenda information in a way that allows further 10825 processing by other programs. See [[*Extracting Agenda Information]], for 10826 more information. 10827 10828 ** Using Column View in the Agenda 10829 :PROPERTIES: 10830 :DESCRIPTION: Using column view for collected entries. 10831 :ALT_TITLE: Agenda Column View 10832 :END: 10833 #+cindex: column view, in agenda 10834 #+cindex: agenda, column view 10835 10836 Column view (see [[*Column View]]) is normally used to view and edit 10837 properties embedded in the hierarchical structure of an Org file. It 10838 can be quite useful to use column view also from the agenda, where 10839 entries are collected by certain criteria. 10840 10841 - {{{kbd(C-c C-x C-c)}}} (~org-agenda-columns~) :: 10842 #+kindex: C-c C-x C-c 10843 #+findex: org-agenda-columns 10844 10845 Turn on column view in the agenda. 10846 10847 To understand how to use this properly, it is important to realize 10848 that the entries in the agenda are no longer in their proper outline 10849 environment. This causes the following issues: 10850 10851 1. 10852 #+vindex: org-columns-default-format-for-agenda 10853 #+vindex: org-columns-default-format 10854 Org needs to make a decision which columns format to use. Since 10855 the entries in the agenda are collected from different files, and 10856 different files may have different columns formats, this is a 10857 non-trivial problem. Org first checks if 10858 ~org-overriding-columns-format~ is currently set, and if so, takes 10859 the format from there. You should set this variable only in the 10860 /local settings section/ of a custom agenda command (see [[*Custom 10861 Agenda Views]]) to make it valid for that specific agenda view. If 10862 no such binding exists, it checks, in sequence, 10863 ~org-columns-default-format-for-agenda~, the format associated with 10864 the first item in the agenda (through a property or a =#+COLUMNS= 10865 setting in that buffer) and finally ~org-columns-default-format~. 10866 10867 2. 10868 #+cindex: @samp{CLOCKSUM}, special property 10869 If any of the columns has a summary type defined (see [[*Column 10870 attributes]]), turning on column view in the agenda visits all 10871 relevant agenda files and make sure that the computations of this 10872 property are up to date. This is also true for the special 10873 =CLOCKSUM= property. Org then sums the values displayed in the 10874 agenda. In the daily/weekly agenda, the sums cover a single day; 10875 in all other views they cover the entire block. 10876 10877 It is important to realize that the agenda may show the same entry 10878 /twice/---for example as scheduled and as a deadline---and it may 10879 show two entries from the same hierarchy (for example a /parent/ 10880 and its /child/). In these cases, the summation in the agenda 10881 leads to incorrect results because some values count double. 10882 10883 3. When the column view in the agenda shows the =CLOCKSUM= property, 10884 that is always the entire clocked time for this item. So even in 10885 the daily/weekly agenda, the clocksum listed in column view may 10886 originate from times outside the current view. This has the 10887 advantage that you can compare these values with a column listing 10888 the planned total effort for a task---one of the major 10889 applications for column view in the agenda. If you want 10890 information about clocked time in the displayed period use clock 10891 table mode (press {{{kbd(R)}}} in the agenda). 10892 10893 4. 10894 #+cindex: @samp{CLOCKSUM_T}, special property 10895 When the column view in the agenda shows the =CLOCKSUM_T= property, 10896 that is always today's clocked time for this item. So even in the 10897 weekly agenda, the clocksum listed in column view only originates 10898 from today. This lets you compare the time you spent on a task for 10899 today, with the time already spent---via =CLOCKSUM=---and with 10900 the planned total effort for it. 10901 10902 * Markup for Rich Contents 10903 :PROPERTIES: 10904 :DESCRIPTION: Compose beautiful documents. 10905 :END: 10906 10907 Org is primarily about organizing and searching through your 10908 plain-text notes. However, it also provides a lightweight yet robust 10909 markup language for rich text formatting and more. For instance, you 10910 may want to center or emphasize text. Or you may need to insert 10911 a formula or image in your writing. Org offers syntax for all of this 10912 and more. Used in conjunction with the export framework (see 10913 [[*Exporting]]), you can author beautiful documents in Org---like the fine 10914 manual you are currently reading. 10915 10916 ** Paragraphs 10917 :PROPERTIES: 10918 :DESCRIPTION: The basic unit of text. 10919 :END: 10920 10921 #+cindex: paragraphs, markup rules 10922 Paragraphs are separated by at least one empty line. If you need to 10923 enforce a line break within a paragraph, use =\\= at the end of 10924 a line. 10925 10926 #+cindex: line breaks, markup rules 10927 To preserve the line breaks, indentation and blank lines in a region, 10928 but otherwise use normal formatting, you can use this construct, which 10929 can also be used to format poetry. 10930 10931 #+cindex: @samp{BEGIN_VERSE} 10932 #+cindex: verse blocks 10933 #+begin_example 10934 ,#+BEGIN_VERSE 10935 Great clouds overhead 10936 Tiny black birds rise and fall 10937 Snow covers Emacs 10938 10939 ---AlexSchroeder 10940 ,#+END_VERSE 10941 #+end_example 10942 10943 When quoting a passage from another document, it is customary to 10944 format this as a paragraph that is indented on both the left and the 10945 right margin. You can include quotations in Org documents like this: 10946 10947 #+cindex: @samp{BEGIN_QUOTE} 10948 #+cindex: quote blocks 10949 #+begin_example 10950 ,#+BEGIN_QUOTE 10951 Everything should be made as simple as possible, 10952 but not any simpler ---Albert Einstein 10953 ,#+END_QUOTE 10954 #+end_example 10955 10956 If you would like to center some text, do it like this: 10957 10958 #+cindex: @samp{BEGIN_CENTER} 10959 #+cindex: center blocks 10960 #+begin_example 10961 ,#+BEGIN_CENTER 10962 Everything should be made as simple as possible, \\ 10963 but not any simpler 10964 ,#+END_CENTER 10965 #+end_example 10966 10967 ** Emphasis and Monospace 10968 :PROPERTIES: 10969 :DESCRIPTION: Bold, italic, etc. 10970 :END: 10971 #+cindex: underlined text, markup rules 10972 #+cindex: bold text, markup rules 10973 #+cindex: italic text, markup rules 10974 #+cindex: verbatim text, markup rules 10975 #+cindex: code text, markup rules 10976 #+cindex: strike-through text, markup rules 10977 10978 You can make words =*bold*=, =/italic/=, =_underlined_=, ==verbatim== 10979 and =~code~=, and, if you must, =+strike-through+=. Text in the code 10980 and verbatim string is not processed for Org specific syntax; it is 10981 exported verbatim. 10982 10983 #+vindex: org-fontify-emphasized-text 10984 To turn off fontification for marked up text, you can set 10985 ~org-fontify-emphasized-text~ to ~nil~. To narrow down the list of 10986 available markup syntax, you can customize ~org-emphasis-alist~. 10987 10988 Sometimes, when marked text also contains the marker character itself, 10989 the result may be unsettling. For example, 10990 10991 #+begin_example 10992 /One may expect this whole sentence to be italicized, but the 10993 following ~user/?variable~ contains =/= character, which effectively 10994 stops emphasis there./ 10995 #+end_example 10996 10997 You can use zero width space to help Org sorting out the ambiguity. 10998 See [[*Escape Character]] for more details. 10999 11000 ** Subscripts and Superscripts 11001 :PROPERTIES: 11002 :DESCRIPTION: Simple syntax for raising/lowering text. 11003 :END: 11004 #+cindex: subscript 11005 #+cindex: superscript 11006 11007 =^= and =_= are used to indicate super- and subscripts. To increase 11008 the readability of ASCII text, it is not necessary, but OK, to 11009 surround multi-character sub- and superscripts with curly braces. For 11010 example 11011 11012 #+begin_example 11013 The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand, 11014 the radius of Alpha Centauri is R_{Alpha Centauri} = 1.28 x R_{sun}. 11015 #+end_example 11016 11017 #+vindex: org-use-sub-superscripts 11018 If you write a text where the underscore is often used in a different 11019 context, Org's convention to always interpret these as subscripts can 11020 get in your way. Configure the variable ~org-use-sub-superscripts~ to 11021 change this convention. For example, when setting this variable to 11022 ~{}~, =a_b= is not interpreted as a subscript, but =a_{b}= is. 11023 11024 You can set ~org-use-sub-superscripts~ in a file using the export 11025 option =^:= (see [[*Export Settings][Export Settings]]). For example, =#+OPTIONS: ^:{}= 11026 sets ~org-use-sub-superscripts~ to ~{}~ and limits super- and 11027 subscripts to the curly bracket notation. 11028 11029 You can also toggle the visual display of super- and subscripts: 11030 11031 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~) :: 11032 11033 #+kindex: C-c C-x \ 11034 #+findex: org-toggle-pretty-entities 11035 This command formats sub- and superscripts in a WYSIWYM way. 11036 11037 #+vindex: org-pretty-entities 11038 #+vindex: org-pretty-entities-include-sub-superscripts 11039 Set both ~org-pretty-entities~ and 11040 ~org-pretty-entities-include-sub-superscripts~ to ~t~ to start with 11041 super- and subscripts /visually/ interpreted as specified by the 11042 option ~org-use-sub-superscripts~. 11043 11044 ** Special Symbols 11045 :PROPERTIES: 11046 :DESCRIPTION: Greek letters and other symbols. 11047 :END: 11048 #+cindex: math symbols 11049 #+cindex: special symbols 11050 #+cindex: entities 11051 11052 You can use LaTeX-like syntax to insert special symbols---named 11053 entities---like =\alpha= to indicate the Greek letter, or =\to= to indicate 11054 an arrow. Completion for these symbols is available, just type =\= 11055 and maybe a few letters, and press {{{kbd(M-TAB)}}} to see possible 11056 completions. If you need such a symbol inside a word, terminate it 11057 with a pair of curly brackets. For example 11058 11059 #+begin_example 11060 Pro tip: Given a circle \Gamma of diameter d, the length of its 11061 circumference is \pi{}d. 11062 #+end_example 11063 11064 #+findex: org-entities-help 11065 #+vindex: org-entities-user 11066 A large number of entities is provided, with names taken from both 11067 HTML and LaTeX; you can comfortably browse the complete list from 11068 a dedicated buffer using the command ~org-entities-help~. It is also 11069 possible to provide your own special symbols in the variable 11070 ~org-entities-user~. 11071 11072 During export, these symbols are transformed into the native format of 11073 the exporter back-end. Strings like =\alpha= are exported as =α= in 11074 the HTML output, and as =\(\alpha\)= in the LaTeX output. Similarly, =\nbsp= 11075 becomes = = in HTML and =~= in LaTeX. 11076 11077 #+cindex: special symbols, in-buffer display 11078 If you would like to see entities displayed as UTF-8 characters, use 11079 the following command[fn:: You can turn this on by default by setting 11080 the variable ~org-pretty-entities~, or on a per-file base with the 11081 =STARTUP= option =entitiespretty=.]: 11082 11083 - {{{kbd(C-c C-x \)}}} (~org-toggle-pretty-entities~) :: 11084 #+kindex: C-c C-x \ 11085 #+findex: org-toggle-pretty-entities 11086 11087 Toggle display of entities as UTF-8 characters. This does not 11088 change the buffer content which remains plain ASCII, but it overlays 11089 the UTF-8 character for display purposes only. 11090 11091 #+cindex: shy hyphen, special symbol 11092 #+cindex: dash, special symbol 11093 #+cindex: ellipsis, special symbol 11094 In addition to regular entities defined above, Org exports in a 11095 special way[fn:: This behavior can be disabled with =-= export setting 11096 (see [[*Export Settings]]).] the following commonly used character 11097 combinations: =\-= is treated as a shy hyphen, =--= and =---= are 11098 converted into dashes, and =...= becomes a compact set of dots. 11099 11100 ** Embedded LaTeX 11101 :PROPERTIES: 11102 :DESCRIPTION: LaTeX can be freely used inside Org documents. 11103 :END: 11104 #+cindex: @TeX{} interpretation 11105 #+cindex: @LaTeX{} interpretation 11106 11107 Plain ASCII is normally sufficient for almost all note taking. 11108 Exceptions include scientific notes, which often require mathematical 11109 symbols and the occasional formula. LaTeX[fn:36] is widely used to 11110 typeset scientific documents. Org mode supports embedding LaTeX code 11111 into its files, because many academics are used to writing and reading 11112 LaTeX source code, and because it can be readily processed to produce 11113 pretty output for a number of export back-ends. 11114 11115 *** LaTeX fragments 11116 :PROPERTIES: 11117 :DESCRIPTION: Complex formulas made easy. 11118 :END: 11119 #+cindex: @LaTeX{} fragments 11120 11121 #+vindex: org-format-latex-header 11122 Org mode can contain LaTeX math fragments, and it supports ways to 11123 process these for several export back-ends. When exporting to LaTeX, 11124 the code is left as it is. When exporting to HTML, Org can use either 11125 [[https://www.mathjax.org][MathJax]] (see [[*Math formatting in HTML export]]) or transcode the math 11126 into images (see [[*Previewing LaTeX fragments]]). 11127 11128 LaTeX fragments do not need any special marking at all. The following 11129 snippets are identified as LaTeX source code: 11130 11131 - Environments of any kind[fn:37]. The only requirement is that the 11132 =\begin= statement appears on a new line, preceded by only 11133 whitespace. 11134 11135 - Text within the usual LaTeX math delimiters. To avoid conflicts 11136 with currency specifications, single =$= characters are only 11137 recognized as math delimiters if the enclosed text contains at most 11138 two line breaks, is directly attached to the =$= characters with no 11139 whitespace in between, and if the closing =$= is followed by 11140 whitespace, punctuation or a dash. For the other delimiters, there 11141 is no such restriction, so when in doubt, use =\(...\)= as inline 11142 math delimiters. 11143 11144 #+texinfo: @noindent 11145 For example: 11146 11147 #+begin_example 11148 \begin{equation} % arbitrary environments, 11149 x=\sqrt{b} % even tables, figures 11150 \end{equation} % etc 11151 11152 If $a^2=b$ and \( b=2 \), then the solution must be 11153 either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \]. 11154 #+end_example 11155 11156 #+vindex: org-export-with-latex 11157 LaTeX processing can be configured with the variable 11158 ~org-export-with-latex~. The default setting is ~t~ which means 11159 MathJax for HTML, and no processing for ASCII and LaTeX back-ends. 11160 You can also set this variable on a per-file basis using one of these 11161 lines: 11162 11163 | =#+OPTIONS: tex:t= | Do the right thing automatically (MathJax) | 11164 | =#+OPTIONS: tex:nil= | Do not process LaTeX fragments at all | 11165 | =#+OPTIONS: tex:verbatim= | Verbatim export, for jsMath or so | 11166 11167 *** Previewing LaTeX fragments 11168 :PROPERTIES: 11169 :DESCRIPTION: What will this snippet look like? 11170 :END: 11171 #+cindex: @LaTeX{} fragments, preview 11172 11173 #+vindex: org-preview-latex-default-process 11174 If you have a working LaTeX installation and =dvipng=, =dvisvgm= or 11175 =convert= installed[fn:38], LaTeX fragments can be processed to 11176 produce images of the typeset expressions to be used for inclusion 11177 while exporting to HTML (see [[*LaTeX fragments]]), or for inline 11178 previewing within Org mode. 11179 11180 #+vindex: org-format-latex-options 11181 #+vindex: org-format-latex-header 11182 You can customize the variables ~org-format-latex-options~ and 11183 ~org-format-latex-header~ to influence some aspects of the preview. 11184 In particular, the ~:scale~ (and for HTML export, ~:html-scale~) 11185 property of the former can be used to adjust the size of the preview 11186 images. 11187 11188 - {{{kbd(C-c C-x C-l)}}} (~org-latex-preview~) :: 11189 #+kindex: C-c C-x C-l 11190 #+findex: org-latex-preview 11191 11192 Produce a preview image of the LaTeX fragment at point and overlay 11193 it over the source code. If there is no fragment at point, process 11194 all fragments in the current entry---between two headlines. 11195 11196 When called with a single prefix argument, clear all images in the 11197 current entry. Two prefix arguments produce a preview image for all 11198 fragments in the buffer, while three of them clear all the images in 11199 that buffer. 11200 11201 #+vindex: org-startup-with-latex-preview 11202 You can turn on the previewing of all LaTeX fragments in a file with 11203 11204 : #+STARTUP: latexpreview 11205 11206 To disable it, simply use 11207 11208 : #+STARTUP: nolatexpreview 11209 11210 *** Using CDLaTeX to enter math 11211 :PROPERTIES: 11212 :DESCRIPTION: Speed up entering of formulas. 11213 :ALT_TITLE: CDLaTeX mode 11214 :END: 11215 #+cindex: CD@LaTeX{} 11216 11217 CDLaTeX mode is a minor mode that is normally used in combination with 11218 a major LaTeX mode like AUCTeX in order to speed-up insertion of 11219 environments and math templates. Inside Org mode, you can make use of 11220 some of the features of CDLaTeX mode. You need to install 11221 =cdlatex.el= and =texmathp.el= (the latter comes also with AUCTeX) 11222 from [[https://elpa.nongnu.org/][NonGNU ELPA]] with the [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Installation.html][Emacs packaging system]] or alternatively from 11223 [[https://staff.fnwi.uva.nl/c.dominik/Tools/cdlatex/]]. Do not use 11224 CDLaTeX mode itself under Org mode, but use the special version Org 11225 CDLaTeX minor mode that comes as part of Org. Turn it on for the 11226 current buffer with {{{kbd(M-x org-cdlatex-mode)}}}, or for all Org 11227 files with 11228 11229 #+begin_src emacs-lisp 11230 (add-hook 'org-mode-hook #'turn-on-org-cdlatex) 11231 #+end_src 11232 11233 When this mode is enabled, the following features are present (for 11234 more details see the documentation of CDLaTeX mode): 11235 11236 #+attr_texinfo: :sep , 11237 - {{{kbd(C-c {)}}} :: 11238 #+kindex: C-c @{ 11239 11240 Insert an environment template. 11241 11242 - {{{kbd(TAB)}}} :: 11243 #+kindex: TAB 11244 11245 The {{{kbd(TAB)}}} key expands the template if point is inside a 11246 LaTeX fragment[fn:: Org mode has a method to test if point is inside 11247 such a fragment, see the documentation of the function 11248 ~org-inside-LaTeX-fragment-p~.]. For example, {{{kbd(TAB)}}} 11249 expands =fr= to =\frac{}{}= and position point correctly inside the 11250 first brace. Another {{{kbd(TAB)}}} gets you into the second brace. 11251 11252 Even outside fragments, {{{kbd(TAB)}}} expands environment 11253 abbreviations at the beginning of a line. For example, if you write 11254 =equ= at the beginning of a line and press {{{kbd(TAB)}}}, this 11255 abbreviation is expanded to an =equation= environment. To get 11256 a list of all abbreviations, type {{{kbd(M-x 11257 cdlatex-command-help)}}}. 11258 11259 - {{{kbd(^)}}}, {{{kbd(_)}}} :: 11260 #+kindex: _ 11261 #+kindex: ^ 11262 #+vindex: cdlatex-simplify-sub-super-scripts 11263 11264 Pressing {{{kbd(_)}}} and {{{kbd(^)}}} inside a LaTeX fragment 11265 inserts these characters together with a pair of braces. If you use 11266 {{{kbd(TAB)}}} to move out of the braces, and if the braces surround 11267 only a single character or macro, they are removed again (depending 11268 on the variable ~cdlatex-simplify-sub-super-scripts~). 11269 11270 - {{{kbd(`)}}} :: 11271 #+kindex: ` 11272 11273 Pressing the backquote followed by a character inserts math macros, 11274 also outside LaTeX fragments. If you wait more than 1.5 seconds 11275 after the backquote, a help window pops up. 11276 11277 - {{{kbd(')}}} :: 11278 #+kindex: ' 11279 11280 Pressing the single-quote followed by another character modifies the 11281 LaTeX symbol before point with an accent or a font. If you wait 11282 more than 1.5 seconds after the single-quote, a help window pops up. 11283 Character modification works only inside LaTeX fragments; outside 11284 the quote is normal. 11285 11286 ** Literal Examples 11287 :PROPERTIES: 11288 :DESCRIPTION: Source code examples with special formatting. 11289 :END: 11290 #+cindex: literal examples, markup rules 11291 #+cindex: code line references, markup rules 11292 11293 You can include literal examples that should not be subjected to 11294 markup. Such examples are typeset in monospace, so this is well 11295 suited for source code and similar examples. 11296 11297 #+cindex: @samp{BEGIN_EXAMPLE} 11298 #+cindex: example block 11299 #+begin_example 11300 ,#+BEGIN_EXAMPLE 11301 Some example from a text file. 11302 ,#+END_EXAMPLE 11303 #+end_example 11304 11305 #+cindex: comma escape, in literal examples 11306 There is one limitation, however. You must insert a comma right 11307 before lines starting with either =*=, =,*=, =#+= or =,#+=, as those 11308 may be interpreted as outlines nodes or some other special syntax. 11309 Org transparently strips these additional commas whenever it accesses 11310 the contents of the block. 11311 11312 #+begin_example 11313 ,#+BEGIN_EXAMPLE 11314 ,,* I am no real headline 11315 ,#+END_EXAMPLE 11316 #+end_example 11317 11318 For simplicity when using small examples, you can also start the 11319 example lines with a colon followed by a space. There may also be 11320 additional whitespace before the colon: 11321 11322 #+begin_example 11323 Here is an example 11324 : Some example from a text file. 11325 #+end_example 11326 11327 #+cindex: formatting source code, markup rules 11328 #+vindex: org-latex-src-block-backend 11329 If the example is source code from a programming language, or any 11330 other text that can be marked up by Font Lock in Emacs, you can ask 11331 for the example to look like the fontified Emacs buffer[fn:39]. This 11332 is done with the code block, where you also need to specify the name 11333 of the major mode that should be used to fontify the example[fn:40], 11334 see [[*Structure Templates]] for shortcuts to easily insert code blocks. 11335 11336 #+cindex: @samp{BEGIN_SRC} 11337 #+cindex: source block 11338 #+begin_example 11339 ,#+BEGIN_SRC emacs-lisp 11340 (defun org-xor (a b) 11341 "Exclusive or." 11342 (if a (not b) b)) 11343 ,#+END_SRC 11344 #+end_example 11345 11346 Both in =example= and in =src= snippets, you can add a =-n= switch to 11347 the end of the =#+BEGIN= line, to get the lines of the example 11348 numbered. The =-n= takes an optional numeric argument specifying the 11349 starting line number of the block. If you use a =+n= switch, the 11350 numbering from the previous numbered snippet is continued in the 11351 current one. The =+n= switch can also take a numeric argument. This 11352 adds the value of the argument to the last line of the previous block 11353 to determine the starting line number. 11354 11355 #+begin_example 11356 ,#+BEGIN_SRC emacs-lisp -n 20 11357 ;; This exports with line number 20. 11358 (message "This is line 21") 11359 ,#+END_SRC 11360 11361 ,#+BEGIN_SRC emacs-lisp +n 10 11362 ;; This is listed as line 31. 11363 (message "This is line 32") 11364 ,#+END_SRC 11365 #+end_example 11366 11367 In literal examples, Org interprets strings like =(ref:name)= as 11368 labels, and use them as targets for special hyperlinks like 11369 =[[(name)]]=---i.e., the reference name enclosed in single parenthesis. 11370 In HTML, hovering the mouse over such a link remote-highlights the 11371 corresponding code line, which is kind of cool. 11372 11373 You can also add a =-r= switch which /removes/ the labels from the 11374 source code[fn:: Adding =-k= to =-n -r= /keeps/ the labels in the 11375 source code while using line numbers for the links, which might be 11376 useful to explain those in an Org mode example code.]. With the =-n= 11377 switch, links to these references are labeled by the line numbers from 11378 the code listing. Otherwise links use the labels with no parentheses. 11379 Here is an example: 11380 11381 #+begin_example -l "(dumb-reference:%s)" 11382 ,#+BEGIN_SRC emacs-lisp -n -r 11383 (save-excursion (ref:sc) 11384 (goto-char (point-min)) (ref:jump) 11385 ,#+END_SRC 11386 In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]] 11387 jumps to point-min. 11388 #+end_example 11389 11390 #+cindex: indentation, in source blocks 11391 Source code and examples may be /indented/ in order to align nicely 11392 with the surrounding text, and in particular with plain list structure 11393 (see [[*Plain Lists]]). By default, Org only retains the relative 11394 indentation between lines, e.g., when exporting the contents of the 11395 block. However, you can use the =-i= switch to also preserve the 11396 global indentation, if it does matter. See [[*Editing Source Code]]. 11397 11398 #+vindex: org-coderef-label-format 11399 If the syntax for the label format conflicts with the language syntax, 11400 use a =-l= switch to change the format, for example 11401 11402 : #+BEGIN_SRC pascal -n -r -l "((%s))" 11403 11404 #+texinfo: @noindent 11405 See also the variable ~org-coderef-label-format~. 11406 11407 HTML export also allows examples to be published as text areas (see 11408 [[*Text areas in HTML export]]). 11409 11410 Because the =#+BEGIN= ... =#+END= patterns need to be added so often, 11411 a shortcut is provided (see [[*Structure Templates]]). 11412 11413 - {{{kbd(C-c ')}}} (~org-edit-special~) :: 11414 11415 #+kindex: C-c ' 11416 #+findex: org-edit-special 11417 Edit the source code example at point in its native mode. This 11418 works by switching to a temporary buffer with the source code. You 11419 need to exit by pressing {{{kbd(C-c ')}}} again. The edited version 11420 then replaces the old version in the Org buffer. Fixed-width 11421 regions---where each line starts with a colon followed by a 11422 space---are edited using Artist mode[fn:: You may select a different 11423 mode with the variable ~org-edit-fixed-width-region-mode~.] to allow 11424 creating ASCII drawings easily. Using this command in an empty line 11425 creates a new fixed-width region. 11426 11427 #+cindex: storing link, in a source code buffer 11428 Calling ~org-store-link~ (see [[*Handling Links]]) while editing a source 11429 code example in a temporary buffer created with {{{kbd(C-c ')}}} 11430 prompts for a label. Make sure that it is unique in the current 11431 buffer, and insert it with the proper formatting like =(ref:label)= at 11432 the end of the current line. Then the label is stored as a link 11433 =(label)=, for retrieval with {{{kbd(C-c C-l)}}}. 11434 11435 ** Images 11436 :PROPERTIES: 11437 :DESCRIPTION: Display an image. 11438 :END: 11439 11440 #+cindex: inlining images 11441 #+cindex: images, markup rules 11442 An image is a link to an image file[fn:: What Emacs considers to be an 11443 image depends on ~image-file-name-extensions~ and 11444 ~image-file-name-regexps~.] that does not have a description part, for 11445 example 11446 11447 : ./img/cat.jpg 11448 11449 If you wish to define a caption for the image (see [[*Captions]]) and 11450 maybe a label for internal cross references (see [[*Internal Links]]), 11451 make sure that the link is on a line by itself and precede it with 11452 =CAPTION= and =NAME= keywords as follows: 11453 11454 #+begin_example 11455 ,#+CAPTION: This is the caption for the next figure link (or table) 11456 ,#+NAME: fig:SED-HR4049 11457 [[./img/a.jpg]] 11458 #+end_example 11459 11460 Such images can be displayed within the buffer with the following 11461 command: 11462 11463 - {{{kbd(C-c C-x C-v)}}} (~org-toggle-inline-images~) :: 11464 11465 #+kindex: C-c C-x C-v 11466 #+findex: org-toggle-inline-images 11467 #+vindex: org-startup-with-inline-images 11468 Toggle the inline display of linked images. When called with a 11469 prefix argument, also display images that do have a link 11470 description. You can ask for inline images to be displayed at 11471 startup by configuring the variable 11472 ~org-startup-with-inline-images~[fn:: The variable 11473 ~org-startup-with-inline-images~ can be set within a buffer with the 11474 =STARTUP= options =inlineimages= and =noinlineimages=.]. 11475 11476 11477 #+vindex: org-image-actual-width 11478 #+cindex: @samp{ORG-IMAGE-ACTUAL-WIDTH}, property 11479 By default, Org mode displays inline images according to their 11480 actual width. You can customize the displayed image width using 11481 ~org-image-actual-width~ variable (globally) or 11482 =ORG-IMAGE-ACTUAL-WIDTH= property (subtree-level)[fn:: The width can 11483 be customized in Emacs >= 24.1, built with imagemagick support.]. 11484 Their value can be the following: 11485 - (default) Non-nil, use the actual width of images when inlining them. 11486 - When set to a number, use imagemagick (when available) to set the 11487 image's width to this value. 11488 - When set to a number in a list, try to get the width from any 11489 =#+ATTR.*= keyword if it matches a width specification like: 11490 #+begin_example 11491 ,#+ATTR_HTML: :width 300px 11492 #+end_example 11493 and fall back on that number if none is found. 11494 - When set to nil, try to get the width from an =#+ATTR.*= keyword 11495 and fall back on the original width if none is found. 11496 11497 11498 #+vindex: org-cycle-inline-images-display 11499 Inline images can also be displayed when cycling the folding state. 11500 When custom option ~org-cycle-inline-images-display~ is set, the 11501 visible inline images under subtree will be displayed automatically. 11502 11503 ** Captions 11504 :PROPERTIES: 11505 :DESCRIPTION: Describe tables, images... 11506 :END: 11507 #+cindex: captions, markup rules 11508 #+cindex: @samp{CAPTION}, keyword 11509 11510 You can assign a caption to a specific part of a document by inserting 11511 a =CAPTION= keyword immediately before it: 11512 11513 #+begin_example 11514 ,#+CAPTION: This is the caption for the next table (or link) 11515 | ... | ... | 11516 |-----+-----| 11517 #+end_example 11518 11519 Optionally, the caption can take the form: 11520 11521 : #+CAPTION[Short caption]: Longer caption. 11522 11523 Even though images and tables are prominent examples of captioned 11524 structures, the same caption mechanism can apply to many 11525 others---e.g., LaTeX equations, source code blocks. Depending on the 11526 export back-end, those may or may not be handled. 11527 11528 ** Horizontal Rules 11529 :PROPERTIES: 11530 :DESCRIPTION: Make a line. 11531 :END: 11532 11533 #+cindex: horizontal rules, markup rules 11534 A line consisting of only dashes, and at least 5 of them, is exported 11535 as a horizontal line. 11536 11537 ** Creating Footnotes 11538 :PROPERTIES: 11539 :DESCRIPTION: Edit and read footnotes. 11540 :END: 11541 #+cindex: footnotes 11542 11543 A footnote is started by a footnote marker in square brackets in 11544 column 0, no indentation allowed. It ends at the next footnote 11545 definition, headline, or after two consecutive empty lines. The 11546 footnote reference is simply the marker in square brackets, inside 11547 text. Markers always start with =fn:=. For example: 11548 11549 #+begin_example 11550 The Org website[fn:1] now looks a lot better than it used to. 11551 ... 11552 [fn:55] The link is: https://orgmode.org 11553 #+end_example 11554 11555 Org mode extends the number-based syntax to /named/ footnotes and 11556 optional inline definition. Here are the valid references: 11557 11558 - =[fn:NAME]= :: 11559 11560 A named footnote reference, where {{{var(NAME)}}} is a unique 11561 label word, or, for simplicity of automatic creation, a number. 11562 11563 - =[fn:: This is the inline definition of this footnote]= :: 11564 11565 An anonymous footnote where the definition is given directly at the 11566 reference point. 11567 11568 - =[fn:NAME: a definition]= :: 11569 11570 An inline definition of a footnote, which also specifies a name for 11571 the note. Since Org allows multiple references to the same note, 11572 you can then use =[fn:NAME]= to create additional references. 11573 11574 #+vindex: org-footnote-auto-label 11575 Footnote labels can be created automatically, or you can create names 11576 yourself. This is handled by the variable ~org-footnote-auto-label~ 11577 and its corresponding =STARTUP= keywords. See the docstring of that 11578 variable for details. 11579 11580 The following command handles footnotes: 11581 11582 - {{{kbd(C-c C-x f)}}} :: 11583 11584 The footnote action command. 11585 11586 #+kindex: C-c C-x f 11587 When point is on a footnote reference, jump to the definition. When 11588 it is at a definition, jump to the---first---reference. 11589 11590 #+vindex: org-footnote-define-inline 11591 #+vindex: org-footnote-section 11592 Otherwise, create a new footnote. Depending on the variable 11593 ~org-footnote-define-inline~[fn:: The corresponding in-buffer 11594 setting is: =#+STARTUP: fninline= or =#+STARTUP: nofninline=.], the 11595 definition is placed right into the text as part of the reference, 11596 or separately into the location determined by the variable 11597 ~org-footnote-section~. 11598 11599 When this command is called with a prefix argument, a menu of 11600 additional options is offered: 11601 11602 #+attr_texinfo: :columns 0.1 0.9 11603 | {{{kbd(s)}}} | Sort the footnote definitions by reference sequence. | 11604 | {{{kbd(r)}}} | Renumber the simple =fn:N= footnotes. | 11605 | {{{kbd(S)}}} | Short for first {{{kbd(r)}}}, then {{{kbd(s)}}} action. | 11606 | {{{kbd(n)}}} | Rename all footnotes into a =fn:1= ... =fn:n= sequence. | 11607 | {{{kbd(d)}}} | Delete the footnote at point, including definition and references. | 11608 11609 #+vindex: org-footnote-auto-adjust 11610 Depending on the variable ~org-footnote-auto-adjust~[fn:: The 11611 corresponding in-buffer options are =#+STARTUP: fnadjust= and 11612 =#+STARTUP: nofnadjust=.], renumbering and sorting footnotes can be 11613 automatic after each insertion or deletion. 11614 11615 - {{{kbd(C-c C-c)}}} :: 11616 11617 #+kindex: C-c C-c 11618 If point is on a footnote reference, jump to the definition. If it 11619 is at the definition, jump back to the reference. When called at 11620 a footnote location with a prefix argument, offer the same menu as 11621 {{{kbd(C-c C-x f)}}}. 11622 11623 - {{{kbd(C-c C-o)}}} or {{{kbd(mouse-1/2)}}} :: 11624 11625 #+kindex: C-c C-o 11626 #+kindex: mouse-1 11627 #+kindex: mouse-2 11628 Footnote labels are also links to the corresponding definition or 11629 reference, and you can use the usual commands to follow these links. 11630 11631 * Exporting 11632 :PROPERTIES: 11633 :DESCRIPTION: Sharing and publishing notes. 11634 :END: 11635 #+cindex: exporting 11636 11637 At some point you might want to print your notes, publish them on the 11638 web, or share them with people not using Org. Org can convert and 11639 export documents to a variety of other formats while retaining as much 11640 structure (see [[*Document Structure]]) and markup (see [[*Markup for Rich 11641 Contents]]) as possible. 11642 11643 #+cindex: export back-end 11644 The libraries responsible for translating Org files to other formats 11645 are called /back-ends/. Org ships with support for the following 11646 back-ends: 11647 11648 - /ascii/ (ASCII format) 11649 - /beamer/ (LaTeX Beamer format) 11650 - /html/ (HTML format) 11651 - /icalendar/ (iCalendar format) 11652 - /latex/ (LaTeX format) 11653 - /md/ (Markdown format) 11654 - /odt/ (OpenDocument Text format) 11655 - /org/ (Org format) 11656 - /texinfo/ (Texinfo format) 11657 - /man/ (Man page format) 11658 11659 Users can install libraries for additional formats from the Emacs 11660 packaging system. For easy discovery, these packages have a common 11661 naming scheme: ~ox-NAME~, where {{{var(NAME)}}} is a format. For 11662 example, ~ox-koma-letter~ for /koma-letter/ back-end. More libraries 11663 can be found in the =org-contrib= repository (see [[*Installation]]). 11664 11665 #+vindex: org-export-backends 11666 Org only loads back-ends for the following formats by default: ASCII, 11667 HTML, iCalendar, LaTeX, and ODT. Additional back-ends can be loaded 11668 in either of two ways: by configuring the ~org-export-backends~ 11669 variable, or by requiring libraries in the Emacs init file. For 11670 example, to load the Markdown back-end, add this to your Emacs config: 11671 11672 #+begin_src emacs-lisp 11673 (require 'ox-md) 11674 #+end_src 11675 11676 ** The Export Dispatcher 11677 :PROPERTIES: 11678 :DESCRIPTION: The main interface. 11679 :END: 11680 #+cindex: dispatcher, for export commands 11681 #+cindex: export, dispatcher 11682 11683 The export dispatcher is the main interface for Org's exports. 11684 A hierarchical menu presents the currently configured export formats. 11685 Options are shown as easy toggle switches on the same screen. 11686 11687 #+vindex: org-export-dispatch-use-expert-ui 11688 Org also has a minimal prompt interface for the export dispatcher. 11689 When the variable ~org-export-dispatch-use-expert-ui~ is set to 11690 a non-~nil~ value, Org prompts in the minibuffer. To switch back to 11691 the hierarchical menu, press {{{kbd(?)}}}. 11692 11693 - {{{kbd(C-c C-e)}}} (~org-export~) :: 11694 #+kindex: C-c C-e 11695 #+findex: org-export 11696 11697 Invokes the export dispatcher interface. The options show default 11698 settings. The {{{kbd(C-u)}}} prefix argument preserves options from 11699 the previous export, including any subtree selections. 11700 11701 Org exports the entire buffer by default. If the Org buffer has an 11702 active region, then Org exports just that region. 11703 11704 Within the dispatcher interface, the following key combinations can 11705 further alter what is exported, and how. 11706 11707 - {{{kbd(C-a)}}} :: 11708 #+kindex: C-c C-e C-a 11709 11710 Toggle asynchronous export. Asynchronous export uses an external 11711 Emacs process with a specially configured initialization file to 11712 complete the exporting process in the background, without tying-up 11713 Emacs. This is particularly useful when exporting long documents. 11714 11715 Output from an asynchronous export is saved on the /export stack/. 11716 To view this stack, call the export dispatcher with a double 11717 {{{kbd(C-u)}}} prefix argument. If already in the export dispatcher 11718 menu, {{{kbd(&)}}} displays the stack. 11719 11720 #+vindex: org-export-in-background 11721 You can make asynchronous export the default by setting 11722 ~org-export-in-background~. 11723 11724 #+vindex: org-export-async-init-file 11725 You can set the initialization file used by the background process 11726 by setting ~org-export-async-init-file~. 11727 11728 - {{{kbd(C-b)}}} :: 11729 #+kindex: C-c C-e C-b 11730 11731 Toggle body-only export. Useful for excluding headers and footers 11732 in the export. Affects only those back-end formats that have 11733 sections like =<head>...</head>= in HTML. 11734 11735 - {{{kbd(C-s)}}} :: 11736 #+kindex: C-c C-e C-s 11737 11738 Toggle subtree export. When turned on, Org exports only the 11739 subtree starting from point position at the time the export 11740 dispatcher was invoked. Org uses the top heading of this subtree 11741 as the document's title. If point is not on a heading, Org uses the 11742 nearest enclosing header. If point is in the document preamble, Org 11743 signals an error and aborts export. 11744 11745 #+vindex: org-export-initial-scope 11746 To make subtree export the default, customize the variable 11747 ~org-export-initial-scope~. 11748 11749 - {{{kbd(C-v)}}} :: 11750 #+kindex: C-c C-e C-v 11751 11752 Toggle visible-only export. This is useful for exporting only 11753 certain parts of an Org document by adjusting the visibility of 11754 particular headings. See also [[*Sparse Trees]]. 11755 11756 ** Export Settings 11757 :PROPERTIES: 11758 :DESCRIPTION: Common export settings. 11759 :END: 11760 #+cindex: options, for export 11761 #+cindex: Export, settings 11762 11763 #+cindex: @samp{OPTIONS}, keyword 11764 Export options can be set: globally with variables; for an individual 11765 file by making variables buffer-local with in-buffer settings (see 11766 [[*Summary of In-Buffer Settings]]); by setting individual keywords or 11767 specifying them in compact form with the =OPTIONS= keyword; or for 11768 a tree by setting properties (see [[*Properties and Columns]]). Options 11769 set at a specific level override options set at a more general level. 11770 11771 #+cindex: @samp{SETUPFILE}, keyword 11772 In-buffer settings may appear anywhere in the file, either directly or 11773 indirectly through a file included using =#+SETUPFILE: filename or 11774 URL= syntax. Option keyword sets tailored to a particular back-end 11775 can be inserted from the export dispatcher (see [[*The Export 11776 Dispatcher]]) using the =Insert template= command by pressing 11777 {{{kbd(#)}}}. To insert keywords individually, a good way to make 11778 sure the keyword is correct is to type =#+= and then to use 11779 {{{kbd(M-TAB)}}}[fn:6] for completion. 11780 11781 The export keywords available for every back-end, and their equivalent 11782 global variables, include: 11783 11784 - =AUTHOR= :: 11785 11786 #+cindex: @samp{AUTHOR}, keyword 11787 #+vindex: user-full-name 11788 The document author (~user-full-name~). 11789 11790 - =CREATOR= :: 11791 11792 #+cindex: @samp{CREATOR}, keyword 11793 #+vindex: org-expot-creator-string 11794 Entity responsible for output generation 11795 (~org-export-creator-string~). 11796 11797 - =DATE= :: 11798 11799 #+cindex: @samp{DATE}, keyword 11800 #+vindex: org-export-date-timestamp-format 11801 A date or a time-stamp[fn:: The variable 11802 ~org-export-date-timestamp-format~ defines how this timestamp are 11803 exported.]. 11804 11805 - =EMAIL= :: 11806 11807 #+cindex: @samp{EMAIL}, keyword 11808 #+vindex: user-mail-address 11809 The email address (~user-mail-address~). 11810 11811 - =LANGUAGE= :: 11812 11813 #+cindex: @samp{LANGUAGE}, keyword 11814 #+vindex: org-export-default-language 11815 Language to use for translating certain strings 11816 (~org-export-default-language~). With =#+LANGUAGE: fr=, for 11817 example, Org translates =Table of contents= to the French =Table des 11818 matières=[fn:41]. 11819 11820 - =SELECT_TAGS= :: 11821 11822 #+cindex: @samp{SELECT_TAGS}, keyword 11823 #+vindex: org-export-select-tags 11824 The default value is =("export")=. When a tree is tagged with 11825 =export= (~org-export-select-tags~), Org selects that tree and its 11826 subtrees for export. Org excludes trees with =noexport= tags, see 11827 below. When selectively exporting files with =export= tags set, Org 11828 does not export any text that appears before the first headline. 11829 11830 - =EXCLUDE_TAGS= :: 11831 11832 #+cindex: @samp{EXCLUDE_TAGS}, keyword 11833 #+vindex: org-export-exclude-tags 11834 The default value is =("noexport")=. When a tree is tagged with 11835 =noexport= (~org-export-exclude-tags~), Org excludes that tree and 11836 its subtrees from export. Entries tagged with =noexport= are 11837 unconditionally excluded from the export, even if they have an 11838 =export= tag. Even if a subtree is not exported, Org executes any 11839 code blocks contained there. 11840 11841 - =TITLE= :: 11842 11843 #+cindex: @samp{TITLE}, keyword 11844 #+cindex: document title 11845 Org displays this title. For long titles, use multiple =#+TITLE= 11846 lines. 11847 11848 - =EXPORT_FILE_NAME= :: 11849 11850 #+cindex: @samp{EXPORT_FILE_NAME}, keyword 11851 The name of the output file to be generated. Otherwise, Org 11852 generates the file name based on the buffer name and the extension 11853 based on the back-end format. 11854 11855 The =OPTIONS= keyword is a compact form. To configure multiple 11856 options, use several =OPTIONS= lines. =OPTIONS= recognizes the 11857 following arguments. 11858 11859 - ~'~ :: 11860 11861 #+vindex: org-export-with-smart-quotes 11862 Toggle smart quotes (~org-export-with-smart-quotes~). Depending on 11863 the language used, when activated, Org treats pairs of double quotes 11864 as primary quotes, pairs of single quotes as secondary quotes, and 11865 single quote marks as apostrophes. 11866 11867 - ~*~ :: 11868 11869 #+vindex: org-export-with-emphasize 11870 Toggle emphasized text (~org-export-with-emphasize~). 11871 11872 - ~-~ :: 11873 11874 #+vindex: org-export-with-special-strings 11875 Toggle conversion of special strings 11876 (~org-export-with-special-strings~). 11877 11878 - ~:~ :: 11879 11880 #+vindex: org-export-with-fixed-width 11881 Toggle fixed-width sections (~org-export-with-fixed-width~). 11882 11883 - ~<~ :: 11884 11885 #+vindex: org-export-with-timestamps 11886 Toggle inclusion of time/date active/inactive stamps 11887 (~org-export-with-timestamps~). 11888 11889 - ~\n~ :: 11890 11891 #+vindex: org-export-preserve-breaks 11892 Toggles whether to preserve line breaks 11893 (~org-export-preserve-breaks~). 11894 11895 - ~^~ :: 11896 11897 #+vindex: org-export-with-sub-superscripts 11898 Toggle TeX-like syntax for sub- and superscripts. If you write 11899 =^:{}=, =a_{b}= is interpreted, but the simple =a_b= is left as it 11900 is (~org-export-with-sub-superscripts~). 11901 11902 - ~arch~ :: 11903 11904 #+vindex: org-export-with-archived-trees 11905 Configure how archived trees are exported. When set to ~headline~, 11906 the export process skips the contents and processes only the 11907 headlines (~org-export-with-archived-trees~). 11908 11909 - ~author~ :: 11910 11911 #+vindex: org-export-with-author 11912 Toggle inclusion of author name into exported file 11913 (~org-export-with-author~). 11914 11915 - ~broken-links~ :: 11916 11917 #+vindex: org-export-with-broken-links 11918 Toggles if Org should continue exporting upon finding a broken 11919 internal link. When set to ~mark~, Org clearly marks the problem 11920 link in the output (~org-export-with-broken-links~). 11921 11922 - ~c~ :: 11923 11924 #+vindex: org-export-with-clocks 11925 Toggle inclusion of =CLOCK= keywords (~org-export-with-clocks~). 11926 11927 - ~creator~ :: 11928 11929 #+vindex: org-export-with-creator 11930 Toggle inclusion of creator information in the exported file 11931 (~org-export-with-creator~). 11932 11933 - ~d~ :: 11934 11935 #+vindex: org-export-with-drawers 11936 Toggles inclusion of drawers, or list of drawers to include, or list 11937 of drawers to exclude (~org-export-with-drawers~). 11938 11939 - ~date~ :: 11940 11941 #+vindex: org-export-with-date 11942 Toggle inclusion of a date into exported file 11943 (~org-export-with-date~). 11944 11945 - ~e~ :: 11946 11947 #+vindex: org-export-with-entities 11948 Toggle inclusion of entities (~org-export-with-entities~). 11949 11950 - ~email~ :: 11951 11952 #+vindex: org-export-with-email 11953 Toggle inclusion of the author's e-mail into exported file 11954 (~org-export-with-email~). 11955 11956 - ~f~ :: 11957 11958 #+vindex: org-export-with-footnotes 11959 Toggle the inclusion of footnotes (~org-export-with-footnotes~). 11960 11961 - ~H~ :: 11962 11963 #+vindex: org-export-headline-levels 11964 Set the number of headline levels for export 11965 (~org-export-headline-levels~). Below that level, headlines are 11966 treated differently. In most back-ends, they become list items. 11967 11968 - ~inline~ :: 11969 11970 #+vindex: org-export-with-inlinetasks 11971 Toggle inclusion of inlinetasks (~org-export-with-inlinetasks~). 11972 11973 - ~num~ :: 11974 11975 #+vindex: org-export-with-section-numbers 11976 #+cindex: @samp{UNNUMBERED}, property 11977 Toggle section-numbers (~org-export-with-section-numbers~). When 11978 set to number N, Org numbers only those headlines at level N or 11979 above. Set =UNNUMBERED= property to non-~nil~ to disable numbering 11980 of heading and subheadings entirely. Moreover, when the value is 11981 =notoc= the headline, and all its children, do not appear in the 11982 table of contents either (see [[*Table of Contents]]). 11983 11984 - ~p~ :: 11985 11986 #+vindex: org-export-with-planning 11987 Toggle export of planning information (~org-export-with-planning~). 11988 "Planning information" comes from lines located right after the 11989 headline and contain any combination of these cookies: =SCHEDULED=, 11990 =DEADLINE=, or =CLOSED=. 11991 11992 - ~pri~ :: 11993 11994 #+vindex: org-export-with-priority 11995 Toggle inclusion of priority cookies 11996 (~org-export-with-priority~). 11997 11998 - ~prop~ :: 11999 12000 #+vindex: org-export-with-properties 12001 Toggle inclusion of property drawers, or list the properties to 12002 include (~org-export-with-properties~). 12003 12004 - ~stat~ :: 12005 12006 #+vindex: org-export-with-statistics-cookies 12007 Toggle inclusion of statistics cookies 12008 (~org-export-with-statistics-cookies~). 12009 12010 - ~tags~ :: 12011 12012 #+vindex: org-export-with-tags 12013 Toggle inclusion of tags, may also be ~not-in-toc~ 12014 (~org-export-with-tags~). 12015 12016 - ~tasks~ :: 12017 12018 #+vindex: org-export-with-tasks 12019 Toggle inclusion of tasks (TODO items); or ~nil~ to remove all 12020 tasks; or ~todo~ to remove done tasks; or list the keywords to keep 12021 (~org-export-with-tasks~). 12022 12023 - ~tex~ :: 12024 12025 #+vindex: org-export-with-latex 12026 ~nil~ does not export; ~t~ exports; ~verbatim~ keeps everything in 12027 verbatim (~org-export-with-latex~). 12028 12029 - ~timestamp~ :: 12030 12031 #+vindex: org-export-time-stamp-file 12032 Toggle inclusion of the creation time in the exported file 12033 (~org-export-time-stamp-file~). 12034 12035 - ~title~ :: 12036 12037 #+vindex: org-export-with-title 12038 Toggle inclusion of title (~org-export-with-title~). 12039 12040 - ~toc~ :: 12041 12042 #+vindex: org-export-with-toc 12043 Toggle inclusion of the table of contents, or set the level limit 12044 (~org-export-with-toc~). 12045 12046 - ~todo~ :: 12047 12048 #+vindex: org-export-with-todo-keywords 12049 Toggle inclusion of TODO keywords into exported text 12050 (~org-export-with-todo-keywords~). 12051 12052 - ~|~ :: 12053 12054 #+vindex: org-export-with-tables 12055 Toggle inclusion of tables (~org-export-with-tables~). 12056 12057 When exporting subtrees, special node properties can override the 12058 above keywords. These properties have an =EXPORT_= prefix. For 12059 example, =DATE= becomes, =EXPORT_DATE= when used for a specific 12060 subtree. Except for =SETUPFILE=, all other keywords listed above 12061 have an =EXPORT_= equivalent. 12062 12063 #+cindex: @samp{BIND}, keyword 12064 #+vindex: org-export-allow-bind-keywords 12065 If ~org-export-allow-bind-keywords~ is non-~nil~, Emacs variables can 12066 become buffer-local during export by using the =BIND= keyword. Its 12067 syntax is =#+BIND: variable value=. This is particularly useful for 12068 in-buffer settings that cannot be changed using keywords. 12069 12070 ** Table of Contents 12071 :PROPERTIES: 12072 :DESCRIPTION: The if and where of the table of contents. 12073 :END: 12074 #+cindex: table of contents 12075 #+cindex: list of tables 12076 #+cindex: list of listings 12077 12078 #+cindex: @samp{toc}, in @samp{OPTIONS} keyword 12079 #+vindex: org-export-with-toc 12080 The table of contents includes all headlines in the document. Its 12081 depth is therefore the same as the headline levels in the file. If 12082 you need to use a different depth, or turn it off entirely, set the 12083 ~org-export-with-toc~ variable accordingly. You can achieve the same 12084 on a per file basis, using the following =toc= item in =OPTIONS= 12085 keyword: 12086 12087 #+begin_example 12088 ,#+OPTIONS: toc:2 (only include two levels in TOC) 12089 ,#+OPTIONS: toc:nil (no default TOC at all) 12090 #+end_example 12091 12092 #+cindex: excluding entries from table of contents 12093 #+cindex: table of contents, exclude entries 12094 Org includes both numbered and unnumbered headlines in the table of 12095 contents[fn:42]. If you need to exclude an unnumbered headline, 12096 along with all its children, set the =UNNUMBERED= property to =notoc= 12097 value. 12098 12099 #+begin_example 12100 ,* Subtree not numbered, not in table of contents either 12101 :PROPERTIES: 12102 :UNNUMBERED: notoc 12103 :END: 12104 #+end_example 12105 12106 #+cindex: @samp{TOC}, keyword 12107 Org normally inserts the table of contents directly before the first 12108 headline of the file. To move the table of contents to a different 12109 location, first turn off the default with ~org-export-with-toc~ 12110 variable or with =#+OPTIONS: toc:nil=. Then insert =#+TOC: headlines 12111 N= at the desired location(s). 12112 12113 #+begin_example 12114 ,#+OPTIONS: toc:nil 12115 ... 12116 ,#+TOC: headlines 2 12117 #+end_example 12118 12119 To adjust the table of contents depth for a specific section of the 12120 Org document, append an additional =local= parameter. This parameter 12121 becomes a relative depth for the current level. The following example 12122 inserts a local table of contents, with direct children only. 12123 12124 #+begin_example 12125 ,* Section 12126 ,#+TOC: headlines 1 local 12127 #+end_example 12128 12129 Note that for this feature to work properly in LaTeX export, the Org 12130 file requires the inclusion of the titletoc package. Because of 12131 compatibility issues, titletoc has to be loaded /before/ hyperref. 12132 Customize the ~org-latex-default-packages-alist~ variable. 12133 12134 The following example inserts a table of contents that links to the 12135 children of the specified target. 12136 12137 #+begin_example 12138 ,* Target 12139 :PROPERTIES: 12140 :CUSTOM_ID: TargetSection 12141 :END: 12142 ,** Heading A 12143 ,** Heading B 12144 ,* Another section 12145 ,#+TOC: headlines 1 :target #TargetSection 12146 #+end_example 12147 12148 The =:target= attribute is supported in HTML, Markdown, ODT, and ASCII export. 12149 12150 Use the =TOC= keyword to generate list of tables---respectively, all 12151 listings---with captions. 12152 12153 #+begin_example 12154 ,#+TOC: listings 12155 ,#+TOC: tables 12156 #+end_example 12157 12158 #+cindex: @samp{ALT_TITLE}, property 12159 Normally Org uses the headline for its entry in the table of contents. 12160 But with =ALT_TITLE= property, a different entry can be specified for 12161 the table of contents. 12162 12163 ** Include Files 12164 :PROPERTIES: 12165 :DESCRIPTION: Include additional files into a document. 12166 :END: 12167 #+cindex: include files, during export 12168 #+cindex: export, include files 12169 #+cindex: @samp{INCLUDE}, keyword 12170 12171 During export, you can include the content of another file. For 12172 example, to include your =.emacs= file, you could use: 12173 12174 : #+INCLUDE: "~/.emacs" src emacs-lisp 12175 12176 #+texinfo: @noindent 12177 The first parameter is the file name to include. The optional second 12178 parameter specifies the block type: =example=, =export= or =src=. The 12179 optional third parameter specifies the source code language to use for 12180 formatting the contents. This is relevant to both =export= and =src= 12181 block types. 12182 12183 If an included file is specified as having a markup language, Org 12184 neither checks for valid syntax nor changes the contents in any way. 12185 For example and source blocks, Org code-escapes the contents before 12186 inclusion. 12187 12188 #+cindex: @samp{minlevel}, include 12189 If an included file is not specified as having any markup language, 12190 Org assumes it be in Org format and proceeds as usual with a few 12191 exceptions. Org makes the footnote labels (see [[*Creating Footnotes]]) 12192 in the included file local to that file. The contents of the included 12193 file belong to the same structure---headline, item---containing the 12194 =INCLUDE= keyword. In particular, headlines within the file become 12195 children of the current section. That behavior can be changed by 12196 providing an additional keyword parameter, =:minlevel=. It shifts the 12197 headlines in the included file to become the lowest level. For 12198 example, this syntax makes the included file a sibling of the current 12199 top-level headline: 12200 12201 : #+INCLUDE: "~/my-book/chapter2.org" :minlevel 1 12202 12203 #+cindex: @samp{lines}, include 12204 Inclusion of only portions of files are specified using ranges 12205 parameter with =:lines= keyword. The line at the upper end of the 12206 range will not be included. The start and/or the end of the range may 12207 be omitted to use the obvious defaults. 12208 12209 | =#+INCLUDE: "~/.emacs" :lines "5-10"= | Include lines 5 to 10, 10 excluded | 12210 | =#+INCLUDE: "~/.emacs" :lines "-10"= | Include lines 1 to 10, 10 excluded | 12211 | =#+INCLUDE: "~/.emacs" :lines "10-"= | Include lines from 10 to EOF | 12212 12213 Inclusions may specify a file-link to extract an object matched by 12214 ~org-link-search~[fn:43] (see [[*Search Options in File Links]]). The 12215 ranges for =:lines= keyword are relative to the requested element. 12216 Therefore, 12217 12218 : #+INCLUDE: "./paper.org::*conclusion" :lines 1-20 12219 12220 #+texinfo: @noindent 12221 includes the first 20 lines of the headline named =conclusion=. 12222 12223 #+cindex: @samp{only-contents}, include 12224 To extract only the contents of the matched object, set 12225 =:only-contents= property to non-~nil~. This omits any planning lines 12226 or property drawers. For example, to include the body of the heading 12227 with the custom ID =theory=, you can use 12228 12229 : #+INCLUDE: "./paper.org::#theory" :only-contents t 12230 12231 The following command allows navigating to the included document: 12232 12233 - {{{kbd(C-c ')}}} (~org-edit~special~) :: 12234 #+kindex: C-c ' 12235 #+findex: org-edit-special 12236 12237 Visit the included file at point. 12238 12239 ** Macro Replacement 12240 :PROPERTIES: 12241 :DESCRIPTION: Use macros to create templates. 12242 :END: 12243 #+cindex: macro replacement, during export 12244 #+cindex: @samp{MACRO}, keyword 12245 12246 #+vindex: org-export-global-macros 12247 Macros replace text snippets during export. Macros are defined 12248 globally in ~org-export-global-macros~, or document-wise with the 12249 following syntax: 12250 12251 : #+MACRO: name replacement text; $1, $2 are arguments 12252 12253 #+texinfo: @noindent 12254 which can be referenced using ={{{name(arg1, arg2)}}}=[fn:44]. For 12255 example 12256 12257 #+begin_example 12258 ,#+MACRO: poem Rose is $1, violet's $2. Life's ordered: Org assists you. 12259 {{{poem(red,blue)}}} 12260 #+end_example 12261 12262 #+texinfo: @noindent 12263 becomes 12264 12265 : Rose is red, violet's blue. Life's ordered: Org assists you. 12266 12267 As a special case, Org parses any replacement text starting with 12268 =(eval= as an Emacs Lisp expression and evaluates it accordingly. 12269 Within such templates, arguments become strings. Thus, the following 12270 macro 12271 12272 : #+MACRO: gnustamp (eval (concat "GNU/" (capitalize $1))) 12273 12274 #+texinfo: @noindent 12275 turns ={{{gnustamp(linux)}}}= into =GNU/Linux= during export. 12276 12277 Org recognizes macro references in following Org markup areas: 12278 paragraphs, headlines, verse blocks, tables cells and lists. Org also 12279 recognizes macro references in keywords, such as =CAPTION=, =TITLE=, 12280 =AUTHOR=, =DATE=, and for some back-end specific export options. 12281 12282 Org comes with following pre-defined macros: 12283 12284 #+attr_texinfo: :sep ; 12285 - ={{{keyword(NAME)}}}=; ={{{title}}}=; ={{{author}}}=; ={{{email}}}= :: 12286 12287 #+cindex: @samp{keyword}, macro 12288 #+cindex: @samp{title}, macro 12289 #+cindex: @samp{author}, macro 12290 #+cindex: @samp{email}, macro 12291 The =keyword= macro collects all values from {{{var(NAME)}}} 12292 keywords throughout the buffer, separated with white space. 12293 =title=, =author= and =email= macros are shortcuts for, 12294 respectively, ={{{keyword(TITLE)}}}=, ={{{keyword(AUTHOR)}}}= and 12295 ={{{keyword(EMAIL)}}}=. 12296 12297 - ={{{date}}}=; ={{{date(FORMAT)}}}= :: 12298 12299 #+cindex: @samp{date}, macro 12300 This macro refers to the =DATE= keyword. {{{var(FORMAT)}}} is an 12301 optional argument to the =date= macro that is used only if =DATE= is 12302 a single timestamp. {{{var(FORMAT)}}} should be a format string 12303 understood by ~format-time-string~. 12304 12305 - ={{{time(FORMAT)}}}=; ={{{modification-time(FORMAT, VC)}}}= :: 12306 12307 #+cindex: @samp{time}, macro 12308 #+cindex: @samp{modification-time}, macro 12309 These macros refer to the document's date and time of export and 12310 date and time of modification. {{{var(FORMAT)}}} is a string 12311 understood by ~format-time-string~. If the second argument to the 12312 ~modification-time~ macro is non-~nil~, Org uses =vc.el= to retrieve 12313 the document's modification time from the version control system. 12314 Otherwise Org reads the file attributes. 12315 12316 - ={{{input-file}}}= :: 12317 12318 #+cindex: @samp{input-file}, macro 12319 This macro refers to the filename of the exported file. 12320 12321 - ={{{property(PROPERTY-NAME)}}}=; ={{{property(PROPERTY-NAME, SEARCH OPTION)}}}= :: 12322 12323 #+cindex: @samp{property}, macro 12324 This macro returns the value of property {{{var(PROPERTY-NAME)}}} in 12325 the current entry. If {{{var(SEARCH-OPTION)}}} (see [[*Search 12326 Options in File Links]]) refers to a remote entry, use it instead. 12327 12328 - ={{{n}}}=; ={{{n(NAME)}}}=; ={{{n(NAME, ACTION)}}}= :: 12329 12330 #+cindex: @samp{n}, macro 12331 #+cindex: counter, macro 12332 This macro implements custom counters by returning the number of 12333 times the macro has been expanded so far while exporting the buffer. 12334 You can create more than one counter using different {{{var(NAME)}}} 12335 values. If {{{var(ACTION)}}} is =-=, previous value of the counter 12336 is held, i.e., the specified counter is not incremented. If the 12337 value is a number, the specified counter is set to that value. If 12338 it is any other non-empty string, the specified counter is reset 12339 to 1. You may leave {{{var(NAME)}}} empty to reset the default 12340 counter. 12341 12342 #+cindex: @samp{results}, macro 12343 Moreover, inline source blocks (see [[*Structure of Code Blocks]]) use the 12344 special =results= macro to mark their output. As such, you are 12345 advised against re-defining it, unless you know what you are doing. 12346 12347 #+vindex: org-hide-macro-markers 12348 The surrounding brackets can be made invisible by setting 12349 ~org-hide-macro-markers~ to a non-~nil~ value. 12350 12351 Org expands macros at the very beginning of the export process. 12352 12353 ** Comment Lines 12354 :PROPERTIES: 12355 :DESCRIPTION: What will not be exported. 12356 :END: 12357 #+cindex: exporting, not 12358 12359 #+cindex: comment lines 12360 Lines starting with zero or more whitespace characters followed by one 12361 =#= and a whitespace are treated as comments and, as such, are not 12362 exported. 12363 12364 #+cindex: @samp{BEGIN_COMMENT} 12365 #+cindex: comment block 12366 Likewise, regions surrounded by =#+BEGIN_COMMENT= ... =#+END_COMMENT= 12367 are not exported. 12368 12369 #+cindex: comment trees 12370 Finally, a =COMMENT= keyword at the beginning of an entry, but after 12371 any other keyword or priority cookie, comments out the entire subtree. 12372 In this case, the subtree is not exported and no code block within it 12373 is executed either[fn:: For a less drastic behavior, consider using a 12374 select tag (see [[*Export Settings]]) instead.]. The command below 12375 helps changing the comment status of a headline. 12376 12377 - {{{kbd(C-c ;)}}} (~org-toggle-comment~) :: 12378 #+kindex: C-c ; 12379 #+findex: org-toggle-comment 12380 12381 Toggle the =COMMENT= keyword at the beginning of an entry. 12382 12383 ** ASCII/Latin-1/UTF-8 export 12384 :PROPERTIES: 12385 :DESCRIPTION: Exporting to flat files with encoding. 12386 :END: 12387 #+cindex: ASCII export 12388 #+cindex: Latin-1 export 12389 #+cindex: UTF-8 export 12390 12391 ASCII export produces an output file containing only plain ASCII 12392 characters. This is the simplest and most direct text output. It 12393 does not contain any Org markup. Latin-1 and UTF-8 export use 12394 additional characters and symbols available in these encoding 12395 standards. All three of these export formats offer the most basic of 12396 text output for maximum portability. 12397 12398 #+vindex: org-ascii-text-width 12399 On export, Org fills and justifies text according to the text width 12400 set in ~org-ascii-text-width~. 12401 12402 #+vindex: org-ascii-links-to-notes 12403 Org exports links using a footnote-like style where the descriptive 12404 part is in the text and the link is in a note before the next heading. 12405 See the variable ~org-ascii-links-to-notes~ for details. 12406 12407 *** ASCII export commands 12408 :PROPERTIES: 12409 :UNNUMBERED: notoc 12410 :END: 12411 12412 #+attr_texinfo: :sep , 12413 - {{{kbd(C-c C-e t a)}}} (~org-ascii-export-to-ascii~), {{{kbd(C-c C-e t l)}}}, {{{kbd(C-c C-e t u)}}} :: 12414 #+kindex: C-c C-e t a 12415 #+kindex: C-c C-e t l 12416 #+kindex: C-c C-e t u 12417 #+findex: org-ascii-export-to-ascii 12418 12419 Export as an ASCII file with a =.txt= extension. For =myfile.org=, 12420 Org exports to =myfile.txt=, overwriting without warning. For 12421 =myfile.txt=, Org exports to =myfile.txt.txt= in order to prevent 12422 data loss. 12423 12424 - {{{kbd(C-c C-e t A)}}} (~org-ascii-export-to-ascii~), {{{kbd(C-c C-e t L)}}}, {{{kbd(C-c C-e t U)}}} :: 12425 #+kindex: C-c C-e t A 12426 #+kindex: C-c C-e t L 12427 #+kindex: C-c C-e t U 12428 #+findex: org-ascii-export-as-ascii 12429 12430 Export to a temporary buffer. Does not create a file. 12431 12432 *** ASCII specific export settings 12433 :PROPERTIES: 12434 :UNNUMBERED: notoc 12435 :END: 12436 12437 The ASCII export back-end has one extra keyword for customizing ASCII 12438 output. Setting this keyword works similar to the general options 12439 (see [[*Export Settings]]). 12440 12441 - =SUBTITLE= :: 12442 12443 #+cindex: @samp{SUBTITLE}, keyword 12444 The document subtitle. For long subtitles, use multiple 12445 =#+SUBTITLE= lines in the Org file. Org prints them on one 12446 continuous line, wrapping into multiple lines if necessary. 12447 12448 *** Header and sectioning structure 12449 :PROPERTIES: 12450 :UNNUMBERED: notoc 12451 :END: 12452 12453 Org converts the first three outline levels into headlines for ASCII 12454 export. The remaining levels are turned into lists. To change this 12455 cut-off point where levels become lists, see [[*Export Settings]]. 12456 12457 *** Quoting ASCII text 12458 :PROPERTIES: 12459 :UNNUMBERED: notoc 12460 :END: 12461 12462 To insert text within the Org file by the ASCII back-end, use one the 12463 following constructs, inline, keyword, or export block: 12464 12465 #+cindex: @samp{ASCII}, keyword 12466 #+cindex: @samp{BEGIN_EXPORT ascii} 12467 #+begin_example 12468 Inline text @@ascii:and additional text@@ within a paragraph. 12469 12470 ,#+ASCII: Some text 12471 12472 ,#+BEGIN_EXPORT ascii 12473 Org exports text in this block only when using ASCII back-end. 12474 ,#+END_EXPORT 12475 #+end_example 12476 12477 *** ASCII specific attributes 12478 :PROPERTIES: 12479 :UNNUMBERED: notoc 12480 :END: 12481 #+cindex: @samp{ATTR_ASCII}, keyword 12482 #+cindex: horizontal rules, in ASCII export 12483 12484 ASCII back-end recognizes only one attribute, =:width=, which 12485 specifies the width of a horizontal rule in number of characters. The 12486 keyword and syntax for specifying widths is: 12487 12488 #+begin_example 12489 ,#+ATTR_ASCII: :width 10 12490 ----- 12491 #+end_example 12492 12493 *** ASCII special blocks 12494 :PROPERTIES: 12495 :UNNUMBERED: notoc 12496 :END: 12497 #+cindex: special blocks, in ASCII export 12498 #+cindex: @samp{BEGIN_JUSTIFYLEFT} 12499 #+cindex: @samp{BEGIN_JUSTIFYRIGHT} 12500 12501 Besides =#+BEGIN_CENTER= blocks (see [[*Paragraphs]]), ASCII back-end has 12502 these two left and right justification blocks: 12503 12504 #+begin_example 12505 ,#+BEGIN_JUSTIFYLEFT 12506 It's just a jump to the left... 12507 ,#+END_JUSTIFYLEFT 12508 12509 ,#+BEGIN_JUSTIFYRIGHT 12510 ...and then a step to the right. 12511 ,#+END_JUSTIFYRIGHT 12512 #+end_example 12513 12514 ** Beamer Export 12515 :PROPERTIES: 12516 :DESCRIPTION: Producing presentations and slides. 12517 :END: 12518 #+cindex: Beamer export 12519 12520 Org uses Beamer export to convert an Org file tree structure into 12521 high-quality interactive slides for presentations. Beamer is a LaTeX 12522 document class for creating presentations in PDF, HTML, and other 12523 popular display formats. 12524 12525 *** Beamer export commands 12526 :PROPERTIES: 12527 :DESCRIPTION: For creating Beamer documents. 12528 :END: 12529 12530 - {{{kbd(C-c C-e l b)}}} (~org-beamer-export-to-latex~) :: 12531 #+kindex: C-c C-e l b 12532 #+findex: org-beamer-export-to-latex 12533 12534 Export as LaTeX file with a =.tex= extension. For =myfile.org=, Org 12535 exports to =myfile.tex=, overwriting without warning. 12536 12537 - {{{kbd(C-c C-e l B)}}} (~org-beamer-export-as-latex~) :: 12538 #+kindex: C-c C-e l B 12539 #+findex: org-beamer-export-as-latex 12540 12541 Export to a temporary buffer. Does not create a file. 12542 12543 - {{{kbd(C-c C-e l P)}}} (~org-beamer-export-to-pdf~) :: 12544 #+kindex: C-c C-e l P 12545 #+findex: org-beamer-export-to-pdf 12546 12547 Export as LaTeX file and then convert it to PDF format. 12548 12549 - {{{kbd(C-c C-e l O)}}} :: 12550 #+kindex: C-c C-e l O 12551 12552 Export as LaTeX file, convert it to PDF format, and then open the 12553 PDF file. 12554 12555 *** Beamer specific export settings 12556 :PROPERTIES: 12557 :DESCRIPTION: For customizing Beamer export. 12558 :END: 12559 12560 Beamer export back-end has several additional keywords for customizing 12561 Beamer output. These keywords work similar to the general options 12562 settings (see [[*Export Settings]]). 12563 12564 - =BEAMER_THEME= :: 12565 12566 #+cindex: @samp{BEAMER_THEME}, keyword 12567 #+vindex: org-beamer-theme 12568 The Beamer layout theme (~org-beamer-theme~). Use square brackets 12569 for options. For example: 12570 12571 : #+BEAMER_THEME: Rochester [height=20pt] 12572 12573 - =BEAMER_FONT_THEME= :: 12574 12575 #+cindex: @samp{BEAMER_FONT_THEME}, keyword 12576 The Beamer font theme. 12577 12578 - =BEAMER_INNER_THEME= :: 12579 12580 #+cindex: @samp{BEAMER_INNER_THEME}, keyword 12581 The Beamer inner theme. 12582 12583 - =BEAMER_OUTER_THEME= :: 12584 12585 #+cindex: @samp{BEAMER_OUTER_THEME}, keyword 12586 The Beamer outer theme. 12587 12588 - =BEAMER_HEADER= :: 12589 12590 #+cindex: @samp{BEAMER_HEADER}, keyword 12591 Arbitrary lines inserted in the preamble, just before the =hyperref= 12592 settings. 12593 12594 - =DESCRIPTION= :: 12595 12596 #+cindex: @samp{DESCRIPTION}, keyword 12597 The document description. For long descriptions, use multiple 12598 =DESCRIPTION= keywords. By default, =hyperref= inserts 12599 =DESCRIPTION= as metadata. Use ~org-latex-hyperref-template~ to 12600 configure document metadata. Use ~org-latex-title-command~ to 12601 configure typesetting of description as part of front matter. 12602 12603 - =KEYWORDS= :: 12604 12605 #+cindex: @samp{KEYWORDS}, keyword 12606 The keywords for defining the contents of the document. Use 12607 multiple =KEYWORDS= lines if necessary. By default, =hyperref= 12608 inserts =KEYWORDS= as metadata. Use ~org-latex-hyperref-template~ 12609 to configure document metadata. Use ~org-latex-title-command~ to 12610 configure typesetting of keywords as part of front matter. 12611 12612 - =SUBTITLE= :: 12613 12614 #+cindex: @samp{SUBTITLE}, keyword 12615 Document's subtitle. For typesetting, use 12616 ~org-beamer-subtitle-format~ string. Use 12617 ~org-latex-hyperref-template~ to configure document metadata. Use 12618 ~org-latex-title-command~ to configure typesetting of subtitle as 12619 part of front matter. 12620 12621 *** Frames and Blocks in Beamer 12622 :PROPERTIES: 12623 :DESCRIPTION: For composing Beamer slides. 12624 :END: 12625 12626 Org transforms heading levels into Beamer's sectioning elements, 12627 frames and blocks. Any Org tree with a not-too-deep-level nesting 12628 should in principle be exportable as a Beamer presentation. 12629 12630 - 12631 #+vindex: org-beamer-frame-level 12632 Org headlines become Beamer frames when the heading level in Org is 12633 equal to ~org-beamer-frame-level~ or =H= value in a =OPTIONS= line 12634 (see [[*Export Settings]]). 12635 12636 #+cindex: @samp{BEAMER_ENV}, property 12637 Org overrides headlines to frames conversion for the current tree of 12638 an Org file if it encounters the =BEAMER_ENV= property set to 12639 =frame= or =fullframe=. Org ignores whatever 12640 ~org-beamer-frame-level~ happens to be for that headline level in 12641 the Org tree. In Beamer terminology, a full frame is a frame 12642 without its title. 12643 12644 - Org exports a Beamer frame's objects as block environments. Org can 12645 enforce wrapping in special block types when =BEAMER_ENV= property 12646 is set[fn:45]. For valid values see 12647 ~org-beamer-environments-default~. To add more values, see 12648 ~org-beamer-environments-extra~. 12649 #+vindex: org-beamer-environments-default 12650 #+vindex: org-beamer-environments-extra 12651 12652 - 12653 #+cindex: @samp{BEAMER_REF}, property 12654 If =BEAMER_ENV= is set to =appendix=, Org exports the entry as an 12655 appendix. When set to =note=, Org exports the entry as a note 12656 within the frame or between frames, depending on the entry's heading 12657 level. When set to =noteNH=, Org exports the entry as a note 12658 without its title. When set to =againframe=, Org exports the entry 12659 with =\againframe= command, which makes setting the =BEAMER_REF= 12660 property mandatory because =\againframe= needs frame to resume. 12661 12662 When =ignoreheading= is set, Org export ignores the entry's headline 12663 but not its content. This is useful for inserting content between 12664 frames. It is also useful for properly closing a =column= 12665 environment. 12666 12667 #+cindex: @samp{BEAMER_ACT}, property 12668 #+cindex: @samp{BEAMER_OPT}, property 12669 When =BEAMER_ACT= is set for a headline, Org export translates that 12670 headline as an overlay or action specification. When enclosed in 12671 square brackets, Org export makes the overlay specification 12672 a default. Use =BEAMER_OPT= to set any options applicable to the 12673 current Beamer frame or block. The Beamer export back-end wraps 12674 with appropriate angular or square brackets. It also adds the 12675 =fragile= option for any code that may require a verbatim block. 12676 12677 #+cindex: @samp{BEAMER_COL}, property 12678 To create a column on the Beamer slide, use the =BEAMER_COL= 12679 property for its headline in the Org file. Set the value of 12680 =BEAMER_COL= to a decimal number representing the fraction of the 12681 total text width. Beamer export uses this value to set the column's 12682 width and fills the column with the contents of the Org entry. If 12683 the Org entry has no specific environment defined, Beamer export 12684 ignores the heading. If the Org entry has a defined environment, 12685 Beamer export uses the heading as title. Behind the scenes, Beamer 12686 export automatically handles LaTeX column separations for contiguous 12687 headlines. To manually adjust them for any unique configurations 12688 needs, use the =BEAMER_ENV= property. 12689 12690 *** Beamer specific syntax 12691 :PROPERTIES: 12692 :DESCRIPTION: For using in Org documents. 12693 :END: 12694 12695 Since Org's Beamer export back-end is an extension of the LaTeX 12696 back-end, it recognizes other LaTeX specific syntax---for example, 12697 =#+LATEX:= or =#+ATTR_LATEX:=. See [[*LaTeX Export]], for details. 12698 12699 Beamer export wraps the table of contents generated with =toc:t= 12700 =OPTION= keyword in a =frame= environment. Beamer export does not 12701 wrap the table of contents generated with =TOC= keyword (see [[*Table of 12702 Contents]]). Use square brackets for specifying options. 12703 12704 : #+TOC: headlines [currentsection] 12705 12706 Insert Beamer-specific code using the following constructs: 12707 12708 #+cindex: @samp{BEAMER}, keyword 12709 #+cindex: @samp{BEGIN_EXPORT beamer} 12710 #+begin_example 12711 ,#+BEAMER: \pause 12712 12713 ,#+BEGIN_EXPORT beamer 12714 Only Beamer export back-end exports this. 12715 ,#+END_EXPORT 12716 12717 Text @@beamer:some code@@ within a paragraph. 12718 #+end_example 12719 12720 Inline constructs, such as the last one above, are useful for adding 12721 overlay specifications to objects with ~bold~, ~item~, ~link~, 12722 ~radio-target~ and ~target~ types. Enclose the value in angular 12723 brackets and place the specification at the beginning of the object as 12724 shown in this example: 12725 12726 : A *@@beamer:<2->@@useful* feature 12727 12728 #+cindex: @samp{ATTR_BEAMER}, keyword 12729 Beamer export recognizes the =ATTR_BEAMER= keyword with the following 12730 attributes from Beamer configurations: =:environment= for changing 12731 local Beamer environment, =:overlay= for specifying Beamer overlays in 12732 angular or square brackets, and =:options= for inserting optional 12733 arguments. 12734 12735 #+begin_example 12736 ,#+ATTR_BEAMER: :environment nonindentlist 12737 - item 1, not indented 12738 - item 2, not indented 12739 - item 3, not indented 12740 #+end_example 12741 12742 #+begin_example 12743 ,#+ATTR_BEAMER: :overlay <+-> 12744 - item 1 12745 - item 2 12746 #+end_example 12747 12748 #+begin_example 12749 ,#+ATTR_BEAMER: :options [Lagrange] 12750 Let $G$ be a finite group, and let $H$ be 12751 a subgroup of $G$. Then the order of $H$ divides the order of $G$. 12752 #+end_example 12753 12754 *** Editing support 12755 :PROPERTIES: 12756 :DESCRIPTION: Editing support. 12757 :END: 12758 12759 Org Beamer mode is a special minor mode for faster editing of Beamer 12760 documents. 12761 12762 : #+STARTUP: beamer 12763 12764 - {{{kbd(C-c C-b)}}} (~org-beamer-select-environment~) :: 12765 #+kindex: C-c C-b 12766 #+findex: org-beamer-select-environment 12767 12768 Org Beamer mode provides this key for quicker selections in Beamer 12769 normal environments, and for selecting the =BEAMER_COL= property. 12770 12771 *** A Beamer example 12772 :PROPERTIES: 12773 :DESCRIPTION: A complete presentation. 12774 :END: 12775 12776 Here is an example of an Org document ready for Beamer export. 12777 12778 #+begin_example 12779 ,#+TITLE: Example Presentation 12780 ,#+AUTHOR: Carsten Dominik 12781 ,#+OPTIONS: H:2 toc:t num:t 12782 ,#+LATEX_CLASS: beamer 12783 ,#+LATEX_CLASS_OPTIONS: [presentation] 12784 ,#+BEAMER_THEME: Madrid 12785 ,#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) 12786 12787 ,* This is the first structural section 12788 12789 ,** Frame 1 12790 ,*** Thanks to Eric Fraga :B_block: 12791 :PROPERTIES: 12792 :BEAMER_COL: 0.48 12793 :BEAMER_ENV: block 12794 :END: 12795 for the first viable Beamer setup in Org 12796 ,*** Thanks to everyone else :B_block: 12797 :PROPERTIES: 12798 :BEAMER_COL: 0.48 12799 :BEAMER_ACT: <2-> 12800 :BEAMER_ENV: block 12801 :END: 12802 for contributing to the discussion 12803 ,**** This will be formatted as a beamer note :B_note: 12804 :PROPERTIES: 12805 :BEAMER_env: note 12806 :END: 12807 ,** Frame 2 (where we will not use columns) 12808 ,*** Request 12809 Please test this stuff! 12810 #+end_example 12811 12812 ** HTML Export 12813 :PROPERTIES: 12814 :DESCRIPTION: Exporting to HTML. 12815 :END: 12816 #+cindex: HTML export 12817 12818 Org mode contains an HTML exporter with extensive HTML formatting 12819 compatible with XHTML 1.0 strict standard. 12820 12821 *** HTML export commands 12822 :PROPERTIES: 12823 :DESCRIPTION: Invoking HTML export. 12824 :END: 12825 12826 - {{{kbd(C-c C-e h h)}}} (~org-html-export-to-html~) :: 12827 #+kindex: C-c C-e h h 12828 #+kindex: C-c C-e h o 12829 #+findex: org-html-export-to-html 12830 12831 Export as HTML file with a =.html= extension. For =myfile.org=, Org 12832 exports to =myfile.html=, overwriting without warning. {{{kbd(C-c 12833 C-e h o)}}} exports to HTML and opens it in a web browser. 12834 12835 - {{{kbd(C-c C-e h H)}}} (~org-html-export-as-html~) :: 12836 #+kindex: C-c C-e h H 12837 #+findex: org-html-export-as-html 12838 12839 Exports to a temporary buffer. Does not create a file. 12840 12841 *** HTML specific export settings 12842 :PROPERTIES: 12843 :DESCRIPTION: Settings for HTML export. 12844 :END: 12845 12846 HTML export has a number of keywords, similar to the general options 12847 settings described in [[*Export Settings]]. 12848 12849 - =DESCRIPTION= :: 12850 12851 #+cindex: @samp{DESCRIPTION}, keyword 12852 This is the document's description, which the HTML exporter inserts 12853 it as a HTML meta tag in the HTML file. For long descriptions, use 12854 multiple =DESCRIPTION= lines. The exporter takes care of wrapping 12855 the lines properly. 12856 12857 The exporter includes a number of other meta tags, which can be customized 12858 by modifying ~org-html-meta-tags~. 12859 12860 - =HTML_DOCTYPE= :: 12861 12862 #+cindex: @samp{HTML_DOCTYPE}, keyword 12863 #+vindex: org-html-doctype 12864 Specify the document type, for example: HTML5 (~org-html-doctype~). 12865 12866 - =HTML_CONTAINER= :: 12867 12868 #+cindex: @samp{HTML_CONTAINER}, keyword 12869 #+vindex: org-html-container-element 12870 Specify the HTML container, such as =div=, for wrapping sections and 12871 elements (~org-html-container-element~). 12872 12873 - =HTML_LINK_HOME= :: 12874 12875 #+cindex: @samp{HTML_LINK_HOME}, keyword 12876 #+vindex: org-html-link-home 12877 The URL for home link (~org-html-link-home~). 12878 12879 - =HTML_LINK_UP= :: 12880 12881 #+cindex: @samp{HTML_LINK_UP}, keyword 12882 #+vindex: org-html-link-up 12883 The URL for the up link of exported HTML pages (~org-html-link-up~). 12884 12885 - =HTML_MATHJAX= :: 12886 12887 #+cindex: @samp{HTML_MATHJAX}, keyword 12888 #+vindex: org-html-mathjax-options 12889 Options for MathJax (~org-html-mathjax-options~). MathJax is used 12890 to typeset LaTeX math in HTML documents. See [[*Math formatting in 12891 HTML export]], for an example. 12892 12893 - =HTML_HEAD= :: 12894 12895 #+cindex: @samp{HTML_HEAD}, keyword 12896 #+vindex: org-html-head 12897 Arbitrary lines for appending to the HTML document's head 12898 (~org-html-head~). 12899 12900 - =HTML_HEAD_EXTRA= :: 12901 12902 #+cindex: @samp{HTML_HEAD_EXTRA}, keyword 12903 #+vindex: org-html-head-extra 12904 More arbitrary lines for appending to the HTML document's head 12905 (~org-html-head-extra~). 12906 12907 - =KEYWORDS= :: 12908 12909 #+cindex: @samp{KEYWORDS}, keyword 12910 Keywords to describe the document's content. HTML exporter inserts 12911 these keywords as HTML meta tags. For long keywords, use multiple 12912 =KEYWORDS= lines. 12913 12914 - =LATEX_HEADER= :: 12915 12916 #+cindex: @samp{LATEX_HEADER}, keyword 12917 Arbitrary lines for appending to the preamble; HTML exporter appends 12918 when transcoding LaTeX fragments to images (see [[*Math formatting in 12919 HTML export]]). 12920 12921 - =SUBTITLE= :: 12922 12923 #+cindex: @samp{SUBTITLE}, keyword 12924 The document's subtitle. HTML exporter formats subtitle if document 12925 type is =HTML5= and the CSS has a =subtitle= class. 12926 12927 Some of these keywords are explained in more detail in the following 12928 sections of the manual. 12929 12930 *** HTML doctypes 12931 :PROPERTIES: 12932 :DESCRIPTION: Exporting various (X)HTML flavors. 12933 :END: 12934 12935 Org can export to various (X)HTML flavors. 12936 12937 #+vindex: org-html-doctype 12938 #+vindex: org-html-doctype-alist 12939 Set the ~org-html-doctype~ variable for different (X)HTML variants. 12940 Depending on the variant, the HTML exporter adjusts the syntax of HTML 12941 conversion accordingly. Org includes the following ready-made 12942 variants: 12943 12944 - ~"html4-strict"~ 12945 - ~"html4-transitional"~ 12946 - ~"html4-frameset"~ 12947 - ~"xhtml-strict"~ 12948 - ~"xhtml-transitional"~ 12949 - ~"xhtml-frameset"~ 12950 - ~"xhtml-11"~ 12951 - ~"html5"~ 12952 - ~"xhtml5"~ 12953 12954 #+texinfo: @noindent 12955 See the variable ~org-html-doctype-alist~ for details. The default is 12956 ~"xhtml-strict"~. 12957 12958 #+vindex: org-html-html5-fancy 12959 #+cindex: @samp{HTML5}, export new elements 12960 Org's HTML exporter does not by default enable new block elements 12961 introduced with the HTML5 standard. To enable them, set 12962 ~org-html-html5-fancy~ to non-~nil~. Or use an =OPTIONS= line in the 12963 file to set =html5-fancy=. 12964 12965 HTML5 documents can now have arbitrary =#+BEGIN= ... =#+END= blocks. 12966 For example: 12967 12968 #+begin_example 12969 ,#+BEGIN_aside 12970 Lorem ipsum 12971 ,#+END_aside 12972 #+end_example 12973 12974 #+texinfo: @noindent 12975 exports to: 12976 12977 #+begin_src html 12978 <aside> 12979 <p>Lorem ipsum</p> 12980 </aside> 12981 #+end_src 12982 12983 #+texinfo: @noindent 12984 while this: 12985 12986 #+begin_example 12987 ,#+ATTR_HTML: :controls controls :width 350 12988 ,#+BEGIN_video 12989 ,#+HTML: <source src="movie.mp4" type="video/mp4"> 12990 ,#+HTML: <source src="movie.ogg" type="video/ogg"> 12991 Your browser does not support the video tag. 12992 ,#+END_video 12993 #+end_example 12994 12995 #+texinfo: @noindent 12996 exports to: 12997 12998 #+begin_src html 12999 <video controls="controls" width="350"> 13000 <source src="movie.mp4" type="video/mp4"> 13001 <source src="movie.ogg" type="video/ogg"> 13002 <p>Your browser does not support the video tag.</p> 13003 </video> 13004 #+end_src 13005 13006 #+vindex: org-html-html5-elements 13007 When special blocks do not have a corresponding HTML5 element, the 13008 HTML exporter reverts to standard translation (see 13009 ~org-html-html5-elements~). For example, =#+BEGIN_lederhosen= exports 13010 to ~<div class="lederhosen">~. 13011 13012 Special blocks cannot have headlines. For the HTML exporter to wrap 13013 the headline and its contents in ~<section>~ or ~<article>~ tags, set 13014 the =HTML_CONTAINER= property for the headline. 13015 13016 *** HTML preamble and postamble 13017 :PROPERTIES: 13018 :DESCRIPTION: Inserting preamble and postamble. 13019 :END: 13020 #+vindex: org-html-preamble 13021 #+vindex: org-html-postamble 13022 #+vindex: org-html-preamble-format 13023 #+vindex: org-html-postamble-format 13024 #+vindex: org-html-validation-link 13025 #+vindex: org-export-creator-string 13026 #+vindex: org-export-time-stamp-file 13027 13028 The HTML exporter has delineations for preamble and postamble. The 13029 default value for ~org-html-preamble~ is ~t~, which makes the HTML 13030 exporter insert the preamble. See the variable 13031 ~org-html-preamble-format~ for the format string. 13032 13033 Set ~org-html-preamble~ to a string to override the default format 13034 string. If set to a function, the HTML exporter expects the function 13035 to return a string upon execution. The HTML exporter inserts this 13036 string in the preamble. The HTML exporter does not insert a preamble 13037 if ~org-html-preamble~ is set ~nil~. 13038 13039 The above also applies to ~org-html-postamble~ and 13040 ~org-html-postamble-format~. In addition, ~org-html-postamble~ can be 13041 set to ~auto~ (its default value), which makes the HTML exporter build 13042 a postamble from looking up author's name, email address, creator's 13043 name, and date. 13044 13045 13046 *** Quoting HTML tags 13047 :PROPERTIES: 13048 :DESCRIPTION: Using direct HTML in Org files. 13049 :END: 13050 13051 The HTML export back-end transforms =<= and =>= to =<= and =>=. 13052 To include raw HTML code in the Org file so the HTML export back-end 13053 can insert that HTML code in the output, use this inline syntax: 13054 =@@html:...@@=. For example: 13055 13056 : @@html:<b>@@bold text@@html:</b>@@ 13057 13058 #+cindex: @samp{HTML}, keyword 13059 #+cindex: @samp{BEGIN_EXPORT html} 13060 For larger raw HTML code blocks, use these HTML export code blocks: 13061 13062 #+begin_example 13063 ,#+HTML: Literal HTML code for export 13064 13065 ,#+BEGIN_EXPORT html 13066 All lines between these markers are exported literally 13067 ,#+END_EXPORT 13068 #+end_example 13069 13070 *** Headlines in HTML export 13071 :PROPERTIES: 13072 :DESCRIPTION: Formatting headlines. 13073 :END: 13074 #+cindex: headlines, in HTML export 13075 13076 Headlines are exported to =<h1>=, =<h2>=, etc. Each headline gets the 13077 =id= attribute from =CUSTOM_ID= property, or a unique generated value, 13078 see [[*Internal Links]]. 13079 13080 #+vindex: org-html-self-link-headlines 13081 When ~org-html-self-link-headlines~ is set to a non-~nil~ value, the 13082 text of the headlines is also wrapped in =<a>= tags. These tags have 13083 a =href= attribute making the headlines link to themselves. 13084 13085 *** Links in HTML export 13086 :PROPERTIES: 13087 :DESCRIPTION: Inserting and formatting links. 13088 :END: 13089 #+cindex: links, in HTML export 13090 #+cindex: internal links, in HTML export 13091 #+cindex: external links, in HTML export 13092 13093 The HTML export back-end transforms Org's internal links (see 13094 [[*Internal Links]]) to equivalent HTML links in the output. The back-end 13095 similarly handles Org's automatic links created by radio targets (see 13096 [[*Radio Targets]]) similarly. For Org links to external files, the 13097 back-end transforms the links to /relative/ paths. 13098 13099 #+vindex: org-html-link-org-files-as-html 13100 For Org links to other =.org= files, the back-end automatically 13101 changes the file extension to =.html= and makes file paths relative. 13102 If the =.org= files have an equivalent =.html= version at the same 13103 location, then the converted links should work without any further 13104 manual intervention. However, to disable this automatic path 13105 translation, set ~org-html-link-org-files-as-html~ to ~nil~. When 13106 disabled, the HTML export back-end substitutes the ID-based links in 13107 the HTML output. For more about linking files when publishing to 13108 a directory, see [[*Publishing links]]. 13109 13110 Org files can also have special directives to the HTML export 13111 back-end. For example, by using =#+ATTR_HTML= lines to specify new 13112 format attributes to ~<a>~ or ~<img>~ tags. This example shows 13113 changing the link's title and style: 13114 13115 #+cindex: @samp{ATTR_HTML}, keyword 13116 #+begin_example 13117 ,#+ATTR_HTML: :title The Org mode website :style color:red; 13118 [[https://orgmode.org]] 13119 #+end_example 13120 13121 *** Tables in HTML export 13122 :PROPERTIES: 13123 :DESCRIPTION: How to modify the formatting of tables. 13124 :END: 13125 #+cindex: tables, in HTML 13126 #+vindex: org-export-html-table-tag 13127 13128 The HTML export back-end uses ~org-html-table-default-attributes~ when 13129 exporting Org tables to HTML. By default, the exporter does not draw 13130 frames and cell borders. To change for this for a table, use the 13131 following lines before the table in the Org file: 13132 13133 #+cindex: @samp{CAPTION}, keyword 13134 #+cindex: @samp{ATTR_HTML}, keyword 13135 #+begin_example 13136 ,#+CAPTION: This is a table with lines around and between cells 13137 ,#+ATTR_HTML: :border 2 :rules all :frame border 13138 #+end_example 13139 13140 The HTML export back-end preserves column groupings in Org tables (see 13141 [[*Column Groups]]) when exporting to HTML. 13142 13143 Additional options for customizing tables for HTML export. 13144 13145 - ~org-html-table-align-individual-fields~ :: 13146 13147 #+vindex: org-html-table-align-individual-fields 13148 Non-~nil~ attaches style attributes for alignment to each table 13149 field. 13150 13151 - ~org-html-table-caption-above~ :: 13152 13153 #+vindex: org-html-table-caption-above 13154 Non-~nil~ places caption string at the beginning of the table. 13155 13156 - ~org-html-table-data-tags~ :: 13157 13158 #+vindex: org-html-table-data-tags 13159 Opening and ending tags for table data fields. 13160 13161 - ~org-html-table-default-attributes~ :: 13162 13163 #+vindex: org-html-table-default-attributes 13164 Default attributes and values for table tags. 13165 13166 - ~org-html-table-header-tags~ :: 13167 13168 #+vindex: org-html-table-header-tags 13169 Opening and ending tags for table's header fields. 13170 13171 - ~org-html-table-row-tags~ :: 13172 13173 #+vindex: org-html-table-row-tags 13174 Opening and ending tags for table rows. 13175 13176 - ~org-html-table-use-header-tags-for-first-column~ :: 13177 13178 #+vindex: org-html-table-use-header-tags-for-first-column 13179 Non-~nil~ formats column one in tables with header tags. 13180 13181 *** Images in HTML export 13182 :PROPERTIES: 13183 :DESCRIPTION: How to insert figures into HTML output. 13184 :END: 13185 #+cindex: images, inline in HTML 13186 #+cindex: inlining images in HTML 13187 13188 The HTML export back-end has features to convert Org image links to 13189 HTML inline images and HTML clickable image links. 13190 13191 #+vindex: org-html-inline-images 13192 When the link in the Org file has no description, the HTML export 13193 back-end by default in-lines that image. For example: 13194 =[[file:myimg.jpg]]= is in-lined, while =[[file:myimg.jpg][the image]]= links to the text, 13195 =the image=. For more details, see the variable 13196 ~org-html-inline-images~. 13197 13198 On the other hand, if the description part of the Org link is itself 13199 another link, such as =file:= or =http:= URL pointing to an image, the 13200 HTML export back-end in-lines this image and links to the main image. 13201 This Org syntax enables the back-end to link low-resolution thumbnail 13202 to the high-resolution version of the image, as shown in this example: 13203 13204 : [[file:highres.jpg][file:thumb.jpg]] 13205 13206 To change attributes of in-lined images, use =#+ATTR_HTML= lines in 13207 the Org file. This example shows realignment to right, and adds ~alt~ 13208 and ~title~ attributes in support of text viewers and modern web 13209 accessibility standards. 13210 13211 #+cindex: @samp{CAPTION}, keyword 13212 #+cindex: @samp{ATTR_HTML}, keyword 13213 #+begin_example 13214 ,#+CAPTION: A black cat stalking a spider 13215 ,#+ATTR_HTML: :alt cat/spider image :title Action! :align right 13216 [[./img/a.jpg]] 13217 #+end_example 13218 13219 The HTML export back-end copies the =http= links from the Org file 13220 as-is. 13221 13222 *** Math formatting in HTML export 13223 :PROPERTIES: 13224 :DESCRIPTION: Beautiful math also on the web. 13225 :END: 13226 #+cindex: MathJax 13227 #+cindex: dvipng 13228 #+cindex: dvisvgm 13229 #+cindex: ImageMagick 13230 13231 #+vindex: org-html-mathjax-options~ 13232 LaTeX math snippets (see [[*LaTeX fragments]]) can be displayed in two 13233 different ways on HTML pages. The default is to use the 13234 [[https://www.mathjax.org][MathJax]], which should work out of the box 13235 with Org[fn:: By default, Org loads MathJax from 13236 [[https://www.jsdelivr.com/][jsDelivr]], as recommended in 13237 [[https://docs.mathjax.org/en/latest/web/start.html][Getting Started 13238 with MathJax Components]].][fn:46]. Some MathJax display options can 13239 be configured via ~org-html-mathjax-options~, or in the buffer. For 13240 example, with the following settings, 13241 13242 #+begin_example 13243 ,#+HTML_MATHJAX: align: left indent: 5em tagside: left 13244 #+end_example 13245 13246 #+texinfo: @noindent 13247 equation labels are displayed on the left margin and equations are 13248 five em from the left margin. 13249 13250 #+vindex: org-html-mathjax-template 13251 See the docstring of ~org-html-mathjax-options~ for all supported 13252 variables. The MathJax template can be configure via 13253 ~org-html-mathjax-template~. 13254 13255 If you prefer, you can also request that LaTeX fragments are processed 13256 into small images that will be inserted into the browser page. Before 13257 the availability of MathJax, this was the default method for Org 13258 files. This method requires that the dvipng program, dvisvgm or 13259 ImageMagick suite is available on your system. You can still get this 13260 processing with 13261 13262 : #+OPTIONS: tex:dvipng 13263 13264 : #+OPTIONS: tex:dvisvgm 13265 13266 #+texinfo: @noindent 13267 or 13268 13269 : #+OPTIONS: tex:imagemagick 13270 13271 *** Text areas in HTML export 13272 :PROPERTIES: 13273 :DESCRIPTION: An alternate way to show an example. 13274 :END: 13275 13276 #+cindex: text areas, in HTML 13277 Before Org mode's Babel, one popular approach to publishing code in 13278 HTML was by using =:textarea=. The advantage of this approach was 13279 that copying and pasting was built into browsers with simple 13280 JavaScript commands. Even editing before pasting was made simple. 13281 13282 The HTML export back-end can create such text areas. It requires an 13283 =#+ATTR_HTML= line as shown in the example below with the =:textarea= 13284 option. This must be followed by either an example or a source code 13285 block. Other Org block types do not honor the =:textarea= option. 13286 13287 By default, the HTML export back-end creates a text area 80 characters 13288 wide and height just enough to fit the content. Override these 13289 defaults with =:width= and =:height= options on the =#+ATTR_HTML= 13290 line. 13291 13292 #+begin_example 13293 ,#+ATTR_HTML: :textarea t :width 40 13294 ,#+BEGIN_EXAMPLE 13295 (defun org-xor (a b) 13296 "Exclusive or." 13297 (if a (not b) b)) 13298 ,#+END_EXAMPLE 13299 #+end_example 13300 13301 *** CSS support 13302 :PROPERTIES: 13303 :DESCRIPTION: Changing the appearance of the output. 13304 :END: 13305 #+cindex: CSS, for HTML export 13306 #+cindex: HTML export, CSS 13307 13308 #+vindex: org-export-html-todo-kwd-class-prefix 13309 #+vindex: org-export-html-tag-class-prefix 13310 You can modify the CSS style definitions for the exported file. The 13311 HTML exporter assigns the following special CSS classes[fn:: If the 13312 classes on TODO keywords and tags lead to conflicts, use the variables 13313 ~org-html-todo-kwd-class-prefix~ and ~org-html-tag-class-prefix~ to 13314 make them unique.] to appropriate parts of the document---your style 13315 specifications may change these, in addition to any of the standard 13316 classes like for headlines, tables, etc. 13317 13318 | ~p.author~ | author information, including email | 13319 | ~p.date~ | publishing date | 13320 | ~p.creator~ | creator info, about org mode version | 13321 | ~.title~ | document title | 13322 | ~.subtitle~ | document subtitle | 13323 | ~.todo~ | TODO keywords, all not-done states | 13324 | ~.done~ | the DONE keywords, all states that count as done | 13325 | ~.WAITING~ | each TODO keyword also uses a class named after itself | 13326 | ~.timestamp~ | timestamp | 13327 | ~.timestamp-kwd~ | keyword associated with a timestamp, like =SCHEDULED= | 13328 | ~.timestamp-wrapper~ | span around keyword plus timestamp | 13329 | ~.tag~ | tag in a headline | 13330 | ~._HOME~ | each tag uses itself as a class, "@" replaced by "_" | 13331 | ~.target~ | target for links | 13332 | ~.linenr~ | the line number in a code example | 13333 | ~.code-highlighted~ | for highlighting referenced code lines | 13334 | ~div.outline-N~ | div for outline level N (headline plus text) | 13335 | ~div.outline-text-N~ | extra div for text at outline level N | 13336 | ~.section-number-N~ | section number in headlines, different for each level | 13337 | ~.figure-number~ | label like "Figure 1:" | 13338 | ~.table-number~ | label like "Table 1:" | 13339 | ~.listing-number~ | label like "Listing 1:" | 13340 | ~div.figure~ | how to format an in-lined image | 13341 | ~pre.src~ | formatted source code | 13342 | ~pre.example~ | normal example | 13343 | ~p.verse~ | verse paragraph | 13344 | ~div.footnotes~ | footnote section headline | 13345 | ~p.footnote~ | footnote definition paragraph, containing a footnote | 13346 | ~.footref~ | a footnote reference number (always a <sup>) | 13347 | ~.footnum~ | footnote number in footnote definition (always <sup>) | 13348 | ~.org-svg~ | default class for a linked =.svg= image | 13349 13350 #+vindex: org-html-style-default 13351 #+vindex: org-html-head 13352 #+vindex: org-html-head-extra 13353 #+cindex: @samp{HTML_INCLUDE_STYLE}, keyword 13354 The HTML export back-end includes a compact default style in each 13355 exported HTML file. To override the default style with another style, 13356 use these keywords in the Org file. They will replace the global 13357 defaults the HTML exporter uses. 13358 13359 #+cindex: @samp{HTML_HEAD}, keyword 13360 #+cindex: @samp{HTML_HEAD_EXTRA}, keyword 13361 #+begin_example 13362 ,#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" /> 13363 ,#+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" /> 13364 #+end_example 13365 13366 #+vindex: org-html-head-include-default-style 13367 To just turn off the default style, customize 13368 ~org-html-head-include-default-style~ variable, or use this option 13369 line in the Org file. 13370 13371 #+cindex: @samp{html-style}, @samp{OPTIONS} item 13372 : #+OPTIONS: html-style:nil 13373 13374 For longer style definitions, either use several =HTML_HEAD= and 13375 =HTML_HEAD_EXTRA= keywords, or use ~<style> ... </style>~ blocks 13376 around them. Both of these approaches can avoid referring to an 13377 external file. 13378 13379 #+cindex: @samp{HTML_CONTAINER_CLASS}, property 13380 #+cindex: @samp{HTML_HEADLINE_CLASS}, property 13381 In order to add styles to a subtree, use the =HTML_CONTAINER_CLASS= 13382 property to assign a class to the tree. In order to specify CSS 13383 styles for a particular headline, you can use the ID specified in 13384 a =CUSTOM_ID= property. You can also assign a specific class to 13385 a headline with the =HTML_HEADLINE_CLASS= property. 13386 13387 Never change the ~org-html-style-default~ constant. Instead use other 13388 simpler ways of customizing as described above. 13389 13390 *** JavaScript supported display of web pages 13391 :PROPERTIES: 13392 :DESCRIPTION: Info and folding in a web browser. 13393 :ALT_TITLE: JavaScript support 13394 :END: 13395 13396 Sebastian Rose has written a JavaScript program especially designed to 13397 allow two different ways of viewing HTML files created with Org. One 13398 is an /Info/-like mode where each section is displayed separately and 13399 navigation can be done with the {{{kbd(n)}}} and {{{kbd(p)}}} keys, and some other 13400 keys as well, press {{{kbd(?)}}} for an overview of the available keys. The 13401 second one has a /folding/ view, much like Org provides inside Emacs. 13402 The script is available at https://orgmode.org/org-info.js and the 13403 documentation at https://orgmode.org/worg/code/org-info-js/. The 13404 script is hosted on https://orgmode.org, but for reliability, prefer 13405 installing it on your own web server. 13406 13407 To use this program, just add this line to the Org file: 13408 13409 #+cindex: @samp{INFOJS_OPT}, keyword 13410 : #+INFOJS_OPT: view:info toc:nil 13411 13412 #+texinfo: @noindent 13413 The HTML header now has the code needed to automatically invoke the 13414 script. For setting options, use the syntax from the above line for 13415 options described below: 13416 13417 - =path:= :: 13418 13419 The path to the script. The default is to grab the script from 13420 [[https://orgmode.org/org-info.js]], but you might want to have a local 13421 copy and use a path like =../scripts/org-info.js=. 13422 13423 - =view:= :: 13424 13425 Initial view when the website is first shown. Possible values are: 13426 13427 | =info= | Info-like interface with one section per page | 13428 | =overview= | Folding interface, initially showing only top-level | 13429 | =content= | Folding interface, starting with all headlines visible | 13430 | =showall= | Folding interface, all headlines and text visible | 13431 13432 - =sdepth:= :: 13433 13434 Maximum headline level still considered as an independent section 13435 for info and folding modes. The default is taken from 13436 ~org-export-headline-levels~, i.e., the =H= switch in =OPTIONS=. If 13437 this is smaller than in ~org-export-headline-levels~, each 13438 info/folding section can still contain child headlines. 13439 13440 - =toc:= :: 13441 13442 Should the table of contents /initially/ be visible? Even when 13443 =nil=, you can always get to the "toc" with {{{kbd(i)}}}. 13444 13445 - =tdepth:= :: 13446 13447 The depth of the table of contents. The defaults are taken from the 13448 variables ~org-export-headline-levels~ and ~org-export-with-toc~. 13449 13450 - =ftoc:= :: 13451 13452 Does the CSS of the page specify a fixed position for the "toc"? If 13453 yes, the toc is displayed as a section. 13454 13455 - =ltoc:= :: 13456 13457 Should there be short contents (children) in each section? Make 13458 this =above= if the section should be above initial text. 13459 13460 - =mouse:= :: 13461 13462 Headings are highlighted when the mouse is over them. Should be 13463 =underline= (default) or a background color like =#cccccc=. 13464 13465 - =buttons:= :: 13466 13467 Should view-toggle buttons be everywhere? When =nil= (the default), 13468 only one such button is present. 13469 13470 #+vindex: org-infojs-options 13471 #+vindex: org-export-html-use-infojs 13472 You can choose default values for these options by customizing the 13473 variable ~org-infojs-options~. If you always want to apply the script 13474 to your pages, configure the variable ~org-export-html-use-infojs~. 13475 13476 ** LaTeX Export 13477 :PROPERTIES: 13478 :DESCRIPTION: Exporting to @LaTeX{} and processing to PDF. 13479 :END: 13480 #+cindex: @LaTeX{} export 13481 #+cindex: PDF export 13482 13483 The LaTeX export back-end can handle complex documents, incorporate 13484 standard or custom LaTeX document classes, generate documents using 13485 alternate LaTeX engines, and produce fully linked PDF files with 13486 indexes, bibliographies, and tables of contents, destined for 13487 interactive online viewing or high-quality print publication. 13488 13489 While the details are covered in-depth in this section, here are some 13490 quick references to variables for the impatient: for engines, see 13491 ~org-latex-compiler~; for build sequences, see 13492 ~org-latex-pdf-process~; for packages, see 13493 ~org-latex-default-packages-alist~ and ~org-latex-packages-alist~. 13494 13495 An important note about the LaTeX export back-end: it is sensitive to 13496 blank lines in the Org document. That's because LaTeX itself depends 13497 on blank lines to tell apart syntactical elements, such as paragraphs. 13498 13499 *** LaTeX/PDF export commands 13500 :PROPERTIES: 13501 :DESCRIPTION: For producing @LaTeX{} and PDF documents. 13502 :END: 13503 13504 - {{{kbd(C-c C-e l l)}}} (~org-latex-export-to-latex~) :: 13505 13506 #+kindex: C-c C-e l l 13507 #+findex: org-latex-export-to-latex~ 13508 Export to a LaTeX file with a =.tex= extension. For =myfile.org=, 13509 Org exports to =myfile.tex=, overwriting without warning. 13510 13511 - {{{kbd(C-c C-e l L)}}} (~org-latex-export-as-latex~) :: 13512 13513 #+kindex: C-c C-e l L 13514 #+findex: org-latex-export-as-latex 13515 Export to a temporary buffer. Do not create a file. 13516 13517 - {{{kbd(C-c C-e l p)}}} (~org-latex-export-to-pdf~) :: 13518 13519 #+kindex: C-c C-e l p 13520 #+findex: org-latex-export-to-pdf 13521 Export as LaTeX file and convert it to PDF file. 13522 13523 - {{{kbd(C-c C-e l o)}}} :: 13524 13525 #+kindex: C-c C-e l o 13526 Export as LaTeX file and convert it to PDF, then open the PDF using 13527 the default viewer. 13528 13529 - {{{kbd(M-x org-export-region-as-latex)}}} :: 13530 13531 Convert the region to LaTeX under the assumption that it was in Org 13532 mode syntax before. This is a global command that can be invoked in 13533 any buffer. 13534 13535 #+vindex: org-latex-compiler 13536 #+vindex: org-latex-bibtex-compiler 13537 #+vindex: org-latex-default-packages-alist 13538 #+cindex: pdflatex 13539 #+cindex: xelatex 13540 #+cindex: lualatex 13541 #+cindex: @samp{LATEX_COMPILER}, keyword 13542 The LaTeX export back-end can use any of these LaTeX engines: 13543 =pdflatex=, =xelatex=, and =lualatex=. These engines compile LaTeX 13544 files with different compilers, packages, and output options. The 13545 LaTeX export back-end finds the compiler version to use from 13546 ~org-latex-compiler~ variable or the =#+LATEX_COMPILER= keyword in the 13547 Org file. See the docstring for the 13548 ~org-latex-default-packages-alist~ for loading packages with certain 13549 compilers. Also see ~org-latex-bibtex-compiler~ to set the 13550 bibliography compiler[fn:47]. 13551 13552 *** LaTeX specific export settings 13553 :PROPERTIES: 13554 :DESCRIPTION: Unique to this @LaTeX{} back-end. 13555 :END: 13556 13557 The LaTeX export back-end has several additional keywords for 13558 customizing LaTeX output. Setting these keywords works similar to the 13559 general options (see [[*Export Settings]]). 13560 13561 #+attr_texinfo: :sep , 13562 - =DESCRIPTION= :: 13563 #+cindex: @samp{DESCRIPTION}, keyword 13564 #+vindex: org-latex-hyperref-template 13565 #+vindex: org-latex-title-command 13566 The document's description. The description along with author name, 13567 keywords, and related file metadata are inserted in the output file 13568 by the hyperref package. See ~org-latex-hyperref-template~ for 13569 customizing metadata items. See ~org-latex-title-command~ for 13570 typesetting description into the document's front matter. Use 13571 multiple =DESCRIPTION= keywords for long descriptions. 13572 13573 - =LANGUAGE= :: 13574 #+cindex: @samp{LANGUAGE}, keyword 13575 #+vindex: org-latex-packages-alist 13576 #+vindex: org-latex-language-alist 13577 13578 Language code of the primary document language. 13579 13580 The list of language codes supported by Org is stored in the 13581 variable ~org-latex-language-alist~. 13582 13583 In order to be effective, the =babel= or =polyglossia= 13584 packages---according to the LaTeX compiler used---must be loaded 13585 with the appropriate language as argument. This can be accomplished 13586 by modifying the ~org-latex-packages-alist~ variable, e.g., with the 13587 following snippet (note that =polyglossia= does not work with 13588 pdfLaTeX): 13589 13590 #+begin_src emacs-lisp 13591 (add-to-list 'org-latex-packages-alist 13592 '("AUTO" "babel" t ("pdflatex" "xelatex" "lualatex"))) 13593 (add-to-list 'org-latex-packages-alist 13594 '("AUTO" "polyglossia" t ("xelatex" "lualatex"))) 13595 #+end_src 13596 13597 - =LATEX_CLASS= :: 13598 13599 #+cindex: @samp{LATEX_CLASS}, keyword 13600 #+vindex: org-latex-default-class 13601 #+vindex: org-latex-classes 13602 This is LaTeX document class, such as /article/, /report/, /book/, 13603 and so on, which contain predefined preamble and headline level 13604 mapping that the LaTeX export back-end needs. The back-end reads 13605 the default class name from the ~org-latex-default-class~ variable. 13606 Org has /article/ as the default class. A valid default class must 13607 be an element of ~org-latex-classes~. 13608 13609 - =LATEX_CLASS_OPTIONS= :: 13610 13611 #+cindex: @samp{LATEX_CLASS_OPTIONS}, keyword 13612 Options the LaTeX export back-end uses when calling the LaTeX 13613 document class. 13614 13615 - =LATEX_COMPILER= :: 13616 13617 #+cindex: @samp{LATEX_COMPILER}, keyword 13618 #+vindex: org-latex-compiler 13619 The compiler, such as =pdflatex=, =xelatex=, =lualatex=, for 13620 producing the PDF. See ~org-latex-compiler~. 13621 13622 - =LATEX_HEADER=, =LATEX_HEADER_EXTRA= :: 13623 13624 #+cindex: @samp{LATEX_HEADER}, keyword 13625 #+cindex: @samp{LATEX_HEADER_EXTRA}, keyword 13626 #+vindex: org-latex-classes 13627 Arbitrary lines to add to the document's preamble, before the 13628 hyperref settings. See ~org-latex-classes~ for adjusting the 13629 structure and order of the LaTeX headers. 13630 13631 - =KEYWORDS= :: 13632 13633 #+cindex: @samp{KEYWORDS}, keyword 13634 #+vindex: org-latex-hyperref-template 13635 #+vindex: org-latex-title-command 13636 The keywords for the document. The description along with author 13637 name, keywords, and related file metadata are inserted in the output 13638 file by the hyperref package. See ~org-latex-hyperref-template~ for 13639 customizing metadata items. See ~org-latex-title-command~ for 13640 typesetting description into the document's front matter. Use 13641 multiple =KEYWORDS= lines if necessary. 13642 13643 - =SUBTITLE= :: 13644 13645 #+cindex: @samp{SUBTITLE}, keyword 13646 #+vindex: org-latex-subtitle-separate 13647 #+vindex: org-latex-subtitle-format 13648 The document's subtitle. It is typeset as per 13649 ~org-latex-subtitle-format~. If ~org-latex-subtitle-separate~ is 13650 non-~nil~, it is typed outside of the ~\title~ macro. See 13651 ~org-latex-hyperref-template~ for customizing metadata items. See 13652 ~org-latex-title-command~ for typesetting description into the 13653 document's front matter. 13654 13655 The following sections have further details. 13656 13657 *** LaTeX header and sectioning structure 13658 :PROPERTIES: 13659 :DESCRIPTION: Setting up the export file structure. 13660 :ALT_TITLE: LaTeX header and sectioning 13661 :END: 13662 #+cindex: @LaTeX{} class 13663 #+cindex: @LaTeX{} sectioning structure 13664 #+cindex: @LaTeX{} header 13665 #+cindex: header, for @LaTeX{} files 13666 #+cindex: sectioning structure, for @LaTeX{} export 13667 13668 The LaTeX export back-end converts the first three of Org's outline 13669 levels into LaTeX headlines. The remaining Org levels are exported as 13670 lists. To change this globally for the cut-off point between levels 13671 and lists, (see [[*Export Settings]]). 13672 13673 By default, the LaTeX export back-end uses the /article/ class. 13674 13675 #+vindex: org-latex-default-class 13676 #+vindex: org-latex-classes 13677 #+vindex: org-latex-default-packages-alist 13678 #+vindex: org-latex-packages-alist 13679 To change the default class globally, edit ~org-latex-default-class~. 13680 To change the default class locally in an Org file, add option lines 13681 =#+LATEX_CLASS: myclass=. To change the default class for just a part 13682 of the Org file, set a subtree property, =EXPORT_LATEX_CLASS=. The 13683 class name entered here must be valid member of ~org-latex-classes~. 13684 This variable defines a header template for each class into which the 13685 exporter splices the values of ~org-latex-default-packages-alist~ and 13686 ~org-latex-packages-alist~. Use the same three variables to define 13687 custom sectioning or custom classes. 13688 13689 #+cindex: @samp{LATEX_CLASS}, keyword 13690 #+cindex: @samp{LATEX_CLASS_OPTIONS}, keyword 13691 #+cindex: @samp{EXPORT_LATEX_CLASS}, property 13692 #+cindex: @samp{EXPORT_LATEX_CLASS_OPTIONS}, property 13693 The LaTeX export back-end sends the =LATEX_CLASS_OPTIONS= keyword and 13694 =EXPORT_LATEX_CLASS_OPTIONS= property as options to the LaTeX 13695 ~\documentclass~ macro. The options and the syntax for specifying 13696 them, including enclosing them in square brackets, follow LaTeX 13697 conventions. 13698 13699 : #+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn] 13700 13701 #+cindex: @samp{LATEX_HEADER}, keyword 13702 #+cindex: @samp{LATEX_HEADER_EXTRA}, keyword 13703 The LaTeX export back-end appends values from =LATEX_HEADER= and 13704 =LATEX_HEADER_EXTRA= keywords to the LaTeX header. The docstring for 13705 ~org-latex-classes~ explains in more detail. Also note that LaTeX 13706 export back-end does not append =LATEX_HEADER_EXTRA= to the header 13707 when previewing LaTeX snippets (see [[*Previewing LaTeX fragments]]). 13708 13709 A sample Org file with the above headers: 13710 13711 #+begin_example 13712 ,#+LATEX_CLASS: article 13713 ,#+LATEX_CLASS_OPTIONS: [a4paper] 13714 ,#+LATEX_HEADER: \usepackage{xyz} 13715 13716 ,* Headline 1 13717 some text 13718 ,* Headline 2 13719 some more text 13720 #+end_example 13721 13722 #+cindex: @samp{LANGUAGE}, keyword 13723 #+vindex: org-export-default-language 13724 LaTeX packages =babel= or =polyglossia= can also be loaded in a 13725 document. The "AUTO" string will be replaced in both cases by the 13726 appropriate value for the =LANGUAGE= keyword, if present in the 13727 document, or by the value of ~org-export-default-language~. Let's see 13728 some examples in one or another case. 13729 13730 =Babel= accepts the classic syntax and (in addition) the new syntax 13731 with the =\babelprovide= command to load the languages using the new 13732 =INI= files procedure. Keep in mind that there are a number of 13733 languages that are only served in babel using =INI= files, so they 13734 cannot be declared using the classic syntax, but only using the 13735 =\babelprovide= command (see 13736 https://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf). 13737 Valid usage examples could be: 13738 13739 #+begin_example 13740 ,#+LATEX_HEADER: \usepackage[french,italian,AUTO]{babel} 13741 #+end_example 13742 13743 where "AUTO" is the main language. But it can also be loaded using 13744 the =\babelprovide= command: 13745 13746 #+begin_example 13747 ,#+LATEX_HEADER: \usepackage[french,italian]{babel} 13748 ,#+LATEX_HEADER: \babelprovide[import, main]{AUTO} 13749 #+end_example 13750 13751 =Polyglossia=, for this procedure to be effective, must be loaded 13752 using the same =babel= classic syntax (but note that /this is not/ 13753 the actual polyglossia syntax). For example, suppose a document 13754 declares Polytonic Greek as the primary language, and French as the 13755 secondary language. In this case, it would be expressed as: 13756 13757 #+begin_example 13758 ,#+LANGUAGE: el-polyton 13759 ,#+LATEX_HEADER: \usepackage[french,AUTO]{polyglossia} 13760 #+end_example 13761 13762 This would produce in LaTeX (with the actual =polyglossia= syntax): 13763 13764 #+begin_example 13765 \usepackage{polyglossia} 13766 \setmainlanguage[variant=polytonic]{greek} 13767 \setotherlanguage{french} 13768 #+end_example 13769 13770 *** Quoting LaTeX code 13771 :PROPERTIES: 13772 :DESCRIPTION: Incorporating literal @LaTeX{} code. 13773 :END: 13774 13775 The LaTeX export back-end can insert any arbitrary LaTeX code, see 13776 [[*Embedded LaTeX]]. There are three ways to embed such code in the Org 13777 file and they all use different quoting syntax. 13778 13779 #+cindex: inline, in @LaTeX{} export 13780 Inserting in-line quoted with @ symbols: 13781 13782 : Code embedded in-line @@latex:any arbitrary LaTeX code@@ in a paragraph. 13783 13784 #+cindex: @samp{LATEX}, keyword 13785 Inserting as one or more keyword lines in the Org file: 13786 13787 : #+LATEX: any arbitrary LaTeX code 13788 13789 #+cindex: @samp{BEGIN_EXPORT latex} 13790 Inserting as an export block in the Org file, where the back-end 13791 exports any code between begin and end markers: 13792 13793 #+begin_example 13794 ,#+BEGIN_EXPORT latex 13795 any arbitrary LaTeX code 13796 ,#+END_EXPORT 13797 #+end_example 13798 13799 *** Tables in LaTeX export 13800 :PROPERTIES: 13801 :DESCRIPTION: Options for exporting tables to @LaTeX{}. 13802 :END: 13803 #+cindex: tables, in @LaTeX{} export 13804 13805 The LaTeX export back-end can pass several LaTeX attributes for table 13806 contents and layout. Besides specifying a label (see [[*Internal Links]]) 13807 and a caption (see [[*Captions]]), the other valid LaTeX attributes 13808 include: 13809 13810 #+attr_texinfo: :sep , 13811 - =:mode= :: 13812 13813 #+vindex: org-latex-default-table-mode 13814 The LaTeX export back-end wraps the table differently depending on 13815 the mode for accurate rendering of math symbols. Mode is either 13816 =table=, =math=, =inline-math=, =verbatim= or =tabbing=. 13817 13818 For =math= or =inline-math= mode, LaTeX export back-end wraps the 13819 table in a math environment, but every cell in it is exported as-is. 13820 For =tabbing= the LaTeX tabbing environment is used and the correct 13821 tabbing delimiters =\>= are used. 13822 The LaTeX export back-end determines the default mode from 13823 ~org-latex-default-table-mode~. The LaTeX export back-end merges 13824 contiguous tables in the same mode into a single environment. 13825 13826 - =:environment= :: 13827 13828 #+vindex: org-latex-default-table-environment 13829 Set the default LaTeX table environment for the LaTeX export 13830 back-end to use when exporting Org tables. Common LaTeX table 13831 environments are provided by these packages: tabularx, longtable, 13832 array, tabu, and bmatrix. For packages, such as tabularx and tabu, 13833 or any newer replacements, include them in the 13834 ~org-latex-packages-alist~ variable so the LaTeX export back-end can 13835 insert the appropriate load package headers in the converted LaTeX 13836 file. Look in the docstring for the ~org-latex-packages-alist~ 13837 variable for configuring these packages for LaTeX snippet previews, 13838 if any. 13839 13840 - =:caption= :: 13841 13842 Use =CAPTION= keyword to set a simple caption for a table (see 13843 [[*Captions]]). For custom captions, use =:caption= attribute, which 13844 accepts raw LaTeX code. =:caption= value overrides =CAPTION= value. 13845 13846 - =:float=, =:placement= :: 13847 13848 The table environments by default are not floats in LaTeX. To make 13849 them floating objects use =:float= with one of the following 13850 options: =t= (for a default =table= environment), =sideways= (for a 13851 =sidewaystable= environment), =multicolumn= (to span the table 13852 across multiple columns of a page in a =table*= environment) and 13853 =nil=. In addition to these three values, =:float= can pass through 13854 any arbitrary value, for example a user-defined float type with the 13855 =float= LaTeX package. 13856 13857 LaTeX floats can also have additional layout =:placement= 13858 attributes. These are the usual =[h t b p ! H]= permissions 13859 specified in square brackets. Note that for =:float sideways= 13860 tables, the LaTeX export back-end ignores =:placement= attributes. 13861 13862 - =:align=, =:font=, =:width= :: 13863 13864 The LaTeX export back-end uses these attributes for regular tables 13865 to set their alignments, fonts, and widths. 13866 13867 - =:options= :: 13868 13869 The =:options= attribute allows adding an optional argument with 13870 a list of various table options (between brackets in LaTeX export), 13871 since certain tabular environments, such as longtblr of the 13872 tabularray LaTeX package, provides this structure. For example: 13873 =:options remark{Note}={note},remark{Source}={source}=. 13874 13875 - =:spread= :: 13876 13877 When =:spread= is non-~nil~, the LaTeX export back-end spreads or 13878 shrinks the table by the =:width= for tabu and longtabu 13879 environments. =:spread= has no effect if =:width= is not set. 13880 13881 - =:booktabs=, =:center=, =:rmlines= :: 13882 13883 #+vindex: org-latex-tables-booktabs 13884 #+vindex: org-latex-tables-centered 13885 All three commands are toggles. =:booktabs= brings in modern 13886 typesetting enhancements to regular tables. The booktabs package 13887 has to be loaded through ~org-latex-packages-alist~. =:center= is 13888 for centering the table. =:rmlines= removes all but the very first 13889 horizontal line made of ASCII characters from "table.el" tables 13890 only. 13891 13892 - =:math-prefix=, =:math-suffix=, =:math-arguments= :: 13893 13894 The LaTeX export back-end inserts =:math-prefix= string value in 13895 a math environment before the table. The LaTeX export back-end 13896 inserts =:math-suffix= string value in a math environment after the 13897 table. The LaTeX export back-end inserts =:math-arguments= string 13898 value between the macro name and the table's contents. 13899 =:math-arguments= comes in use for matrix macros that require more 13900 than one argument, such as =qbordermatrix=. 13901 13902 LaTeX table attributes help formatting tables for a wide range of 13903 situations, such as matrix product or spanning multiple pages: 13904 13905 #+begin_example 13906 ,#+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l 13907 | ... | ... | 13908 | ... | ... | 13909 13910 ,#+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times 13911 | a | b | 13912 | c | d | 13913 ,#+ATTR_LATEX: :mode math :environment bmatrix 13914 | 1 | 2 | 13915 | 3 | 4 | 13916 #+end_example 13917 13918 Set the caption with the LaTeX command 13919 =\bicaption{HeadingA}{HeadingB}=: 13920 13921 #+begin_example 13922 ,#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB} 13923 | ... | ... | 13924 | ... | ... | 13925 #+end_example 13926 13927 *** Images in LaTeX export 13928 :PROPERTIES: 13929 :DESCRIPTION: How to insert figures into @LaTeX{} output. 13930 :END: 13931 #+cindex: images, inline in LaTeX 13932 #+cindex: inlining images in LaTeX 13933 #+cindex: @samp{ATTR_LATEX}, keyword 13934 13935 The LaTeX export back-end processes image links in Org files that do 13936 not have descriptions, such as these links =[[file:img.jpg]]= or 13937 =[[./img.jpg]]=, as direct image insertions in the final PDF output. In 13938 the PDF, they are no longer links but actual images embedded on the 13939 page. The LaTeX export back-end uses =\includegraphics= macro to 13940 insert the image. But for TikZ (https://sourceforge.net/projects/pgf/) 13941 images, the back-end uses an ~\input~ macro wrapped within 13942 a ~tikzpicture~ environment. 13943 13944 For specifying image =:width=, =:height=, =:scale= and other =:options=, 13945 use this syntax: 13946 13947 #+begin_example 13948 ,#+ATTR_LATEX: :width 5cm :options angle=90 13949 [[./img/sed-hr4049.pdf]] 13950 #+end_example 13951 13952 A =:scale= attribute overrides both =:width= and =:height= attributes. 13953 13954 For custom commands for captions, use the =:caption= attribute. It 13955 overrides the default =#+CAPTION= value: 13956 13957 #+begin_example 13958 ,#+ATTR_LATEX: :caption \bicaption{HeadingA}{HeadingB} 13959 [[./img/sed-hr4049.pdf]] 13960 #+end_example 13961 13962 When captions follow the method as described in [[*Captions]], the LaTeX 13963 export back-end wraps the picture in a floating =figure= environment. 13964 To float an image without specifying a caption, set the =:float= 13965 attribute to one of the following: 13966 13967 - =t= :: 13968 13969 For a default =figure= environment. 13970 13971 - =multicolumn= :: 13972 13973 To span the image across multiple columns of a page; the back-end 13974 wraps the image in a =figure*= environment. 13975 13976 - =wrap= :: 13977 13978 For text to flow around the image on the right; the figure occupies 13979 the left half of the page. 13980 13981 - =sideways= :: 13982 13983 For a new page with the image sideways, rotated ninety degrees, in 13984 a =sidewaysfigure= environment; overrides =:placement= setting. 13985 13986 - =nil= :: 13987 13988 To avoid a =:float= even if using a caption. 13989 13990 - Any arbitrary value :: 13991 13992 For example, a user-defined float type with the =float= LaTeX 13993 package. 13994 13995 13996 Use the =placement= attribute to modify a floating environment's 13997 placement. 13998 13999 #+begin_example 14000 ,#+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement {r}{0.4\textwidth} 14001 [[./img/hst.png]] 14002 #+end_example 14003 14004 #+vindex: org-latex-images-centered 14005 #+cindex: center image in LaTeX export 14006 #+cindex: image, centering in LaTeX export 14007 The LaTeX export back-end centers all images by default. Setting 14008 =:center= to =nil= disables centering. To disable centering globally, 14009 set ~org-latex-images-centered~ to =nil=. 14010 14011 Set the =:comment-include= attribute to non-~nil~ value for the LaTeX 14012 export back-end to comment out the =\includegraphics= macro. 14013 14014 *** Plain lists in LaTeX export 14015 :PROPERTIES: 14016 :DESCRIPTION: Attributes specific to lists. 14017 :END: 14018 14019 #+cindex: plain lists, in @LaTeX{} export 14020 #+cindex: @samp{ATTR_LATEX}, keyword 14021 The LaTeX export back-end accepts the =environment= and =options= 14022 attributes for plain lists. Both attributes work together for 14023 customizing lists, as shown in the examples: 14024 14025 #+begin_example 14026 ,#+LATEX_HEADER: \usepackage[inline]{enumitem} 14027 Some ways to say "Hello": 14028 ,#+ATTR_LATEX: :environment itemize* 14029 ,#+ATTR_LATEX: :options [label={}, itemjoin={,}, itemjoin*={, and}] 14030 - Hola 14031 - Bonjour 14032 - Guten Tag. 14033 #+end_example 14034 14035 Since LaTeX supports only four levels of nesting for lists, use an 14036 external package, such as =enumitem= in LaTeX, for levels deeper than 14037 four: 14038 14039 #+begin_example 14040 ,#+LATEX_HEADER: \usepackage{enumitem} 14041 ,#+LATEX_HEADER: \renewlist{itemize}{itemize}{9} 14042 ,#+LATEX_HEADER: \setlist[itemize]{label=$\circ$} 14043 - One 14044 - Two 14045 - Three 14046 - Four 14047 - Five 14048 #+end_example 14049 14050 *** Source blocks in LaTeX export 14051 :PROPERTIES: 14052 :DESCRIPTION: Attributes specific to source code blocks. 14053 :END: 14054 #+cindex: source blocks, in @LaTeX{} export 14055 #+cindex: @samp{ATTR_LATEX}, keyword 14056 14057 The LaTeX export back-end can make source code blocks into floating 14058 objects through the attributes =:float= and =:options=. For =:float=: 14059 14060 - =t= :: 14061 14062 Makes a source block float; by default floats any source block with 14063 a caption. 14064 14065 - =multicolumn= :: 14066 14067 Spans the source block across multiple columns of a page. 14068 14069 - =nil= :: 14070 14071 Avoids a =:float= even if using a caption; useful for source code 14072 blocks that may not fit on a page. 14073 14074 #+begin_example 14075 ,#+ATTR_LATEX: :float nil 14076 ,#+BEGIN_SRC emacs-lisp 14077 Lisp code that may not fit in a single page. 14078 ,#+END_SRC 14079 #+end_example 14080 14081 #+vindex: org-latex-listings-options 14082 #+vindex: org-latex-minted-options 14083 #+vindex: org-latex-engraved-options 14084 The LaTeX export back-end passes string values in =:options= to LaTeX 14085 packages for customization of that specific source block. In the 14086 example below, the =:options= are set for Engraved or Minted. Minted 14087 is a source code highlighting LaTeX package with many configurable 14088 options[fn:: Minted uses an external Python package for code 14089 highlighting, which requires the flag =-shell-escape= to be added to 14090 ~org-latex-pdf-process~.]. Both Minted and Engraved are built on 14091 [[https://www.ctan.org/pkg/fvextra][fvextra]], and so support many of 14092 the same options. 14093 14094 #+begin_example 14095 ,#+ATTR_LATEX: :options mathescape 14096 ,#+BEGIN_SRC emacs-lisp 14097 (defun Fib (n) ; $n_i = n_{i-2} + n_{i-1}$ 14098 (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2))))) 14099 ,#+END_SRC 14100 #+end_example 14101 14102 To apply similar configuration options for all source blocks in a 14103 file, use the ~org-latex-listings-options~, 14104 ~org-latex-engraved-options~, and ~org-latex-minted-options~ 14105 variables. 14106 14107 *** Example blocks in LaTeX export 14108 :PROPERTIES: 14109 :DESCRIPTION: Attributes specific to example blocks. 14110 :END: 14111 #+cindex: example blocks, in @LaTeX{} export 14112 #+cindex: verbatim blocks, in @LaTeX{} export 14113 #+cindex: @samp{ATTR_LATEX}, keyword 14114 14115 The LaTeX export back-end wraps the contents of example blocks in 14116 a =verbatim= environment. To change this behavior to use another 14117 environment globally, specify an appropriate export filter (see 14118 [[*Advanced Export Configuration]]). To change this behavior to use 14119 another environment for each block, use the =:environment= parameter 14120 to specify a custom environment. 14121 14122 #+begin_example 14123 ,#+ATTR_LATEX: :environment myverbatim 14124 ,#+BEGIN_EXAMPLE 14125 This sentence is false. 14126 ,#+END_EXAMPLE 14127 #+end_example 14128 14129 *** Special blocks in LaTeX export 14130 :PROPERTIES: 14131 :DESCRIPTION: Attributes specific to special blocks. 14132 :END: 14133 14134 #+cindex: special blocks, in @LaTeX{} export 14135 #+cindex: abstract, in @LaTeX{} export 14136 #+cindex: proof, in @LaTeX{} export 14137 #+cindex: @samp{ATTR_LATEX}, keyword 14138 14139 For other special blocks in the Org file, the LaTeX export back-end 14140 makes a special environment of the same name. The back-end also takes 14141 =:options=, if any, and appends as-is to that environment's opening 14142 string. For example: 14143 14144 #+begin_example 14145 ,#+BEGIN_abstract 14146 We demonstrate how to solve the Syracuse problem. 14147 ,#+END_abstract 14148 14149 ,#+ATTR_LATEX: :options [Proof of important theorem] 14150 ,#+BEGIN_proof 14151 ... 14152 Therefore, any even number greater than 2 is the sum of two primes. 14153 ,#+END_proof 14154 #+end_example 14155 14156 #+texinfo: @noindent 14157 exports to 14158 14159 #+begin_example 14160 \begin{abstract} 14161 We demonstrate how to solve the Syracuse problem. 14162 \end{abstract} 14163 14164 \begin{proof}[Proof of important theorem] 14165 ... 14166 Therefore, any even number greater than 2 is the sum of two primes. 14167 \end{proof} 14168 #+end_example 14169 14170 If you need to insert a specific caption command, use =:caption= 14171 attribute. It overrides standard =CAPTION= value, if any. For 14172 example: 14173 14174 #+begin_example 14175 ,#+ATTR_LATEX: :caption \MyCaption{HeadingA} 14176 ,#+BEGIN_proof 14177 ... 14178 ,#+END_proof 14179 #+end_example 14180 14181 *** Horizontal rules in LaTeX export 14182 :PROPERTIES: 14183 :DESCRIPTION: Attributes specific to horizontal rules. 14184 :END: 14185 #+cindex: horizontal rules, in @LaTeX{} export 14186 #+cindex: @samp{ATTR_LATEX}, keyword 14187 14188 The LaTeX export back-end converts horizontal rules by the specified 14189 =:width= and =:thickness= attributes. For example: 14190 14191 #+begin_example 14192 ,#+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt 14193 ----- 14194 #+end_example 14195 14196 *** Verse blocks in LaTeX export 14197 :PROPERTIES: 14198 :DESCRIPTION: Attributes specific to special blocks. 14199 :END: 14200 14201 #+cindex: verse blocks, in @LaTeX{} export 14202 #+cindex: @samp{ATTR_LATEX}, keyword 14203 14204 The LaTeX export back-end accepts four attributes for verse blocks: 14205 =:lines=, =:center=, =:versewidth= and =:latexcode=. The three first 14206 require the external LaTeX package =verse.sty=, which is an extension 14207 of the standard LaTeX environment. 14208 14209 - =:lines= :: To add marginal verse numbering. Its value is an 14210 integer, the sequence in which the verses should be numbered. 14211 - =:center= :: With value =t= all the verses on the page are optically 14212 centered (a typographic convention for poetry), taking as a 14213 reference the longest verse, which must be indicated by the 14214 attribute =:versewidth=. 14215 - =:versewidth= :: Its value is a literal text string with the longest 14216 verse. 14217 - =:latexcode= :: It accepts any arbitrary LaTeX code that can be 14218 included within a LaTeX =verse= environment. 14219 14220 A complete example with Shakespeare's first sonnet: 14221 14222 #+begin_src org 14223 ,#+ATTR_LATEX: :center t :latexcode \color{red} :lines 5 14224 ,#+ATTR_LATEX: :versewidth Feed’st thy light’s flame with self-substantial fuel, 14225 ,#+BEGIN_VERSE 14226 From fairest creatures we desire increase, 14227 That thereby beauty’s rose might never die, 14228 But as the riper should by time decease 14229 His tender heir might bear his memory 14230 But thou, contracted to thine own bright eyes, 14231 Feed’st thy light’s flame with self-substantial fuel, 14232 Making a famine where abundance lies, 14233 Thyself thy foe, to thy sweet self too cruel. 14234 Thou that art now the world’s fresh ornament, 14235 And only herald to the gaudy spring, 14236 Within thine own bud buriest thy content, 14237 And, tender churl, mak’st waste in niggardly. 14238 Pity the world, or else this glutton be, 14239 To eat the world’s due, by the grave and thee. 14240 ,#+END_VERSE 14241 #+end_src 14242 14243 *** Quote blocks in LaTeX export 14244 :PROPERTIES: 14245 :DESCRIPTION: Attributes specific to quote blocks. 14246 :END: 14247 14248 #+cindex: quote blocks, in @LaTeX{} export 14249 #+cindex: @samp{ATTR_LATEX}, keyword 14250 #+cindex: org-latex-default-quote-environment 14251 14252 The LaTeX export back-end accepts two attributes for quote blocks: 14253 =:environment=, for an arbitrary quoting environment (the default 14254 value is that of ~org-latex-default-quote-environment~: ~"quote"~) and 14255 =:options=. For example, to choose the environment =quotation=, 14256 included as an alternative to =quote= in standard LaTeX classes: 14257 14258 #+begin_example 14259 ,#+ATTR_LATEX: :environment quotation 14260 ,#+BEGIN_QUOTE 14261 some text... 14262 ,#+END_QUOTE 14263 #+end_example 14264 14265 To choose the =foreigndisplayquote= environment, included in the LaTeX 14266 package =csquotes=, with the =german= option, use this syntax: 14267 14268 #+begin_example 14269 ,#+LATEX_HEADER:\usepackage[autostyle=true]{csquotes} 14270 ,#+ATTR_LATEX: :environment foreigndisplayquote :options {german} 14271 ,#+BEGIN_QUOTE 14272 some text in German... 14273 ,#+END_QUOTE 14274 #+end_example 14275 14276 #+texinfo: @noindent 14277 which is exported to LaTeX as 14278 14279 #+begin_example 14280 \begin{foreigndisplayquote}{german} 14281 some text in German... 14282 \end{foreigndisplayquote} 14283 #+end_example 14284 14285 ** Markdown Export 14286 :PROPERTIES: 14287 :DESCRIPTION: Exporting to Markdown. 14288 :END: 14289 #+cindex: Markdown export 14290 14291 The Markdown export back-end, "md", converts an Org file to Markdown 14292 format, as defined at https://daringfireball.net/projects/markdown/. 14293 14294 Since it is built on top of the HTML back-end (see [[*HTML Export]]), it 14295 converts every Org construct not defined in Markdown syntax, such as 14296 tables, to HTML. 14297 14298 *** Markdown export commands 14299 :PROPERTIES: 14300 :UNNUMBERED: notoc 14301 :END: 14302 14303 - {{{kbd(C-c C-e m m)}}} (~org-md-export-to-markdown~) :: 14304 14305 #+kindex: C-c C-c m m 14306 #+findex: org-md-export-to-markdown 14307 Export to a text file with Markdown syntax. For =myfile.org=, Org 14308 exports to =myfile.md=, overwritten without warning. 14309 14310 - {{{kbd(C-c C-e m M)}}} (~org-md-export-as-markdown~) :: 14311 14312 #+kindex: C-c C-c m M 14313 #+findex: org-md-export-as-markdown 14314 Export to a temporary buffer. Does not create a file. 14315 14316 - {{{kbd(C-c C-e m o)}}} :: 14317 14318 #+kindex: C-c C-e m o 14319 Export as a text file with Markdown syntax, then open it. 14320 14321 *** Header and sectioning structure 14322 :PROPERTIES: 14323 :UNNUMBERED: notoc 14324 :END: 14325 14326 #+vindex: org-md-headline-style 14327 Based on ~org-md-headline-style~, Markdown export can generate 14328 headlines of both /atx/ and /setext/ types. /atx/ limits headline 14329 levels to two whereas /setext/ limits headline levels to six. Beyond 14330 these limits, the export back-end converts headlines to lists. To set 14331 a limit to a level before the absolute limit (see [[*Export Settings]]). 14332 14333 ** OpenDocument Text Export 14334 :PROPERTIES: 14335 :DESCRIPTION: Exporting to OpenDocument Text. 14336 :END: 14337 #+cindex: ODT 14338 #+cindex: OpenDocument 14339 #+cindex: export, OpenDocument 14340 #+cindex: LibreOffice 14341 14342 The ODT export back-end handles creating of OpenDocument Text (ODT) 14343 format. Documents created by this exporter use the 14344 {{{cite(OpenDocument-v1.2 specification)}}}[fn:: See 14345 [[https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][Open 14346 Document Format for Office Applications (OpenDocument) Version 1.2]].] 14347 and are compatible with LibreOffice 3.4. 14348 14349 *** Pre-requisites for ODT export 14350 :PROPERTIES: 14351 :DESCRIPTION: Required packages. 14352 :END: 14353 #+cindex: zip 14354 14355 The ODT export back-end relies on the zip program to create the final 14356 compressed ODT output. Check if =zip= is locally available and 14357 executable. Without it, export cannot finish. 14358 14359 *** ODT export commands 14360 :PROPERTIES: 14361 :DESCRIPTION: Invoking export. 14362 :END: 14363 14364 - {{{kbd(C-c C-e o o)}}} (~org-export-to-odt~) :: 14365 14366 #+kindex: C-c C-e o o 14367 #+findex: org-export-to-odt 14368 Export as OpenDocument Text file. 14369 14370 #+cindex: @samp{EXPORT_FILE_NAME}, property 14371 #+vindex: org-odt-preferred-output-format 14372 14373 If ~org-odt-preferred-output-format~ is specified, the ODT export 14374 back-end automatically converts the exported file to that format. 14375 14376 For =myfile.org=, Org exports to =myfile.odt=, overwriting without 14377 warning. The ODT export back-end exports a region only if a region 14378 was active. 14379 14380 If the selected region is a single tree, the ODT export back-end 14381 makes the tree head the document title. Incidentally, {{{kbd(C-c 14382 @)}}} selects the current subtree. If the tree head entry has, or 14383 inherits, an =EXPORT_FILE_NAME= property, the ODT export back-end 14384 uses that for file name. 14385 14386 - {{{kbd(C-c C-e o O)}}} :: 14387 14388 #+kindex: C-c C-e o O 14389 Export as an OpenDocument Text file and open the resulting file. 14390 14391 #+vindex: org-export-odt-preferred-output-format 14392 If ~org-export-odt-preferred-output-format~ is specified, open the 14393 converted file instead. See [[*Automatically exporting to other 14394 formats]]. 14395 14396 *** ODT specific export settings 14397 :PROPERTIES: 14398 :DESCRIPTION: Configuration options. 14399 :END: 14400 14401 The ODT export back-end has several additional keywords for 14402 customizing ODT output. Setting these keywords works similar to the 14403 general options (see [[*Export Settings]]). 14404 14405 - =DESCRIPTION= :: 14406 14407 #+cindex: @samp{DESCRIPTION}, keyword 14408 This is the document's description, which the ODT export back-end 14409 inserts as document metadata. For long descriptions, use multiple 14410 lines, prefixed with =DESCRIPTION=. 14411 14412 - =KEYWORDS= :: 14413 14414 #+cindex: @samp{KEYWORDS}, keyword 14415 The keywords for the document. The ODT export back-end inserts the 14416 description along with author name, keywords, and related file 14417 metadata as metadata in the output file. Use multiple =KEYWORDS= if 14418 necessary. 14419 14420 - =ODT_STYLES_FILE= :: 14421 14422 #+cindex: @samp{ODT_STYLES_FILE}, keyword 14423 #+vindex: org-odt-styles-file 14424 The ODT export back-end uses the ~org-odt-styles-file~ by default. 14425 See [[*Applying custom styles]] for details. 14426 14427 - =SUBTITLE= :: 14428 14429 #+cindex: @samp{SUBTITLE}, keyword 14430 The document subtitle. 14431 14432 *** Extending ODT export 14433 :PROPERTIES: 14434 :DESCRIPTION: Producing DOC, PDF files. 14435 :END: 14436 14437 The ODT export back-end can produce documents in other formats besides 14438 ODT using a specialized ODT converter process. Its common interface 14439 works with popular converters to produce formats such as =doc=, or 14440 convert a document from one format, say =csv=, to another format, say 14441 =xls=. 14442 14443 #+cindex: @file{unoconv} 14444 #+vindex: org-odt-convert-process 14445 Customize ~org-odt-convert-process~ variable to point to =unoconv=, 14446 which is the ODT's preferred converter. Working installations of 14447 LibreOffice would already have =unoconv= installed. Alternatively, 14448 other converters may be substituted here. See [[*Configuring 14449 a document converter]]. 14450 14451 **** Automatically exporting to other formats 14452 :PROPERTIES: 14453 :UNNUMBERED: notoc 14454 :END: 14455 14456 #+vindex: org-odt-preferred-output-format 14457 If ODT format is just an intermediate step to get to other formats, 14458 such as =doc=, =docx=, =rtf=, or =pdf=, etc., then extend the ODT 14459 export back-end to directly produce that format. Specify the final 14460 format in the ~org-odt-preferred-output-format~ variable. This is one 14461 way to extend (see [[*ODT export commands]]). 14462 14463 **** Converting between document formats 14464 :PROPERTIES: 14465 :UNNUMBERED: notoc 14466 :END: 14467 14468 The Org export back-end is made to be inter-operable with a wide range 14469 of text document format converters. Newer generation converters, such 14470 as LibreOffice and Pandoc, can handle hundreds of formats at once. 14471 Org provides a consistent interaction with whatever converter is 14472 installed. Here are some generic commands: 14473 14474 - {{{kbd(M-x org-odt-convert)}}} :: 14475 14476 #+findex: org-odt-convert 14477 Convert an existing document from one format to another. With 14478 a prefix argument, opens the newly produced file. 14479 14480 *** Applying custom styles 14481 :PROPERTIES: 14482 :DESCRIPTION: Styling the output. 14483 :END: 14484 #+cindex: styles, custom 14485 #+cindex: template, custom 14486 14487 The ODT export back-end comes with many OpenDocument styles (see 14488 [[*Working with OpenDocument style files]]). To expand or further 14489 customize these built-in style sheets, either edit the style sheets 14490 directly or generate them using an application such as LibreOffice. 14491 The example here shows creating a style using LibreOffice. 14492 14493 **** Applying custom styles: the easy way 14494 :PROPERTIES: 14495 :UNNUMBERED: notoc 14496 :END: 14497 14498 1. Create a sample =example.org= file with settings as shown below, 14499 and export it to ODT format. 14500 14501 : #+OPTIONS: H:10 num:t 14502 14503 2. Open the above =example.odt= using LibreOffice. Use the /Stylist/ 14504 to locate the target styles, which typically have the "Org" prefix. 14505 Open one, modify, and save as either OpenDocument Text (ODT) or 14506 OpenDocument Template (OTT) file. 14507 14508 3. 14509 #+vindex: org-odt-styles-file 14510 Customize the variable ~org-odt-styles-file~ and point it to the 14511 newly created file. For additional configuration options, see 14512 [[x-overriding-factory-styles][Overriding factory styles]]. 14513 14514 #+cindex: @samp{ODT_STYLES_FILE}, keyword 14515 To apply an ODT style to a particular file, use the 14516 =ODT_STYLES_FILE= keyword as shown in the example below: 14517 14518 : #+ODT_STYLES_FILE: "/path/to/example.ott" 14519 14520 #+texinfo: @noindent 14521 or 14522 14523 : #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png")) 14524 14525 **** Using third-party styles and templates 14526 :PROPERTIES: 14527 :UNNUMBERED: notoc 14528 :END: 14529 14530 The ODT export back-end relies on many templates and style names. 14531 Using third-party styles and templates can lead to mismatches. 14532 Templates derived from built-in ODT templates and styles seem to have 14533 fewer problems. 14534 14535 *** Links in ODT export 14536 :PROPERTIES: 14537 :DESCRIPTION: Handling and formatting links. 14538 :END: 14539 #+cindex: links, in ODT export 14540 14541 ODT exporter creates native cross-references for internal links. It 14542 creates Internet-style links for all other links. 14543 14544 A link with no description and pointing to a regular, un-itemized, 14545 outline heading is replaced with a cross-reference and section number 14546 of the heading. 14547 14548 A =\ref{label}=-style reference to an image, table etc., is replaced 14549 with a cross-reference and sequence number of the labeled entity. See 14550 [[*Labels and captions in ODT export]]. 14551 14552 *** Tables in ODT export 14553 :PROPERTIES: 14554 :DESCRIPTION: Org tables conversions. 14555 :END: 14556 14557 #+cindex: tables, in ODT export 14558 14559 The ODT export back-end handles native Org mode tables (see [[*Tables]]) 14560 and simple =table.el= tables. Complex =table.el= tables having column 14561 or row spans are not supported. Such tables are stripped from the 14562 exported document. 14563 14564 By default, the ODT export back-end exports a table with top and 14565 bottom frames and with ruled lines separating row and column groups 14566 (see [[*Column Groups]]). All tables are typeset to occupy the same 14567 width. The ODT export back-end honors any table alignments and 14568 relative widths for columns (see [[*Column Width and Alignment]]). 14569 14570 Note that the ODT export back-end interprets column widths as weighted 14571 ratios, the default weight being 1. 14572 14573 #+cindex: @samp{ATTR_ODT}, keyword 14574 Specifying =:rel-width= property on an =ATTR_ODT= line controls the 14575 width of the table. For example: 14576 14577 #+begin_example 14578 ,#+ATTR_ODT: :rel-width 50 14579 | Area/Month | Jan | Feb | Mar | Sum | 14580 |---------------+-------+-------+-------+-------| 14581 | / | < | | | < | 14582 | <l13> | <r5> | <r5> | <r5> | <r6> | 14583 | North America | 1 | 21 | 926 | 948 | 14584 | Middle East | 6 | 75 | 844 | 925 | 14585 | Asia Pacific | 9 | 27 | 790 | 826 | 14586 |---------------+-------+-------+-------+-------| 14587 | Sum | 16 | 123 | 2560 | 2699 | 14588 #+end_example 14589 14590 On export, the above table takes 50% of text width area. The exporter 14591 sizes the columns in the ratio: 13:5:5:5:6. The first column is 14592 left-aligned and rest of the columns, right-aligned. Vertical rules 14593 separate the header and the last column. Horizontal rules separate 14594 the header and the last row. 14595 14596 For even more customization, create custom table styles and associate 14597 them with a table using the =ATTR_ODT= keyword. See [[*Customizing 14598 tables in ODT export]]. 14599 14600 *** Images in ODT export 14601 :PROPERTIES: 14602 :DESCRIPTION: Inserting images. 14603 :END: 14604 #+cindex: images, embedding in ODT 14605 #+cindex: embedding images in ODT 14606 14607 **** Embedding images 14608 :PROPERTIES: 14609 :UNNUMBERED: notoc 14610 :END: 14611 14612 The ODT export back-end processes image links in Org files that do not 14613 have descriptions, such as these links =[[file:img.jpg]]= or =[[./img.jpg]]=, 14614 as direct image insertions in the final output. Either of these 14615 examples works: 14616 14617 : [[file:img.png]] 14618 14619 : [[./img.png]] 14620 14621 **** Embedding clickable images 14622 :PROPERTIES: 14623 :UNNUMBERED: notoc 14624 :END: 14625 14626 For clickable images, provide a link whose description is another link 14627 to an image file. For example, to embed an image 14628 =org-mode-unicorn.png= which when clicked jumps to https://orgmode.org 14629 website, do the following 14630 14631 : [[https://orgmode.org][./org-mode-unicorn.png]] 14632 14633 **** Sizing and scaling of embedded images 14634 :PROPERTIES: 14635 :UNNUMBERED: notoc 14636 :END: 14637 14638 #+cindex: @samp{ATTR_ODT}, keyword 14639 14640 Control the size and scale of the embedded images with the =ATTR_ODT= 14641 attribute. 14642 14643 #+cindex: identify, ImageMagick 14644 #+vindex: org-odt-pixels-per-inch 14645 The ODT export back-end starts with establishing the size of the image 14646 in the final document. The dimensions of this size are measured in 14647 centimeters. The back-end then queries the image file for its 14648 dimensions measured in pixels. For this measurement, the back-end 14649 relies on ImageMagick's identify program or Emacs ~create-image~ and 14650 ~image-size~ API. ImageMagick is the preferred choice for large file 14651 sizes or frequent batch operations. The back-end then converts the 14652 pixel dimensions using ~org-odt-pixels-per-inch~ into the familiar 72 14653 dpi or 96 dpi. The default value for this is in 14654 ~display-pixels-per-inch~, which can be tweaked for better results 14655 based on the capabilities of the output device. Here are some common 14656 image scaling operations: 14657 14658 - Explicitly size the image :: 14659 14660 To embed =img.png= as a 10 cm x 10 cm image, do the following: 14661 14662 #+begin_example 14663 ,#+ATTR_ODT: :width 10 :height 10 14664 [[./img.png]] 14665 #+end_example 14666 14667 - Scale the image :: 14668 14669 To embed =img.png= at half its size, do the following: 14670 14671 #+begin_example 14672 ,#+ATTR_ODT: :scale 0.5 14673 [[./img.png]] 14674 #+end_example 14675 14676 - Scale the image to a specific width :: 14677 14678 To embed =img.png= with a width of 10 cm while retaining the 14679 original height:width ratio, do the following: 14680 14681 #+begin_example 14682 ,#+ATTR_ODT: :width 10 14683 [[./img.png]] 14684 #+end_example 14685 14686 - Scale the image to a specific height :: 14687 14688 To embed =img.png= with a height of 10 cm while retaining the 14689 original height:width ratio, do the following: 14690 14691 #+begin_example 14692 ,#+ATTR_ODT: :height 10 14693 [[./img.png]] 14694 #+end_example 14695 14696 **** Anchoring of images 14697 :PROPERTIES: 14698 :UNNUMBERED: notoc 14699 :END: 14700 14701 #+cindex: @samp{ATTR_ODT}, keyword 14702 The ODT export back-end can anchor images to =as-char=, =paragraph=, 14703 or =page=. Set the preferred anchor using the =:anchor= property of 14704 the =ATTR_ODT= line. 14705 14706 To create an image that is anchored to a page: 14707 14708 #+begin_example 14709 ,#+ATTR_ODT: :anchor page 14710 [[./img.png]] 14711 #+end_example 14712 14713 *** Math formatting in ODT export 14714 :PROPERTIES: 14715 :DESCRIPTION: Formatting @LaTeX{} fragments. 14716 :END: 14717 14718 The ODT exporter has special support for handling math. 14719 14720 **** LaTeX math snippets 14721 :PROPERTIES: 14722 :DESCRIPTION: Embedding in @LaTeX{} format. 14723 :END: 14724 14725 LaTeX math snippets (see [[*LaTeX fragments]]) can be embedded in the ODT 14726 document in one of the following ways: 14727 14728 - MathML :: 14729 14730 #+cindex: MathML 14731 Add this line to the Org file. This option is activated on 14732 a per-file basis. 14733 14734 : #+OPTIONS: tex:t 14735 14736 With this option, LaTeX fragments are first converted into MathML 14737 fragments using an external LaTeX-to-MathML converter program. The 14738 resulting MathML fragments are then embedded as an OpenDocument 14739 Formula in the exported document. 14740 14741 #+vindex: org-latex-to-mathml-convert-command 14742 #+vindex: org-latex-to-mathml-jar-file 14743 You can specify the LaTeX-to-MathML converter by customizing the 14744 variables ~org-latex-to-mathml-convert-command~ and 14745 ~org-latex-to-mathml-jar-file~. 14746 14747 If you prefer to use MathToWeb[fn:: See 14748 [[http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl][MathToWeb]].] 14749 as your converter, you can configure the above variables as shown 14750 below. 14751 14752 #+begin_src emacs-lisp 14753 (setq org-latex-to-mathml-convert-command 14754 "java -jar %j -unicode -force -df %o %I" 14755 org-latex-to-mathml-jar-file 14756 "/path/to/mathtoweb.jar") 14757 #+end_src 14758 14759 #+texinfo: @noindent 14760 or, to use LaTeXML[fn:: See [[https://dlmf.nist.gov/LaTeXML/]].] 14761 instead, 14762 14763 #+begin_src emacs-lisp 14764 (setq org-latex-to-mathml-convert-command 14765 "latexmlmath \"%i\" --presentationmathml=%o") 14766 #+end_src 14767 14768 To quickly verify the reliability of the LaTeX-to-MathML 14769 converter, use the following commands: 14770 14771 - {{{kbd(M-x org-export-as-odf)}}} :: 14772 14773 Convert a LaTeX math snippet to an OpenDocument formula (=.odf=) 14774 file. 14775 14776 - {{{kbd(M-x org-export-as-odf-and-open)}}} :: 14777 14778 Convert a LaTeX math snippet to an OpenDocument formula (=.odf=) 14779 file and open the formula file with the system-registered 14780 application. 14781 14782 - PNG images :: 14783 14784 #+cindex: dvipng 14785 #+cindex: dvisvgm 14786 #+cindex: ImageMagick 14787 Add this line to the Org file. This option is activated on 14788 a per-file basis. 14789 14790 : #+OPTIONS: tex:dvipng 14791 14792 : #+OPTIONS: tex:dvisvgm 14793 14794 #+texinfo: @noindent 14795 or 14796 14797 : #+OPTIONS: tex:imagemagick 14798 14799 Under this option, LaTeX fragments are processed into PNG or SVG 14800 images and the resulting images are embedded in the exported 14801 document. This method requires dvipng program, dvisvgm or 14802 ImageMagick programs. 14803 14804 **** MathML and OpenDocument formula files 14805 :PROPERTIES: 14806 :DESCRIPTION: Embedding in native format. 14807 :END: 14808 14809 When embedding LaTeX math snippets in ODT documents is not reliable, 14810 there is one more option to try. Embed an equation by linking to its 14811 MathML (=.mml=) source or its OpenDocument formula (=.odf=) file as 14812 shown below: 14813 14814 : [[./equation.mml]] 14815 14816 #+texinfo: @noindent 14817 or 14818 14819 : [[./equation.odf]] 14820 14821 *** Labels and captions in ODT export 14822 :PROPERTIES: 14823 :DESCRIPTION: Rendering objects. 14824 :END: 14825 14826 ODT format handles labeling and captioning of objects based on their 14827 types. Inline images, tables, LaTeX fragments, and Math formulas are 14828 numbered and captioned separately. Each object also gets a unique 14829 sequence number based on its order of first appearance in the Org 14830 file. Each category has its own sequence. A caption is just a label 14831 applied to these objects. 14832 14833 #+begin_example 14834 ,#+CAPTION: Bell curve 14835 ,#+NAME: fig:SED-HR4049 14836 [[./img/a.png]] 14837 #+end_example 14838 14839 When rendered, it may show as follows in the exported document: 14840 14841 : Figure 2: Bell curve 14842 14843 #+vindex: org-odt-category-map-alist 14844 To modify the category component of the caption, customize the option 14845 ~org-odt-category-map-alist~. For example, to tag embedded images 14846 with the string "Illustration" instead of the default string "Figure", 14847 use the following setting: 14848 14849 #+begin_src emacs-lisp 14850 (setq org-odt-category-map-alist 14851 '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p))) 14852 #+end_src 14853 14854 With the above modification, the previous example changes to: 14855 14856 : Illustration 2: Bell curve 14857 14858 *** Literal examples in ODT export 14859 :PROPERTIES: 14860 :DESCRIPTION: For source code and example blocks. 14861 :END: 14862 14863 The ODT export back-end supports literal examples (see [[*Literal 14864 Examples]]) with full fontification. Internally, the ODT export 14865 back-end relies on =htmlfontify.el= to generate the style definitions 14866 needed for fancy listings. The auto-generated styles get =OrgSrc= 14867 prefix and inherit colors from the faces used by Emacs Font Lock 14868 library for that source language. 14869 14870 #+vindex: org-odt-fontify-srcblocks 14871 For custom fontification styles, customize the 14872 ~org-odt-create-custom-styles-for-srcblocks~ option. 14873 14874 #+vindex: org-odt-create-custom-styles-for-srcblocks 14875 To turn off fontification of literal examples, customize the 14876 ~org-odt-fontify-srcblocks~ option. 14877 14878 *** Advanced topics in ODT export 14879 :PROPERTIES: 14880 :DESCRIPTION: For power users. 14881 :END: 14882 14883 The ODT export back-end has extensive features useful for power users 14884 and frequent uses of ODT formats. 14885 14886 **** Configuring a document converter 14887 :PROPERTIES: 14888 :DESCRIPTION: Registering a document converter. 14889 :UNNUMBERED: notoc 14890 :END: 14891 #+cindex: convert 14892 #+cindex: doc, docx, rtf 14893 #+cindex: converter 14894 14895 The ODT export back-end works with popular converters with little or 14896 no extra configuration. See [[*Extending ODT export]]. The following is 14897 for unsupported converters or tweaking existing defaults. 14898 14899 - Register the converter :: 14900 14901 #+vindex: org-export-odt-convert-processes 14902 Add the name of the converter to the ~org-odt-convert-processes~ 14903 variable. Note that it also requires how the converter is invoked 14904 on the command line. See the variable's docstring for details. 14905 14906 - Configure its capabilities :: 14907 14908 #+vindex: org-export-odt-convert-capabilities 14909 Specify which formats the converter can handle by customizing the 14910 variable ~org-odt-convert-capabilities~. Use the entry for the 14911 default values in this variable for configuring the new converter. 14912 Also see its docstring for details. 14913 14914 - Choose the converter :: 14915 14916 #+vindex: org-export-odt-convert-process 14917 Select the newly added converter as the preferred one by customizing 14918 the option ~org-odt-convert-process~. 14919 14920 **** Working with OpenDocument style files 14921 :PROPERTIES: 14922 :DESCRIPTION: Exploring internals. 14923 :UNNUMBERED: notoc 14924 :END: 14925 #+cindex: styles, custom 14926 #+cindex: template, custom 14927 14928 This section explores the internals of the ODT exporter; the means by which 14929 it produces styled documents; the use of automatic and custom OpenDocument 14930 styles. 14931 14932 The ODT exporter relies on two files for generating its output. These 14933 files are bundled with the distribution under the directory pointed to 14934 by the variable ~org-odt-styles-dir~. The two files are: 14935 14936 - =OrgOdtStyles.xml= <<x-orgodtstyles-xml>> :: 14937 14938 This file contributes to the =styles.xml= file of the final ODT 14939 document. This file gets modified for the following purposes: 14940 14941 1. To control outline numbering based on user settings; 14942 14943 2. To add styles generated by =htmlfontify.el= for fontification of 14944 code blocks. 14945 14946 - =OrgOdtContentTemplate.xml= <<x-orgodtcontenttemplate-xml>> :: 14947 14948 This file contributes to the =content.xml= file of the final ODT 14949 document. The contents of the Org outline are inserted between the 14950 =<office:text>= ... =</office:text>= elements of this file. 14951 14952 Apart from serving as a template file for the final =content.xml=, 14953 the file serves the following purposes: 14954 14955 1. It contains automatic styles for formatting of tables which are 14956 referenced by the exporter; 14957 14958 2. It contains =<text:sequence-decl>= ... =</text:sequence-decl>= 14959 elements that control numbering of tables, images, equations, and 14960 similar entities. 14961 14962 <<x-overriding-factory-styles>> The following two variables control 14963 the location from where the ODT exporter picks up the custom styles 14964 and content template files. Customize these variables to override the 14965 factory styles used by the exporter. 14966 14967 - ~org-odt-styles-file~ :: 14968 14969 The ODT export back-end uses the file pointed to by this variable, 14970 such as =styles.xml=, for the final output. It can take one of the 14971 following values: 14972 14973 - =FILE.xml= :: 14974 14975 Use this file instead of the default =styles.xml= 14976 14977 - =FILE.odt= or =FILE.ott= :: 14978 14979 Use the =styles.xml= contained in the specified OpenDocument 14980 Text or Template file 14981 14982 - =FILE.odt= or =FILE.ott= and a subset of included files :: 14983 14984 Use the =styles.xml= contained in the specified OpenDocument Text 14985 or Template file. Additionally extract the specified member files 14986 and embed those within the final ODT document. 14987 14988 Use this option if the =styles.xml= file references additional 14989 files like header and footer images. 14990 14991 - ~nil~ :: 14992 14993 Use the default =styles.xml=. 14994 14995 - ~org-odt-content-template-file~ :: 14996 14997 Use this variable to specify the blank =content.xml= used in the 14998 final output. 14999 15000 **** Creating one-off styles 15001 :PROPERTIES: 15002 :DESCRIPTION: Customizing styles, highlighting... 15003 :UNNUMBERED: notoc 15004 :END: 15005 15006 The ODT export back-end can read embedded raw OpenDocument XML from 15007 the Org file. Such direct formatting is useful for one-off instances. 15008 15009 - Embedding ODT tags as part of regular text :: 15010 15011 Enclose OpenDocument syntax in =@@odt:...@@= for inline markup. For 15012 example, to highlight a region of text do the following: 15013 15014 #+begin_example 15015 @@odt:<text:span text:style-name="Highlight">This is highlighted 15016 text</text:span>@@. But this is regular text. 15017 #+end_example 15018 15019 *Hint:* To see the above example in action, edit the =styles.xml= 15020 (see [[x-orgodtstyles-xml][Factory styles]]) and add a custom /Highlight/ style as shown 15021 below: 15022 15023 #+begin_example 15024 <style:style style:name="Highlight" style:family="text"> 15025 <style:text-properties fo:background-color="#ff0000"/> 15026 </style:style> 15027 #+end_example 15028 15029 - Embedding a one-line OpenDocument XML :: 15030 15031 #+cindex: @samp{ODT}, keyword 15032 The ODT export back-end can read one-liner options with =#+ODT:= in 15033 the Org file. For example, to force a page break: 15034 15035 #+begin_example 15036 ,#+ODT: <text:p text:style-name="PageBreak"/> 15037 #+end_example 15038 15039 *Hint:* To see the above example in action, edit your 15040 =styles.xml= (see [[x-orgodtstyles-xml][Factory styles]]) and add a custom =PageBreak= 15041 style as shown below. 15042 15043 #+begin_example 15044 <style:style style:name="PageBreak" style:family="paragraph" 15045 style:parent-style-name="Text_20_body"> 15046 <style:paragraph-properties fo:break-before="page"/> 15047 </style:style> 15048 #+end_example 15049 15050 - Embedding a block of OpenDocument XML :: 15051 15052 The ODT export back-end can also read ODT export blocks for 15053 OpenDocument XML. Such blocks use the =#+BEGIN_EXPORT odt= 15054 ... =#+END_EXPORT= constructs. 15055 15056 For example, to create a one-off paragraph that uses bold text, do 15057 the following: 15058 15059 #+begin_example 15060 ,#+BEGIN_EXPORT odt 15061 <text:p text:style-name="Text_20_body_20_bold"> 15062 This paragraph is specially formatted and uses bold text. 15063 </text:p> 15064 ,#+END_EXPORT 15065 #+end_example 15066 15067 **** Customizing tables in ODT export 15068 :PROPERTIES: 15069 :DESCRIPTION: Defining table templates. 15070 :UNNUMBERED: notoc 15071 :END: 15072 #+cindex: tables, in ODT export 15073 #+cindex: @samp{ATTR_ODT}, keyword 15074 15075 Override the default table format by specifying a custom table style 15076 with the =#+ATTR_ODT= line. For a discussion on default formatting of 15077 tables, see [[*Tables in ODT export]]. 15078 15079 This feature closely mimics the way table templates are defined in the 15080 OpenDocument-v1.2 specification[fn:: 15081 [[https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html][OpenDocument-v1.2 15082 Specification]]]. 15083 15084 #+vindex: org-odt-table-styles 15085 For quick preview of this feature, install the settings below and export the 15086 table that follows: 15087 15088 #+begin_src emacs-lisp 15089 (setq org-export-odt-table-styles 15090 (append org-export-odt-table-styles 15091 '(("TableWithHeaderRowAndColumn" "Custom" 15092 ((use-first-row-styles . t) 15093 (use-first-column-styles . t))) 15094 ("TableWithFirstRowandLastRow" "Custom" 15095 ((use-first-row-styles . t) 15096 (use-last-row-styles . t)))))) 15097 #+end_src 15098 15099 #+begin_example 15100 ,#+ATTR_ODT: :style TableWithHeaderRowAndColumn 15101 | Name | Phone | Age | 15102 | Peter | 1234 | 17 | 15103 | Anna | 4321 | 25 | 15104 #+end_example 15105 15106 The example above used =Custom= template and installed two table 15107 styles =TableWithHeaderRowAndColumn= and 15108 =TableWithFirstRowandLastRow=. *Important:* The OpenDocument styles 15109 needed for producing the above template were pre-defined. They are 15110 available in the section marked =Custom Table Template= in 15111 =OrgOdtContentTemplate.xml= (see [[x-orgodtcontenttemplate-xml][Factory styles]]). For adding new 15112 templates, define new styles there. 15113 15114 To use this feature proceed as follows: 15115 15116 1. Create a table template[fn:: See the =<table:table-template>= 15117 element of the OpenDocument-v1.2 specification.]. 15118 15119 A table template is set of =table-cell= and =paragraph= styles for 15120 each of the following table cell categories: 15121 15122 - Body 15123 - First column 15124 - Last column 15125 - First row 15126 - Last row 15127 - Even row 15128 - Odd row 15129 - Even column 15130 - Odd Column 15131 15132 The names for the above styles must be chosen based on the name of 15133 the table template using a well-defined convention. 15134 15135 The naming convention is better illustrated with an example. For 15136 a table template with the name =Custom=, the needed style names are 15137 listed in the following table. 15138 15139 | Cell type | Cell style | Paragraph style | 15140 |--------------+------------------------------+-----------------------------------| 15141 | Body | =CustomTableCell= | =CustomTableParagraph= | 15142 | First column | =CustomFirstColumnTableCell= | =CustomFirstColumnTableParagraph= | 15143 | Last column | =CustomLastColumnTableCell= | =CustomLastColumnTableParagraph= | 15144 | First row | =CustomFirstRowTableCell= | =CustomFirstRowTableParagraph= | 15145 | Last row | =CustomLastRowTableCell= | =CustomLastRowTableParagraph= | 15146 | Even row | =CustomEvenRowTableCell= | =CustomEvenRowTableParagraph= | 15147 | Odd row | =CustomOddRowTableCell= | =CustomOddRowTableParagraph= | 15148 | Even column | =CustomEvenColumnTableCell= | =CustomEvenColumnTableParagraph= | 15149 | Odd column | =CustomOddColumnTableCell= | =CustomOddColumnTableParagraph= | 15150 15151 To create a table template with the name =Custom=, define the above 15152 styles in the =<office:automatic-styles>= ... 15153 =</office:automatic-styles>= element of the content template file 15154 (see [[x-orgodtcontenttemplate-xml][Factory styles]]). 15155 15156 2. Define a table style[fn:: See the attributes =table:template-name=, 15157 =table:use-first-row-styles=, =table:use-last-row-styles=, 15158 =table:use-first-column-styles=, =table:use-last-column-styles=, 15159 =table:use-banding-rows-styles=, and 15160 =table:use-banding-column-styles= of the =<table:table>= element in 15161 the OpenDocument-v1.2 specification.]. 15162 15163 #+vindex: org-odt-table-styles 15164 To define a table style, create an entry for the style in the 15165 variable ~org-odt-table-styles~ and specify the following: 15166 15167 - the name of the table template created in step (1), 15168 - the set of cell styles in that template that are to be activated. 15169 15170 For example, the entry below defines two different table styles 15171 =TableWithHeaderRowAndColumn= and =TableWithFirstRowandLastRow= 15172 based on the same template =Custom=. The styles achieve their 15173 intended effect by selectively activating the individual cell 15174 styles in that template. 15175 15176 #+begin_src emacs-lisp 15177 (setq org-export-odt-table-styles 15178 (append org-export-odt-table-styles 15179 '(("TableWithHeaderRowAndColumn" "Custom" 15180 ((use-first-row-styles . t) 15181 (use-first-column-styles . t))) 15182 ("TableWithFirstRowandLastRow" "Custom" 15183 ((use-first-row-styles . t) 15184 (use-last-row-styles . t)))))) 15185 #+end_src 15186 15187 3. Associate a table with the table style. 15188 15189 To do this, specify the table style created in step (2) as part of 15190 the =ATTR_ODT= line as shown below. 15191 15192 #+begin_example 15193 ,#+ATTR_ODT: :style TableWithHeaderRowAndColumn 15194 | Name | Phone | Age | 15195 | Peter | 1234 | 17 | 15196 | Anna | 4321 | 25 | 15197 #+end_example 15198 15199 **** Validating OpenDocument XML 15200 :PROPERTIES: 15201 :DESCRIPTION: Debugging corrupted OpenDocument files. 15202 :UNNUMBERED: notoc 15203 :END: 15204 15205 Sometimes ODT format files may not open due to =.odt= file corruption. 15206 To verify if such a file is corrupt, validate it against the 15207 OpenDocument Relax NG Compact (RNC) syntax schema. But first the 15208 =.odt= files have to be decompressed using =zip=. Note that =.odt= 15209 files are ZIP archives: [[info:emacs::File Archives]]. The contents of 15210 ODT files are in XML. For general help with validation---and 15211 schema-sensitive editing---of XML files: [[info:nxml-mode::Introduction]]. 15212 15213 #+vindex: org-export-odt-schema-dir 15214 Customize ~org-odt-schema-dir~ to point to a directory with 15215 OpenDocument RNC files and the needed schema-locating rules. The ODT 15216 export back-end takes care of updating the 15217 ~rng-schema-locating-files~. 15218 15219 ** Org Export 15220 :PROPERTIES: 15221 :DESCRIPTION: Exporting to Org. 15222 :END: 15223 15224 #+cindex: Org export 15225 /org/ export back-end creates a normalized version of the Org document 15226 in current buffer. The exporter evaluates Babel code (see [[*Evaluating 15227 Code Blocks]]) and removes content specific to other back-ends. 15228 15229 *** Org export commands 15230 :PROPERTIES: 15231 :UNNUMBERED: notoc 15232 :END: 15233 15234 - {{{kbd(C-c C-e O o)}}} (~org-org-export-to-org~) :: 15235 15236 #+kindex: C-c C-e O o 15237 #+findex: org-org-export-to-org 15238 Export as an Org file with a =.org= extension. For =myfile.org=, 15239 Org exports to =myfile.org.org=, overwriting without warning. 15240 15241 - {{{kbd(C-c C-e O v)}}} (~~) :: 15242 15243 #+kindex: C-c C-e O v 15244 Export to an Org file, then open it. 15245 15246 ** Texinfo Export 15247 :PROPERTIES: 15248 :DESCRIPTION: Exporting to Texinfo. 15249 :END: 15250 15251 *** Texinfo export commands 15252 :PROPERTIES: 15253 :DESCRIPTION: Invoking commands. 15254 :END: 15255 15256 - {{{kbd(C-c C-e i t)}}} (~org-texinfo-export-to-texinfo~) :: 15257 15258 #+kindex: C-c C-e i t 15259 #+findex: org-texinfo-export-to-texinfo 15260 Export as a Texinfo file with =.texi= extension. For =myfile.org=, 15261 Org exports to =myfile.texi=, overwriting without warning. 15262 15263 - {{{kbd(C-c C-e i i)}}} (~org-texinfo-export-to-info~) :: 15264 15265 #+kindex: C-c C-e i i 15266 #+findex: org-texinfo-export-to-info 15267 #+vindex: org-texinfo-info-process 15268 Export to Texinfo format first and then process it to make an Info 15269 file. To generate other formats, such as DocBook, customize the 15270 ~org-texinfo-info-process~ variable. 15271 15272 *** Texinfo specific export settings 15273 :PROPERTIES: 15274 :DESCRIPTION: Setting the environment. 15275 :END: 15276 15277 The Texinfo export back-end has several additional keywords for 15278 customizing Texinfo output. Setting these keywords works similar to 15279 the general options (see [[*Export Settings]]). 15280 15281 - =SUBTITLE= :: 15282 15283 #+cindex: @samp{SUBTITLE}, keyword 15284 The document subtitle. 15285 15286 - =SUBAUTHOR= :: 15287 15288 #+cindex: @samp{SUBAUTHOR}, keyword 15289 Additional authors for the document. 15290 15291 - =TEXINFO_FILENAME= :: 15292 15293 #+cindex: @samp{TEXINFO_FILENAME}, keyword 15294 The Texinfo filename. 15295 15296 - =TEXINFO_CLASS= :: 15297 15298 #+cindex: @samp{TEXINFO_CLASS}, keyword 15299 #+vindex: org-texinfo-default-class 15300 The default document class (~org-texinfo-default-class~), which must 15301 be a member of ~org-texinfo-classes~. 15302 15303 - =TEXINFO_HEADER= :: 15304 15305 #+cindex: @samp{TEXINFO_HEADER}, keyword 15306 Arbitrary lines inserted at the end of the header. 15307 15308 - =TEXINFO_POST_HEADER= :: 15309 15310 #+cindex: @samp{TEXINFO_POST_HEADER}, keyword 15311 Arbitrary lines inserted after the end of the header. 15312 15313 - =TEXINFO_DIR_CATEGORY= :: 15314 15315 #+cindex: @samp{TEXINFO_DIR_CATEGORY}, keyword 15316 The directory category of the document. 15317 15318 - =TEXINFO_DIR_TITLE= :: 15319 15320 #+cindex: @samp{TEXINFO_DIR_TITLE}, keyword 15321 The directory title of the document. 15322 15323 - =TEXINFO_DIR_DESC= :: 15324 15325 #+cindex: @samp{TEXINFO_DIR_DESC}, keyword 15326 The directory description of the document. 15327 15328 - =TEXINFO_PRINTED_TITLE= :: 15329 15330 #+cindex: @samp{TEXINFO_PRINTED_TITLE}, keyword 15331 The printed title of the document. 15332 15333 *** Texinfo file header 15334 :PROPERTIES: 15335 :DESCRIPTION: Generating the header. 15336 :END: 15337 15338 #+cindex: @samp{TEXINFO_FILENAME}, keyword 15339 After creating the header for a Texinfo file, the Texinfo back-end 15340 automatically generates a name and destination path for the Info file. 15341 To override this default with a more sensible path and name, specify 15342 the =TEXINFO_FILENAME= keyword. 15343 15344 #+vindex: org-texinfo-coding-system 15345 #+cindex: @samp{TEXINFO_HEADER}, keyword 15346 Along with the output's file name, the Texinfo header also contains 15347 language details (see [[*Export Settings]]) and encoding system as set in 15348 the ~org-texinfo-coding-system~ variable. Insert =TEXINFO_HEADER= 15349 keywords for each additional command in the header, for example: 15350 15351 : #+TEXINFO_HEADER: @synindex 15352 15353 #+cindex: @samp{TEXINFO_CLASS}, keyword 15354 #+vindex: org-texinfo-classes 15355 Instead of repeatedly installing the same set of commands, define 15356 a class in ~org-texinfo-classes~ once, and then activate it in the 15357 document by setting the =TEXINFO_CLASS= keyword to that class. 15358 15359 *** Texinfo title and copyright page 15360 :PROPERTIES: 15361 :DESCRIPTION: Creating preamble pages. 15362 :END: 15363 15364 #+cindex: @samp{TEXINFO_PRINTED_TITLE}, keyword 15365 The default template for hard copy output has a title page with 15366 =TITLE= and =AUTHOR= keywords (see [[*Export Settings]]). To replace the 15367 regular title with something different for the printed version, use 15368 the =TEXINFO_PRINTED_TITLE= and =SUBTITLE= keywords. Both expect raw 15369 Texinfo code for setting their values. 15370 15371 #+cindex: @samp{SUBAUTHOR}, keyword 15372 If one =AUTHOR= line is not sufficient, add multiple =SUBAUTHOR= 15373 keywords. They have to be set in raw Texinfo code. 15374 15375 #+begin_example 15376 ,#+AUTHOR: Jane Smith 15377 ,#+SUBAUTHOR: John Doe 15378 ,#+TEXINFO_PRINTED_TITLE: This Long Title@@inlinefmt{tex,@*} Is Broken in @TeX{} 15379 #+end_example 15380 15381 #+cindex: @samp{COPYING}, property 15382 Copying material is defined in a dedicated headline with a non-~nil~ 15383 =COPYING= property. The back-end inserts the contents within 15384 a =@copying= command at the beginning of the document. The heading 15385 itself does not appear in the structure of the document. 15386 15387 Copyright information is printed on the back of the title page. 15388 15389 #+begin_example 15390 ,* Legalese 15391 :PROPERTIES: 15392 :COPYING: t 15393 :END: 15394 15395 This is a short example of a complete Texinfo file, version 1.0. 15396 15397 Copyright \copy 2016 Free Software Foundation, Inc. 15398 #+end_example 15399 15400 *** Info directory file 15401 :PROPERTIES: 15402 :DESCRIPTION: Installing a manual in Info file hierarchy. 15403 :END: 15404 15405 #+cindex: @samp{dir} file, in Texinfo export 15406 #+cindex: Info directory file, in Texinfo export 15407 #+cindex: @code{install-info}, in Texinfo export 15408 15409 #+cindex: @samp{TEXINFO_DIR_CATEGORY}, keyword 15410 #+cindex: @samp{TEXINFO_DIR_TITLE}, keyword 15411 #+cindex: @samp{TEXINFO_DIR_DESC}, keyword 15412 The end result of the Texinfo export process is the creation of an 15413 Info file. This Info file's metadata has variables for category, 15414 title, and description: =TEXINFO_DIR_CATEGORY=, =TEXINFO_DIR_TITLE=, 15415 and =TEXINFO_DIR_DESC= keywords that establish where in the Info 15416 hierarchy the file fits. 15417 15418 Here is an example that writes to the Info directory file: 15419 15420 #+begin_example 15421 ,#+TEXINFO_DIR_CATEGORY: Emacs 15422 ,#+TEXINFO_DIR_TITLE: Org Mode: (org) 15423 ,#+TEXINFO_DIR_DESC: Outline-based notes management and organizer 15424 #+end_example 15425 15426 *** Headings and sectioning structure 15427 :PROPERTIES: 15428 :DESCRIPTION: Building document structure. 15429 :END: 15430 15431 #+vindex: org-texinfo-classes 15432 #+vindex: org-texinfo-default-class 15433 #+cindex: @samp{TEXINFO_CLASS}, keyword 15434 The Texinfo export back-end uses a pre-defined scheme to convert Org 15435 headlines to equivalent Texinfo structuring commands. A scheme like 15436 this maps top-level headlines to numbered chapters tagged as 15437 ~@chapter~ and lower-level headlines to unnumbered chapters tagged as 15438 ~@unnumbered~. To override such mappings to introduce ~@part~ or 15439 other Texinfo structuring commands, define a new class in 15440 ~org-texinfo-classes~. Activate the new class with the 15441 =TEXINFO_CLASS= keyword. When no new class is defined and activated, 15442 the Texinfo export back-end defaults to the 15443 ~org-texinfo-default-class~. 15444 15445 If an Org headline's level has no associated Texinfo structuring 15446 command, or is below a certain threshold (see [[*Export Settings]]), then 15447 the Texinfo export back-end makes it into a list item. 15448 15449 #+cindex: @samp{APPENDIX}, property 15450 The Texinfo export back-end makes any headline with a non-~nil~ 15451 =APPENDIX= property into an appendix. This happens independent of the 15452 Org headline level or the =TEXINFO_CLASS= keyword. 15453 15454 #+cindex: @samp{ALT_TITLE}, property 15455 #+cindex: @samp{DESCRIPTION}, property 15456 The Texinfo export back-end creates a menu entry after the Org 15457 headline for each regular sectioning structure. To override this with 15458 a shorter menu entry, use the =ALT_TITLE= property (see [[*Table of 15459 Contents]]). Texinfo menu entries also have an option for a longer 15460 =DESCRIPTION= property. Here's an example that uses both to override 15461 the default menu entry: 15462 15463 #+begin_example 15464 ,* Controlling Screen Display 15465 :PROPERTIES: 15466 :ALT_TITLE: Display 15467 :DESCRIPTION: Controlling Screen Display 15468 :END: 15469 #+end_example 15470 15471 #+cindex: Top node, in Texinfo export 15472 The text before the first headline belongs to the /Top/ node, i.e., 15473 the node in which a reader enters an Info manual. As such, it is 15474 expected not to appear in printed output generated from the =.texi= 15475 file. See [[info:texinfo::The Top Node]], for more information. 15476 15477 *** Indices 15478 :PROPERTIES: 15479 :DESCRIPTION: Creating indices. 15480 :END: 15481 15482 #+cindex: @samp{CINDEX}, keyword 15483 #+cindex: concept index, in Texinfo export 15484 #+cindex: @samp{FINDEX}, keyword 15485 #+cindex: function index, in Texinfo export 15486 #+cindex: @samp{KINDEX}, keyword 15487 #+cindex: keystroke index, in Texinfo export 15488 #+cindex: @samp{PINDEX}, keyword 15489 #+cindex: program index, in Texinfo export 15490 #+cindex: @samp{TINDEX}, keyword 15491 #+cindex: data type index, in Texinfo export 15492 #+cindex: @samp{VINDEX}, keyword 15493 #+cindex: variable index, in Texinfo export 15494 The Texinfo export back-end recognizes these indexing keywords if used 15495 in the Org file: =CINDEX=, =FINDEX=, =KINDEX=, =PINDEX=, =TINDEX= and 15496 =VINDEX=. Write their value as verbatim Texinfo code; in particular, 15497 ={=, =}= and =@= characters need to be escaped with =@= if they do not 15498 belong to a Texinfo command. 15499 15500 : #+CINDEX: Defining indexing entries 15501 15502 #+cindex: @samp{INDEX}, property 15503 For the back-end to generate an index entry for a headline, set the 15504 =INDEX= property to =cp= or =vr=. These abbreviations come from 15505 Texinfo that stand for concept index and variable index. The Texinfo 15506 manual has abbreviations for all other kinds of indexes. The back-end 15507 exports the headline as an unnumbered chapter or section command, and 15508 then inserts the index after its contents. 15509 15510 #+begin_example 15511 ,* Concept Index 15512 :PROPERTIES: 15513 :INDEX: cp 15514 :END: 15515 #+end_example 15516 15517 *** Quoting Texinfo code 15518 :PROPERTIES: 15519 :DESCRIPTION: Incorporating literal Texinfo code. 15520 :END: 15521 15522 Use any of the following three methods to insert or escape raw Texinfo 15523 code: 15524 15525 #+cindex: @samp{TEXINFO}, keyword 15526 #+cindex: @samp{BEGIN_EXPORT texinfo} 15527 #+begin_example 15528 Richard @@texinfo:@sc{@@Stallman@@texinfo:}@@ commence' GNU. 15529 15530 ,#+TEXINFO: @need800 15531 This paragraph is preceded by... 15532 15533 ,#+BEGIN_EXPORT texinfo 15534 @auindex Johnson, Mark 15535 @auindex Lakoff, George 15536 ,#+END_EXPORT 15537 #+end_example 15538 15539 *** Plain lists in Texinfo export 15540 :PROPERTIES: 15541 :DESCRIPTION: List attributes. 15542 :END: 15543 15544 #+cindex: lettered lists, in Texinfo export 15545 #+cindex: enum, Texinfo attribute 15546 The Texinfo export back-end converts unordered and ordered lists in 15547 the Org file using the default command =@itemize=. 15548 15549 Ordered lists are numbered when exported to Texinfo format. Such 15550 numbering obeys any counter (see [[*Plain Lists]]) in the first item of 15551 the list. The =:enum= attribute also let you start the list at a 15552 specific number, or switch to a lettered list, as illustrated here: 15553 15554 #+begin_example 15555 #+ATTR_TEXINFO: :enum A 15556 1. Alpha 15557 2. Bravo 15558 3. Charlie 15559 #+end_example 15560 15561 #+cindex: @samp{ATTR_TEXINFO}, keyword 15562 #+cindex: two-column tables, in Texinfo export 15563 #+cindex: table-type, Texinfo attribute 15564 The Texinfo export back-end by default converts description lists in 15565 the Org file using the default command =@table=, which results in 15566 a table with two columns. To change this behavior, set =:table-type= 15567 attribute to either =ftable= or =vtable= value. For more information, 15568 see [[info:texinfo::Two-column Tables]]. 15569 15570 #+vindex: org-texinfo-table-default-markup 15571 #+cindex: indic, Texinfo attribute 15572 The Texinfo export back-end by default also applies a text highlight 15573 based on the defaults stored in ~org-texinfo-table-default-markup~. 15574 To override the default highlight command, specify another one with 15575 the =:indic= attribute. 15576 15577 #+cindex: multiple items in Texinfo lists 15578 #+cindex: sep, Texinfo attribute 15579 Org syntax is limited to one entry per list item. Nevertheless, the 15580 Texinfo export back-end can split that entry according to any text 15581 provided through the =:sep= attribute. Each part then becomes a new 15582 entry in the first column of the table. 15583 15584 The following example illustrates all the attributes above: 15585 15586 #+begin_example 15587 ,#+ATTR_TEXINFO: :table-type vtable :sep , :indic asis 15588 - foo, bar :: This is the common text for variables foo and bar. 15589 #+end_example 15590 15591 #+texinfo: @noindent 15592 becomes 15593 15594 #+begin_example 15595 @vtable @asis 15596 @item foo 15597 @itemx bar 15598 This is the common text for variables foo and bar. 15599 @end table 15600 #+end_example 15601 15602 The =:compact= attribute is an alternative to the =:sep= attribute, 15603 which allows writing each entry on its own line. If this attribute is 15604 non-nil and an item in a description list has no body but is followed 15605 by another item, then the second item is transcoded to =@itemx=. This 15606 example is transcoded to the same output as above. 15607 15608 #+begin_example 15609 ,#+ATTR_TEXINFO: :table-type vtable :indic asis :compact t 15610 - foo :: 15611 - bar :: 15612 This is the common text for variables foo and bar. 15613 #+end_example 15614 15615 Support for this compact syntax can also be enabled for all lists in 15616 a file using the =compact-itemx= export option, or globally using the 15617 variable ~org-texinfo-compact-itemx~. 15618 15619 The Texinfo export back-end also supports two approaches to writing 15620 Texinfo definition commands (see [[info:texinfo::Definition Commands]]). 15621 One of them uses description lists and is described below, the other 15622 relies on special blocks (see [[*Special blocks in Texinfo export]]). 15623 15624 Items in a description list in a Org file that begin with =Function:= 15625 or certain other prefixes are converted using Texinfo definition 15626 commands. This works even if other items in the same list do not have 15627 such a prefix; if necessary a single description list is converted 15628 using multiple tables (such as =@vtable=) and definition commands 15629 (such as =@defun=). 15630 15631 #+begin_example 15632 - Function: org-texinfo-drawer drawer contents info :: 15633 Transcode a DRAWER element from Org to Texinfo. 15634 #+end_example 15635 15636 #+texinfo: @noindent 15637 becomes 15638 15639 #+begin_example 15640 @defun org-texinfo-drawer drawer contents info :: 15641 Transcode a DRAWER element from Org to Texinfo. 15642 @end defun 15643 #+end_example 15644 15645 The recognized prefixes are =Command:=, =Function:=, =Macro:=, 15646 =Special Form:=, =Variable:= and =User Option:=. These are the same 15647 prefixes that appear in the Info file for the respective definition 15648 commands. For example a =Function:= item in the Org file is converted 15649 to a =@defun= command in the Texinfo file, which in turn is converted 15650 to a definition prefixed with =-- Function:= in the Info file. 15651 15652 As a special case the prefix =Key:= is also recognized. No Texinfo 15653 definition command exists for key bindings and the output in Info 15654 files also lacks the =Key:= prefix. Even so this special case is 15655 supported because it provides a convenient shorthand, as illustrated 15656 here: 15657 15658 #+begin_example 15659 - Key: C-c C-c (do-something) :: 15660 This command does something. 15661 15662 - User Option: do-something-somehow :: 15663 This option controls how exactly ~do-something~ does its thing. 15664 #+end_example 15665 15666 #+texinfo: @noindent 15667 becomes 15668 15669 #+begin_example 15670 @table @asis 15671 @item @kbd{C-c C-c} (@code{do-something}) 15672 @kindex C-c C-c 15673 @findex do-something 15674 This command does something. 15675 @end table 15676 15677 @defopt do-something-somehow 15678 This option controls how exactly @code{do-something} does its thing. 15679 @end defopt 15680 #+end_example 15681 15682 #+texinfo: @noindent 15683 Command in parenthesis, as done above, is optional. 15684 15685 *** Tables in Texinfo export 15686 :PROPERTIES: 15687 :DESCRIPTION: Table attributes. 15688 :END: 15689 15690 #+cindex: @samp{ATTR_TEXINFO}, keyword 15691 When exporting tables, the Texinfo export back-end uses the widest 15692 cell width in each column. To override this and instead specify as 15693 fractions of line length, use the =:columns= attribute. See example 15694 below. 15695 15696 #+begin_example 15697 ,#+ATTR_TEXINFO: :columns .5 .5 15698 | a cell | another cell | 15699 #+end_example 15700 15701 *** Images in Texinfo export 15702 :PROPERTIES: 15703 :DESCRIPTION: Image attributes. 15704 :END: 15705 15706 #+cindex: @samp{ATTR_TEXINFO}, keyword 15707 Insert a file link to the image in the Org file, and the Texinfo 15708 export back-end inserts the image. These links must have the usual 15709 supported image extensions and no descriptions. To scale the image, 15710 use =:width= and =:height= attributes. For alternate text, use =:alt= 15711 and specify the text using Texinfo code, as shown in the example: 15712 15713 #+begin_example 15714 ,#+ATTR_TEXINFO: :width 1in :alt Alternate @i{text} 15715 [[ridt.pdf]] 15716 #+end_example 15717 15718 *** Quotations in Texinfo export 15719 :PROPERTIES: 15720 :DESCRIPTION: Quote block attributes. 15721 :END: 15722 15723 #+cindex: @samp{ATTR_TEXINFO}, keyword 15724 You can write the text of a quotation within a quote block (see 15725 [[*Paragraphs]]). You may also emphasize some text at the beginning of 15726 the quotation with the =:tag= attribute. 15727 15728 #+begin_example 15729 ,#+ATTR_TEXINFO: :tag Warning 15730 ,#+BEGIN_QUOTE 15731 Striking your thumb with a hammer may cause severe pain and discomfort. 15732 ,#+END_QUOTE 15733 #+end_example 15734 15735 To specify the author of the quotation, use the =:author= attribute. 15736 15737 #+begin_example 15738 ,#+ATTR_TEXINFO: :author King Arthur 15739 ,#+BEGIN_QUOTE 15740 The Lady of the Lake, her arm clad in the purest shimmering samite, 15741 held aloft Excalibur from the bosom of the water, signifying by divine 15742 providence that I, Arthur, was to carry Excalibur. That is why I am 15743 your king. 15744 ,#+END_QUOTE 15745 #+end_example 15746 15747 *** Key bindings in Texinfo export 15748 :PROPERTIES: 15749 :DESCRIPTION: @@kbd Texinfo command. 15750 :END: 15751 15752 Org does not provide any markup for key bindings that corresponds to 15753 Texinfo's ~@kbd~ and ~@key~ commands. One way to deal with this is to 15754 fall back to code syntax. =~C-x SPC~=, for example, is transcoded to 15755 ~@code{C-x SPC}~. 15756 15757 A better approach is to define and use an Org macro named ~kbd~. To 15758 make that easier the function ~org-texinfo-kbd-macro~ is provided, 15759 which is intended to be used like this: 15760 15761 #+begin_example 15762 ,#+macro: kbd (eval (org-texinfo-kbd-macro $1)) 15763 15764 Type {{{kbd(C-c SPC)}}}. 15765 #+end_example 15766 15767 #+texinfo: @noindent 15768 which becomes 15769 15770 #+begin_example 15771 Type @kbd{C-c @key{SPC}}. 15772 #+end_example 15773 15774 *** Special blocks in Texinfo export 15775 :PROPERTIES: 15776 :DESCRIPTION: Special block attributes. 15777 :END: 15778 15779 The Texinfo export back-end supports two approaches to writing Texinfo 15780 definition commands. One of them is described here, the other in 15781 [[*Plain lists in Texinfo export]]. 15782 15783 #+cindex: @samp{ATTR_TEXINFO}, keyword 15784 15785 The Texinfo export back-end converts special blocks to commands with 15786 the same name. It also adds any =:options= attributes to the end of 15787 the command, as shown in this example: 15788 15789 #+begin_example 15790 ,#+ATTR_TEXINFO: :options org-org-export-to-org ... 15791 ,#+BEGIN_defun 15792 A somewhat obsessive function name. 15793 ,#+END_defun 15794 #+end_example 15795 15796 #+texinfo: @noindent 15797 becomes 15798 15799 #+begin_example 15800 @defun org-org-export-to-org ... 15801 A somewhat obsessive function name. 15802 @end defun 15803 #+end_example 15804 15805 *** A Texinfo example 15806 :PROPERTIES: 15807 :DESCRIPTION: Processing Org to Texinfo. 15808 :END: 15809 15810 Here is a more detailed example Org file. See 15811 [[info:texinfo::GNU Sample Texts]] for an equivalent example using 15812 Texinfo code. 15813 15814 #+begin_example 15815 ,#+TITLE: GNU Sample {{{version}}} 15816 ,#+SUBTITLE: for version {{{version}}}, {{{updated}}} 15817 ,#+AUTHOR: A.U. Thor 15818 ,#+EMAIL: bug-sample@gnu.org 15819 15820 ,#+OPTIONS: ':t toc:t author:t email:t 15821 ,#+LANGUAGE: en 15822 15823 ,#+MACRO: version 2.0 15824 ,#+MACRO: updated last updated 4 March 2014 15825 15826 ,#+TEXINFO_FILENAME: sample.info 15827 ,#+TEXINFO_HEADER: @syncodeindex pg cp 15828 15829 ,#+TEXINFO_DIR_CATEGORY: Texinfo documentation system 15830 ,#+TEXINFO_DIR_TITLE: sample: (sample) 15831 ,#+TEXINFO_DIR_DESC: Invoking sample 15832 15833 ,#+TEXINFO_PRINTED_TITLE: GNU Sample 15834 15835 This manual is for GNU Sample (version {{{version}}}, 15836 {{{updated}}}). 15837 15838 ,* Copying 15839 :PROPERTIES: 15840 :COPYING: t 15841 :END: 15842 15843 This manual is for GNU Sample (version {{{version}}}, 15844 {{{updated}}}), which is an example in the Texinfo documentation. 15845 15846 Copyright \copy 2016 Free Software Foundation, Inc. 15847 15848 ,#+BEGIN_QUOTE 15849 Permission is granted to copy, distribute and/or modify this 15850 document under the terms of the GNU Free Documentation License, 15851 Version 1.3 or any later version published by the Free Software 15852 Foundation; with no Invariant Sections, with no Front-Cover Texts, 15853 and with no Back-Cover Texts. A copy of the license is included in 15854 the section entitled "GNU Free Documentation License". 15855 ,#+END_QUOTE 15856 15857 ,* Invoking sample 15858 15859 ,#+PINDEX: sample 15860 ,#+CINDEX: invoking @command{sample} 15861 15862 This is a sample manual. There is no sample program to invoke, but 15863 if there were, you could see its basic usage and command line 15864 options here. 15865 15866 ,* GNU Free Documentation License 15867 :PROPERTIES: 15868 :APPENDIX: t 15869 :END: 15870 15871 ,#+INCLUDE: fdl.org 15872 15873 ,* Index 15874 :PROPERTIES: 15875 :INDEX: cp 15876 :END: 15877 #+end_example 15878 15879 ** iCalendar Export 15880 :PROPERTIES: 15881 :DESCRIPTION: Exporting to iCalendar. 15882 :END: 15883 #+cindex: iCalendar export 15884 15885 A large part of Org mode's interoperability success is its ability to 15886 easily export to or import from external applications. The iCalendar 15887 export back-end takes calendar data from Org files and exports to the 15888 standard iCalendar format. 15889 15890 #+vindex: org-icalendar-include-todo 15891 #+vindex: org-icalendar-use-deadline 15892 #+vindex: org-icalendar-use-scheduled 15893 The iCalendar export back-end can also incorporate TODO entries based 15894 on the configuration of the ~org-icalendar-include-todo~ variable. 15895 The back-end exports plain timestamps as =VEVENT=, TODO items as 15896 =VTODO=, and also create events from deadlines that are in non-TODO 15897 items. The back-end uses the deadlines and scheduling dates in Org 15898 TODO items for setting the start and due dates for the iCalendar TODO 15899 entry. Consult the ~org-icalendar-use-deadline~ and 15900 ~org-icalendar-use-scheduled~ variables for more details. 15901 15902 #+vindex: org-icalendar-categories 15903 #+vindex: org-icalendar-alarm-time 15904 For tags on the headline, the iCalendar export back-end makes them 15905 into iCalendar categories. To tweak the inheritance of tags and TODO 15906 states, configure the variable ~org-icalendar-categories~. To assign 15907 clock alarms based on time, configure the ~org-icalendar-alarm-time~ 15908 variable. 15909 15910 #+vindex: org-icalendar-store-UID 15911 #+cindex: @samp{ID}, property 15912 The iCalendar format standard requires globally unique identifier---or 15913 UID---for each entry. The iCalendar export back-end creates UIDs 15914 during export. To save a copy of the UID in the Org file set the 15915 variable ~org-icalendar-store-UID~. The back-end looks for the =ID= 15916 property of the entry for re-using the same UID for subsequent 15917 exports. 15918 15919 Since a single Org entry can result in multiple iCalendar 15920 entries---timestamp, deadline, scheduled item, or TODO item---Org adds 15921 prefixes to the UID, depending on which part of the Org entry 15922 triggered the creation of the iCalendar entry. Prefixing ensures UIDs 15923 remains unique, yet enable synchronization programs trace the 15924 connections. 15925 15926 - {{{kbd(C-c C-e c f)}}} (~org-icalendar-export-to-ics~) :: 15927 15928 #+kindex: C-c C-e c f 15929 #+findex: org-icalendar-export-to-ics 15930 Create iCalendar entries from the current Org buffer and store them 15931 in the same directory, using a file extension =.ics=. 15932 15933 - {{{kbd(C-c C-e c a)}}} (~org-icalendar-export-agenda-files~) :: 15934 15935 #+kindex: C-c C-e c a 15936 #+findex: org-icalendar-export-agenda-files 15937 Create iCalendar entries from Org files in ~org-agenda-files~ and 15938 store in a separate iCalendar file for each Org file. 15939 15940 - {{{kbd(C-c C-e c c)}}} (~org-icalendar-combine-agenda-files~) :: 15941 15942 #+kindex: C-c C-e c c 15943 #+findex: org-icalendar-combine-agenda-files 15944 #+vindex: org-icalendar-combined-agenda-file 15945 Create a combined iCalendar file from Org files in 15946 ~org-agenda-files~ and write it to 15947 ~org-icalendar-combined-agenda-file~ file name. 15948 15949 #+cindex: @samp{SUMMARY}, property 15950 #+cindex: @samp{DESCRIPTION}, property 15951 #+cindex: @samp{LOCATION}, property 15952 #+cindex: @samp{TIMEZONE}, property 15953 #+cindex: @samp{CLASS}, property 15954 The iCalendar export back-end includes =SUMMARY=, =DESCRIPTION=, 15955 =LOCATION=, =TIMEZONE= and =CLASS= properties from the Org entries 15956 when exporting. To force the back-end to inherit the =LOCATION=, 15957 =TIMEZONE= and =CLASS= properties, configure the 15958 ~org-use-property-inheritance~ variable. 15959 15960 #+vindex: org-icalendar-include-body 15961 When Org entries do not have =SUMMARY=, =DESCRIPTION=, =LOCATION= and 15962 =CLASS= properties, the iCalendar export back-end derives the summary 15963 from the headline, and derives the description from the body of the 15964 Org item. The ~org-icalendar-include-body~ variable limits the 15965 maximum number of characters of the content are turned into its 15966 description. 15967 15968 The =TIMEZONE= property can be used to specify a per-entry time zone, 15969 and is applied to any entry with timestamp information. Time zones 15970 should be specified as per the IANA time zone database format, e.g., 15971 =Asia/Almaty=. Alternately, the property value can be =UTC=, to force 15972 UTC time for this entry only. 15973 15974 The =CLASS= property can be used to specify a per-entry visibility 15975 class or access restrictions, and is applied to any entry with class 15976 information. The iCalendar standard defines three visibility classes: 15977 - =PUBLIC= :: The entry is publicly visible (this is the default). 15978 - =CONFIDENTIAL= :: Only a limited group of clients get access to the 15979 event. 15980 - =PRIVATE= :: The entry can be retrieved only by its owner. 15981 The server should treat unknown class properties the same as 15982 =PRIVATE=. 15983 15984 Exporting to iCalendar format depends in large part on the 15985 capabilities of the destination application. Some are more lenient 15986 than others. Consult the Org mode FAQ for advice on specific 15987 applications. 15988 15989 ** Other Built-in Back-ends 15990 :PROPERTIES: 15991 :DESCRIPTION: Exporting to a man page. 15992 :END: 15993 15994 Other export back-ends included with Org are: 15995 15996 - =ox-man.el=: Export to a man page. 15997 15998 To activate such back-ends, either customize ~org-export-backends~ or 15999 load directly with =(require 'ox-man)=. On successful load, the 16000 back-end adds new keys in the export dispatcher (see [[*The Export 16001 Dispatcher]]). 16002 16003 Follow the comment section of such files, for example, =ox-man.el=, 16004 for usage and configuration details. 16005 16006 ** Advanced Export Configuration 16007 :PROPERTIES: 16008 :DESCRIPTION: Fine-tuning the export output. 16009 :END: 16010 16011 *** Export hooks 16012 :PROPERTIES: 16013 :UNNUMBERED: notoc 16014 :END: 16015 16016 #+vindex: org-export-before-processing-hook 16017 #+vindex: org-export-before-parsing-hook 16018 The export process executes two hooks before the actual exporting 16019 begins. The first hook, ~org-export-before-processing-hook~, runs 16020 before any expansions of macros, Babel code, and include keywords in 16021 the buffer. The second hook, ~org-export-before-parsing-hook~, runs 16022 before the buffer is parsed. 16023 16024 Functions added to these hooks are called with a single argument: the 16025 export back-end actually used, as a symbol. You may use them for 16026 heavy duty structural modifications of the document. For example, you 16027 can remove every headline in the buffer during export like this: 16028 16029 #+begin_src emacs-lisp 16030 (defun my-headline-removal (backend) 16031 "Remove all headlines in the current buffer. 16032 BACKEND is the export back-end being used, as a symbol." 16033 (org-map-entries 16034 (lambda () (delete-region (point) (line-beginning-position 2))))) 16035 16036 (add-hook 'org-export-before-parsing-hook #'my-headline-removal) 16037 #+end_src 16038 16039 *** Filters 16040 :PROPERTIES: 16041 :UNNUMBERED: notoc 16042 :END: 16043 16044 #+cindex: Filters, exporting 16045 Filters are lists of functions to be applied to certain parts for 16046 a given back-end. The output from the first function in the filter is 16047 passed on to the next function in the filter. The final output is the 16048 output from the final function in the filter. 16049 16050 The Org export process has many filter sets applicable to different 16051 types of objects, plain text, parse trees, export options, and final 16052 output formats. The filters are named after the element type or 16053 object type: ~org-export-filter-TYPE-functions~, where {{{var(TYPE)}}} 16054 is the type targeted by the filter. Valid types are: 16055 16056 #+attr_texinfo: :columns 0.33 0.33 0.33 16057 | body | bold | babel-call | 16058 | center-block | clock | code | 16059 | diary-sexp | drawer | dynamic-block | 16060 | entity | example-block | export-block | 16061 | export-snippet | final-output | fixed-width | 16062 | footnote-definition | footnote-reference | headline | 16063 | horizontal-rule | inline-babel-call | inline-src-block | 16064 | inlinetask | italic | item | 16065 | keyword | latex-environment | latex-fragment | 16066 | line-break | link | node-property | 16067 | options | paragraph | parse-tree | 16068 | plain-list | plain-text | planning | 16069 | property-drawer | quote-block | radio-target | 16070 | section | special-block | src-block | 16071 | statistics-cookie | strike-through | subscript | 16072 | superscript | table | table-cell | 16073 | table-row | target | timestamp | 16074 | underline | verbatim | verse-block | 16075 16076 Here is an example filter that replaces non-breaking spaces ~ ~ in the 16077 Org buffer with =~= for the LaTeX back-end. 16078 16079 #+begin_src emacs-lisp 16080 (defun my-latex-filter-nobreaks (text backend info) 16081 "Ensure \" \" are properly handled in LaTeX export." 16082 (when (org-export-derived-backend-p backend 'latex) 16083 (replace-regexp-in-string " " "~" text))) 16084 16085 (add-to-list 'org-export-filter-plain-text-functions 16086 'my-latex-filter-nobreaks) 16087 #+end_src 16088 16089 A filter requires three arguments: the code to be transformed, the 16090 name of the back-end, and some optional information about the export 16091 process. The third argument can be safely ignored. Note the use of 16092 ~org-export-derived-backend-p~ predicate that tests for /latex/ 16093 back-end or any other back-end, such as /beamer/, derived from 16094 /latex/. 16095 16096 *** Defining filters for individual files 16097 :PROPERTIES: 16098 :UNNUMBERED: notoc 16099 :END: 16100 16101 The Org export can filter not just for back-ends, but also for 16102 specific files through the =BIND= keyword. Here is an example with 16103 two filters; one removes brackets from time stamps, and the other 16104 removes strike-through text. The filter functions are defined in 16105 a code block in the same Org file, which is a handy location for 16106 debugging. 16107 16108 #+begin_example 16109 ,#+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp) 16110 ,#+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through) 16111 ,#+BEGIN_SRC emacs-lisp :exports results :results none 16112 (defun tmp-f-timestamp (s backend info) 16113 (replace-regexp-in-string "&[lg]t;\\|[][]" "" s)) 16114 (defun tmp-f-strike-through (s backend info) "") 16115 ,#+END_SRC 16116 #+end_example 16117 16118 *** Extending an existing back-end 16119 :PROPERTIES: 16120 :UNNUMBERED: notoc 16121 :END: 16122 16123 Some parts of the conversion process can be extended for certain 16124 elements so as to introduce a new or revised translation. That is how 16125 the HTML export back-end was extended to handle Markdown format. The 16126 extensions work seamlessly so any aspect of filtering not done by the 16127 extended back-end is handled by the original back-end. Of all the 16128 export customization in Org, extending is very powerful as it operates 16129 at the parser level. 16130 16131 For this example, make the /ascii/ back-end display the language used 16132 in a source code block. Also make it display only when some attribute 16133 is non-~nil~, like the following: 16134 16135 : #+ATTR_ASCII: :language t 16136 16137 Then extend ASCII back-end with a custom "my-ascii" back-end. 16138 16139 #+begin_src emacs-lisp 16140 (defun my-ascii-src-block (src-block contents info) 16141 "Transcode a SRC-BLOCK element from Org to ASCII. 16142 CONTENTS is nil. INFO is a plist used as a communication 16143 channel." 16144 (if (not (org-export-read-attribute :attr_ascii src-block :language)) 16145 (org-export-with-backend 'ascii src-block contents info) 16146 (concat 16147 (format ",--[ %s ]--\n%s`----" 16148 (org-element-property :language src-block) 16149 (replace-regexp-in-string 16150 "^" "| " 16151 (org-element-normalize-string 16152 (org-export-format-code-default src-block info))))))) 16153 16154 (org-export-define-derived-backend 'my-ascii 'ascii 16155 :translate-alist '((src-block . my-ascii-src-block))) 16156 #+end_src 16157 16158 The ~my-ascii-src-block~ function looks at the attribute above the 16159 current element. If not true, hands over to /ascii/ back-end. If 16160 true, which it is in this example, it creates a box around the code 16161 and leaves room for the inserting a string for language. The last 16162 form creates the new back-end that springs to action only when 16163 translating ~src-block~ type elements. 16164 16165 To use the newly defined back-end, evaluate the following from an Org 16166 buffer: 16167 16168 #+begin_src emacs-lisp 16169 (org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*") 16170 #+end_src 16171 16172 Further steps to consider would be an interactive function, 16173 self-installing an item in the export dispatcher menu, and other 16174 user-friendly improvements. 16175 16176 ** Export in Foreign Buffers 16177 :PROPERTIES: 16178 :DESCRIPTION: Author tables and lists in Org syntax. 16179 :END: 16180 16181 The export back-ends in Org often include commands to convert selected 16182 regions. A convenient feature of this in-place conversion is that the 16183 exported output replaces the original source. Here are such 16184 functions: 16185 16186 - ~org-ascii-convert-region-to-ascii~ :: 16187 16188 #+findex: org-ascii-convert-region-to-ascii 16189 Convert the selected region into ASCII. 16190 16191 - ~org-ascii-convert-region-to-utf8~ :: 16192 16193 #+findex: org-ascii-convert-region-to-utf8 16194 Convert the selected region into UTF-8. 16195 16196 - ~org-html-convert-region-to-html~ :: 16197 16198 #+findex: org-html-convert-region-to-html 16199 Convert the selected region into HTML. 16200 16201 - ~org-latex-convert-region-to-latex~ :: 16202 16203 #+findex: org-latex-convert-region-to-latex 16204 Convert the selected region into LaTeX. 16205 16206 - ~org-texinfo-convert-region-to-texinfo~ :: 16207 16208 #+findex: org-texinfo-convert-region-to-texinfo 16209 Convert the selected region into Texinfo. 16210 16211 - ~org-md-convert-region-to-md~ :: 16212 16213 #+findex: org-md-convert-region-to-md 16214 Convert the selected region into Markdown. 16215 16216 In-place conversions are particularly handy for quick conversion of 16217 tables and lists in foreign buffers. For example, in an HTML buffer, 16218 write a list in Org syntax, select it, and convert it to HTML with 16219 {{{kbd(M-x org-html-convert-region-to-html)}}}. 16220 16221 *** Exporting to minimal HTML 16222 :PROPERTIES: 16223 :DESCRIPTION: Exporting HTML without CSS, Javascript, etc. 16224 :ALT_TITLE: Bare HTML 16225 :END: 16226 16227 If you want to output a minimal HTML file, with no CSS, no Javascript, 16228 no preamble or postamble, here are the variable you would need to set: 16229 16230 #+vindex: org-html-head 16231 #+vindex: org-html-head-extra 16232 #+vindex: org-html-head-include-default-style 16233 #+vindex: org-html-head-include-scripts 16234 #+vindex: org-html-preamble 16235 #+vindex: org-html-postamble 16236 #+vindex: org-html-use-infojs 16237 #+begin_src emacs-lisp 16238 (setq org-html-head "" 16239 org-html-head-extra "" 16240 org-html-head-include-default-style nil 16241 org-html-head-include-scripts nil 16242 org-html-preamble nil 16243 org-html-postamble nil 16244 org-html-use-infojs nil) 16245 #+end_src 16246 16247 * Publishing 16248 :PROPERTIES: 16249 :DESCRIPTION: Create a web site of linked Org files. 16250 :END: 16251 #+cindex: publishing 16252 16253 Org includes a publishing management system that allows you to 16254 configure automatic HTML conversion of /projects/ composed of 16255 interlinked Org files. You can also configure Org to automatically 16256 upload your exported HTML pages and related attachments, such as 16257 images and source code files, to a web server. 16258 16259 You can also use Org to convert files into PDF, or even combine HTML 16260 and PDF conversion so that files are available in both formats on the 16261 server. 16262 16263 Publishing has been contributed to Org by David O'Toole. 16264 16265 ** Configuration 16266 :PROPERTIES: 16267 :DESCRIPTION: Defining projects. 16268 :END: 16269 Publishing needs significant configuration to specify files, 16270 destination and many other properties of a project. 16271 16272 *** The variable ~org-publish-project-alist~ 16273 :PROPERTIES: 16274 :DESCRIPTION: The central configuration variable. 16275 :ALT_TITLE: Project alist 16276 :END: 16277 #+cindex: projects, for publishing 16278 16279 #+vindex: org-publish-project-alist 16280 Publishing is configured almost entirely through setting the value of 16281 one variable, called ~org-publish-project-alist~. Each element of the 16282 list configures one project, and may be in one of the two following 16283 forms: 16284 16285 #+begin_src emacs-lisp 16286 ("project-name" :property value :property value ...) 16287 #+end_src 16288 16289 #+texinfo: @noindent 16290 i.e., a well-formed property list with alternating keys and values, 16291 or: 16292 16293 #+begin_src emacs-lisp 16294 ("project-name" :components ("project-name" "project-name" ...)) 16295 #+end_src 16296 16297 In both cases, projects are configured by specifying property values. 16298 A project defines the set of files that are to be published, as well 16299 as the publishing configuration to use when publishing those files. 16300 When a project takes the second form listed above, the individual 16301 members of the ~:components~ property are taken to be sub-projects, 16302 which group together files requiring different publishing options. 16303 When you publish such a "meta-project", all the components are also 16304 published, in the sequence given. 16305 16306 *** Sources and destinations for files 16307 :PROPERTIES: 16308 :DESCRIPTION: From here to there. 16309 :ALT_TITLE: Sources and destinations 16310 :END: 16311 #+cindex: directories, for publishing 16312 16313 Most properties are optional, but some should always be set. In 16314 particular, Org needs to know where to look for source files, and 16315 where to put published files. 16316 16317 - ~:base-directory~ :: 16318 16319 Directory containing publishing source files. 16320 16321 - ~:publishing-directory~ :: 16322 16323 Directory where output files are published. You can directly 16324 publish to a webserver using a file name syntax appropriate for the 16325 Emacs tramp package. Or you can publish to a local directory and 16326 use external tools to upload your website (see [[*Uploading Files]]). 16327 16328 - ~:preparation-function~ :: 16329 16330 Function or list of functions to be called before starting the 16331 publishing process, for example, to run =make= for updating files to 16332 be published. Each preparation function is called with a single 16333 argument, the project property list. 16334 16335 - ~:completion-function~ :: 16336 16337 Function or list of functions called after finishing the publishing 16338 process, for example, to change permissions of the resulting files. 16339 Each completion function is called with a single argument, the 16340 project property list. 16341 16342 *** Selecting files 16343 :PROPERTIES: 16344 :DESCRIPTION: What files are part of the project? 16345 :END: 16346 #+cindex: files, selecting for publishing 16347 16348 By default, all files with extension =.org= in the base directory are 16349 considered part of the project. This can be modified by setting the 16350 following properties 16351 16352 - ~:base-extension~ :: 16353 16354 Extension---without the dot---of source files. This actually is 16355 a regular expression. Set this to the symbol ~any~ if you want to 16356 get all files in ~:base-directory~, even without extension. 16357 16358 - ~:exclude~ :: 16359 16360 Regular expression to match file names that should not be published, 16361 even though they have been selected on the basis of their extension. 16362 16363 - ~:include~ :: 16364 16365 List of files to be included regardless of ~:base-extension~ and 16366 ~:exclude~. 16367 16368 - ~:recursive~ :: 16369 16370 Non-~nil~ means, check base-directory recursively for files to 16371 publish. 16372 16373 *** Publishing action 16374 :PROPERTIES: 16375 :DESCRIPTION: Setting the function doing the publishing. 16376 :END: 16377 #+cindex: action, for publishing 16378 16379 Publishing means that a file is copied to the destination directory 16380 and possibly transformed in the process. The default transformation 16381 is to export Org files as HTML files, and this is done by the function 16382 ~org-html-publish-to-html~ which calls the HTML exporter (see [[*HTML 16383 Export]]). But you can also publish your content as PDF files using 16384 ~org-latex-publish-to-pdf~, or as ASCII, Texinfo, etc., using the 16385 corresponding functions. 16386 16387 If you want to publish the Org file as an =.org= file but with 16388 /archived/, /commented/, and /tag-excluded/ trees removed, use 16389 ~org-org-publish-to-org~. This produces =file.org= and puts it in the 16390 publishing directory. If you want a htmlized version of this file, 16391 set the parameter ~:htmlized-source~ to ~t~. It produces 16392 =file.org.html= in the publishing directory[fn:: If the publishing 16393 directory is the same as the source directory, =file.org= is exported 16394 as =file.org.org=, so you probably do not want to do this.]. 16395 16396 Other files like images only need to be copied to the publishing 16397 destination; for this you can use ~org-publish-attachment~. For 16398 non-Org files, you always need to specify the publishing function: 16399 16400 - ~:publishing-function~ :: 16401 16402 Function executing the publication of a file. This may also be 16403 a list of functions, which are all called in turn. 16404 16405 - ~:htmlized-source~ :: 16406 16407 Non-~nil~ means, publish htmlized source. 16408 16409 The function must accept three arguments: a property list containing 16410 at least a ~:publishing-directory~ property, the name of the file to 16411 be published, and the path to the publishing directory of the output 16412 file. It should take the specified file, make the necessary 16413 transformation, if any, and place the result into the destination 16414 folder. 16415 16416 *** Options for the exporters 16417 :PROPERTIES: 16418 :DESCRIPTION: Tweaking HTML/@LaTeX{} export. 16419 :ALT_TITLE: Publishing options 16420 :END: 16421 #+cindex: options, for publishing 16422 #+cindex: publishing options 16423 16424 The property list can be used to set many export options for the HTML 16425 and LaTeX exporters. In most cases, these properties correspond to 16426 user variables in Org. The table below lists these properties along 16427 with the variable they belong to. See the documentation string for 16428 the respective variable for details. 16429 16430 #+vindex: org-publish-project-alist 16431 When a property is given a value in ~org-publish-project-alist~, its 16432 setting overrides the value of the corresponding user variable, if 16433 any, during publishing. Options set within a file (see [[*Export 16434 Settings]]), however, override everything. 16435 16436 **** Generic properties 16437 :PROPERTIES: 16438 :UNNUMBERED: notoc 16439 :END: 16440 16441 | ~:archived-trees~ | ~org-export-with-archived-trees~ | 16442 | ~:exclude-tags~ | ~org-export-exclude-tags~ | 16443 | ~:headline-levels~ | ~org-export-headline-levels~ | 16444 | ~:language~ | ~org-export-default-language~ | 16445 | ~:preserve-breaks~ | ~org-export-preserve-breaks~ | 16446 | ~:section-numbers~ | ~org-export-with-section-numbers~ | 16447 | ~:select-tags~ | ~org-export-select-tags~ | 16448 | ~:with-author~ | ~org-export-with-author~ | 16449 | ~:with-broken-links~ | ~org-export-with-broken-links~ | 16450 | ~:with-clocks~ | ~org-export-with-clocks~ | 16451 | ~:with-creator~ | ~org-export-with-creator~ | 16452 | ~:with-date~ | ~org-export-with-date~ | 16453 | ~:with-drawers~ | ~org-export-with-drawers~ | 16454 | ~:with-email~ | ~org-export-with-email~ | 16455 | ~:with-emphasize~ | ~org-export-with-emphasize~ | 16456 | ~:with-fixed-width~ | ~org-export-with-fixed-width~ | 16457 | ~:with-footnotes~ | ~org-export-with-footnotes~ | 16458 | ~:with-latex~ | ~org-export-with-latex~ | 16459 | ~:with-planning~ | ~org-export-with-planning~ | 16460 | ~:with-priority~ | ~org-export-with-priority~ | 16461 | ~:with-properties~ | ~org-export-with-properties~ | 16462 | ~:with-special-strings~ | ~org-export-with-special-strings~ | 16463 | ~:with-sub-superscript~ | ~org-export-with-sub-superscripts~ | 16464 | ~:with-tables~ | ~org-export-with-tables~ | 16465 | ~:with-tags~ | ~org-export-with-tags~ | 16466 | ~:with-tasks~ | ~org-export-with-tasks~ | 16467 | ~:with-timestamps~ | ~org-export-with-timestamps~ | 16468 | ~:with-title~ | ~org-export-with-title~ | 16469 | ~:with-toc~ | ~org-export-with-toc~ | 16470 | ~:with-todo-keywords~ | ~org-export-with-todo-keywords~ | 16471 16472 **** ASCII specific properties 16473 :PROPERTIES: 16474 :UNNUMBERED: notoc 16475 :END: 16476 16477 | ~:ascii-bullets~ | ~org-ascii-bullets~ | 16478 | ~:ascii-caption-above~ | ~org-ascii-caption-above~ | 16479 | ~:ascii-charset~ | ~org-ascii-charset~ | 16480 | ~:ascii-global-margin~ | ~org-ascii-global-margin~ | 16481 | ~:ascii-format-drawer-function~ | ~org-ascii-format-drawer-function~ | 16482 | ~:ascii-format-inlinetask-function~ | ~org-ascii-format-inlinetask-function~ | 16483 | ~:ascii-headline-spacing~ | ~org-ascii-headline-spacing~ | 16484 | ~:ascii-indented-line-width~ | ~org-ascii-indented-line-width~ | 16485 | ~:ascii-inlinetask-width~ | ~org-ascii-inlinetask-width~ | 16486 | ~:ascii-inner-margin~ | ~org-ascii-inner-margin~ | 16487 | ~:ascii-links-to-notes~ | ~org-ascii-links-to-notes~ | 16488 | ~:ascii-list-margin~ | ~org-ascii-list-margin~ | 16489 | ~:ascii-paragraph-spacing~ | ~org-ascii-paragraph-spacing~ | 16490 | ~:ascii-quote-margin~ | ~org-ascii-quote-margin~ | 16491 | ~:ascii-table-keep-all-vertical-lines~ | ~org-ascii-table-keep-all-vertical-lines~ | 16492 | ~:ascii-table-use-ascii-art~ | ~org-ascii-table-use-ascii-art~ | 16493 | ~:ascii-table-widen-columns~ | ~org-ascii-table-widen-columns~ | 16494 | ~:ascii-text-width~ | ~org-ascii-text-width~ | 16495 | ~:ascii-underline~ | ~org-ascii-underline~ | 16496 | ~:ascii-verbatim-format~ | ~org-ascii-verbatim-format~ | 16497 16498 **** Beamer specific properties 16499 :PROPERTIES: 16500 :UNNUMBERED: notoc 16501 :END: 16502 16503 | ~:beamer-theme~ | ~org-beamer-theme~ | 16504 | ~:beamer-column-view-format~ | ~org-beamer-column-view-format~ | 16505 | ~:beamer-environments-extra~ | ~org-beamer-environments-extra~ | 16506 | ~:beamer-frame-default-options~ | ~org-beamer-frame-default-options~ | 16507 | ~:beamer-outline-frame-options~ | ~org-beamer-outline-frame-options~ | 16508 | ~:beamer-outline-frame-title~ | ~org-beamer-outline-frame-title~ | 16509 | ~:beamer-subtitle-format~ | ~org-beamer-subtitle-format~ | 16510 16511 **** HTML specific properties 16512 :PROPERTIES: 16513 :UNNUMBERED: notoc 16514 :END: 16515 16516 | ~:html-allow-name-attribute-in-anchors~ | ~org-html-allow-name-attribute-in-anchors~ | 16517 | ~:html-checkbox-type~ | ~org-html-checkbox-type~ | 16518 | ~:html-container~ | ~org-html-container-element~ | 16519 | ~:html-divs~ | ~org-html-divs~ | 16520 | ~:html-doctype~ | ~org-html-doctype~ | 16521 | ~:html-extension~ | ~org-html-extension~ | 16522 | ~:html-footnote-format~ | ~org-html-footnote-format~ | 16523 | ~:html-footnote-separator~ | ~org-html-footnote-separator~ | 16524 | ~:html-footnotes-section~ | ~org-html-footnotes-section~ | 16525 | ~:html-format-drawer-function~ | ~org-html-format-drawer-function~ | 16526 | ~:html-format-headline-function~ | ~org-html-format-headline-function~ | 16527 | ~:html-format-inlinetask-function~ | ~org-html-format-inlinetask-function~ | 16528 | ~:html-head-extra~ | ~org-html-head-extra~ | 16529 | ~:html-head-include-default-style~ | ~org-html-head-include-default-style~ | 16530 | ~:html-head-include-scripts~ | ~org-html-head-include-scripts~ | 16531 | ~:html-head~ | ~org-html-head~ | 16532 | ~:html-home/up-format~ | ~org-html-home/up-format~ | 16533 | ~:html-html5-fancy~ | ~org-html-html5-fancy~ | 16534 | ~:html-indent~ | ~org-html-indent~ | 16535 | ~:html-infojs-options~ | ~org-html-infojs-options~ | 16536 | ~:html-infojs-template~ | ~org-html-infojs-template~ | 16537 | ~:html-inline-image-rules~ | ~org-html-inline-image-rules~ | 16538 | ~:html-inline-images~ | ~org-html-inline-images~ | 16539 | ~:html-link-home~ | ~org-html-link-home~ | 16540 | ~:html-link-org-files-as-html~ | ~org-html-link-org-files-as-html~ | 16541 | ~:html-link-up~ | ~org-html-link-up~ | 16542 | ~:html-link-use-abs-url~ | ~org-html-link-use-abs-url~ | 16543 | ~:html-mathjax-options~ | ~org-html-mathjax-options~ | 16544 | ~:html-mathjax-template~ | ~org-html-mathjax-template~ | 16545 | ~:html-equation-reference-format~ | ~org-html-equation-reference-format~ | 16546 | ~:html-metadata-timestamp-format~ | ~org-html-metadata-timestamp-format~ | 16547 | ~:html-postamble-format~ | ~org-html-postamble-format~ | 16548 | ~:html-postamble~ | ~org-html-postamble~ | 16549 | ~:html-preamble-format~ | ~org-html-preamble-format~ | 16550 | ~:html-preamble~ | ~org-html-preamble~ | 16551 | ~:html-self-link-headlines~ | ~org-html-self-link-headlines~ | 16552 | ~:html-table-align-individual-field~ | ~org-html-table-align-individual-fields~ | 16553 | ~:html-table-attributes~ | ~org-html-table-default-attributes~ | 16554 | ~:html-table-caption-above~ | ~org-html-table-caption-above~ | 16555 | ~:html-table-data-tags~ | ~org-html-table-data-tags~ | 16556 | ~:html-table-header-tags~ | ~org-html-table-header-tags~ | 16557 | ~:html-table-row-tags~ | ~org-html-table-row-tags~ | 16558 | ~:html-table-use-header-tags-for-first-column~ | ~org-html-table-use-header-tags-for-first-column~ | 16559 | ~:html-tag-class-prefix~ | ~org-html-tag-class-prefix~ | 16560 | ~:html-text-markup-alist~ | ~org-html-text-markup-alist~ | 16561 | ~:html-todo-kwd-class-prefix~ | ~org-html-todo-kwd-class-prefix~ | 16562 | ~:html-toplevel-hlevel~ | ~org-html-toplevel-hlevel~ | 16563 | ~:html-use-infojs~ | ~org-html-use-infojs~ | 16564 | ~:html-validation-link~ | ~org-html-validation-link~ | 16565 | ~:html-viewport~ | ~org-html-viewport~ | 16566 | ~:html-wrap-src-lines~ | ~org-html-wrap-src-lines~ | 16567 | ~:html-xml-declaration~ | ~org-html-xml-declaration~ | 16568 16569 **** LaTeX specific properties 16570 :PROPERTIES: 16571 :UNNUMBERED: notoc 16572 :END: 16573 16574 | ~:latex-active-timestamp-format~ | ~org-latex-active-timestamp-format~ | 16575 | ~:latex-caption-above~ | ~org-latex-caption-above~ | 16576 | ~:latex-classes~ | ~org-latex-classes~ | 16577 | ~:latex-class~ | ~org-latex-default-class~ | 16578 | ~:latex-compiler~ | ~org-latex-compiler~ | 16579 | ~:latex-default-figure-position~ | ~org-latex-default-figure-position~ | 16580 | ~:latex-default-table-environment~ | ~org-latex-default-table-environment~ | 16581 | ~:latex-default-table-mode~ | ~org-latex-default-table-mode~ | 16582 | ~:latex-diary-timestamp-format~ | ~org-latex-diary-timestamp-format~ | 16583 | ~:latex-engraved-options~ | ~org-latex-engraved-options~ | 16584 | ~:latex-engraved-preamble~ | ~org-latex-engraved-preamble~ | 16585 | ~:latex-engraved-theme~ | ~org-latex-engraved-theme~ | 16586 | ~:latex-footnote-defined-format~ | ~org-latex-footnote-defined-format~ | 16587 | ~:latex-footnote-separator~ | ~org-latex-footnote-separator~ | 16588 | ~:latex-format-drawer-function~ | ~org-latex-format-drawer-function~ | 16589 | ~:latex-format-headline-function~ | ~org-latex-format-headline-function~ | 16590 | ~:latex-format-inlinetask-function~ | ~org-latex-format-inlinetask-function~ | 16591 | ~:latex-hyperref-template~ | ~org-latex-hyperref-template~ | 16592 | ~:latex-image-default-height~ | ~org-latex-image-default-height~ | 16593 | ~:latex-image-default-option~ | ~org-latex-image-default-option~ | 16594 | ~:latex-image-default-width~ | ~org-latex-image-default-width~ | 16595 | ~:latex-images-centered~ | ~org-latex-images-centered~ | 16596 | ~:latex-inactive-timestamp-format~ | ~org-latex-inactive-timestamp-format~ | 16597 | ~:latex-inline-image-rules~ | ~org-latex-inline-image-rules~ | 16598 | ~:latex-link-with-unknown-path-format~ | ~org-latex-link-with-unknown-path-format~ | 16599 | ~:latex-listings-langs~ | ~org-latex-listings-langs~ | 16600 | ~:latex-listings-options~ | ~org-latex-listings-options~ | 16601 | ~:latex-minted-langs~ | ~org-latex-minted-langs~ | 16602 | ~:latex-minted-options~ | ~org-latex-minted-options~ | 16603 | ~:latex-prefer-user-labels~ | ~org-latex-prefer-user-labels~ | 16604 | ~:latex-subtitle-format~ | ~org-latex-subtitle-format~ | 16605 | ~:latex-subtitle-separate~ | ~org-latex-subtitle-separate~ | 16606 | ~:latex-src-block-backend~ | ~org-latex-src-block-backend~ | 16607 | ~:latex-table-scientific-notation~ | ~org-latex-table-scientific-notation~ | 16608 | ~:latex-tables-booktabs~ | ~org-latex-tables-booktabs~ | 16609 | ~:latex-tables-centered~ | ~org-latex-tables-centered~ | 16610 | ~:latex-text-markup-alist~ | ~org-latex-text-markup-alist~ | 16611 | ~:latex-title-command~ | ~org-latex-title-command~ | 16612 | ~:latex-toc-command~ | ~org-latex-toc-command~ | 16613 16614 **** Markdown specific properties 16615 :PROPERTIES: 16616 :UNNUMBERED: notoc 16617 :END: 16618 16619 | ~:md-footnote-format~ | ~org-md-footnote-format~ | 16620 | ~:md-footnotes-section~ | ~org-md-footnotes-section~ | 16621 | ~:md-headline-style~ | ~org-md-headline-style~ | 16622 | ~:md-toplevel-hlevel~ | ~org-md-toplevel-hlevel~ | 16623 16624 **** ODT specific properties 16625 :PROPERTIES: 16626 :UNNUMBERED: notoc 16627 :END: 16628 16629 | ~:odt-content-template-file~ | ~org-odt-content-template-file~ | 16630 | ~:odt-display-outline-level~ | ~org-odt-display-outline-level~ | 16631 | ~:odt-fontify-srcblocks~ | ~org-odt-fontify-srcblocks~ | 16632 | ~:odt-format-drawer-function~ | ~org-odt-format-drawer-function~ | 16633 | ~:odt-format-headline-function~ | ~org-odt-format-headline-function~ | 16634 | ~:odt-format-inlinetask-function~ | ~org-odt-format-inlinetask-function~ | 16635 | ~:odt-inline-formula-rules~ | ~org-odt-inline-formula-rules~ | 16636 | ~:odt-inline-image-rules~ | ~org-odt-inline-image-rules~ | 16637 | ~:odt-pixels-per-inch~ | ~org-odt-pixels-per-inch~ | 16638 | ~:odt-styles-file~ | ~org-odt-styles-file~ | 16639 | ~:odt-table-styles~ | ~org-odt-table-styles~ | 16640 | ~:odt-use-date-fields~ | ~org-odt-use-date-fields~ | 16641 16642 **** Texinfo specific properties 16643 :PROPERTIES: 16644 :UNNUMBERED: notoc 16645 :END: 16646 16647 | ~:texinfo-active-timestamp-format~ | ~org-texinfo-active-timestamp-format~ | 16648 | ~:texinfo-classes~ | ~org-texinfo-classes~ | 16649 | ~:texinfo-class~ | ~org-texinfo-default-class~ | 16650 | ~:texinfo-compact-itemx | ~org-texinfo-compact-itemx~ | 16651 | ~:texinfo-table-default-markup~ | ~org-texinfo-table-default-markup~ | 16652 | ~:texinfo-diary-timestamp-format~ | ~org-texinfo-diary-timestamp-format~ | 16653 | ~:texinfo-filename~ | ~org-texinfo-filename~ | 16654 | ~:texinfo-format-drawer-function~ | ~org-texinfo-format-drawer-function~ | 16655 | ~:texinfo-format-headline-function~ | ~org-texinfo-format-headline-function~ | 16656 | ~:texinfo-format-inlinetask-function~ | ~org-texinfo-format-inlinetask-function~ | 16657 | ~:texinfo-inactive-timestamp-format~ | ~org-texinfo-inactive-timestamp-format~ | 16658 | ~:texinfo-link-with-unknown-path-format~ | ~org-texinfo-link-with-unknown-path-format~ | 16659 | ~:texinfo-node-description-column~ | ~org-texinfo-node-description-column~ | 16660 | ~:texinfo-table-scientific-notation~ | ~org-texinfo-table-scientific-notation~ | 16661 | ~:texinfo-tables-verbatim~ | ~org-texinfo-tables-verbatim~ | 16662 | ~:texinfo-text-markup-alist~ | ~org-texinfo-text-markup-alist~ | 16663 16664 *** Publishing links 16665 :PROPERTIES: 16666 :DESCRIPTION: Which links keep working after publishing? 16667 :END: 16668 #+cindex: links, publishing 16669 16670 To create a link from one Org file to another, you would use something 16671 like =[[file:foo.org][The foo]]= or simply =[[file:foo.org]]= (see 16672 [[*External Links]]). When published, this link becomes a link to 16673 =foo.html=. You can thus interlink the pages of your "Org web" 16674 project and the links will work as expected when you publish them to 16675 HTML. If you also publish the Org source file and want to link to it, 16676 use an =http= link instead of a =file:= link, because =file= links are 16677 converted to link to the corresponding =.html= file. 16678 16679 Links to encrypted Org files, like =[[file:foo.org.gpg]]= are also 16680 supported. 16681 16682 You may also link to related files, such as images. Provided you are 16683 careful with relative file names, and provided you have also 16684 configured Org to upload the related files, these links will work too. 16685 See [[*Example: complex publishing configuration]], for an example of this 16686 usage. 16687 16688 Links between published documents can contain some search options (see 16689 [[*Search Options in File Links]]), which will be resolved to the 16690 appropriate location in the linked file. For example, once published 16691 to HTML, the following links all point to a dedicated anchor in 16692 =foo.html=. 16693 16694 #+begin_example 16695 [[file:foo.org::*heading]] 16696 [[file:foo.org::#custom-id]] 16697 [[file:foo.org::target]] 16698 #+end_example 16699 16700 *** Generating a sitemap 16701 :PROPERTIES: 16702 :DESCRIPTION: Generating a list of all pages. 16703 :ALT_TITLE: Site map 16704 :END: 16705 #+cindex: sitemap, of published pages 16706 16707 The following properties may be used to control publishing of 16708 a map of files for a given project. 16709 16710 - ~:auto-sitemap~ :: 16711 16712 When non-~nil~, publish a sitemap during 16713 ~org-publish-current-project~ or ~org-publish-all~. 16714 16715 - ~:sitemap-filename~ :: 16716 16717 Filename for output of sitemap. Defaults to =sitemap.org=, which 16718 becomes =sitemap.html=. 16719 16720 - ~:sitemap-title~ :: 16721 16722 Title of sitemap page. Defaults to name of file. 16723 16724 - ~:sitemap-format-entry~ :: 16725 16726 #+findex: org-publish-find-date 16727 #+findex: org-publish-find-property 16728 #+findex: org-publish-find-title 16729 With this option one can tell how a site-map entry is formatted in 16730 the site-map. It is a function called with three arguments: the 16731 file or directory name relative to base directory of the project, 16732 the site-map style and the current project. It is expected to 16733 return a string. Default value turns file names into links and use 16734 document titles as descriptions. For specific formatting needs, one 16735 can use ~org-publish-find-date~, ~org-publish-find-title~ and 16736 ~org-publish-find-property~, to retrieve additional information 16737 about published documents. 16738 16739 - ~:sitemap-function~ :: 16740 16741 Plug-in function to use for generation of the sitemap. It is called 16742 with two arguments: the title of the site-map and a representation 16743 of the files and directories involved in the project as a nested 16744 list, which can further be transformed using ~org-list-to-generic~, 16745 ~org-list-to-subtree~ and alike. Default value generates a plain 16746 list of links to all files in the project. 16747 16748 - ~:sitemap-sort-folders~ :: 16749 16750 Where folders should appear in the sitemap. Set this to ~first~ 16751 (default) or ~last~ to display folders first or last, respectively. 16752 When set to ~ignore~, folders are ignored altogether. Any other 16753 value mixes files and folders. This variable has no effect when 16754 site-map style is ~tree~. 16755 16756 - ~:sitemap-sort-files~ :: 16757 16758 How the files are sorted in the site map. Set this to 16759 ~alphabetically~ (default), ~chronologically~ or 16760 ~anti-chronologically~. ~chronologically~ sorts the files with 16761 older date first while ~anti-chronologically~ sorts the files with 16762 newer date first. ~alphabetically~ sorts the files alphabetically. 16763 The date of a file is retrieved with ~org-publish-find-date~. 16764 16765 - ~:sitemap-ignore-case~ :: 16766 16767 Should sorting be case-sensitive? Default ~nil~. 16768 16769 - ~:sitemap-file-entry-format~ :: 16770 16771 With this option one can tell how a sitemap's entry is formatted in 16772 the sitemap. This is a format string with some escape sequences: 16773 ~%t~ stands for the title of the file, ~%a~ stands for the author of 16774 the file and ~%d~ stands for the date of the file. The date is 16775 retrieved with the ~org-publish-find-date~ function and formatted 16776 with ~org-publish-sitemap-date-format~. Default ~%t~. 16777 16778 - ~:sitemap-date-format~ :: 16779 16780 Format string for the ~format-time-string~ function that tells how 16781 a sitemap entry's date is to be formatted. This property bypasses 16782 ~org-publish-sitemap-date-format~ which defaults to ~%Y-%m-%d~. 16783 16784 *** Generating an index 16785 :PROPERTIES: 16786 :DESCRIPTION: An index that reaches across pages. 16787 :END: 16788 #+cindex: index, in a publishing project 16789 16790 Org mode can generate an index across the files of a publishing project. 16791 16792 - ~:makeindex~ :: 16793 16794 When non-~nil~, generate in index in the file =theindex.org= and 16795 publish it as =theindex.html=. 16796 16797 The file is created when first publishing a project with the 16798 ~:makeindex~ set. The file only contains a statement =#+INCLUDE: 16799 "theindex.inc"=. You can then build around this include statement by 16800 adding a title, style information, etc. 16801 16802 #+cindex: @samp{INDEX}, keyword 16803 Index entries are specified with =INDEX= keyword. An entry that 16804 contains an exclamation mark creates a sub item. 16805 16806 #+begin_example 16807 ,*** Curriculum Vitae 16808 ,#+INDEX: CV 16809 ,#+INDEX: Application!CV 16810 #+end_example 16811 16812 ** Uploading Files 16813 :PROPERTIES: 16814 :DESCRIPTION: How to get files up on the server. 16815 :END: 16816 #+cindex: rsync 16817 #+cindex: unison 16818 16819 For those people already utilizing third party sync tools such as 16820 Rsync or Unison, it might be preferable not to use the built-in remote 16821 publishing facilities of Org mode which rely heavily on Tramp. Tramp, 16822 while very useful and powerful, tends not to be so efficient for 16823 multiple file transfer and has been known to cause problems under 16824 heavy usage. 16825 16826 Specialized synchronization utilities offer several advantages. In 16827 addition to timestamp comparison, they also do content and 16828 permissions/attribute checks. For this reason you might prefer to 16829 publish your web to a local directory---possibly even /in place/ with 16830 your Org files---and then use Unison or Rsync to do the 16831 synchronization with the remote host. 16832 16833 Since Unison, for example, can be configured as to which files to 16834 transfer to a certain remote destination, it can greatly simplify the 16835 project publishing definition. Simply keep all files in the correct 16836 location, process your Org files with ~org-publish~ and let the 16837 synchronization tool do the rest. You do not need, in this scenario, 16838 to include attachments such as JPG, CSS or PNG files in the project 16839 definition since the third-party tool syncs them. 16840 16841 Publishing to a local directory is also much faster than to a remote 16842 one, so that you can afford more easily to republish entire projects. 16843 If you set ~org-publish-use-timestamps-flag~ to ~nil~, you gain the 16844 main benefit of re-including any changed external files such as source 16845 example files you might include with =INCLUDE= keyword. The timestamp 16846 mechanism in Org is not smart enough to detect if included files have 16847 been modified. 16848 16849 ** Sample Configuration 16850 :PROPERTIES: 16851 :DESCRIPTION: Example projects. 16852 :END: 16853 16854 Below we provide two example configurations. The first one is 16855 a simple project publishing only a set of Org files. The second 16856 example is more complex, with a multi-component project. 16857 16858 *** Example: simple publishing configuration 16859 :PROPERTIES: 16860 :DESCRIPTION: One-component publishing. 16861 :ALT_TITLE: Simple example 16862 :END: 16863 16864 This example publishes a set of Org files to the =public_html= 16865 directory on the local machine. 16866 16867 #+begin_src emacs-lisp 16868 (setq org-publish-project-alist 16869 '(("org" 16870 :base-directory "~/org/" 16871 :publishing-function org-html-publish-to-html 16872 :publishing-directory "~/public_html" 16873 :section-numbers nil 16874 :with-toc nil 16875 :html-head "<link rel=\"stylesheet\" 16876 href=\"../other/mystyle.css\" 16877 type=\"text/css\"/>"))) 16878 #+end_src 16879 16880 *** Example: complex publishing configuration 16881 :PROPERTIES: 16882 :DESCRIPTION: A multi-component publishing example. 16883 :ALT_TITLE: Complex example 16884 :END: 16885 16886 This more complicated example publishes an entire website, including 16887 Org files converted to HTML, image files, Emacs Lisp source code, and 16888 style sheets. The publishing directory is remote and private files 16889 are excluded. 16890 16891 To ensure that links are preserved, care should be taken to replicate 16892 your directory structure on the web server, and to use relative file 16893 paths. For example, if your Org files are kept in =~/org/= and your 16894 publishable images in =~/images/=, you would link to an image with 16895 16896 : file:../images/myimage.png 16897 16898 On the web server, the relative path to the image should be the same. 16899 You can accomplish this by setting up an =images/= folder in the right 16900 place on the web server, and publishing images to it. 16901 16902 #+begin_src emacs-lisp 16903 (setq org-publish-project-alist 16904 '(("orgfiles" 16905 :base-directory "~/org/" 16906 :base-extension "org" 16907 :publishing-directory "/ssh:user@host:~/html/notebook/" 16908 :publishing-function org-html-publish-to-html 16909 :exclude "PrivatePage.org" ;; regexp 16910 :headline-levels 3 16911 :section-numbers nil 16912 :with-toc nil 16913 :html-head "<link rel=\"stylesheet\" 16914 href=\"../other/mystyle.css\" type=\"text/css\"/>" 16915 :html-preamble t) 16916 16917 ("images" 16918 :base-directory "~/images/" 16919 :base-extension "jpg\\|gif\\|png" 16920 :publishing-directory "/ssh:user@host:~/html/images/" 16921 :publishing-function org-publish-attachment) 16922 16923 ("other" 16924 :base-directory "~/other/" 16925 :base-extension "css\\|el" 16926 :publishing-directory "/ssh:user@host:~/html/other/" 16927 :publishing-function org-publish-attachment) 16928 ("website" :components ("orgfiles" "images" "other")))) 16929 #+end_src 16930 16931 ** Triggering Publication 16932 :PROPERTIES: 16933 :DESCRIPTION: Publication commands. 16934 :END: 16935 16936 Once properly configured, Org can publish with the following commands: 16937 16938 - {{{kbd(C-c C-e P x)}}} (~org-publish~) :: 16939 16940 #+kindex: C-c C-e P x 16941 #+findex: org-publish 16942 Prompt for a specific project and publish all files that belong to 16943 it. 16944 16945 - {{{kbd(C-c C-e P p)}}} (~org-publish-current-project~) :: 16946 16947 #+kindex: C-c C-e P p 16948 #+findex: org-publish-current-project 16949 Publish the project containing the current file. 16950 16951 - {{{kbd(C-c C-e P f)}}} (~org-publish-current-file~) :: 16952 16953 #+kindex: C-c C-e P f 16954 #+findex: org-publish-current-file 16955 Publish only the current file. 16956 16957 - {{{kbd(C-c C-e P a)}}} (~org-publish-all~) :: 16958 16959 #+kindex: C-c C-e P a 16960 #+findex: org-publish-all 16961 Publish every project. 16962 16963 #+vindex: org-publish-use-timestamps-flag 16964 Org uses timestamps to track when a file has changed. The above 16965 functions normally only publish changed files. You can override this 16966 and force publishing of all files by giving a prefix argument to any 16967 of the commands above, or by customizing the variable 16968 ~org-publish-use-timestamps-flag~. This may be necessary in 16969 particular if files include other files via =SETUPFILE= or =INCLUDE= 16970 keywords. 16971 16972 * Citation handling 16973 :PROPERTIES: 16974 :DESCRIPTION: create, follow and export citations. 16975 :END: 16976 #+cindex: citation 16977 16978 The =oc.el= library provides tooling to handle citations in Org via 16979 "citation processors" that offer some or all of the following 16980 capabilities: 16981 16982 - activate :: Fontification, tooltip preview, etc. 16983 - follow :: At-point actions on citations via ~org-open-at-point~. 16984 - insert :: Add and edit citations via ~org-cite-insert~. 16985 - export :: Via different libraries for different target formats. 16986 16987 To use a "citation processor", the user must load them; for example; 16988 16989 #+begin_src emacs-lisp 16990 (require 'oc-bibtex) 16991 #+end_src 16992 16993 They can then configure them with ~org-cite-activate-processor~, 16994 ~org-cite-follow-processor~, ~org-cite-insert-processor~, and 16995 ~org-cite-export-processors~ respectively. 16996 16997 The included "basic" processor provides all four capabilities. 16998 16999 ** Citations 17000 17001 Before adding citations, first set one-or-more bibliographies, either 17002 globally with ~org-cite-global-bibliography~, or locally using one or 17003 more "bibliography" keywords. 17004 17005 #+begin_example 17006 #+bibliography: SomeFile.bib 17007 #+bibliography: /some/other/file.json 17008 #+bibliography: "/some/file/with spaces/in its name.bib" 17009 #+end_example 17010 17011 #+kindex: C-c C-x @@ 17012 #+findex: org-cite-insert 17013 One can then insert and edit citations using ~org-cite-insert~, called 17014 with {{{kbd(C-c C-x @)}}}. 17015 17016 A /citation/ requires one or more citation /key(s)/, elements 17017 identifying a reference in the bibliography. 17018 17019 - Each citation is surrounded by brackets and uses the =cite= type. 17020 17021 - Each key starts with the character =@=. 17022 17023 - Each key can be qualified by a /prefix/ (e.g.\nbsp{}"see ") and/or 17024 a /suffix/ (e.g.\nbsp{}"p.\nbsp{}123"), giving information useful or necessary 17025 for the comprehension of the citation but not included in the 17026 reference. 17027 17028 - A single citation can cite more than one reference ; the keys are 17029 separated by semicolons ; the formatting of such citation groups is 17030 specified by the style. 17031 17032 - One can also specify a stylistic variation for the citations by 17033 inserting a =/= and a style name between the =cite= keyword and the 17034 colon; this usually makes sense only for the author-year styles. 17035 17036 : [cite/style:common prefix ;prefix @key suffix; ... ; common suffix] 17037 17038 The only mandatory elements are: 17039 17040 - The =cite= keyword and the colon. 17041 - The =@= character immediately preceding each key. 17042 - The brackets surrounding the citation(s) (group). 17043 17044 ** Citation export processors 17045 17046 Org currently includes the following export processors: 17047 17048 - Two processors can export to a variety of formats, including =latex= 17049 (and therefore =pdf=), =html=, =odt= and plain (UTF8) text: 17050 17051 - basic :: a basic export processor, well adapted to situations 17052 where backward compatibility is not a requirement and formatting 17053 needs are minimal; 17054 17055 - csl :: this export processor uses format files written in [[https://en.wikipedia.org/wiki/Citation_Style_Language][Citation 17056 Style Language]] via [[https://github.com/andras-simonyi/citeproc-el][citeproc-el]]; 17057 17058 - In contrast, three other processors target LaTeX and LaTeX-derived 17059 formats exclusively: 17060 17061 - bibtex :: this export processor uses BibTeX, the historical 17062 bibliographic processor used with LaTeX, thus allowing the use of 17063 data and style files compatible with this processor (including a 17064 large number of publishers' styles). It only supports LaTeX's 17065 =\cite= and =\nocite= commands. 17066 17067 - natbib :: as with the bibtex processor, but using the LaTeX 17068 package =natbib=, allowing more stylistic variants that LaTeX's 17069 =\cite= command. 17070 17071 - biblatex :: this backend allows the use of data and formats 17072 prepared for BibLaTeX, an alternate bibliographic processor used 17073 with LaTeX, which overcomes some serious BibTeX limitations, but 17074 has not (yet?)\nbsp{}been widely adopted by publishers. 17075 17076 The =CITE_EXPORT= keyword specifies the export processor and the 17077 citation (and possibly reference) style(s); for example (all arguments 17078 are optional) 17079 17080 : #+cite_export: basic author author-year 17081 17082 #+texinfo: @noindent 17083 specifies the "basic" export processor with citations inserted as 17084 author's name and references indexed by author's names and year; 17085 17086 : #+cite_export: csl /some/path/to/vancouver-brackets.csl 17087 17088 #+texinfo: @noindent 17089 specifies the "csl" processor and CSL style, which in this case 17090 defines numeric citations and numeric references according to the 17091 =Vancouver= specification (as style used in many medical journals), 17092 following a typesetting variation putting citations between brackets; 17093 17094 : #+cite_export: natbib kluwer 17095 17096 #+texinfo: @noindent 17097 specifies the =natbib= export processor with a label citation style 17098 conformant to the Harvard style and the specification of the 17099 Wolkers-Kluwer publisher; since it relies on the ~bibtex~ processor of 17100 your LaTeX installation, it won't export to anything but PDF. 17101 17102 ** Bibliography printing 17103 17104 The =PRINT_BIBLIOGRAPHY= keyword specifies where the bibliography 17105 should be printed (note the colon): 17106 17107 : #+print_bibliography: 17108 17109 The bibliography printed by the LaTeX-based export processors 17110 "bibtex", "natbib" and "biblatex" has a chapter or section heading by 17111 default, while the "basic" and "csl" processors print the list of 17112 bibliography entries without a heading. 17113 17114 A document may contain more than one =PRINT_BIBLIOGRAPHY= keywords. 17115 Each of the keywords will trigger printing the bibliography. 17116 17117 The keywords can be used with or without additional options. Options 17118 can be used, for example, to print only entries that belong to a 17119 certain category or to control formatting. The set of supported 17120 =PRINT_BIBLIOGRAPHY= options and their interpretation varies between 17121 the different citation export processors. Some export processors do 17122 not support passing options. 17123 17124 *** Bibliography options in the "biblatex" and "csl" export processors 17125 17126 The "biblatex" and "csl" export processors support bibliography 17127 options through a property list attached to the =PRINT_BIBLIOGRAPHY= 17128 keyword. For example, 17129 17130 : #print_bibliography: :keyword algebra :type book 17131 17132 Values including spaces must be surrounded with double quotes. If you 17133 need to use a key multiple times, you can separate its values with 17134 commas, but without any space in-between: 17135 17136 : #print_bibliography: :keyword "algebraic logic" :nottype article,book 17137 17138 The "biblatex" export processor accepts all options supported by 17139 BibLaTeX's ~\printbibliography~ command, while the "csl" processor 17140 accepts the following ones: 17141 17142 - =:keyword <keyword(,keyword2...)>= :: Print only entries whose 17143 keyword field contains all given keywords. 17144 17145 - =:notkeyword <keyword(,keyword2...)>= :: Print only entries whose 17146 keyword field does not contain any of the given keywords. 17147 17148 - =:type <entrytype>= :: Print only entries whose type is 17149 =<entrytype>=. Entry type is the BibTeX/BibLaTeX entry type if this 17150 information is available (the entry was read from a BibTeX/BibLaTeX 17151 bibliography) and the CSL entry type otherwise. 17152 17153 - =:nottype <entrytype(,entrytype2...)>= :: Print only entries whose 17154 type is not among the given entry types. Entry type is determined 17155 as in the case of =:type=. 17156 17157 - =:csltype <entrytype>= :: Print only entries whose CSL entry type 17158 (possibly based on a conversion from BibTeX/BibLaTeX to CSL) is 17159 =<entrytype>=. 17160 17161 - =:notcsltype <entrytype(,entrytype2...)>= :: Print only entries whose 17162 CSL entry type (possibly based on a conversion from BibTeX/BibLaTeX 17163 to CSL) is not among the listed entry types. 17164 17165 - =:filter <predicate>= :: Print only entries for which the given 17166 Emacs Lisp predicate returns a non-~nil~ value. 17167 17168 * Working with Source Code 17169 :PROPERTIES: 17170 :DESCRIPTION: Export, evaluate, and tangle code blocks. 17171 :END: 17172 #+cindex: source code, working with 17173 17174 Source code here refers to any plain text collection of computer 17175 instructions, possibly with comments, written using a human-readable 17176 programming language. Org can manage source code in an Org document 17177 when the source code is identified with begin and end markers. 17178 Working with source code begins with identifying source code blocks. 17179 A source code block can be placed almost anywhere in an Org document; 17180 it is not restricted to the preamble or the end of the document. 17181 However, Org cannot manage a source code block if it is placed inside 17182 an Org comment or within a fixed width section. 17183 17184 Here is an example source code block in the Emacs Lisp language: 17185 17186 #+begin_example 17187 ,#+BEGIN_SRC emacs-lisp 17188 (defun org-xor (a b) 17189 "Exclusive or." 17190 (if a (not b) b)) 17191 ,#+END_SRC 17192 #+end_example 17193 17194 Source code blocks are one of many Org block types, which also include 17195 "center", "comment", "dynamic", "example", "export", "quote", 17196 "special", and "verse". This section pertains to blocks between 17197 =#+BEGIN_SRC= and =#+END_SRC=. 17198 17199 Details of Org's facilities for working with source code are described 17200 in the following sections. 17201 17202 ** Features Overview 17203 :PROPERTIES: 17204 :DESCRIPTION: Enjoy the versatility of source blocks. 17205 :END: 17206 17207 Org can manage the source code in the block delimited by =#+BEGIN_SRC= 17208 ... =#+END_SRC= in several ways that can simplify housekeeping tasks 17209 essential to modern source code maintenance. Org can edit, format, 17210 extract, export, and publish source code blocks. Org can also compile 17211 and execute a source code block, then capture the results. The Org 17212 mode literature sometimes refers to source code blocks as /live code/ 17213 blocks because they can alter the content of the Org document or the 17214 material that it exports. Users can control the "liveliness" of each 17215 source code block by tweaking the header arguments (see [[*Using Header 17216 Arguments]]) for compiling, execution, extraction, and exporting. 17217 17218 For editing and formatting a source code block, Org uses an 17219 appropriate Emacs major mode that includes features specifically 17220 designed for source code in that language. 17221 17222 Org can extract one or more source code blocks and write them to one 17223 or more source files---a process known as /tangling/ in literate 17224 programming terminology. 17225 17226 For exporting and publishing, Org's back-ends can format a source code 17227 block appropriately, often with native syntax highlighting. 17228 17229 For executing and compiling a source code block, the user can 17230 configure Org to select the appropriate compiler. Org provides 17231 facilities to collect the result of the execution or compiler output, 17232 insert it into the Org document, and/or export it. In addition to 17233 text results, Org can insert links to other data types, including 17234 audio, video, and graphics. Org can also link a compiler error 17235 message to the appropriate line in the source code block. 17236 17237 An important feature of Org's management of source code blocks is the 17238 ability to pass variables, functions, and results to one another using 17239 a common syntax for source code blocks in any language. Although most 17240 literate programming facilities are restricted to one language or 17241 another, Org's language-agnostic approach lets the literate programmer 17242 match each programming task with the appropriate computer language and 17243 to mix them all together in a single Org document. This 17244 interoperability among languages explains why Org's source code 17245 management facility was named /Org Babel/ by its originators, Eric 17246 Schulte and Dan Davison. 17247 17248 Org mode fulfills the promise of easy verification and maintenance of 17249 publishing reproducible research by keeping text, data, code, 17250 configuration settings of the execution environment, the results of 17251 the execution, and associated narratives, claims, references, and 17252 internal and external links in a single Org document. 17253 17254 ** Structure of Code Blocks 17255 :PROPERTIES: 17256 :DESCRIPTION: Code block syntax described. 17257 :END: 17258 #+cindex: code block, structure 17259 #+cindex: source code, block structure 17260 #+cindex: @samp{NAME} keyword, in source blocks 17261 #+cindex: @samp{BEGIN_SRC} 17262 17263 Org offers two ways to structure source code in Org documents: in 17264 a source code block, and directly inline. Both specifications are 17265 shown below. 17266 17267 A source code block conforms to this structure: 17268 17269 #+begin_example 17270 ,#+NAME: <name> 17271 ,#+BEGIN_SRC <language> <switches> <header arguments> 17272 <body> 17273 ,#+END_SRC 17274 #+end_example 17275 17276 Do not be put-off by having to remember the source block syntax. Org 17277 mode offers a command for wrapping existing text in a block (see 17278 [[*Structure Templates]]). Org also works with other completion systems 17279 in Emacs, some of which predate Org and have custom domain-specific 17280 languages for defining templates. Regular use of templates reduces 17281 errors, increases accuracy, and maintains consistency. 17282 17283 #+cindex: source code, inline 17284 An inline code block conforms to this structure: 17285 17286 : src_<language>{<body>} 17287 17288 #+texinfo: @noindent 17289 or 17290 17291 : src_<language>[<header arguments>]{<body>} 17292 17293 - =#+NAME: <name>= :: 17294 17295 Optional. Names the source block so it can be called, like 17296 a function, from other source blocks or inline code to evaluate or 17297 to capture the results. Code from other blocks, other files, and 17298 from table formulas (see [[*The Spreadsheet]]) can use the name to 17299 reference a source block. This naming serves the same purpose as 17300 naming Org tables. Org mode requires unique names. For duplicate 17301 names, Org mode's behavior is undefined. 17302 17303 - =#+BEGIN_SRC= ... =#+END_SRC= :: 17304 17305 Mandatory. They mark the start and end of a block that Org 17306 requires. The =#+BEGIN_SRC= line takes additional arguments, as 17307 described next. 17308 17309 - =<language>= :: 17310 17311 #+cindex: language, in code blocks 17312 Mandatory. It is the identifier of the source code language in the 17313 block. See [[*Languages]], for identifiers of supported languages. 17314 17315 - =<switches>= :: 17316 17317 #+cindex: switches, in code blocks 17318 Optional. Switches provide finer control of the code execution, 17319 export, and format (see the discussion of switches in [[*Literal 17320 Examples]]). 17321 17322 - =<header arguments>= :: 17323 17324 #+cindex: header arguments, in code blocks 17325 Optional. Heading arguments control many aspects of evaluation, 17326 export and tangling of code blocks (see [[*Using Header Arguments]]). 17327 Using Org's properties feature, header arguments can be selectively 17328 applied to the entire buffer or specific subtrees of the Org 17329 document. 17330 17331 - =<body>= :: 17332 17333 Source code in the dialect of the specified language identifier. 17334 17335 ** Using Header Arguments 17336 :PROPERTIES: 17337 :DESCRIPTION: Different ways to set header arguments. 17338 :END: 17339 17340 Org comes with many header arguments common to all languages. New 17341 header arguments are added for specific languages as they become 17342 available for use in source code blocks. A header argument is 17343 specified with an initial colon followed by the argument's name in 17344 lowercase. 17345 17346 Since header arguments can be set in several ways, Org prioritizes 17347 them in case of overlaps or conflicts by giving local settings 17348 a higher priority. Header values in function calls, for example, 17349 override header values from global defaults. 17350 17351 *** System-wide header arguments 17352 :PROPERTIES: 17353 :UNNUMBERED: notoc 17354 :END: 17355 #+vindex: org-babel-default-header-args 17356 17357 #+vindex: org-babel-default-header-args 17358 System-wide values of header arguments can be specified by customizing 17359 the ~org-babel-default-header-args~ variable, which defaults to the 17360 following values: 17361 17362 #+begin_example 17363 :session => "none" 17364 :results => "replace" 17365 :exports => "code" 17366 :cache => "no" 17367 :noweb => "no" 17368 :hlines => "no" 17369 :tangle => "no" 17370 #+end_example 17371 17372 #+vindex: org-babel-default-inline-header-args 17373 Inline source blocks (see [[*Structure of Code Blocks]]) use slightly 17374 different default header arguments defined in 17375 ~org-babel-default-inline-header-args~: 17376 17377 #+begin_example 17378 :session => "none" 17379 :results => "replace" 17380 :exports => "results" 17381 :hlines => "yes" 17382 #+end_example 17383 17384 The most notable difference between default header arguments for 17385 inline and normal source blocks is =:exports= argument. For inline 17386 source blocks, results of evaluation are exported by default; not the 17387 code. 17388 17389 Unlike the default values, header arguments set using Org mode 17390 properties (see [[*Header arguments in Org mode properties]]) do apply to 17391 both the normal source blocks and inline source blocks. 17392 17393 The example below sets =:noweb= header arguments to =yes=, which makes 17394 Org expand =:noweb= references by default. 17395 17396 #+begin_src emacs-lisp 17397 (setq org-babel-default-header-args 17398 (cons '(:noweb . "yes") 17399 (assq-delete-all :noweb org-babel-default-header-args))) 17400 #+end_src 17401 17402 #+cindex: language specific default header arguments 17403 #+cindex: default header arguments per language 17404 Each language can have separate default header arguments by 17405 customizing the variable ~org-babel-default-header-args:<LANG>~, where 17406 {{{var(<LANG>)}}} is the name of the language. For details, see the 17407 language-specific online documentation at 17408 https://orgmode.org/worg/org-contrib/babel/. 17409 17410 *** Header arguments in Org mode properties 17411 :PROPERTIES: 17412 :UNNUMBERED: notoc 17413 :END: 17414 17415 For header arguments applicable to the buffer, use =PROPERTY= keyword 17416 anywhere in the Org file (see [[*Property Syntax]]). 17417 17418 The following example makes all the R code blocks execute in the same 17419 session. Setting =:results= to =silent= ignores the results of 17420 executions for all blocks, not just R code blocks; no results inserted 17421 for any block. 17422 17423 #+begin_example 17424 ,#+PROPERTY: header-args:R :session *R* 17425 ,#+PROPERTY: header-args :results silent 17426 #+end_example 17427 17428 #+vindex: org-use-property-inheritance 17429 Header arguments set through Org's property drawers (see [[*Property 17430 Syntax]]) apply at the subtree level on down. Since these property 17431 drawers can appear anywhere in the file hierarchy, Org uses outermost 17432 call or source block to resolve the values. Org ignores 17433 ~org-use-property-inheritance~ setting. 17434 17435 In this example, =:cache= defaults to =yes= for all code blocks in the 17436 subtree. 17437 17438 #+begin_example 17439 ,* sample header 17440 :PROPERTIES: 17441 :header-args: :cache yes 17442 :END: 17443 #+end_example 17444 17445 #+kindex: C-c C-x p 17446 #+findex: org-set-property 17447 Properties defined through ~org-set-property~ function, bound to 17448 {{{kbd(C-c C-x p)}}}, apply to all active languages. They override 17449 properties set in ~org-babel-default-header-args~. 17450 17451 #+cindex: language specific header arguments properties 17452 #+cindex: header arguments per language 17453 Language-specific header arguments are also read from properties 17454 =header-args:<LANG>= where {{{var(<LANG>)}}} is the language 17455 identifier. For example, 17456 17457 #+begin_example 17458 ,* Heading 17459 :PROPERTIES: 17460 :header-args:clojure: :session *clojure-1* 17461 :header-args:R: :session *R* 17462 :END: 17463 ,** Subheading 17464 :PROPERTIES: 17465 :header-args:clojure: :session *clojure-2* 17466 :END: 17467 #+end_example 17468 17469 #+texinfo: @noindent 17470 would force separate sessions for Clojure blocks in =Heading= and 17471 =Subheading=, but use the same session for all R blocks. Blocks in 17472 =Subheading= inherit settings from =Heading=. 17473 17474 *** Code block specific header arguments 17475 :PROPERTIES: 17476 :UNNUMBERED: notoc 17477 :END: 17478 17479 Header arguments are most commonly set at the source code block level, 17480 on the =#+BEGIN_SRC= line. Arguments set at this level take 17481 precedence over those set in the ~org-babel-default-header-args~ 17482 variable, and also those set as header properties. 17483 17484 In the following example, setting =:results= to =silent= makes it 17485 ignore results of the code execution. Setting =:exports= to =code= 17486 exports only the body of the code block to HTML or LaTeX. 17487 17488 #+begin_example 17489 ,#+NAME: factorial 17490 ,#+BEGIN_SRC haskell :results silent :exports code :var n=0 17491 fac 0 = 1 17492 fac n = n * fac (n-1) 17493 ,#+END_SRC 17494 #+end_example 17495 17496 The same header arguments in an inline code block: 17497 17498 : src_haskell[:exports both]{fac 5} 17499 17500 #+cindex: @samp{HEADER}, keyword 17501 Code block header arguments can span multiple lines using =#+HEADER:= 17502 on each line. Note that Org currently accepts the plural spelling of 17503 =#+HEADER:= only as a convenience for backward-compatibility. It may 17504 be removed at some point. 17505 17506 Multi-line header arguments on an unnamed code block: 17507 17508 #+begin_example 17509 ,#+HEADER: :var data1=1 17510 ,#+BEGIN_SRC emacs-lisp :var data2=2 17511 (message "data1:%S, data2:%S" data1 data2) 17512 ,#+END_SRC 17513 17514 ,#+RESULTS: 17515 : data1:1, data2:2 17516 #+end_example 17517 17518 Multi-line header arguments on a named code block: 17519 17520 #+begin_example 17521 ,#+NAME: named-block 17522 ,#+HEADER: :var data=2 17523 ,#+BEGIN_SRC emacs-lisp 17524 (message "data:%S" data) 17525 ,#+END_SRC 17526 17527 ,#+RESULTS: named-block 17528 : data:2 17529 #+end_example 17530 17531 *** Header arguments in function calls 17532 :PROPERTIES: 17533 :UNNUMBERED: notoc 17534 :END: 17535 17536 Header arguments in function calls are the most specific and override 17537 all other settings in case of an overlap. They get the highest 17538 priority. Two =#+CALL:= examples are shown below. For the complete 17539 syntax of =CALL= keyword, see [[*Evaluating Code Blocks]]. 17540 17541 In this example, =:exports results= header argument is applied to the 17542 evaluation of the =#+CALL:= line. 17543 17544 : #+CALL: factorial(n=5) :exports results 17545 17546 In this example, =:session special= header argument is applied to the 17547 evaluation of =factorial= code block. 17548 17549 : #+CALL: factorial[:session special](n=5) 17550 17551 ** Environment of a Code Block 17552 :PROPERTIES: 17553 :DESCRIPTION: Arguments, sessions, working directory... 17554 :END: 17555 17556 *** Passing arguments 17557 :PROPERTIES: 17558 :UNNUMBERED: notoc 17559 :END: 17560 17561 #+cindex: passing arguments to code blocks 17562 #+cindex: arguments, in code blocks 17563 #+cindex: @samp{var}, header argument 17564 Use =var= for passing arguments to source code blocks. The specifics 17565 of variables in code blocks vary by the source language and are 17566 covered in the language-specific documentation. The syntax for =var=, 17567 however, is the same for all languages. This includes declaring 17568 a variable, and assigning a default value. 17569 17570 The following syntax is used to pass arguments to code blocks using 17571 the =var= header argument. 17572 17573 : :var NAME=ASSIGN 17574 17575 #+texinfo: @noindent 17576 {{{var(NAME)}}} is the name of the variable bound in the code block 17577 body. {{{var(ASSIGN)}}} is a literal value, such as a string, 17578 a number, a reference to a table, a list, a literal example, another 17579 code block---with or without arguments---or the results of evaluating 17580 a code block. {{{var(ASSIGN)}}} may specify a filename for references 17581 to elements in a different file, using a =:= to separate the filename 17582 from the reference. 17583 17584 : :var NAME=FILE:REFERENCE 17585 17586 Here are examples of passing values by reference: 17587 17588 - table :: 17589 17590 A table named with a =NAME= keyword. 17591 17592 #+begin_example 17593 ,#+NAME: example-table 17594 | 1 | 17595 | 2 | 17596 | 3 | 17597 | 4 | 17598 17599 ,#+NAME: table-length 17600 ,#+BEGIN_SRC emacs-lisp :var table=example-table 17601 (length table) 17602 ,#+END_SRC 17603 17604 ,#+RESULTS: table-length 17605 : 4 17606 #+end_example 17607 17608 When passing a table, you can treat specially the row, or the 17609 column, containing labels for the columns, or the rows, in the 17610 table. 17611 17612 #+cindex: @samp{colnames}, header argument 17613 The =colnames= header argument accepts =yes=, =no=, or =nil= values. 17614 The default value is =nil=: if an input table has column 17615 names---because the second row is a horizontal rule---then Org 17616 removes the column names, processes the table, puts back the column 17617 names, and then writes the table to the results block. Using =yes=, 17618 Org does the same to the first row, even if the initial table does 17619 not contain any horizontal rule. When set to =no=, Org does not 17620 pre-process column names at all. 17621 17622 #+begin_example 17623 ,#+NAME: less-cols 17624 | a | 17625 |---| 17626 | b | 17627 | c | 17628 17629 ,#+BEGIN_SRC python :var tab=less-cols :colnames nil 17630 return [[val + '*' for val in row] for row in tab] 17631 ,#+END_SRC 17632 17633 ,#+RESULTS: 17634 | a | 17635 |----| 17636 | b* | 17637 | c* | 17638 #+end_example 17639 17640 #+cindex: @samp{rownames}, header argument 17641 Similarly, the =rownames= header argument can take two values: =yes= 17642 or =no=. When set to =yes=, Org removes the first column, processes 17643 the table, puts back the first column, and then writes the table to 17644 the results block. The default is =no=, which means Org does not 17645 pre-process the first column. Note that Emacs Lisp code blocks 17646 ignore =rownames= header argument because of the ease of 17647 table-handling in Emacs. 17648 17649 #+begin_example 17650 ,#+NAME: with-rownames 17651 | one | 1 | 2 | 3 | 4 | 5 | 17652 | two | 6 | 7 | 8 | 9 | 10 | 17653 17654 ,#+BEGIN_SRC python :var tab=with-rownames :rownames yes 17655 return [[val + 10 for val in row] for row in tab] 17656 ,#+END_SRC 17657 17658 ,#+RESULTS: 17659 | one | 11 | 12 | 13 | 14 | 15 | 17660 | two | 16 | 17 | 18 | 19 | 20 | 17661 #+end_example 17662 17663 To refer to a table in another file, join the filename and table name with 17664 a colon, for example: =:var table=other-file.org:example-table=. 17665 17666 - list :: 17667 17668 A simple named list. 17669 17670 #+begin_example 17671 ,#+NAME: example-list 17672 - simple 17673 - not 17674 - nested 17675 - list 17676 17677 ,#+BEGIN_SRC emacs-lisp :var x=example-list 17678 (print x) 17679 ,#+END_SRC 17680 17681 ,#+RESULTS: 17682 | simple | list | 17683 #+end_example 17684 17685 Note that only the top level list items are passed along. Nested 17686 list items are ignored. 17687 17688 - code block without arguments :: 17689 17690 A code block name, as assigned by =NAME= keyword from the example 17691 above, optionally followed by parentheses. 17692 17693 #+begin_example 17694 ,#+BEGIN_SRC emacs-lisp :var length=table-length() 17695 (* 2 length) 17696 ,#+END_SRC 17697 17698 ,#+RESULTS: 17699 : 8 17700 #+end_example 17701 17702 - code block with arguments :: 17703 17704 A code block name, as assigned by =NAME= keyword, followed by 17705 parentheses and optional arguments passed within the parentheses. 17706 17707 #+begin_example 17708 ,#+NAME: double 17709 ,#+BEGIN_SRC emacs-lisp :var input=8 17710 (* 2 input) 17711 ,#+END_SRC 17712 17713 ,#+RESULTS: double 17714 : 16 17715 17716 ,#+NAME: squared 17717 ,#+BEGIN_SRC emacs-lisp :var input=double(input=1) 17718 (* input input) 17719 ,#+END_SRC 17720 17721 ,#+RESULTS: squared 17722 : 4 17723 #+end_example 17724 17725 - literal example, or code block contents :: 17726 17727 A code block or literal example block named with a =NAME= keyword, 17728 followed by brackets (optional for example blocks). 17729 17730 #+begin_example 17731 ,#+NAME: literal-example 17732 ,#+BEGIN_EXAMPLE 17733 A literal example 17734 on two lines 17735 ,#+END_EXAMPLE 17736 17737 ,#+NAME: read-literal-example 17738 ,#+BEGIN_SRC emacs-lisp :var x=literal-example[] 17739 (concatenate #'string x " for you.") 17740 ,#+END_SRC 17741 17742 ,#+RESULTS: read-literal-example 17743 : A literal example 17744 : on two lines for you. 17745 #+end_example 17746 17747 Indexing variable values enables referencing portions of a variable. 17748 Indexes are 0 based with negative values counting backwards from the 17749 end. If an index is separated by commas then each subsequent section 17750 indexes as the next dimension. Note that this indexing occurs 17751 /before/ other table-related header arguments are applied, such as 17752 =hlines=, =colnames= and =rownames=. The following example assigns 17753 the last cell of the first row the table =example-table= to the 17754 variable =data=: 17755 17756 #+begin_example 17757 ,#+NAME: example-table 17758 | 1 | a | 17759 | 2 | b | 17760 | 3 | c | 17761 | 4 | d | 17762 17763 ,#+BEGIN_SRC emacs-lisp :var data=example-table[0,-1] 17764 data 17765 ,#+END_SRC 17766 17767 ,#+RESULTS: 17768 : a 17769 #+end_example 17770 17771 Two integers separated by a colon reference a range of variable 17772 values. In that case the entire inclusive range is referenced. For 17773 example the following assigns the middle three rows of =example-table= 17774 to =data=. 17775 17776 #+begin_example 17777 ,#+NAME: example-table 17778 | 1 | a | 17779 | 2 | b | 17780 | 3 | c | 17781 | 4 | d | 17782 | 5 | 3 | 17783 17784 ,#+BEGIN_SRC emacs-lisp :var data=example-table[1:3] 17785 data 17786 ,#+END_SRC 17787 17788 ,#+RESULTS: 17789 | 2 | b | 17790 | 3 | c | 17791 | 4 | d | 17792 #+end_example 17793 17794 To pick the entire range, use an empty index, or the single character 17795 =*=. =0:-1= does the same thing. Example below shows how to 17796 reference the first column only. 17797 17798 #+begin_example 17799 ,#+NAME: example-table 17800 | 1 | a | 17801 | 2 | b | 17802 | 3 | c | 17803 | 4 | d | 17804 17805 ,#+BEGIN_SRC emacs-lisp :var data=example-table[,0] 17806 data 17807 ,#+END_SRC 17808 17809 ,#+RESULTS: 17810 | 1 | 2 | 3 | 4 | 17811 #+end_example 17812 17813 Index referencing can be used for tables and code blocks. Index 17814 referencing can handle any number of dimensions. Commas delimit 17815 multiple dimensions, as shown below. 17816 17817 #+begin_example 17818 ,#+NAME: 3D 17819 ,#+BEGIN_SRC emacs-lisp 17820 '(((1 2 3) (4 5 6) (7 8 9)) 17821 ((10 11 12) (13 14 15) (16 17 18)) 17822 ((19 20 21) (22 23 24) (25 26 27))) 17823 ,#+END_SRC 17824 17825 ,#+BEGIN_SRC emacs-lisp :var data=3D[1,,1] 17826 data 17827 ,#+END_SRC 17828 17829 ,#+RESULTS: 17830 | 11 | 14 | 17 | 17831 #+end_example 17832 17833 Note that row names and column names are not removed prior to variable 17834 indexing. You need to take them into account, even when =colnames= or 17835 =rownames= header arguments remove them. 17836 17837 Emacs lisp code can also set the values for variables. To 17838 differentiate a value from Lisp code, Org interprets any value 17839 starting with =(=, =[=, ='= or =`= as Emacs Lisp code. The result of 17840 evaluating that code is then assigned to the value of that variable. 17841 The following example shows how to reliably query and pass the file 17842 name of the Org mode buffer to a code block using headers. We need 17843 reliability here because the file's name could change once the code in 17844 the block starts executing. 17845 17846 #+begin_example 17847 ,#+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both 17848 wc -w $filename 17849 ,#+END_SRC 17850 #+end_example 17851 17852 Note that values read from tables and lists are not mistakenly 17853 evaluated as Emacs Lisp code, as illustrated in the following example. 17854 17855 #+begin_example 17856 ,#+NAME: table 17857 | (a b c) | 17858 17859 ,#+HEADER: :var data=table[0,0] 17860 ,#+BEGIN_SRC perl 17861 $data 17862 ,#+END_SRC 17863 17864 ,#+RESULTS: 17865 : (a b c) 17866 #+end_example 17867 17868 *** Using sessions 17869 :PROPERTIES: 17870 :UNNUMBERED: notoc 17871 :END: 17872 17873 #+cindex: using sessions in code blocks 17874 #+cindex: @samp{session}, header argument 17875 Two code blocks can share the same environment. The =session= header 17876 argument is for running multiple source code blocks under one session. 17877 Org runs code blocks with the same session name in the same 17878 interpreter process. 17879 17880 - =none= :: 17881 17882 Default. Each code block gets a new interpreter process to execute. 17883 The process terminates once the block is evaluated. 17884 17885 - {{{var(STRING)}}} :: 17886 17887 Any string besides =none= turns that string into the name of that 17888 session. For example, =:session STRING= names it =STRING=. If 17889 =session= has no value, then the session name is derived from the 17890 source language identifier. Subsequent blocks with the same source 17891 code language use the same session. Depending on the language, 17892 state variables, code from other blocks, and the overall interpreted 17893 environment may be shared. Some interpreted languages support 17894 concurrent sessions when subsequent source code language blocks 17895 change session names. 17896 17897 Only languages that provide interactive evaluation can have session 17898 support. Not all languages provide this support, such as C and ditaa. 17899 Even languages, such as Python and Haskell, that do support 17900 interactive evaluation impose limitations on allowable language 17901 constructs that can run interactively. Org inherits those limitations 17902 for those code blocks running in a session. 17903 17904 *** Choosing a working directory 17905 :PROPERTIES: 17906 :UNNUMBERED: notoc 17907 :END: 17908 17909 #+cindex: working directory, in a code block 17910 #+cindex: @samp{dir}, header argument 17911 #+cindex: @samp{mkdirp}, header argument 17912 The =dir= header argument specifies the default directory during code 17913 block execution. If it is absent, then the directory associated with 17914 the current buffer is used. In other words, supplying =:dir 17915 DIRECTORY= temporarily has the same effect as changing the current 17916 directory with {{{kbd(M-x cd RET DIRECTORY)}}}, and then not setting 17917 =dir=. Under the surface, =dir= simply sets the value of the Emacs 17918 variable ~default-directory~. Setting =mkdirp= header argument to 17919 a non-~nil~ value creates the directory, if necessary. 17920 17921 Setting =dir= to the symbol ~attach~ or the string ~"'attach"~ will 17922 set =dir= to the directory returned by ~(org-attach-dir)~, set =:mkdir 17923 yes=, and insert any file paths, as when using =:results file=, which 17924 are under the node's attachment directory using =attachment:= links 17925 instead of the usual =file:= links. Any returned path outside of the 17926 attachment directory will use =file:= links as per usual. 17927 17928 For example, to save the plot file in the =Work/= folder of the home 17929 directory---notice tilde is expanded: 17930 17931 #+begin_example 17932 ,#+BEGIN_SRC R :file myplot.png :dir ~/Work 17933 matplot(matrix(rnorm(100), 10), type="l") 17934 ,#+END_SRC 17935 #+end_example 17936 17937 To evaluate the code block on a remote machine, supply a remote 17938 directory name using Tramp syntax. For example: 17939 17940 #+begin_example 17941 ,#+BEGIN_SRC R :file plot.png :dir /scp:dand@yakuba.princeton.edu: 17942 plot(1:10, main=system("hostname", intern=TRUE)) 17943 ,#+END_SRC 17944 #+end_example 17945 17946 Org first captures the text results as usual for insertion in the Org 17947 file. Then Org also inserts a link to the remote file, thanks to 17948 Emacs Tramp. Org constructs the remote path to the file name from 17949 =dir= and ~default-directory~, as illustrated here: 17950 17951 : [[file:/scp:dand@yakuba.princeton.edu:/home/dand/plot.png][plot.png]] 17952 17953 When =dir= is used with =session=, Org sets the starting directory for 17954 a new session. But Org does not alter the directory of an already 17955 existing session. 17956 17957 Do not use =dir= with =:exports results= or with =:exports both= to 17958 avoid Org inserting incorrect links to remote files. That is because 17959 Org does not expand ~default directory~ to avoid some underlying 17960 portability issues. 17961 17962 *** Inserting headers and footers 17963 :PROPERTIES: 17964 :UNNUMBERED: notoc 17965 :END: 17966 17967 #+cindex: headers, in code blocks 17968 #+cindex: footers, in code blocks 17969 #+cindex: @samp{prologue}, header argument 17970 The =prologue= header argument is for appending to the top of the code 17971 block for execution, like a reset instruction. For example, you may 17972 use =:prologue "reset"= in a Gnuplot code block or, for every such 17973 block: 17974 17975 #+begin_src emacs-lisp 17976 (add-to-list 'org-babel-default-header-args:gnuplot 17977 '((:prologue . "reset"))) 17978 17979 #+end_src 17980 17981 #+cindex: @samp{epilogue}, header argument 17982 Likewise, the value of the =epilogue= header argument is for appending 17983 to the end of the code block for execution. 17984 17985 ** Evaluating Code Blocks 17986 :PROPERTIES: 17987 :DESCRIPTION: Place results of evaluation in the Org buffer. 17988 :END: 17989 #+cindex: code block, evaluating 17990 #+cindex: source code, evaluating 17991 #+cindex: @samp{RESULTS}, keyword 17992 17993 A note about security: With code evaluation comes the risk of harm. 17994 Org safeguards by prompting for user's permission before executing any 17995 code in the source block. To customize this safeguard, or disable it, 17996 see [[*Code Evaluation and Security Issues]]. 17997 17998 *** How to evaluate source code 17999 :PROPERTIES: 18000 :UNNUMBERED: notoc 18001 :END: 18002 18003 Org captures the results of the code block evaluation and inserts them 18004 in the Org file, right after the code block. The insertion point is 18005 after a newline and the =RESULTS= keyword. Org creates the =RESULTS= 18006 keyword if one is not already there. More details in [[*Results of 18007 Evaluation]]. 18008 18009 By default, Org enables only Emacs Lisp code blocks for execution. 18010 See [[*Languages]] to enable other languages. 18011 18012 #+kindex: C-c C-c 18013 #+kindex: C-c C-v e 18014 #+findex: org-babel-execute-src-block 18015 Org provides many ways to execute code blocks. {{{kbd(C-c C-c)}}} or 18016 {{{kbd(C-c C-v e)}}} with the point on a code block[fn:: The option 18017 ~org-babel-no-eval-on-ctrl-c-ctrl-c~ can be used to remove code 18018 evaluation from the {{{kbd(C-c C-c)}}} key binding.] calls the 18019 ~org-babel-execute-src-block~ function, which executes the code in the 18020 block, collects the results, and inserts them in the buffer. 18021 18022 #+cindex: @samp{CALL}, keyword 18023 #+vindex: org-babel-inline-result-wrap 18024 By calling a named code block[fn:48] from an Org mode buffer or 18025 a table. Org can call the named code blocks from the current Org mode 18026 buffer or from the "Library of Babel" (see [[*Library of Babel]]). 18027 18028 The syntax for =CALL= keyword is: 18029 18030 #+begin_example 18031 ,#+CALL: <name>(<arguments>) 18032 ,#+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments> 18033 #+end_example 18034 18035 The syntax for inline named code blocks is: 18036 18037 #+begin_example 18038 ... call_<name>(<arguments>) ... 18039 ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ... 18040 #+end_example 18041 18042 When inline syntax is used, the result is wrapped based on the 18043 variable ~org-babel-inline-result-wrap~, which by default is set to 18044 ~"=%s="~ to produce verbatim text suitable for markup. 18045 18046 - =<name>= :: 18047 18048 This is the name of the code block (see [[*Structure of Code Blocks]]) 18049 to be evaluated in the current document. If the block is located in 18050 another file, start =<name>= with the file name followed by 18051 a colon. For example, in order to execute a block named =clear-data= 18052 in =file.org=, you can write the following: 18053 18054 : #+CALL: file.org:clear-data() 18055 18056 - =<arguments>= :: 18057 18058 Org passes arguments to the code block using standard function call 18059 syntax. For example, a =#+CALL:= line that passes =4= to a code 18060 block named =double=, which declares the header argument =:var n=2=, 18061 would be written as: 18062 18063 : #+CALL: double(n=4) 18064 18065 #+texinfo: @noindent 18066 Note how this function call syntax is different from the header 18067 argument syntax. 18068 18069 - =<inside header arguments>= :: 18070 18071 Org passes inside header arguments to the named code block using the 18072 header argument syntax. Inside header arguments apply to code block 18073 evaluation. For example, =[:results output]= collects results 18074 printed to stdout during code execution of that block. Note how 18075 this header argument syntax is different from the function call 18076 syntax. 18077 18078 - =<end header arguments>= :: 18079 18080 End header arguments affect the results returned by the code block. 18081 For example, =:results html= wraps the results in a =#+BEGIN_EXPORT 18082 html= block before inserting the results in the Org buffer. 18083 18084 *** Limit code block evaluation 18085 :PROPERTIES: 18086 :UNNUMBERED: notoc 18087 :END: 18088 18089 #+cindex: @samp{eval}, header argument 18090 #+cindex: control code block evaluation 18091 The =eval= header argument can limit evaluation of specific code 18092 blocks and =CALL= keyword. It is useful for protection against 18093 evaluating untrusted code blocks by prompting for a confirmation. 18094 18095 - =yes= :: 18096 18097 Org always evaluates the source code without asking permission. 18098 18099 - =never= or =no= :: 18100 18101 Org never evaluates the source code. 18102 18103 - =query= :: 18104 18105 Org prompts the user for permission to evaluate the source code. 18106 18107 - =never-export= or =no-export= :: 18108 18109 Org does not evaluate the source code when exporting, yet the user 18110 can evaluate it interactively. 18111 18112 - =query-export= :: 18113 18114 Org prompts the user for permission to evaluate the source code 18115 during export. 18116 18117 If =eval= header argument is not set, then Org determines whether to 18118 evaluate the source code from the ~org-confirm-babel-evaluate~ 18119 variable (see [[*Code Evaluation and Security Issues]]). 18120 18121 *** Cache results of evaluation 18122 :PROPERTIES: 18123 :UNNUMBERED: notoc 18124 :END: 18125 18126 #+cindex: @samp{cache}, header argument 18127 #+cindex: cache results of code evaluation 18128 The =cache= header argument is for caching results of evaluating code 18129 blocks. Caching results can avoid re-evaluating a code block that 18130 have not changed since the previous run. To benefit from the cache 18131 and avoid redundant evaluations, the source block must have a result 18132 already present in the buffer, and neither the header 18133 arguments---including the value of =var= references---nor the text of 18134 the block itself has changed since the result was last computed. This 18135 feature greatly helps avoid long-running calculations. For some edge 18136 cases, however, the cached results may not be reliable. 18137 18138 The caching feature is best for when code blocks are pure functions, 18139 that is functions that return the same value for the same input 18140 arguments (see [[*Environment of a Code Block]]), and that do not have 18141 side effects, and do not rely on external variables other than the 18142 input arguments. Functions that depend on a timer, file system 18143 objects, and random number generators are clearly unsuitable for 18144 caching. 18145 18146 A note of warning: when =cache= is used in a session, caching may 18147 cause unexpected results. 18148 18149 When the caching mechanism tests for any source code changes, it does 18150 not expand noweb style references (see [[*Noweb Reference Syntax]]). 18151 18152 The =cache= header argument can have one of two values: =yes= or =no=. 18153 18154 - =no= :: 18155 18156 Default. No caching of results; code block evaluated every time. 18157 18158 - =yes= :: 18159 18160 Whether to run the code or return the cached results is determined 18161 by comparing the SHA1 hash value of the combined code block and 18162 arguments passed to it. This hash value is packed on the 18163 =#+RESULTS:= line from previous evaluation. When hash values match, 18164 Org does not evaluate the code block. When hash values mismatch, 18165 Org evaluates the code block, inserts the results, recalculates the 18166 hash value, and updates =#+RESULTS:= line. 18167 18168 In this example, both functions are cached. But =caller= runs only if 18169 the result from =random= has changed since the last run. 18170 18171 # +1 here is to work around Emacs bug#59293. 18172 # Otherwise, (1) is recognized as footnote reference by info.el. 18173 #+begin_example 18174 ,#+NAME: random 18175 ,#+BEGIN_SRC R :cache yes 18176 runif(+1) 18177 ,#+END_SRC 18178 18179 ,#+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random 18180 0.4659510825295 18181 18182 ,#+NAME: caller 18183 ,#+BEGIN_SRC emacs-lisp :var x=random :cache yes 18184 x 18185 ,#+END_SRC 18186 18187 ,#+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller 18188 0.254227238707244 18189 #+end_example 18190 18191 ** Results of Evaluation 18192 :PROPERTIES: 18193 :DESCRIPTION: Choosing a results type, post-processing... 18194 :END: 18195 #+cindex: code block, results of evaluation 18196 #+cindex: source code, results of evaluation 18197 18198 #+cindex: @samp{results}, header argument 18199 How Org handles results of a code block execution depends on many 18200 header arguments working together. The primary determinant, however, 18201 is the =results= header argument. It accepts four classes of options. 18202 Each code block can take only one option per class: 18203 18204 - Collection :: 18205 18206 For how the results should be collected from the code block; 18207 18208 - Type :: 18209 18210 For which type of result the code block will return; affects how Org 18211 processes and inserts results in the Org buffer; 18212 18213 - Format :: 18214 18215 For the result; affects how Org processes results; 18216 18217 - Handling :: 18218 18219 For inserting results once they are properly formatted. 18220 18221 *** Collection 18222 :PROPERTIES: 18223 :UNNUMBERED: notoc 18224 :END: 18225 18226 Collection options specify the results. Choose one of the options; 18227 they are mutually exclusive. 18228 18229 - =value= :: 18230 18231 Default for most Babel libraries[fn:48]. Functional mode. Org 18232 gets the value by wrapping the code in a function definition in the 18233 language of the source block. That is why when using =:results 18234 value=, code should execute like a function and return a value. For 18235 languages like Python, an explicit ~return~ statement is mandatory 18236 when using =:results value=. Result is the value returned by the 18237 last statement in the code block. 18238 18239 When evaluating the code block in a session (see [[*Environment of 18240 a Code Block]]), Org passes the code to an interpreter running as an 18241 interactive Emacs inferior process. Org gets the value from the 18242 source code interpreter's last statement output. Org has to use 18243 language-specific methods to obtain the value. For example, from 18244 the variable ~_~ in Ruby, and the value of ~.Last.value~ in R. 18245 18246 - =output= :: 18247 18248 Scripting mode. Org passes the code to an external process running 18249 the interpreter. Org returns the contents of the standard output 18250 stream as text results. 18251 18252 When using a session, Org passes the code to the interpreter running 18253 as an interactive Emacs inferior process. Org concatenates any text 18254 output from the interpreter and returns the collection as a result. 18255 18256 *** Type 18257 :PROPERTIES: 18258 :UNNUMBERED: notoc 18259 :END: 18260 18261 Type tells what result types to expect from the execution of the code 18262 block. Choose one of the options; they are mutually exclusive. 18263 18264 The default behavior is to automatically determine the result type. 18265 The result type detection depends on the code block language, as 18266 described in the documentation for individual languages. See 18267 [[*Languages]]. 18268 18269 #+attr_texinfo: :sep , 18270 - =table=, =vector= :: 18271 18272 Interpret the results as an Org table. If the result is a single 18273 value, create a table with one row and one column. Usage example: 18274 =:results value table=. 18275 18276 #+cindex: @samp{hlines}, header argument 18277 In-between each table row or below the table headings, sometimes 18278 results have horizontal lines, which are also known as "hlines". 18279 The =hlines= argument with the default =no= value strips such lines 18280 from the input table. For most code, this is desirable, or else 18281 those =hline= symbols raise unbound variable errors. A =yes= 18282 accepts such lines, as demonstrated in the following example. 18283 18284 #+begin_example 18285 ,#+NAME: many-cols 18286 | a | b | c | 18287 |---+---+---| 18288 | d | e | f | 18289 |---+---+---| 18290 | g | h | i | 18291 18292 ,#+NAME: no-hline 18293 ,#+BEGIN_SRC python :var tab=many-cols :hlines no 18294 return tab 18295 ,#+END_SRC 18296 18297 ,#+RESULTS: no-hline 18298 | a | b | c | 18299 | d | e | f | 18300 | g | h | i | 18301 18302 ,#+NAME: hlines 18303 ,#+BEGIN_SRC python :var tab=many-cols :hlines yes 18304 return tab 18305 ,#+END_SRC 18306 18307 ,#+RESULTS: hlines 18308 | a | b | c | 18309 |---+---+---| 18310 | d | e | f | 18311 |---+---+---| 18312 | g | h | i | 18313 #+end_example 18314 18315 - =list= :: 18316 18317 Interpret the results as an Org list. If the result is a single 18318 value, create a list of one element. 18319 18320 - =scalar=, =verbatim= :: 18321 18322 Interpret literally and insert as quoted text. Do not create 18323 a table. Usage example: =:results value verbatim=. 18324 18325 - =file= :: 18326 18327 Interpret as a filename. Save the results of execution of the code 18328 block to that file, then insert a link to it. You can control both 18329 the filename and the description associated to the link. 18330 18331 #+cindex: @samp{file}, header argument 18332 #+cindex: @samp{output-dir}, header argument 18333 Org first tries to generate the filename from the value of the 18334 =file= header argument and the directory specified using the 18335 =output-dir= header arguments. If =output-dir= is not specified, 18336 Org assumes it is the current directory. 18337 18338 #+begin_example 18339 ,#+BEGIN_SRC asymptote :results value file :file circle.pdf :output-dir img/ 18340 size(2cm); 18341 draw(unitcircle); 18342 ,#+END_SRC 18343 #+end_example 18344 18345 #+cindex: @samp{file-ext}, header argument 18346 If =file= header argument is missing, Org generates the base name of 18347 the output file from the name of the code block, and its extension 18348 from the =file-ext= header argument. In that case, both the name 18349 and the extension are mandatory. 18350 18351 #+begin_example 18352 ,#+name: circle 18353 ,#+BEGIN_SRC asymptote :results value file :file-ext pdf 18354 size(2cm); 18355 draw(unitcircle); 18356 ,#+END_SRC 18357 #+end_example 18358 18359 #+cindex: @samp{file-desc}, header argument 18360 The =file-desc= header argument defines the description (see [[*Link 18361 Format]]) for the link. If =file-desc= is present but has no value, 18362 the =file= value is used as the link description. When this 18363 argument is not present, the description is omitted. If you want to 18364 provide the =file-desc= argument but omit the description, you can 18365 provide it with an empty vector (i.e., :file-desc []). 18366 18367 #+cindex: @samp{sep}, header argument 18368 By default, Org assumes that a table written to a file has 18369 TAB-delimited output. You can choose a different separator with 18370 the =sep= header argument. 18371 18372 #+cindex: @samp{file-mode}, header argument 18373 The =file-mode= header argument defines the file permissions. To 18374 make it executable, use =:file-mode (identity #o755)=. 18375 18376 #+begin_example 18377 ,#+BEGIN_SRC shell :results file :file script.sh :file-mode (identity #o755) 18378 echo "#!/bin/bash" 18379 echo "echo Hello World" 18380 ,#+END_SRC 18381 #+end_example 18382 18383 *** Format 18384 :PROPERTIES: 18385 :UNNUMBERED: notoc 18386 :END: 18387 18388 Format pertains to the type of the result returned by the code block. 18389 Choose one of the options; they are mutually exclusive. The default 18390 follows from the type specified above. 18391 18392 #+attr_texinfo: :sep , 18393 - =code= :: 18394 18395 Result enclosed in a code block. Useful for parsing. Usage 18396 example: =:results value code=. 18397 18398 - =drawer= :: 18399 18400 Result wrapped in a =RESULTS= drawer. Useful for containing =raw= 18401 or =org= results for later scripting and automated processing. 18402 Usage example: =:results value drawer=. 18403 18404 - =html= :: 18405 18406 Results enclosed in a =BEGIN_EXPORT html= block. Usage example: 18407 =:results value html=. 18408 18409 - =latex= :: 18410 18411 Results enclosed in a =BEGIN_EXPORT latex= block. Usage example: 18412 =:results value latex=. 18413 18414 - =link=, =graphics= :: 18415 18416 When used along with =file= type, the result is a link to the file 18417 specified in =:file= header argument. However, unlike plain =file= 18418 type, code block output is not written to the disk. The block is 18419 expected to generate the file by its side-effects only, as in the 18420 following example: 18421 18422 #+begin_example 18423 ,#+begin_src shell :results file link :file "org-mode-unicorn.svg" 18424 wget -c "https://orgmode.org/resources/img/org-mode-unicorn.svg" 18425 ,#+end_src 18426 18427 ,#+RESULTS: 18428 [[file:org-mode-unicorn.svg]] 18429 #+end_example 18430 18431 - =org= :: 18432 18433 Results enclosed in a =BEGIN_SRC org= block. For comma-escape, 18434 either {{{kbd(TAB)}}} in the block, or export the file. Usage 18435 example: =:results value org=. 18436 18437 - =pp= :: 18438 18439 Result converted to pretty-print source code. Enclosed in a code 18440 block. Languages supported: Emacs Lisp, Python, and Ruby. Usage 18441 example: =:results value pp=. 18442 18443 - =raw= :: 18444 18445 Interpreted as raw Org mode. Inserted directly into the buffer. 18446 Aligned if it is a table. Usage example: =:results value raw=. 18447 18448 #+cindex: @samp{wrap}, header argument 18449 The =wrap= header argument unconditionally marks the results block by 18450 appending strings to =#+BEGIN_= and =#+END_=. If no string is 18451 specified, Org wraps the results in a =#+BEGIN_results= 18452 ... =#+END_results= block. It takes precedent over the =results= 18453 value listed above. E.g., 18454 18455 #+begin_example 18456 ,#+BEGIN_SRC emacs-lisp :results html :wrap EXPORT markdown 18457 "<blink>Welcome back to the 90's</blink>" 18458 ,#+END_SRC 18459 18460 ,#+RESULTS: 18461 ,#+BEGIN_EXPORT markdown 18462 <blink>Welcome back to the 90's</blink> 18463 ,#+END_EXPORT 18464 #+end_example 18465 18466 *** Handling 18467 :PROPERTIES: 18468 :UNNUMBERED: notoc 18469 :END: 18470 18471 Handling options after collecting the results. Choose one of the 18472 options; they are mutually exclusive. 18473 18474 - =replace= :: 18475 18476 Default. Insert results in the Org buffer. Remove previous 18477 results. Usage example: =:results output replace=. 18478 18479 - =silent= :: 18480 18481 Do not insert results in the Org mode buffer, but echo them in the 18482 minibuffer. Usage example: =:results output silent=. 18483 18484 - =none= :: 18485 18486 Compute results, but do not do anything with them. No inserting in 18487 the Org mode buffer nor echo them in the minibuffer. The results 18488 can still be used when referenced from another code block. 18489 Usage example: =:results none=. 18490 18491 - =discard= :: 18492 18493 Ignore the results completely. This option is similar to =none=, 18494 but no processing is performed on the return value. Calling the 18495 code block programmatically (see [[*How to evaluate source code]]) or by 18496 reference (see [[*Passing arguments]] and [[*Noweb Reference Syntax]]) will 18497 always yield nil. 18498 18499 - =append= :: 18500 18501 Append results to the Org buffer. Latest results are at the bottom. 18502 Does not remove previous results. Usage example: =:results output 18503 append=. 18504 18505 - =prepend= :: 18506 18507 Prepend results to the Org buffer. Latest results are at the top. 18508 Does not remove previous results. Usage example: =:results output 18509 prepend=. 18510 18511 *** Post-processing 18512 :PROPERTIES: 18513 :UNNUMBERED: notoc 18514 :END: 18515 18516 #+cindex: @samp{post}, header argument 18517 #+cindex: @samp{*this*}, in @samp{post} header argument 18518 The =post= header argument is for post-processing results from block 18519 evaluation. When =post= has any value, Org binds the results to 18520 ~*this*~ variable for easy passing to =var= header argument 18521 specifications (see [[*Environment of a Code Block]]). That makes results 18522 available to other code blocks, or even for direct Emacs Lisp code 18523 execution. 18524 18525 The following two examples illustrate =post= header argument in 18526 action. The first one shows how to attach an =ATTR_LATEX= keyword 18527 using =post=. 18528 18529 #+begin_example 18530 ,#+NAME: attr_wrap 18531 ,#+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output 18532 echo "#+ATTR_LATEX: :width $width" 18533 echo "$data" 18534 ,#+END_SRC 18535 18536 ,#+HEADER: :file /tmp/it.png 18537 ,#+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer 18538 digraph{ 18539 a -> b; 18540 b -> c; 18541 c -> a; 18542 } 18543 ,#+end_src 18544 18545 ,#+RESULTS: 18546 :RESULTS: 18547 ,#+ATTR_LATEX :width 5cm 18548 [[file:/tmp/it.png]] 18549 :END: 18550 #+end_example 18551 18552 The second example shows use of =colnames= header argument in =post= 18553 to pass data between code blocks. 18554 18555 #+begin_example 18556 ,#+NAME: round-tbl 18557 ,#+BEGIN_SRC emacs-lisp :var tbl="" fmt="%.3f" 18558 (mapcar (lambda (row) 18559 (mapcar (lambda (cell) 18560 (if (numberp cell) 18561 (format fmt cell) 18562 cell)) 18563 row)) 18564 tbl) 18565 ,#+end_src 18566 18567 ,#+BEGIN_SRC R :colnames yes :post round-tbl[:colnames yes](*this*) 18568 set.seed(42) 18569 data.frame(foo=rnorm(1)) 18570 ,#+END_SRC 18571 18572 ,#+RESULTS: 18573 | foo | 18574 |-------| 18575 | 1.371 | 18576 #+end_example 18577 18578 ** Exporting Code Blocks 18579 :PROPERTIES: 18580 :DESCRIPTION: Export contents and/or results. 18581 :END: 18582 #+cindex: code block, exporting 18583 #+cindex: source code, exporting 18584 18585 It is possible to export the /code/ of code blocks, the /results/ of 18586 code block evaluation, /both/ the code and the results of code block 18587 evaluation, or /none/. Org defaults to exporting /code/ for most 18588 languages and /results/ for inline code blocks. For some languages, 18589 such as ditaa, Org defaults to /results/ both in ordinary source 18590 blocks and in inline source blocks. To export just the body of code 18591 blocks, see [[*Literal Examples]]. To selectively export subtrees of an 18592 Org document, see [[*Exporting]]. 18593 18594 #+cindex: @samp{exports}, header argument 18595 The =exports= header argument is to specify if that part of the Org 18596 file is exported to, say, HTML or LaTeX formats. 18597 18598 - =code= :: 18599 18600 The default. The body of code is included into the exported file. 18601 Example: =:exports code=. 18602 18603 - =results= :: 18604 18605 The results of evaluation of the code is included in the exported 18606 file. Example: =:exports results=. 18607 18608 - =both= :: 18609 18610 Both the code and results of evaluation are included in the exported 18611 file. Example: =:exports both=. 18612 18613 - =none= :: 18614 18615 Neither the code nor the results of evaluation is included in the 18616 exported file. Whether the code is evaluated at all depends on 18617 other options. Example: =:exports none=. 18618 18619 If a source block is named using =NAME= keyword, the same name will be 18620 assigned to the results of evaluation. This way, fuzzy links pointing 18621 to the named source blocks exported using =:exports results= will 18622 remain valid and point to the results of evaluation. 18623 18624 Results of evaluation of a named block can also be explicitly named 18625 using a separate =NAME= keyword. The name value set via =NAME= 18626 keyword will be preferred over the parent source block. 18627 18628 : #+NAME: code name 18629 : #+BEGIN_SRC emacs-lisp :exports both value 18630 : (+ 1 2) 18631 : #+END_SRC 18632 : 18633 : #+NAME: results name 18634 : #+RESULTS: code name 18635 : 3 18636 : 18637 : This [[code name][link]] will point to the code block. 18638 : Another [[results name][link]] will point to the results. 18639 18640 Explicit setting of the result name may be necessary when a named code 18641 block is exported using =:exports both=. Links to such block may 18642 arbitrarily point either to the code block or to its results when 18643 results do not have a distinct name. 18644 18645 Note that all the links pointing to a source block exported using 18646 =:exports none= will be broken. This will make export process fail, 18647 unless broken links are allowed during export (see [[*Export Settings]]). 18648 18649 #+vindex: org-export-use-babel 18650 To stop Org from evaluating code blocks to speed exports, use the 18651 header argument =:eval never-export= (see [[*Evaluating Code Blocks]]). 18652 To stop Org from evaluating code blocks for greater security, set the 18653 ~org-export-use-babel~ variable to ~nil~, but understand that header 18654 arguments will have no effect. 18655 18656 Turning off evaluation comes in handy when batch processing. For 18657 example, markup languages for wikis, which have a high risk of 18658 untrusted code. Stopping code block evaluation also stops evaluation 18659 of all header arguments of the code block. This may not be desirable 18660 in some circumstances. So during export, to allow evaluation of just 18661 the header arguments but not any code evaluation in the source block, 18662 set =:eval never-export= (see [[*Evaluating Code Blocks]]). 18663 18664 Org never evaluates code blocks in commented subtrees when exporting 18665 (see [[*Comment Lines]]). On the other hand, Org does evaluate code 18666 blocks in subtrees excluded from export (see [[*Export Settings]]). 18667 18668 ** Extracting Source Code 18669 :PROPERTIES: 18670 :DESCRIPTION: Create pure source code files. 18671 :END: 18672 #+cindex: tangling 18673 #+cindex: source code, extracting 18674 #+cindex: code block, extracting source code 18675 18676 Extracting source code from code blocks is a basic task in literate 18677 programming. Org has features to make this easy. In literate 18678 programming parlance, documents on creation are /woven/ with code and 18679 documentation, and on export, the code is tangled for execution by 18680 a computer. Org facilitates weaving and tangling for producing, 18681 maintaining, sharing, and exporting literate programming documents. 18682 Org provides extensive customization options for extracting source 18683 code. 18684 18685 When Org tangles code blocks, it expands, merges, and transforms them. 18686 Then Org recomposes them into one or more separate files, as 18687 configured through the options. During this tangling process, Org 18688 expands variables in the source code, and resolves any noweb style 18689 references (see [[*Noweb Reference Syntax]]). 18690 18691 *** Header arguments 18692 :PROPERTIES: 18693 :UNNUMBERED: notoc 18694 :END: 18695 18696 #+cindex: @samp{tangle}, header argument 18697 The =tangle= header argument specifies if the code block is exported 18698 to source file(s). 18699 18700 - =yes= :: 18701 18702 Export the code block to source file. The file name for the source 18703 file is derived from the name of the Org file, and the file 18704 extension is derived from the source code language identifier. 18705 Example: =:tangle yes=. 18706 18707 - =no= :: 18708 18709 The default. Do not extract the code in a source code file. 18710 Example: =:tangle no=. 18711 18712 - {{{var(FILENAME)}}} :: 18713 18714 Export the code block to source file whose file name is derived from 18715 any string passed to the =tangle= header argument. Org derives the 18716 file name as being relative to the directory of the Org file's 18717 location. Example: =:tangle FILENAME=. 18718 18719 #+cindex: @samp{mkdirp}, header argument 18720 The =mkdirp= header argument creates parent directories for tangled 18721 files if the directory does not exist. A =yes= value enables 18722 directory creation whereas =no= inhibits it. 18723 18724 #+cindex: @samp{comments}, header argument 18725 The =comments= header argument controls inserting comments into 18726 tangled files. These are above and beyond whatever comments may 18727 already exist in the code block. 18728 18729 - =no= :: 18730 18731 The default. Do not insert any extra comments during tangling. 18732 18733 - =link= :: 18734 18735 Wrap the code block in comments. Include links pointing back to the 18736 place in the Org file from where the code was tangled. 18737 18738 - =yes= :: 18739 18740 Kept for backward compatibility; same as =link=. 18741 18742 - =org= :: 18743 18744 Nearest headline text from Org file is inserted as comment. The 18745 exact text that is inserted is picked from the leading context of 18746 the source block. 18747 18748 - =both= :: 18749 18750 Includes both =link= and =org= options. 18751 18752 - =noweb= :: 18753 18754 Includes =link= option, expands noweb references (see [[*Noweb 18755 Reference Syntax]]), and wraps them in link comments inside the body 18756 of the code block. 18757 18758 #+cindex: @samp{padline}, header argument 18759 The =padline= header argument controls insertion of newlines to pad 18760 source code in the tangled file. 18761 18762 - =yes= :: 18763 18764 Default. Insert a newline before and after each code block in the 18765 tangled file. 18766 18767 - =no= :: 18768 18769 Do not insert newlines to pad the tangled code blocks. 18770 18771 #+cindex: @samp{shebang}, header argument 18772 The =shebang= header argument can turn results into executable script 18773 files. By setting it to a string value---for example, =:shebang 18774 "#!/bin/bash"=---Org inserts that string as the first line of the 18775 tangled file that the code block is extracted to. Org then turns on 18776 the tangled file's executable permission. 18777 18778 #+cindex: @samp{tangle-mode}, header argument 18779 The =tangle-mode= header argument specifies what permissions to set 18780 for tangled files by ~set-file-modes~. Permissions are given by an 18781 octal value, which can be provided calling the ~identity~ function on 18782 an elisp octal value. For instance, to create a read-only file one may 18783 use =:tangle-mode (identity #o444)=. To reduce the verbosity required, 18784 a octal shorthand is defined, =oXXX= (=o= for octal). Using this, our 18785 read-only example is =:tangle-mode o444=. Omitting the =o= prefix will 18786 cause the argument to be interpreted as an integer, which can lead to 18787 unexpected results (=444= is the same as =o674=). 18788 Two other shorthands are recognized, ls-style strings like 18789 =rw-r--r--=, and chmod-style permissions like =g+w=. 18790 Note that chmod-style permissions are based on 18791 ~org-babel-tangle-default-file-mode~, which is =#o544= by default. 18792 18793 When =:tangle-mode= and =:shebang= are both specified, the give 18794 =:tangle-mode= will override the permissions from =:shebang=. When 18795 multiple source code blocks tangle to a single file with conflicting 18796 =:tangle-mode= header arguments, Org's behavior is undefined. 18797 18798 #+cindex: @samp{no-expand}, header argument 18799 By default Org expands code blocks during tangling. The =no-expand= 18800 header argument turns off such expansions. Note that one side-effect 18801 of expansion by ~org-babel-expand-src-block~ also assigns values (see 18802 [[*Environment of a Code Block]]) to variables. Expansions also replace 18803 noweb references with their targets (see [[*Noweb Reference Syntax]]). 18804 Some of these expansions may cause premature assignment, hence this 18805 option. This option makes a difference only for tangling. It has no 18806 effect when exporting since code blocks for execution have to be 18807 expanded anyway. 18808 18809 *** Functions 18810 :PROPERTIES: 18811 :UNNUMBERED: notoc 18812 :END: 18813 18814 - ~org-babel-tangle~ :: 18815 18816 #+findex: org-babel-tangle 18817 #+kindex: C-c C-v t 18818 Tangle the current file. Bound to {{{kbd(C-c C-v t)}}}. 18819 18820 With prefix argument only tangle the current code block. 18821 18822 - ~org-babel-tangle-file~ :: 18823 18824 #+findex: org-babel-tangle-file 18825 #+kindex: C-c C-v f 18826 Choose a file to tangle. Bound to {{{kbd(C-c C-v f)}}}. 18827 18828 *** Tangle hooks 18829 :PROPERTIES: 18830 :UNNUMBERED: notoc 18831 :END: 18832 18833 - ~org-babel-pre-tangle-hook~ :: 18834 18835 #+vindex: org-babel-pre-tangle-hook 18836 This hook is run before the tangle process begins. The active 18837 buffer is buffer to be tangled. 18838 18839 - ~org-babel-tangle-body-hook~ :: 18840 18841 #+vindex: org-babel-tangle-body-hook 18842 This hook is run from a temporary buffer containing expanded code of 18843 every tangled code block. The hook can modify the expanded code as 18844 needed. The contents of the current buffer will be used as actual 18845 code block expansion. 18846 18847 - ~org-babel-post-tangle-hook~ :: 18848 18849 #+vindex: org-babel-post-tangle-hook 18850 This hook is run from within code files tangled by 18851 ~org-babel-tangle~, making it suitable for post-processing, 18852 compilation, and evaluation of code in the tangled files. 18853 18854 - ~org-babel-tangle-finished-hook~ :: 18855 #+vindex: org-babel-tangle-finished-hook 18856 This hook is run after post-tangle hooks, in the original buffer. 18857 18858 *** Jumping between code and Org 18859 :PROPERTIES: 18860 :UNNUMBERED: notoc 18861 :END: 18862 18863 #+findex: org-babel-tangle-jump-to-org 18864 Debuggers normally link errors and messages back to the source code. 18865 But for tangled files, we want to link back to the Org file, not to 18866 the tangled source file. To make this extra jump, Org uses 18867 ~org-babel-tangle-jump-to-org~ function with two additional source 18868 code block header arguments: 18869 18870 1. Set =padline= to true---this is the default setting. 18871 2. Set =comments= to =link=, which makes Org insert links to the Org 18872 file. 18873 18874 ** Languages 18875 :PROPERTIES: 18876 :DESCRIPTION: List of supported code block languages. 18877 :END: 18878 #+cindex: babel, languages 18879 #+cindex: source code, languages 18880 #+cindex: code block, languages 18881 18882 Code blocks in dozens of languages are supported. See Worg website 18883 for [[https://orgmode.org/worg/org-contrib/babel/languages/index.html][language specific documentation]]. 18884 18885 #+vindex: org-babel-load-languages 18886 By default, only Emacs Lisp is enabled for evaluation. To enable or 18887 disable other languages, customize the ~org-babel-load-languages~ 18888 variable either through the Emacs customization interface, or by 18889 adding code to the init file as shown next. 18890 18891 In this example, evaluation is disabled for Emacs Lisp, and enabled 18892 for R. 18893 18894 #+begin_src emacs-lisp 18895 (org-babel-do-load-languages 18896 'org-babel-load-languages 18897 '((emacs-lisp . nil) 18898 (R . t))) 18899 #+end_src 18900 18901 Note that this is not the only way to enable a language. Org also 18902 enables languages when loaded with ~require~ statement. For example, 18903 the following enables execution of Clojure code blocks: 18904 18905 #+begin_src emacs-lisp 18906 (require 'ob-clojure) 18907 #+end_src 18908 18909 ** Editing Source Code 18910 :PROPERTIES: 18911 :DESCRIPTION: Language major-mode editing. 18912 :END: 18913 #+cindex: code block, editing 18914 #+cindex: source code, editing 18915 18916 #+kindex: C-c ' 18917 Use {{{kbd(C-c ')}}} to edit the current code block. It opens a new 18918 major mode edit buffer containing the body of the source code block, 18919 ready for any edits. Use {{{kbd(C-c ')}}} again to close the buffer 18920 and return to the Org buffer. 18921 18922 #+kindex: C-x C-s 18923 #+vindex: org-edit-src-auto-save-idle-delay 18924 #+cindex: auto-save, in code block editing 18925 {{{kbd(C-x C-s)}}} saves the buffer and updates the contents of the 18926 Org buffer. Set ~org-edit-src-auto-save-idle-delay~ to save the base 18927 buffer after a certain idle delay time. Set 18928 ~org-edit-src-turn-on-auto-save~ to auto-save this buffer into 18929 a separate file using Auto-save mode. 18930 18931 While editing the source code in the major mode, the Org Src minor 18932 mode remains active. It provides these customization variables as 18933 described below. For even more variables, look in the customization 18934 group ~org-edit-structure~. 18935 18936 - ~org-src-lang-modes~ :: 18937 18938 #+vindex: org-src-lang-modes 18939 If an Emacs major-mode named ~<LANG>-mode~ exists, where 18940 {{{var(<LANG>)}}} is the language identifier from code block's 18941 header line, then the edit buffer uses that major mode. Use this 18942 variable to arbitrarily map language identifiers to major modes. 18943 18944 - ~org-src-window-setup~ :: 18945 18946 #+vindex: org-src-window-setup 18947 For specifying Emacs window arrangement when the new edit buffer is 18948 created. 18949 18950 - ~org-src-preserve-indentation~ :: 18951 18952 #+cindex: indentation, in code blocks 18953 #+vindex: org-src-preserve-indentation 18954 Default is ~nil~. Source code is indented. This indentation 18955 applies during export or tangling, and depending on the context, may 18956 alter leading spaces and tabs. When non-~nil~, source code is 18957 aligned with the leftmost column. No lines are modified during 18958 export or tangling, which is very useful for white-space sensitive 18959 languages, such as Python. 18960 18961 - ~org-src-ask-before-returning-to-edit-buffer~ :: 18962 18963 #+vindex: org-src-ask-before-returning-to-edit-buffer 18964 When ~nil~, Org returns to the edit buffer without further prompts. 18965 The default prompts for a confirmation. 18966 18967 #+vindex: org-src-fontify-natively 18968 #+vindex: org-src-block-faces 18969 Set ~org-src-fontify-natively~ to non-~nil~ to turn on native code 18970 fontification in the /Org/ buffer. Fontification of code blocks can 18971 give visual separation of text and code on the display page. To 18972 further customize the appearance of ~org-block~ for specific 18973 languages, customize ~org-src-block-faces~. The following example 18974 shades the background of regular blocks, and colors source blocks only 18975 for Python and Emacs Lisp languages. 18976 18977 #+begin_src emacs-lisp 18978 (require 'color) 18979 (set-face-attribute 'org-block nil :background 18980 (color-darken-name 18981 (face-attribute 'default :background) 3)) 18982 18983 (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF")) 18984 ("python" (:background "#E5FFB8")))) 18985 #+end_src 18986 18987 ** Noweb Reference Syntax 18988 :PROPERTIES: 18989 :DESCRIPTION: Literate programming in Org mode. 18990 :END: 18991 #+cindex: code block, noweb reference 18992 #+cindex: syntax, noweb 18993 #+cindex: source code, noweb reference 18994 18995 #+cindex: @samp{noweb-ref}, header argument 18996 Source code blocks can include references to other source code blocks, 18997 using a noweb[fn:: For noweb literate programming details, see 18998 https://www.cs.tufts.edu/~nr/noweb/.] style syntax: 18999 19000 : <<CODE-BLOCK-ID>> 19001 19002 #+texinfo: @noindent 19003 where {{{var(CODE-BLOCK-ID)}}} refers to either the =NAME= of a single 19004 source code block, or a collection of one or more source code blocks 19005 sharing the same =noweb-ref= header argument (see [[*Using Header 19006 Arguments]]). Org can replace such references with the source code of 19007 the block or blocks being referenced, or, in the case of a single 19008 source code block named with =NAME=, with the results of an evaluation 19009 of that block. 19010 19011 #+cindex: @samp{noweb}, header argument 19012 The =noweb= header argument controls expansion of noweb syntax 19013 references. Expansions occur when source code blocks are evaluated, 19014 tangled, or exported. 19015 19016 - =no= :: 19017 19018 Default. No expansion of noweb syntax references in the body of the 19019 code when evaluating, tangling, or exporting. 19020 19021 - =yes= :: 19022 19023 Expansion of noweb syntax references in the body of the code block 19024 when evaluating, tangling, or exporting. 19025 19026 - =tangle= :: 19027 19028 Expansion of noweb syntax references in the body of the code block 19029 when tangling. No expansion when evaluating or exporting. 19030 19031 - =strip-tangle= :: 19032 19033 Expansion of noweb syntax references in the body of the code block 19034 when evaluating or exporting. Removes noweb syntax references 19035 when exporting. 19036 19037 - =no-export= :: 19038 19039 Expansion of noweb syntax references in the body of the code block 19040 when evaluating or tangling. No expansion when exporting. 19041 19042 - =strip-export= :: 19043 19044 Expansion of noweb syntax references in the body of the code block 19045 when expanding prior to evaluating or tangling. Removes noweb 19046 syntax references when exporting. 19047 19048 - =eval= :: 19049 19050 Expansion of noweb syntax references in the body of the code block 19051 only before evaluating. 19052 19053 In the most simple case, the contents of a single source block is 19054 inserted within other blocks. Thus, in following example, 19055 19056 #+begin_example 19057 ,#+NAME: initialization 19058 ,#+BEGIN_SRC emacs-lisp 19059 (setq sentence "Never a foot too far, even.") 19060 ,#+END_SRC 19061 19062 ,#+BEGIN_SRC emacs-lisp :noweb yes 19063 <<initialization>> 19064 (reverse sentence) 19065 ,#+END_SRC 19066 #+end_example 19067 19068 #+texinfo: @noindent 19069 the second code block is expanded as 19070 19071 #+begin_example 19072 ,#+BEGIN_SRC emacs-lisp :noweb yes 19073 (setq sentence "Never a foot too far, even.") 19074 (reverse sentence) 19075 ,#+END_SRC 19076 #+end_example 19077 19078 You may also include the contents of multiple blocks sharing a common 19079 =noweb-ref= header argument, which can be set at the file, subtree, 19080 or code block level. In the example Org file shown next, the body of 19081 the source code in each block is extracted for concatenation to a pure 19082 code file when tangled. 19083 19084 #+begin_example 19085 ,#+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh 19086 <<fullest-disk>> 19087 ,#+END_SRC 19088 ,* the mount point of the fullest disk 19089 :PROPERTIES: 19090 :header-args: :noweb-ref fullest-disk 19091 :END: 19092 19093 ,** query all mounted disks 19094 ,#+BEGIN_SRC sh 19095 df \ 19096 ,#+END_SRC 19097 19098 ,** strip the header row 19099 ,#+BEGIN_SRC sh 19100 |sed '1d' \ 19101 ,#+END_SRC 19102 19103 ,** output mount point of fullest disk 19104 ,#+BEGIN_SRC sh 19105 |awk '{if (u < +$5) {u = +$5; m = $6}} END {print m}' 19106 ,#+END_SRC 19107 #+end_example 19108 19109 #+cindex: @samp{noweb-sep}, header argument 19110 By default a newline separates each noweb reference concatenation. To 19111 use a different separator, edit the =noweb-sep= header argument. 19112 19113 Alternatively, Org can include the results of evaluation of a single 19114 code block rather than its body. Evaluation occurs when parentheses, 19115 possibly including arguments, are appended to the code block name, as 19116 shown below. 19117 19118 : <<NAME(optional arguments)>> 19119 19120 Note that in this case, a code block name set by =NAME= keyword is 19121 required; the reference set by =noweb-ref= will not work when 19122 evaluation is desired. 19123 19124 Here is an example that demonstrates how the exported content changes 19125 when noweb style references are used with parentheses versus without. 19126 Given: 19127 19128 #+begin_example 19129 ,#+NAME: some-code 19130 ,#+BEGIN_SRC python :var num=0 :results output :exports none 19131 print(num*10) 19132 ,#+END_SRC 19133 #+end_example 19134 19135 #+texinfo: @noindent 19136 this code block: 19137 19138 #+begin_example 19139 ,#+BEGIN_SRC text :noweb yes 19140 <<some-code>> 19141 ,#+END_SRC 19142 #+end_example 19143 19144 #+texinfo: @noindent 19145 expands to: 19146 19147 : print(num*10) 19148 19149 Below, a similar noweb style reference is used, but with parentheses, 19150 while setting a variable =num= to 10: 19151 19152 #+begin_example 19153 ,#+BEGIN_SRC text :noweb yes 19154 <<some-code(num=10)>> 19155 ,#+END_SRC 19156 #+end_example 19157 19158 #+texinfo: @noindent 19159 Note that the expansion now contains the results of the code block 19160 =some-code=, not the code block itself: 19161 19162 : 100 19163 19164 Noweb insertions honor prefix characters that appear before the noweb 19165 syntax reference. This behavior is illustrated in the following 19166 example. Because the =<<example>>= noweb reference appears behind the 19167 SQL comment syntax, each line of the expanded noweb reference is 19168 commented. With: 19169 19170 #+begin_example 19171 ,#+NAME: example 19172 ,#+BEGIN_SRC text 19173 this is the 19174 multi-line body of example 19175 ,#+END_SRC 19176 #+end_example 19177 19178 #+texinfo: @noindent 19179 this code block: 19180 19181 #+begin_example 19182 ,#+BEGIN_SRC sql :noweb yes 19183 ---<<example>> 19184 ,#+END_SRC 19185 #+end_example 19186 19187 #+texinfo: @noindent 19188 expands to: 19189 19190 #+begin_example 19191 ,#+BEGIN_SRC sql :noweb yes 19192 ---this is the 19193 ---multi-line body of example 19194 ,#+END_SRC 19195 #+end_example 19196 19197 Since this change does not affect noweb replacement text without 19198 newlines in them, inline noweb references are acceptable. 19199 19200 This feature can also be used for management of indentation in 19201 exported code snippets. With: 19202 19203 #+begin_example 19204 ,#+NAME: if-true 19205 ,#+BEGIN_SRC python :exports none 19206 print('do things when true') 19207 ,#+end_src 19208 19209 ,#+name: if-false 19210 ,#+begin_src python :exports none 19211 print('do things when false') 19212 ,#+end_src 19213 #+end_example 19214 19215 #+texinfo: @noindent 19216 this code block: 19217 19218 #+begin_example 19219 ,#+begin_src python :noweb yes :results output 19220 if true: 19221 <<if-true>> 19222 else: 19223 <<if-false>> 19224 ,#+end_src 19225 #+end_example 19226 19227 #+texinfo: @noindent 19228 expands to: 19229 19230 #+begin_example 19231 if true: 19232 print('do things when true') 19233 else: 19234 print('do things when false') 19235 #+end_example 19236 19237 This prefix behavior can be turned off in a block by setting the 19238 =noweb-prefix= header argument to =no=, as in: 19239 19240 #+begin_example 19241 ,#+BEGIN_SRC elisp :noweb-prefix no 19242 (setq example-data "<<example>>") 19243 ,#+END_SRC 19244 #+end_example 19245 19246 #+texinfo: @noindent 19247 which expands to: 19248 19249 #+begin_example 19250 (setq example-data "this is the 19251 multi-line body of example") 19252 #+end_example 19253 19254 When in doubt about the outcome of a source code block expansion, you 19255 can preview the results with the following command: 19256 19257 - {{{kbd(C-c C-v v)}}} or {{{kbd(C-c C-v C-v)}}} (~org-babel-expand-src-block~) :: 19258 19259 #+findex: org-babel-expand-src-block 19260 #+kindex: C-c C-v v 19261 #+kindex: C-c C-v C-v 19262 Expand the current source code block according to its header 19263 arguments and pop open the results in a preview buffer. 19264 19265 ** Library of Babel 19266 :PROPERTIES: 19267 :DESCRIPTION: Use and contribute to a library of useful code blocks. 19268 :END: 19269 #+cindex: babel, library of 19270 #+cindex: source code, library 19271 #+cindex: code block, library 19272 19273 The "Library of Babel" is a collection of code blocks. Like 19274 a function library, these code blocks can be called from other Org 19275 files. A collection of useful code blocks is available on [[https://orgmode.org/worg/library-of-babel.html][Worg]]. For 19276 remote code block evaluation syntax, see [[*Evaluating Code Blocks]]. 19277 19278 #+kindex: C-c C-v i 19279 #+findex: org-babel-lob-ingest 19280 For any user to add code to the library, first save the code in 19281 regular code blocks of an Org file, and then load the Org file with 19282 ~org-babel-lob-ingest~, which is bound to {{{kbd(C-c C-v i)}}}. 19283 19284 ** Key bindings and Useful Functions 19285 :PROPERTIES: 19286 :DESCRIPTION: Work quickly with code blocks. 19287 :END: 19288 #+cindex: code block, key bindings 19289 19290 Many common Org mode key sequences are re-bound depending on 19291 the context. 19292 19293 Active key bindings in code blocks: 19294 19295 #+kindex: C-c C-c 19296 #+findex: org-babel-execute-src-block 19297 #+kindex: C-c C-o 19298 #+findex: org-babel-open-src-block-result 19299 #+kindex: M-UP 19300 #+findex: org-babel-load-in-session 19301 #+kindex: M-DOWN 19302 #+findex: org-babel-pop-to-session 19303 #+attr_texinfo: :columns 0.2 0.55 19304 | Key binding | Function | 19305 |--------------------+-----------------------------------| 19306 | {{{kbd(C-c C-c)}}} | ~org-babel-execute-src-block~ | 19307 | {{{kbd(C-c C-o)}}} | ~org-babel-open-src-block-result~ | 19308 | {{{kbd(M-UP)}}} | ~org-babel-load-in-session~ | 19309 | {{{kbd(M-DOWN)}}} | ~org-babel-pop-to-session~ | 19310 19311 Active key bindings in Org mode buffer: 19312 19313 #+kindex: C-c C-v p 19314 #+kindex: C-c C-v C-p 19315 #+kindex: C-c C-v n 19316 #+kindex: C-c C-v C-n 19317 #+kindex: C-c C-v e 19318 #+kindex: C-c C-v C-e 19319 #+kindex: C-c C-v o 19320 #+kindex: C-c C-v C-o 19321 #+kindex: C-c C-v v 19322 #+kindex: C-c C-v C-v 19323 #+kindex: C-c C-v u 19324 #+kindex: C-c C-v C-u 19325 #+kindex: C-c C-v g 19326 #+kindex: C-c C-v C-g 19327 #+kindex: C-c C-v r 19328 #+kindex: C-c C-v C-r 19329 #+kindex: C-c C-v b 19330 #+kindex: C-c C-v C-b 19331 #+kindex: C-c C-v s 19332 #+kindex: C-c C-v C-s 19333 #+kindex: C-c C-v d 19334 #+kindex: C-c C-v C-d 19335 #+kindex: C-c C-v t 19336 #+kindex: C-c C-v C-t 19337 #+kindex: C-c C-v f 19338 #+kindex: C-c C-v C-f 19339 #+kindex: C-c C-v c 19340 #+kindex: C-c C-v C-c 19341 #+kindex: C-c C-v j 19342 #+kindex: C-c C-v C-j 19343 #+kindex: C-c C-v l 19344 #+kindex: C-c C-v C-l 19345 #+kindex: C-c C-v i 19346 #+kindex: C-c C-v C-i 19347 #+kindex: C-c C-v I 19348 #+kindex: C-c C-v C-I 19349 #+kindex: C-c C-v z 19350 #+kindex: C-c C-v C-z 19351 #+kindex: C-c C-v a 19352 #+kindex: C-c C-v C-a 19353 #+kindex: C-c C-v h 19354 #+kindex: C-c C-v C-h 19355 #+kindex: C-c C-v x 19356 #+kindex: C-c C-v C-x 19357 #+findex: org-babel-previous-src-block 19358 #+findex: org-babel-next-src-block 19359 #+findex: org-babel-execute-maybe 19360 #+findex: org-babel-open-src-block-result 19361 #+findex: org-babel-expand-src-block 19362 #+findex: org-babel-goto-src-block-head 19363 #+findex: org-babel-goto-named-src-block 19364 #+findex: org-babel-goto-named-result 19365 #+findex: org-babel-execute-buffer 19366 #+findex: org-babel-execute-subtree 19367 #+findex: org-babel-demarcate-block 19368 #+findex: org-babel-tangle 19369 #+findex: org-babel-tangle-file 19370 #+findex: org-babel-check-src-block 19371 #+findex: org-babel-insert-header-arg 19372 #+findex: org-babel-load-in-session 19373 #+findex: org-babel-lob-ingest 19374 #+findex: org-babel-view-src-block-info 19375 #+findex: org-babel-switch-to-session-with-code 19376 #+findex: org-babel-sha1-hash 19377 #+findex: org-babel-describe-bindings 19378 #+findex: org-babel-do-key-sequence-in-edit-buffer 19379 #+attr_texinfo: :columns 0.45 0.55 19380 | Key binding | Function | 19381 |------------------------------------------------+--------------------------------------------| 19382 | {{{kbd(C-c C-v p)}}} or {{{kbd(C-c C-v C-p)}}} | ~org-babel-previous-src-block~ | 19383 | {{{kbd(C-c C-v n)}}} or {{{kbd(C-c C-v C-n)}}} | ~org-babel-next-src-block~ | 19384 | {{{kbd(C-c C-v e)}}} or {{{kbd(C-c C-v C-e)}}} | ~org-babel-execute-maybe~ | 19385 | {{{kbd(C-c C-v o)}}} or {{{kbd(C-c C-v C-o)}}} | ~org-babel-open-src-block-result~ | 19386 | {{{kbd(C-c C-v v)}}} or {{{kbd(C-c C-v C-v)}}} | ~org-babel-expand-src-block~ | 19387 | {{{kbd(C-c C-v u)}}} or {{{kbd(C-c C-v C-u)}}} | ~org-babel-goto-src-block-head~ | 19388 | {{{kbd(C-c C-v g)}}} or {{{kbd(C-c C-v C-g)}}} | ~org-babel-goto-named-src-block~ | 19389 | {{{kbd(C-c C-v r)}}} or {{{kbd(C-c C-v C-r)}}} | ~org-babel-goto-named-result~ | 19390 | {{{kbd(C-c C-v b)}}} or {{{kbd(C-c C-v C-b)}}} | ~org-babel-execute-buffer~ | 19391 | {{{kbd(C-c C-v s)}}} or {{{kbd(C-c C-v C-s)}}} | ~org-babel-execute-subtree~ | 19392 | {{{kbd(C-c C-v d)}}} or {{{kbd(C-c C-v C-d)}}} | ~org-babel-demarcate-block~ | 19393 | {{{kbd(C-c C-v t)}}} or {{{kbd(C-c C-v C-t)}}} | ~org-babel-tangle~ | 19394 | {{{kbd(C-c C-v f)}}} or {{{kbd(C-c C-v C-f)}}} | ~org-babel-tangle-file~ | 19395 | {{{kbd(C-c C-v c)}}} or {{{kbd(C-c C-v C-c)}}} | ~org-babel-check-src-block~ | 19396 | {{{kbd(C-c C-v j)}}} or {{{kbd(C-c C-v C-j)}}} | ~org-babel-insert-header-arg~ | 19397 | {{{kbd(C-c C-v l)}}} or {{{kbd(C-c C-v C-l)}}} | ~org-babel-load-in-session~ | 19398 | {{{kbd(C-c C-v i)}}} or {{{kbd(C-c C-v C-i)}}} | ~org-babel-lob-ingest~ | 19399 | {{{kbd(C-c C-v I)}}} or {{{kbd(C-c C-v C-I)}}} | ~org-babel-view-src-block-info~ | 19400 | {{{kbd(C-c C-v z)}}} or {{{kbd(C-c C-v C-z)}}} | ~org-babel-switch-to-session-with-code~ | 19401 | {{{kbd(C-c C-v a)}}} or {{{kbd(C-c C-v C-a)}}} | ~org-babel-sha1-hash~ | 19402 | {{{kbd(C-c C-v h)}}} or {{{kbd(C-c C-v C-h)}}} | ~org-babel-describe-bindings~ | 19403 | {{{kbd(C-c C-v x)}}} or {{{kbd(C-c C-v C-x)}}} | ~org-babel-do-key-sequence-in-edit-buffer~ | 19404 19405 ** Batch Execution 19406 :PROPERTIES: 19407 :DESCRIPTION: Call functions from the command line. 19408 :END: 19409 #+cindex: code block, batch execution 19410 #+cindex: source code, batch execution 19411 19412 Org mode features, including working with source code facilities can 19413 be invoked from the command line. This enables building shell scripts 19414 for batch processing, running automated system tasks, and expanding 19415 Org mode's usefulness. 19416 19417 The sample script shows batch processing of multiple files using 19418 ~org-babel-tangle~. 19419 19420 #+begin_example 19421 #!/bin/sh 19422 # Tangle files with Org mode 19423 # 19424 emacs -Q --batch --eval " 19425 (progn 19426 (require 'ob-tangle) 19427 (dolist (file command-line-args-left) 19428 (with-current-buffer (find-file-noselect file) 19429 (org-babel-tangle)))) 19430 " "$@" 19431 #+end_example 19432 19433 * Miscellaneous 19434 :PROPERTIES: 19435 :DESCRIPTION: All the rest which did not fit elsewhere. 19436 :END: 19437 19438 ** Completion 19439 :PROPERTIES: 19440 :DESCRIPTION: @kbd{M-@key{TAB}} guesses completions. 19441 :END: 19442 #+cindex: completion, of @TeX{} symbols 19443 #+cindex: completion, of TODO keywords 19444 #+cindex: completion, of dictionary words 19445 #+cindex: completion, of option keywords 19446 #+cindex: completion, of tags 19447 #+cindex: completion, of property keys 19448 #+cindex: completion, of link abbreviations 19449 #+cindex: @TeX{} symbol completion 19450 #+cindex: TODO keywords completion 19451 #+cindex: dictionary word completion 19452 #+cindex: option keyword completion 19453 #+cindex: tag completion 19454 #+cindex: link abbreviations, completion of 19455 19456 Org has in-buffer completions. Unlike minibuffer completions, which 19457 are useful for quick command interactions, Org's in-buffer completions 19458 are more suitable for content creation in Org documents. Type one or 19459 more letters and invoke the hot key to complete the text in-place. 19460 Depending on the context and the keys, Org offers different types of 19461 completions. No minibuffer is involved. Such mode-specific hot keys 19462 have become an integral part of Emacs and Org provides several 19463 shortcuts. 19464 19465 - {{{kbd(M-TAB)}}} :: 19466 #+kindex: M-TAB 19467 19468 Complete word at point. 19469 19470 - At the beginning of an empty headline, complete TODO keywords. 19471 19472 - After =\=, complete TeX symbols supported by the exporter. 19473 19474 - After =:= in a headline, complete tags. Org deduces the list of 19475 tags from the =TAGS= in-buffer option (see [[*Setting Tags]]), the 19476 variable ~org-tag-alist~, or from all tags used in the current 19477 buffer. 19478 19479 - After =:= and not in a headline, complete property keys. The list 19480 of keys is constructed dynamically from all keys used in the 19481 current buffer. 19482 19483 - After =[[=, complete link abbreviations (see [[*Link Abbreviations]]). 19484 19485 - After =[[*=, complete headlines in the current buffer so that they 19486 can be used in search links like: =[[*find this headline]]= 19487 19488 - After =#+=, complete the special keywords like =TYP_TODO= or 19489 file-specific =OPTIONS=. After option keyword is complete, 19490 pressing {{{kbd(M-TAB)}}} again inserts example settings for this 19491 keyword. 19492 19493 - After =STARTUP= keyword, complete startup items. 19494 19495 - When point is anywhere else, complete dictionary words using 19496 Ispell. 19497 19498 ** Structure Templates 19499 :PROPERTIES: 19500 :DESCRIPTION: Quick insertion of structural elements. 19501 :END: 19502 #+cindex: template insertion 19503 #+cindex: insertion, of templates 19504 19505 With just a few keystrokes, it is possible to insert empty structural 19506 blocks, such as =#+BEGIN_SRC= ... =#+END_SRC=, or to wrap existing 19507 text in such a block. 19508 19509 - {{{kbd(C-c C-\,)}}} (~org-insert-structure-template~) :: 19510 19511 #+findex: org-insert-structure-template 19512 #+kindex: C-c C-, 19513 Prompt for a type of block structure, and insert the block at point. 19514 If the region is active, it is wrapped in the block. First prompts 19515 the user for keys, which are used to look up a structure type from 19516 the variable below. If the key is {{{kbd(TAB)}}}, {{{kbd(RET)}}}, 19517 or {{{kbd(SPC)}}}, the user is prompted to enter a block type. 19518 19519 #+vindex: org-structure-template-alist 19520 Available structure types are defined in 19521 ~org-structure-template-alist~, see the docstring for adding or 19522 changing values. 19523 19524 #+cindex: Tempo 19525 #+cindex: template expansion 19526 #+cindex: insertion, of templates 19527 #+vindex: org-tempo-keywords-alist 19528 Org Tempo expands snippets to structures defined in 19529 ~org-structure-template-alist~ and ~org-tempo-keywords-alist~. For 19530 example, {{{kbd(< s TAB)}}} creates a code block. Enable it by 19531 customizing ~org-modules~ or add =(require 'org-tempo)= to your Emacs 19532 init file[fn:: For more information, please refer to the commentary 19533 section in =org-tempo.el=.]. 19534 19535 #+attr_texinfo: :columns 0.1 0.9 19536 | {{{kbd(a)}}} | =#+BEGIN_EXPORT ascii= ... =#+END_EXPORT= | 19537 | {{{kbd(c)}}} | =#+BEGIN_CENTER= ... =#+END_CENTER= | 19538 | {{{kbd(C)}}} | =#+BEGIN_COMMENT= ... =#+END_COMMENT= | 19539 | {{{kbd(e)}}} | =#+BEGIN_EXAMPLE= ... =#+END_EXAMPLE= | 19540 | {{{kbd(E)}}} | =#+BEGIN_EXPORT= ... =#+END_EXPORT= | 19541 | {{{kbd(h)}}} | =#+BEGIN_EXPORT html= ... =#+END_EXPORT= | 19542 | {{{kbd(l)}}} | =#+BEGIN_EXPORT latex= ... =#+END_EXPORT= | 19543 | {{{kbd(q)}}} | =#+BEGIN_QUOTE= ... =#+END_QUOTE= | 19544 | {{{kbd(s)}}} | =#+BEGIN_SRC= ... =#+END_SRC= | 19545 | {{{kbd(v)}}} | =#+BEGIN_VERSE= ... =#+END_VERSE= | 19546 19547 ** Speed Keys 19548 :PROPERTIES: 19549 :DESCRIPTION: Electric commands at the beginning of a headline. 19550 :END: 19551 #+cindex: speed keys 19552 19553 Single keystrokes can execute custom commands in an Org file when 19554 point is on a headline. Without the extra burden of a meta or 19555 modifier key, Speed Keys can speed navigation or execute custom 19556 commands. Besides faster navigation, Speed Keys may come in handy on 19557 small mobile devices that do not have full keyboards. Speed Keys may 19558 also work on TTY devices known for their problems when entering Emacs 19559 key chords. 19560 19561 #+vindex: org-use-speed-commands 19562 By default, Org has Speed Keys disabled. To activate Speed Keys, set 19563 the variable ~org-use-speed-commands~ to a non-~nil~ value. To 19564 trigger a Speed Key, point must be at the beginning of an Org 19565 headline, before any of the stars. 19566 19567 #+vindex: org-speed-commands 19568 #+findex: org-speed-command-help 19569 Org comes with a pre-defined list of Speed Keys. To add or modify 19570 Speed Keys, customize the option ~org-speed-commands~. For more 19571 details, see the variable's docstring. With Speed Keys activated, 19572 {{{kbd(M-x org-speed-command-help)}}}, or {{{kbd(?)}}} when point is at the 19573 beginning of an Org headline, shows currently active Speed Keys, 19574 including the user-defined ones. 19575 19576 ** A Cleaner Outline View 19577 :PROPERTIES: 19578 :DESCRIPTION: Getting rid of leading stars in the outline. 19579 :ALT_TITLE: Clean View 19580 :END: 19581 #+cindex: hiding leading stars 19582 #+cindex: dynamic indentation 19583 #+cindex: odd-levels-only outlines 19584 #+cindex: clean outline view 19585 19586 Org's outline with stars and no indents can look cluttered for short 19587 documents. For /book-like/ long documents, the effect is not as 19588 noticeable. Org provides an alternate stars and indentation scheme, 19589 as shown on the right in the following table. It displays only one 19590 star and indents text to line up with the heading: 19591 19592 #+begin_example 19593 ,* Top level headline | * Top level headline 19594 ,** Second level | * Second level 19595 ,*** Third level | * Third level 19596 some text | some text 19597 ,*** Third level | * Third level 19598 more text | more text 19599 ,* Another top level headline | * Another top level headline 19600 #+end_example 19601 19602 Org can achieve this in two ways, (1) by just displaying the buffer in 19603 this way without changing it, or (2) by actually indenting every line 19604 in the desired amount with hard spaces and hiding leading stars. 19605 19606 *** Org Indent Mode 19607 19608 #+cindex: Indent mode 19609 #+findex: org-indent-mode 19610 To display the buffer in the indented view, activate Org Indent minor 19611 mode, using {{{kbd(M-x org-indent-mode)}}}. Text lines that are not 19612 headlines are prefixed with virtual spaces to vertically align with 19613 the headline text[fn:49]. 19614 19615 #+vindex: org-indent-indentation-per-level 19616 To make more horizontal space, the headlines are shifted by two 19617 characters. Configure ~org-indent-indentation-per-level~ variable for 19618 a different number. 19619 19620 #+vindex: org-indent-mode-turns-on-hiding-stars 19621 #+vindex: org-indent-mode-turns-off-org-adapt-indentation 19622 By default, Org Indent mode turns off ~org-adapt-indentation~ and does 19623 hide leading stars by locally setting ~org-hide-leading-stars~ to ~t~: 19624 only one star on each headline is visible, the rest are masked with 19625 the same font color as the background. If you want to customize this 19626 default behavior, see ~org-indent-mode-turns-on-hiding-stars~ and 19627 ~org-indent-mode-turns-off-org-adapt-indentation~. 19628 19629 #+vindex: org-startup-indented 19630 To globally turn on Org Indent mode for all files, customize the 19631 variable ~org-startup-indented~. To control it for individual files, 19632 use =STARTUP= keyword as follows: 19633 19634 : #+STARTUP: indent 19635 : #+STARTUP: noindent 19636 19637 *** Hard indentation 19638 19639 It is possible to use hard spaces to achieve the indentation instead, 19640 if the bare ASCII file should have the indented look also outside 19641 Emacs[fn:50]. With Org's support, you have to indent all lines to 19642 line up with the outline headers. You would use these settings[fn:: 19643 ~org-adapt-indentation~ can also be set to ='headline-data=, in which 19644 case only data lines below the headline will be indented.]: 19645 19646 #+begin_src emacs-lisp 19647 (setq org-adapt-indentation t 19648 org-hide-leading-stars t 19649 org-odd-levels-only t) 19650 #+end_src 19651 19652 - /Indentation of text below headlines/ (~org-adapt-indentation~) :: 19653 19654 #+vindex: org-adapt-indentation 19655 The first setting modifies paragraph filling, line wrapping, and 19656 structure editing commands to preserving or adapting the indentation 19657 as appropriate. 19658 19659 - /Hiding leading stars/ (~org-hide-leading-stars~) :: 19660 19661 #+vindex: org-hide-leading-stars 19662 #+vindex: org-hide, face 19663 The second setting makes leading stars invisible by applying the 19664 face ~org-hide~ to them. For per-file preference, use these file 19665 =STARTUP= options: 19666 19667 #+begin_example 19668 ,#+STARTUP: hidestars 19669 ,#+STARTUP: showstars 19670 #+end_example 19671 19672 - /Odd levels/ (~org-odd-levels-only~) :: 19673 19674 #+vindex: org-odd-levels-only 19675 The third setting makes Org use only odd levels, 1, 3, 5, ..., in 19676 the outline to create more indentation. On a per-file level, 19677 control this with: 19678 19679 #+begin_example 19680 ,#+STARTUP: odd 19681 ,#+STARTUP: oddeven 19682 #+end_example 19683 19684 To convert a file between single and double stars layouts, use 19685 {{{kbd(M-x org-convert-to-odd-levels)}}} and {{{kbd(M-x 19686 org-convert-to-oddeven-levels)}}}. 19687 19688 ** Execute commands in the active region 19689 :PROPERTIES: 19690 :DESCRIPTION: Execute commands on multiple items in Org or agenda view. 19691 :END: 19692 19693 #+vindex: org-loop-over-headlines-in-active-region 19694 When in an Org buffer and the region is active, some commands will 19695 apply to all the subtrees in the active region. For example, hitting 19696 {{{kbd(C-c C-s)}}} when multiple headlines are within the active region will 19697 successively prompt you for a new schedule date and time. To disable 19698 this, set the option ~org-loop-over-headlines-in-active-region~ to 19699 non-~t~, activate the region and run the command normally. 19700 19701 #+vindex: org-agenda-loop-over-headlines-in-active-region 19702 ~org-agenda-loop-over-headlines-in-active-region~ is the equivalent 19703 option of the agenda buffer, where you can also use [[*Bulk remote editing selected entries][bulk editing of 19704 selected entries]]. 19705 19706 Not all commands can loop in the active region and what subtrees or 19707 headlines are considered can be refined: see the docstrings of these 19708 options for more details. 19709 19710 ** Dynamic Headline Numbering 19711 :PROPERTIES: 19712 :DESCRIPTION: Display and update outline numbering. 19713 :END: 19714 19715 #+cindex: Org Num mode 19716 #+cindex: number headlines 19717 The Org Num minor mode, toggled with {{{kbd(M-x org-num-mode)}}}, 19718 displays outline numbering on top of headlines. It also updates it 19719 automatically upon changes to the structure of the document. 19720 19721 #+vindex: org-num-max-level 19722 #+vindex: org-num-skip-tags 19723 #+vindex: org-num-skip-commented 19724 #+vindex: org-num-skip-unnumbered 19725 By default, all headlines are numbered. You can limit numbering to 19726 specific headlines according to their level, tags, =COMMENT= keyword, 19727 or =UNNUMBERED= property. Set ~org-num-max-level~, 19728 ~org-num-skip-tags~, ~org-num-skip-commented~, 19729 ~org-num-skip-unnumbered~, or ~org-num-skip-footnotes~ accordingly. 19730 19731 #+vindex: org-num-skip-footnotes 19732 If ~org-num-skip-footnotes~ is non-~nil~, footnotes sections (see 19733 [[*Creating Footnotes]]) are not numbered either. 19734 19735 #+vindex: org-num-face 19736 #+vindex: org-num-format-function 19737 You can control how the numbering is displayed by setting 19738 ~org-num-face~ and ~org-num-format-function~. 19739 19740 #+vindex: org-startup-numerated 19741 You can also turn this mode globally for all Org files by setting the 19742 option ~org-startup-numerated~ to =t=, or locally on a file by using 19743 =#+startup: num=. 19744 19745 ** The Very Busy {{{kbd(C-c C-c)}}} Key 19746 :PROPERTIES: 19747 :DESCRIPTION: When in doubt, press @kbd{C-c C-c}. 19748 :END: 19749 #+kindex: C-c C-c 19750 #+cindex: @kbd{C-c C-c}, overview 19751 19752 The {{{kbd(C-c C-c)}}} key in Org serves many purposes depending on 19753 the context. It is probably the most over-worked, multi-purpose key 19754 combination in Org. Its uses are well documented throughout this 19755 manual, but here is a consolidated list for easy reference. 19756 19757 - If column view (see [[*Column View]]) is on, exit column view. 19758 19759 - If any highlights shown in the buffer from the creation of a sparse 19760 tree, or from clock display, remove such highlights. 19761 19762 - If point is in one of the special =KEYWORD= lines, scan the buffer 19763 for these lines and update the information. Also reset the Org file 19764 cache used to temporary store the contents of URLs used as values 19765 for keywords like =SETUPFILE=. 19766 19767 - If point is inside a table, realign the table. 19768 19769 - If point is on a =TBLFM= keyword, re-apply the formulas to the 19770 entire table. 19771 19772 - If the current buffer is a capture buffer, close the note and file 19773 it. With a prefix argument, also jump to the target location after 19774 saving the note. 19775 19776 - If point is on a =<<<target>>>=, update radio targets and 19777 corresponding links in this buffer. 19778 19779 - If point is on a property line or at the start or end of a property 19780 drawer, offer property commands. 19781 19782 - If point is at a footnote reference, go to the corresponding 19783 definition, and /vice versa/. 19784 19785 - If point is on a statistics cookie, update it. 19786 19787 - If point is in a plain list item with a checkbox, toggle the status 19788 of the checkbox. 19789 19790 - If point is on a numbered item in a plain list, renumber the ordered 19791 list. 19792 19793 - If point is on the =#+BEGIN= line of a dynamic block, the block is 19794 updated. 19795 19796 - If point is at a timestamp, fix the day name in the timestamp. 19797 19798 ** Summary of In-Buffer Settings 19799 :PROPERTIES: 19800 :DESCRIPTION: Overview of keywords. 19801 :ALT_TITLE: In-buffer Settings 19802 :END: 19803 #+cindex: in-buffer settings 19804 #+cindex: special keywords 19805 19806 In-buffer settings start with =#+=, followed by a keyword, a colon, 19807 one or more spaces, and then a word for each setting. Org accepts 19808 multiple settings on the same line. Org also accepts multiple lines 19809 for a keyword. This manual describes these settings throughout. A 19810 summary follows here. 19811 19812 #+cindex: refresh set-up 19813 {{{kbd(C-c C-c)}}} activates any changes to the in-buffer settings. 19814 Closing and reopening the Org file in Emacs also activates the 19815 changes. 19816 19817 #+attr_texinfo: :sep , 19818 - =#+ARCHIVE: %s_done::= :: 19819 19820 #+cindex: @samp{ARCHIVE}, keyword 19821 #+vindex: org-archive-location 19822 Sets the archive location of the agenda file. The corresponding 19823 variable is ~org-archive-location~. 19824 19825 - =#+CATEGORY= :: 19826 19827 #+cindex: @samp{CATEGORY}, keyword 19828 Sets the category of the agenda file, which applies to the entire 19829 document. 19830 19831 - =#+COLUMNS: %25ITEM ...= :: 19832 19833 #+cindex: @samp{COLUMNS}, property 19834 Set the default format for columns view. This format applies when 19835 columns view is invoked in locations where no =COLUMNS= property 19836 applies. 19837 19838 - =#+CONSTANTS: name1=value1 ...= :: 19839 19840 #+cindex: @samp{CONSTANTS}, keyword 19841 #+vindex: org-table-formula-constants 19842 #+vindex: org-table-formula 19843 Set file-local values for constants that table formulas can use. 19844 This line sets the local variable 19845 ~org-table-formula-constants-local~. The global version of this 19846 variable is ~org-table-formula-constants~. 19847 19848 - =#+FILETAGS: :tag1:tag2:tag3:= :: 19849 19850 #+cindex: @samp{FILETAGS}, keyword 19851 Set tags that all entries in the file inherit from, including the 19852 top-level entries. 19853 19854 - =#+LINK: linkword replace= :: 19855 19856 #+cindex: @samp{LINK}, keyword 19857 #+vindex: org-link-abbrev-alist 19858 Each line specifies one abbreviation for one link. Use multiple 19859 =LINK= keywords for more, see [[*Link Abbreviations]]. The 19860 corresponding variable is ~org-link-abbrev-alist~. 19861 19862 - =#+PRIORITIES: highest lowest default= :: 19863 19864 #+cindex: @samp{PRIORITIES}, keyword 19865 #+vindex: org-priority-highest 19866 #+vindex: org-priority-lowest 19867 #+vindex: org-priority-default 19868 This line sets the limits and the default for the priorities. All 19869 three must be either letters A--Z or numbers 0--9. The highest 19870 priority must have a lower ASCII number than the lowest priority. 19871 19872 - =#+PROPERTY: Property_Name Value= :: 19873 19874 #+cindex: @samp{PROPERTY}, keyword 19875 This line sets a default inheritance value for entries in the 19876 current buffer, most useful for specifying the allowed values of 19877 a property. 19878 19879 - =#+SETUPFILE: file= :: 19880 19881 #+cindex: @samp{SETUPFILE}, keyword 19882 The setup file or a URL pointing to such file is for additional 19883 in-buffer settings. Org loads this file and parses it for any 19884 settings in it only when Org opens the main file. If URL is 19885 specified, the contents are downloaded and stored in a temporary 19886 file cache. {{{kbd(C-c C-c)}}} on the settings line parses and 19887 loads the file, and also resets the temporary file cache. Org also 19888 parses and loads the document during normal exporting process. Org 19889 parses the contents of this document as if it was included in the 19890 buffer. It can be another Org file. To visit the file---not 19891 a URL---use {{{kbd(C-c ')}}} while point is on the line with the 19892 file name. 19893 19894 - =#+STARTUP:= :: 19895 19896 #+cindex: @samp{STARTUP}, keyword 19897 Startup options Org uses when first visiting a file. 19898 19899 #+vindex: org-startup-folded 19900 The first set of options deals with the initial visibility of the 19901 outline tree. The corresponding variable for global default 19902 settings is ~org-startup-folded~ with a default value of 19903 ~showeverything~. 19904 19905 | =overview= | Top-level headlines only. | 19906 | =content= | All headlines. | 19907 | =showall= | No folding on any entry. | 19908 | =show2levels= | Headline levels 1-2. | 19909 | =show3levels= | Headline levels 1-3. | 19910 | =show4levels= | Headline levels 1-4. | 19911 | =show5levels= | Headline levels 1-5. | 19912 | =showeverything= | Show even drawer contents. | 19913 19914 #+vindex: org-startup-indented 19915 Dynamic virtual indentation is controlled by the variable 19916 ~org-startup-indented~[fn:: Note that Org Indent mode also sets the 19917 ~wrap-prefix~ property, such that Visual Line mode (or purely 19918 setting ~word-wrap~) wraps long lines, including headlines, 19919 correctly indented.]. 19920 19921 | =indent= | Start with Org Indent mode turned on. | 19922 | =noindent= | Start with Org Indent mode turned off. | 19923 19924 #+vindex: org-startup-numerated 19925 Dynamic virtual numeration of headlines is controlled by the variable 19926 ~org-startup-numerated~. 19927 19928 | =num= | Start with Org num mode turned on. | 19929 | =nonum= | Start with Org num mode turned off. | 19930 19931 #+vindex: org-startup-align-all-tables 19932 Aligns tables consistently upon visiting a file. The 19933 corresponding variable is ~org-startup-align-all-tables~ with 19934 ~nil~ as default value. 19935 19936 | =align= | Align all tables. | 19937 | =noalign= | Do not align tables on startup. | 19938 19939 #+vindex: org-startup-shrink-all-tables 19940 Shrink table columns with a width cookie. The corresponding 19941 variable is ~org-startup-shrink-all-tables~ with ~nil~ as 19942 default value. 19943 19944 #+vindex: org-startup-with-inline-images 19945 When visiting a file, inline images can be automatically 19946 displayed. The corresponding variable is 19947 ~org-startup-with-inline-images~, with a default value ~nil~ to 19948 avoid delays when visiting a file. 19949 19950 | =inlineimages= | Show inline images. | 19951 | =noinlineimages= | Do not show inline images on startup. | 19952 19953 #+vindex: org-log-done 19954 #+vindex: org-log-note-clock-out 19955 #+vindex: org-log-repeat 19956 Logging the closing and reopening of TODO items and clock 19957 intervals can be configured using these options (see variables 19958 ~org-log-done~, ~org-log-note-clock-out~, and ~org-log-repeat~). 19959 19960 | =logdone= | Record a timestamp when an item is marked as done. | 19961 | =lognotedone= | Record timestamp and a note when DONE. | 19962 | =nologdone= | Do not record when items are marked as done. | 19963 | =logrepeat= | Record a time when reinstating a repeating item. | 19964 | =lognoterepeat= | Record a note when reinstating a repeating item. | 19965 | =nologrepeat= | Do not record when reinstating repeating item. | 19966 | =lognoteclock-out= | Record a note when clocking out. | 19967 | =nolognoteclock-out= | Do not record a note when clocking out. | 19968 | =logreschedule= | Record a timestamp when scheduling time changes. | 19969 | =lognotereschedule= | Record a note when scheduling time changes. | 19970 | =nologreschedule= | Do not record when a scheduling date changes. | 19971 | =logredeadline= | Record a timestamp when deadline changes. | 19972 | =lognoteredeadline= | Record a note when deadline changes. | 19973 | =nologredeadline= | Do not record when a deadline date changes. | 19974 | =logrefile= | Record a timestamp when refiling. | 19975 | =lognoterefile= | Record a note when refiling. | 19976 | =nologrefile= | Do not record when refiling. | 19977 19978 #+vindex: org-hide-leading-stars 19979 #+vindex: org-odd-levels-only 19980 Here are the options for hiding leading stars in outline 19981 headings, and for indenting outlines. The corresponding 19982 variables are ~org-hide-leading-stars~ and 19983 ~org-odd-levels-only~, both with a default setting ~nil~ 19984 (meaning =showstars= and =oddeven=). 19985 19986 | =hidestars= | Make all but one of the stars starting a headline invisible. | 19987 | =showstars= | Show all stars starting a headline. | 19988 | =indent= | Virtual indentation according to outline level. | 19989 | =noindent= | No virtual indentation according to outline level. | 19990 | =odd= | Allow only odd outline levels (1, 3, ...). | 19991 | =oddeven= | Allow all outline levels. | 19992 19993 #+vindex: org-put-time-stamp-overlays 19994 #+vindex: org-time-stamp-overlay-formats 19995 To turn on custom format overlays over timestamps (variables 19996 ~org-put-time-stamp-overlays~ and 19997 ~org-time-stamp-overlay-formats~), use: 19998 19999 | =customtime= | Overlay custom time format. | 20000 20001 #+vindex: constants-unit-system 20002 The following options influence the table spreadsheet (variable 20003 ~constants-unit-system~). 20004 20005 | =constcgs= | =constants.el= should use the c-g-s unit system. | 20006 | =constSI= | =constants.el= should use the SI unit system. | 20007 20008 #+vindex: org-footnote-define-inline 20009 #+vindex: org-footnote-auto-label 20010 #+vindex: org-footnote-auto-adjust 20011 To influence footnote settings, use the following keywords. The 20012 corresponding variables are ~org-footnote-define-inline~, 20013 ~org-footnote-auto-label~, and ~org-footnote-auto-adjust~. 20014 20015 | =fninline= | Define footnotes inline. | 20016 | =fnnoinline= | Define footnotes in separate section. | 20017 | =fnlocal= | Define footnotes near first reference, but not inline. | 20018 | =fnprompt= | Prompt for footnote labels. | 20019 | =fnauto= | Create =[fn:1]=-like labels automatically (default). | 20020 | =fnconfirm= | Offer automatic label for editing or confirmation. | 20021 | =fnadjust= | Automatically renumber and sort footnotes. | 20022 | =nofnadjust= | Do not renumber and sort automatically. | 20023 20024 #+vindex: org-hide-block-startup 20025 #+vindex: org-hide-drawer-startup 20026 To hide blocks or drawers on startup, use these keywords. The 20027 corresponding variables are ~org-hide-block-startup~ and 20028 ~org-hide-drawer-startup~. 20029 20030 | =hideblocks= | Hide all begin/end blocks on startup. | 20031 | =nohideblocks= | Do not hide blocks on startup. | 20032 | =hidedrawers= | Hide all begin/end blocks on startup. | 20033 | =nohidedrawers= | Do not hide blocks on startup. | 20034 20035 20036 #+vindex: org-pretty-entities 20037 The display of entities as UTF-8 characters is governed by the 20038 variable ~org-pretty-entities~ and the keywords 20039 20040 | =entitiespretty= | Show entities as UTF-8 characters where possible. | 20041 | =entitiesplain= | Leave entities plain. | 20042 20043 - =#+TAGS: TAG1(c1) TAG2(c2)= :: 20044 20045 #+cindex: @samp{TAGS}, keyword 20046 #+vindex: org-tag-alist 20047 These lines (several such lines are allowed) specify the valid tags 20048 in this file, and (potentially) the corresponding /fast tag 20049 selection/ keys. The corresponding variable is ~org-tag-alist~. 20050 20051 - =#+TODO:=, =#+SEQ_TODO:=, =#+TYP_TODO:= :: 20052 20053 #+cindex: @samp{SEQ_TODO}, keyword 20054 #+cindex: @samp{TODO}, keyword 20055 #+cindex: @samp{TYP_TODO}, keyword 20056 #+vindex: org-todo-keywords 20057 These lines set the TODO keywords and their interpretation in the 20058 current file. The corresponding variable is ~org-todo-keywords~. 20059 20060 ** Regular Expressions 20061 :PROPERTIES: 20062 :DESCRIPTION: Elisp regular expressions. 20063 :END: 20064 #+cindex: regular expressions syntax 20065 #+cindex: regular expressions, in searches 20066 20067 Org, as an Emacs mode, makes use of Elisp regular expressions for 20068 searching, matching and filtering. Elisp regular expressions have a 20069 somewhat different syntax then some common standards. Most notably, 20070 alternation is indicated using =\|= and matching groups are denoted by 20071 =\(...\)=. For example the string =home\|work= matches either =home= 20072 or =work=. 20073 20074 For more information, see [[info:emacs::Regexps][Regular Expressions in Emacs]]. 20075 20076 ** Org Syntax 20077 :PROPERTIES: 20078 :DESCRIPTION: Formal description of Org's syntax. 20079 :END: 20080 20081 A reference document providing a formal description of Org's syntax is 20082 available as [[https://orgmode.org/worg/dev/org-syntax.html][a draft on Worg]], written and maintained by Nicolas 20083 Goaziou. It defines Org's core internal concepts such as "headlines", 20084 "sections", "affiliated keywords", "(greater) elements" and "objects". 20085 Each part of an Org document belongs to one of the previous 20086 categories. 20087 20088 To explore the abstract structure of an Org buffer, run this in 20089 a buffer: 20090 20091 : M-: (org-element-parse-buffer) <RET> 20092 20093 #+texinfo: @noindent 20094 It outputs a list containing the buffer's content represented as an 20095 abstract structure. The export engine relies on the information 20096 stored in this list. Most interactive commands---e.g., for structure 20097 editing---also rely on the syntactic meaning of the surrounding 20098 context. 20099 20100 #+cindex: syntax checker 20101 #+cindex: linter 20102 #+findex: org-lint 20103 You can probe the syntax of your documents with the command 20104 20105 : M-x org-lint <RET> 20106 20107 #+texinfo: @noindent 20108 It runs a number of checks to find common mistakes. It then displays 20109 their location in a dedicated buffer, along with a description and 20110 a "trust level", since false-positive are possible. From there, you 20111 can operate on the reports with the following keys: 20112 20113 #+attr_texinfo: :columns 0.22 0.78 20114 | {{{kbd(C-j)}}}, {{{kbd(TAB)}}} | Display the offending line | 20115 | {{{kbd(RET)}}} | Move point to the offending line | 20116 | {{{kbd(g)}}} | Check the document again | 20117 | {{{kbd(h)}}} | Hide all reports from the same checker | 20118 | {{{kbd(i)}}} | Also remove them from all subsequent checks | 20119 | {{{kbd(S)}}} | Sort reports by the column at point | 20120 20121 ** Context Dependent Documentation 20122 :PROPERTIES: 20123 :DESCRIPTION: Read documentation about current syntax. 20124 :ALT_TITLE: Documentation Access 20125 :END: 20126 #+cindex: documentation 20127 #+cindex: Info 20128 20129 #+findex: org-info-find-node 20130 #+kindex: C-c C-x I 20131 {{{kbd(C-c C-x I)}}} in an Org file tries to open a suitable section 20132 of the Org manual depending on the syntax at point. For example, 20133 using it on a headline displays "Document Structure" section. 20134 20135 {{{kbd(q)}}} closes the Info window. 20136 20137 ** Escape Character 20138 :PROPERTIES: 20139 :DESCRIPTION: Prevent Org from interpreting your writing. 20140 :END: 20141 20142 #+cindex: escape character 20143 #+cindex: zero width space 20144 You may sometimes want to write text that looks like Org syntax, but 20145 should really read as plain text. Org may use a specific escape 20146 character in some situations, i.e., a backslash in macros (see [[*Macro 20147 Replacement]]) and links (see [[*Link Format]]), or a comma in source and 20148 example blocks (see [[*Literal Examples]]). In the general case, however, 20149 we suggest to use the zero width space. You can insert one with any 20150 of the following: 20151 20152 : C-x 8 <RET> zero width space <RET> 20153 : C-x 8 <RET> 200B <RET> 20154 20155 For example, in order to write =[[1,2]]= as-is in your document, you 20156 may write instead 20157 20158 : [X[1,2]] 20159 20160 where =X= denotes the zero width space character. 20161 20162 ** Code Evaluation and Security Issues 20163 :PROPERTIES: 20164 :DESCRIPTION: Org files evaluate in-line code. 20165 :ALT_TITLE: Code Evaluation Security 20166 :END: 20167 20168 Unlike plain text, running code comes with risk. Each source code 20169 block, in terms of risk, is equivalent to an executable file. Org 20170 therefore puts a few confirmation prompts by default. This is to 20171 alert the casual user from accidentally running untrusted code. 20172 20173 For users who do not run code blocks or write code regularly, Org's 20174 default settings should suffice. However, some users may want to 20175 tweak the prompts for fewer interruptions. To weigh the risks of 20176 automatic execution of code blocks, here are some details about code 20177 evaluation. 20178 20179 Org evaluates code in the following circumstances: 20180 20181 - /Source code blocks/ :: 20182 20183 Org evaluates source code blocks in an Org file during export. Org 20184 also evaluates a source code block with the {{{kbd(C-c C-c)}}} key 20185 chord. Users exporting or running code blocks must load files only 20186 from trusted sources. Be wary of customizing variables that remove 20187 or alter default security measures. 20188 20189 #+attr_texinfo: :options org-confirm-babel-evaluate 20190 #+begin_defopt 20191 When ~t~, Org prompts the user for confirmation before executing 20192 each code block. When ~nil~, Org executes code blocks without 20193 prompting the user for confirmation. When this option is set to 20194 a custom function, Org invokes the function with these two 20195 arguments: the source code language and the body of the code block. 20196 The custom function must return either a ~t~ or ~nil~, which 20197 determines if the user is prompted. Each source code language can 20198 be handled separately through this function argument. 20199 #+end_defopt 20200 20201 For example, here is how to execute ditaa code blocks without 20202 prompting: 20203 20204 #+begin_src emacs-lisp 20205 (defun my-org-confirm-babel-evaluate (lang body) 20206 (not (string= lang "ditaa"))) ;don't ask for ditaa 20207 (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate) 20208 #+end_src 20209 20210 - /Following =shell= and =elisp= links/ :: 20211 20212 Org has two link types that can directly evaluate code (see 20213 [[*External Links]]). Because such code is not visible, these links 20214 have a potential risk. Org therefore prompts the user when it 20215 encounters such links. The customization variables are: 20216 20217 #+attr_texinfo: :options org-link-shell-confirm-function 20218 #+begin_defopt 20219 Function that prompts the user before executing a shell link. 20220 #+end_defopt 20221 20222 #+attr_texinfo: :options org-link-elisp-confirm-function 20223 #+begin_defopt 20224 Function that prompts the user before executing an Emacs Lisp link. 20225 #+end_defopt 20226 20227 - /Formulas in tables/ :: 20228 20229 Formulas in tables (see [[*The Spreadsheet]]) are code that is evaluated 20230 either by the Calc interpreter, or by the Emacs Lisp interpreter. 20231 20232 ** Interaction with Other Packages 20233 :PROPERTIES: 20234 :DESCRIPTION: With other Emacs packages. 20235 :ALT_TITLE: Interaction 20236 :END: 20237 #+cindex: packages, interaction with other 20238 20239 Org's compatibility and the level of interaction with other Emacs 20240 packages are documented here. 20241 20242 *** Packages that Org cooperates with 20243 :PROPERTIES: 20244 :DESCRIPTION: Packages Org cooperates with. 20245 :ALT_TITLE: Cooperation 20246 :END: 20247 20248 - =calc.el= by Dave Gillespie :: 20249 #+cindex: @file{calc.el} 20250 20251 Org uses the Calc package for implementing spreadsheet functionality 20252 in its tables (see [[*The Spreadsheet]]). Org also uses Calc for 20253 embedded calculations. See [[info:calc::Embedded Mode][GNU Emacs Calc Manual]]. 20254 20255 - =constants.el= by Carsten Dominik :: 20256 #+cindex: @file{constants.el} 20257 #+vindex: org-table-formula-constants 20258 20259 Org can use names for constants in formulas in tables. Org can also 20260 use calculation suffixes for units, such as =M= for =Mega=. For 20261 a standard collection of such constants, install the =constants= 20262 package. Install version 2.0 of this package, available at 20263 [[http://www.astro.uva.nl/~dominik/Tools]]. Org checks if the function 20264 ~constants-get~ has been autoloaded. Installation instructions are 20265 in the file =constants.el=. 20266 20267 - =cdlatex.el= by Carsten Dominik :: 20268 #+cindex: @file{cdlatex.el} 20269 20270 Org mode can make use of the CDLaTeX package to efficiently enter 20271 LaTeX fragments into Org files. See [[*Using CDLaTeX to enter math]]. 20272 20273 - =imenu.el= by Ake Stenhoff and Lars Lindberg :: 20274 #+cindex: @file{imenu.el} 20275 20276 Imenu creates dynamic menus based on an index of items in a file. 20277 Org mode supports Imenu menus. Enable it with a mode hook as 20278 follows: 20279 20280 #+begin_src emacs-lisp 20281 (add-hook 'org-mode-hook 20282 (lambda () (imenu-add-to-menubar "Imenu"))) 20283 #+end_src 20284 20285 #+vindex: org-imenu-depth 20286 By default the index is two levels deep---you can modify the 20287 depth using the option ~org-imenu-depth~. 20288 20289 - =speedbar.el= by Eric\nbsp{}M.\nbsp{}Ludlam :: 20290 #+cindex: @file{speedbar.el} 20291 20292 Speedbar package creates a special Emacs frame for displaying files 20293 and index items in files. Org mode supports Speedbar; users can 20294 drill into Org files directly from the Speedbar. The {{{kbd(<)}}} 20295 in the Speedbar frame tweaks the agenda commands to that file or to 20296 a subtree. 20297 20298 - =table.el= by Takaaki Ota :: 20299 #+cindex: table editor, @file{table.el} 20300 #+cindex: @file{table.el} 20301 20302 Complex ASCII tables with automatic line wrapping, column- and 20303 row-spanning, and alignment can be created using the Emacs table 20304 package by Takaaki Ota. Org mode recognizes such tables and exports 20305 them properly. {{{kbd(C-c ')}}} to edit these tables in a special 20306 buffer, much like Org's code blocks. Because of interference with 20307 other Org mode functionality, Takaaki Ota tables cannot be edited 20308 directly in the Org buffer. 20309 20310 - {{{kbd(C-c ')}}} (~org-edit-special~) :: 20311 20312 #+kindex: C-c ' 20313 #+findex: org-edit-special 20314 Edit a =table.el= table. Works when point is in a =table.el= 20315 table. 20316 20317 - {{{kbd(C-c ~)}}} (~org-table-create-with-table.el~) :: 20318 20319 #+kindex: C-c ~ 20320 #+findex: org-table-create-with-table.el 20321 Insert a =table.el= table. If there is already a table at point, 20322 this command converts it between the =table.el= format and the Org 20323 mode format. See the documentation string of the command 20324 ~org-convert-table~ for the restrictions under which this is 20325 possible. 20326 20327 *** Packages that conflict with Org mode 20328 :PROPERTIES: 20329 :DESCRIPTION: Packages that lead to conflicts. 20330 :ALT_TITLE: Conflicts 20331 :END: 20332 20333 #+cindex: shift-selection 20334 #+vindex: org-support-shift-select 20335 In Emacs, shift-selection combines motions of point with shift key to 20336 enlarge regions. Emacs sets this mode by default. This conflicts 20337 with Org's use of {{{kbd(S-<cursor>)}}} commands to change timestamps, 20338 TODO keywords, priorities, and item bullet types, etc. Since 20339 {{{kbd(S-<cursor>)}}} commands outside of specific contexts do not do 20340 anything, Org offers the variable ~org-support-shift-select~ for 20341 customization. Org mode accommodates shift selection by (i) making it 20342 available outside of the special contexts where special commands 20343 apply, and (ii) extending an existing active region even if point 20344 moves across a special context. 20345 20346 - =cua.el= by Kim\nbsp{}F.\nbsp{}Storm :: 20347 20348 #+cindex: @file{cua.el} 20349 #+vindex: org-replace-disputed-keys 20350 Org key bindings conflict with {{{kbd(S-<cursor>)}}} keys used by 20351 CUA mode. For Org to relinquish these bindings to CUA mode, 20352 configure the variable ~org-replace-disputed-keys~. When set, Org 20353 moves the following key bindings in Org files, and in the agenda 20354 buffer---but not during date selection. 20355 20356 #+attr_texinfo: :columns 0.4 0.4 20357 | {{{kbd(S-UP)}}} \rArr{} {{{kbd(M-p)}}} | {{{kbd(S-DOWN)}}} \rArr{} {{{kbd(M-n)}}} | 20358 | {{{kbd(S-LEFT)}}} \rArr{} {{{kbd(M--)}}} | {{{kbd(S-RIGHT)}}} \rArr{} {{{kbd(M-+)}}} | 20359 | {{{kbd(C-S-LEFT)}}} \rArr{} {{{kbd(M-S--)}}} | {{{kbd(C-S-RIGHT)}}} \rArr{} {{{kbd(M-S-+)}}} | 20360 20361 #+vindex: org-disputed-keys 20362 Yes, these are unfortunately more difficult to remember. If you 20363 want to have other replacement keys, look at the variable 20364 ~org-disputed-keys~. 20365 20366 - =ecomplete.el= by Lars Magne Ingebrigtsen :: 20367 20368 #+cindex: @file{ecomplete.el} 20369 Ecomplete provides "electric" address completion in address header 20370 lines in message buffers. Sadly Orgtbl mode cuts Ecomplete's power 20371 supply: no completion happens when Orgtbl mode is enabled in message 20372 buffers while entering text in address header lines. If one wants 20373 to use ecomplete one should /not/ follow the advice to automagically 20374 turn on Orgtbl mode in message buffers (see [[*The Orgtbl Minor Mode]]), 20375 but instead---after filling in the message headers---turn on Orgtbl 20376 mode manually when needed in the messages body. 20377 20378 - =filladapt.el= by Kyle Jones :: 20379 20380 #+cindex: @file{filladapt.el} 20381 Org mode tries to do the right thing when filling paragraphs, list 20382 items and other elements. Many users reported problems using both 20383 =filladapt.el= and Org mode, so a safe thing to do is to disable 20384 filladapt like this: 20385 20386 #+begin_src emacs-lisp 20387 (add-hook 'org-mode-hook 'turn-off-filladapt-mode) 20388 #+end_src 20389 20390 - =viper.el= by Michael Kifer :: 20391 #+cindex: @file{viper.el} 20392 #+kindex: C-c / 20393 20394 Viper uses {{{kbd(C-c /)}}} and therefore makes this key not access 20395 the corresponding Org mode command ~org-sparse-tree~. You need to 20396 find another key for this command, or override the key in 20397 ~viper-vi-global-user-map~ with 20398 20399 #+begin_src emacs-lisp 20400 (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree) 20401 #+end_src 20402 20403 - =windmove.el= by Hovav Shacham :: 20404 #+cindex: @file{windmove.el} 20405 20406 This package also uses the {{{kbd(S-<cursor>)}}} keys, so everything 20407 written in the paragraph above about CUA mode also applies here. If 20408 you want to make the windmove function active in locations where Org 20409 mode does not have special functionality on {{{kbd(S-<cursor>)}}}, 20410 add this to your configuration: 20411 20412 #+begin_src emacs-lisp 20413 ;; Make windmove work in Org mode: 20414 (add-hook 'org-shiftup-final-hook 'windmove-up) 20415 (add-hook 'org-shiftleft-final-hook 'windmove-left) 20416 (add-hook 'org-shiftdown-final-hook 'windmove-down) 20417 (add-hook 'org-shiftright-final-hook 'windmove-right) 20418 #+end_src 20419 20420 - =yasnippet.el= :: 20421 20422 #+cindex: @file{yasnippet.el} 20423 The way Org mode binds the {{{kbd(TAB)}}} key (binding to ~[tab]~ 20424 instead of ~"\t"~) overrules YASnippet's access to this key. The 20425 following code fixed this problem: 20426 20427 #+begin_src emacs-lisp 20428 (add-hook 'org-mode-hook 20429 (lambda () 20430 (setq-local yas/trigger-key [tab]) 20431 (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand))) 20432 #+end_src 20433 20434 The latest version of YASnippet does not play well with Org mode. 20435 If the above code does not fix the conflict, start by defining 20436 the following function: 20437 20438 #+begin_src emacs-lisp 20439 (defun yas/org-very-safe-expand () 20440 (let ((yas/fallback-behavior 'return-nil)) (yas/expand))) 20441 #+end_src 20442 20443 Then, tell Org mode to use that function: 20444 20445 #+begin_src emacs-lisp 20446 (add-hook 'org-mode-hook 20447 (lambda () 20448 (make-variable-buffer-local 'yas/trigger-key) 20449 (setq yas/trigger-key [tab]) 20450 (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand) 20451 (define-key yas/keymap [tab] 'yas/next-field))) 20452 #+end_src 20453 20454 ** Using Org on a TTY 20455 :PROPERTIES: 20456 :DESCRIPTION: Using Org on a tty. 20457 :ALT_TITLE: TTY Keys 20458 :END: 20459 #+cindex: tty key bindings 20460 20461 Org provides alternative key bindings for TTY and modern mobile 20462 devices that cannot perform movement commands on point and key 20463 bindings with modifier keys. Some of these workarounds may be more 20464 cumbersome than necessary. Users should look into customizing these 20465 further based on their usage needs. For example, the normal 20466 {{{kbd(S-<cursor>)}}} for editing timestamp might be better with 20467 {{{kbd(C-c .)}}} chord. 20468 20469 #+attr_texinfo: :columns 0.2 0.28 0.15 0.21 20470 | Default | Alternative 1 | Speed key | Alternative 2 | 20471 |----------------------+--------------------------+--------------+----------------------| 20472 | {{{kbd(S-TAB)}}} | {{{kbd(C-u TAB)}}} | {{{kbd(C)}}} | | 20473 | {{{kbd(M-LEFT)}}} | {{{kbd(C-c C-x l)}}} | {{{kbd(l)}}} | {{{kbd(Esc LEFT)}}} | 20474 | {{{kbd(M-S-LEFT)}}} | {{{kbd(C-c C-x L)}}} | {{{kbd(L)}}} | | 20475 | {{{kbd(M-RIGHT)}}} | {{{kbd(C-c C-x r)}}} | {{{kbd(r)}}} | {{{kbd(Esc RIGHT)}}} | 20476 | {{{kbd(M-S-RIGHT)}}} | {{{kbd(C-c C-x R)}}} | {{{kbd(R)}}} | | 20477 | {{{kbd(M-UP)}}} | {{{kbd(C-c C-x u)}}} | | {{{kbd(Esc UP)}}} | 20478 | {{{kbd(M-S-UP)}}} | {{{kbd(C-c C-x U)}}} | {{{kbd(U)}}} | | 20479 | {{{kbd(M-DOWN)}}} | {{{kbd(C-c C-x d)}}} | | {{{kbd(Esc DOWN)}}} | 20480 | {{{kbd(M-S-DOWN)}}} | {{{kbd(C-c C-x D)}}} | {{{kbd(D)}}} | | 20481 | {{{kbd(S-RET)}}} | {{{kbd(C-c C-x c)}}} | | | 20482 | {{{kbd(M-RET)}}} | {{{kbd(C-c C-x m)}}} | | {{{kbd(Esc RET)}}} | 20483 | {{{kbd(M-S-RET)}}} | {{{kbd(C-c C-x M)}}} | | | 20484 | {{{kbd(S-LEFT)}}} | {{{kbd(C-c LEFT)}}} | | | 20485 | {{{kbd(S-RIGHT)}}} | {{{kbd(C-c RIGHT)}}} | | | 20486 | {{{kbd(S-UP)}}} | {{{kbd(C-c UP)}}} | | | 20487 | {{{kbd(S-DOWN)}}} | {{{kbd(C-c DOWN)}}} | | | 20488 | {{{kbd(C-S-LEFT)}}} | {{{kbd(C-c C-x LEFT)}}} | | | 20489 | {{{kbd(C-S-RIGHT)}}} | {{{kbd(C-c C-x RIGHT)}}} | | | 20490 20491 ** Protocols for External Access 20492 :PROPERTIES: 20493 :DESCRIPTION: External access to Emacs and Org. 20494 :ALT_TITLE: Protocols 20495 :END: 20496 #+cindex: protocols, for external access 20497 20498 Org protocol is a tool to trigger custom actions in Emacs from 20499 external applications. Any application that supports calling external 20500 programs with an URL as argument may be used with this functionality. 20501 For example, you can configure bookmarks in your web browser to send a 20502 link to the current page to Org and create a note from it using 20503 capture (see [[*Capture]]). You can also create a bookmark that tells 20504 Emacs to open the local source file of a remote website you are 20505 browsing. 20506 20507 #+cindex: Org protocol, set-up 20508 #+cindex: Installing Org protocol 20509 In order to use Org protocol from an application, you need to register 20510 =org-protocol://= as a valid scheme-handler. External calls are 20511 passed to Emacs through the =emacsclient= command, so you also need to 20512 ensure an Emacs server is running. More precisely, when the 20513 application calls 20514 20515 : emacsclient "org-protocol://PROTOCOL?key1=val1&key2=val2" 20516 20517 #+texinfo: @noindent 20518 Emacs calls the handler associated to {{{var(PROTOCOL)}}} with 20519 argument =(:key1 val1 :key2 val2)=. 20520 20521 #+cindex: protocol, new protocol 20522 #+cindex: defining new protocols 20523 Org protocol comes with three predefined protocols, detailed in the 20524 following sections. Configure ~org-protocol-protocol-alist~ to define 20525 your own. 20526 20527 *** The ~store-link~ protocol 20528 :PROPERTIES: 20529 :DESCRIPTION: Store a link, push URL to kill-ring. 20530 :END: 20531 #+cindex: store-link protocol 20532 #+cindex: protocol, store-link 20533 20534 Using the ~store-link~ handler, you can copy links, to that they can 20535 be inserted using {{{kbd(M-x org-insert-link)}}} or yanking. More 20536 precisely, the command 20537 20538 : emacsclient "org-protocol://store-link?url=URL&title=TITLE" 20539 20540 #+texinfo: @noindent 20541 stores the following link: 20542 20543 : [[URL][TITLE]] 20544 20545 In addition, {{{var(URL)}}} is pushed on the kill-ring for yanking. 20546 You need to encode {{{var(URL)}}} and {{{var(TITLE)}}} if they contain 20547 slashes, and probably quote those for the shell. 20548 20549 To use this feature from a browser, add a bookmark with an arbitrary 20550 name, e.g., =Org: store-link= and enter this as /Location/: 20551 20552 #+begin_example 20553 javascript:location.href='org-protocol://store-link?' + 20554 new URLSearchParams({url:location.href, title:document.title}); 20555 #+end_example 20556 20557 Title is an optional parameter. Another expression was recommended earlier: 20558 20559 #+begin_example 20560 javascript:location.href='org-protocol://store-link?url='+ 20561 encodeURIComponent(location.href); 20562 #+end_example 20563 20564 The latter form is compatible with older Org versions from 9.0 to 9.4. 20565 20566 *** The ~capture~ protocol 20567 :PROPERTIES: 20568 :DESCRIPTION: Fill a buffer with external information. 20569 :END: 20570 #+cindex: capture protocol 20571 #+cindex: protocol, capture 20572 20573 Activating the "capture" handler pops up a =Capture= buffer in Emacs, 20574 using acapture template. 20575 20576 : emacsclient "org-protocol://capture?template=X&url=URL&title=TITLE&body=BODY" 20577 20578 To use this feature, add a bookmark with an arbitrary name, e.g., 20579 =Org: capture=, and enter this as =Location=: 20580 20581 #+begin_example 20582 javascript:location.href='org-protocol://capture?' + 20583 new URLSearchParams({ 20584 template: 'x', url: window.location.href, 20585 title: document.title, body: window.getSelection()}); 20586 #+end_example 20587 20588 You might have seen another expression: 20589 20590 #+begin_example 20591 javascript:location.href='org-protocol://capture?template=x'+ 20592 '&url='+encodeURIComponent(window.location.href)+ 20593 '&title='+encodeURIComponent(document.title)+ 20594 '&body='+encodeURIComponent(window.getSelection()); 20595 #+end_example 20596 20597 It is a bit more cluttered than the former one, but it is compatible 20598 with previous Org versions 9.0-9.4. In these versions encoding of 20599 space as "+" character was not supported by URI decoder. 20600 20601 #+vindex: org-protocol-default-template-key 20602 The capture template to be used can be specified in the bookmark (like 20603 =X= above). If unspecified, the template key is set in the variable 20604 ~org-protocol-default-template-key~. The following template 20605 placeholders are available: 20606 20607 #+begin_example 20608 %:link The URL 20609 %:description The webpage title 20610 %:annotation Equivalent to [[%:link][%:description]] 20611 %i The selected text 20612 #+end_example 20613 20614 *** The ~open-source~ protocol 20615 :PROPERTIES: 20616 :DESCRIPTION: Edit published contents. 20617 :END: 20618 #+cindex: open-source protocol 20619 #+cindex: protocol, open-source 20620 20621 The ~open-source~ handler is designed to help with editing local 20622 sources when reading a document. To that effect, you can use 20623 a bookmark with the following location: 20624 20625 #+begin_example 20626 javascript:location.href='org-protocol://open-source?&url='+ 20627 encodeURIComponent(location.href) 20628 #+end_example 20629 20630 #+vindex: org-protocol-project-alist 20631 The variable ~org-protocol-project-alist~ maps URLs to local file 20632 names, by stripping URL parameters from the end and replacing the 20633 ~:base-url~ with ~:working-directory~ and ~:online-suffix~ with 20634 ~:working-suffix~. For example, assuming you own a local copy of 20635 =https://orgmode.org/worg/= contents at =/home/user/worg=, you can set 20636 ~org-protocol-project-alist~ to the following 20637 20638 #+begin_src emacs-lisp 20639 (setq org-protocol-project-alist 20640 '(("Worg" 20641 :base-url "https://orgmode.org/worg/" 20642 :working-directory "/home/user/worg/" 20643 :online-suffix ".html" 20644 :working-suffix ".org"))) 20645 #+end_src 20646 20647 #+texinfo: @noindent 20648 If you are now browsing 20649 =https://orgmode.org/worg/org-contrib/org-protocol.html= and find 20650 a typo or have an idea about how to enhance the documentation, simply 20651 click the bookmark and start editing. 20652 20653 #+cindex: rewritten URL in open-source protocol 20654 #+cindex: protocol, open-source rewritten URL 20655 However, such mapping may not always yield the desired results. 20656 Suppose you maintain an online store located at =https://example.com/=. 20657 The local sources reside in =/home/user/example/=. It is common 20658 practice to serve all products in such a store through one file and 20659 rewrite URLs that do not match an existing file on the server. That 20660 way, a request to =https://example.com/print/posters.html= might be 20661 rewritten on the server to something like 20662 =https://example.com/shop/products.php/posters.html.php=. The 20663 ~open-source~ handler probably cannot find a file named 20664 =/home/user/example/print/posters.html.php= and fails. 20665 20666 Such an entry in ~org-protocol-project-alist~ may hold an additional 20667 property ~:rewrites~. This property is a list of cons cells, each of 20668 which maps a regular expression to a path relative to the 20669 ~:working-directory~. 20670 20671 Now map the URL to the path =/home/user/example/products.php= by 20672 adding ~:rewrites~ rules like this: 20673 20674 #+begin_src emacs-lisp 20675 (setq org-protocol-project-alist 20676 '(("example.com" 20677 :base-url "https://example.com/" 20678 :working-directory "/home/user/example/" 20679 :online-suffix ".php" 20680 :working-suffix ".php" 20681 :rewrites (("example.com/print/" . "products.php") 20682 ("example.com/$" . "index.php"))))) 20683 #+end_src 20684 20685 #+texinfo: @noindent 20686 Since =example.com/$= is used as a regular expression, it maps 20687 =http://example.com/=, =https://example.com=, 20688 =http://www.example.com/= and similar to 20689 =/home/user/example/index.php=. 20690 20691 The ~:rewrites~ rules are searched as a last resort if and only if no 20692 existing file name is matched. 20693 20694 #+cindex: protocol, open-source, set-up mapping 20695 #+cindex: mappings in open-source protocol 20696 #+findex: org-protocol-create 20697 #+findex: org-protocol-create-for-org 20698 Two functions can help you filling ~org-protocol-project-alist~ with 20699 valid contents: ~org-protocol-create~ and 20700 ~org-protocol-create-for-org~. The latter is of use if you're editing 20701 an Org file that is part of a publishing project. 20702 ** Org Crypt 20703 :PROPERTIES: 20704 :DESCRIPTION: Encrypting Org files. 20705 :END: 20706 20707 Org Crypt encrypts the text of an entry, but not the headline, or 20708 properties. Behind the scene, it uses the [[info:epa][Emacs EasyPG Library]] to 20709 encrypt and decrypt files, and EasyPG needs a correct [[info:gnupg][GnuPG]] setup. 20710 20711 #+vindex: org-crypt-tag-matcher 20712 Any text below a headline that has a =crypt= tag is automatically 20713 encrypted when the file is saved. To use a different tag, customize 20714 the ~org-crypt-tag-matcher~ setting. 20715 20716 Here is a suggestion for Org Crypt settings in Emacs init file: 20717 20718 #+begin_src emacs-lisp 20719 (require 'org-crypt) 20720 (org-crypt-use-before-save-magic) 20721 (setq org-tags-exclude-from-inheritance '("crypt")) 20722 20723 (setq org-crypt-key nil) 20724 ;; GPG key to use for encryption. 20725 ;; nil means use symmetric encryption unconditionally. 20726 ;; "" means use symmetric encryption unless heading sets CRYPTKEY property. 20727 20728 (setq auto-save-default nil) 20729 ;; Auto-saving does not cooperate with org-crypt.el: so you need to 20730 ;; turn it off if you plan to use org-crypt.el quite often. Otherwise, 20731 ;; you'll get an (annoying) message each time you start Org. 20732 20733 ;; To turn it off only locally, you can insert this: 20734 ;; 20735 ;; # -*- buffer-auto-save-file-name: nil; -*- 20736 #+end_src 20737 20738 It's possible to use different keys for different headings by 20739 specifying the respective key as property =CRYPTKEY=, e.g.: 20740 20741 #+begin_example 20742 ,* Totally secret :crypt: 20743 :PROPERTIES: 20744 :CRYPTKEY: 0x0123456789012345678901234567890123456789 20745 :END: 20746 #+end_example 20747 20748 Note that =CRYPTKEY= property is only effective when ~org-crypt-key~ 20749 is set to non-nil. ~nil~ value of ~org-crypt-key~ makes Org use 20750 symmetric encryption unconditionally. 20751 20752 Excluding the =crypt= tag from inheritance prevents already encrypted 20753 text from being encrypted again. 20754 20755 ** Org Mobile 20756 :PROPERTIES: 20757 :DESCRIPTION: Viewing and capture on a mobile device. 20758 :END: 20759 #+cindex: smartphone 20760 20761 Org Mobile is a protocol for synchronizing Org files between Emacs and 20762 other applications, e.g., on mobile devices. It enables offline-views 20763 and capture support for an Org mode system that is rooted on a "real" 20764 computer. The external application can also record changes to 20765 existing entries. 20766 20767 This appendix describes Org's support for agenda view formats 20768 compatible with Org Mobile. It also describes synchronizing changes, 20769 such as to notes, between the mobile application and the computer. 20770 20771 To change tags and TODO states in the mobile application, first 20772 customize the variables ~org-todo-keywords~, ~org-tag-alist~ and 20773 ~org-tag-persistent-alist~. These should cover all the important tags 20774 and TODO keywords, even if Org files use only some of them. Though 20775 the mobile application is expected to support in-buffer settings, it 20776 is required to understand TODO states /sets/ (see [[*Setting up keywords 20777 for individual files]]) and /mutually exclusive/ tags (see [[*Setting 20778 Tags]]) only for those set in these variables. 20779 20780 *** Setting up the staging area 20781 :PROPERTIES: 20782 :DESCRIPTION: For the mobile device. 20783 :END: 20784 20785 #+vindex: org-mobile-directory 20786 The mobile application needs access to a file directory on 20787 a server[fn:51] to interact with Emacs. Pass its location through 20788 the ~org-mobile-directory~ variable. If you can mount that directory 20789 locally just set the variable to point to that directory: 20790 20791 #+begin_src emacs-lisp 20792 (setq org-mobile-directory "~/orgmobile/") 20793 #+end_src 20794 20795 Alternatively, by using TRAMP (see [[info:tramp][TRAMP User Manual]]), 20796 ~org-mobile-directory~ may point to a remote directory accessible 20797 through, for example, SSH, SCP, or DAVS: 20798 20799 #+begin_src emacs-lisp 20800 (setq org-mobile-directory "/davs:user@remote.host:/org/webdav/") 20801 #+end_src 20802 20803 #+vindex: org-mobile-encryption 20804 With a public server, consider encrypting the files. Org also 20805 requires OpenSSL installed on the local computer. To turn on 20806 encryption, set the same password in the mobile application and in 20807 Emacs. Set the password in the variable 20808 ~org-mobile-use-encryption~[fn:: If Emacs is configured for safe 20809 storing of passwords, then configure the variable 20810 ~org-mobile-encryption-password~; please read the docstring of that 20811 variable.]. Note that even after the mobile application encrypts the 20812 file contents, the file name remains visible on the file systems of 20813 the local computer, the server, and the mobile device. 20814 20815 *** Pushing to the mobile application 20816 :PROPERTIES: 20817 :DESCRIPTION: Uploading Org files and agendas. 20818 :END: 20819 20820 #+findex: org-mobile-push 20821 #+vindex: org-mobile-files 20822 The command ~org-mobile-push~ copies files listed in 20823 ~org-mobile-files~ into the staging area. Files include agenda files 20824 (as listed in ~org-agenda-files~). Customize ~org-mobile-files~ to 20825 add other files. File names are staged with paths relative to 20826 ~org-directory~, so all files should be inside this directory[fn:: 20827 Symbolic links in ~org-directory~ need to have the same name as their 20828 targets.]. 20829 20830 Push creates a special Org file =agendas.org= with custom agenda views 20831 defined by the user[fn:52]. 20832 20833 Finally, Org writes the file =index.org=, containing links to other 20834 files. The mobile application reads this file first from the server 20835 to determine what other files to download for agendas. For faster 20836 downloads, it is expected to only read files whose checksums[fn:: 20837 Checksums are stored automatically in the file =checksums.dat=.] have 20838 changed. 20839 20840 *** Pulling from the mobile application 20841 :PROPERTIES: 20842 :DESCRIPTION: Integrating captured and flagged items. 20843 :END: 20844 20845 #+findex: org-mobile-pull 20846 The command ~org-mobile-pull~ synchronizes changes with the server. 20847 More specifically, it first pulls the Org files for viewing. It then 20848 appends captured entries and pointers to flagged or changed entries to 20849 the file =mobileorg.org= on the server. Org ultimately integrates its 20850 data in an inbox file format, through the following steps: 20851 20852 1. 20853 #+vindex: org-mobile-inbox-for-pull 20854 Org moves all entries found in =mobileorg.org=[fn:: The file will 20855 be empty after this operation.] and appends them to the file 20856 pointed to by the variable ~org-mobile-inbox-for-pull~. It should 20857 reside neither in the staging area nor on the server. Each 20858 captured entry and each editing event is a top-level entry in the 20859 inbox file. 20860 20861 2. 20862 #+cindex: @samp{FLAGGED}, tag 20863 After moving the entries, Org processes changes to the shared 20864 files. Some of them are applied directly and without user 20865 interaction. Examples include changes to tags, TODO state, 20866 headline and body text. Entries requiring further action are 20867 tagged as =FLAGGED=. Org marks entries with problems with an error 20868 message in the inbox. They have to be resolved manually. 20869 20870 3. Org generates an agenda view for flagged entries for user 20871 intervention to clean up. For notes stored in flagged entries, Org 20872 displays them in the echo area when point is on the corresponding 20873 agenda item. 20874 20875 - {{{kbd(?)}}} :: 20876 20877 Pressing {{{kbd(?)}}} displays the entire flagged note in another 20878 window. Org also pushes it to the kill ring. To store flagged 20879 note as a normal note, use {{{kbd(? z C-y C-c C-c)}}}. Pressing 20880 {{{kbd(?)}}} twice does these things: first it removes the 20881 =FLAGGED= tag; second, it removes the flagged note from the 20882 property drawer; third, it signals that manual editing of the 20883 flagged entry is now finished. 20884 20885 #+kindex: ? @r{(Agenda dispatcher)} 20886 From the agenda dispatcher, {{{kbd(?)}}} returns to the view to finish 20887 processing flagged entries. Note that these entries may not be the 20888 most recent since the mobile application searches files that were last 20889 pulled. To get an updated agenda view with changes since the last 20890 pull, pull again. 20891 20892 * Hacking 20893 :PROPERTIES: 20894 :DESCRIPTION: How to hack your way around. 20895 :APPENDIX: t 20896 :END: 20897 #+cindex: hacking 20898 20899 This appendix describes some ways a user can extend the functionality 20900 of Org. 20901 20902 ** Hooks 20903 :PROPERTIES: 20904 :DESCRIPTION: How to reach into Org's internals. 20905 :END: 20906 #+cindex: hooks 20907 20908 Org has a large number of hook variables for adding functionality. 20909 This appendix illustrates using a few. A complete list of hooks with 20910 documentation is maintained by the Worg project at 20911 https://orgmode.org/worg/doc.html#hooks. 20912 20913 ** Add-on Packages 20914 :PROPERTIES: 20915 :DESCRIPTION: Available extensions. 20916 :END: 20917 #+cindex: add-on packages 20918 20919 Various authors wrote a large number of add-on packages for Org. Some 20920 of these packages used to be part of the =org-mode= repository but are 20921 now hosted in a separate =org-contrib= repository 20922 [[https://git.sr.ht/~bzg/org-contrib][here]]. A Worg page with more 20923 information is at: https://orgmode.org/worg/org-contrib/. 20924 20925 ** Adding Hyperlink Types 20926 :PROPERTIES: 20927 :DESCRIPTION: New custom link types. 20928 :END: 20929 #+cindex: hyperlinks, adding new types 20930 20931 Org has many built-in hyperlink types (see [[*Hyperlinks]]), and an 20932 interface for adding new link types. The following example shows the 20933 process of adding Org links to Unix man pages, which look like this 20934 20935 : [[man:printf][The printf manual]] 20936 20937 #+texinfo: @noindent 20938 The following =ol-man.el= file implements it 20939 20940 #+begin_src emacs-lisp 20941 ;;; ol-man.el - Support for links to man pages in Org mode 20942 (require 'ol) 20943 20944 (org-link-set-parameters "man" 20945 :follow #'org-man-open 20946 :export #'org-man-export 20947 :store #'org-man-store-link) 20948 20949 (defcustom org-man-command 'man 20950 "The Emacs command to be used to display a man page." 20951 :group 'org-link 20952 :type '(choice (const man) (const woman))) 20953 20954 (defun org-man-open (path _) 20955 "Visit the manpage on PATH. 20956 PATH should be a topic that can be thrown at the man command." 20957 (funcall org-man-command path)) 20958 20959 (defun org-man-store-link () 20960 "Store a link to a man page." 20961 (when (memq major-mode '(Man-mode woman-mode)) 20962 ;; This is a man page, we do make this link. 20963 (let* ((page (org-man-get-page-name)) 20964 (link (concat "man:" page)) 20965 (description (format "Man page for %s" page))) 20966 (org-link-store-props 20967 :type "man" 20968 :link link 20969 :description description)))) 20970 20971 (defun org-man-get-page-name () 20972 "Extract the page name from the buffer name." 20973 ;; This works for both `Man-mode' and `woman-mode'. 20974 (if (string-match " \\(\\S-+\\)\\*" (buffer-name)) 20975 (match-string 1 (buffer-name)) 20976 (error "Cannot create link to this man page"))) 20977 20978 (defun org-man-export (link description format _) 20979 "Export a man page link from Org files." 20980 (let ((path (format "http://man.he.net/?topic=%s§ion=all" link)) 20981 (desc (or description link))) 20982 (pcase format 20983 (`html (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc)) 20984 (`latex (format "\\href{%s}{%s}" path desc)) 20985 (`texinfo (format "@uref{%s,%s}" path desc)) 20986 (`ascii (format "%s (%s)" desc path)) 20987 (t path)))) 20988 20989 (provide ol-man) 20990 ;;; ol-man.el ends here 20991 #+end_src 20992 20993 #+texinfo: @noindent 20994 To activate links to man pages in Org, enter this in the Emacs init 20995 file: 20996 20997 #+begin_src emacs-lisp 20998 (require 'ol-man) 20999 #+end_src 21000 21001 #+texinfo: @noindent 21002 A review of =ol-man.el=: 21003 21004 1. First, =(require 'ol)= ensures that =ol.el= is loaded. 21005 21006 2. 21007 21008 #+findex: org-link-set-parameters 21009 #+vindex: org-link-parameters 21010 Then ~org-link-set-parameters~ defines a new link type with =man= 21011 prefix and associates functions for following, exporting and 21012 storing such links. See the variable ~org-link-parameters~ for 21013 a complete list of possible associations. 21014 21015 3. The rest of the file implements necessary variables and functions. 21016 21017 For example, ~org-man-store-link~ is responsible for storing a link 21018 when ~org-store-link~ (see [[*Handling Links]]) is called from a buffer 21019 displaying a man page. It first checks if the major mode is 21020 appropriate. If check fails, the function returns ~nil~, which 21021 means it isn't responsible for creating a link to the current 21022 buffer. Otherwise the function makes a link string by combining 21023 the =man:= prefix with the man topic. It also provides a default 21024 description. The function ~org-insert-link~ can insert it back 21025 into an Org buffer later on. 21026 21027 ** Adding Export Back-ends 21028 :PROPERTIES: 21029 :DESCRIPTION: How to write new export back-ends. 21030 :END: 21031 #+cindex: Export, writing back-ends 21032 21033 Org's export engine makes it easy for writing new back-ends. The 21034 framework on which the engine was built makes it easy to derive new 21035 back-ends from existing ones. 21036 21037 #+findex: org-export-define-backend 21038 #+findex: org-export-define-derived-backend 21039 The two main entry points to the export engine are: 21040 ~org-export-define-backend~ and ~org-export-define-derived-backend~. 21041 To grok these functions, see =ox-latex.el= for an example of defining 21042 a new back-end from scratch, and =ox-beamer.el= for an example of 21043 deriving from an existing engine. 21044 21045 For creating a new back-end from scratch, first set its name as 21046 a symbol in an alist consisting of elements and export functions. To 21047 make the back-end visible to the export dispatcher, set ~:menu-entry~ 21048 keyword. For export options specific to this back-end, set the 21049 ~:options-alist~. 21050 21051 For creating a new back-end from an existing one, set 21052 ~:translate-alist~ to an alist of export functions. This alist 21053 replaces the parent back-end functions. 21054 21055 For complete documentation, see [[https://orgmode.org/worg/dev/org-export-reference.html][the Org Export Reference on Worg]]. 21056 21057 ** Tables in Arbitrary Syntax 21058 :PROPERTIES: 21059 :DESCRIPTION: Orgtbl for LaTeX and other programs. 21060 :END: 21061 #+cindex: tables, in other modes 21062 #+cindex: lists, in other modes 21063 #+cindex: Orgtbl mode 21064 21065 Due to Org's success in handling tables with Orgtbl, a frequently 21066 requested feature is the use of Org's table functions in other modes, 21067 e.g., LaTeX. This would be hard to do in a general way without 21068 complicated customization nightmares. Moreover, that would take Org 21069 away from its simplicity roots that Orgtbl has proven. There is, 21070 however, an alternate approach to accomplishing the same. 21071 21072 This approach involves implementing a custom /translate/ function that 21073 operates on a native Org /source table/ to produce a table in another 21074 format. This strategy would keep the excellently working Orgtbl 21075 simple and isolate complications, if any, confined to the translate 21076 function. To add more alien table formats, we just add more translate 21077 functions. Also the burden of developing custom translate functions 21078 for new table formats is in the hands of those who know those formats 21079 best. 21080 21081 *** Radio tables 21082 :PROPERTIES: 21083 :DESCRIPTION: Sending and receiving radio tables. 21084 :END: 21085 #+cindex: radio tables 21086 21087 Radio tables are target locations for translated tables that are not near 21088 their source. Org finds the target location and inserts the translated 21089 table. 21090 21091 The key to finding the target location is the magic words =BEGIN/END 21092 RECEIVE ORGTBL=. They have to appear as comments in the current mode. 21093 If the mode is C, then: 21094 21095 #+begin_example 21096 /* BEGIN RECEIVE ORGTBL table_name */ 21097 /* END RECEIVE ORGTBL table_name */ 21098 #+end_example 21099 21100 At the location of source, Org needs a special line to direct Orgtbl 21101 to translate and to find the target for inserting the translated 21102 table. For example: 21103 21104 #+cindex: @samp{ORGTBL}, keyword 21105 : #+ORGTBL: SEND table_name translation_function arguments ... 21106 21107 #+texinfo: @noindent 21108 =table_name= is the table's reference name, which is also used in the 21109 receiver lines, and the =translation_function= is the Lisp function 21110 that translates. This line, in addition, may also contain alternating 21111 key and value arguments at the end. The translation function gets 21112 these values as a property list. A few standard parameters are 21113 already recognized and acted upon before the translation function is 21114 called: 21115 21116 - =:skip N= :: 21117 21118 Skip the first N lines of the table. Hlines do count; include them 21119 if they are to be skipped. 21120 21121 - =:skipcols (n1 n2 ...)= :: 21122 21123 List of columns to be skipped. First Org automatically discards 21124 columns with calculation marks and then sends the table to the 21125 translator function, which then skips columns as specified in 21126 =skipcols=. 21127 21128 To keep the source table intact in the buffer without being disturbed 21129 when the source file is compiled or otherwise being worked on, use one 21130 of these strategies: 21131 21132 - Place the table in a block comment. For example, in C mode you 21133 could wrap the table between =/*= and =*/= lines. 21134 21135 - Put the table after an "end" statement. For example ~\bye~ in TeX 21136 and ~\end{document}~ in LaTeX. 21137 21138 - Comment and un-comment each line of the table during edits. The 21139 {{{kbd(M-x orgtbl-toggle-comment)}}} command makes toggling easy. 21140 21141 *** A LaTeX example of radio tables 21142 :PROPERTIES: 21143 :DESCRIPTION: Step by step, almost a tutorial. 21144 :ALT_TITLE: A LaTeX example 21145 :END: 21146 #+cindex: @LaTeX{}, and Orgtbl mode 21147 21148 To wrap a source table in LaTeX, use the =comment= environment 21149 provided by =comment.sty=[fn:: https://www.ctan.org/pkg/comment]. To 21150 activate it, put ~\usepackage{comment}~ in the document header. 21151 Orgtbl mode inserts a radio table skeleton[fn:53] with the command 21152 {{{kbd(M-x orgtbl-insert-radio-table)}}}, which prompts for a table 21153 name. For example, if =salesfigures= is the name, the template 21154 inserts: 21155 21156 #+begin_example 21157 % BEGIN RECEIVE ORGTBL salesfigures 21158 % END RECEIVE ORGTBL salesfigures 21159 \begin{comment} 21160 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex 21161 | | | 21162 \end{comment} 21163 #+end_example 21164 21165 #+vindex: LaTeX-verbatim-environments 21166 #+texinfo: @noindent 21167 The line =#+ORGTBL: SEND= tells Orgtbl mode to use the function 21168 ~orgtbl-to-latex~ to convert the table to LaTeX format, then insert 21169 the table at the target (receive) location named =salesfigures=. Now 21170 the table is ready for data entry. It can even use spreadsheet 21171 features[fn:54]: 21172 21173 #+begin_example 21174 % BEGIN RECEIVE ORGTBL salesfigures 21175 % END RECEIVE ORGTBL salesfigures 21176 \begin{comment} 21177 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex 21178 | Month | Days | Nr sold | per day | 21179 |-------+------+---------+---------| 21180 | Jan | 23 | 55 | 2.4 | 21181 | Feb | 21 | 16 | 0.8 | 21182 | March | 22 | 278 | 12.6 | 21183 ,#+TBLFM: $4=$3/$2;%.1f 21184 % $ (optional extra dollar to keep Font Lock happy, see footnote) 21185 \end{comment} 21186 #+end_example 21187 21188 After editing, {{{kbd(C-c C-c)}}} inserts the translated table at the 21189 target location, between the two marker lines. 21190 21191 For hand-made custom tables, note that the translator needs to skip 21192 the first two lines of the source table. Also the command has to 21193 /splice/ out the target table without the header and footer. 21194 21195 #+begin_example 21196 \begin{tabular}{lrrr} 21197 Month & \multicolumn{1}{c}{Days} & Nr.\ sold & per day\\ 21198 % BEGIN RECEIVE ORGTBL salesfigures 21199 % END RECEIVE ORGTBL salesfigures 21200 \end{tabular} 21201 % 21202 \begin{comment} 21203 ,#+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2 21204 | Month | Days | Nr sold | per day | 21205 |-------+------+---------+---------| 21206 | Jan | 23 | 55 | 2.4 | 21207 | Feb | 21 | 16 | 0.8 | 21208 | March | 22 | 278 | 12.6 | 21209 ,#+TBLFM: $4=$3/$2;%.1f 21210 \end{comment} 21211 #+end_example 21212 21213 The LaTeX translator function ~orgtbl-to-latex~ is already part of 21214 Orgtbl mode and uses a =tabular= environment to typeset the table and 21215 marks horizontal lines with ~\hline~. For additional parameters to 21216 control output, see [[*Translator functions]]: 21217 21218 - =:splice BOOLEAN= :: 21219 21220 When {{{var(BOOLEAN}}} is non-~nil~, return only table body lines; 21221 i.e., not wrapped in =tabular= environment. Default is ~nil~. 21222 21223 - =:fmt FMT= :: 21224 21225 Format string to warp each field. It should contain =%s= for the 21226 original field value. For example, to wrap each field value in 21227 dollar symbol, you could use =:fmt "$%s$"=. Format can also wrap 21228 a property list with column numbers and formats, for example =:fmt 21229 (2 "$%s$" 4 "%s\\%%")=. In place of a string, a function of one 21230 argument can be used; the function must return a formatted string. 21231 21232 - =:efmt EFMT= :: 21233 21234 Format numbers as exponentials. The spec should have =%s= twice for 21235 inserting mantissa and exponent, for example ="%s\\times10^{%s}"=. This 21236 may also be a property list with column numbers and formats, for 21237 example =:efmt (2 "$%s\\times10^{%s}$" 4 "$%s\\cdot10^{%s}$")=. After 21238 {{{var(EFMT)}}} has been applied to a value, {{{var(FMT)}}}---see 21239 above---is also applied. Functions with two arguments can be 21240 supplied instead of strings. By default, no special formatting is 21241 applied. 21242 21243 *** Translator functions 21244 :PROPERTIES: 21245 :DESCRIPTION: Copy and modify. 21246 :END: 21247 #+cindex: HTML, and Orgtbl mode 21248 #+cindex: translator function 21249 21250 #+findex: orgtbl-to-csv 21251 #+findex: orgtbl-to-tsv 21252 #+findex: orgtbl-to-latex 21253 #+findex: orgtbl-to-html 21254 #+findex: orgtbl-to-texinfo 21255 #+findex: orgtbl-to-unicode 21256 #+findex: orgtbl-to-orgtbl 21257 #+findex: orgtbl-to-generic 21258 Orgtbl mode has built-in translator functions: ~orgtbl-to-csv~ 21259 (comma-separated values), ~orgtbl-to-tsv~ (TAB-separated values), 21260 ~orgtbl-to-latex~, ~orgtbl-to-html~, ~orgtbl-to-texinfo~, 21261 ~orgtbl-to-unicode~ and ~orgtbl-to-orgtbl~. They use the generic 21262 translator, ~orgtbl-to-generic~, which delegates translations to 21263 various export back-ends. 21264 21265 Properties passed to the function through the =ORGTBL SEND= line take 21266 precedence over properties defined inside the function. For example, 21267 this overrides the default LaTeX line endings, ~\\~, with ~\\[2mm]~: 21268 21269 : #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]" 21270 21271 For a new language translator, define a converter function. It can be 21272 a generic function, such as shown in this example. It marks 21273 a beginning and ending of a table with =!BTBL!= and =!ETBL!=; 21274 a beginning and ending of lines with =!BL!= and =!EL!=; and uses a TAB 21275 for a field separator: 21276 21277 #+begin_src emacs-lisp 21278 (defun orgtbl-to-language (table params) 21279 "Convert the orgtbl-mode TABLE to language." 21280 (orgtbl-to-generic 21281 table 21282 (org-combine-plists 21283 '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t") 21284 params))) 21285 #+end_src 21286 21287 #+texinfo: @noindent 21288 The documentation for the ~orgtbl-to-generic~ function shows 21289 a complete list of parameters, each of which can be passed through to 21290 ~orgtbl-to-latex~, ~orgtbl-to-texinfo~, and any other function using 21291 that generic function. 21292 21293 For complicated translations the generic translator function could be 21294 replaced by a custom translator function. Such a custom function must 21295 take two arguments and return a single string containing the formatted 21296 table. The first argument is the table whose lines are a list of 21297 fields or the symbol ~hline~. The second argument is the property 21298 list consisting of parameters specified in the =#+ORGTBL: SEND= line. 21299 Please share your translator functions by posting them to the Org 21300 users mailing list, at mailto:emacs-orgmode@gnu.org. 21301 21302 ** Dynamic Blocks 21303 :PROPERTIES: 21304 :DESCRIPTION: Automatically filled blocks. 21305 :END: 21306 #+cindex: dynamic blocks 21307 21308 Org supports /dynamic blocks/ in Org documents. They are inserted 21309 with begin and end markers like any other code block, but the contents 21310 are updated automatically by a user function. 21311 21312 #+kindex: C-c C-x x 21313 #+findex: org-dynamic-block-insert-dblock 21314 You can insert a dynamic block with ~org-dynamic-block-insert-dblock~, 21315 which is bound to {{{kbd(C-c C-x x)}}} by default. For example, 21316 {{{kbd(C-c C-x x c l o c k t a b l e RET)}}} inserts a table that 21317 updates the work time (see [[*Clocking Work Time]]). 21318 21319 Dynamic blocks can have names and function parameters. The syntax is 21320 similar to source code block specifications: 21321 21322 #+begin_example 21323 ,#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ... 21324 ... 21325 ,#+END: 21326 #+end_example 21327 21328 These commands update dynamic blocks: 21329 21330 - {{{kbd(C-c C-x C-u)}}} (~org-dblock-update~) :: 21331 21332 #+kindex: C-c C-x C-u 21333 #+findex: org-dblock-update 21334 Update dynamic block at point. 21335 21336 - {{{kbd(C-u C-c C-x C-u)}}} :: 21337 21338 #+kindex: C-u C-c C-x C-u 21339 Update all dynamic blocks in the current file. 21340 21341 Before updating a dynamic block, Org removes content between the 21342 =BEGIN= and =END= markers. Org then reads the parameters on the 21343 =BEGIN= line for passing to the writer function as a plist. The 21344 previous content of the dynamic block becomes erased from the buffer 21345 and appended to the plist under ~:content~. 21346 21347 The syntax for naming a writer function with a dynamic block labeled 21348 =myblock= is: ~org-dblock-write:myblock~. 21349 21350 The following is an example of a dynamic block and a block writer function 21351 that updates the time when the function was last run: 21352 21353 #+begin_example 21354 ,#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M" 21355 ... 21356 ,#+END: 21357 #+end_example 21358 21359 #+texinfo: @noindent 21360 The dynamic block's writer function: 21361 21362 #+begin_src emacs-lisp 21363 (defun org-dblock-write:block-update-time (params) 21364 (let ((fmt (or (plist-get params :format) "%d. %m. %Y"))) 21365 (insert "Last block update at: " 21366 (format-time-string fmt)))) 21367 #+end_src 21368 21369 To keep dynamic blocks up-to-date in an Org file, use the function, 21370 ~org-update-all-dblocks~ in hook, such as ~before-save-hook~. The 21371 ~org-update-all-dblocks~ function does not run if the file is not in 21372 Org mode. 21373 21374 #+findex: org-narrow-to-block 21375 Dynamic blocks, like any other block, can be narrowed with 21376 ~org-narrow-to-block~. 21377 21378 ** Special Agenda Views 21379 :PROPERTIES: 21380 :DESCRIPTION: Customized views. 21381 :END: 21382 #+cindex: agenda views, user-defined 21383 21384 #+vindex: org-agenda-skip-function 21385 #+vindex: org-agenda-skip-function-global 21386 Org provides a special hook to further limit items in agenda views: 21387 ~agenda~, ~agenda*~[fn:: The ~agenda*~ view is the same as ~agenda~ 21388 except that it only considers /appointments/, i.e., scheduled and 21389 deadline items that have a time specification =[h]h:mm= in their 21390 time-stamps.], ~todo~, ~alltodo~, ~tags~, ~tags-todo~, ~tags-tree~. 21391 Specify a custom function that tests inclusion of every matched item 21392 in the view. This function can also skip as much as is needed. 21393 21394 For a global condition applicable to agenda views, use the 21395 ~org-agenda-skip-function-global~ variable. Org uses a global 21396 condition with ~org-agenda-skip-function~ for custom searching. 21397 21398 This example defines a function for a custom view showing TODO items 21399 with =waiting= status. Manually this is a multi-step search process, 21400 but with a custom view, this can be automated as follows: 21401 21402 The custom function searches the subtree for the =waiting= tag and 21403 returns ~nil~ on match. Otherwise it gives the location from where 21404 the search continues. 21405 21406 #+begin_src emacs-lisp 21407 (defun my-skip-unless-waiting () 21408 "Skip trees that are not waiting" 21409 (let ((subtree-end (save-excursion (org-end-of-subtree t)))) 21410 (if (re-search-forward ":waiting:" subtree-end t) 21411 nil ; tag found, do not skip 21412 subtree-end))) ; tag not found, continue after end of subtree 21413 #+end_src 21414 21415 To use this custom function in a custom agenda command: 21416 21417 #+begin_src emacs-lisp 21418 (org-add-agenda-custom-command 21419 '("b" todo "PROJECT" 21420 ((org-agenda-skip-function 'my-skip-unless-waiting) 21421 (org-agenda-overriding-header "Projects waiting for something: ")))) 21422 #+end_src 21423 21424 #+vindex: org-agenda-overriding-header 21425 Note that this also binds ~org-agenda-overriding-header~ to a more 21426 meaningful string suitable for the agenda view. 21427 21428 #+vindex: org-odd-levels-only 21429 #+vindex: org-agenda-skip-function 21430 #+findex: org-agenda-skip-entry-if 21431 #+findex: org-agenda-skip-subtree-if 21432 Search for entries with a limit set on levels for the custom search. 21433 This is a general approach to creating custom searches in Org. To 21434 include all levels, use =LEVEL>0=[fn:: Note that, for 21435 ~org-odd-levels-only~, a level number corresponds to order in the 21436 hierarchy, not to the number of stars.]. Then to selectively pick the 21437 matched entries, use ~org-agenda-skip-function~, which also accepts 21438 Lisp forms, such as ~org-agenda-skip-entry-if~ and 21439 ~org-agenda-skip-subtree-if~. For example: 21440 21441 - =(org-agenda-skip-entry-if 'scheduled)= :: 21442 21443 Skip current entry if it has been scheduled. 21444 21445 - =(org-agenda-skip-entry-if 'notscheduled)= :: 21446 21447 Skip current entry if it has not been scheduled. 21448 21449 - =(org-agenda-skip-entry-if 'deadline)= :: 21450 21451 Skip current entry if it has a deadline. 21452 21453 - =(org-agenda-skip-entry-if 'scheduled 'deadline)= :: 21454 21455 Skip current entry if it has a deadline, or if it is scheduled. 21456 21457 - =(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))= :: 21458 21459 Skip current entry if the TODO keyword is TODO or WAITING. 21460 21461 - =(org-agenda-skip-entry-if 'todo 'done)= :: 21462 21463 Skip current entry if the TODO keyword marks a DONE state. 21464 21465 - =(org-agenda-skip-entry-if 'timestamp)= :: 21466 21467 Skip current entry if it has any timestamp, may also be deadline or 21468 scheduled. 21469 21470 - =(org-agenda-skip-entry-if 'regexp "regular expression")= :: 21471 21472 Skip current entry if the regular expression matches in the entry. 21473 21474 - =(org-agenda-skip-entry-if 'notregexp "regular expression")= :: 21475 21476 Skip current entry unless the regular expression matches. 21477 21478 - =(org-agenda-skip-subtree-if 'regexp "regular expression")= :: 21479 21480 Same as above, but check and skip the entire subtree. 21481 21482 The following is an example of a search for =waiting= without the 21483 special function: 21484 21485 #+begin_src emacs-lisp 21486 (org-add-agenda-custom-command 21487 '("b" todo "PROJECT" 21488 ((org-agenda-skip-function '(org-agenda-skip-subtree-if 21489 'regexp ":waiting:")) 21490 (org-agenda-overriding-header "Projects waiting for something: ")))) 21491 #+end_src 21492 21493 ** Speeding Up Your Agendas 21494 :PROPERTIES: 21495 :DESCRIPTION: Tips on how to speed up your agendas. 21496 :END: 21497 #+cindex: agenda views, optimization 21498 21499 Some agenda commands slow down when the Org files grow in size or 21500 number. Here are tips to speed up: 21501 21502 - Reduce the number of Org agenda files to avoid slowdowns due to hard drive 21503 accesses. 21504 21505 - Reduce the number of DONE and archived headlines so agenda 21506 operations that skip over these can finish faster. 21507 21508 - Do not dim blocked tasks: 21509 #+vindex: org-agenda-dim-blocked-tasks 21510 21511 #+begin_src emacs-lisp 21512 (setq org-agenda-dim-blocked-tasks nil) 21513 #+end_src 21514 21515 - Stop preparing agenda buffers on startup: 21516 #+vindex: org-startup-folded 21517 #+vindex: org-agenda-inhibit-startup 21518 21519 #+begin_src emacs-lisp 21520 (setq org-agenda-inhibit-startup t) 21521 #+end_src 21522 21523 - Disable tag inheritance for agendas: 21524 #+vindex: org-agenda-show-inherited-tags 21525 #+vindex: org-agenda-use-tag-inheritance 21526 21527 #+begin_src emacs-lisp 21528 (setq org-agenda-use-tag-inheritance nil) 21529 #+end_src 21530 21531 #+vindex: org-agenda-ignore-properties 21532 - Disable parsing of some drawer properties: 21533 21534 #+begin_src emacs-lisp 21535 (setq org-agenda-ignore-properties '(effort appt stats category)) 21536 #+end_src 21537 21538 The drawer properties you can disable in the agenda are effort 21539 estimates (~effort~), appointments (~appt~), statistics (~stats~) 21540 and subtree-local categories (~category~). 21541 21542 These options can be applied to selected agenda views. For more 21543 details about generation of agenda views, see the docstrings for the 21544 relevant variables, and this [[https://orgmode.org/worg/agenda-optimization.html][dedicated Worg page]] for agenda 21545 optimization. 21546 21547 ** Extracting Agenda Information 21548 :PROPERTIES: 21549 :DESCRIPTION: Post-processing agenda information. 21550 :END: 21551 #+cindex: agenda, pipe 21552 #+cindex: scripts, for agenda processing 21553 21554 Org provides commands to access agendas through Emacs batch mode. 21555 Through this command-line interface, agendas are automated for further 21556 processing or printing. 21557 21558 #+vindex: org-agenda-custom-commands 21559 #+findex: org-batch-agenda 21560 ~org-batch-agenda~ creates an agenda view in ASCII and outputs to 21561 standard output. This command takes one string parameter. When 21562 string consists of a single character, Org uses it as a key to 21563 ~org-agenda-custom-commands~. These are the same ones available 21564 through the agenda dispatcher (see [[*The Agenda Dispatcher]]). 21565 21566 This example command line directly prints the TODO list to the printer: 21567 21568 : emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr 21569 21570 When the string parameter length is two or more characters, Org 21571 matches it with tags/TODO strings. For example, this example command 21572 line prints items tagged with =shop=, but excludes items tagged with 21573 =NewYork=: 21574 21575 #+begin_example 21576 emacs -batch -l ~/.emacs \ 21577 -eval '(org-batch-agenda "+shop-NewYork")' | lpr 21578 #+end_example 21579 21580 #+texinfo: @noindent 21581 An example showing on-the-fly parameter modifications: 21582 21583 #+begin_example 21584 emacs -batch -l ~/.emacs \ 21585 -eval '(org-batch-agenda "a" \ 21586 org-agenda-span (quote month) \ 21587 org-agenda-include-diary nil \ 21588 org-agenda-files (quote ("~/org/project.org")))' \ 21589 | lpr 21590 #+end_example 21591 21592 #+texinfo: @noindent 21593 which produces an agenda for the next 30 days from just the 21594 =~/org/projects.org= file. 21595 21596 #+findex: org-batch-agenda-csv 21597 For structured processing of agenda output, use ~org-batch-agenda-csv~ 21598 with the following fields: 21599 21600 - category :: The category of the item 21601 - head :: The headline, without TODO keyword, TAGS and PRIORITY 21602 - type :: The type of the agenda entry, can be 21603 21604 | ~todo~ | selected in TODO match | 21605 | ~tagsmatch~ | selected in tags match | 21606 | ~diary~ | imported from diary | 21607 | ~deadline~ | a deadline | 21608 | ~scheduled~ | scheduled | 21609 | ~timestamp~ | appointment, selected by timestamp | 21610 | ~closed~ | entry was closed on date | 21611 | ~upcoming-deadline~ | warning about nearing deadline | 21612 | ~past-scheduled~ | forwarded scheduled item | 21613 | ~block~ | entry has date block including date | 21614 21615 - todo :: The TODO keyword, if any 21616 - tags :: All tags including inherited ones, separated by colons 21617 - date :: The relevant date, like =2007-2-14= 21618 - time :: The time, like =15:00-16:50= 21619 - extra :: String with extra planning info 21620 - priority-l :: The priority letter if any was given 21621 - priority-n :: The computed numerical priority 21622 21623 If the selection of the agenda item was based on a timestamp, 21624 including those items with =DEADLINE= and =SCHEDULED= keywords, then 21625 Org includes date and time in the output. 21626 21627 If the selection of the agenda item was based on a timestamp (or 21628 deadline/scheduled), then Org includes date and time in the output. 21629 21630 Here is an example of a post-processing script in Perl. It takes the 21631 CSV output from Emacs and prints with a checkbox: 21632 21633 #+begin_src perl 21634 #!/usr/bin/perl 21635 21636 # define the Emacs command to run 21637 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'"; 21638 21639 # run it and capture the output 21640 $agenda = qx{$cmd 2>/dev/null}; 21641 21642 # loop over all lines 21643 foreach $line (split(/\n/,$agenda)) { 21644 # get the individual values 21645 ($category,$head,$type,$todo,$tags,$date,$time,$extra, 21646 $priority_l,$priority_n) = split(/,/,$line); 21647 # process and print 21648 print "[ ] $head\n"; 21649 } 21650 #+end_src 21651 21652 ** Using the Property API 21653 :PROPERTIES: 21654 :DESCRIPTION: Writing programs that use entry properties. 21655 :END: 21656 #+cindex: API, for properties 21657 #+cindex: properties, API 21658 21659 Here is a description of the functions that can be used to work with 21660 properties. 21661 21662 #+attr_texinfo: :options org-entry-properties &optional pom which 21663 #+begin_defun 21664 Get all properties of the entry at point-or-marker {{{var(POM)}}}. 21665 This includes the TODO keyword, the tags, time strings for deadline, 21666 scheduled, and clocking, and any additional properties defined in the 21667 entry. The return value is an alist. Keys may occur multiple times 21668 if the property key was used several times. {{{var(POM)}}} may also 21669 be ~nil~, in which case the current entry is used. If 21670 {{{var(WHICH)}}} is ~nil~ or ~all~, get all properties. If 21671 {{{var(WHICH)}}} is ~special~ or ~standard~, only get that subclass. 21672 #+end_defun 21673 21674 #+vindex: org-use-property-inheritance 21675 #+findex: org-insert-property-drawer 21676 #+attr_texinfo: :options org-entry-get pom property &optional inherit 21677 #+begin_defun 21678 Get value of {{{var(PROPERTY)}}} for entry at point-or-marker 21679 {{{var(POM)}}}. By default, this only looks at properties defined 21680 locally in the entry. If {{{var(INHERIT)}}} is non-~nil~ and the 21681 entry does not have the property, then also check higher levels of the 21682 hierarchy. If {{{var(INHERIT)}}} is the symbol ~selective~, use 21683 inheritance if and only if the setting of 21684 ~org-use-property-inheritance~ selects {{{var(PROPERTY)}}} for 21685 inheritance. 21686 #+end_defun 21687 21688 #+attr_texinfo: :options org-entry-delete pom property 21689 #+begin_defun 21690 Delete the property {{{var(PROPERTY)}}} from entry at point-or-marker 21691 {{{var(POM)}}}. 21692 #+end_defun 21693 21694 #+attr_texinfo: :options org-entry-put pom property value 21695 #+begin_defun 21696 Set {{{var(PROPERTY)}}} to {{{var(VALUES)}}} for entry at 21697 point-or-marker POM. 21698 #+end_defun 21699 21700 #+attr_texinfo: :options org-buffer-property-keys &optional include-specials 21701 #+begin_defun 21702 Get all property keys in the current buffer. 21703 #+end_defun 21704 21705 #+attr_texinfo: :options org-insert-property-drawer 21706 #+begin_defun 21707 Insert a property drawer for the current entry. Also 21708 #+end_defun 21709 21710 #+attr_texinfo: :options org-entry-put-multivalued-property pom property &rest values 21711 #+begin_defun 21712 Set {{{var(PROPERTY)}}} at point-or-marker {{{var(POM)}}} to 21713 {{{var(VALUES)}}}. {{{var(VALUES)}}} should be a list of strings. 21714 They are concatenated, with spaces as separators. 21715 #+end_defun 21716 21717 #+attr_texinfo: :options org-entry-get-multivalued-property pom property 21718 #+begin_defun 21719 Treat the value of the property {{{var(PROPERTY)}}} as 21720 a whitespace-separated list of values and return the values as a list 21721 of strings. 21722 #+end_defun 21723 21724 #+attr_texinfo: :options org-entry-add-to-multivalued-property pom property value 21725 #+begin_defun 21726 Treat the value of the property {{{var(PROPERTY)}}} as 21727 a whitespace-separated list of values and make sure that 21728 {{{var(VALUE)}}} is in this list. 21729 #+end_defun 21730 21731 #+attr_texinfo: :options org-entry-remove-from-multivalued-property pom property value 21732 #+begin_defun 21733 Treat the value of the property {{{var(PROPERTY)}}} as 21734 a whitespace-separated list of values and make sure that 21735 {{{var(VALUE)}}} is /not/ in this list. 21736 #+end_defun 21737 21738 #+attr_texinfo: :options org-entry-member-in-multivalued-property pom property value 21739 #+begin_defun 21740 Treat the value of the property {{{var(PROPERTY)}}} as 21741 a whitespace-separated list of values and check if {{{var(VALUE)}}} is 21742 in this list. 21743 #+end_defun 21744 21745 #+attr_texinfo: :options org-property-allowed-value-functions 21746 #+begin_defopt 21747 Hook for functions supplying allowed values for a specific property. 21748 The functions must take a single argument, the name of the property, 21749 and return a flat list of allowed values. If =:ETC= is one of the 21750 values, use the values as completion help, but allow also other values 21751 to be entered. The functions must return ~nil~ if they are not 21752 responsible for this property. 21753 #+end_defopt 21754 21755 ** Using the Mapping API 21756 :PROPERTIES: 21757 :DESCRIPTION: Mapping over all or selected entries. 21758 :END: 21759 #+cindex: API, for mapping 21760 #+cindex: mapping entries, API 21761 21762 Org has sophisticated mapping capabilities to find all entries 21763 satisfying certain criteria. Internally, this functionality is used 21764 to produce agenda views, but there is also an API that can be used to 21765 execute arbitrary functions for each or selected entries. The main 21766 entry point for this API is: 21767 21768 #+attr_texinfo: :options org-map-entries func &optional match scope &rest skip 21769 #+begin_defun 21770 Call {{{var(FUNC)}}} at each headline selected by {{{var(MATCH)}}} in 21771 {{{var(SCOPE)}}}. 21772 21773 {{{var(FUNC)}}} is a function or a Lisp form. With point positioned 21774 at the beginning of the headline, call the function without arguments. 21775 Org returns a list of return values of calls to the function. 21776 21777 To avoid preserving point, Org wraps the call to {{{var(FUNC)}}} in 21778 ~save-excursion~ form. After evaluation, Org moves point to the end 21779 of the line that was just processed. Search continues from that point 21780 forward. This may not always work as expected under some conditions, 21781 such as if the current subtree was removed by a previous archiving 21782 operation. In such rare circumstances, Org skips the next entry 21783 entirely when it should not. To stop Org from such skips, make 21784 {{{var(FUNC)}}} set the variable ~org-map-continue-from~ to a specific 21785 buffer position. 21786 21787 {{{var(MATCH)}}} is a tags/property/TODO match. Org iterates only 21788 matched headlines. Org iterates over all headlines when 21789 {{{var(MATCH)}}} is ~nil~ or ~t~. 21790 21791 {{{var(SCOPE)}}} determines the scope of this command. It can be any 21792 of: 21793 21794 - ~nil~ :: 21795 21796 The current buffer, respecting the restriction, if any. 21797 21798 - ~tree~ :: 21799 21800 The subtree started with the entry at point. 21801 21802 - ~region~ :: 21803 21804 The entries within the active region, if any. 21805 21806 - ~file~ :: 21807 21808 The current buffer, without restriction. 21809 21810 - ~file-with-archives~ :: 21811 21812 The current buffer, and any archives associated with it. 21813 21814 - ~agenda~ :: 21815 21816 All agenda files. 21817 21818 - ~agenda-with-archives~ :: 21819 21820 All agenda files with any archive files associated with them. 21821 21822 - list of filenames :: 21823 21824 If this is a list, all files in the list are scanned. 21825 21826 #+texinfo: @noindent 21827 The remaining arguments are treated as settings for the scanner's 21828 skipping facilities. Valid arguments are: 21829 21830 - ~archive~ :: 21831 21832 Skip trees with the =ARCHIVE= tag. 21833 21834 - ~comment~ :: 21835 21836 Skip trees with the COMMENT keyword. 21837 21838 - function or Lisp form :: 21839 21840 #+vindex: org-agenda-skip-function 21841 Used as value for ~org-agenda-skip-function~, so whenever the 21842 function returns ~t~, {{{var(FUNC)}}} is called for that entry and 21843 search continues from the point where the function leaves it. 21844 #+end_defun 21845 21846 The mapping routine can call any arbitrary function, even functions 21847 that change meta data or query the property API (see [[*Using the 21848 Property API]]). Here are some handy functions: 21849 21850 #+attr_texinfo: :options org-todo &optional arg 21851 #+begin_defun 21852 Change the TODO state of the entry. See the docstring of the 21853 functions for the many possible values for the argument 21854 {{{var(ARG)}}}. 21855 #+end_defun 21856 21857 #+attr_texinfo: :options org-priority &optional action 21858 #+begin_defun 21859 Change the priority of the entry. See the docstring of this function 21860 for the possible values for {{{var(ACTION)}}}. 21861 #+end_defun 21862 21863 #+attr_texinfo: :options org-toggle-tag tag &optional onoff 21864 #+begin_defun 21865 Toggle the tag {{{var(TAG)}}} in the current entry. Setting 21866 {{{var(ONOFF)}}} to either ~on~ or ~off~ does not toggle tag, but 21867 ensure that it is either on or off. 21868 #+end_defun 21869 21870 #+attr_texinfo: :options org-promote 21871 #+begin_defun 21872 Promote the current entry. 21873 #+end_defun 21874 21875 #+attr_texinfo: :options org-demote 21876 #+begin_defun 21877 Demote the current entry. 21878 #+end_defun 21879 21880 This example turns all entries tagged with =TOMORROW= into TODO 21881 entries with keyword =UPCOMING=. Org ignores entries in comment trees 21882 and archive trees. 21883 21884 #+begin_src emacs-lisp 21885 (org-map-entries '(org-todo "UPCOMING") 21886 "+TOMORROW" 'file 'archive 'comment) 21887 #+end_src 21888 21889 The following example counts the number of entries with TODO keyword 21890 =WAITING=, in all agenda files. 21891 21892 #+begin_src emacs-lisp 21893 (length (org-map-entries t "/+WAITING" 'agenda)) 21894 #+end_src 21895 21896 * History and Acknowledgments 21897 :PROPERTIES: 21898 :DESCRIPTION: How Org came into being. 21899 :APPENDIX: t 21900 :END: 21901 21902 ** From Carsten 21903 :PROPERTIES: 21904 :UNNUMBERED: notoc 21905 :END: 21906 21907 Org was born in 2003, out of frustration over the user interface of 21908 the Emacs Outline mode. I was trying to organize my notes and 21909 projects, and using Emacs seemed to be the natural way to go. 21910 However, having to remember eleven different commands with two or 21911 three keys per command, only to hide and show parts of the outline 21912 tree, that seemed entirely unacceptable to me. Also, when using 21913 outlines to take notes, I constantly wanted to restructure the tree, 21914 organizing it parallel to my thoughts and plans. /Visibility cycling/ 21915 and /structure editing/ were originally implemented in the package 21916 =outline-magic.el=, but quickly moved to the more general =org.el=. 21917 As this environment became comfortable for project planning, the next 21918 step was adding /TODO entries/, basic /timestamps/, and /table 21919 support/. These areas highlighted the two main goals that Org still 21920 has today: to be a new, outline-based, plain text mode with innovative 21921 and intuitive editing features, and to incorporate project planning 21922 functionality directly into a notes file. 21923 21924 Since the first release, literally thousands of emails to me or to the 21925 [[mailto:emacs-orgmode@gnu.org][mailing list]] have provided a constant stream of bug reports, feedback, 21926 new ideas, and sometimes patches and add-on code. Many thanks to 21927 everyone who has helped to improve this package. I am trying to keep 21928 here a list of the people who had significant influence in shaping one 21929 or more aspects of Org. The list may not be complete, if I have 21930 forgotten someone, please accept my apologies and let me know. 21931 21932 Before I get to this list, a few special mentions are in order: 21933 21934 - Bastien Guerry :: 21935 21936 Bastien has written a large number of extensions to Org (most of 21937 them integrated into the core by now), including the LaTeX exporter 21938 and the plain list parser. His support during the early days was 21939 central to the success of this project. Bastien also invented Worg, 21940 helped establishing the Web presence of Org, and sponsored hosting 21941 costs for the orgmode.org website. Bastien stepped in as maintainer 21942 of Org between 2011 and 2013, at a time when I desperately needed 21943 a break. 21944 21945 - Eric Schulte and Dan Davison :: 21946 21947 Eric and Dan are jointly responsible for the Org Babel system, which 21948 turns Org into a multi-language environment for evaluating code and 21949 doing literate programming and reproducible research. This has 21950 become one of Org's killer features that define what Org is today. 21951 21952 - John Wiegley :: 21953 21954 John has contributed a number of great ideas and patches directly to 21955 Org, including the attachment system (=org-attach.el=), integration 21956 with Apple Mail (=org-mac-message.el=), hierarchical dependencies of 21957 TODO items, habit tracking (=org-habits.el=), and encryption 21958 (=org-crypt.el=). Also, the capture system is really an extended 21959 copy of his great =remember.el=. 21960 21961 - Sebastian Rose :: 21962 21963 Without Sebastian, the HTML/XHTML publishing of Org would be the 21964 pitiful work of an ignorant amateur. Sebastian has pushed this part 21965 of Org onto a much higher level. He also wrote =org-info.js=, 21966 a JavaScript program for displaying webpages derived from Org using 21967 an Info-like or a folding interface with single-key navigation. 21968 21969 See below for the full list of contributions! Again, please let me 21970 know what I am missing here! 21971 21972 ** From Bastien 21973 :PROPERTIES: 21974 :UNNUMBERED: notoc 21975 :END: 21976 21977 I (Bastien) have been maintaining Org between 2011 and 2013. This 21978 appendix would not be complete without adding a few more 21979 acknowledgments and thanks. 21980 21981 I am first grateful to Carsten for his trust while handing me over the 21982 maintainership of Org. His unremitting support is what really helped 21983 me getting more confident over time, with both the community and the 21984 code. 21985 21986 When I took over maintainership, I knew I would have to make Org more 21987 collaborative than ever, as I would have to rely on people that are 21988 more knowledgeable than I am on many parts of the code. Here is 21989 a list of the persons I could rely on, they should really be 21990 considered co-maintainers, either of the code or the community: 21991 21992 - Eric Schulte :: 21993 21994 Eric is maintaining the Babel parts of Org. His reactivity here 21995 kept me away from worrying about possible bugs here and let me focus 21996 on other parts. 21997 21998 - Nicolas Goaziou :: 21999 22000 Nicolas is maintaining the consistency of the deepest parts of Org. 22001 His work on =org-element.el= and =ox.el= has been outstanding, and 22002 it opened the doors for many new ideas and features. He rewrote 22003 many of the old exporters to use the new export engine, and helped 22004 with documenting this major change. More importantly (if that's 22005 possible), he has been more than reliable during all the work done 22006 for Org 8.0, and always very reactive on the mailing list. 22007 22008 - Achim Gratz :: 22009 22010 Achim rewrote the building process of Org, turning some /ad hoc/ 22011 tools into a flexible and conceptually clean process. He patiently 22012 coped with the many hiccups that such a change can create for users. 22013 22014 - Nick Dokos :: 22015 22016 The Org mode mailing list would not be such a nice place without 22017 Nick, who patiently helped users so many times. It is impossible to 22018 overestimate such a great help, and the list would not be so active 22019 without him. 22020 22021 I received support from so many users that it is clearly impossible to 22022 be fair when shortlisting a few of them, but Org's history would not 22023 be complete if the ones above were not mentioned in this manual. 22024 22025 ** List of Contributions 22026 :PROPERTIES: 22027 :UNNUMBERED: notoc 22028 :END: 22029 22030 - Russell Adams came up with the idea for drawers. 22031 22032 - Thomas Baumann wrote =ol-bbdb.el= and =ol-mhe.el=. 22033 22034 - Christophe Bataillon created the great unicorn logo that we use on 22035 the Org mode website. 22036 22037 - Alex Bochannek provided a patch for rounding timestamps. 22038 22039 - Jan Böcker wrote =ol-docview.el=. 22040 22041 - Brad Bozarth showed how to pull RSS feed data into Org files. 22042 22043 - Tom Breton wrote =org-choose.el=. 22044 22045 - Charles Cave's suggestion sparked the implementation of templates 22046 for Remember, which are now templates for capture. 22047 22048 - Timothy E Chapman worked on a complete overhaul of the orgmode.org 22049 website in 2020 and helped fixing various bugs. 22050 22051 - Pavel Chalmoviansky influenced the agenda treatment of items with 22052 specified time. 22053 22054 - Gregory Chernov patched support for Lisp forms into table 22055 calculations and improved XEmacs compatibility, in particular by 22056 porting =nouline.el= to XEmacs. 22057 22058 - Sacha Chua suggested copying some linking code from Planner. 22059 22060 - Baoqiu Cui contributed the DocBook exporter. 22061 22062 - Eddward DeVilla proposed and tested checkbox statistics. He also 22063 came up with the idea of properties, and that there should be an API 22064 for them. 22065 22066 - Nick Dokos tracked down several nasty bugs. 22067 22068 - Kees Dullemond used to edit projects lists directly in HTML and so 22069 inspired some of the early development, including HTML export. He 22070 also asked for a way to narrow wide table columns. 22071 22072 - Thomas\nbsp{}S.\nbsp{}Dye contributed documentation on Worg and helped 22073 integrating the Org Babel documentation into the manual. 22074 22075 - Christian Egli converted the documentation into Texinfo format, 22076 inspired the agenda, patched CSS formatting into the HTML exporter, 22077 and wrote =org-taskjuggler.el=. 22078 22079 - David Emery provided a patch for custom CSS support in exported HTML 22080 agendas. 22081 22082 - Nic Ferrier contributed mailcap and XOXO support. 22083 22084 - Miguel\nbsp{}A.\nbsp{}Figueroa-Villanueva implemented hierarchical checkboxes. 22085 22086 - John Foerch figured out how to make incremental search show context 22087 around a match in a hidden outline tree. 22088 22089 - Raimar Finken wrote =org-git-line.el=. 22090 22091 - Mikael Fornius works as a mailing list moderator. 22092 22093 - Austin Frank works as a mailing list moderator. 22094 22095 - Eric Fraga drove the development of Beamer export with ideas and 22096 testing. 22097 22098 - Barry Gidden did proofreading the manual in preparation for the book 22099 publication through Network Theory Ltd. 22100 22101 - Niels Giesen had the idea to automatically archive DONE trees. 22102 22103 - Nicolas Goaziou rewrote much of the plain list code. 22104 22105 - Kai Grossjohann pointed out key-binding conflicts with other 22106 packages. 22107 22108 - Brian Gough of Network Theory Ltd publishes the Org mode manual as 22109 a book. 22110 22111 - Bernt Hansen has driven much of the support for auto-repeating 22112 tasks, task state change logging, and the clocktable. His clear 22113 explanations have been critical when we started to adopt the Git 22114 version control system. 22115 22116 - Manuel Hermenegildo has contributed various ideas, small fixes and 22117 patches. 22118 22119 - Phil Jackson wrote =ol-irc.el=. 22120 22121 - Scott Jaderholm proposed footnotes, control over whitespace between 22122 folded entries, and column view for properties. 22123 22124 - Matt Jones wrote MobileOrg Android. 22125 22126 - Tokuya Kameshima wrote =org-wl.el= and =org-mew.el=. 22127 22128 - Shidai Liu ("Leo") asked for embedded LaTeX and tested it. He also 22129 provided frequent feedback and some patches. 22130 22131 - Matt Lundin has proposed last-row references for table formulas and 22132 named invisible anchors. He has also worked a lot on the FAQ. 22133 22134 - David Maus wrote =org-atom.el=, maintains the issues file for Org, 22135 and is a prolific contributor on the mailing list with competent 22136 replies, small fixes and patches. 22137 22138 - Jason\nbsp{}F.\nbsp{}McBrayer suggested agenda export to CSV format. 22139 22140 - Kyle Meyer helped setting up the [[https://public-inbox.org/][public-inbox]] archive of the [[https://orgmode.org/list/][Org 22141 mailing list]] and has been fixing many bugs. 22142 22143 - Max Mikhanosha came up with the idea of refiling. 22144 22145 - Dmitri Minaev sent a patch to set priority limits on a per-file 22146 basis. 22147 22148 - Stefan Monnier provided a patch to keep the Emacs Lisp compiler 22149 happy. 22150 22151 - Richard Moreland wrote MobileOrg for the iPhone. 22152 22153 - Rick Moynihan proposed allowing multiple TODO sequences in a file 22154 and being able to quickly restrict the agenda to a subtree. 22155 22156 - Todd Neal provided patches for links to Info files and Elisp forms. 22157 22158 - Greg Newman refreshed the unicorn logo into its current form. 22159 22160 - Tim O'Callaghan suggested in-file links, search options for general 22161 file links, and tags. 22162 22163 - Osamu Okano wrote =orgcard2ref.pl=, a Perl program to create a text 22164 version of the reference card. 22165 22166 - Takeshi Okano translated the manual and David O'Toole's tutorial 22167 into Japanese. 22168 22169 - Oliver Oppitz suggested multi-state TODO items. 22170 22171 - Scott Otterson sparked the introduction of descriptive text for 22172 links, among other things. 22173 22174 - Pete Phillips helped during the development of the TAGS feature, 22175 and provided frequent feedback. 22176 22177 - Martin Pohlack provided the code snippet to bundle character 22178 insertion into bundles of 20 for undo. 22179 22180 - Ihor Radchenko helped with fixing bugs and improving the user 22181 experience regarding Org's speed. 22182 22183 - T.\nbsp{}V.\nbsp{}Raman reported bugs and suggested improvements. 22184 22185 - Matthias Rempe (Oelde) provided ideas, Windows support, and quality 22186 control. 22187 22188 - Paul Rivier provided the basic implementation of named footnotes. 22189 He also acted as mailing list moderator for some time. 22190 22191 - Kevin Rogers contributed code to access VM files on remote hosts. 22192 22193 - Frank Ruell solved the mystery of the =keymapp nil= bug, a conflict 22194 with =allout.el=. 22195 22196 - Jason Riedy generalized the send-receive mechanism for Orgtbl 22197 tables with extensive patches. 22198 22199 - Philip Rooke created the Org reference card, provided lots of 22200 feedback, developed and applied standards to the Org documentation. 22201 22202 - Christian Schlauer proposed angular brackets around links, among 22203 other things. 22204 22205 - Paul Sexton wrote =org-ctags.el=. 22206 22207 - Tom Shannon's =organizer-mode.el= inspired linking to VM/BBDB/Gnus. 22208 22209 - Ilya Shlyakhter proposed the Archive Sibling, line numbering in 22210 literal examples, and remote highlighting for referenced code lines. 22211 22212 - Stathis Sideris wrote the =ditaa.jar= ASCII to PNG converter that is 22213 now packaged into the [[https://git.sr.ht/~bzg/org-contrib][org-contrib]] repository. 22214 22215 - Daniel Sinder came up with the idea of internal archiving by locking 22216 subtrees. 22217 22218 - Dale Smith proposed link abbreviations. 22219 22220 - James TD Smith has contributed a large number of patches for 22221 useful tweaks and features. 22222 22223 - Adam Spiers asked for global linking commands, inspired the link 22224 extension system, added support for Mairix, and proposed the mapping 22225 API. 22226 22227 - Ulf Stegemann created the table to translate special symbols to 22228 HTML, LaTeX, UTF-8, Latin-1 and ASCII. 22229 22230 - Andy Stewart contributed code to =ol-w3m.el=, to copy 22231 HTML content with links transformation to Org syntax. 22232 22233 - David O'Toole wrote =org-publish.el= and drafted the 22234 manual chapter about publishing. 22235 22236 - Jambunathan\nbsp{}K.\nbsp{}contributed the ODT exporter. 22237 22238 - Sebastien Vauban reported many issues with LaTeX and Beamer export 22239 and enabled source code highlighting in Gnus. 22240 22241 - Stefan Vollmar organized a video-recorded talk at the 22242 Max-Planck-Institute for Neurology. He also inspired the creation 22243 of a concept index for HTML export. 22244 22245 - Jürgen Vollmer contributed code generating the table of contents in 22246 HTML output. 22247 22248 - Samuel Wales has provided important feedback and bug reports. 22249 22250 - Chris Wallace provided a patch implementing the =QUOTE= block. 22251 22252 - David Wainberg suggested archiving, and improvements to the 22253 linking system. 22254 22255 - Carsten Wimmer suggested some changes and helped fix a bug in 22256 linking to Gnus. 22257 22258 - Roland Winkler requested additional key bindings to make Org work on 22259 a TTY. 22260 22261 - Piotr Zielinski wrote =org-mouse.el=, proposed agenda 22262 blocks and contributed various ideas and code snippets. 22263 22264 - Marco Wahl wrote =ol-eww.el=. 22265 22266 * GNU Free Documentation License 22267 :PROPERTIES: 22268 :APPENDIX: t 22269 :DESCRIPTION: The license for this documentation. 22270 :END: 22271 22272 #+include: fdl.org 22273 22274 * Main Index 22275 :PROPERTIES: 22276 :INDEX: cp 22277 :DESCRIPTION: An index of Org's concepts and features. 22278 :END: 22279 22280 * Key Index 22281 :PROPERTIES: 22282 :DESCRIPTION: Key bindings and where they are described. 22283 :INDEX: ky 22284 :END: 22285 22286 * Command and Function Index 22287 :PROPERTIES: 22288 :DESCRIPTION: Command names and some internal functions. 22289 :INDEX: fn 22290 :END: 22291 22292 * Variable Index 22293 :PROPERTIES: 22294 :DESCRIPTION: Variables mentioned in the manual. 22295 :INDEX: vr 22296 :END: 22297 22298 This is not a complete index of variables and faces, only the ones 22299 that are mentioned in the manual. For a more complete list, use 22300 {{{kbd(M-x org-customize)}}} and then click yourself through the tree. 22301 22302 * Copying 22303 :PROPERTIES: 22304 :copying: t 22305 :END: 22306 22307 This manual is for Org version {{{version}}}. 22308 22309 Copyright \copy 2004--2023 Free Software Foundation, Inc. 22310 22311 #+begin_quote 22312 Permission is granted to copy, distribute and/or modify this document 22313 under the terms of the GNU Free Documentation License, Version 1.3 or 22314 any later version published by the Free Software Foundation; with no 22315 Invariant Sections, with the Front-Cover Texts being "A GNU Manual," 22316 and with the Back-Cover Texts as in (a) below. A copy of the license 22317 is included in the section entitled "GNU Free Documentation License." 22318 22319 (a) The FSF's Back-Cover Text is: "You have the freedom to copy and 22320 modify this GNU manual." 22321 #+end_quote 22322 22323 * Export Setup :noexport: 22324 22325 #+setupfile: doc-setup.org 22326 22327 #+export_file_name: org.texi 22328 22329 #+texinfo_dir_category: Emacs editing modes 22330 #+texinfo_dir_title: Org Mode: (org) 22331 #+texinfo_dir_desc: Outline-based notes management and organizer 22332 22333 * Footnotes 22334 22335 [fn:1] See the variables ~org-special-ctrl-a/e~, ~org-special-ctrl-k~, 22336 and ~org-ctrl-k-protect-subtree~ to configure special behavior of 22337 {{{kbd(C-a)}}}, {{{kbd(C-e)}}}, and {{{kbd(C-k)}}} in headlines. Note 22338 also that clocking only works with headings indented less than 30 22339 stars. 22340 22341 [fn:2] The indirect buffer contains the entire buffer, but is narrowed 22342 to the current tree. Editing the indirect buffer also changes the 22343 original buffer, but without affecting visibility in that buffer. For 22344 more information about indirect buffers, see [[info:emacs#Indirect Buffers][GNU Emacs Manual]]. 22345 22346 [fn:3] When using =*= as a bullet, lines must be indented so that they 22347 are not interpreted as headlines. Also, when you are hiding leading 22348 stars to get a clean outline view, plain list items starting with 22349 a star may be hard to distinguish from true headlines. In short: even 22350 though =*= is supported, it may be better to not use it for plain list 22351 items. 22352 22353 [fn:4] You can also get =a.=, =A.=, =a)= and =A)= by configuring 22354 ~org-list-allow-alphabetical~. To minimize confusion with normal 22355 text, those are limited to one character only. Beyond that limit, 22356 bullets automatically become numbers. 22357 22358 [fn:5] If there's a checkbox in the item, the cookie must be put 22359 /before/ the checkbox. If you have activated alphabetical lists, you 22360 can also use counters like =[@b]=. 22361 22362 [fn:6] Many desktops intercept {{{kbd(M-TAB)}}} to switch windows. 22363 Use {{{kbd(C-M-i)}}} or {{{kbd(ESC TAB)}}} instead. 22364 22365 [fn:7] Org understands references typed by the user as =B4=, but it 22366 does not use this syntax when offering a formula for editing. You can 22367 customize this behavior using the variable 22368 ~org-table-use-standard-references~. 22369 22370 [fn:8] The file =constants.el= can supply the values of constants in 22371 two different unit systems, =SI= and =cgs=. Which one is used depends 22372 on the value of the variable ~constants-unit-system~. You can use the 22373 =STARTUP= options =constSI= and =constcgs= to set this value for the 22374 current buffer. 22375 22376 [fn:9] The printf reformatting is limited in precision because the 22377 value passed to it is converted into an "integer" or "double". The 22378 "integer" is limited in size by truncating the signed value to 32 22379 bits. The "double" is limited in precision to 64 bits overall which 22380 leaves approximately 16 significant decimal digits. 22381 22382 [fn:10] Plain URIs are recognized only for a well-defined set of 22383 schemes. See [[*External Links]]. Unlike URI syntax, they cannot contain 22384 parenthesis or white spaces, either. URIs within angle brackets have 22385 no such limitation. 22386 22387 [fn:11] To insert a link targeting a headline, in-buffer completion 22388 can be used. Just type a star followed by a few optional letters into 22389 the buffer and press {{{kbd(M-TAB)}}}. All headlines in the current 22390 buffer are offered as completions. 22391 22392 [fn:12] The actual behavior of the search depends on the value of the 22393 variable ~org-link-search-must-match-exact-headline~. If its value is 22394 ~nil~, then a fuzzy text search is done. If it is ~t~, then only the 22395 exact headline is matched, ignoring spaces and statistic cookies. If 22396 the value is ~query-to-create~, then an exact headline is searched; if 22397 it is not found, then the user is queried to create it. 22398 22399 [fn:13] Note that you do not have to use this command to insert 22400 a link. Links in Org are plain text, and you can type or paste them 22401 straight into the buffer. By using this command, the links are 22402 automatically enclosed in double brackets, and you will be asked for 22403 the optional descriptive text. 22404 22405 [fn:14] After insertion of a stored link, the link will be removed 22406 from the list of stored links. To keep it in the list for later use, 22407 use a triple {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or 22408 configure the option ~org-link-keep-stored-after-insertion~. 22409 22410 [fn:15] Check also the variable ~org-fast-tag-selection-include-todo~, 22411 it allows you to change the TODO state through the tags interface (see 22412 [[*Setting Tags]]), in case you like to mingle the two concepts. Note 22413 that this means you need to come up with unique keys across both sets 22414 of keywords. 22415 22416 [fn:16] It is possible that Org mode records two timestamps when you 22417 are using both ~org-log-done~ and state change logging. However, it 22418 never prompts for two notes: if you have configured both, the state 22419 change recording note takes precedence and cancel the closing note. 22420 22421 [fn:17] With the exception of description lists. But you can allow it 22422 by modifying ~org-list-automatic-rules~ accordingly. 22423 22424 [fn:18] An age can be defined as a duration, using units defined in 22425 ~org-duration-units~, e.g., =3d 1h=. If any value in the column is as 22426 such, the summary is also expressed as a duration. 22427 22428 [fn:19] The Org date format is inspired by the standard ISO 8601 22429 date/time format. To use an alternative format, see [[*Custom time 22430 format]]. The day name is optional when you type the date yourself. 22431 However, any date inserted or modified by Org adds that day name, for 22432 reading convenience. 22433 22434 [fn:20] When working with the standard diary expression functions, you 22435 need to be very careful with the order of the arguments. That order 22436 depends evilly on the variable ~calendar-date-style~. For example, to 22437 specify a date December 1, 2005, the call might look like 22438 =(diary-date 12 1 2005)= or =(diary-date 1 12 2005)= or =(diary-date 22439 2005 12 1)=, depending on the settings. This has been the source of 22440 much confusion. Org mode users can resort to special versions of 22441 these functions, namely ~org-date~, ~org-anniversary~, ~org-cyclic, and 22442 ~org-block~. These work just like the corresponding ~diary-~ 22443 functions, but with stable ISO order of arguments (year, month, day) 22444 wherever applicable, independent of the value of 22445 ~calendar-date-style~. 22446 22447 [fn:21] See the variable ~org-read-date-prefer-future~. You may set 22448 that variable to the symbol ~time~ to even make a time before now 22449 shift the date to tomorrow. 22450 22451 [fn:22] You can also use the calendar command {{{kbd(.)}}} to jump to 22452 today's date, but if you are inserting an hour specification for your 22453 timestamp, {{{kbd(.)}}} will then insert a dot after the hour. By contrast, 22454 {{{kbd(C-.)}}} will always jump to today's date. 22455 22456 [fn:23] It will still be listed on that date after it has been marked 22457 as done. If you do not like this, set the variable 22458 ~org-agenda-skip-scheduled-if-done~. 22459 22460 [fn:24] The =SCHEDULED= and =DEADLINE= dates are inserted on the line 22461 right below the headline. Do not put any text between this line and 22462 the headline. 22463 22464 [fn:25] Org does not repeat inactive timestamps, however. See 22465 [[*Timestamps]]. 22466 22467 [fn:26] You can change this using the option ~org-log-repeat~, or the 22468 =STARTUP= options =logrepeat=, =lognoterepeat=, and =nologrepeat=. 22469 With =lognoterepeat=, you will also be prompted for a note. 22470 22471 [fn:27] Clocking only works if all headings are indented with less 22472 than 30 stars. This is a hard-coded limitation of ~lmax~ in 22473 ~org-clock-sum~. 22474 22475 [fn:28] On computers using macOS, idleness is based on actual user 22476 idleness, not just Emacs' idle time. For X11, you can install a 22477 utility program =x11idle.c=, available in the =org-contrib/= 22478 repository, or install the xprintidle package and set it to the 22479 variable ~org-clock-x11idle-program-name~ if you are running Debian, 22480 to get the same general treatment of idleness. On other systems, idle 22481 time refers to Emacs idle time only. 22482 22483 [fn:29] Org used to offer four different targets for date/week tree 22484 capture. Now, Org automatically translates these to use 22485 ~file+olp+datetree~, applying the ~:time-prompt~ and ~:tree-type~ 22486 properties. Please rewrite your date/week-tree targets using 22487 ~file+olp+datetree~ since the older targets are now deprecated. 22488 22489 [fn:30] A date tree is an outline structure with years on the highest 22490 level, months or ISO weeks as sublevels and then dates on the lowest 22491 level. 22492 22493 #+begin_example 22494 ,* 2022 22495 ,** 2022-10 October 22496 ,*** 2022-10-07 Friday 22497 ,*** 2022-10-08 Saturday 22498 #+end_example 22499 22500 Tags are allowed in the tree structure. 22501 22502 [fn:31] This is always the other, not the user. See the variable 22503 ~org-link-from-user-regexp~. 22504 22505 [fn:32] For backward compatibility, the universal prefix argument 22506 {{{kbd(C-u)}}} causes all TODO entries to be listed before the agenda. 22507 This feature is deprecated, use the dedicated TODO list, or a block 22508 agenda instead (see [[*Block agenda]]). 22509 22510 [fn:33] Custom agenda commands can preset a filter by binding one of 22511 the variables ~org-agenda-tag-filter-preset~, 22512 ~org-agenda-category-filter-preset~, ~org-agenda-effort-filter-preset~ 22513 or ~org-agenda-regexp-filter-preset~ as an option. This filter is 22514 then applied to the view and persists as a basic filter through 22515 refreshes and more secondary filtering. The filter is a global 22516 property of the entire agenda view---in a block agenda, you should 22517 only set this in the global options section, not in the section of an 22518 individual block. 22519 22520 [fn:34] /Planned/ means here that these entries have some planning 22521 information attached to them, like a time-stamp, a scheduled or 22522 a deadline string. See ~org-agenda-entry-types~ on how to set what 22523 planning information is taken into account. 22524 22525 [fn:35] To create PDF output, the Ghostscript ps2pdf utility must be 22526 installed on the system. Selecting a PDF file also creates the 22527 postscript file. 22528 22529 [fn:36] LaTeX is a macro system based on Donald\nbsp{}E.\nbsp{}Knuth's TeX 22530 system. Many of the features described here as "LaTeX" are really 22531 from TeX, but for simplicity I am blurring this distinction. 22532 22533 [fn:37] When MathJax is used, only the environments recognized by 22534 MathJax are processed. When dvipng, dvisvgm, or ImageMagick suite is 22535 used to create images, any LaTeX environment is handled. 22536 22537 [fn:38] These are respectively available at 22538 [[https://sourceforge.net/projects/dvipng/]], [[http://dvisvgm.bplaced.net/]] 22539 and from the ImageMagick suite. Choose the converter by setting the 22540 variable ~org-preview-latex-default-process~ accordingly. 22541 22542 [fn:39] This works automatically for the HTML backend (it requires 22543 version 1.34 of the =htmlize.el= package, which you need to install). 22544 Fontified code chunks in LaTeX can be achieved using either the 22545 [[https://www.ctan.org/pkg/listings][listings]] LaTeX package, [[https://www.ctan.org/pkg/minted][minted]] LaTeX package, or by using 22546 [[https://elpa.gnu.org/packages/engrave-faces.html][engrave-faces]] . Refer to ~org-latex-src-block-backend~ for details. 22547 22548 [fn:40] Source code in code blocks may also be evaluated either 22549 interactively or on export. See [[*Working with Source Code]] for more 22550 information on evaluating code blocks. 22551 22552 [fn:41] For export to LaTeX format---or LaTeX-related formats such as 22553 Beamer---, the =org-latex-package-alist= variable needs further 22554 configuration. See [[LaTeX specific export settings]]. 22555 22556 [fn:42] At the moment, some export back-ends do not obey this 22557 specification. For example, LaTeX export excludes every unnumbered 22558 headline from the table of contents. 22559 22560 [fn:43] Note that ~org-link-search-must-match-exact-headline~ is 22561 locally bound to non-~nil~. Therefore, ~org-link-search~ only matches 22562 headlines and named elements. 22563 22564 [fn:44] Since commas separate the arguments, commas within arguments 22565 have to be escaped with the backslash character. So only those 22566 backslash characters before a comma need escaping with another 22567 backslash character. 22568 22569 [fn:45] If =BEAMER_ENV= is set, Org export adds =B_environment= tag 22570 to make it visible. The tag serves as a visual aid and has no 22571 semantic relevance. 22572 22573 [fn:46] Please note that exported formulas are part of an HTML 22574 document, and that signs such as =<=, =>=, or =&= have special 22575 meanings. See [[https://docs.mathjax.org/en/latest/input/tex/html.html#tex-and-latex-in-html-documents][MathJax TeX and LaTeX in HTML documents]]. 22576 22577 [fn:47] This does not allow setting different bibliography compilers 22578 for different files. However, "smart" LaTeX compilation systems, such 22579 as latexmk, can select the correct bibliography compiler. 22580 22581 [fn:48] Actually, the constructs =call_<name>()= and =src_<lang>{}= 22582 are not evaluated when they appear in a keyword (see [[*Summary of 22583 In-Buffer Settings]]). 22584 22585 [fn:49] Org Indent mode also sets ~wrap-prefix~ correctly for 22586 indenting and wrapping long lines of headlines or text. This minor 22587 mode also handles Visual Line mode and directly applied settings 22588 through ~word-wrap~. 22589 22590 [fn:50] This works, but requires extra effort. Org Indent mode is 22591 more convenient for most applications. 22592 22593 [fn:51] For a server to host files, consider using a WebDAV server, 22594 such as [[https://nextcloud.com][Nextcloud]]. Additional help is at this [[https://orgmode.org/worg/org-faq.html#mobileorg_webdav][FAQ entry]]. 22595 22596 [fn:52] While creating the agendas, Org mode forces =ID= properties 22597 on all referenced entries, so that these entries can be uniquely 22598 identified if Org Mobile flags them for further action. To avoid 22599 setting properties configure the variable 22600 ~org-mobile-force-id-on-agenda-items~ to ~nil~. Org mode then relies 22601 on outline paths, assuming they are unique. 22602 22603 [fn:53] By default this works only for LaTeX, HTML, and Texinfo. 22604 Configure the variable ~orgtbl-radio-table-templates~ to install 22605 templates for other modes. 22606 22607 [fn:54] If the =TBLFM= keyword contains an odd number of dollar 22608 characters, this may cause problems with Font Lock in LaTeX mode. As 22609 shown in the example you can fix this by adding an extra line inside 22610 the =comment= environment that is used to balance the dollar 22611 expressions. If you are using AUCTeX with the font-latex library, 22612 a much better solution is to add the =comment= environment to the 22613 variable ~LaTeX-verbatim-environments~.