org.texi (912356B)
1 \input texinfo @c -*- texinfo -*- 2 @c %**start of header 3 @setfilename org.info 4 @settitle The Org Manual 5 @documentencoding UTF-8 6 @documentlanguage en 7 @set txicodequoteundirected 8 @set txicodequotebacktick 9 @set MAINTAINERSITE @uref{https://orgmode.org,maintainers webpage} 10 @set MAINTAINER Bastien Guerry 11 @set MAINTAINEREMAIL @email{bzg@gnu.org} 12 @set MAINTAINERCONTACT @uref{mailto:bzg@gnu.org,contact the maintainer} 13 @c %**end of header 14 15 @copying 16 This manual is for Org version 9.7. 17 18 Copyright @copyright{} 2004--2024 Free Software Foundation, Inc. 19 20 @quotation 21 Permission is granted to copy, distribute and/or modify this document 22 under the terms of the GNU Free Documentation License, Version 1.3 or 23 any later version published by the Free Software Foundation; with no 24 Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,'' 25 and with the Back-Cover Texts as in (a) below. A copy of the license 26 is included in the section entitled ``GNU Free Documentation License.'' 27 28 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and 29 modify this GNU manual.'' 30 31 @end quotation 32 @end copying 33 34 @dircategory Emacs editing modes 35 @direntry 36 * Org Mode: (org). Outline-based notes management and organizer. 37 @end direntry 38 39 @finalout 40 @titlepage 41 @title The Org Manual 42 @subtitle Release 9.7 43 @author The Org Mode Developers 44 @page 45 @vskip 0pt plus 1filll 46 @insertcopying 47 @end titlepage 48 49 @contents 50 51 @ifnottex 52 @node Top 53 @top The Org Manual 54 55 @insertcopying 56 57 @end ifnottex 58 59 @menu 60 * Introduction:: Getting started. 61 * Document Structure:: A tree works like your brain. 62 * Tables:: Pure magic for quick formatting. 63 * Hyperlinks:: Notes in context. 64 * TODO Items:: Every tree branch can be a TODO item. 65 * Tags:: Tagging headlines and matching sets of tags. 66 * Properties and Columns:: Storing information about an entry. 67 * Dates and Times:: Making items useful for planning. 68 * Refiling and Archiving:: Moving and copying information with ease. 69 * Capture and Attachments:: Dealing with external data. 70 * Agenda Views:: Collecting information into views. 71 * Markup for Rich Contents:: Compose beautiful documents. 72 * Exporting:: Sharing and publishing notes. 73 * Publishing:: Create a web site of linked Org files. 74 * Citation handling:: create, follow and export citations. 75 * Working with Source Code:: Export, evaluate, and tangle code blocks. 76 * Miscellaneous:: All the rest which did not fit elsewhere. 77 * Hacking:: How to hack your way around. 78 * History and Acknowledgments:: How Org came into being. 79 * GNU Free Documentation License:: The license for this documentation. 80 * Main Index:: An index of Org's concepts and features. 81 * Key Index:: Key bindings and where they are described. 82 * Command and Function Index:: Command names and some internal functions. 83 * Variable Index:: Variables mentioned in the manual. 84 85 @detailmenu 86 --- The Detailed Node Listing --- 87 88 Introduction 89 90 * Summary:: Brief summary of what Org does. 91 * Installation:: Installing Org. 92 * Activation:: How to activate Org for certain buffers. 93 * Feedback:: Bug reports, ideas, patches, etc. 94 * Conventions:: Typesetting conventions used in this manual. 95 96 Document Structure 97 98 * Headlines:: How to typeset Org tree headlines. 99 * Visibility Cycling:: Show and hide, much simplified. 100 * Motion:: Jumping to other headlines. 101 * Structure Editing:: Changing sequence and level of headlines. 102 * Sparse Trees:: Matches embedded in context. 103 * Plain Lists:: Additional structure within an entry. 104 * Drawers:: Tucking stuff away. 105 * Blocks:: Folding blocks. 106 107 Visibility Cycling 108 109 * Global and local cycling:: Cycling through various visibility states. 110 * Initial visibility:: Setting the initial visibility state. 111 * Catching invisible edits:: Preventing mistakes when editing invisible parts. 112 113 Tables 114 115 * Built-in Table Editor:: Simple tables. 116 * Column Width and Alignment:: Overrule the automatic settings. 117 * Column Groups:: Grouping to trigger vertical lines. 118 * Orgtbl Mode:: The table editor as minor mode. 119 * The Spreadsheet:: The table editor has spreadsheet capabilities. 120 * Org Plot:: Plotting from Org tables. 121 122 The Spreadsheet 123 124 * References:: How to refer to another field or range. 125 * Formula syntax for Calc:: Using Calc to compute stuff. 126 * Formula syntax for Lisp:: Writing formulas in Emacs Lisp. 127 * Durations and time values:: How to compute durations and time values. 128 * Field and range formulas:: Formula for specific (ranges of) fields. 129 * Column formulas:: Formulas valid for an entire column. 130 * Lookup functions:: Lookup functions for searching tables. 131 * Editing and debugging formulas:: Fixing formulas. 132 * Updating the table:: Recomputing all dependent fields. 133 * Advanced features:: Field and column names, automatic recalculation... 134 135 Hyperlinks 136 137 * Link Format:: How links in Org are formatted. 138 * Internal Links:: Links to other places in the current file. 139 * Radio Targets:: Make targets trigger links in plain text. 140 * External Links:: URL-like links to the world. 141 * Handling Links:: Creating, inserting and following. 142 * Using Links Outside Org:: Linking from my C source code? 143 * Link Abbreviations:: Shortcuts for writing complex links. 144 * Search Options:: Linking to a specific location. 145 * Custom Searches:: When the default search is not enough. 146 147 TODO Items 148 149 * TODO Basics:: Marking and displaying TODO entries. 150 * TODO Extensions:: Workflow and assignments. 151 * Progress Logging:: Dates and notes for progress. 152 * Priorities:: Some things are more important than others. 153 * Breaking Down Tasks:: Splitting a task into manageable pieces. 154 * Checkboxes:: Tick-off lists. 155 156 TODO Extensions 157 158 * Workflow states:: From TODO to DONE in steps. 159 * TODO types:: I do this, Fred does the rest. 160 * Multiple sets in one file:: Mixing it all, still finding your way. 161 * Fast access to TODO states:: Single letter selection of state. 162 * Per-file keywords:: Different files, different requirements. 163 * Faces for TODO keywords:: Highlighting states. 164 * TODO dependencies:: When one task needs to wait for others. 165 166 Progress Logging 167 168 * Closing items:: When was this entry marked as done? 169 * Tracking TODO state changes:: When did the status change? 170 * Tracking your habits:: How consistent have you been? 171 172 Tags 173 174 * Tag Inheritance:: Tags use the tree structure of an outline. 175 * Setting Tags:: How to assign tags to a headline. 176 * Tag Hierarchy:: Create a hierarchy of tags. 177 * Tag Searches:: Searching for combinations of tags. 178 179 Properties and Columns 180 181 * Property Syntax:: How properties are spelled out. 182 * Special Properties:: Access to other Org mode features. 183 * Property Searches:: Matching property values. 184 * Property Inheritance:: Passing values down a tree. 185 * Column View:: Tabular viewing and editing. 186 187 Column View 188 189 * Defining columns:: The COLUMNS format property. 190 * Using column view:: How to create and use column view. 191 * Capturing column view:: A dynamic block for column view. 192 193 Defining columns 194 195 * Scope of column definitions:: Where defined, where valid? 196 * Column attributes:: Appearance and content of a column. 197 198 Dates and Times 199 200 * Timestamps:: Assigning a time to a tree entry. 201 * Creating Timestamps:: Commands to insert timestamps. 202 * Deadlines and Scheduling:: Planning your work. 203 * Clocking Work Time:: Tracking how long you spend on a task. 204 * Effort Estimates:: Planning work effort in advance. 205 * Timers:: Notes with a running timer. 206 207 Creating Timestamps 208 209 * The date/time prompt:: How Org mode helps you enter dates and times. 210 * Custom time format:: Making dates look different. 211 212 Deadlines and Scheduling 213 214 * Inserting deadline/schedule:: Planning items. 215 * Repeated tasks:: Items that show up again and again. 216 217 Clocking Work Time 218 219 * Clocking commands:: Starting and stopping a clock. 220 * The clock table:: Detailed reports. 221 * Resolving idle time:: Resolving time when you've been idle. 222 223 Refiling and Archiving 224 225 * Refile and Copy:: Moving/copying a tree from one place to another. 226 * Archiving:: What to do with finished products. 227 228 Archiving 229 230 * Moving subtrees:: Moving a tree to an archive file. 231 * Internal archiving:: Switch off a tree but keep it in the file. 232 233 Capture and Attachments 234 235 * Capture:: Capturing new stuff. 236 * Attachments:: Attach files to outlines. 237 * RSS Feeds:: Getting input from RSS feeds. 238 239 Capture 240 241 * Setting up capture:: Where notes will be stored. 242 * Using capture:: Commands to invoke and terminate capture. 243 * Capture templates:: Define the outline of different note types. 244 245 Capture templates 246 247 * Template elements:: What is needed for a complete template entry. 248 * Template expansion:: Filling in information about time and context. 249 * Templates in contexts:: Only show a template in a specific context. 250 251 Attachments 252 253 * Attachment defaults and dispatcher:: How to access attachment commands 254 * Attachment options:: Configuring the attachment system 255 * Attachment links:: Hyperlink access to attachments 256 * Automatic version-control with Git:: Everything safely stored away 257 * Attach from Dired:: Using dired to select an attachment 258 259 Agenda Views 260 261 * Agenda Files:: Files being searched for agenda information. 262 * Agenda Dispatcher:: Keyboard access to agenda views. 263 * Built-in Agenda Views:: What is available out of the box? 264 * Presentation and Sorting:: How agenda items are prepared for display. 265 * Agenda Commands:: Remote editing of Org trees. 266 * Custom Agenda Views:: Defining special searches and views. 267 * Exporting Agenda Views:: Writing a view to a file. 268 * Agenda Column View:: Using column view for collected entries. 269 270 Built-in Agenda Views 271 272 * Weekly/daily agenda:: The calendar page with current tasks. 273 * Global TODO list:: All unfinished action items. 274 * Matching tags and properties:: Structured information with fine-tuned search. 275 * Search view:: Find entries by searching for text. 276 * Stuck projects:: Find projects you need to review. 277 278 Presentation and Sorting 279 280 * Categories:: Not all tasks are equal. 281 * Time-of-day specifications:: How the agenda knows the time. 282 * Sorting of agenda items:: The order of things. 283 * Filtering/limiting agenda items:: Dynamically narrow the agenda. 284 285 Custom Agenda Views 286 287 * Storing searches:: Type once, use often. 288 * Block agenda:: All the stuff you need in a single buffer. 289 * Setting options:: Changing the rules. 290 291 Markup for Rich Contents 292 293 * Paragraphs:: The basic unit of text. 294 * Emphasis and Monospace:: Bold, italic, etc. 295 * Subscripts and Superscripts:: Simple syntax for raising/lowering text. 296 * Special Symbols:: Greek letters and other symbols. 297 * Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents. 298 * Literal Examples:: Source code examples with special formatting. 299 * Images:: Display an image. 300 * Captions:: Describe tables, images... 301 * Horizontal Rules:: Make a line. 302 * Creating Footnotes:: Edit and read footnotes. 303 304 Embedded @LaTeX{} 305 306 * @LaTeX{} fragments:: Complex formulas made easy. 307 * Previewing @LaTeX{} fragments:: What will this snippet look like? 308 * CD@LaTeX{} mode:: Speed up entering of formulas. 309 310 Exporting 311 312 * The Export Dispatcher:: The main interface. 313 * Export Settings:: Common export settings. 314 * Table of Contents:: The if and where of the table of contents. 315 * Include Files:: Include additional files into a document. 316 * Macro Replacement:: Use macros to create templates. 317 * Comment Lines:: What will not be exported. 318 * ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding. 319 * Beamer Export:: Producing presentations and slides. 320 * HTML Export:: Exporting to HTML. 321 * @LaTeX{} Export:: Exporting to @LaTeX{} and processing to PDF. 322 * Markdown Export:: Exporting to Markdown. 323 * OpenDocument Text Export:: Exporting to OpenDocument Text. 324 * Org Export:: Exporting to Org. 325 * Texinfo Export:: Exporting to Texinfo. 326 * iCalendar Export:: Exporting to iCalendar. 327 * Other Built-in Backends:: Exporting to a man page. 328 * Advanced Export Configuration:: Fine-tuning the export output. 329 * Export Region:: Author tables and lists in Org syntax. 330 331 Beamer Export 332 333 * Beamer export commands:: For creating Beamer documents. 334 * Beamer specific export settings:: For customizing Beamer export. 335 * Frames and Blocks in Beamer:: For composing Beamer slides. 336 * Beamer specific syntax:: For using in Org documents. 337 * Editing support:: Editing support. 338 * A Beamer example:: A complete presentation. 339 340 HTML Export 341 342 * HTML export commands:: Invoking HTML export. 343 * HTML specific export settings:: Settings for HTML export. 344 * HTML doctypes:: Exporting various (X)HTML flavors. 345 * HTML preamble and postamble:: Inserting preamble and postamble. 346 * Bare HTML:: Exporting HTML without CSS, Javascript, etc. 347 * Quoting HTML tags:: Using direct HTML in Org files. 348 * Headlines in HTML export:: Formatting headlines. 349 * Links in HTML export:: Inserting and formatting links. 350 * Tables in HTML export:: How to modify the formatting of tables. 351 * Images in HTML export:: How to insert figures into HTML output. 352 * Math formatting in HTML export:: Beautiful math also on the web. 353 * Text areas in HTML export:: An alternate way to show an example. 354 * CSS support:: Changing the appearance of the output. 355 * JavaScript support:: Info and folding in a web browser. 356 357 @LaTeX{} Export 358 359 * @LaTeX{}/PDF export commands:: For producing @LaTeX{} and PDF documents. 360 * @LaTeX{} specific export settings:: Unique to this @LaTeX{} backend. 361 * @LaTeX{} header and sectioning:: Setting up the export file structure. 362 * Quoting @LaTeX{} code:: Incorporating literal @LaTeX{} code. 363 * Tables in @LaTeX{} export:: Options for exporting tables to @LaTeX{}. 364 * Images in @LaTeX{} export:: How to insert figures into @LaTeX{} output. 365 * Plain lists in @LaTeX{} export:: Attributes specific to lists. 366 * Source blocks in @LaTeX{} export:: Attributes specific to source code blocks. 367 * Example blocks in @LaTeX{} export:: Attributes specific to example blocks. 368 * Special blocks in @LaTeX{} export:: Attributes specific to special blocks. 369 * Horizontal rules in @LaTeX{} export:: Attributes specific to horizontal rules. 370 * Verse blocks in @LaTeX{} export:: Attributes specific to special blocks. 371 * Quote blocks in @LaTeX{} export:: Attributes specific to quote blocks. 372 373 OpenDocument Text Export 374 375 * Pre-requisites for ODT export:: Required packages. 376 * ODT export commands:: Invoking export. 377 * ODT specific export settings:: Configuration options. 378 * Extending ODT export:: Producing DOC, PDF files. 379 * Applying custom styles:: Styling the output. 380 * Links in ODT export:: Handling and formatting links. 381 * Tables in ODT export:: Org tables conversions. 382 * Images in ODT export:: Inserting images. 383 * Math formatting in ODT export:: Formatting @LaTeX{} fragments. 384 * Labels and captions in ODT export:: Rendering objects. 385 * Literal examples in ODT export:: For source code and example blocks. 386 * Advanced topics in ODT export:: For power users. 387 388 Math formatting in ODT export 389 390 * @LaTeX{} math snippets:: Embedding in @LaTeX{} format. 391 * MathML and OpenDocument formula files:: Embedding in native format. 392 393 Texinfo Export 394 395 * Texinfo export commands:: Invoking commands. 396 * Texinfo specific export settings:: Setting the environment. 397 * Texinfo file header:: Generating the header. 398 * Texinfo title and copyright page:: Creating preamble pages. 399 * Info directory file:: Installing a manual in Info file hierarchy. 400 * Headings and sectioning structure:: Building document structure. 401 * Indices:: Creating indices. 402 * Quoting Texinfo code:: Incorporating literal Texinfo code. 403 * Plain lists in Texinfo export:: List attributes. 404 * Tables in Texinfo export:: Table attributes. 405 * Images in Texinfo export:: Image attributes. 406 * Quotations in Texinfo export:: Quote block attributes. 407 * Key bindings in Texinfo export:: @@kbd Texinfo command. 408 * Special blocks in Texinfo export:: Special block attributes. 409 * A Texinfo example:: Processing Org to Texinfo. 410 411 Publishing 412 413 * Configuration:: Defining projects. 414 * Uploading Files:: How to get files up on the server. 415 * Sample Configuration:: Example projects. 416 * Triggering Publication:: Publication commands. 417 418 Configuration 419 420 * Project alist:: The central configuration variable. 421 * Sources and destinations:: From here to there. 422 * Selecting files:: What files are part of the project? 423 * Publishing action:: Setting the function doing the publishing. 424 * Publishing options:: Tweaking HTML/@LaTeX{} export. 425 * Publishing links:: Which links keep working after publishing? 426 * Site map:: Generating a list of all pages. 427 * Generating an index:: An index that reaches across pages. 428 429 Sample Configuration 430 431 * Simple example:: One-component publishing. 432 * Complex example:: A multi-component publishing example. 433 434 Citation handling 435 436 * Citations:: 437 * Citation export processors:: 438 * Bibliography printing:: 439 440 Bibliography printing 441 442 * Bibliography options in the @samp{biblatex} and @samp{csl} export processors:: 443 444 Working with Source Code 445 446 * Features Overview:: Enjoy the versatility of source blocks. 447 * Structure of Code Blocks:: Code block syntax described. 448 * Using Header Arguments:: Different ways to set header arguments. 449 * Environment of a Code Block:: Arguments, sessions, working directory... 450 * Evaluating Code Blocks:: Place results of evaluation in the Org buffer. 451 * Results of Evaluation:: Choosing a results type, post-processing... 452 * Exporting Code Blocks:: Export contents and/or results. 453 * Extracting Source Code:: Create pure source code files. 454 * Languages:: List of supported code block languages. 455 * Editing Source Code:: Language major-mode editing. 456 * Noweb Reference Syntax:: Literate programming in Org mode. 457 * Library of Babel:: Use and contribute to a library of useful code blocks. 458 * Key bindings and Useful Functions:: Work quickly with code blocks. 459 * Batch Execution:: Call functions from the command line. 460 461 Miscellaneous 462 463 * Completion:: @kbd{M-@key{TAB}} guesses completions. 464 * Structure Templates:: Quick insertion of structural elements. 465 * Speed Keys:: Electric commands at the beginning of a headline. 466 * Clean View:: Getting rid of leading stars in the outline. 467 * Execute commands in the active region:: Execute commands on multiple items in Org or agenda view. 468 * Dynamic Headline Numbering:: Display and update outline numbering. 469 * The Very Busy @kbd{C-c C-c} Key:: When in doubt, press @kbd{C-c C-c}. 470 * In-buffer Settings:: Overview of keywords. 471 * Regular Expressions:: Elisp regular expressions. 472 * Org Syntax:: Formal description of Org's syntax. 473 * Documentation Access:: Read documentation about current syntax. 474 * Escape Character:: Prevent Org from interpreting your writing. 475 * Code Evaluation Security:: Org files evaluate in-line code. 476 * Interaction:: With other Emacs packages. 477 * TTY Keys:: Using Org on a tty. 478 * Protocols:: External access to Emacs and Org. 479 * Org Crypt:: Encrypting Org files. 480 * Org Mobile:: Viewing and capture on a mobile device. 481 * Drag and Drop & @code{yank-media}:: Dropping and pasting files and images 482 483 Clean View 484 485 * Org Indent Mode:: 486 * Hard indentation:: 487 488 Interaction 489 490 * Cooperation:: Packages Org cooperates with. 491 * Conflicts:: Packages that lead to conflicts. 492 493 Protocols 494 495 * The @code{store-link} protocol:: Store a link, push URL to kill-ring. 496 * The @code{capture} protocol:: Fill a buffer with external information. 497 * The @code{open-source} protocol:: Edit published contents. 498 499 Org Mobile 500 501 * Setting up the staging area:: For the mobile device. 502 * Pushing to the mobile application:: Uploading Org files and agendas. 503 * Pulling from the mobile application:: Integrating captured and flagged items. 504 505 Hacking 506 507 * Hooks:: How to reach into Org's internals. 508 * Add-on Packages:: Available extensions. 509 * Adding Hyperlink Types:: New custom link types. 510 * Adding Export Backends:: How to write new export backends. 511 * Tables in Arbitrary Syntax:: Orgtbl for LaTeX and other programs. 512 * Dynamic Blocks:: Automatically filled blocks. 513 * Special Agenda Views:: Customized views. 514 * Speeding Up Your Agendas:: Tips on how to speed up your agendas. 515 * Extracting Agenda Information:: Post-processing agenda information. 516 * Using the Property API:: Writing programs that use entry properties. 517 * Using the Mapping API:: Mapping over all or selected entries. 518 519 Tables in Arbitrary Syntax 520 521 * Radio tables:: Sending and receiving radio tables. 522 * A @LaTeX{} example:: Step by step, almost a tutorial. 523 * Translator functions:: Copy and modify. 524 525 @end detailmenu 526 @end menu 527 528 @node Introduction 529 @chapter Introduction 530 531 @cindex introduction 532 533 @menu 534 * Summary:: Brief summary of what Org does. 535 * Installation:: Installing Org. 536 * Activation:: How to activate Org for certain buffers. 537 * Feedback:: Bug reports, ideas, patches, etc. 538 * Conventions:: Typesetting conventions used in this manual. 539 @end menu 540 541 @node Summary 542 @section Summary 543 544 @cindex summary 545 546 Org Mode is an authoring tool and a TODO lists manager for GNU Emacs. 547 It relies on a lightweight plain-text markup language used in files 548 with the @samp{.org} extension. 549 550 Authoring Org files is best supported by Emacs, but you can view, 551 understand, and change them with any text editor. 552 553 As an authoring tool, Org helps you write structured documents and 554 provides exporting facilities. Org files can also be used for literate 555 programming and reproducible research. As a TODO lists manager, Org 556 helps you organize your tasks in a flexible way, from daily needs to 557 detailed project-planning, allowing logging, multiple views on your 558 tasks, exporting your agendas, etc. 559 560 Org mode is implemented on top of Outline mode, which makes it 561 possible to keep the content of large files well structured. 562 Visibility cycling and structure editing help to work with the tree. 563 Tables are easily created with a built-in table editor. Plain text 564 URL-like links connect to websites, emails, Usenet messages, BBDB 565 entries, and any files related to the projects. 566 567 Org develops organizational tasks around notes files that contain 568 lists or information about projects as plain text. Project planning 569 and task management make use of metadata which is part of an outline 570 node. Based on this data, specific entries can be extracted in 571 queries and create dynamic @emph{agenda views} that also integrate the Emacs 572 calendar and diary. Org can be used to implement many different 573 project planning schemes, such as David Allen's GTD system. 574 575 Org files can serve as a single source authoring system with export to 576 many different formats such as HTML, @LaTeX{}, Open Document, and 577 Markdown. New export backends can be derived from existing ones, or 578 defined from scratch. 579 580 Org files can include source code blocks, which makes Org uniquely 581 suited for authoring technical documents with code examples. Org 582 source code blocks are fully functional; they can be evaluated in 583 place and their results can be captured in the file. This makes it 584 possible to create a single file reproducible research compendium. 585 586 Org keeps simple things simple. When first fired up, it should feel 587 like a straightforward, easy to use outliner. Complexity is not 588 imposed, but a large amount of functionality is available when needed. 589 Org is a toolbox. Many users actually run only a---very 590 personal---fraction of Org's capabilities, and know that there is more 591 whenever they need it. 592 593 All of this is achieved with strictly plain text files, the most 594 portable and future-proof file format. Org runs in Emacs. Emacs is 595 one of the most widely ported programs, so that Org mode is available 596 on every major platform. 597 598 @cindex FAQ 599 There is a website for Org which provides links to the newest version 600 of Org, as well as additional information, frequently asked questions 601 (FAQ), links to tutorials, etc. This page is located at 602 @uref{https://orgmode.org}. 603 604 @cindex print edition 605 An earlier version (7.3) of this manual was available as a paperback 606 book from the Network Theory Ltd. publishing company, closed in 2009. 607 608 @node Installation 609 @section Installation 610 611 @cindex installation 612 613 Org is included in distributions of GNU Emacs, you probably do not 614 need to install it. Most users will simply activate Org and begin 615 exploring its features. 616 617 If, for one reason or another, you want to install Org on top of this 618 pre-packaged version, you can use the Emacs package system or clone 619 Org's git repository. We @strong{strongly recommend} sticking to a single 620 installation method. 621 622 When installing Org on top of the pre-packaged version, please note 623 that Org stable versions are meant to be fully compatible with the 624 last three stable versions of Emacs but not with older Emacsen. 625 626 Some Org components also depend on third-party packages available 627 through package archives. Org is only guaranteed to be compatible 628 with the latest stable versions of these third-party packages. 629 630 @anchor{Using Emacs packaging system} 631 @subheading Using Emacs packaging system 632 633 Recent Emacs distributions include a packaging system which lets you 634 install Elisp libraries. You can install Org from the ``package menu'', 635 with @kbd{M-x list-packages}. See @ref{Package Menu,Package Menu,,emacs,}. 636 637 @quotation Important 638 You need to do this in a session where no @samp{.org} file has been 639 visited, i.e., where no Org built-in function have been loaded. 640 Otherwise autoload Org functions will mess up the installation. 641 642 @end quotation 643 644 To avoid interference with built-in Org mode, you can use command line: 645 646 @example 647 emacs -Q -batch -eval "(progn (require 'package) (package-initialize) (package-refresh-contents) (package-upgrade 'org))" 648 @end example 649 650 This approach has the advantage of isolating the upgrade process from 651 a running Emacs session, ensuring that version conflicts can not 652 arise. 653 654 @anchor{Using Org's git repository} 655 @subheading Using Org's git repository 656 657 You can clone Org's repository and install Org like this: 658 659 @example 660 $ cd ~/src/ 661 $ git clone https://git.savannah.gnu.org/git/emacs/org-mode.git 662 $ cd org-mode/ 663 $ make autoloads 664 @end example 665 666 Note that in this case, @samp{make autoloads} is mandatory: it defines 667 Org's version in @samp{org-version.el} and Org's autoloads in 668 @samp{org-loaddefs.el}. 669 670 Make sure you set the load path correctly in your Emacs init file: 671 672 @lisp 673 (add-to-list 'load-path "~/src/org-mode/lisp") 674 @end lisp 675 676 You can also compile with @samp{make}, generate the documentation with 677 @samp{make doc}, create a local configuration with @samp{make config} and 678 install Org with @samp{make install}. Please run @samp{make help} to get the 679 list of compilation/installation options. 680 681 For more detailed explanations on Org's build system, please check the 682 Org Build System page on @uref{https://orgmode.org/worg/dev/org-build-system.html, Worg}. 683 684 @anchor{Installing Org's contributed packages} 685 @subheading Installing Org's contributed packages 686 687 Org's repository used to contain @samp{contrib/} directory for add-ons 688 contributed by others. As of Org 9.5, the directory has been moved to 689 the dedicated org-contrib @uref{https://git.sr.ht/~bzg/org-contrib, repository}, which you can install 690 separately as a @uref{https://elpa.nongnu.org/nongnu/org-contrib.html, package} from NonGNU ELPA@. 691 692 There are enough valuable packages maintained outside of the Org repository. 693 Worg has a list of @uref{https://orgmode.org/worg/org-contrib/index.html, org-contrib and external packages}, certainly it is not 694 exhaustive. 695 696 @node Activation 697 @section Activation 698 699 @cindex activation 700 @cindex autoload 701 @cindex ELPA 702 @cindex global key bindings 703 @cindex key bindings, global 704 705 Org mode buffers need Font Lock to be turned on: this is the default 706 in Emacs@footnote{ If you do not use Font Lock globally turn it on in Org 707 buffer with @samp{(add-hook 'org-mode-hook #'turn-on-font-lock)}.}. 708 709 There are compatibility issues between Org mode and some other Elisp 710 packages (see @ref{Conflicts}). Please take the 711 time to check the list. 712 713 @findex org-agenda 714 @findex org-capture 715 @findex org-store-link 716 For a better experience, the three Org commands @code{org-store-link}, 717 @code{org-capture} and @code{org-agenda} ought to be accessible anywhere in 718 Emacs, not just in Org buffers. To that effect, you need to bind them 719 to globally available keys, like the ones reserved for users (see 720 @ref{Key Binding Conventions,,,elisp,}). Here are suggested bindings, 721 please modify the keys to your own liking in your @ref{Init File,personal init file,,emacs,}. 722 723 @lisp 724 (global-set-key (kbd "C-c l") #'org-store-link) 725 (global-set-key (kbd "C-c a") #'org-agenda) 726 (global-set-key (kbd "C-c c") #'org-capture) 727 @end lisp 728 729 @cindex Org mode, turning on 730 Files with the @samp{.org} extension use Org mode by default. To turn on 731 Org mode in a file that does not have the extension @samp{.org}, make the 732 first line of a file look like this: 733 734 @example 735 MY PROJECTS -*- mode: org; -*- 736 @end example 737 738 739 @vindex org-insert-mode-line-in-empty-file 740 @noindent 741 which selects Org mode for this buffer no matter what the file's name 742 is. See also the variable @code{org-insert-mode-line-in-empty-file}. 743 744 Many commands in Org work on the region if the region is @emph{active}. To 745 make use of this, you need to have Transient Mark mode turned on, 746 which is the default. If you do not like it, you can create an active 747 region by using the mouse to select a region, or pressing 748 @kbd{C-@key{SPC}} twice before moving point. 749 750 @node Feedback 751 @section Feedback 752 753 @cindex feedback 754 @cindex contact 755 @cindex bug reports 756 @cindex reporting a bug 757 @cindex request a feature 758 @cindex feature requests 759 @cindex ideas 760 @cindex maintainer 761 @cindex author 762 763 If you find problems with Org, or if you have questions, remarks, or 764 ideas about it, please send an email to the Org mailing list 765 @email{mailto:emacs-orgmode@@gnu.org}. You can subscribe to the list 766 @uref{https://lists.gnu.org/mailman/listinfo/emacs-orgmode, from this web 767 page}. If you are not a member of the mailing list, your mail will 768 be passed to the list after a moderator has approved it@footnote{ Please 769 consider subscribing to the mailing list in order to minimize the work 770 the mailing list moderators have to do.}. We ask you to read and 771 respect the 772 @uref{https://www.gnu.org/philosophy/kind-communication.html, GNU Kind 773 Communications Guidelines} when sending messages on this mailing 774 list. Please allow up to one month for the response and followup if 775 no response is received on the bug report. 776 777 @findex org-version 778 @findex org-submit-bug-report 779 For bug reports, please first try to reproduce the bug with the latest 780 version of Org available---if you are running an outdated version, it 781 is quite possible that the bug has been fixed already. If the bug 782 persists, prepare a report and provide as much information as 783 possible, including the version information of Emacs (@kbd{M-x emacs-version}) and Org (@kbd{M-x org-version}), as well as 784 the Org related setup in the Emacs init file. The easiest way to do 785 this is to use the command 786 787 @example 788 M-x org-submit-bug-report <RET> 789 @end example 790 791 792 @noindent 793 which puts all this information into an Emacs mail buffer so that you 794 only need to add your description. If you are not sending the Email 795 from within Emacs, please copy and paste the content into your Email 796 program. 797 798 Sometimes you might face a problem due to an error in your Emacs or 799 Org mode setup. Before reporting a bug, it is very helpful to start 800 Emacs with minimal customizations and reproduce the problem. Doing so 801 often helps you determine if the problem is with your customization or 802 with Org mode itself. You can start a typical minimal session with 803 a command like the example below. 804 805 @example 806 $ emacs -Q -l /path/to/minimal-org.el 807 @end example 808 809 810 However if you are using Org mode as distributed with Emacs, a minimal 811 setup is not necessary. In that case it is sufficient to start Emacs 812 as @samp{emacs -Q}. The @samp{minimal-org.el} setup file can have contents as 813 shown below. 814 815 @lisp 816 ;;; Minimal setup to load latest `org-mode'. 817 818 ;; Activate debugging. 819 (setq debug-on-error t 820 debug-on-signal nil 821 debug-on-quit nil) 822 823 ;; Add latest Org mode to load path. 824 (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp")) 825 @end lisp 826 827 If you are using Org mode version from Git repository, you can start 828 minimal session using make. 829 830 @example 831 # Bare Emacs 832 make repro 833 # or pass extra arguments 834 make repro REPRO_ARGS="-l /path/to/minimal/config.el /tmp/bug.org" 835 @end example 836 837 838 If an error occurs, a ``backtrace'' can be very useful---see below on 839 how to create one. Often a small example file helps, along with clear 840 information about: 841 842 @enumerate 843 @item 844 What exactly did you do? 845 @item 846 What did you expect to happen? 847 @item 848 What happened instead? 849 @end enumerate 850 851 @cindex performance 852 @cindex profile 853 @cindex slow 854 @cindex slowdown 855 @cindex laggy 856 @cindex not responsive 857 If you experience degraded performance, you can record a ``profile'' and 858 share it on the Org mailing list. See below for the instructions how 859 to record a useful profile. 860 861 Thank you for helping to improve this program. 862 863 @anchor{How to create a useful backtrace} 864 @subheading How to create a useful backtrace 865 866 @cindex backtrace of an error 867 If working with Org produces an error with a message you do not 868 understand, you may have hit a bug. The best way to report this is by 869 providing, in addition to what was mentioned above, a backtrace. This 870 is information from the built-in debugger about where and how the 871 error occurred. Here is how to produce a useful backtrace: 872 873 @enumerate 874 @item 875 Reload uncompiled versions of all Org mode Lisp files. The 876 backtrace contains much more information if it is produced with 877 uncompiled code. To do this, use 878 879 @example 880 C-u M-x org-reload <RET> 881 @end example 882 883 884 @noindent 885 or, from the menu: Org @arrow{} Refresh/Reload @arrow{} Reload Org uncompiled. 886 887 @item 888 Then, activate the debugger: 889 890 @example 891 M-x toggle-debug-on-error <RET> 892 @end example 893 894 895 @noindent 896 or, from the menu: Options @arrow{} Enter Debugger on Error. 897 898 @item 899 Do whatever you have to do to hit the error. Do not forget to 900 document the steps you take. 901 902 @item 903 When you hit the error, a @samp{*Backtrace*} buffer appears on the 904 screen. Save this buffer to a file---for example using @kbd{C-x C-w}---and attach it to your bug report. 905 @end enumerate 906 907 @anchor{How to profile Org performance} 908 @subheading How to profile Org performance 909 910 @cindex profiler 911 Sometimes, Org is becoming slow for no apparent reason. Such slowdown 912 is often caused by interaction between third-party packages and Org 913 mode. However, identifying the root cause is not always straightforward. 914 915 Emacs is able to record performance statistics, which can then be used 916 to find out which functions are taking most of the time to execute. 917 To record the statistics, one can use so-called profiler. To use the 918 Emacs profiler, we recommend the following steps: 919 920 @enumerate 921 @item 922 Make sure that no profiler is currently active: 923 924 @example 925 M-x profiler-stop <RET> 926 @end example 927 928 @item 929 Start a new CPU profiler session: 930 931 @example 932 M-x profiler-start <RET> cpu <RET> 933 @end example 934 935 @item 936 Use Emacs as usual, performing the actions that are deemed slow. 937 938 @item 939 Display and examine the recorded performance statistics: 940 941 @example 942 M-x profiler-report <RET> 943 @end example 944 945 946 This command will display a summary of the commands and functions 947 that have been executed between @code{profiler-start} and 948 @code{profiler-report} invocations, with command taking most of the time 949 displayed on top. 950 951 @samp{<TAB>} key can be used to fold and unfold lines in the profiler 952 buffer. The child items revealed upon unfolding are the functions 953 and commands called by the unfolded parent. 954 955 The root causes are often buried deep inside sub-children items in 956 the profiler. You can press @samp{B} (@code{profiler-report-render-reversed-calltree}) 957 to quickly reveal the actual function/command that takes most of 958 the time to run. 959 960 Pressing @samp{C} @code{profiler-report-render-calltree} will recover the 961 original view. 962 963 @item 964 If you need further help, you can share the statistics data. 965 966 Just save the data by issuing 967 968 @example 969 M-x profiler-report-write-profile <RET> 970 /path/to/profile-file-to-be-saved <RET> 971 @end example 972 973 974 Then, you can attached the saved file to your email to the Org 975 mailing list, alongside with details about what you did to trigger 976 the slowdown. 977 978 Note that the saved statistics will only contain the function names 979 and how long their execution takes. No private data will be 980 recorded. 981 @end enumerate 982 983 @node Conventions 984 @section Typesetting Conventions Used in this Manual 985 986 @anchor{TODO keywords tags properties etc} 987 @subheading TODO keywords, tags, properties, etc. 988 989 Org uses various syntactical elements: TODO keywords, tags, property 990 names, keywords, blocks, etc. In this manual we use the following 991 conventions: 992 993 @table @asis 994 @item @samp{TODO} 995 @itemx @samp{WAITING} 996 TODO keywords are written with all capitals, even if they are 997 user-defined. 998 999 @item @samp{boss} 1000 @itemx @samp{ARCHIVE} 1001 Tags are case-sensitive. User-defined tags are usually written in 1002 lowercase; built-in tags with special meaning are written as they 1003 should appear in the document, usually with all capitals. 1004 1005 @item @samp{Release} 1006 @itemx @samp{PRIORITY} 1007 User-defined properties are capitalized; built-in properties with 1008 special meaning are written with all capitals. 1009 1010 @item @samp{TITLE} 1011 @itemx @samp{BEGIN} @dots{} @samp{END} 1012 Keywords and blocks are written in uppercase to enhance their 1013 readability, but you can use lowercase in your Org files. 1014 @end table 1015 1016 @anchor{Key bindings and commands} 1017 @subheading Key bindings and commands 1018 1019 The manual lists both the keys and the corresponding commands for 1020 accessing a functionality. Org mode often uses the same key for 1021 different functions, depending on context. The command that is bound 1022 to such keys has a generic name, like @code{org-metaright}. In the manual 1023 we will, wherever possible, give the function that is internally 1024 called by the generic command. For example, in the chapter on 1025 document structure, @kbd{M-@key{RIGHT}} will be listed to call 1026 @code{org-do-demote}, while in the chapter on tables, it will be listed to 1027 call @code{org-table-move-column-right}. 1028 1029 @node Document Structure 1030 @chapter Document Structure 1031 1032 @cindex document structure 1033 @cindex structure of document 1034 Org is an outliner. Outlines allow a document to be organized in 1035 a hierarchical structure, which, least for me, is the best 1036 representation of notes and thoughts. An overview of this structure 1037 is achieved by folding, i.e., hiding large parts of the document to 1038 show only the general document structure and the parts currently being 1039 worked on. Org greatly simplifies the use of outlines by compressing 1040 the entire show and hide functionalities into a single command, 1041 @code{org-cycle}, which is bound to the @kbd{@key{TAB}} key. 1042 1043 @menu 1044 * Headlines:: How to typeset Org tree headlines. 1045 * Visibility Cycling:: Show and hide, much simplified. 1046 * Motion:: Jumping to other headlines. 1047 * Structure Editing:: Changing sequence and level of headlines. 1048 * Sparse Trees:: Matches embedded in context. 1049 * Plain Lists:: Additional structure within an entry. 1050 * Drawers:: Tucking stuff away. 1051 * Blocks:: Folding blocks. 1052 @end menu 1053 1054 @node Headlines 1055 @section Headlines 1056 1057 @cindex headlines 1058 @cindex outline tree 1059 @vindex org-special-ctrl-a/e 1060 @vindex org-special-ctrl-k 1061 @vindex org-ctrl-k-protect-subtree 1062 1063 Headlines define the structure of an outline tree. Org headlines 1064 start on the left margin@footnote{See the variables @code{org-special-ctrl-a/e}, @code{org-special-ctrl-k}, 1065 and @code{org-ctrl-k-protect-subtree} to configure special behavior of 1066 @kbd{C-a}, @kbd{C-e}, and @kbd{C-k} in headlines. Note 1067 also that clocking only works with headings indented less than 30 1068 stars.} with one or more stars followed by 1069 a space. For example: 1070 1071 @example 1072 * Top level headline 1073 ** Second level 1074 *** Third level 1075 some text 1076 *** Third level 1077 more text 1078 * Another top level headline 1079 @end example 1080 1081 @vindex org-footnote-section 1082 The name defined in @code{org-footnote-section} is reserved. Do not use it 1083 as a title for your own headings. 1084 1085 Some people find the many stars too noisy and would prefer an outline 1086 that has whitespace followed by a single star as headline starters. 1087 This can be achieved using an Org Indent minor mode. See @ref{Clean View} for more information. 1088 1089 Headlines are not numbered. However, you may want to dynamically 1090 number some, or all, of them. See @ref{Dynamic Headline Numbering}. 1091 1092 @vindex org-cycle-separator-lines 1093 An empty line after the end of a subtree is considered part of it and 1094 is hidden when the subtree is folded. However, if you leave at least 1095 two empty lines, one empty line remains visible after folding the 1096 subtree, in order to structure the collapsed view. See the variable 1097 @code{org-cycle-separator-lines} to modify this behavior. 1098 1099 @node Visibility Cycling 1100 @section Visibility Cycling 1101 1102 @cindex cycling, visibility 1103 @cindex visibility cycling 1104 @cindex trees, visibility 1105 @cindex show hidden text 1106 @cindex hide text 1107 1108 @menu 1109 * Global and local cycling:: Cycling through various visibility states. 1110 * Initial visibility:: Setting the initial visibility state. 1111 * Catching invisible edits:: Preventing mistakes when editing invisible parts. 1112 @end menu 1113 1114 @node Global and local cycling 1115 @subsection Global and local cycling 1116 1117 @cindex subtree visibility states 1118 @cindex subtree cycling 1119 @cindex folded, subtree visibility state 1120 @cindex children, subtree visibility state 1121 @cindex subtree, subtree visibility state 1122 1123 Outlines make it possible to hide parts of the text in the buffer. 1124 Org uses just two commands, bound to @kbd{@key{TAB}} and 1125 @kbd{S-@key{TAB}} to change the visibility in the buffer. 1126 1127 @table @asis 1128 @item @kbd{@key{TAB}} (@code{org-cycle}) 1129 @kindex TAB 1130 @findex org-cycle 1131 @emph{Subtree cycling}: Rotate current subtree among the states 1132 1133 @example 1134 ,-> FOLDED -> CHILDREN -> SUBTREE --. 1135 '-----------------------------------' 1136 @end example 1137 1138 @vindex org-cycle-emulate-tab 1139 Point must be on a headline for this to work@footnote{ See, however, the 1140 option @code{org-cycle-emulate-tab}.}. 1141 1142 @item @kbd{S-@key{TAB}} (@code{org-global-cycle}) 1143 @itemx @kbd{C-u @key{TAB}} 1144 @cindex global visibility states 1145 @cindex global cycling 1146 @cindex overview, global visibility state 1147 @cindex contents, global visibility state 1148 @cindex show all, global visibility state 1149 @kindex C-u TAB 1150 @kindex S-TAB 1151 @findex org-global-cycle 1152 @emph{Global cycling}: Rotate the entire buffer among the states 1153 1154 @example 1155 ,-> OVERVIEW -> CONTENTS -> SHOW ALL --. 1156 '--------------------------------------' 1157 @end example 1158 1159 When @kbd{S-@key{TAB}} is called with a numeric prefix argument 1160 @var{N}, view contents only up to headlines of level 1161 @var{N}. 1162 1163 Note that inside tables (see @ref{Tables}), @kbd{S-@key{TAB}} jumps to the 1164 previous field instead. 1165 1166 @vindex org-cycle-global-at-bob 1167 You can run global cycling using @kbd{@key{TAB}} only if point is at 1168 the very beginning of the buffer, but not on a headline, and 1169 @code{org-cycle-global-at-bob} is set to a non-@code{nil} value. 1170 1171 @item @kbd{C-u C-u @key{TAB}} (@code{org-cycle-set-startup-visibility}) 1172 @cindex startup visibility 1173 @kindex C-u C-u TAB 1174 @findex org-cycle-set-startup-visibility 1175 Switch back to the startup visibility of the buffer (see @ref{Initial visibility}). 1176 1177 @item @kbd{C-u C-u C-u @key{TAB}} (@code{org-show-all}) 1178 @cindex show all, command 1179 @kindex C-u C-u C-u TAB 1180 @findex org-show-all 1181 Show all, including drawers. 1182 1183 @item @kbd{C-c C-r} (@code{org-reveal}) 1184 @cindex revealing context 1185 @kindex C-c C-r 1186 @findex org-reveal 1187 Reveal context around point, showing the current entry, the 1188 following heading and the hierarchy above. It is useful for working 1189 near a location that has been exposed by a sparse tree command (see 1190 @ref{Sparse Trees}) or an agenda command (see @ref{Agenda Commands}). With a prefix argument, show, on each level, all sibling 1191 headings. With a double prefix argument, also show the entire 1192 subtree of the parent. 1193 1194 @item @kbd{C-c C-k} (@code{org-show-branches}) 1195 @cindex show branches, command 1196 @kindex C-c C-k 1197 @findex org-show-branches 1198 Expose all the headings of the subtree, but not their bodies. 1199 1200 @item @kbd{C-c @key{TAB}} (@code{org-show-children}) 1201 @cindex show children, command 1202 @kindex C-c TAB 1203 @findex org-show-children 1204 Expose all direct children of the subtree. With a numeric prefix 1205 argument @var{N}, expose all children down to level 1206 @var{N}. 1207 1208 @item @kbd{C-c C-x b} (@code{org-tree-to-indirect-buffer}) 1209 @kindex C-c C-x b 1210 @findex org-tree-to-indirect-buffer 1211 Show the current subtree in an indirect buffer@footnote{The indirect buffer contains the entire buffer, but is narrowed 1212 to the current tree. Editing the indirect buffer also changes the 1213 original buffer, but without affecting visibility in that buffer. For 1214 more information about indirect buffers, see @ref{Indirect Buffers,GNU Emacs Manual,,emacs,}.}. With 1215 a numeric prefix argument @var{N}, go up to level @var{N} 1216 and then take that tree. If @var{N} is negative then go up 1217 that many levels. With a @kbd{C-u} prefix, do not remove the 1218 previously used indirect buffer. 1219 1220 @item @kbd{C-c C-x v} (@code{org-copy-visible}) 1221 @kindex C-c C-x v 1222 @findex org-copy-visible 1223 Copy the @emph{visible} text in the region into the kill ring. 1224 @end table 1225 1226 @node Initial visibility 1227 @subsection Initial visibility 1228 1229 @vindex org-startup-folded 1230 When Emacs first visits an Org file, the global state is set to 1231 @code{showeverything}, i.e., all file content is visible@footnote{ When 1232 @code{org-agenda-inhibit-startup} is non-@code{nil}, Org does not honor the 1233 default visibility state when first opening a file for the agenda (see 1234 @ref{Speeding Up Your Agendas}).}. This can be configured through the 1235 variable @code{org-startup-folded}, or on a per-file basis by adding one of 1236 the following lines anywhere in the buffer: 1237 1238 @cindex @samp{STARTUP}, keyword 1239 @example 1240 #+STARTUP: overview 1241 #+STARTUP: content 1242 #+STARTUP: showall 1243 #+STARTUP: show2levels 1244 #+STARTUP: show3levels 1245 #+STARTUP: show4levels 1246 #+STARTUP: show5levels 1247 #+STARTUP: showeverything 1248 @end example 1249 1250 @cindex @samp{VISIBILITY}, property 1251 Furthermore, any entries with a @samp{VISIBILITY} property (see @ref{Properties and Columns}) get their visibility adapted accordingly. Allowed values 1252 for this property are @samp{folded}, @samp{children}, @samp{content}, and @samp{all}. 1253 1254 @table @asis 1255 @item @kbd{C-u C-u @key{TAB}} (@code{org-cycle-set-startup-visibility}) 1256 @kindex C-u C-u TAB 1257 @findex org-cycle-set-startup-visibility 1258 Switch back to the startup visibility of the buffer, i.e., whatever 1259 is requested by startup options and @samp{VISIBILITY} properties in 1260 individual entries. 1261 @end table 1262 1263 @node Catching invisible edits 1264 @subsection Catching invisible edits 1265 1266 @cindex edits, catching invisible 1267 1268 @vindex org-fold-catch-invisible-edits 1269 @vindex org-fold-catch-invisible-edits-commands 1270 Sometimes you may inadvertently edit an invisible part of the buffer 1271 and be confused on what has been edited and how to undo the mistake. 1272 By default, Org prevents such edits for a limited set of user 1273 commands. Users can control which commands are affected by 1274 customizing @code{org-fold-catch-invisible-edits-commands}. 1275 1276 The strategy used to decide if a given edit is dangerous is controlled 1277 by @code{org-fold-catch-invisible-edits}. See the docstring of this option 1278 on the available strategies. Set the option to @code{nil} to disable 1279 catching invisible edits completely. 1280 1281 @node Motion 1282 @section Motion 1283 1284 @cindex motion, between headlines 1285 @cindex jumping, to headlines 1286 @cindex headline navigation 1287 1288 The following commands jump to other headlines in the buffer. 1289 1290 @table @asis 1291 @item @kbd{C-c C-n} (@code{org-next-visible-heading}) 1292 @kindex C-c C-n 1293 @findex org-next-visible-heading 1294 Next heading. 1295 1296 @item @kbd{C-c C-p} (@code{org-previous-visible-heading}) 1297 @kindex C-c C-p 1298 @findex org-previous-visible-heading 1299 Previous heading. 1300 1301 @item @kbd{C-c C-f} (@code{org-forward-heading-same-level}) 1302 @kindex C-c C-f 1303 @findex org-forward-heading-same-level 1304 Next heading same level. 1305 1306 @item @kbd{C-c C-b} (@code{org-backward-heading-same-level}) 1307 @kindex C-c C-b 1308 @findex org-backward-heading-same-level 1309 Previous heading same level. 1310 1311 @item @kbd{C-c C-u} (@code{outline-up-heading}) 1312 @kindex C-c C-u 1313 @findex outline-up-heading 1314 Backward to higher level heading. 1315 1316 @item @kbd{C-c C-j} (@code{org-goto}) 1317 @kindex C-c C-j 1318 @findex org-goto 1319 @vindex org-goto-auto-isearch 1320 Jump to a different place without changing the current outline 1321 visibility. Shows the document structure in a temporary buffer, 1322 where you can use the following keys to find your destination: 1323 1324 @multitable @columnfractions 0.3 0.7 1325 @item @kbd{@key{TAB}} 1326 @tab Cycle visibility. 1327 @item @kbd{@key{DOWN}} / @kbd{@key{UP}} 1328 @tab Next/previous visible headline. 1329 @item @kbd{@key{RET}} 1330 @tab Select this location. 1331 @item @kbd{/} 1332 @tab Do a Sparse-tree search 1333 @end multitable 1334 1335 @noindent 1336 The following keys work if you turn off @code{org-goto-auto-isearch} 1337 1338 @multitable @columnfractions 0.3 0.7 1339 @item @kbd{n} / @kbd{p} 1340 @tab Next/previous visible headline. 1341 @item @kbd{f} / @kbd{b} 1342 @tab Next/previous headline same level. 1343 @item @kbd{u} 1344 @tab One level up. 1345 @item @kbd{0} @dots{} @kbd{9} 1346 @tab Digit argument. 1347 @item @kbd{q} 1348 @tab Quit. 1349 @end multitable 1350 1351 @vindex org-goto-interface 1352 @noindent 1353 See also the variable @code{org-goto-interface}. 1354 @end table 1355 1356 @node Structure Editing 1357 @section Structure Editing 1358 1359 @cindex structure editing 1360 @cindex headline, promotion and demotion 1361 @cindex promotion, of subtrees 1362 @cindex demotion, of subtrees 1363 @cindex subtree, cut and paste 1364 @cindex pasting, of subtrees 1365 @cindex cutting, of subtrees 1366 @cindex copying, of subtrees 1367 @cindex sorting, of subtrees 1368 @cindex subtrees, cut and paste 1369 1370 @table @asis 1371 @item @kbd{M-@key{RET}} (@code{org-meta-return}) 1372 @kindex M-RET 1373 @findex org-meta-return 1374 @vindex org-M-RET-may-split-line 1375 Insert a new heading, item or row. 1376 1377 If the command is used at the @emph{beginning} of a line, and if there is 1378 a heading or a plain list item (see @ref{Plain Lists}) at point, the new 1379 heading/item is created @emph{before} the current line. When used at the 1380 beginning of a regular line of text, turn that line into a heading. 1381 1382 When this command is used in the middle of a line, the line is split 1383 and the rest of the line becomes the new item or headline. If you 1384 do not want the line to be split, customize 1385 @code{org-M-RET-may-split-line}. 1386 1387 Calling the command with a @kbd{C-u} prefix unconditionally 1388 inserts a new heading at the end of the current subtree, thus 1389 preserving its contents. With a double @kbd{C-u C-u} prefix, 1390 the new heading is created at the end of the parent subtree instead. 1391 1392 @item @kbd{C-@key{RET}} (@code{org-insert-heading-respect-content}) 1393 @kindex C-RET 1394 @findex org-insert-heading-respect-content 1395 Insert a new heading at the end of the current subtree. 1396 1397 @item @kbd{M-S-@key{RET}} (@code{org-insert-todo-heading}) 1398 @kindex M-S-RET 1399 @findex org-insert-todo-heading 1400 @vindex org-treat-insert-todo-heading-as-state-change 1401 Insert new TODO entry with same level as current heading. See also 1402 the variable @code{org-treat-insert-todo-heading-as-state-change}. 1403 1404 @item @kbd{C-S-@key{RET}} (@code{org-insert-todo-heading-respect-content}) 1405 @kindex C-S-RET 1406 @findex org-insert-todo-heading-respect-content 1407 Insert new TODO entry with same level as current heading. Like 1408 @kbd{C-@key{RET}}, the new headline is inserted after the current 1409 subtree. 1410 1411 @item @kbd{@key{TAB}} (@code{org-cycle}) 1412 @kindex TAB 1413 @findex org-cycle 1414 In a new entry with no text yet, the first @kbd{@key{TAB}} demotes 1415 the entry to become a child of the previous one. The next 1416 @kbd{@key{TAB}} makes it a parent, and so on, all the way to top 1417 level. Yet another @kbd{@key{TAB}}, and you are back to the initial 1418 level. 1419 1420 @item @kbd{M-@key{LEFT}} (@code{org-do-promote}) 1421 @itemx @kbd{M-@key{RIGHT}} (@code{org-do-demote}) 1422 @kindex M-LEFT 1423 @findex org-do-promote 1424 @kindex M-RIGHT 1425 @findex org-do-demote 1426 Promote or demote current heading by one level. 1427 1428 @cindex region, active 1429 @cindex active region 1430 @cindex transient mark mode 1431 When there is an active region---i.e., when Transient Mark mode is 1432 active---promotion and demotion work on all headlines in the region. 1433 To select a region of headlines, it is best to place both point and 1434 mark at the beginning of a line, mark at the beginning of the first 1435 headline, and point at the line just after the last headline to 1436 change. 1437 1438 @item @kbd{M-S-@key{LEFT}} (@code{org-promote-subtree}) 1439 @kindex M-S-LEFT 1440 @findex org-promote-subtree 1441 Promote the current subtree by one level. 1442 1443 @item @kbd{M-S-@key{RIGHT}} (@code{org-demote-subtree}) 1444 @kindex M-S-RIGHT 1445 @findex org-demote-subtree 1446 Demote the current subtree by one level. 1447 1448 @item @kbd{M-@key{UP}} (@code{org-move-subtree-up}) 1449 @kindex M-UP 1450 @findex org-move-subtree-up 1451 Move subtree up, i.e., swap with previous subtree of same level. 1452 1453 @item @kbd{M-@key{DOWN}} (@code{org-move-subtree-down}) 1454 @kindex M-DOWN 1455 @findex org-move-subtree-down 1456 Move subtree down, i.e., swap with next subtree of same level. 1457 1458 @item @kbd{C-c @@} (@code{org-mark-subtree}) 1459 @kindex C-c @@ 1460 @findex org-mark-subtree 1461 Mark the subtree at point. Hitting repeatedly marks subsequent 1462 subtrees of the same level as the marked subtree. 1463 1464 @item @kbd{C-c C-x C-w} (@code{org-cut-subtree}) 1465 @kindex C-c C-x C-w 1466 @findex org-cut-subtree 1467 Kill subtree, i.e., remove it from buffer but save in kill ring. 1468 With a numeric prefix argument N, kill N sequential subtrees. 1469 1470 @item @kbd{C-c C-x M-w} (@code{org-copy-subtree}) 1471 @kindex C-c C-x M-w 1472 @findex org-copy-subtree 1473 Copy subtree to kill ring. With a numeric prefix argument N, copy 1474 the N sequential subtrees. 1475 1476 @item @kbd{C-c C-x C-y} (@code{org-paste-subtree}) 1477 @kindex C-c C-x C-y 1478 @findex org-paste-subtree 1479 Yank subtree from kill ring. This does modify the level of the 1480 subtree to make sure the tree fits in nicely at the yank position. 1481 The yank level can also be specified with a numeric prefix argument, 1482 or by yanking after a headline marker like @samp{****}. With 1483 @kbd{C-u} prefix, force inserting as a sibling. With 1484 @kbd{C-u C-u} prefix argument, force inserting as a child. 1485 1486 @item @kbd{C-y} (@code{org-yank}) 1487 @kindex C-y 1488 @findex org-yank 1489 @vindex org-yank-adjusted-subtrees 1490 @vindex org-yank-folded-subtrees 1491 Depending on the variables @code{org-yank-adjusted-subtrees} and 1492 @code{org-yank-folded-subtrees}, Org's internal @code{yank} command pastes 1493 subtrees folded and in a clever way, using the same command as 1494 @kbd{C-c C-x C-y}. With the default settings, no level 1495 adjustment takes place, but the yanked tree is folded unless doing 1496 so would swallow text previously visible. Any prefix argument to 1497 this command forces a normal @code{yank} to be executed, with the prefix 1498 passed along. A good way to force a normal yank is @kbd{C-u C-y}. If you use @code{yank-pop} after a yank, it yanks previous kill 1499 items plainly, without adjustment and folding. 1500 1501 @item @kbd{C-c C-x c} (@code{org-clone-subtree-with-time-shift}) 1502 @kindex C-c C-x c 1503 @findex org-clone-subtree-with-time-shift 1504 Clone a subtree by making a number of sibling copies of it. You are 1505 prompted for the number of copies to make, and you can also specify 1506 if any timestamps in the entry should be shifted. This can be 1507 useful, for example, to create a number of tasks related to a series 1508 of lectures to prepare. For more details, see the docstring of the 1509 command @code{org-clone-subtree-with-time-shift}. 1510 1511 @item @kbd{C-c C-w} (@code{org-refile}) 1512 @kindex C-c C-w 1513 @findex org-refile 1514 Refile entry or region to a different location. See @ref{Refile and Copy}. 1515 1516 @item @kbd{C-c ^} (@code{org-sort}) 1517 @kindex C-c ^ 1518 @findex org-sort 1519 Sort same-level entries. When there is an active region, all 1520 entries in the region are sorted. Otherwise the children of the 1521 current headline are sorted. The command prompts for the sorting 1522 method, which can be alphabetically, numerically, by time---first 1523 timestamp with active preferred, creation time, scheduled time, 1524 deadline time---by priority, by TODO keyword---in the sequence the 1525 keywords have been defined in the setup---or by the value of 1526 a property. Reverse sorting is possible as well. You can also 1527 supply your own function to extract the sorting key. With 1528 a @kbd{C-u} prefix, sorting is case-sensitive. 1529 1530 @item @kbd{C-x n s} (@code{org-narrow-to-subtree}) 1531 @kindex C-x n s 1532 @findex org-narrow-to-subtree 1533 Narrow buffer to current subtree. 1534 1535 @item @kbd{C-x n b} (@code{org-narrow-to-block}) 1536 @kindex C-x n b 1537 @findex org-narrow-to-block 1538 Narrow buffer to current block. 1539 1540 @item @kbd{C-x n w} (@code{widen}) 1541 @kindex C-x n w 1542 @findex widen 1543 Widen buffer to remove narrowing. 1544 1545 @item @kbd{C-c *} (@code{org-toggle-heading}) 1546 @kindex C-c * 1547 @findex org-toggle-heading 1548 Turn a normal line or plain list item into a headline---so that it 1549 becomes a subheading at its location. Also turn a headline into 1550 a normal line by removing the stars. If there is an active region, 1551 turn all lines in the region into headlines. If the first line in 1552 the region was an item, turn only the item lines into headlines. 1553 Finally, if the first line is a headline, remove the stars from all 1554 headlines in the region. 1555 @end table 1556 1557 Note that when point is inside a table (see @ref{Tables}), the Meta-Cursor 1558 keys have different functionality. 1559 1560 @node Sparse Trees 1561 @section Sparse Trees 1562 1563 @cindex sparse trees 1564 @cindex trees, sparse 1565 @cindex folding, sparse trees 1566 @cindex occur, command 1567 1568 @vindex org-show-context-detail 1569 An important feature of Org mode is the ability to construct @emph{sparse 1570 trees} for selected information in an outline tree, so that the entire 1571 document is folded as much as possible, but the selected information 1572 is made visible along with the headline structure above it@footnote{ See 1573 also the variable @code{org-show-context-detail} to decide how much context 1574 is shown around each match.}. Just try it out and you will see 1575 immediately how it works. 1576 1577 Org mode contains several commands creating such trees, all these 1578 commands can be accessed through a dispatcher: 1579 1580 @table @asis 1581 @item @kbd{C-c /} (@code{org-sparse-tree}) 1582 @kindex C-c / 1583 @findex org-sparse-tree 1584 This prompts for an extra key to select a sparse-tree creating 1585 command. 1586 1587 @item @kbd{C-c / r} or @kbd{C-c / /} (@code{org-occur}) 1588 @kindex C-c / r 1589 @kindex C-c / / 1590 @findex org-occur 1591 @vindex org-remove-highlights-with-change 1592 Prompts for a regexp (see @ref{Regular Expressions}) and shows a 1593 sparse tree with all matches. If the match is in a headline, the 1594 headline is made visible. If the match is in the body of an entry, 1595 headline and body are made visible. In order to provide minimal 1596 context, also the full hierarchy of headlines above the match is 1597 shown, as well as the headline following the match. Each match is 1598 also highlighted; the highlights disappear when the buffer is 1599 changed by an editing command, or by pressing @kbd{C-c C-c}@footnote{ This depends on the option 1600 @code{org-remove-highlights-with-change}.}. When called with a 1601 @kbd{C-u} prefix argument, previous highlights are kept, so 1602 several calls to this command can be stacked. 1603 1604 @item @kbd{M-g n} or @kbd{M-g M-n} (@code{next-error}) 1605 @kindex M-g n 1606 @kindex M-g M-n 1607 @findex next-error 1608 Jump to the next sparse tree match in this buffer. 1609 1610 @item @kbd{M-g p} or @kbd{M-g M-p} (@code{previous-error}) 1611 @kindex M-g p 1612 @kindex M-g M-p 1613 @findex previous-error 1614 Jump to the previous sparse tree match in this buffer. 1615 @end table 1616 1617 @vindex org-agenda-custom-commands 1618 For frequently used sparse trees of specific search strings, you can 1619 use the variable @code{org-agenda-custom-commands} to define fast keyboard 1620 access to specific sparse trees. These commands will then be 1621 accessible through the agenda dispatcher (see @ref{Agenda Dispatcher}). 1622 For example: 1623 1624 @lisp 1625 (setq org-agenda-custom-commands 1626 '(("f" occur-tree "FIXME"))) 1627 @end lisp 1628 1629 @noindent 1630 defines the key @kbd{f} as a shortcut for creating a sparse tree 1631 matching the string @samp{FIXME}. 1632 1633 The other sparse tree commands select headings based on TODO keywords, 1634 tags, or properties and are discussed later in this manual. 1635 1636 @kindex C-c C-e C-v 1637 @cindex printing sparse trees 1638 @cindex visible text, printing 1639 To print a sparse tree, you can use the Emacs command 1640 @code{ps-print-buffer-with-faces} which does not print invisible parts of 1641 the document. Or you can use the command @kbd{C-c C-e C-v} to 1642 export only the visible part of the document and print the resulting 1643 file. 1644 1645 @node Plain Lists 1646 @section Plain Lists 1647 1648 @cindex plain lists 1649 @cindex lists, plain 1650 @cindex lists, ordered 1651 @cindex ordered lists 1652 1653 Within an entry of the outline tree, hand-formatted lists can provide 1654 additional structure. They also provide a way to create lists of 1655 checkboxes (see @ref{Checkboxes}). Org supports editing such lists, and 1656 every exporter (see @ref{Exporting}) can parse and format them. 1657 1658 Org knows ordered lists, unordered lists, and description lists. 1659 1660 @itemize 1661 @item 1662 @emph{Unordered} list items start with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a bullet, lines must be indented so that they 1663 are not interpreted as headlines. Also, when you are hiding leading 1664 stars to get a clean outline view, plain list items starting with 1665 a star may be hard to distinguish from true headlines. In short: even 1666 though @samp{*} is supported, it may be better to not use it for plain list 1667 items.} as bullets. 1668 1669 @item 1670 @vindex org-plain-list-ordered-item-terminator 1671 @vindex org-alphabetical-lists 1672 @emph{Ordered} list items start with a numeral followed by either a 1673 period or a right parenthesis@footnote{ You can filter out any of them by 1674 configuring @code{org-plain-list-ordered-item-terminator}.}, such as @samp{1.} 1675 or @samp{1)}@footnote{You can also get @samp{a.}, @samp{A.}, @samp{a)} and @samp{A)} by configuring 1676 @code{org-list-allow-alphabetical}. To minimize confusion with normal 1677 text, those are limited to one character only. Beyond that limit, 1678 bullets automatically become numbers.} If you want a list to start with a different 1679 value---e.g., 20---start the text of the item with @samp{[@@20]}@footnote{If there's a checkbox in the item, the cookie must be put 1680 @emph{before} the checkbox. If you have activated alphabetical lists, you 1681 can also use counters like @samp{[@@b]}.}. 1682 Those constructs can be used in any item of the list in order to 1683 enforce a particular numbering. 1684 1685 @item 1686 @emph{Description} list items are unordered list items, and contain the 1687 separator @samp{::} to distinguish the description @emph{term} from the 1688 description. 1689 @end itemize 1690 1691 Items belonging to the same list must have the same indentation on the 1692 first line. In particular, if an ordered list reaches number @samp{10.}, 1693 then the 2-digit numbers must be written left-aligned with the other 1694 numbers in the list. An item ends before the next line that is less 1695 or equally indented than its bullet/number. 1696 1697 A list ends whenever every item has ended, which means before any line 1698 less or equally indented than items at top level. It also ends before 1699 two blank lines. In that case, all items are closed. Here is an 1700 example: 1701 1702 @example 1703 * Lord of the Rings 1704 My favorite scenes are (in this order) 1705 1. The attack of the Rohirrim 1706 2. Eowyn's fight with the witch king 1707 + this was already my favorite scene in the book 1708 + I really like Miranda Otto. 1709 3. Peter Jackson being shot by Legolas 1710 - on DVD only 1711 He makes a really funny face when it happens. 1712 8. [@@8] <favorite scenes 4 to 8 are skipped for brevity> 1713 But in the end, no individual scenes matter but the film as a whole. 1714 Important actors in this film are: 1715 - Elijah Wood :: He plays Frodo 1716 - Sean Astin :: He plays Sam, Frodo's friend. I still remember him 1717 very well from his role as Mikey Walsh in /The Goonies/. 1718 @end example 1719 1720 Org supports these lists by tuning filling and wrapping commands to 1721 deal with them correctly, and by exporting them properly (see 1722 @ref{Exporting}). Since indentation is what governs the structure of these 1723 lists, many structural constructs like @samp{#+BEGIN_} blocks can be 1724 indented to signal that they belong to a particular item. 1725 1726 @vindex org-list-demote-modify-bullet 1727 @vindex org-list-indent-offset 1728 If you find that using a different bullet for a sub-list---than that 1729 used for the current list-level---improves readability, customize the 1730 variable @code{org-list-demote-modify-bullet}. To get a greater difference 1731 of indentation between items and theirs sub-items, customize 1732 @code{org-list-indent-offset}. 1733 1734 @vindex org-list-automatic-rules 1735 The following commands act on items when point is in the first line of 1736 an item---the line with the bullet or number. Some of them imply the 1737 application of automatic rules to keep list structure intact. If some 1738 of these actions get in your way, configure @code{org-list-automatic-rules} 1739 to disable them individually. 1740 1741 @table @asis 1742 @item @kbd{@key{TAB}} (@code{org-cycle}) 1743 @cindex cycling, in plain lists 1744 @kindex TAB 1745 @findex org-cycle 1746 @vindex org-cycle-include-plain-lists 1747 Items can be folded just like headline levels. Normally this works 1748 only if point is on a plain list item. For more details, see the 1749 variable @code{org-cycle-include-plain-lists}. If this variable is set 1750 to @code{integrate}, plain list items are treated like low-level 1751 headlines. The level of an item is then given by the indentation of 1752 the bullet/number. Items are always subordinate to real headlines, 1753 however; the hierarchies remain completely separated. In a new item 1754 with no text yet, the first @kbd{@key{TAB}} demotes the item to 1755 become a child of the previous one. Subsequent @kbd{@key{TAB}}s move 1756 the item to meaningful levels in the list and eventually get it back 1757 to its initial position. 1758 1759 @item @kbd{M-@key{RET}} (@code{org-insert-heading}) 1760 @kindex M-RET 1761 @findex org-insert-heading 1762 @vindex org-M-RET-may-split-line 1763 Insert new item at current level. With a prefix argument, force a 1764 new heading (see @ref{Structure Editing}). If this command is used 1765 in the middle of an item, that item is @emph{split} in two, and the 1766 second part becomes the new item@footnote{ If you do not want the item to 1767 be split, customize the variable @code{org-M-RET-may-split-line}.}. If 1768 this command is executed @emph{before item's body}, the new item is 1769 created @emph{before} the current one. 1770 1771 @item @kbd{M-S-@key{RET}} 1772 @kindex M-S-RET 1773 Insert a new item with a checkbox (see @ref{Checkboxes}). 1774 1775 @item @kbd{S-@key{UP}} 1776 @itemx @kbd{S-@key{DOWN}} 1777 @kindex S-UP 1778 @kindex S-DOWN 1779 @cindex shift-selection-mode 1780 @vindex org-support-shift-select 1781 @vindex org-list-use-circular-motion 1782 Jump to the previous/next item in the current list, but only if 1783 @code{org-support-shift-select} is off@footnote{ If you want to cycle around 1784 items that way, you may customize @code{org-list-use-circular-motion}.}. 1785 If not, you can still use paragraph jumping commands like 1786 @kbd{C-@key{UP}} and @kbd{C-@key{DOWN}} to quite similar effect. 1787 1788 @item @kbd{M-@key{UP}} 1789 @itemx @kbd{M-@key{DOWN}} 1790 @kindex M-UP 1791 @kindex M-DOWN 1792 Move the item including subitems up/down@footnote{ See 1793 @code{org-list-use-circular-motion} for a cyclic behavior.}, i.e., swap 1794 with previous/next item of same indentation. If the list is 1795 ordered, renumbering is automatic. 1796 1797 @item @kbd{M-@key{LEFT}} 1798 @itemx @kbd{M-@key{RIGHT}} 1799 @kindex M-LEFT 1800 @kindex M-RIGHT 1801 Decrease/increase the indentation of an item, leaving children 1802 alone. 1803 1804 @item @kbd{M-S-@key{LEFT}} 1805 @itemx @kbd{M-S-@key{RIGHT}} 1806 @kindex M-S-LEFT 1807 @kindex M-S-RIGHT 1808 Decrease/increase the indentation of the item, including subitems. 1809 Initially, the item tree is selected based on current indentation. 1810 When these commands are executed several times in direct succession, 1811 the initially selected region is used, even if the new indentation 1812 would imply a different hierarchy. To use the new hierarchy, break 1813 the command chain by moving point. 1814 1815 As a special case, using this command on the very first item of 1816 a list moves the whole list. This behavior can be disabled by 1817 configuring @code{org-list-automatic-rules}. The global indentation of 1818 a list has no influence on the text @emph{after} the list. 1819 1820 @item @kbd{C-c C-c} 1821 @kindex C-c C-c 1822 If there is a checkbox (see @ref{Checkboxes}) in the item line, toggle 1823 the state of the checkbox. In any case, verify bullets and 1824 indentation consistency in the whole list. 1825 1826 @item @kbd{C-c -} 1827 @kindex C-c - 1828 @vindex org-plain-list-ordered-item-terminator 1829 Cycle the entire list level through the different itemize/enumerate 1830 bullets (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}) or a subset of them, depending 1831 on @code{org-plain-list-ordered-item-terminator}, the type of list, and 1832 its indentation. With a numeric prefix argument N, select the Nth 1833 bullet from this list. If there is an active region when calling 1834 this, all lines are converted to list items. With a prefix 1835 argument, the selected text is changed into a single item. If the 1836 first line already was a list item, any item marker is removed from 1837 the list. Finally, even without an active region, a normal line is 1838 converted into a list item. 1839 1840 @item @kbd{C-c *} 1841 @kindex C-c * 1842 Turn a plain list item into a headline---so that it becomes 1843 a subheading at its location. See @ref{Structure Editing}, for 1844 a detailed explanation. 1845 1846 @item @kbd{C-c C-*} 1847 @kindex C-c C-* 1848 Turn the whole plain list into a subtree of the current heading. 1849 Checkboxes (see @ref{Checkboxes}) become @samp{TODO}, respectively @samp{DONE}, 1850 keywords when unchecked, respectively checked. 1851 1852 @item @kbd{S-@key{LEFT}} 1853 @itemx @kbd{S-@key{RIGHT}} 1854 @vindex org-support-shift-select 1855 @kindex S-LEFT 1856 @kindex S-RIGHT 1857 This command also cycles bullet styles when point is in on the 1858 bullet or anywhere in an item line, details depending on 1859 @code{org-support-shift-select}. 1860 1861 @item @kbd{C-c ^} 1862 @kindex C-c ^ 1863 @cindex sorting, of plain list 1864 Sort the plain list. Prompt for the sorting method: numerically, 1865 alphabetically, by time, or by custom function. 1866 @end table 1867 1868 @node Drawers 1869 @section Drawers 1870 1871 @cindex drawers 1872 @cindex visibility cycling, drawers 1873 1874 Sometimes you want to keep information associated with an entry, but 1875 you normally do not want to see it. For this, Org mode has @emph{drawers}. 1876 They can contain anything but a headline and another drawer. Drawers 1877 look like this: 1878 1879 @example 1880 ** This is a headline 1881 Still outside the drawer 1882 :DRAWERNAME: 1883 This is inside the drawer. 1884 :END: 1885 After the drawer. 1886 @end example 1887 1888 @kindex C-c C-x d 1889 @findex org-insert-drawer 1890 You can interactively insert a drawer at point by calling 1891 @code{org-insert-drawer}, which is bound to @kbd{C-c C-x d}. With an 1892 active region, this command puts the region inside the drawer. With a 1893 prefix argument, this command calls non-interactive function 1894 @code{org-insert-property-drawer}, which creates a @samp{PROPERTIES} drawer 1895 right below the current headline. Org mode uses this special drawer 1896 for storing properties (see @ref{Properties and Columns}). You cannot use 1897 it for anything else. 1898 1899 Completion over drawer keywords is also possible using 1900 @kbd{M-@key{TAB}}@footnote{Many desktops intercept @kbd{M-@key{TAB}} to switch windows. 1901 Use @kbd{C-M-i} or @kbd{@key{ESC} @key{TAB}} instead.}. 1902 1903 Visibility cycling (see @ref{Visibility Cycling}) on the headline hides and 1904 shows the entry, but keep the drawer collapsed to a single line. In 1905 order to look inside the drawer, you need to move point to the drawer 1906 line and press @kbd{@key{TAB}} there. 1907 1908 You can also arrange for state change notes (see @ref{Tracking TODO state changes}) and clock times (see @ref{Clocking Work Time}) to be stored in 1909 a @samp{LOGBOOK} drawer. If you want to store a quick note there, in 1910 a similar way to state changes, use 1911 1912 @table @asis 1913 @item @kbd{C-c C-z} 1914 @kindex C-c C-z 1915 Add a time-stamped note to the @samp{LOGBOOK} drawer. 1916 @end table 1917 1918 @node Blocks 1919 @section Blocks 1920 1921 @vindex org-hide-block-startup 1922 @cindex blocks, folding 1923 1924 Org mode uses @samp{#+BEGIN} @dots{} @samp{#+END} blocks for various purposes from 1925 including source code examples (see @ref{Literal Examples}) to capturing 1926 time logging information (see @ref{Clocking Work Time}). These blocks can 1927 be folded and unfolded by pressing @kbd{@key{TAB}} in the @samp{#+BEGIN} 1928 line. You can also get all blocks folded at startup by configuring 1929 the variable @code{org-hide-block-startup} or on a per-file basis by using 1930 1931 @cindex STARTUP, keyword 1932 @example 1933 #+STARTUP: hideblocks 1934 #+STARTUP: nohideblocks 1935 @end example 1936 1937 @node Tables 1938 @chapter Tables 1939 1940 @cindex tables 1941 @cindex editing tables 1942 1943 Org comes with a fast and intuitive table editor. Spreadsheet-like 1944 calculations are supported using the Emacs Calc package (see @ref{Top,GNU Emacs 1945 Calculator Manual,,calc,}). 1946 1947 @menu 1948 * Built-in Table Editor:: Simple tables. 1949 * Column Width and Alignment:: Overrule the automatic settings. 1950 * Column Groups:: Grouping to trigger vertical lines. 1951 * Orgtbl Mode:: The table editor as minor mode. 1952 * The Spreadsheet:: The table editor has spreadsheet capabilities. 1953 * Org Plot:: Plotting from Org tables. 1954 @end menu 1955 1956 @node Built-in Table Editor 1957 @section Built-in Table Editor 1958 1959 @cindex table editor, built-in 1960 1961 @cindex header lines, in tables 1962 @cindex horizontal rule, in tables 1963 @cindex row separator, in tables 1964 @cindex table syntax 1965 Org makes it easy to format tables in plain ASCII@. Any line with @samp{|} 1966 as the first non-whitespace character is considered part of a table. 1967 @samp{|} is also the column separator@footnote{ To insert a vertical bar into a 1968 table field, use @samp{\vert} or, inside a word @samp{abc\vert@{@}def}.}. 1969 Moreover, a line starting with @samp{|-} is a horizontal rule. It 1970 separates rows explicitly. Rows before the first horizontal rule are 1971 header lines. A table might look like this: 1972 1973 @example 1974 | Name | Phone | Age | 1975 |-------+-------+-----| 1976 | Peter | 1234 | 17 | 1977 | Anna | 4321 | 25 | 1978 @end example 1979 1980 A table is re-aligned automatically each time you press 1981 @kbd{@key{TAB}}, @kbd{@key{RET}} or @kbd{C-c C-c} inside the table. 1982 @kbd{@key{TAB}} also moves to the next field---@kbd{@key{RET}} to the 1983 next row---and creates new table rows at the end of the table or 1984 before horizontal lines. The indentation of the table is set by the 1985 first line. Horizontal rules are automatically expanded on every 1986 re-align to span the whole table width. So, to create the above 1987 table, you would only type 1988 1989 @example 1990 |Name|Phone|Age| 1991 |- 1992 @end example 1993 1994 @noindent 1995 and then press @kbd{@key{TAB}} to align the table and start filling in 1996 fields. Even faster would be to type @samp{|Name|Phone|Age} followed by 1997 @kbd{C-c @key{RET}}. 1998 1999 When typing text into a field, Org treats @kbd{@key{DEL}}, 2000 @kbd{Backspace}, and all character keys in a special way, so that 2001 inserting and deleting avoids shifting other fields. Also, when 2002 typing @emph{immediately} after point was moved into a new field with 2003 @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}, the field is 2004 automatically made blank. If this behavior is too unpredictable for 2005 you, configure the option @code{org-table-auto-blank-field}. 2006 2007 @anchor{Creation and conversion} 2008 @subheading Creation and conversion 2009 2010 @table @asis 2011 @item @kbd{C-c |} (@code{org-table-create-or-convert-from-region}) 2012 @kindex C-c | 2013 @findex org-table-create-or-convert-from-region 2014 Convert the active region to table. If every line contains at least 2015 one @kbd{@key{TAB}} character, the function assumes that the material 2016 is tab separated. If every line contains a comma, comma-separated 2017 values (CSV) are assumed. If not, lines are split at whitespace 2018 into fields. You can use a prefix argument to force a specific 2019 separator: @kbd{C-u} forces CSV, @kbd{C-u C-u} forces 2020 @kbd{@key{TAB}}, @kbd{C-u C-u C-u} prompts for a regular 2021 expression to match the separator, and a numeric argument 2022 N indicates that at least N consecutive spaces, or alternatively 2023 a @kbd{@key{TAB}} will be the separator. 2024 2025 If there is no active region, this command creates an empty Org 2026 table. But it is easier just to start typing, like @kbd{| N a m e | P h o n e | A g e @key{RET} | - @key{TAB}}. 2027 @end table 2028 2029 @anchor{Re-aligning and field motion} 2030 @subheading Re-aligning and field motion 2031 2032 @table @asis 2033 @item @kbd{C-c C-c} (@code{org-table-align}) 2034 @kindex C-c C-c 2035 @findex org-table-align 2036 Re-align the table without moving point. 2037 2038 @item @kbd{@key{TAB}} (@code{org-table-next-field}) 2039 @kindex TAB 2040 @findex org-table-next-field 2041 Re-align the table, move to the next field. Creates a new row if 2042 necessary. 2043 2044 @item @kbd{M-x org-table-blank-field} 2045 @findex org-table-blank-field 2046 Blank the current table field or active region. 2047 2048 @item @kbd{S-@key{TAB}} (@code{org-table-previous-field}) 2049 @kindex S-TAB 2050 @findex org-table-previous-field 2051 Re-align, move to previous field. 2052 2053 @item @kbd{@key{RET}} (@code{org-table-next-row}) 2054 @kindex RET 2055 @findex org-table-next-row 2056 Re-align the table and move down to next row. Creates a new row if 2057 necessary. At the beginning or end of a line, @kbd{@key{RET}} still 2058 inserts a new line, so it can be used to split a table. 2059 2060 @item @kbd{M-a} (@code{org-table-beginning-of-field}) 2061 @kindex M-a 2062 @findex org-table-beginning-of-field 2063 Move to beginning of the current table field, or on to the previous 2064 field. 2065 2066 @item @kbd{M-e} (@code{org-table-end-of-field}) 2067 @kindex M-e 2068 @findex org-table-end-of-field 2069 Move to end of the current table field, or on to the next field. 2070 @end table 2071 2072 @anchor{Column and row editing} 2073 @subheading Column and row editing 2074 2075 @table @asis 2076 @item @kbd{M-@key{LEFT}} (@code{org-table-move-column-left}) 2077 @kindex M-LEFT 2078 @findex org-table-move-column-left 2079 Move the current column left. 2080 2081 @item @kbd{M-@key{RIGHT}} (@code{org-table-move-column-right}) 2082 @kindex M-RIGHT 2083 @findex org-table-move-column-right 2084 Move the current column right. 2085 2086 @item @kbd{M-S-@key{LEFT}} (@code{org-table-delete-column}) 2087 @kindex M-S-LEFT 2088 @findex org-table-delete-column 2089 Kill the current column. 2090 2091 @item @kbd{M-S-@key{RIGHT}} (@code{org-table-insert-column}) 2092 @kindex M-S-RIGHT 2093 @findex org-table-insert-column 2094 Insert a new column at point position. Move the recent column and 2095 all cells to the right of this column to the right. 2096 2097 @item @kbd{M-@key{UP}} (@code{org-table-move-row-up}) 2098 @kindex M-UP 2099 @findex org-table-move-row-up 2100 Move the current row up. 2101 2102 @item @kbd{M-@key{DOWN}} (@code{org-table-move-row-down}) 2103 @kindex M-DOWN 2104 @findex org-table-move-row-down 2105 Move the current row down. 2106 2107 @item @kbd{M-S-@key{UP}} (@code{org-table-kill-row}) 2108 @kindex M-S-UP 2109 @findex org-table-kill-row 2110 Kill the current row or horizontal line. 2111 2112 @item @kbd{S-@key{UP}} (@code{org-table-move-cell-up}) 2113 @kindex S-UP 2114 @findex org-table-move-cell-up 2115 Move cell up by swapping with adjacent cell. 2116 2117 @item @kbd{S-@key{DOWN}} (@code{org-table-move-cell-down}) 2118 @kindex S-DOWN 2119 @findex org-table-move-cell-down 2120 Move cell down by swapping with adjacent cell. 2121 2122 @item @kbd{S-@key{LEFT}} (@code{org-table-move-cell-left}) 2123 @kindex S-LEFT 2124 @findex org-table-move-cell-left 2125 Move cell left by swapping with adjacent cell. 2126 2127 @item @kbd{S-@key{RIGHT}} (@code{org-table-move-cell-right}) 2128 @kindex S-RIGHT 2129 @findex org-table-move-cell-right 2130 Move cell right by swapping with adjacent cell. 2131 2132 @item @kbd{M-S-@key{DOWN}} (@code{org-table-insert-row}) 2133 @kindex M-S-DOWN 2134 @findex org-table-insert-row 2135 Insert a new row above the current row. With a prefix argument, the 2136 line is created below the current one. 2137 2138 @item @kbd{C-c -} (@code{org-table-insert-hline}) 2139 @kindex C-c - 2140 @findex org-table-insert-hline 2141 Insert a horizontal line below current row. With a prefix argument, 2142 the line is created above the current line. 2143 2144 @item @kbd{C-c @key{RET}} (@code{org-table-hline-and-move}) 2145 @kindex C-c RET 2146 @findex org-table-hline-and-move 2147 Insert a horizontal line below current row, and move point into the 2148 row below that line. 2149 2150 @item @kbd{C-c ^} (@code{org-table-sort-lines}) 2151 @kindex C-c ^ 2152 @findex org-table-sort-lines 2153 Sort the table lines in the region. The position of point indicates 2154 the column to be used for sorting, and the range of lines is the 2155 range between the nearest horizontal separator lines, or the entire 2156 table. If point is before the first column, you are prompted for 2157 the sorting column. If there is an active region, the mark 2158 specifies the first line and the sorting column, while point should 2159 be in the last line to be included into the sorting. The command 2160 prompts for the sorting type, alphabetically, numerically, or by 2161 time. You can sort in normal or reverse order. You can also supply 2162 your own key extraction and comparison functions. When called with 2163 a prefix argument, alphabetic sorting is case-sensitive. 2164 @end table 2165 2166 @anchor{Regions} 2167 @subheading Regions 2168 2169 @table @asis 2170 @item @kbd{C-c C-x M-w} (@code{org-table-copy-region}) 2171 @kindex C-c C-x M-w 2172 @findex org-table-copy-region 2173 Copy a rectangular region from a table to a special clipboard. 2174 Point and mark determine edge fields of the rectangle. If there is 2175 no active region, copy just the current field. The process ignores 2176 horizontal separator lines. 2177 2178 @item @kbd{C-c C-x C-w} (@code{org-table-cut-region}) 2179 @kindex C-c C-x C-w 2180 @findex org-table-cut-region 2181 Copy a rectangular region from a table to a special clipboard, and 2182 blank all fields in the rectangle. So this is the ``cut'' operation. 2183 2184 @item @kbd{C-c C-x C-y} (@code{org-table-paste-rectangle}) 2185 @kindex C-c C-x C-y 2186 @findex org-table-paste-rectangle 2187 Paste a rectangular region into a table. The upper left corner ends 2188 up in the current field. All involved fields are overwritten. If 2189 the rectangle does not fit into the present table, the table is 2190 enlarged as needed. The process ignores horizontal separator lines. 2191 2192 @item @kbd{M-@key{RET}} (@code{org-table-wrap-region}) 2193 @kindex M-RET 2194 @findex org-table-wrap-region 2195 Split the current field at point position and move the rest to the 2196 line below. If there is an active region, and both point and mark 2197 are in the same column, the text in the column is wrapped to minimum 2198 width for the given number of lines. A numeric prefix argument may 2199 be used to change the number of desired lines. If there is no 2200 region, but you specify a prefix argument, the current field is made 2201 blank, and the content is appended to the field above. 2202 @end table 2203 2204 @anchor{Calculations} 2205 @subheading Calculations 2206 2207 @cindex formula, in tables 2208 @cindex calculations, in tables 2209 2210 @table @asis 2211 @item @kbd{C-c +} (@code{org-table-sum}) 2212 @kindex C-c + 2213 @findex org-table-sum 2214 Sum the numbers in the current column, or in the rectangle defined 2215 by the active region. The result is shown in the echo area and can 2216 be inserted with @kbd{C-y}. 2217 2218 @item @kbd{S-@key{RET}} (@code{org-table-copy-down}) 2219 @kindex S-RET 2220 @findex org-table-copy-down 2221 @vindex org-table-copy-increment 2222 When current field is empty, copy from first non-empty field above. 2223 When not empty, copy current field down to next row and move point 2224 along with it. 2225 2226 Depending on the variable @code{org-table-copy-increment}, integer and 2227 time stamp field values, and fields prefixed or suffixed with 2228 a whole number, can be incremented during copy. Also, a @code{0} prefix 2229 argument temporarily disables the increment. 2230 2231 This key is also used by shift-selection and related modes (see 2232 @ref{Conflicts}). 2233 @end table 2234 2235 @anchor{Miscellaneous (1)} 2236 @subheading Miscellaneous 2237 2238 @table @asis 2239 @item @kbd{C-c `} (@code{org-table-edit-field}) 2240 @kindex C-c ` 2241 @findex org-table-edit-field 2242 Edit the current field in a separate window. This is useful for 2243 fields that are not fully visible (see @ref{Column Width and Alignment}). 2244 When called with a @kbd{C-u} prefix, just make the full field 2245 visible, so that it can be edited in place. When called with two 2246 @kbd{C-u} prefixes, make the editor window follow point through 2247 the table and always show the current field. The follow mode exits 2248 automatically when point leaves the table, or when you repeat this 2249 command with @kbd{C-u C-u C-c `}. 2250 2251 @item @kbd{M-x org-table-import} 2252 @findex org-table-import 2253 Import a file as a table. The table should be TAB or whitespace 2254 separated. Use, for example, to import a spreadsheet table or data 2255 from a database, because these programs generally can write 2256 TAB-separated text files. This command works by inserting the file 2257 into the buffer and then converting the region to a table. Any 2258 prefix argument is passed on to the converter, which uses it to 2259 determine the separator. 2260 2261 @item @kbd{C-c |} (@code{org-table-create-or-convert-from-region}) 2262 @kindex C-c | 2263 @findex org-table-create-or-convert-from-region 2264 Tables can also be imported by pasting tabular text into the Org 2265 buffer, selecting the pasted text with @kbd{C-x C-x} and then 2266 using the @kbd{C-c |} command (see @ref{Creation and conversion}). 2267 2268 @item @kbd{M-x org-table-export} 2269 @findex org-table-export 2270 @vindex org-table-export-default-format 2271 Export the table, by default as a TAB-separated file. Use for data 2272 exchange with, for example, spreadsheet or database programs. The 2273 format used to export the file can be configured in the variable 2274 @code{org-table-export-default-format}. You may also use properties 2275 @samp{TABLE_EXPORT_FILE} and @samp{TABLE_EXPORT_FORMAT} to specify the file 2276 name and the format for table export in a subtree. Org supports 2277 quite general formats for exported tables. The exporter format is 2278 the same as the format used by Orgtbl radio tables, see @ref{Translator functions}, for a detailed description. 2279 2280 @item @kbd{M-x org-table-header-line-mode} 2281 @findex org-table-header-line-mode 2282 @vindex org-table-header-line-p 2283 Turn on the display of the first data row of the table at point in 2284 the window header line when this first row is not visible anymore in 2285 the buffer. You can activate this minor mode by default by setting 2286 the option @code{org-table-header-line-p} to @code{t}. 2287 2288 @item @kbd{M-x org-table-transpose-table-at-point} 2289 @findex org-table-transpose-table-at-point 2290 Transpose the table at point and eliminate hlines. 2291 @end table 2292 2293 @node Column Width and Alignment 2294 @section Column Width and Alignment 2295 2296 @cindex narrow columns in tables 2297 @cindex alignment in tables 2298 2299 The width of columns is automatically determined by the table editor. 2300 The alignment of a column is determined automatically from the 2301 fraction of number-like versus non-number fields in the column. 2302 2303 @vindex org-table-automatic-realign 2304 Editing a field may modify alignment of the table. Moving 2305 a contiguous row or column---i.e., using @kbd{@key{TAB}} or 2306 @kbd{@key{RET}}---automatically re-aligns it. If you want to disable 2307 this behavior, set @code{org-table-automatic-realign} to @code{nil}. In any 2308 case, you can always align manually a table: 2309 2310 @table @asis 2311 @item @kbd{C-c C-c} (@code{org-table-align}) 2312 @kindex C-c C-c 2313 @findex org-table-align 2314 Align the current table. 2315 @end table 2316 2317 @vindex org-startup-align-all-tables 2318 Setting the option @code{org-startup-align-all-tables} re-aligns all tables 2319 in a file upon visiting it. You can also set this option on 2320 a per-file basis with: 2321 2322 @example 2323 #+STARTUP: align 2324 #+STARTUP: noalign 2325 @end example 2326 2327 Sometimes a single field or a few fields need to carry more text, 2328 leading to inconveniently wide columns. Maybe you want to hide away 2329 several columns or display them with a fixed width, regardless of 2330 content, as shown in the following example. 2331 2332 @example 2333 |---+---------------------+--------| |---+-------…+…| 2334 | | <6> | | | | <6> …|…| 2335 | 1 | one | some | ----\ | 1 | one …|…| 2336 | 2 | two | boring | ----/ | 2 | two …|…| 2337 | 3 | This is a long text | column | | 3 | This i…|…| 2338 |---+---------------------+--------| |---+-------…+…| 2339 @end example 2340 2341 To set the width of a column, one field anywhere in the column may 2342 contain just the string @samp{<N>} where @var{N} specifies the width 2343 as a number of characters. You control displayed width of columns 2344 with the following tools: 2345 2346 @table @asis 2347 @item @kbd{C-c @key{TAB}} (@code{org-table-toggle-column-width}) 2348 @kindex C-c TAB 2349 @findex org-table-toggle-column-width 2350 Shrink or expand current column. 2351 2352 If a width cookie specifies a width W for the column, shrinking it 2353 displays the first W visible characters only. Otherwise, the column 2354 is shrunk to a single character. 2355 2356 When called before the first column or after the last one, ask for 2357 a list of column ranges to operate on. 2358 2359 @item @kbd{C-u C-c @key{TAB}} (@code{org-table-shrink}) 2360 @kindex C-u C-c TAB 2361 @findex org-table-shrink 2362 Shrink all columns with a column width. Expand the others. 2363 2364 @item @kbd{C-u C-u C-c @key{TAB}} (@code{org-table-expand}) 2365 @kindex C-u C-u C-c TAB 2366 @findex org-table-expand 2367 Expand all columns. 2368 @end table 2369 2370 To see the full text of a shrunk field, hold the mouse over it: 2371 a tool-tip window then shows the full contents of the field. 2372 Alternatively, @kbd{C-h .} (@code{display-local-help}) reveals them, 2373 too. For convenience, any change near the shrunk part of a column 2374 expands it. 2375 2376 @vindex org-startup-shrink-all-tables 2377 Setting the option @code{org-startup-shrink-all-tables} shrinks all columns 2378 containing a width cookie in a file the moment it is visited. You can 2379 also set this option on a per-file basis with: 2380 2381 @example 2382 #+STARTUP: shrink 2383 @end example 2384 2385 2386 If you would like to overrule the automatic alignment of number-rich 2387 columns to the right and of string-rich columns to the left, you can 2388 use @samp{<r>}, @samp{<c>} or @samp{<l>} in a similar fashion. You may also combine 2389 alignment and field width like this: @samp{<r10>}. 2390 2391 Lines which only contain these formatting cookies are removed 2392 automatically upon exporting the document. 2393 2394 @node Column Groups 2395 @section Column Groups 2396 2397 @cindex grouping columns in tables 2398 2399 When Org exports tables, it does so by default without vertical lines 2400 because that is visually more satisfying in general. Occasionally 2401 however, vertical lines can be useful to structure a table into groups 2402 of columns, much like horizontal lines can do for groups of rows. In 2403 order to specify column groups, you can use a special row where the 2404 first field contains only @samp{/}. The further fields can either contain 2405 @samp{<} to indicate that this column should start a group, @samp{>} to indicate 2406 the end of a column, or @samp{<>} (no space between @samp{<} and @samp{>}) to make 2407 a column a group of its own. Upon export, boundaries between column 2408 groups are marked with vertical lines. Here is an example: 2409 2410 @example 2411 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | 2412 |---+-----+-----+-----+---------+------------| 2413 | / | < | | > | < | > | 2414 | 1 | 1 | 1 | 1 | 1 | 1 | 2415 | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 | 2416 | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 | 2417 |---+-----+-----+-----+---------+------------| 2418 #+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1))) 2419 @end example 2420 2421 It is also sufficient to just insert the column group starters after 2422 every vertical line you would like to have: 2423 2424 @example 2425 | N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | 2426 |---+-----+-----+-----+---------+------------| 2427 | / | < | | | < | | 2428 @end example 2429 2430 @node Orgtbl Mode 2431 @section The Orgtbl Minor Mode 2432 2433 @cindex Orgtbl mode 2434 @cindex minor mode for tables 2435 2436 @findex orgtbl-mode 2437 If you like the intuitive way the Org table editor works, you might 2438 also want to use it in other modes like Text mode or Mail mode. The 2439 minor mode Orgtbl mode makes this possible. You can always toggle the 2440 mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for 2441 example in Message mode, use 2442 2443 @lisp 2444 (add-hook 'message-mode-hook #'turn-on-orgtbl) 2445 @end lisp 2446 2447 Furthermore, with some special setup, it is possible to maintain 2448 tables in arbitrary syntax with Orgtbl mode. For example, it is 2449 possible to construct @LaTeX{} tables with the underlying ease and power 2450 of Orgtbl mode, including spreadsheet capabilities. For details, see 2451 @ref{Tables in Arbitrary Syntax}. 2452 2453 @node The Spreadsheet 2454 @section The Spreadsheet 2455 2456 @cindex calculations, in tables 2457 @cindex spreadsheet capabilities 2458 @cindex Calc package 2459 2460 The table editor makes use of the Emacs Calc package to implement 2461 spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms 2462 to derive fields from other fields. While fully featured, Org's 2463 implementation is not identical to other spreadsheets. For example, 2464 Org knows the concept of a @emph{column formula} that will be applied to 2465 all non-header fields in a column without having to copy the formula 2466 to each relevant field. There is also a formula debugger, and a 2467 formula editor with features for highlighting fields in the table 2468 corresponding to the references at point in the formula, moving these 2469 references by arrow keys. 2470 2471 @menu 2472 * References:: How to refer to another field or range. 2473 * Formula syntax for Calc:: Using Calc to compute stuff. 2474 * Formula syntax for Lisp:: Writing formulas in Emacs Lisp. 2475 * Durations and time values:: How to compute durations and time values. 2476 * Field and range formulas:: Formula for specific (ranges of) fields. 2477 * Column formulas:: Formulas valid for an entire column. 2478 * Lookup functions:: Lookup functions for searching tables. 2479 * Editing and debugging formulas:: Fixing formulas. 2480 * Updating the table:: Recomputing all dependent fields. 2481 * Advanced features:: Field and column names, automatic recalculation... 2482 @end menu 2483 2484 @node References 2485 @subsection References 2486 2487 @cindex references 2488 2489 To compute fields in the table from other fields, formulas must 2490 reference other fields or ranges. In Org, fields can be referenced by 2491 name, by absolute coordinates, and by relative coordinates. To find 2492 out what the coordinates of a field are, press @kbd{C-c ?} in 2493 that field, or press @kbd{C-c @}} to toggle the display of a grid. 2494 2495 @anchor{Field references} 2496 @subsubheading Field references 2497 2498 @cindex field references 2499 @cindex references, to fields 2500 Formulas can reference the value of another field in two ways. Like 2501 in any other spreadsheet, you may reference fields with 2502 a letter/number combination like @samp{B3}, meaning the second field in the 2503 third row. However, Org prefers to use another, more general 2504 representation that looks like this:@footnote{Org understands references typed by the user as @samp{B4}, but it 2505 does not use this syntax when offering a formula for editing. You can 2506 customize this behavior using the variable 2507 @code{org-table-use-standard-references}.} 2508 2509 @example 2510 @@ROW$COLUMN 2511 @end example 2512 2513 2514 Column specifications can be absolute like @samp{$1}, @samp{$2}, @dots{}, @samp{$N}, or 2515 relative to the current column, i.e., the column of the field which is 2516 being computed, like @samp{$+1} or @samp{$-2}. @samp{$<} and @samp{$>} are immutable 2517 references to the first and last column, respectively, and you can use 2518 @samp{$>>>} to indicate the third column from the right. 2519 2520 The row specification only counts data lines and ignores horizontal 2521 separator lines, or ``hlines''. Like with columns, you can use absolute 2522 row numbers @samp{@@1}, @samp{@@2}, @dots{}, @samp{@@N}, and row numbers relative to the 2523 current row like @samp{@@+3} or @samp{@@-1}. @samp{@@<} and @samp{@@>} are immutable 2524 references the first and last row in the table, respectively. You may 2525 also specify the row relative to one of the hlines: @samp{@@I} refers to the 2526 first hline, @samp{@@II} to the second, etc. @samp{@@-I} refers to the first such 2527 line above the current line, @samp{@@+I} to the first such line below the 2528 current line. You can also write @samp{@@III+2} which is the second data 2529 line after the third hline in the table. 2530 2531 @samp{@@0} and @samp{$0} refer to the current row and column, respectively, i.e., 2532 to the row/column for the field being computed. Also, if you omit 2533 either the column or the row part of the reference, the current 2534 row/column is implied. 2535 2536 Org's references with @emph{unsigned} numbers are fixed references in the 2537 sense that if you use the same reference in the formula for two 2538 different fields, the same field is referenced each time. Org's 2539 references with @emph{signed} numbers are floating references because the 2540 same reference operator can reference different fields depending on 2541 the field being calculated by the formula. 2542 2543 Here are a few examples: 2544 2545 @multitable @columnfractions 0.2 0.8 2546 @item @samp{@@2$3} 2547 @tab 2nd row, 3rd column (same as @samp{C2}) 2548 @item @samp{$5} 2549 @tab column 5 in the current row (same as @samp{E&}) 2550 @item @samp{@@2} 2551 @tab current column, row 2 2552 @item @samp{@@-1$-3} 2553 @tab field one row up, three columns to the left 2554 @item @samp{@@-I$2} 2555 @tab field just under hline above current row, column 2 2556 @item @samp{@@>$5} 2557 @tab field in the last row, in column 5 2558 @end multitable 2559 2560 @anchor{Range references} 2561 @subsubheading Range references 2562 2563 @cindex range references 2564 @cindex references, to ranges 2565 You may reference a rectangular range of fields by specifying two 2566 field references connected by two dots @samp{..}. The ends are included in 2567 the range. If both fields are in the current row, you may simply use 2568 @samp{$2..$7}, but if at least one field is in a different row, you need to 2569 use the general @samp{@@ROW$COLUMN} format at least for the first field, 2570 i.e., the reference must start with @samp{@@} in order to be interpreted 2571 correctly. Examples: 2572 2573 @multitable @columnfractions 0.2 0.8 2574 @item @samp{$1..$3} 2575 @tab first three fields in the current row 2576 @item @samp{$P..$Q} 2577 @tab range, using column names (see @ref{Advanced features}) 2578 @item @samp{$<<<..$>>} 2579 @tab start in third column, continue to the last but one 2580 @item @samp{@@2$1..@@4$3} 2581 @tab nine fields between these two fields (same as @samp{A2..C4}) 2582 @item @samp{@@-1$-2..@@-1} 2583 @tab 3 fields in the row above, starting from 2 columns on the left 2584 @item @samp{@@I..II} 2585 @tab between first and second hline, short for @samp{@@I..@@II} 2586 @end multitable 2587 2588 @noindent 2589 Range references return a vector of values that can be fed into Calc 2590 vector functions. Empty fields in ranges are normally suppressed, so 2591 that the vector contains only the non-empty fields. For other options 2592 with the mode switches @samp{E}, @samp{N} and examples, see @ref{Formula syntax for Calc}. 2593 2594 @anchor{Field coordinates in formulas} 2595 @subsubheading Field coordinates in formulas 2596 2597 @cindex field coordinates 2598 @cindex coordinates, of field 2599 @cindex row, of field coordinates 2600 @cindex column, of field coordinates 2601 @vindex org-table-current-column 2602 @vindex org-table-current-dline 2603 One of the very first actions during evaluation of Calc formulas and 2604 Lisp formulas is to substitute @samp{@@#} and @samp{$#} in the formula with the 2605 row or column number of the field where the current result will go to. 2606 The traditional Lisp formula equivalents are @code{org-table-current-dline} 2607 and @code{org-table-current-column}. Examples: 2608 2609 @table @asis 2610 @item @samp{if(@@# % 2, $#, string(""))} 2611 Insert column number on odd rows, set field to empty on even rows. 2612 2613 @item @samp{$2 = '(identity remote(FOO, @@@@#$1))} 2614 Copy text or values of each row of column 1 of the table named 2615 @var{FOO} into column 2 of the current table. 2616 2617 @item @samp{@@3 = 2 * remote(FOO, @@1$$#)} 2618 Insert the doubled value of each column of row 1 of the table 2619 named @var{FOO} into row 3 of the current table. 2620 @end table 2621 2622 @noindent 2623 For the second and third examples, table @var{FOO} must have at 2624 least as many rows or columns as the current table. Note that this is 2625 inefficient@footnote{ The computation time scales as O(N^2) because table 2626 @var{FOO} is parsed for each field to be copied.} for large 2627 number of rows. 2628 2629 @anchor{Named references} 2630 @subsubheading Named references 2631 2632 @cindex named references 2633 @cindex references, named 2634 @cindex name, of column or field 2635 @cindex constants, in calculations 2636 @cindex @samp{CONSTANTS}, keyword 2637 @vindex org-table-formula-constants 2638 2639 @samp{$name} is interpreted as the name of a column, parameter or constant. 2640 Constants are defined globally through the variable 2641 @code{org-table-formula-constants}, and locally---for the file---through 2642 a line like this example: 2643 2644 @example 2645 #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6 2646 @end example 2647 2648 2649 @vindex constants-unit-system 2650 @pindex constants.el 2651 Also, properties (see @ref{Properties and Columns}) can be used as 2652 constants in table formulas: for a property @samp{Xyz} use the name 2653 @samp{$PROP_Xyz}, and the property will be searched in the current outline 2654 entry and in the hierarchy above it. If you have the @samp{constants.el} 2655 package, it will also be used to resolve constants, including natural 2656 constants like @samp{$h} for Planck's constant, and units like @samp{$km} for 2657 kilometers@footnote{The file @samp{constants.el} can supply the values of constants in 2658 two different unit systems, @samp{SI} and @samp{cgs}. Which one is used depends 2659 on the value of the variable @code{constants-unit-system}. You can use the 2660 @samp{STARTUP} options @samp{constSI} and @samp{constcgs} to set this value for the 2661 current buffer.}. Column names and parameters can be specified in 2662 special table lines. These are described below, see @ref{Advanced features}. All names must start with a letter, and further consist 2663 of letters and numbers. 2664 2665 @anchor{Remote references} 2666 @subsubheading Remote references 2667 2668 @cindex remote references 2669 @cindex references, remote 2670 @cindex references, to a different table 2671 @cindex name, of column or field 2672 @cindex @samp{NAME}, keyword 2673 You may also reference constants, fields and ranges from a different 2674 table, either in the current file or even in a different file. The 2675 syntax is 2676 2677 @example 2678 remote(NAME,REF) 2679 @end example 2680 2681 2682 @noindent 2683 where @var{NAME} can be the name of a table in the current file 2684 as set by a @samp{#+NAME:} line before the table. It can also be the ID of 2685 an entry, even in a different file, and the reference then refers to 2686 the first table in that entry. @var{REF} is an absolute field or 2687 range reference as described above for example @samp{@@3$3} or @samp{$somename}, 2688 valid in the referenced table. 2689 2690 @cindex table indirection 2691 When @var{NAME} has the format @samp{@@ROW$COLUMN}, it is substituted 2692 with the name or ID found in this field of the current table. For 2693 example @samp{remote($1, @@@@>$2)} @result{} @samp{remote(year_2013, @@@@>$1)}. The format 2694 @samp{B3} is not supported because it can not be distinguished from a plain 2695 table name or ID@. 2696 2697 @node Formula syntax for Calc 2698 @subsection Formula syntax for Calc 2699 2700 @cindex formula syntax, Calc 2701 @cindex syntax, of formulas 2702 2703 A formula can be any algebraic expression understood by the Emacs Calc 2704 package. Note that Calc has the non-standard convention that @samp{/} has 2705 lower precedence than @samp{*}, so that @samp{a/b*c} is interpreted as 2706 @samp{(a/(b*c))}. Before evaluation by @code{calc-eval} (see @ref{Calling Calc from Your Programs,Calling Calc from 2707 Your Lisp Programs,,calc,}), variable substitution takes place according to 2708 the rules described above. 2709 2710 @cindex vectors, in table calculations 2711 The range vectors can be directly fed into the Calc vector functions 2712 like @code{vmean} and @code{vsum}. 2713 2714 @cindex format specifier, in spreadsheet 2715 @cindex mode, for Calc 2716 @vindex org-calc-default-modes 2717 A formula can contain an optional mode string after a semicolon. This 2718 string consists of flags to influence Calc and other modes during 2719 execution. By default, Org uses the standard Calc modes (precision 2720 12, angular units degrees, fraction and symbolic modes off). The 2721 display format, however, has been changed to @samp{(float 8)} to keep 2722 tables compact. The default settings can be configured using the 2723 variable @code{org-calc-default-modes}. 2724 2725 @table @asis 2726 @item @samp{p20} 2727 Set the internal Calc calculation precision to 20 digits. 2728 2729 @item @samp{n3}, @samp{s3}, @samp{e2}, @samp{f4} 2730 Normal, scientific, engineering or fixed format of the result of 2731 Calc passed back to Org. Calc formatting is unlimited in precision 2732 as long as the Calc calculation precision is greater. 2733 2734 @item @samp{D}, @samp{R} 2735 Degree and radian angle modes of Calc. 2736 2737 @item @samp{F}, @samp{S} 2738 Fraction and symbolic modes of Calc. 2739 2740 @item @samp{u} 2741 Units simplification mode of Calc. Calc is also a symbolic 2742 calculator and is capable of working with values having a unit, 2743 represented with numerals followed by a unit string in Org table 2744 cells. This mode instructs Calc to simplify the units in the 2745 computed expression before returning the result. 2746 2747 @item @samp{T}, @samp{t}, @samp{U} 2748 Duration computations in Calc or Lisp, @ref{Durations and time values}. 2749 2750 @item @samp{E} 2751 If and how to consider empty fields. Without @samp{E} empty fields in 2752 range references are suppressed so that the Calc vector or Lisp list 2753 contains only the non-empty fields. With @samp{E} the empty fields are 2754 kept. For empty fields in ranges or empty field references the 2755 value @samp{nan} (not a number) is used in Calc formulas and the empty 2756 string is used for Lisp formulas. Add @samp{N} to use 0 instead for both 2757 formula types. For the value of a field the mode @samp{N} has higher 2758 precedence than @samp{E}. 2759 2760 @item @samp{N} 2761 Interpret all fields as numbers, use 0 for non-numbers. See the 2762 next section to see how this is essential for computations with Lisp 2763 formulas. In Calc formulas it is used only occasionally because 2764 there number strings are already interpreted as numbers without @samp{N}. 2765 2766 @item @samp{L} 2767 Literal, for Lisp formulas only. See the next section. 2768 @end table 2769 2770 Unless you use large integer numbers or high-precision calculation and 2771 display for floating point numbers you may alternatively provide 2772 a @code{printf} format specifier to reformat the Calc result after it has 2773 been passed back to Org instead of letting Calc already do the 2774 formatting@footnote{The printf reformatting is limited in precision because the 2775 value passed to it is converted into an ``integer'' or ``double''. The 2776 ``integer'' is limited in size by truncating the signed value to 32 2777 bits. The ``double'' is limited in precision to 64 bits overall which 2778 leaves approximately 16 significant decimal digits.}. A few examples: 2779 2780 @multitable {aaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 2781 @item @samp{$1+$2} 2782 @tab Sum of first and second field 2783 @item @samp{$1+$2;%.2f} 2784 @tab Same, format result to two decimals 2785 @item @samp{exp($2)+exp($1)} 2786 @tab Math functions can be used 2787 @item @samp{$0;%.1f} 2788 @tab Reformat current cell to 1 decimal 2789 @item @samp{($3-32)*5/9} 2790 @tab Degrees F @arrow{} C conversion 2791 @item @samp{$c/$1/$cm} 2792 @tab Hz @arrow{} cm conversion, using @samp{constants.el} 2793 @item @samp{tan($1);Dp3s1} 2794 @tab Compute in degrees, precision 3, display SCI 1 2795 @item @samp{sin($1);Dp3%.1e} 2796 @tab Same, but use @code{printf} specifier for display 2797 @item @samp{vmean($2..$7)} 2798 @tab Compute column range mean, using vector function 2799 @item @samp{vmean($2..$7);EN} 2800 @tab Same, but treat empty fields as 0 2801 @item @samp{taylor($3,x=7,2)} 2802 @tab Taylor series of $3, at x=7, second degree 2803 @end multitable 2804 2805 Calc also contains a complete set of logical operations (see @ref{Logical Operations,Logical 2806 Operations,,calc,}). For example 2807 2808 @table @asis 2809 @item @samp{if($1 < 20, teen, string(""))} 2810 @samp{"teen"} if age @samp{$1} is less than 20, else the Org table result 2811 field is set to empty with the empty string. 2812 2813 @item @samp{if("$1" == "nan" || "$2" == "nan", string(""), $1 + $2); E f-1} 2814 Sum of the first two columns. When at least one of the input fields 2815 is empty the Org table result field is set to empty. @samp{E} is 2816 required to not convert empty fields to 0. @samp{f-1} is an optional 2817 Calc format string similar to @samp{%.1f} but leaves empty results empty. 2818 2819 @item @samp{if(typeof(vmean($1..$7)) == 12, string(""), vmean($1..$7)); E} 2820 Mean value of a range unless there is any empty field. Every field 2821 in the range that is empty is replaced by @samp{nan} which lets @samp{vmean} 2822 result in @samp{nan}. Then @samp{typeof =} 12= detects the @samp{nan} from @code{vmean} 2823 and the Org table result field is set to empty. Use this when the 2824 sample set is expected to never have missing values. 2825 2826 @item @samp{if("$1..$7" == "[]", string(""), vmean($1..$7))} 2827 Mean value of a range with empty fields skipped. Every field in the 2828 range that is empty is skipped. When all fields in the range are 2829 empty the mean value is not defined and the Org table result field 2830 is set to empty. Use this when the sample set can have a variable 2831 size. 2832 2833 @item @samp{vmean($1..$7); EN} 2834 To complete the example before: Mean value of a range with empty 2835 fields counting as samples with value 0. Use this only when 2836 incomplete sample sets should be padded with 0 to the full size. 2837 @end table 2838 2839 You can add your own Calc functions defined in Emacs Lisp with 2840 @code{defmath} and use them in formula syntax for Calc. 2841 2842 @node Formula syntax for Lisp 2843 @subsection Emacs Lisp forms as formulas 2844 2845 @cindex Lisp forms, as table formulas 2846 2847 It is also possible to write a formula in Emacs Lisp. This can be 2848 useful for string manipulation and control structures, if Calc's 2849 functionality is not enough. 2850 2851 A formula is evaluated as a Lisp form when it starts with a 2852 single-quote followed by an opening parenthesis. Cell table 2853 references are interpolated into the Lisp form before execution. The 2854 evaluation should return either a string or a number. Evaluation 2855 modes and a @code{printf} format used to render the returned values can be 2856 specified after a semicolon. 2857 2858 By default, references are interpolated as literal Lisp strings: the 2859 field content is replaced in the Lisp form stripped of leading and 2860 trailing white space and surrounded in double-quotes. For example: 2861 2862 @example 2863 '(concat $1 $2) 2864 @end example 2865 2866 2867 @noindent 2868 concatenates the content of columns 1 and column 2. 2869 2870 When the @samp{N} flag is used, all referenced elements are parsed as 2871 numbers and interpolated as Lisp numbers, without quotes. Fields that 2872 cannot be parsed as numbers are interpolated as zeros. For example: 2873 2874 @example 2875 '(+ $1 $2);N 2876 @end example 2877 2878 2879 @noindent 2880 adds columns 1 and 2, equivalent to Calc's @samp{$1+$2}. Ranges are 2881 inserted as space-separated fields, so they can be embedded in list or 2882 vector syntax. For example: 2883 2884 @example 2885 '(apply '+ '($1..$4));N 2886 @end example 2887 2888 2889 @noindent 2890 computes the sum of columns 1 to 4, like Calc's @samp{vsum($1..$4)}. 2891 2892 When the @samp{L} flag is used, all fields are interpolated literally: the 2893 cell content is replaced in the Lisp form stripped of leading and 2894 trailing white space and without quotes. If a reference is intended 2895 to be interpreted as a string by the Lisp form, the reference operator 2896 itself should be enclosed in double-quotes, like @samp{"$3"}. The @samp{L} flag 2897 is useful when strings and numbers are used in the same Lisp form. For 2898 example: 2899 2900 @example 2901 '(substring "$1" $2 $3);L 2902 @end example 2903 2904 2905 @noindent 2906 extracts the part of the string in column 1 between the character 2907 positions specified in the integers in column 2 and 3 and it is easier 2908 to read than the equivalent: 2909 2910 @example 2911 '(substring $1 (string-to-number $2) (string-to-number $3)) 2912 @end example 2913 2914 2915 When the formula itself contains @samp{;} symbol, Org mode may incorrectly 2916 interpret everything past @samp{;} as format specifier: 2917 2918 @example 2919 '(concat $1 ";") 2920 @end example 2921 2922 2923 @noindent 2924 You can put an extra tailing @samp{;} to indicate that all the earlier 2925 instances of @samp{;} belong to the formula itself: 2926 2927 @example 2928 '(concat $1 ";"); 2929 @end example 2930 2931 @node Durations and time values 2932 @subsection Durations and time values 2933 2934 @cindex duration, computing 2935 @cindex time, computing 2936 @vindex org-table-duration-custom-format 2937 2938 If you want to compute time values use the @samp{T}, @samp{t}, or @samp{U} flag, 2939 either in Calc formulas or Elisp formulas: 2940 2941 @example 2942 | Task 1 | Task 2 | Total | 2943 |---------+----------+----------| 2944 | 2:12 | 1:47 | 03:59:00 | 2945 | 2:12 | 1:47 | 03:59 | 2946 | 3:02:20 | -2:07:00 | 0.92 | 2947 #+TBLFM: @@2$3=$1+$2;T::@@3$3=$1+$2;U::@@4$3=$1+$2;t 2948 @end example 2949 2950 Input duration values must be of the form @samp{HH:MM[:SS]}, where seconds 2951 are optional. With the @samp{T} flag, computed durations are displayed as 2952 @samp{HH:MM:SS} (see the first formula above). With the @samp{U} flag, seconds 2953 are omitted so that the result is only @samp{HH:MM} (see second formula 2954 above). Zero-padding of the hours field depends upon the value of the 2955 variable @code{org-table-duration-hour-zero-padding}. 2956 2957 With the @samp{t} flag, computed durations are displayed according to the 2958 value of the option @code{org-table-duration-custom-format}, which defaults 2959 to @code{hours} and displays the result as a fraction of hours (see the 2960 third formula in the example above). 2961 2962 Negative duration values can be manipulated as well, and integers are 2963 considered as seconds in addition and subtraction. 2964 2965 @node Field and range formulas 2966 @subsection Field and range formulas 2967 2968 @cindex field formula 2969 @cindex range formula 2970 @cindex formula, for individual table field 2971 @cindex formula, for range of fields 2972 2973 To assign a formula to a particular field, type it directly into the 2974 field, preceded by @samp{:=}, for example @samp{vsum(@@II..III)}. When you press 2975 @kbd{@key{TAB}} or @kbd{@key{RET}} or @kbd{C-c C-c} with point 2976 still in the field, the formula is stored as the formula for this 2977 field, evaluated, and the current field is replaced with the result. 2978 2979 @cindex @samp{TBLFM}, keyword 2980 Formulas are stored in a special @samp{TBLFM} keyword located directly 2981 below the table. If you type the equation in the fourth field of the 2982 third data line in the table, the formula looks like @samp{@@3$4=$1+$2}. 2983 When inserting/deleting/swapping column and rows with the appropriate 2984 commands, @emph{absolute references} (but not relative ones) in stored 2985 formulas are modified in order to still reference the same field. To 2986 avoid this from happening, in particular in range references, anchor 2987 ranges at the table borders (using @samp{@@<}, @samp{@@>}, @samp{$<}, @samp{$>}), or at 2988 hlines using the @samp{@@I} notation. Automatic adaptation of field 2989 references does not happen if you edit the table structure with normal 2990 editing commands---you must fix the formulas yourself. 2991 2992 Instead of typing an equation into the field, you may also use the 2993 following command 2994 2995 @table @asis 2996 @item @kbd{C-u C-c =} (@code{org-table-eval-formula}) 2997 @kindex C-u C-c = 2998 @findex org-table-eval-formula 2999 Install a new formula for the current field. The command prompts 3000 for a formula with default taken from the @samp{TBLFM} keyword, 3001 applies it to the current field, and stores it. 3002 @end table 3003 3004 The left-hand side of a formula can also be a special expression in 3005 order to assign the formula to a number of different fields. There is 3006 no keyboard shortcut to enter such range formulas. To add them, use 3007 the formula editor (see @ref{Editing and debugging formulas}) or edit 3008 the @samp{TBLFM} keyword directly. 3009 3010 @table @asis 3011 @item @samp{$2=} 3012 Column formula, valid for the entire column. This is so common that 3013 Org treats these formulas in a special way, see @ref{Column formulas}. 3014 3015 @item @samp{@@3=} 3016 Row formula, applies to all fields in the specified row. @samp{@@>=} 3017 means the last row. 3018 3019 @item @samp{@@1$2..@@4$3=} 3020 Range formula, applies to all fields in the given rectangular range. 3021 This can also be used to assign a formula to some but not all fields 3022 in a row. 3023 3024 @item @samp{$NAME=} 3025 Named field, see @ref{Advanced features}. 3026 @end table 3027 3028 @node Column formulas 3029 @subsection Column formulas 3030 3031 @cindex column formula 3032 @cindex formula, for table column 3033 3034 When you assign a formula to a simple column reference like @samp{$3=}, the 3035 same formula is used in all fields of that column, with the following 3036 very convenient exceptions: (i) If the table contains horizontal 3037 separator hlines with rows above and below, everything before the 3038 first such hline is considered part of the table @emph{header} and is not 3039 modified by column formulas. Therefore a header is mandatory when you 3040 use column formulas and want to add hlines to group rows, like for 3041 example to separate a total row at the bottom from the summand rows 3042 above. (ii) Fields that already get a value from a field/range 3043 formula are left alone by column formulas. These conditions make 3044 column formulas very easy to use. 3045 3046 To assign a formula to a column, type it directly into any field in 3047 the column, preceded by an equal sign, like @samp{=$1+$2}. When you press 3048 @kbd{@key{TAB}} or @kbd{@key{RET}} or @kbd{C-c C-c} with point 3049 still in the field, the formula is stored as the formula for the 3050 current column, evaluated and the current field replaced with the 3051 result. If the field contains only @samp{=}, the previously stored formula 3052 for this column is used. For each column, Org only remembers the most 3053 recently used formula. In the @samp{TBLFM} keyword, column formulas look 3054 like @samp{$4=$1+$2}. The left-hand side of a column formula can not be 3055 the name of column, it must be the numeric column reference or @samp{$>}. 3056 3057 Instead of typing an equation into the field, you may also use the 3058 following command: 3059 3060 @table @asis 3061 @item @kbd{C-c =} (@code{org-table-eval-formula}) 3062 @kindex C-c = 3063 @findex org-table-eval-formula 3064 Install a new formula for the current column and replace current 3065 field with the result of the formula. The command prompts for 3066 a formula, with default taken from the @samp{TBLFM} keyword, applies it 3067 to the current field and stores it. With a numeric prefix argument, 3068 e.g., @kbd{C-5 C-c =}, the command applies it to that many 3069 consecutive fields in the current column. 3070 @end table 3071 3072 @node Lookup functions 3073 @subsection Lookup functions 3074 3075 @cindex lookup functions in tables 3076 @cindex table lookup functions 3077 3078 Org has three predefined Emacs Lisp functions for lookups in tables. 3079 3080 @table @asis 3081 @item @samp{(org-lookup-first VAL S-LIST R-LIST &optional PREDICATE)} 3082 @findex org-lookup-first 3083 Searches for the first element @var{S} in list 3084 @var{S-LIST} for which 3085 @lisp 3086 (PREDICATE VAL S) 3087 @end lisp 3088 is non-@code{nil}; returns the value from the corresponding position in 3089 list @var{R-LIST}. The default @var{PREDICATE} is 3090 @code{equal}. Note that the parameters @var{VAL} and @var{S} 3091 are passed to @var{PREDICATE} in the same order as the 3092 corresponding parameters are in the call to @code{org-lookup-first}, 3093 where @var{VAL} precedes @var{S-LIST}. If 3094 @var{R-LIST} is @code{nil}, the matching element @var{S} of 3095 @var{S-LIST} is returned. 3096 3097 @item @samp{(org-lookup-last VAL S-LIST R-LIST &optional PREDICATE)} 3098 @findex org-lookup-last 3099 Similar to @code{org-lookup-first} above, but searches for the @emph{last} 3100 element for which @var{PREDICATE} is non-@code{nil}. 3101 3102 @item @samp{(org-lookup-all VAL S-LIST R-LIST &optional PREDICATE)} 3103 @findex org-lookup-all 3104 Similar to @code{org-lookup-first}, but searches for @emph{all} elements for 3105 which @var{PREDICATE} is non-@code{nil}, and returns @emph{all} 3106 corresponding values. This function can not be used by itself in 3107 a formula, because it returns a list of values. However, powerful 3108 lookups can be built when this function is combined with other Emacs 3109 Lisp functions. 3110 @end table 3111 3112 If the ranges used in these functions contain empty fields, the @samp{E} 3113 mode for the formula should usually be specified: otherwise empty 3114 fields are not included in @var{S-LIST} and/or @var{R-LIST} 3115 which can, for example, result in an incorrect mapping from an element 3116 of @var{S-LIST} to the corresponding element of 3117 @var{R-LIST}. 3118 3119 These three functions can be used to implement associative arrays, 3120 count matching cells, rank results, group data, etc. For practical 3121 examples see @uref{https://orgmode.org/worg/org-tutorials/org-lookups.html, this tutorial on Worg}. 3122 3123 @node Editing and debugging formulas 3124 @subsection Editing and debugging formulas 3125 3126 @cindex formula editing 3127 @cindex editing, of table formulas 3128 3129 @vindex org-table-use-standard-references 3130 You can edit individual formulas in the minibuffer or directly in the 3131 field. Org can also prepare a special buffer with all active formulas 3132 of a table. When offering a formula for editing, Org converts 3133 references to the standard format (like @samp{B3} or @samp{D&}) if possible. If 3134 you prefer to only work with the internal format (like @samp{@@3$2} or 3135 @samp{$4}), configure the variable @code{org-table-use-standard-references}. 3136 3137 @table @asis 3138 @item @kbd{C-c =} or @kbd{C-u C-c =} (@code{org-table-eval-formula}) 3139 @kindex C-c = 3140 @kindex C-u C-c = 3141 @findex org-table-eval-formula 3142 Edit the formula associated with the current column/field in the 3143 minibuffer. See @ref{Column formulas}, and @ref{Field and range formulas}. 3144 3145 @item @kbd{C-u C-u C-c =} (@code{org-table-eval-formula}) 3146 @kindex C-u C-u C-c = 3147 @findex org-table-eval-formula 3148 Re-insert the active formula (either a field formula, or a column 3149 formula) into the current field, so that you can edit it directly in 3150 the field. The advantage over editing in the minibuffer is that you 3151 can use the command @kbd{C-c ?}. 3152 3153 @item @kbd{C-c ?} (@code{org-table-field-info}) 3154 @kindex C-c ? 3155 @findex org-table-field-info 3156 While editing a formula in a table field, highlight the field(s) 3157 referenced by the reference at point position in the formula. 3158 3159 @item @kbd{C-c @}} (@code{org-table-toggle-coordinate-overlays}) 3160 @kindex C-c @} 3161 @findex org-table-toggle-coordinate-overlays 3162 Toggle the display of row and column numbers for a table, using 3163 overlays. These are updated each time the table is aligned; you can 3164 force it with @kbd{C-c C-c}. 3165 3166 @item @kbd{C-c @{} (@code{org-table-toggle-formula-debugger}) 3167 @kindex C-c @{ 3168 @findex org-table-toggle-formula-debugger 3169 Toggle the formula debugger on and off. See below. 3170 3171 @item @kbd{C-c '} (@code{org-table-edit-formulas}) 3172 @kindex C-c ' 3173 @findex org-table-edit-formulas 3174 Edit all formulas for the current table in a special buffer, where 3175 the formulas are displayed one per line. If the current field has 3176 an active formula, point in the formula editor marks it. While 3177 inside the special buffer, Org automatically highlights any field or 3178 range reference at point position. You may edit, remove and add 3179 formulas, and use the following commands: 3180 3181 @table @asis 3182 @item @kbd{C-c C-c} or @kbd{C-x C-s} (@code{org-table-fedit-finish}) 3183 @kindex C-x C-s 3184 @kindex C-c C-c 3185 @findex org-table-fedit-finish 3186 Exit the formula editor and store the modified formulas. With 3187 @kbd{C-u} prefix, also apply the new formulas to the 3188 entire table. 3189 3190 @item @kbd{C-c C-q} (@code{org-table-fedit-abort}) 3191 @kindex C-c C-q 3192 @findex org-table-fedit-abort 3193 Exit the formula editor without installing changes. 3194 3195 @item @kbd{C-c C-r} (@code{org-table-fedit-toggle-ref-type}) 3196 @kindex C-c C-r 3197 @findex org-table-fedit-toggle-ref-type 3198 Toggle all references in the formula editor between standard (like 3199 @samp{B3}) and internal (like @samp{@@3$2}). 3200 3201 @item @kbd{@key{TAB}} (@code{org-table-fedit-lisp-indent}) 3202 @kindex TAB 3203 @findex org-table-fedit-lisp-indent 3204 Pretty-print or indent Lisp formula at point. When in a line 3205 containing a Lisp formula, format the formula according to Emacs 3206 Lisp rules. Another @kbd{@key{TAB}} collapses the formula back 3207 again. In the open formula, @kbd{@key{TAB}} re-indents just like 3208 in Emacs Lisp mode. 3209 3210 @item @kbd{M-@key{TAB}} (@code{lisp-complete-symbol}) 3211 @kindex M-TAB 3212 @findex lisp-complete-symbol 3213 Complete Lisp symbols, just like in Emacs Lisp mode. 3214 3215 @item @kbd{S-@key{UP}}, @kbd{S-@key{DOWN}}, @kbd{S-@key{LEFT}}, @kbd{S-@key{RIGHT}} 3216 @kindex S-UP 3217 @kindex S-DOWN 3218 @kindex S-LEFT 3219 @kindex S-RIGHT 3220 @findex org-table-fedit-ref-up 3221 @findex org-table-fedit-ref-down 3222 @findex org-table-fedit-ref-left 3223 @findex org-table-fedit-ref-right 3224 Shift the reference at point. For example, if the reference is 3225 @samp{B3} and you press @kbd{S-@key{RIGHT}}, it becomes @samp{C3}. This also 3226 works for relative references and for hline references. 3227 3228 @item @kbd{M-S-@key{UP}} (@code{org-table-fedit-line-up}) 3229 @kindex M-S-UP 3230 @findex org-table-fedit-line-up 3231 Move the test line for column formulas up in the Org buffer. 3232 3233 @item @kbd{M-S-@key{DOWN}} (@code{org-table-fedit-line-down}) 3234 @kindex M-S-DOWN 3235 @findex org-table-fedit-line-down 3236 Move the test line for column formulas down in the Org buffer. 3237 3238 @item @kbd{M-@key{UP}} (@code{org-table-fedit-scroll-up}) 3239 @kindex M-UP 3240 @findex org-table-fedit-scroll-up 3241 Scroll up the window displaying the table. 3242 3243 @item @kbd{M-@key{DOWN}} (@code{org-table-fedit-scroll-down}) 3244 @kindex M-DOWN 3245 @findex org-table-fedit-scroll-down 3246 Scroll down the window displaying the table. 3247 3248 @item @kbd{C-c @}} 3249 @kindex C-c @} 3250 @findex org-table-toggle-coordinate-overlays 3251 Turn the coordinate grid in the table on and off. 3252 @end table 3253 @end table 3254 3255 Making a table field blank does not remove the formula associated with 3256 the field, because that is stored in a different line---the @samp{TBLFM} 3257 keyword line. During the next recalculation, the field will be filled 3258 again. To remove a formula from a field, you have to give an empty 3259 reply when prompted for the formula, or to edit the @samp{TBLFM} keyword. 3260 3261 @kindex C-c C-c 3262 You may edit the @samp{TBLFM} keyword directly and re-apply the changed 3263 equations with @kbd{C-c C-c} in that line or with the normal 3264 recalculation commands in the table. 3265 3266 @anchor{Using multiple @samp{TBLFM} lines} 3267 @subsubheading Using multiple @samp{TBLFM} lines 3268 3269 @cindex multiple formula lines 3270 @cindex @samp{TBLFM} keywords, multiple 3271 @cindex @samp{TBLFM}, switching 3272 3273 @kindex C-c C-c 3274 You may apply the formula temporarily. This is useful when you want 3275 to switch the formula applied to the table. Place multiple @samp{TBLFM} 3276 keywords right after the table, and then press @kbd{C-c C-c} on 3277 the formula to apply. Here is an example: 3278 3279 @example 3280 | x | y | 3281 |---+---| 3282 | 1 | | 3283 | 2 | | 3284 #+TBLFM: $2=$1*1 3285 #+TBLFM: $2=$1*2 3286 @end example 3287 3288 @noindent 3289 Pressing @kbd{C-c C-c} in the line of @samp{#+TBLFM: $2=$1*2} yields: 3290 3291 @example 3292 | x | y | 3293 |---+---| 3294 | 1 | 2 | 3295 | 2 | 4 | 3296 #+TBLFM: $2=$1*1 3297 #+TBLFM: $2=$1*2 3298 @end example 3299 3300 @noindent 3301 If you recalculate this table, with @kbd{C-u C-c *}, for example, 3302 you get the following result from applying only the first @samp{TBLFM} 3303 keyword. 3304 3305 @example 3306 | x | y | 3307 |---+---| 3308 | 1 | 1 | 3309 | 2 | 2 | 3310 #+TBLFM: $2=$1*1 3311 #+TBLFM: $2=$1*2 3312 @end example 3313 3314 @anchor{Debugging formulas} 3315 @subsubheading Debugging formulas 3316 3317 @cindex formula debugging 3318 @cindex debugging, of table formulas 3319 3320 When the evaluation of a formula leads to an error, the field content 3321 becomes the string @samp{#ERROR}. If you want to see what is going on 3322 during variable substitution and calculation in order to find a bug, 3323 turn on formula debugging in the Tbl menu and repeat the calculation, 3324 for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a field. 3325 Detailed information are displayed. 3326 3327 @node Updating the table 3328 @subsection Updating the table 3329 3330 @cindex recomputing table fields 3331 @cindex updating, table 3332 3333 Recalculation of a table is normally not automatic, but needs to be 3334 triggered by a command. To make recalculation at least 3335 semi-automatic, see @ref{Advanced features}. 3336 3337 In order to recalculate a line of a table or the entire table, use the 3338 following commands: 3339 3340 @table @asis 3341 @item @kbd{C-c *} (@code{org-table-recalculate}) 3342 @kindex C-c * 3343 @findex org-table-recalculate 3344 Recalculate the current row by first applying the stored column 3345 formulas from left to right, and all field/range formulas in the 3346 current row. 3347 3348 @item @kbd{C-u C-c *} or @kbd{C-u C-c C-c} 3349 @kindex C-u C-c * 3350 @kindex C-u C-c C-c 3351 Recompute the entire table, line by line. Any lines before the 3352 first hline are left alone, assuming that these are part of the 3353 table header. 3354 3355 @item @kbd{C-u C-u C-c *} or @kbd{C-u C-u C-c C-c} (@code{org-table-iterate}) 3356 @kindex C-u C-u C-c * 3357 @kindex C-u C-u C-c C-c 3358 @findex org-table-iterate 3359 Iterate the table by recomputing it until no further changes occur. 3360 This may be necessary if some computed fields use the value of other 3361 fields that are computed @emph{later} in the calculation sequence. 3362 3363 @item @kbd{M-x org-table-recalculate-buffer-tables} 3364 @findex org-table-recalculate-buffer-tables 3365 Recompute all tables in the current buffer. 3366 3367 @item @kbd{M-x org-table-iterate-buffer-tables} 3368 @findex org-table-iterate-buffer-tables 3369 Iterate all tables in the current buffer, in order to converge 3370 table-to-table dependencies. 3371 @end table 3372 3373 @node Advanced features 3374 @subsection Advanced features 3375 3376 If you want the recalculation of fields to happen automatically, or if 3377 you want to be able to assign @emph{names}@footnote{ Such names must start with 3378 an alphabetic character and use only alphanumeric/underscore 3379 characters.} to fields and columns, you need to reserve the first 3380 column of the table for special marking characters. 3381 3382 @table @asis 3383 @item @kbd{C-#} (@code{org-table-rotate-recalc-marks}) 3384 @kindex C-# 3385 @findex org-table-rotate-recalc-marks 3386 Rotate the calculation mark in first column through the states @samp{#}, 3387 @samp{*}, @samp{!}, @samp{$}. When there is an active region, change all marks in 3388 the region. 3389 @end table 3390 3391 Here is an example of a table that collects exam results of students 3392 and makes use of these features: 3393 3394 @example 3395 |---+---------+--------+--------+--------+-------+------| 3396 | | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note | 3397 |---+---------+--------+--------+--------+-------+------| 3398 | ! | | P1 | P2 | P3 | Tot | | 3399 | # | Maximum | 10 | 15 | 25 | 50 | 10.0 | 3400 | ^ | | m1 | m2 | m3 | mt | | 3401 |---+---------+--------+--------+--------+-------+------| 3402 | # | Peter | 10 | 8 | 23 | 41 | 8.2 | 3403 | # | Sam | 2 | 4 | 3 | 9 | 1.8 | 3404 |---+---------+--------+--------+--------+-------+------| 3405 | | Average | | | | 25.0 | | 3406 | ^ | | | | | at | | 3407 | $ | max=50 | | | | | | 3408 |---+---------+--------+--------+--------+-------+------| 3409 #+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f 3410 @end example 3411 3412 @quotation Important 3413 Please note that for these special tables, recalculating the table 3414 with @kbd{C-u C-c *} only affects rows that are marked @samp{#} or 3415 @samp{*}, and fields that have a formula assigned to the field itself. The 3416 column formulas are not applied in rows with empty first field. 3417 3418 @end quotation 3419 3420 @cindex marking characters, tables 3421 The marking characters have the following meaning: 3422 3423 @table @asis 3424 @item @samp{!} 3425 The fields in this line define names for the columns, so that you 3426 may refer to a column as @samp{$Tot} instead of @samp{$6}. 3427 3428 @item @samp{^} 3429 This row defines names for the fields @emph{above} the row. With such 3430 a definition, any formula in the table may use @samp{$m1} to refer to the 3431 value @samp{10}. Also, if you assign a formula to a names field, it is 3432 stored as @samp{$name = ...}. 3433 3434 @item @samp{_} 3435 Similar to @samp{^}, but defines names for the fields in the row @emph{below}. 3436 3437 @item @samp{$} 3438 Fields in this row can define @emph{parameters} for formulas. For 3439 example, if a field in a @samp{$} row contains @samp{max=50}, then formulas in 3440 this table can refer to the value 50 using @samp{$max}. Parameters work 3441 exactly like constants, only that they can be defined on a per-table 3442 basis. 3443 3444 @item @samp{#} 3445 Fields in this row are automatically recalculated when pressing 3446 @kbd{@key{TAB}} or @kbd{@key{RET}} or @kbd{S-@key{TAB}} in this row. 3447 Also, this row is selected for a global recalculation with 3448 @kbd{C-u C-c *}. Unmarked lines are left alone by this 3449 command. 3450 3451 @item @samp{*} 3452 Selects this line for global recalculation with @kbd{C-u C-c *}, but not for automatic recalculation. Use this when automatic 3453 recalculation slows down editing too much. 3454 3455 @item @samp{/} 3456 Do not export this line. Useful for lines that contain the 3457 narrowing @samp{<N>} markers or column group markers. 3458 @end table 3459 3460 Finally, just to whet your appetite for what can be done with the 3461 fantastic Calc package, here is a table that computes the Taylor 3462 series of degree n at location x for a couple of functions. 3463 3464 @example 3465 |---+-------------+---+-----+--------------------------------------| 3466 | | Func | n | x | Result | 3467 |---+-------------+---+-----+--------------------------------------| 3468 | # | exp(x) | 1 | x | 1 + x | 3469 | # | exp(x) | 2 | x | 1 + x + x^2 / 2 | 3470 | # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 | 3471 | # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 | 3472 | # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 | 3473 | * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 | 3474 |---+-------------+---+-----+--------------------------------------| 3475 #+TBLFM: $5=taylor($2,$4,$3);n3 3476 @end example 3477 3478 @node Org Plot 3479 @section Org Plot 3480 3481 @cindex graph, in tables 3482 @cindex plot tables using Gnuplot 3483 3484 Org Plot can produce graphs of information stored in Org tables, 3485 either graphically or in ASCII art. 3486 3487 @anchor{Graphical plots using Gnuplot} 3488 @subheading Graphical plots using Gnuplot 3489 3490 @cindex @samp{PLOT}, keyword 3491 Org Plot can produce 2D and 3D graphs of information stored in Org 3492 tables using @uref{https://www.gnuplot.info/, Gnuplot} and @uref{http://cars9.uchicago.edu/~ravel/software/gnuplot-mode.html, Gnuplot mode}. To see this in action, ensure 3493 that you have both Gnuplot and Gnuplot mode installed on your system, 3494 then call @kbd{C-c " g} or @kbd{M-x org-plot/gnuplot} on the 3495 following table. 3496 3497 @example 3498 #+PLOT: title:"Citas" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]" 3499 | Sede | Max cites | H-index | 3500 |-----------+-----------+---------| 3501 | Chile | 257.72 | 21.39 | 3502 | Leeds | 165.77 | 19.68 | 3503 | Sao Paolo | 71.00 | 11.50 | 3504 | Stockholm | 134.19 | 14.33 | 3505 | Morelia | 257.56 | 17.67 | 3506 @end example 3507 3508 Org Plot supports a range of plot types, and provides the ability to add more. 3509 For example, a radar plot can be generated like so: 3510 @example 3511 #+PLOT: title:"An evaluation of plaintext document formats" transpose:yes type:radar min:0 max:4 3512 | Format | Fine-grained-control | Initial Effort | Syntax simplicity | Editor Support | Integrations | Ease-of-referencing | Versatility | 3513 |-------------------+----------------------+----------------+-------------------+----------------+--------------+---------------------+-------------| 3514 | Word | 2 | 4 | 4 | 2 | 3 | 2 | 2 | 3515 | LaTeX | 4 | 1 | 1 | 3 | 2 | 4 | 3 | 3516 | Org Mode | 4 | 2 | 3.5 | 1 | 4 | 4 | 4 | 3517 | Markdown | 1 | 3 | 3 | 4 | 3 | 3 | 1 | 3518 | Markdown + Pandoc | 2.5 | 2.5 | 2.5 | 3 | 3 | 3 | 2 | 3519 @end example 3520 3521 Notice that Org Plot is smart enough to apply the table's headers as 3522 labels. Further control over the labels, type, content, and 3523 appearance of plots can be exercised through the @samp{PLOT} keyword 3524 preceding a table. See below for a complete list of Org Plot options. 3525 For more information and examples see the @uref{https://orgmode.org/worg/org-tutorials/org-plot.html, Org Plot tutorial}. 3526 3527 @anchor{Plot options} 3528 @subsubheading Plot options 3529 3530 @table @asis 3531 @item @samp{set} 3532 Specify any Gnuplot option to be set when graphing. 3533 3534 @item @samp{title} 3535 Specify the title of the plot. 3536 3537 @item @samp{ind} 3538 Specify which column of the table to use as the @samp{x} axis. 3539 3540 @item @samp{timeind} 3541 Specify which column of the table to use as the @samp{x} axis as a time 3542 value. 3543 3544 @item @samp{deps} 3545 Specify the columns to graph as a Lisp style list, surrounded by 3546 parentheses and separated by spaces for example @samp{dep:(3 4)} to graph 3547 the third and fourth columns. Defaults to graphing all other 3548 columns aside from the @samp{ind} column. 3549 3550 @item @samp{transpose} 3551 When @samp{y}, @samp{yes}, or @samp{t} attempt to transpose the table data before 3552 plotting. Also recognizes the shorthand option @samp{trans}. 3553 3554 @item @samp{type} 3555 Specify the type of the plot, by default one of @samp{2d}, @samp{3d}, @samp{radar}, or @samp{grid}. 3556 Available types can be customized with @code{org-plot/preset-plot-types}. 3557 3558 @item @samp{with} 3559 Specify a @samp{with} option to be inserted for every column being 3560 plotted, e.g., @samp{lines}, @samp{points}, @samp{boxes}, @samp{impulses}. Defaults to 3561 @samp{lines}. 3562 3563 @item @samp{file} 3564 If you want to plot to a file, specify 3565 @samp{"path/to/desired/output-file"}. 3566 3567 @item @samp{labels} 3568 List of labels to be used for the @samp{deps}. Defaults to the column 3569 headers if they exist. 3570 3571 @item @samp{line} 3572 Specify an entire line to be inserted in the Gnuplot script. 3573 3574 @item @samp{map} 3575 When plotting @samp{3d} or @samp{grid} types, set this to @samp{t} to graph a flat 3576 mapping rather than a @samp{3d} slope. 3577 3578 @item @samp{min} 3579 Provides a minimum axis value that may be used by a plot type. 3580 Implicitly assumes the @samp{y} axis is being referred to. Can 3581 explicitly provide a value for a either the @samp{x} or @samp{y} axis with 3582 @samp{xmin} and @samp{ymin}. 3583 3584 @item @samp{max} 3585 Provides a maximum axis value that may be used by a plot type. 3586 Implicitly assumes the @samp{y} axis is being referred to. Can 3587 explicitly provide a value for a either the @samp{x} or @samp{y} axis with 3588 @samp{xmax} and @samp{ymax}. 3589 3590 @item @samp{ticks} 3591 Provides a desired number of axis ticks to display, that may be used 3592 by a plot type. If none is given a plot type that requires ticks 3593 will use @code{org--plot/sensible-tick-num} to try to determine a good 3594 value. 3595 3596 @item @samp{timefmt} 3597 Specify format of Org mode timestamps as they will be parsed by 3598 Gnuplot. Defaults to @samp{%Y-%m-%d-%H:%M:%S}. 3599 3600 @item @samp{script} 3601 If you want total control, you can specify a script file---place the 3602 file name between double-quotes---which will be used to plot. 3603 Before plotting, every instance of @samp{$datafile} in the specified 3604 script will be replaced with the path to the generated data file. 3605 Note: even if you set this option, you may still want to specify the 3606 plot type, as that can impact the content of the data file. 3607 @end table 3608 3609 @anchor{ASCII bar plots} 3610 @subheading ASCII bar plots 3611 3612 While point is on a column, typing @kbd{C-c " a} or @kbd{M-x orgtbl-ascii-plot} create a new column containing an ASCII-art bars 3613 plot. The plot is implemented through a regular column formula. When 3614 the source column changes, the bar plot may be updated by refreshing 3615 the table, for example typing @kbd{C-u C-c *}. 3616 3617 @example 3618 | Sede | Max cites | | 3619 |---------------+-----------+--------------| 3620 | Chile | 257.72 | WWWWWWWWWWWW | 3621 | Leeds | 165.77 | WWWWWWWh | 3622 | Sao Paolo | 71.00 | WWW; | 3623 | Stockholm | 134.19 | WWWWWW: | 3624 | Morelia | 257.56 | WWWWWWWWWWWH | 3625 | Rochefourchat | 0.00 | | 3626 #+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12) 3627 @end example 3628 3629 The formula is an Elisp call. 3630 3631 @defun orgtbl-ascii-draw value min max &optional width 3632 Draw an ASCII bar in a table. 3633 3634 @var{VALUE} is the value to plot. 3635 3636 @var{MIN} is the value displayed as an empty bar. @var{MAX} 3637 is the value filling all the @var{WIDTH}. Sources values outside 3638 this range are displayed as @samp{too small} or @samp{too large}. 3639 3640 @var{WIDTH} is the number of characters of the bar plot. It 3641 defaults to @samp{12}. 3642 @end defun 3643 3644 @node Hyperlinks 3645 @chapter Hyperlinks 3646 3647 @cindex hyperlinks 3648 3649 Like HTML, Org provides support for links inside a file, external 3650 links to other files, Usenet articles, emails, and much more. 3651 3652 @menu 3653 * Link Format:: How links in Org are formatted. 3654 * Internal Links:: Links to other places in the current file. 3655 * Radio Targets:: Make targets trigger links in plain text. 3656 * External Links:: URL-like links to the world. 3657 * Handling Links:: Creating, inserting and following. 3658 * Using Links Outside Org:: Linking from my C source code? 3659 * Link Abbreviations:: Shortcuts for writing complex links. 3660 * Search Options:: Linking to a specific location. 3661 * Custom Searches:: When the default search is not enough. 3662 @end menu 3663 3664 @node Link Format 3665 @section Link Format 3666 3667 @cindex link format 3668 @cindex format, of links 3669 3670 @cindex angle bracket links 3671 @cindex plain links 3672 Org recognizes plain URIs, possibly wrapped within angle 3673 brackets@footnote{Plain URIs are recognized only for a well-defined set of 3674 schemes. See @ref{External Links}. Unlike URI syntax, they cannot contain 3675 parenthesis or white spaces, either. URIs within angle brackets have 3676 no such limitation.}, and activate them as clickable links. 3677 3678 @cindex bracket links 3679 The general link format, however, looks like this: 3680 3681 @example 3682 [[LINK][DESCRIPTION]] 3683 @end example 3684 3685 3686 @noindent 3687 or alternatively 3688 3689 @example 3690 [[LINK]] 3691 @end example 3692 3693 3694 @cindex escape syntax, for links 3695 @cindex backslashes, in links 3696 Some @samp{\}, @samp{[} and @samp{]} characters in the @var{LINK} part need to 3697 be ``escaped'', i.e., preceded by another @samp{\} character. More 3698 specifically, the following characters, and only them, must be 3699 escaped: 3700 3701 @enumerate 3702 @item 3703 all @samp{[} and @samp{]} characters, 3704 @item 3705 every @samp{\} character preceding either @samp{]} or @samp{[}, 3706 @item 3707 every @samp{\} character at the end of the link. 3708 @end enumerate 3709 3710 @findex org-link-escape 3711 Functions inserting links (see @ref{Handling Links}) properly escape 3712 ambiguous characters. You only need to bother about the rules above 3713 when inserting directly, or yanking, a URI within square brackets. 3714 When in doubt, you may use the function @code{org-link-escape}, which turns 3715 a link string into its escaped form. 3716 3717 Once a link in the buffer is complete, with all brackets present, Org 3718 changes the display so that @samp{DESCRIPTION} is displayed instead of 3719 @samp{[[LINK][DESCRIPTION]]} and @samp{LINK} is displayed instead of @samp{[[LINK]]}. 3720 Links are highlighted in the @code{org-link} face, which, by default, is an 3721 underlined face. 3722 3723 You can directly edit the visible part of a link. This can be either 3724 the @var{LINK} part, if there is no description, or the 3725 @var{DESCRIPTION} part otherwise. To also edit the invisible 3726 @var{LINK} part, use @kbd{C-c C-l} with point on the link 3727 (see @ref{Handling Links}). 3728 3729 If you place point at the beginning or just behind the end of the 3730 displayed text and press @kbd{@key{BS}}, you remove 3731 the---invisible---bracket at that location@footnote{ More accurately, the 3732 precise behavior depends on how point arrived there---see 3733 @ref{Invisible Text,Invisible Text,,elisp,}.}. This makes the link 3734 incomplete and the internals are again displayed as plain text. 3735 Inserting the missing bracket hides the link internals again. To show 3736 the internal structure of all links, use the menu: Org @arrow{} 3737 Hyperlinks @arrow{} Literal links, customize @code{org-link-descriptive}, or use 3738 @samp{literallinks} @ref{In-buffer Settings, , startup option}. 3739 3740 @node Internal Links 3741 @section Internal Links 3742 3743 @cindex internal links 3744 @cindex links, internal 3745 3746 A link that does not look like a URL---i.e., does not start with 3747 a known scheme or a file name---refers to the current document. You 3748 can follow it with @kbd{C-c C-o} when point is on the link, or 3749 with a mouse click (see @ref{Handling Links}). 3750 3751 @cindex @samp{CUSTOM_ID}, property 3752 Org provides several refinements to internal navigation within 3753 a document. Most notably, a construct like @samp{[[#my-custom-id]]} 3754 specifically targets the entry with the @samp{CUSTOM_ID} property set to 3755 @samp{my-custom-id}. Also, an internal link looking like @samp{[[*Some 3756 section]]} points to a headline with the name @samp{Some section}@footnote{To insert a link targeting a headline, in-buffer completion 3757 can be used. Just type a star followed by a few optional letters into 3758 the buffer and press @kbd{M-@key{TAB}}. All headlines in the current 3759 buffer are offered as completions.}. 3760 3761 @cindex targets, for links 3762 When the link does not belong to any of the cases above, Org looks for 3763 a @emph{dedicated target}: the same string in double angular brackets, like 3764 @samp{<<My Target>>}. 3765 3766 @cindex @samp{NAME}, keyword 3767 If no dedicated target exists, the link tries to match the exact name 3768 of an element within the buffer. Naming is done, unsurprisingly, with 3769 the @samp{NAME} keyword, which has to be put in the line before the element 3770 it refers to, as in the following example 3771 3772 @example 3773 #+NAME: My Target 3774 | a | table | 3775 |----+------------| 3776 | of | four cells | 3777 @end example 3778 3779 @vindex org-link-search-must-match-exact-headline 3780 Ultimately, if none of the above succeeds, Org searches for a headline 3781 that is exactly the link text but may also include a TODO keyword and 3782 tags, or initiates a plain text search, according to the value of 3783 @code{org-link-search-must-match-exact-headline}. 3784 3785 Note that you must make sure custom IDs, dedicated targets, and names 3786 are unique throughout the document. Org provides a linter to assist 3787 you in the process, if needed. See @ref{Org Syntax}. 3788 3789 During export, internal links are used to mark objects and assign them 3790 a number. Marked objects are then referenced by links pointing to 3791 them. In particular, links without a description appear as the number 3792 assigned to the marked object@footnote{ When targeting a @samp{NAME} keyword, 3793 the @samp{CAPTION} keyword is mandatory in order to get proper numbering 3794 (see @ref{Captions}).}. In the following excerpt from an Org buffer 3795 3796 @example 3797 1. one item 3798 2. <<target>>another item 3799 Here we refer to item [[target]]. 3800 @end example 3801 3802 @noindent 3803 The last sentence will appear as @samp{Here we refer to item 2} when 3804 exported. 3805 3806 In non-Org files, the search looks for the words in the link text. In 3807 the above example the search would be for @samp{target}. 3808 3809 Following a link pushes a mark onto Org's own mark ring. You can 3810 return to the previous position with @kbd{C-c &}. Using this 3811 command several times in direct succession goes back to positions 3812 recorded earlier. 3813 3814 @node Radio Targets 3815 @section Radio Targets 3816 3817 @cindex radio targets 3818 @cindex targets, radio 3819 @cindex links, radio targets 3820 3821 Org can automatically turn any occurrences of certain target names in 3822 normal text into a link. So without explicitly creating a link, the 3823 text connects to the target radioing its position. Radio targets are 3824 enclosed by triple angular brackets. For example, a target @samp{<<<My 3825 Target>>>} causes each occurrence of @samp{my target} in normal text to 3826 become activated as a link. The Org file is scanned automatically for 3827 radio targets only when the file is first loaded into Emacs. To 3828 update the target list during editing, press @kbd{C-c C-c} with 3829 point on or at a target. 3830 3831 @node External Links 3832 @section External Links 3833 3834 @cindex links, external 3835 @cindex external links 3836 @cindex attachment links 3837 @cindex BBDB links 3838 @cindex Elisp links 3839 @cindex file links 3840 @cindex Gnus links 3841 @cindex Help links 3842 @cindex IRC links 3843 @cindex Info links 3844 @cindex MH-E links 3845 @cindex Rmail links 3846 @cindex shell links 3847 @cindex URL links 3848 @cindex Usenet links 3849 3850 Org supports links to files, websites, Usenet and email messages, BBDB 3851 database entries and links to both IRC conversations and their logs. 3852 External links are URL-like locators. They start with a short 3853 identifying string followed by a colon. There can be no space after 3854 the colon. 3855 3856 Here is the full set of built-in link types: 3857 3858 @table @asis 3859 @item @samp{file} 3860 File links. File name may be remote, absolute, or relative. 3861 3862 As a special case, ``file'' prefix may be omitted if the file name 3863 is complete, e.g., it starts with @samp{./}, or @samp{/}. 3864 3865 @item @samp{attachment} 3866 Same as file links but for files and folders attached to the current 3867 node (see @ref{Attachments}). Attachment links are intended to behave 3868 exactly as file links but for files relative to the attachment 3869 directory. 3870 3871 @item @samp{bbdb} 3872 Link to a BBDB record, with possible regexp completion. 3873 3874 @item @samp{docview} 3875 Link to a document opened with DocView mode. You may specify a page 3876 number. 3877 3878 @item @samp{doi} 3879 Link to an electronic resource, through its handle. 3880 3881 @item @samp{elisp} 3882 Execute an Elisp command upon activation. 3883 3884 @item @samp{gnus}, @samp{rmail}, @samp{mhe} 3885 Link to messages or folders from a given Emacs MUA@. 3886 3887 @item @samp{help} 3888 Display documentation of a symbol in @samp{*Help*} buffer. 3889 3890 @item @samp{http}, @samp{https} 3891 Web links. 3892 3893 @item @samp{id} 3894 Link to a specific headline by its ID property, in an Org file. 3895 3896 @item @samp{info} 3897 Link to an Info manual, or to a specific node. 3898 3899 @item @samp{irc} 3900 Link to an IRC channel. 3901 3902 @item @samp{mailto} 3903 Link to message composition. 3904 3905 @item @samp{news} 3906 Usenet links. 3907 3908 @item @samp{shell} 3909 Execute a shell command upon activation. 3910 @end table 3911 3912 3913 For @samp{file:} and @samp{id:} links, you can additionally specify a line 3914 number, or a text search string, separated by @samp{::}. In Org files, you 3915 may link to a headline name, a custom ID, or a code reference instead. 3916 3917 The following table illustrates the link types above, along with their 3918 options: 3919 3920 @multitable {aaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 3921 @headitem Link Type 3922 @tab Example 3923 @item http 3924 @tab @samp{http://staff.science.uva.nl/c.dominik/} 3925 @item https 3926 @tab @samp{https://orgmode.org/} 3927 @item doi 3928 @tab @samp{doi:10.1000/182} 3929 @item file 3930 @tab @samp{file:/home/dominik/images/jupiter.jpg} 3931 @item 3932 @tab @samp{/home/dominik/images/jupiter.jpg} (same as above) 3933 @item 3934 @tab @samp{file:papers/last.pdf} 3935 @item 3936 @tab @samp{./papers/last.pdf} (same as above) 3937 @item 3938 @tab @samp{file:/ssh:me@@some.where:papers/last.pdf} (remote) 3939 @item 3940 @tab @samp{/ssh:me@@some.where:papers/last.pdf} (same as above) 3941 @item 3942 @tab @samp{file:sometextfile::NNN} (jump to line number) 3943 @item 3944 @tab @samp{file:projects.org} 3945 @item 3946 @tab @samp{file:projects.org::some words} (text search)@footnote{The actual behavior of the search depends on the value of the 3947 variable @code{org-link-search-must-match-exact-headline}. If its value is 3948 @code{nil}, then a fuzzy text search is done. If it is @code{t}, then only the 3949 exact headline is matched, ignoring spaces and statistic cookies. If 3950 the value is @code{query-to-create}, then an exact headline is searched; if 3951 it is not found, then the user is queried to create it.} 3952 @item 3953 @tab @samp{file:projects.org::*task title} (headline search) 3954 @item 3955 @tab @samp{file:projects.org::#custom-id} (headline search) 3956 @item attachment 3957 @tab @samp{attachment:projects.org} 3958 @item 3959 @tab @samp{attachment:projects.org::some words} (text search) 3960 @item docview 3961 @tab @samp{docview:papers/last.pdf::NNN} 3962 @item id 3963 @tab @samp{id:B7423F4D-2E8A-471B-8810-C40F074717E9} 3964 @item 3965 @tab @samp{id:B7423F4D-2E8A-471B-8810-C40F074717E9::*task} (headline search) 3966 @item news 3967 @tab @samp{news:comp.emacs} 3968 @item mailto 3969 @tab @samp{mailto:adent@@galaxy.net} 3970 @item mhe 3971 @tab @samp{mhe:folder} (folder link) 3972 @item 3973 @tab @samp{mhe:folder#id} (message link) 3974 @item rmail 3975 @tab @samp{rmail:folder} (folder link) 3976 @item 3977 @tab @samp{rmail:folder#id} (message link) 3978 @item gnus 3979 @tab @samp{gnus:group} (group link) 3980 @item 3981 @tab @samp{gnus:group#id} (article link) 3982 @item bbdb 3983 @tab @samp{bbdb:R.*Stallman} (record with regexp) 3984 @item irc 3985 @tab @samp{irc:/irc.com/#emacs/bob} 3986 @item help 3987 @tab @samp{help:org-store-link} 3988 @item info 3989 @tab @samp{info:org#External links} 3990 @item shell 3991 @tab @samp{shell:ls *.org} 3992 @item elisp 3993 @tab @samp{elisp:(find-file "Elisp.org")} (Elisp form to evaluate) 3994 @item 3995 @tab @samp{elisp:org-agenda} (interactive Elisp command) 3996 @end multitable 3997 3998 @cindex VM links 3999 @cindex Wanderlust links 4000 On top of these built-in link types, additional ones are available 4001 through the @samp{org-contrib} repository (see @ref{Installation}). For 4002 example, these links to VM or Wanderlust messages are available when 4003 you load the corresponding libraries from the @samp{org-contrib} 4004 repository: 4005 4006 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaa} 4007 @item @samp{vm:folder} 4008 @tab VM folder link 4009 @item @samp{vm:folder#id} 4010 @tab VM message link 4011 @item @samp{vm://myself@@some.where.org/folder#id} 4012 @tab VM on remote machine 4013 @item @samp{vm-imap:account:folder} 4014 @tab VM IMAP folder link 4015 @item @samp{vm-imap:account:folder#id} 4016 @tab VM IMAP message link 4017 @item @samp{wl:folder} 4018 @tab Wanderlust folder link 4019 @item @samp{wl:folder#id} 4020 @tab Wanderlust message link 4021 @end multitable 4022 4023 For information on customizing Org to add new link types, see @ref{Adding Hyperlink Types}. 4024 4025 A link should be enclosed in double brackets and may contain 4026 descriptive text to be displayed instead of the URL (see @ref{Link Format}), for example: 4027 4028 @example 4029 [[https://www.gnu.org/software/emacs/][GNU Emacs]] 4030 @end example 4031 4032 4033 If the description is a file name or URL that points to an image, HTML 4034 export (see @ref{HTML Export}) inlines the image as a clickable button. If 4035 there is no description at all and the link points to an image, that 4036 image is inlined into the exported HTML file. 4037 4038 @cindex square brackets, around links 4039 @cindex angular brackets, around links 4040 @cindex plain text external links 4041 Org also recognizes external links amid normal text and activates them 4042 as links. If spaces must be part of the link (for example in 4043 @samp{bbdb:R.*Stallman}), or if you need to remove ambiguities about the 4044 end of the link, enclose the link in square or angular brackets. 4045 4046 @node Handling Links 4047 @section Handling Links 4048 4049 @cindex links, handling 4050 4051 Org provides methods to create a link in the correct syntax, to insert 4052 it into an Org file, and to follow the link. 4053 4054 @findex org-store-link 4055 @cindex storing links 4056 The main function is @code{org-store-link}, called with @kbd{M-x org-store-link}. Because of its importance, we suggest to bind it 4057 to a widely available key (see @ref{Activation}). It stores a link to the 4058 current location. The link is stored for later insertion into an Org 4059 buffer---see below. The kind of link that is created depends on the 4060 current buffer: 4061 4062 @table @asis 4063 @item @emph{Org mode buffers} 4064 For Org files, if there is a @samp{<<target>>} at point, the link points 4065 to the target. If there is a named block (using @samp{#+name:}) at 4066 point, the link points to that name. Otherwise it points to the 4067 current headline, which is also the description. 4068 4069 @vindex org-id-link-to-org-use-id 4070 @cindex @samp{CUSTOM_ID}, property 4071 @cindex @samp{ID}, property 4072 If the headline has a @samp{CUSTOM_ID} property, store a link to this 4073 custom ID@. In addition or alternatively, depending on the value of 4074 @code{org-id-link-to-org-use-id}, create and/or use a globally unique 4075 @samp{ID} property for the link@footnote{ The Org Id library must first be 4076 loaded, either through @code{org-customize}, by enabling @code{id} in 4077 @code{org-modules}, or by adding @samp{(require 'org-id)} in your Emacs init 4078 file.}. So using this command in Org buffers potentially creates 4079 two links: a human-readable link from the custom ID, and one that is 4080 globally unique and works even if the entry is moved from file to 4081 file. The @samp{ID} property can be either a UUID (default) or a 4082 timestamp, depending on @code{org-id-method}. Later, when inserting the 4083 link, you need to decide which one to use. 4084 4085 @vindex org-id-link-consider-parent-id 4086 @vindex org-id-link-use-context 4087 @vindex org-link-context-for-files 4088 When @code{org-id-link-consider-parent-id} is @code{t}@footnote{ Also, 4089 @code{org-link-context-for-files} and @code{org-id-link-use-context} should be 4090 both enabled (which they are, by default).}, parent @samp{ID} properties 4091 are considered. This allows linking to specific targets, named 4092 blocks, or headlines (which may not have a globally unique @samp{ID} 4093 themselves) within the context of a parent headline or file which 4094 does. 4095 4096 For example, given this org file: 4097 4098 @example 4099 * Parent 4100 :PROPERTIES: 4101 :ID: abc 4102 :END: 4103 ** Child 1 4104 ** Child 2 4105 @end example 4106 4107 Storing a link with point at ``Child 1'' will produce a link 4108 @samp{<id:abc::*Child 1>}, which precisely links to the ``Child 1'' 4109 headline even though it does not have its own ID@. 4110 4111 @item @emph{Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus} 4112 @vindex org-link-email-description-format 4113 Pretty much all Emacs mail clients are supported. The link points 4114 to the current article, or, in some Gnus buffers, to the group. The 4115 description is constructed according to the variable 4116 @code{org-link-email-description-format}. By default, it refers to the 4117 addressee and the subject. 4118 4119 @item @emph{Web browsers: W3M and EWW} 4120 Here the link is the current URL, with the page title as the 4121 description. 4122 4123 @item @emph{Contacts: BBDB} 4124 Links created in a BBDB buffer point to the current entry. 4125 4126 @item @emph{Chat: IRC} 4127 @vindex org-irc-links-to-logs 4128 For IRC links, if the variable @code{org-irc-link-to-logs} is non-@code{nil}, 4129 create a @samp{file} style link to the relevant point in the logs for the 4130 current conversation. Otherwise store an @samp{irc} style link to the 4131 user/channel/server under the point. 4132 4133 @item @emph{Other files} 4134 For any other file, the link points to the file, with a search 4135 string (see @ref{Search Options}) pointing to the contents 4136 of the current line. If there is an active region, the selected 4137 words form the basis of the search string. You can write custom Lisp 4138 functions to select the search string and perform the search for 4139 particular file types (see @ref{Custom Searches}). 4140 4141 You can also define dedicated links to other files. See @ref{Adding Hyperlink Types}. 4142 4143 @item @emph{Agenda view} 4144 When point is in an agenda view, the created link points to the 4145 entry referenced by the current line. 4146 @end table 4147 4148 From an Org buffer, the following commands create, navigate or, more 4149 generally, act on links. 4150 4151 @table @asis 4152 @item @kbd{C-c C-l} (@code{org-insert-link}) 4153 @kindex C-c C-l 4154 @findex org-insert-link 4155 @cindex link completion 4156 @cindex completion, of links 4157 @cindex inserting links 4158 @vindex org-link-keep-stored-after-insertion 4159 Insert a link@footnote{Note that you do not have to use this command to insert 4160 a link. Links in Org are plain text, and you can type or paste them 4161 straight into the buffer. By using this command, the links are 4162 automatically enclosed in double brackets, and you will be asked for 4163 the optional descriptive text.}. This prompts for a link to be inserted into 4164 the buffer. You can just type a link, using text for an internal 4165 link, or one of the link type prefixes mentioned in the examples 4166 above. The link is inserted into the buffer, along with 4167 a descriptive text@footnote{After insertion of a stored link, the link will be removed 4168 from the list of stored links. To keep it in the list for later use, 4169 use a triple @kbd{C-u} prefix argument to @kbd{C-c C-l}, or 4170 configure the option @code{org-link-keep-stored-after-insertion}.}. If some text was selected at this time, 4171 it becomes the default description. 4172 4173 @table @asis 4174 @item @emph{Inserting stored links} 4175 All links stored during the current session are part of the 4176 history for this prompt, so you can access them with @kbd{@key{UP}} 4177 and @kbd{@key{DOWN}} (or @kbd{M-p}, @kbd{M-n}). 4178 4179 @item @emph{Completion support} 4180 Completion with @kbd{@key{TAB}} helps you to insert valid link 4181 prefixes like @samp{http} or @samp{ftp}, including the prefixes defined 4182 through link abbreviations (see @ref{Link Abbreviations}). If you 4183 press @kbd{@key{RET}} after inserting only the prefix, Org offers 4184 specific completion support for some link types@footnote{ This works if 4185 a function has been defined in the @code{:complete} property of a link 4186 in @code{org-link-parameters}.}. For example, if you type @kbd{f i l e @key{RET}}---alternative access: @kbd{C-u C-c C-l}, see 4187 below---Org offers file name completion, and after @kbd{b b d b @key{RET}} you can complete contact names. 4188 @end table 4189 4190 @item @kbd{C-u C-c C-l} 4191 @cindex file name completion 4192 @cindex completion, of file names 4193 @kindex C-u C-c C-l 4194 When @kbd{C-c C-l} is called with a @kbd{C-u} prefix 4195 argument, insert a link to a file. You may use file name completion 4196 to select the name of the file. The path to the file is inserted 4197 relative to the directory of the current Org file, if the linked 4198 file is in the current directory or in a sub-directory of it, or if 4199 the path is written relative to the current directory using @samp{../}. 4200 Otherwise an absolute path is used, if possible with @samp{~/} for your 4201 home directory. You can force an absolute path with two 4202 @kbd{C-u} prefixes. 4203 4204 @item @kbd{C-c C-l} (with point on existing link) 4205 @cindex following links 4206 When point is on an existing link, @kbd{C-c C-l} allows you to 4207 edit the link and description parts of the link. 4208 4209 @item @kbd{C-c C-o} (@code{org-open-at-point}) 4210 @kindex C-c C-o 4211 @findex org-open-at-point 4212 @vindex org-file-apps 4213 Open link at point. This launches a web browser for URL (using 4214 @code{browse-url-at-point}), run VM/MH-E/Wanderlust/Rmail/Gnus/BBDB for 4215 the corresponding links, and execute the command in a shell link. 4216 When point is on an internal link, this command runs the 4217 corresponding search. When point is on the tags part of a headline, 4218 it creates the corresponding tags view (see @ref{Matching tags and properties}). If point is on a timestamp, it compiles the agenda for 4219 that date. Furthermore, it visits text and remote files in @samp{file} 4220 links with Emacs and select a suitable application for local 4221 non-text files. Classification of files is based on file extension 4222 only. See option @code{org-file-apps}. If you want to override the 4223 default application and visit the file with Emacs, use 4224 a @kbd{C-u} prefix. If you want to avoid opening in Emacs, use 4225 a @kbd{C-u C-u} prefix. 4226 4227 @vindex org-link-frame-setup 4228 If point is on a headline, but not on a link, offer all links in the 4229 headline and entry text. If you want to setup the frame 4230 configuration for following links, customize @code{org-link-frame-setup}. 4231 4232 @item @kbd{@key{RET}} 4233 @vindex org-return-follows-link 4234 @kindex RET 4235 When @code{org-return-follows-link} is set, @kbd{@key{RET}} also follows 4236 the link at point. 4237 4238 @item @kbd{mouse-2} or @kbd{mouse-1} 4239 @kindex mouse-2 4240 @kindex mouse-1 4241 On links, @kbd{mouse-1} and @kbd{mouse-2} opens the link 4242 just as @kbd{C-c C-o} does. 4243 4244 @item @kbd{mouse-3} 4245 @vindex org-link-use-indirect-buffer-for-internals 4246 @kindex mouse-3 4247 Like @kbd{mouse-2}, but force file links to be opened with 4248 Emacs, and internal links to be displayed in another window@footnote{ See 4249 the variable @code{org-link-use-indirect-buffer-for-internals}.}. 4250 4251 @item @kbd{C-c %} (@code{org-mark-ring-push}) 4252 @kindex C-c % 4253 @findex org-mark-ring-push 4254 @cindex mark ring 4255 Push the current position onto the Org mark ring, to be able to 4256 return easily. Commands following an internal link do this 4257 automatically. 4258 4259 @item @kbd{C-c &} (@code{org-mark-ring-goto}) 4260 @kindex C-c & 4261 @findex org-mark-ring-goto 4262 @cindex links, returning to 4263 Jump back to a recorded position. A position is recorded by the 4264 commands following internal links, and by @kbd{C-c %}. Using 4265 this command several times in direct succession moves through a ring 4266 of previously recorded positions. 4267 4268 @item @kbd{C-c C-x C-n} (@code{org-next-link}) 4269 @itemx @kbd{C-c C-x C-p} (@code{org-previous-link}) 4270 @kindex C-c C-x C-p 4271 @findex org-previous-link 4272 @kindex C-c C-x C-n 4273 @findex org-next-link 4274 @cindex links, finding next/previous 4275 Move forward/backward to the next link in the buffer. At the limit 4276 of the buffer, the search fails once, and then wraps around. The 4277 key bindings for this are really too long; you might want to bind 4278 this also to @kbd{M-n} and @kbd{M-p}. 4279 4280 @lisp 4281 (with-eval-after-load 'org 4282 (define-key org-mode-map (kbd "M-n") #'org-next-link) 4283 (define-key org-mode-map (kbd "M-p") #'org-previous-link)) 4284 @end lisp 4285 @end table 4286 4287 @node Using Links Outside Org 4288 @section Using Links Outside Org 4289 4290 @findex org-insert-link-global 4291 @findex org-open-at-point-global 4292 You can insert and follow links that have Org syntax not only in Org, 4293 but in any Emacs buffer. For this, Org provides two functions: 4294 @code{org-insert-link-global} and @code{org-open-at-point-global}. 4295 4296 You might want to bind them to globally available keys. See 4297 @ref{Activation} for some advice. 4298 4299 @node Link Abbreviations 4300 @section Link Abbreviations 4301 4302 @cindex link abbreviations 4303 @cindex abbreviation, links 4304 4305 Long URL can be cumbersome to type, and often many similar links are 4306 needed in a document. For this you can use link abbreviations. An 4307 abbreviated link looks like this 4308 4309 @example 4310 [[linkword:tag][description]] 4311 @end example 4312 4313 4314 @noindent 4315 @vindex org-link-abbrev-alist 4316 where the tag is optional. The @emph{linkword} must be a word, starting 4317 with a letter, followed by letters, numbers, @samp{-}, and @samp{_}. 4318 Abbreviations are resolved according to the information in the 4319 variable @code{org-link-abbrev-alist} that relates the linkwords to 4320 replacement text. Here is an example: 4321 4322 @lisp 4323 (setq org-link-abbrev-alist 4324 '(("bugzilla" . "https://10.1.2.9/bugzilla/show_bug.cgi?id=") 4325 ("Nu Html Checker" . "https://validator.w3.org/nu/?doc=%h") 4326 ("duckduckgo" . "https://duckduckgo.com/?q=%s") 4327 ("omap" . "https://nominatim.openstreetmap.org/search?q=%s&polygon=1") 4328 ("ads" . "https://ui.adsabs.harvard.edu/search/q=%20author%3A\"%s\""))) 4329 @end lisp 4330 4331 If the replacement text contains the string @samp{%s}, it is replaced with 4332 the tag. Using @samp{%h} instead of @samp{%s} percent-encodes the tag (see the 4333 example above, where we need to encode the URL parameter). Using 4334 @samp{%(my-function)} passes the tag to a custom Lisp function, and replace 4335 it by the resulting string. 4336 4337 If the replacement text do not contain any specifier, it is simply 4338 appended to the string in order to create the link. 4339 4340 Instead of a string, you may also specify a Lisp function to create 4341 the link. Such a function will be called with the tag as the only 4342 argument. 4343 4344 With the above setting, you could link to a specific bug with 4345 @samp{[[bugzilla:129]]}, search the web for @samp{OrgMode} with @samp{[[duckduckgo:OrgMode]]}, 4346 show the map location of the Free Software Foundation @samp{[[omap:31 4347 Milk Street, Boston]]} or of Carsten's office @samp{[[omap:Science Park 904, 4348 Amsterdam, The Netherlands]]} and find out what the Org author is doing 4349 besides Emacs hacking with @samp{[[ads:Dominik,C]]}. 4350 4351 If you need special abbreviations just for a single Org buffer, you 4352 can define them in the file with 4353 4354 @cindex @samp{LINK}, keyword 4355 @example 4356 #+LINK: bugzilla https://10.1.2.9/bugzilla/show_bug.cgi?id= 4357 #+LINK: duckduckgo https://duckduckgo.com/?q=%s 4358 #+LINK: "Nu Html Checker" https://validator.w3.org/nu/?doc=%h 4359 @end example 4360 4361 The abbreviations containing spaces must be quoted. 4362 4363 In-buffer completion (see @ref{Completion}) can be used after @samp{[} to 4364 complete link abbreviations. You may also define a Lisp function that 4365 implements special (e.g., completion) support for inserting such a 4366 link with @kbd{C-c C-l}. Such a function should not accept any 4367 arguments, and should return the full link with a prefix. You can set 4368 the link completion function like this: 4369 4370 @lisp 4371 (org-link-set-parameter "type" :complete #'some-completion-function) 4372 @end lisp 4373 4374 @node Search Options 4375 @section Search Options in File Links 4376 4377 @cindex search option in file links 4378 @cindex search option in id links 4379 @cindex file links, searching 4380 @cindex id links, searching 4381 @cindex attachment links, searching 4382 4383 File links can contain additional information to make Emacs jump to a 4384 particular location in the file when following a link. This can be a 4385 line number or a search option after a double colon@footnote{ For backward 4386 compatibility, line numbers can also follow a single colon.}. For 4387 example, when the command @code{org-store-link} creates a link (see 4388 @ref{Handling Links}) to a file, it encodes the words in the current 4389 line as a search string that can be used to find this line back later 4390 when following the link with @kbd{C-c C-o}. 4391 4392 Note that all search options apply for Attachment and ID links in the 4393 same way that they apply for File links. 4394 4395 Here is the syntax of the different ways to attach a search to a file 4396 link, together with explanations for each: 4397 4398 @example 4399 [[file:~/code/main.c::255]] 4400 [[file:~/xx.org::My Target]] 4401 [[file:~/xx.org::*My Target]] 4402 [[file:~/xx.org::#my-custom-id]] 4403 [[file:~/xx.org::/regexp/]] 4404 [[attachment:main.c::255]] 4405 @end example 4406 4407 @table @asis 4408 @item @samp{255} 4409 Jump to line 255. 4410 4411 @item @samp{My Target} 4412 Search for a link target @samp{<<My Target>>}, or do a text search for 4413 @samp{my target}, similar to the search in internal links, see @ref{Internal Links}. In HTML export (see @ref{HTML Export}), such a file link becomes 4414 a HTML reference to the corresponding named anchor in the linked 4415 file. 4416 4417 @item @samp{*My Target} 4418 In an Org file, restrict search to headlines. 4419 4420 @item @samp{#my-custom-id} 4421 Link to a heading with a @samp{CUSTOM_ID} property 4422 4423 @item @samp{/REGEXP/} 4424 Do a regular expression search for @var{REGEXP} (see @ref{Regular Expressions}). This uses the Emacs command @code{occur} to list all 4425 matches in a separate window. If the target file is in Org mode, 4426 @code{org-occur} is used to create a sparse tree with the matches. 4427 @end table 4428 4429 As a degenerate case, a file link with an empty file name can be used 4430 to search the current file. For example, @samp{[[file:::find me]]} does 4431 a search for @samp{find me} in the current file, just as @samp{[[find me]]} 4432 would. 4433 4434 @node Custom Searches 4435 @section Custom Searches 4436 4437 @cindex custom search strings 4438 @cindex search strings, custom 4439 4440 The default mechanism for creating search strings and for doing the 4441 actual search related to a file link may not work correctly in all 4442 cases. For example, Bib@TeX{} database files have many entries like 4443 @code{year="1993"} which would not result in good search strings, because 4444 the only unique identification for a Bib@TeX{} entry is the citation key. 4445 4446 @vindex org-create-file-search-functions 4447 @vindex org-execute-file-search-functions 4448 If you come across such a problem, you can write custom functions to 4449 set the right search string for a particular file type, and to do the 4450 search for the string in the file. Using @code{add-hook}, these functions 4451 need to be added to the hook variables 4452 @code{org-create-file-search-functions} and 4453 @code{org-execute-file-search-functions}. See the docstring for these 4454 variables for more information. Org actually uses this mechanism for 4455 Bib@TeX{} database files, and you can use the corresponding code as an 4456 implementation example. See the file @samp{ol-bibtex.el}. 4457 4458 @node TODO Items 4459 @chapter TODO Items 4460 4461 @cindex TODO items 4462 4463 Org mode does not maintain TODO lists as separate documents@footnote{ Of 4464 course, you can make a document that contains only long lists of TODO 4465 items, but this is not required.}. Instead, TODO items are an 4466 integral part of the notes file, because TODO items usually come up 4467 while taking notes! With Org mode, simply mark any entry in a tree as 4468 being a TODO item. In this way, information is not duplicated, and 4469 the entire context from which the TODO item emerged is always present. 4470 4471 Of course, this technique for managing TODO items scatters them 4472 throughout your notes file. Org mode compensates for this by 4473 providing methods to give you an overview of all the things that you 4474 have to do. 4475 4476 @menu 4477 * TODO Basics:: Marking and displaying TODO entries. 4478 * TODO Extensions:: Workflow and assignments. 4479 * Progress Logging:: Dates and notes for progress. 4480 * Priorities:: Some things are more important than others. 4481 * Breaking Down Tasks:: Splitting a task into manageable pieces. 4482 * Checkboxes:: Tick-off lists. 4483 @end menu 4484 4485 @node TODO Basics 4486 @section Basic TODO Functionality 4487 4488 Any headline becomes a TODO item when it starts with the word @samp{TODO}, 4489 for example: 4490 4491 @example 4492 *** TODO Write letter to Sam Fortune 4493 @end example 4494 4495 4496 The most important commands to work with TODO entries are: 4497 4498 @table @asis 4499 @item @kbd{C-c C-t} (@code{org-todo}) 4500 @kindex C-c C-t 4501 @cindex cycling, of TODO states 4502 Rotate the TODO state of the current item among 4503 4504 @example 4505 ,-> (unmarked) -> TODO -> DONE --. 4506 '--------------------------------' 4507 @end example 4508 4509 If TODO keywords have fast access keys (see @ref{Fast access to TODO states}), prompt for a TODO keyword through the fast selection 4510 interface; this is the default behavior when 4511 @code{org-use-fast-todo-selection} is non-@code{nil}. 4512 4513 The same state changing can also be done ``remotely'' from the agenda 4514 buffer with the @kbd{t} command key (see @ref{Agenda Commands}). 4515 4516 @item @kbd{S-@key{RIGHT}} @kbd{S-@key{LEFT}} 4517 @kindex S-RIGHT 4518 @kindex S-LEFT 4519 @vindex org-treat-S-cursor-todo-selection-as-state-change 4520 Select the following/preceding TODO state, similar to cycling. 4521 Useful mostly if more than two TODO states are possible (see 4522 @ref{TODO Extensions}). See also @ref{Conflicts}, for a discussion of the interaction with 4523 shift-selection. See also the variable 4524 @code{org-treat-S-cursor-todo-selection-as-state-change}. 4525 4526 @item @kbd{C-c / t} (@code{org-show-todo-tree}) 4527 @kindex C-c / t 4528 @cindex sparse tree, for TODO 4529 @vindex org-todo-keywords 4530 @findex org-show-todo-tree 4531 View TODO items in a @emph{sparse tree} (see @ref{Sparse Trees}). Folds the 4532 entire buffer, but shows all TODO items---with not-DONE state---and 4533 the headings hierarchy above them. With a prefix argument, or by 4534 using @kbd{C-c / T}, search for a specific TODO@. You are 4535 prompted for the keyword, and you can also give a list of keywords 4536 like @samp{KWD1|KWD2|...} to list entries that match any one of these 4537 keywords. With a numeric prefix argument N, show the tree for the 4538 Nth keyword in the variable @code{org-todo-keywords}. With two prefix 4539 arguments, find all TODO states, both un-done and done. 4540 4541 @item @kbd{M-x org-agenda t} (@code{org-todo-list}) 4542 @kindex t @r{(Agenda dispatcher)} 4543 Show the global TODO list. Collects the TODO items (with not-DONE 4544 states) from all agenda files (see @ref{Agenda Views}) into a single 4545 buffer. The new buffer is in Org Agenda mode, which provides 4546 commands to examine and manipulate the TODO entries from the new 4547 buffer (see @ref{Agenda Commands}). See @ref{Global TODO list}, for more information. 4548 4549 @item @kbd{S-M-@key{RET}} (@code{org-insert-todo-heading}) 4550 @kindex S-M-RET 4551 @findex org-insert-todo-heading 4552 Insert a new TODO entry below the current one. 4553 @end table 4554 4555 @vindex org-todo-state-tags-triggers 4556 Changing a TODO state can also trigger tag changes. See the docstring 4557 of the option @code{org-todo-state-tags-triggers} for details. 4558 4559 @node TODO Extensions 4560 @section Extended Use of TODO Keywords 4561 4562 @cindex extended TODO keywords 4563 4564 @vindex org-todo-keywords 4565 By default, marked TODO entries have one of only two states: TODO and 4566 DONE@. Org mode allows you to classify TODO items in more complex ways 4567 with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With special 4568 setup, the TODO keyword system can work differently in different 4569 files. 4570 4571 Note that @emph{tags} are another way to classify headlines in general and 4572 TODO items in particular (see @ref{Tags}). 4573 4574 @menu 4575 * Workflow states:: From TODO to DONE in steps. 4576 * TODO types:: I do this, Fred does the rest. 4577 * Multiple sets in one file:: Mixing it all, still finding your way. 4578 * Fast access to TODO states:: Single letter selection of state. 4579 * Per-file keywords:: Different files, different requirements. 4580 * Faces for TODO keywords:: Highlighting states. 4581 * TODO dependencies:: When one task needs to wait for others. 4582 @end menu 4583 4584 @node Workflow states 4585 @subsection TODO keywords as workflow states 4586 4587 @cindex TODO workflow 4588 @cindex workflow states as TODO keywords 4589 4590 You can use TODO keywords to indicate different, possibly @emph{sequential} 4591 states in the process of working on an item, for example@footnote{ Changing 4592 the variable @code{org-todo-keywords} only becomes effective after 4593 restarting Org mode in a buffer.}: 4594 4595 @lisp 4596 (setq org-todo-keywords 4597 '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED"))) 4598 @end lisp 4599 4600 The vertical bar separates the TODO keywords (states that @emph{need 4601 action}) from the DONE states (which need @emph{no further action}). If 4602 you do not provide the separator bar, the last state is used as the 4603 DONE state. 4604 4605 @cindex completion, of TODO keywords 4606 With this setup, the command @kbd{C-c C-t} cycles an entry from 4607 @samp{TODO} to @samp{FEEDBACK}, then to @samp{VERIFY}, and finally to @samp{DONE} and 4608 @samp{DELEGATED}. You may also use a numeric prefix argument to quickly 4609 select a specific state. For example @kbd{C-3 C-c C-t} changes 4610 the state immediately to @samp{VERIFY}. Or you can use @kbd{S-@key{RIGHT}} 4611 and @kbd{S-@key{LEFT}} to go forward and backward through the states. 4612 If you define many keywords, you can use in-buffer completion (see 4613 @ref{Completion}) or a special one-key selection scheme (see @ref{Fast access to TODO states}) to insert these words into the buffer. 4614 Changing a TODO state can be logged with a timestamp, see @ref{Tracking TODO state changes}, for more information. 4615 4616 @node TODO types 4617 @subsection TODO keywords as types 4618 4619 @cindex TODO types 4620 @cindex names as TODO keywords 4621 @cindex types as TODO keywords 4622 4623 The second possibility is to use TODO keywords to indicate different 4624 @emph{types} of action items. For example, you might want to indicate that 4625 items are for ``work'' or ``home''. Or, when you work with several people 4626 on a single project, you might want to assign action items directly to 4627 persons, by using their names as TODO keywords. This type of 4628 functionality is actually much better served by using tags (see 4629 @ref{Tags}), so the TODO implementation is kept just for backward 4630 compatibility. 4631 4632 Using TODO types, it would be set up like this: 4633 4634 @lisp 4635 (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE"))) 4636 @end lisp 4637 4638 In this case, different keywords do not indicate states, but rather 4639 different types. So the normal work flow would be to assign a task to 4640 a person, and later to mark it DONE@. Org mode supports this style by 4641 adapting the workings of the command @kbd{C-c C-t}@footnote{ This is 4642 also true for the @kbd{t} command in the agenda buffer.}. When 4643 used several times in succession, it still cycles through all names, 4644 in order to first select the right type for a task. But when you 4645 return to the item after some time and execute @kbd{C-c C-t} 4646 again, it will switch from any name directly to @samp{DONE}. Use prefix 4647 arguments or completion to quickly select a specific name. You can 4648 also review the items of a specific TODO type in a sparse tree by 4649 using a numeric prefix to @kbd{C-c / t}. For example, to see all 4650 things Lucy has to do, you would use @kbd{C-3 C-c / t}. To 4651 collect Lucy's items from all agenda files into a single buffer, you 4652 would use the numeric prefix argument as well when creating the global 4653 TODO list: @kbd{C-3 M-x org-agenda t}. 4654 4655 @node Multiple sets in one file 4656 @subsection Multiple keyword sets in one file 4657 4658 @cindex TODO keyword sets 4659 4660 Sometimes you may want to use different sets of TODO keywords in 4661 parallel. For example, you may want to have the basic TODO/DONE, but 4662 also a workflow for bug fixing, and a separate state indicating that 4663 an item has been canceled---so it is not DONE, but also does not 4664 require action. Your setup would then look like this: 4665 4666 @lisp 4667 (setq org-todo-keywords 4668 '((sequence "TODO" "|" "DONE") 4669 (sequence "REPORT" "BUG" "KNOWNCAUSE" "|" "FIXED") 4670 (sequence "|" "CANCELED"))) 4671 @end lisp 4672 4673 The keywords should all be different, this helps Org mode keep track 4674 of which subsequence should be used for a given entry. In this setup, 4675 @kbd{C-c C-t} only operates within a sub-sequence, so it switches 4676 from @samp{DONE} to (nothing) to @samp{TODO}, and from @samp{FIXED} to (nothing) to 4677 @samp{REPORT}. Therefore you need a mechanism to initially select the 4678 correct sequence. In addition to typing a keyword or using completion 4679 (see @ref{Completion}), you may also apply the following commands: 4680 4681 @table @asis 4682 @item @kbd{C-u C-u C-c C-t} 4683 @itemx @kbd{C-S-@key{RIGHT}} 4684 @itemx @kbd{C-S-@key{LEFT}} 4685 @kindex C-S-RIGHT 4686 @kindex C-S-LEFT 4687 @kindex C-u C-u C-c C-t 4688 These keys jump from one TODO sub-sequence to the next. In the 4689 above example, @kbd{C-u C-u C-c C-t} or @kbd{C-S-@key{RIGHT}} 4690 would jump from @samp{TODO} or @samp{DONE} to @samp{REPORT}, and any of the words 4691 in the second row to @samp{CANCELED}. Note that the @kbd{C-S-} key 4692 binding conflict with shift-selection (see @ref{Conflicts}). 4693 4694 @item @kbd{S-@key{RIGHT}} 4695 @itemx @kbd{S-@key{LEFT}} 4696 @kindex S-RIGHT 4697 @kindex S-LEFT 4698 @kbd{S-@key{LEFT}} and @kbd{S-@key{RIGHT}} walk through @emph{all} keywords 4699 from all sub-sequences, so for example @kbd{S-@key{RIGHT}} would 4700 switch from @samp{DONE} to @samp{REPORT} in the example above. For 4701 a discussion of the interaction with shift-selection, see @ref{Conflicts}. 4702 @end table 4703 4704 @node Fast access to TODO states 4705 @subsection Fast access to TODO states 4706 4707 If you would like to quickly change an entry to an arbitrary TODO 4708 state instead of cycling through the states, you can set up keys for 4709 single-letter access to the states. This is done by adding the 4710 selection character after each keyword, in parentheses@footnote{ All 4711 characters are allowed except @samp{@@}, @samp{^} and @samp{!}, which have a special 4712 meaning here.}. For example: 4713 4714 @lisp 4715 (setq org-todo-keywords 4716 '((sequence "TODO(t)" "|" "DONE(d)") 4717 (sequence "REPORT(r)" "BUG(b)" "KNOWNCAUSE(k)" "|" "FIXED(f)") 4718 (sequence "|" "CANCELED(c)"))) 4719 @end lisp 4720 4721 If you then press @kbd{C-c C-t} followed by the selection key, 4722 the entry is switched to this state. @kbd{@key{SPC}} can be used to 4723 remove any TODO keyword from an entry. 4724 4725 @node Per-file keywords 4726 @subsection Setting up keywords for individual files 4727 4728 @cindex keyword options 4729 @cindex per-file keywords 4730 @cindex @samp{TODO}, keyword 4731 @cindex @samp{TYP_TODO}, keyword 4732 @cindex @samp{SEQ_TODO}, keyword 4733 4734 It can be very useful to use different aspects of the TODO mechanism 4735 in different files. For file-local settings, you need to add special 4736 lines to the file which set the keywords and interpretation for that 4737 file only. For example, to set one of the two examples discussed 4738 above, you need one of the following lines, starting in column zero 4739 anywhere in the file: 4740 4741 @example 4742 #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED 4743 @end example 4744 4745 4746 You may also write @samp{#+SEQ_TODO} to be explicit about the 4747 interpretation, but it means the same as @samp{#+TODO}, or 4748 4749 @example 4750 #+TYP_TODO: Fred Sara Lucy Mike | DONE 4751 @end example 4752 4753 4754 A setup for using several sets in parallel would be: 4755 4756 @example 4757 #+TODO: TODO(t) | DONE(d) 4758 #+TODO: REPORT(r) BUG(b) KNOWNCAUSE(k) | FIXED(f) 4759 #+TODO: | CANCELED(c) 4760 @end example 4761 4762 @cindex completion, of option keywords 4763 @kindex M-TAB 4764 To make sure you are using the correct keyword, type @samp{#+} into the 4765 buffer and then use @kbd{M-@key{TAB}} to complete it (see @ref{Completion}). 4766 4767 @cindex DONE, final TODO keyword 4768 Remember that the keywords after the vertical bar---or the last 4769 keyword if no bar is there---must always mean that the item is DONE, 4770 although you may use a different word. After changing one of these 4771 lines, use @kbd{C-c C-c} with point still in the line to make the 4772 changes known to Org mode@footnote{ Org mode parses these lines only when 4773 Org mode is activated after visiting a file. @kbd{C-c C-c} with 4774 point in a line starting with @samp{#+} is simply restarting Org mode for 4775 the current buffer.}. 4776 4777 @node Faces for TODO keywords 4778 @subsection Faces for TODO keywords 4779 4780 @cindex faces, for TODO keywords 4781 4782 @vindex org-todo, face 4783 @vindex org-done, face 4784 @vindex org-todo-keyword-faces 4785 Org mode highlights TODO keywords with special faces: @code{org-todo} for 4786 keywords indicating that an item still has to be acted upon, and 4787 @code{org-done} for keywords indicating that an item is finished. If you 4788 are using more than two different states, you might want to use 4789 special faces for some of them. This can be done using the variable 4790 @code{org-todo-keyword-faces}. For example: 4791 4792 @lisp 4793 (setq org-todo-keyword-faces 4794 '(("TODO" . org-warning) ("STARTED" . "yellow") 4795 ("CANCELED" . (:foreground "blue" :weight bold)))) 4796 @end lisp 4797 4798 @vindex org-faces-easy-properties 4799 While using a list with face properties as shown for @samp{CANCELED} 4800 @emph{should} work, this does not always seem to be the case. If 4801 necessary, define a special face and use that. A string is 4802 interpreted as a color. The variable @code{org-faces-easy-properties} 4803 determines if that color is interpreted as a foreground or 4804 a background color. 4805 4806 @node TODO dependencies 4807 @subsection TODO dependencies 4808 4809 @cindex TODO dependencies 4810 @cindex dependencies, of TODO states 4811 4812 @vindex org-enforce-todo-dependencies 4813 @cindex @samp{ORDERED}, property 4814 The structure of Org files---hierarchy and lists---makes it easy to 4815 define TODO dependencies. Usually, a parent TODO task should not be 4816 marked as done until all TODO subtasks, or children tasks, are marked 4817 as done. Sometimes there is a logical sequence to (sub)tasks, so that 4818 one subtask cannot be acted upon before all siblings above it have 4819 been marked as done. If you customize the variable 4820 @code{org-enforce-todo-dependencies}, Org blocks entries from changing 4821 state to DONE while they have TODO children that are not DONE@. 4822 Furthermore, if an entry has a property @samp{ORDERED}, each of its TODO 4823 children is blocked until all earlier siblings are marked as done. 4824 Here is an example: 4825 4826 @example 4827 * TODO Blocked until (two) is done 4828 ** DONE one 4829 ** TODO two 4830 4831 * Parent 4832 :PROPERTIES: 4833 :ORDERED: t 4834 :END: 4835 ** TODO a 4836 ** TODO b, needs to wait for (a) 4837 ** TODO c, needs to wait for (a) and (b) 4838 @end example 4839 4840 @cindex TODO dependencies, @samp{NOBLOCKING} 4841 @cindex @samp{NOBLOCKING}, property 4842 You can ensure an entry is never blocked by using the @samp{NOBLOCKING} 4843 property (see @ref{Properties and Columns}): 4844 4845 @example 4846 * This entry is never blocked 4847 :PROPERTIES: 4848 :NOBLOCKING: t 4849 :END: 4850 @end example 4851 4852 @table @asis 4853 @item @kbd{C-c C-x o} (@code{org-toggle-ordered-property}) 4854 @kindex C-c C-x o 4855 @findex org-toggle-ordered-property 4856 @vindex org-track-ordered-property-with-tag 4857 Toggle the @samp{ORDERED} property of the current entry. A property is 4858 used for this behavior because this should be local to the current 4859 entry, not inherited from entries above like a tag (see @ref{Tags}). 4860 However, if you would like to @emph{track} the value of this property 4861 with a tag for better visibility, customize the variable 4862 @code{org-track-ordered-property-with-tag}. 4863 4864 @item @kbd{C-u C-u C-u C-c C-t} 4865 @kindex C-u C-u C-u C-u C-c C-t 4866 Change TODO state, regardless of any state blocking. 4867 @end table 4868 4869 @vindex org-agenda-dim-blocked-tasks 4870 If you set the variable @code{org-agenda-dim-blocked-tasks}, TODO entries 4871 that cannot be marked as done because of unmarked children are shown 4872 in a dimmed font or even made invisible in agenda views (see @ref{Agenda Views}). 4873 4874 @cindex checkboxes and TODO dependencies 4875 @vindex org-enforce-todo-dependencies 4876 You can also block changes of TODO states by using checkboxes (see 4877 @ref{Checkboxes}). If you set the variable 4878 @code{org-enforce-todo-checkbox-dependencies}, an entry that has unchecked 4879 checkboxes is blocked from switching to DONE@. 4880 4881 If you need more complex dependency structures, for example 4882 dependencies between entries in different trees or files, check out 4883 the module @samp{org-depend.el} in the @samp{org-contrib} repository. 4884 4885 @node Progress Logging 4886 @section Progress Logging 4887 4888 @cindex progress logging 4889 @cindex logging, of progress 4890 4891 To record a timestamp and a note when changing a TODO state, call the 4892 command @code{org-todo} with a prefix argument. 4893 4894 @table @asis 4895 @item @kbd{C-u C-c C-t} (@code{org-todo}) 4896 @kindex C-u C-c C-t 4897 Prompt for a note and record a the time of the TODO state change. 4898 The note is inserted as a list item below the headline, but can also 4899 be placed into a drawer, see @ref{Tracking TODO state changes}. 4900 @end table 4901 4902 If you want to be more systematic, Org mode can automatically record a 4903 timestamp and optionally a note when you mark a TODO item as DONE, or 4904 even each time you change the state of a TODO item. This system is 4905 highly configurable, settings can be on a per-keyword basis and can be 4906 localized to a file or even a subtree. For information on how to 4907 clock working time for a task, see @ref{Clocking Work Time}. 4908 4909 @menu 4910 * Closing items:: When was this entry marked as done? 4911 * Tracking TODO state changes:: When did the status change? 4912 * Tracking your habits:: How consistent have you been? 4913 @end menu 4914 4915 @node Closing items 4916 @subsection Closing items 4917 4918 The most basic automatic logging is to keep track of @emph{when} a certain 4919 TODO item was marked as done. This can be achieved with@footnote{ The 4920 corresponding in-buffer setting is: @samp{#+STARTUP: logdone}.} 4921 4922 @lisp 4923 (setq org-log-done 'time) 4924 @end lisp 4925 4926 @vindex org-closed-keep-when-no-todo 4927 @noindent 4928 Then each time you turn an entry from a TODO (not-done) state into any 4929 of the DONE states, a line @samp{CLOSED: [timestamp]} is inserted just 4930 after the headline. If you turn the entry back into a TODO item 4931 through further state cycling, that line is removed again. If you 4932 turn the entry back to a non-TODO state (by pressing @kbd{C-c C-t @key{SPC}} for example), that line is also removed, unless you set 4933 @code{org-closed-keep-when-no-todo} to non-@code{nil}. If you want to record a 4934 note along with the timestamp, use@footnote{ The corresponding in-buffer 4935 setting is: @samp{#+STARTUP: lognotedone}.} 4936 4937 @lisp 4938 (setq org-log-done 'note) 4939 @end lisp 4940 4941 @noindent 4942 You are then prompted for a note, and that note is stored below the 4943 entry with a @samp{Closing Note} heading. 4944 4945 @node Tracking TODO state changes 4946 @subsection Tracking TODO state changes 4947 4948 @cindex drawer, for state change recording 4949 4950 @vindex org-log-states-order-reversed 4951 @vindex org-log-into-drawer 4952 @cindex @samp{LOG_INTO_DRAWER}, property 4953 You might want to automatically keep track of when a state change 4954 occurred and maybe take a note about this change. You can either 4955 record just a timestamp, or a time-stamped note. These records are 4956 inserted after the headline as an itemized list, newest first@footnote{ See 4957 the variable @code{org-log-states-order-reversed}.}. When taking a lot of 4958 notes, you might want to get the notes out of the way into a drawer 4959 (see @ref{Drawers}). Customize the variable @code{org-log-into-drawer} to 4960 get this behavior---the recommended drawer for this is called 4961 @samp{LOGBOOK}@footnote{ Note that the @samp{LOGBOOK} drawer is unfolded when 4962 pressing @kbd{@key{SPC}} in the agenda to show an entry---use 4963 @kbd{C-u @key{SPC}} to keep it folded here.}. You can also overrule 4964 the setting of this variable for a subtree by setting a 4965 @samp{LOG_INTO_DRAWER} property. 4966 4967 Since it is normally too much to record a note for every state, Org 4968 mode expects configuration on a per-keyword basis for this. This is 4969 achieved by adding special markers @samp{!} (for a timestamp) or @samp{@@} (for 4970 a note with timestamp) in parentheses after each keyword. For 4971 example, with the setting 4972 4973 @lisp 4974 (setq org-todo-keywords 4975 '((sequence "TODO(t)" "WAIT(w@@/!)" "|" "DONE(d!)" "CANCELED(c@@)"))) 4976 @end lisp 4977 4978 @vindex org-log-done 4979 You not only define global TODO keywords and fast access keys, but 4980 also request that a time is recorded when the entry is set to @samp{DONE}, 4981 and that a note is recorded when switching to @samp{WAIT} or 4982 @samp{CANCELED}@footnote{It is possible that Org mode records two timestamps when you 4983 are using both @code{org-log-done} and state change logging. However, it 4984 never prompts for two notes: if you have configured both, the state 4985 change recording note takes precedence and cancel the closing note.}. The setting for @samp{WAIT} is even more special: the 4986 @samp{!} after the slash means that in addition to the note taken when 4987 entering the state, a timestamp should be recorded when @emph{leaving} the 4988 @samp{WAIT} state, if and only if the @emph{target} state does not configure 4989 logging for entering it. So it has no effect when switching from 4990 @samp{WAIT} to @samp{DONE}, because @samp{DONE} is configured to record a timestamp 4991 only. But when switching from @samp{WAIT} back to @samp{TODO}, the @samp{/!} in the 4992 @samp{WAIT} setting now triggers a timestamp even though @samp{TODO} has no 4993 logging configured. 4994 4995 You can use the exact same syntax for setting logging preferences local 4996 to a buffer: 4997 4998 @example 4999 #+TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@) 5000 @end example 5001 5002 5003 To record a timestamp without a note for TODO keywords configured with 5004 @samp{@@}, just type @kbd{C-c C-c} to enter a blank note when prompted. 5005 5006 @cindex @samp{LOGGING}, property 5007 In order to define logging settings that are local to a subtree or 5008 a single item, define a @samp{LOGGING} property in this entry. Any 5009 non-empty @samp{LOGGING} property resets all logging settings to @code{nil}. 5010 You may then turn on logging for this specific tree using @samp{STARTUP} 5011 keywords like @samp{lognotedone} or @samp{logrepeat}, as well as adding state 5012 specific settings like @samp{TODO(!)}. For example: 5013 5014 @example 5015 * TODO Log each state with only a time 5016 :PROPERTIES: 5017 :LOGGING: TODO(!) WAIT(!) DONE(!) CANCELED(!) 5018 :END: 5019 * TODO Only log when switching to WAIT, and when repeating 5020 :PROPERTIES: 5021 :LOGGING: WAIT(@@) logrepeat 5022 :END: 5023 * TODO No logging at all 5024 :PROPERTIES: 5025 :LOGGING: nil 5026 :END: 5027 @end example 5028 5029 @node Tracking your habits 5030 @subsection Tracking your habits 5031 5032 @cindex habits 5033 @cindex @samp{STYLE}, property 5034 5035 Org has the ability to track the consistency of a special category of 5036 TODO, called ``habits.'' To use habits, you have to enable the @code{habit} 5037 module by customizing the variable @code{org-modules}. 5038 5039 A habit has the following properties: 5040 5041 @enumerate 5042 @item 5043 The habit is a TODO item, with a TODO keyword representing an open 5044 state. 5045 5046 @item 5047 The property @samp{STYLE} is set to the value @samp{habit} (see @ref{Properties and Columns}). 5048 5049 @item 5050 The TODO has a scheduled date, usually with a @samp{.+} style repeat 5051 interval. A @samp{++} style may be appropriate for habits with time 5052 constraints, e.g., must be done on specific days of week (@samp{++1w}), 5053 or a @samp{+} style for an unusual habit that can have a backlog, e.g., 5054 weekly reports. See @ref{Repeated tasks} for more details about repeat 5055 intervals. 5056 5057 @item 5058 The TODO may also have minimum and maximum ranges specified by 5059 using the syntax @samp{.+2d/3d}, which says that you want to do the task 5060 at least every three days, but at most every two days. 5061 5062 @item 5063 State logging for the DONE state is enabled (see @ref{Tracking TODO state changes}), in order for historical data to be represented in 5064 the consistency graph. If it is not enabled it is not an error, 5065 but the consistency graphs are largely meaningless. 5066 @end enumerate 5067 5068 To give you an idea of what the above rules look like in action, here's an 5069 actual habit with some history: 5070 5071 @example 5072 ** TODO Shave 5073 SCHEDULED: <2009-10-17 Sat .+2d/4d> 5074 :PROPERTIES: 5075 :STYLE: habit 5076 :LAST_REPEAT: [2009-10-19 Mon 00:36] 5077 :END: 5078 - State "DONE" from "TODO" [2009-10-15 Thu] 5079 - State "DONE" from "TODO" [2009-10-12 Mon] 5080 - State "DONE" from "TODO" [2009-10-10 Sat] 5081 - State "DONE" from "TODO" [2009-10-04 Sun] 5082 - State "DONE" from "TODO" [2009-10-02 Fri] 5083 - State "DONE" from "TODO" [2009-09-29 Tue] 5084 - State "DONE" from "TODO" [2009-09-25 Fri] 5085 - State "DONE" from "TODO" [2009-09-19 Sat] 5086 - State "DONE" from "TODO" [2009-09-16 Wed] 5087 - State "DONE" from "TODO" [2009-09-12 Sat] 5088 @end example 5089 5090 What this habit says is: I want to shave at most every 2 days---given 5091 by the @samp{SCHEDULED} date and repeat interval---and at least every 5092 4 days. If today is the 15th, then the habit first appears in the 5093 agenda (see @ref{Agenda Views}) on Oct 17, after the minimum of 2 days has 5094 elapsed, and will appear overdue on Oct 19, after four days have 5095 elapsed. 5096 5097 What's really useful about habits is that they are displayed along 5098 with a consistency graph, to show how consistent you've been at 5099 getting that task done in the past. This graph shows every day that 5100 the task was done over the past three weeks, with colors for each day. 5101 The colors used are: 5102 5103 @table @asis 5104 @item Blue 5105 If the task was not to be done yet on that day. 5106 @item Green 5107 If the task could have been done on that day. 5108 @item Yellow 5109 If the task was going to be overdue the next day. 5110 @item Red 5111 If the task was overdue on that day. 5112 @end table 5113 5114 In addition to coloring each day, the day is also marked with an 5115 asterisk if the task was actually done that day, and an exclamation 5116 mark to show where the current day falls in the graph. 5117 5118 There are several configuration variables that can be used to change 5119 the way habits are displayed in the agenda. 5120 5121 @table @asis 5122 @item @code{org-habit-graph-column} 5123 @vindex org-habit-graph-column 5124 The buffer column at which the consistency graph should be drawn. 5125 This overwrites any text in that column, so it is a good idea to 5126 keep your habits' titles brief and to the point. 5127 5128 @item @code{org-habit-preceding-days} 5129 @vindex org-habit-preceding-days 5130 The amount of history, in days before today, to appear in 5131 consistency graphs. 5132 5133 @item @code{org-habit-following-days} 5134 @vindex org-habit-following-days 5135 The number of days after today that appear in consistency graphs. 5136 5137 @item @code{org-habit-show-habits-only-for-today} 5138 @vindex org-habit-show-habits-only-for-today 5139 If non-@code{nil}, only show habits in today's agenda view. The default 5140 value is @code{t}. Pressing @kbd{C-u K} in the agenda toggles this 5141 variable. 5142 @end table 5143 5144 Lastly, pressing @kbd{K} in the agenda buffer causes habits to 5145 temporarily be disabled and do not appear at all. Press @kbd{K} 5146 again to bring them back. They are also subject to tag filtering, if 5147 you have habits which should only be done in certain contexts, for 5148 example. 5149 5150 @node Priorities 5151 @section Priorities 5152 5153 @cindex priorities 5154 @cindex priority cookie 5155 5156 If you use Org mode extensively, you may end up with enough TODO items 5157 that it starts to make sense to prioritize them. Prioritizing can be 5158 done by placing a @emph{priority cookie} into the headline of a TODO item 5159 right after the TODO keyword, like this: 5160 5161 @example 5162 *** TODO [#A] Write letter to Sam Fortune 5163 @end example 5164 5165 5166 @vindex org-priority-faces 5167 By default, Org mode supports three priorities: @samp{A}, @samp{B}, and @samp{C}. 5168 @samp{A} is the highest priority. An entry without a cookie is treated as 5169 equivalent if it had priority @samp{B}. Priorities make a difference only 5170 for sorting in the agenda (see @ref{Weekly/daily agenda}). Outside the 5171 agenda, they have no inherent meaning to Org mode. The cookies are 5172 displayed with the face defined by the variable @code{org-priority-faces}, 5173 which can be customized. 5174 5175 You can also use numeric values for priorities, such as 5176 5177 @example 5178 *** TODO [#1] Write letter to Sam Fortune 5179 @end example 5180 5181 5182 When using numeric priorities, you need to set @code{org-priority-highest}, 5183 @code{org-priority-lowest} and @code{org-priority-default} to integers, which 5184 must all be strictly inferior to 65. 5185 5186 Priorities can be attached to any outline node; they do not need to be 5187 TODO items. 5188 5189 @table @asis 5190 @item @kbd{C-c ,} (@code{org-priority}) 5191 @kindex C-c , 5192 @findex org-priority 5193 Set the priority of the current headline. The command prompts for 5194 a priority character @samp{A}, @samp{B} or @samp{C}. When you press @kbd{@key{SPC}} 5195 instead, the priority cookie, if one is set, is removed from the 5196 headline. The priorities can also be changed ``remotely'' from the 5197 agenda buffer with the @kbd{,} command (see @ref{Agenda Commands}). 5198 5199 @item @kbd{S-@key{UP}} (@code{org-priority-up}) 5200 @itemx @kbd{S-@key{DOWN}} (@code{org-priority-down}) 5201 @kindex S-UP 5202 @kindex S-DOWN 5203 @findex org-priority-up 5204 @findex org-priority-down 5205 @vindex org-priority-start-cycle-with-default 5206 Increase/decrease the priority of the current headline@footnote{ See also 5207 the option @code{org-priority-start-cycle-with-default}.}. Note that 5208 these keys are also used to modify timestamps (see @ref{Creating Timestamps}). See also @ref{Conflicts}, 5209 for a discussion of the interaction with shift-selection. 5210 @end table 5211 5212 @vindex org-priority-highest 5213 @vindex org-priority-lowest 5214 @vindex org-priority-default 5215 You can change the range of allowed priorities by setting the 5216 variables @code{org-priority-highest}, @code{org-priority-lowest}, and 5217 @code{org-priority-default}. For an individual buffer, you may set these 5218 values (highest, lowest, default) like this (please make sure that the 5219 highest priority is earlier in the alphabet than the lowest priority): 5220 5221 @cindex @samp{PRIORITIES}, keyword 5222 @example 5223 #+PRIORITIES: A C B 5224 @end example 5225 5226 5227 Or, using numeric values: 5228 5229 @example 5230 #+PRIORITIES: 1 10 5 5231 @end example 5232 5233 @node Breaking Down Tasks 5234 @section Breaking Down Tasks into Subtasks 5235 5236 @cindex tasks, breaking down 5237 @cindex statistics, for TODO items 5238 5239 @vindex org-agenda-todo-list-sublevels 5240 It is often advisable to break down large tasks into smaller, 5241 manageable subtasks. You can do this by creating an outline tree 5242 below a TODO item, with detailed subtasks on the tree@footnote{ To keep 5243 subtasks out of the global TODO list, see the option 5244 @code{org-agenda-todo-list-sublevels}.}. To keep an overview of the 5245 fraction of subtasks that have already been marked as done, insert 5246 either @samp{[/]} or @samp{[%]} anywhere in the headline. These cookies are 5247 updated each time the TODO status of a child changes, or when pressing 5248 @kbd{C-c C-c} on the cookie. For example: 5249 5250 @example 5251 * Organize Party [33%] 5252 ** TODO Call people [1/2] 5253 *** TODO Peter 5254 *** DONE Sarah 5255 ** TODO Buy food 5256 ** DONE Talk to neighbor 5257 @end example 5258 5259 @cindex @samp{COOKIE_DATA}, property 5260 If a heading has both checkboxes and TODO children below it, the 5261 meaning of the statistics cookie become ambiguous. Set the property 5262 @samp{COOKIE_DATA} to either @samp{checkbox} or @samp{todo} to resolve this issue. 5263 5264 @vindex org-hierarchical-todo-statistics 5265 If you would like to have the statistics cookie count any TODO entries 5266 in the subtree (not just direct children), configure the variable 5267 @code{org-hierarchical-todo-statistics}. To do this for a single subtree, 5268 include the word @samp{recursive} into the value of the @samp{COOKIE_DATA} 5269 property. 5270 5271 @example 5272 * Parent capturing statistics [2/20] 5273 :PROPERTIES: 5274 :COOKIE_DATA: todo recursive 5275 :END: 5276 @end example 5277 5278 If you would like a TODO entry to automatically change to DONE when 5279 all children are done, you can use the following setup: 5280 5281 @lisp 5282 (defun org-summary-todo (n-done n-not-done) 5283 "Switch entry to DONE when all subentries are done, to TODO otherwise." 5284 (let (org-log-done org-todo-log-states) ; turn off logging 5285 (org-todo (if (= n-not-done 0) "DONE" "TODO")))) 5286 5287 (add-hook 'org-after-todo-statistics-hook #'org-summary-todo) 5288 @end lisp 5289 5290 Another possibility is the use of checkboxes to identify (a hierarchy 5291 of) a large number of subtasks (see @ref{Checkboxes}). 5292 5293 @node Checkboxes 5294 @section Checkboxes 5295 5296 @cindex checkboxes 5297 5298 @vindex org-list-automatic-rules 5299 Every item in a plain list@footnote{With the exception of description lists. But you can allow it 5300 by modifying @code{org-list-automatic-rules} accordingly.} (see @ref{Plain Lists}) can be made into 5301 a checkbox by starting it with the string @samp{[ ]}. This feature is 5302 similar to TODO items (see @ref{TODO Items}), but is more lightweight. 5303 Checkboxes are not included into the global TODO list, so they are 5304 often great to split a task into a number of simple steps. Or you can 5305 use them in a shopping list. 5306 5307 Here is an example of a checkbox list. 5308 5309 @example 5310 * TODO Organize party [2/4] 5311 - [-] call people [1/3] 5312 - [ ] Peter 5313 - [X] Sarah 5314 - [ ] Sam 5315 - [X] order food 5316 - [ ] think about what music to play 5317 - [X] talk to the neighbors 5318 @end example 5319 5320 @cindex statistics, for checkboxes 5321 @cindex checkbox statistics 5322 @cindex @samp{COOKIE_DATA}, property 5323 @vindex org-checkbox-hierarchical-statistics 5324 The @samp{[2/4]} and @samp{[1/3]} in the first and second line are cookies 5325 indicating how many checkboxes present in this entry have been checked 5326 off, and the total number of checkboxes present. This can give you an 5327 idea on how many checkboxes remain, even without opening a folded 5328 entry. The cookies can be placed into a headline or into (the first 5329 line of) a plain list item. Each cookie covers checkboxes of direct 5330 children structurally below the headline/item on which the cookie 5331 appears@footnote{ Set the variable @code{org-checkbox-hierarchical-statistics} 5332 if you want such cookies to count all checkboxes below the cookie, not 5333 just those belonging to direct children.}. You have to insert the 5334 cookie yourself by typing either @samp{[/]} or @samp{[%]}. With @samp{[/]} you get 5335 an @samp{n out of m} result, as in the examples above. With @samp{[%]} you get 5336 information about the percentage of checkboxes checked (in the above 5337 example, this would be @samp{[50%]} and @samp{[33%]}, respectively). In a 5338 headline, a cookie can count either checkboxes below the heading or 5339 TODO states of children, and it displays whatever was changed last. 5340 Set the property @samp{COOKIE_DATA} to either @samp{checkbox} or @samp{todo} to 5341 resolve this issue. 5342 5343 @cindex blocking, of checkboxes 5344 @cindex checkbox blocking 5345 @cindex @samp{ORDERED}, property 5346 If the current outline node has an @samp{ORDERED} property, checkboxes must 5347 be checked off in sequence, and an error is thrown if you try to check 5348 off a box while there are unchecked boxes above it. 5349 5350 A checkbox can be in one of the three states: 5351 @enumerate 5352 @item 5353 not checked @samp{[ ]} 5354 @item 5355 partially checked @samp{[-]} 5356 @item 5357 checked @samp{[X]} 5358 @end enumerate 5359 5360 Checkboxes work hierarchically, so if a checkbox item has children 5361 that are checkboxes, toggling one of the children checkboxes makes the 5362 parent checkbox reflect if none, some, or all of the children are 5363 checked. 5364 5365 If all child checkboxes are not checked, the parent checkbox is also not checked. 5366 @example 5367 - [ ] call people 5368 - [ ] Peter 5369 - [ ] Sarah 5370 @end example 5371 5372 If some but not all child checkboxes are checked, the parent checkbox is partially checked. 5373 @example 5374 - [-] call people 5375 - [X] Peter 5376 - [ ] Sarah 5377 @end example 5378 5379 If all child checkboxes are checked, the parent checkbox is also checked. 5380 @example 5381 - [X] call people 5382 - [X] Peter 5383 - [X] Sarah 5384 @end example 5385 5386 The following commands work with checkboxes: 5387 5388 @table @asis 5389 @item @kbd{C-c C-c} (@code{org-toggle-checkbox}) 5390 @kindex C-c C-c 5391 @findex org-toggle-checkbox 5392 Toggle checkbox status or---with prefix argument---checkbox presence 5393 at point. With a single prefix argument, add an empty checkbox or 5394 remove the current one@footnote{ @kbd{C-u C-c C-c} on the @emph{first} 5395 item of a list with no checkbox adds checkboxes to the rest of the 5396 list.}. With a double prefix argument, set it to @samp{[-]}, which is 5397 considered to be an intermediate state. 5398 5399 @item @kbd{C-c C-x C-b} (@code{org-toggle-checkbox}) 5400 @kindex C-c C-x C-b 5401 Toggle checkbox status or---with prefix argument---checkbox presence 5402 at point. With double prefix argument, set it to @samp{[-]}, which is 5403 considered to be an intermediate state. 5404 5405 @itemize 5406 @item 5407 If there is an active region, toggle the first checkbox in the 5408 region and set all remaining boxes to the same status as the 5409 first. With a prefix argument, add or remove the checkbox for all 5410 items in the region. 5411 5412 @item 5413 If point is in a headline, toggle checkboxes in the region between 5414 this headline and the next---so @emph{not} the entire subtree. 5415 5416 @item 5417 If there is no active region, just toggle the checkbox at point. 5418 @end itemize 5419 5420 @item @kbd{C-c C-x C-r} (@code{org-toggle-radio-button}) 5421 @kindex C-c C-x C-r 5422 @findex org-toggle-radio-button 5423 @cindex radio button, checkbox as 5424 Toggle checkbox status by using the checkbox of the item at point as 5425 a radio button: when the checkbox is turned on, all other checkboxes 5426 on the same level will be turned off. With a universal prefix 5427 argument, toggle the presence of the checkbox. With a double prefix 5428 argument, set it to @samp{[-]}. 5429 5430 @findex org-list-checkbox-radio-mode 5431 @kbd{C-c C-c} can be told to consider checkboxes as radio buttons by 5432 setting @samp{#+ATTR_ORG: :radio t} right before the list or by calling 5433 @kbd{M-x org-list-checkbox-radio-mode} to activate this minor mode. 5434 5435 @item @kbd{M-S-@key{RET}} (@code{org-insert-todo-heading}) 5436 @kindex M-S-RET 5437 @findex org-insert-todo-heading 5438 Insert a new item with a checkbox. This works only if point is 5439 already in a plain list item (see @ref{Plain Lists}). 5440 5441 @item @kbd{C-c C-x o} (@code{org-toggle-ordered-property}) 5442 @kindex C-c C-x o 5443 @findex org-toggle-ordered-property 5444 @vindex org-track-ordered-property-with-tag 5445 Toggle the @samp{ORDERED} property of the entry, to toggle if checkboxes 5446 must be checked off in sequence. A property is used for this 5447 behavior because this should be local to the current entry, not 5448 inherited like a tag. However, if you would like to @emph{track} the 5449 value of this property with a tag for better visibility, customize 5450 @code{org-track-ordered-property-with-tag}. 5451 5452 @item @kbd{C-c #} (@code{org-update-statistics-cookies}) 5453 @kindex C-c # 5454 @findex org-update-statistics-cookies 5455 Update the statistics cookie in the current outline entry. When 5456 called with a @kbd{C-u} prefix, update the entire file. 5457 Checkbox statistic cookies are updated automatically if you toggle 5458 checkboxes with @kbd{C-c C-c} and make new ones with 5459 @kbd{M-S-@key{RET}}. TODO statistics cookies update when changing 5460 TODO states. If you delete boxes/entries or add/change them by 5461 hand, use this command to get things back into sync. 5462 @end table 5463 5464 @node Tags 5465 @chapter Tags 5466 5467 @cindex tags 5468 @cindex headline tagging 5469 @cindex matching, tags 5470 @cindex sparse tree, tag based 5471 5472 An excellent way to implement labels and contexts for 5473 cross-correlating information is to assign @emph{tags} to headlines. Org 5474 mode has extensive support for tags. 5475 5476 @vindex org-tag-faces 5477 Every headline can contain a list of tags; they occur at the end of 5478 the headline. Tags are normal words containing letters, numbers, @samp{_}, 5479 and @samp{@@}. Tags must be preceded and followed by a single colon, e.g., 5480 @samp{:work:}. Several tags can be specified, as in @samp{:work:urgent:}. Tags 5481 by default are in bold face with the same color as the headline. You 5482 may specify special faces for specific tags using the variable 5483 @code{org-tag-faces}, in much the same way as you can for TODO keywords 5484 (see @ref{Faces for TODO keywords}). 5485 5486 @menu 5487 * Tag Inheritance:: Tags use the tree structure of an outline. 5488 * Setting Tags:: How to assign tags to a headline. 5489 * Tag Hierarchy:: Create a hierarchy of tags. 5490 * Tag Searches:: Searching for combinations of tags. 5491 @end menu 5492 5493 @node Tag Inheritance 5494 @section Tag Inheritance 5495 5496 @cindex tag inheritance 5497 @cindex inheritance, of tags 5498 @cindex sublevels, inclusion into tags match 5499 5500 @emph{Tags} make use of the hierarchical structure of outline trees. If 5501 a heading has a certain tag, all subheadings inherit the tag as well. 5502 For example, in the list 5503 5504 @example 5505 * Meeting with the French group :work: 5506 ** Summary by Frank :boss:notes: 5507 *** TODO Prepare slides for him :action: 5508 @end example 5509 5510 @noindent 5511 the final heading has the tags @samp{work}, @samp{boss}, @samp{notes}, and @samp{action} 5512 even though the final heading is not explicitly marked with those 5513 tags. You can also set tags that all entries in a file should inherit 5514 just as if these tags were defined in a hypothetical level zero that 5515 surrounds the entire file. Use a line like this@footnote{ As with all 5516 these in-buffer settings, pressing @kbd{C-c C-c} activates any 5517 changes in the line.} 5518 5519 @cindex @samp{FILETAGS}, keyword 5520 @example 5521 #+FILETAGS: :Peter:Boss:Secret: 5522 @end example 5523 5524 5525 @vindex org-use-tag-inheritance 5526 @vindex org-tags-exclude-from-inheritance 5527 To limit tag inheritance to specific tags, or to turn it off entirely, 5528 use the variables @code{org-use-tag-inheritance} and 5529 @code{org-tags-exclude-from-inheritance}. 5530 5531 @vindex org-agenda-use-tag-inheritance 5532 Tag inheritance is relevant when the agenda search tries to match 5533 a tag, either in the @code{tags} or @code{tags-todo} agenda types. In other 5534 agenda types, @code{org-use-tag-inheritance} has no effect. Still, you may 5535 want to have your tags correctly set in the agenda, so that tag 5536 filtering works fine, with inherited tags. Set 5537 @code{org-agenda-use-tag-inheritance} to control this: the default value 5538 includes all agenda types, but setting this to @code{nil} can really speed 5539 up agenda generation. 5540 5541 @node Setting Tags 5542 @section Setting Tags 5543 5544 @cindex setting tags 5545 @cindex tags, setting 5546 5547 @kindex M-TAB 5548 Tags can simply be typed into the buffer at the end of a headline. 5549 After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is 5550 also a special command for inserting tags: 5551 5552 @table @asis 5553 @item @kbd{C-c C-q} (@code{org-set-tags-command}) 5554 @kindex C-c C-q 5555 @findex org-set-tags-command 5556 @cindex completion, of tags 5557 @vindex org-tags-column 5558 Enter new tags for the current headline. Org mode either offers 5559 completion or a special single-key interface for setting tags, see 5560 below. After pressing @kbd{@key{RET}}, the tags are inserted and 5561 aligned to @code{org-tags-column}. When called with a @kbd{C-u} 5562 prefix, all tags in the current buffer are aligned to that column, 5563 just to make things look nice. Tags are automatically realigned 5564 after promotion, demotion, and TODO state changes (see @ref{TODO Basics}). 5565 5566 @item @kbd{C-c C-c} (@code{org-set-tags-command}) 5567 @kindex C-c C-c 5568 When point is in a headline, this does the same as @kbd{C-c C-q}. 5569 @end table 5570 5571 @vindex org-complete-tags-always-offer-all-agenda-tags 5572 @vindex org-tag-alist 5573 @cindex @samp{TAGS}, keyword 5574 Org supports tag insertion based on a @emph{list of tags}. By default this 5575 list is constructed dynamically, containing all tags currently used in 5576 the buffer@footnote{ To extend this default list to all tags used in all 5577 agenda files (see @ref{Agenda Views}), customize the variable 5578 @code{org-complete-tags-always-offer-all-agenda-tags}.}. You may also 5579 globally specify a hard list of tags with the variable 5580 @code{org-tag-alist}. Finally you can set the default tags for a given 5581 file using the @samp{TAGS} keyword, like 5582 5583 @example 5584 #+TAGS: @@work @@home @@tennisclub 5585 #+TAGS: laptop car pc sailboat 5586 @end example 5587 5588 If you have globally defined your preferred set of tags using the 5589 variable @code{org-tag-alist}, but would like to use a dynamic tag list in 5590 a specific file, add an empty @samp{TAGS} keyword to that file: 5591 5592 @example 5593 #+TAGS: 5594 @end example 5595 5596 5597 @vindex org-tag-persistent-alist 5598 If you have a preferred set of tags that you would like to use in 5599 every file, in addition to those defined on a per-file basis by @samp{TAGS} 5600 keyword, then you may specify a list of tags with the variable 5601 @code{org-tag-persistent-alist}. You may turn this off on a per-file basis 5602 by adding a @samp{STARTUP} keyword to that file: 5603 5604 @example 5605 #+STARTUP: noptag 5606 @end example 5607 5608 5609 By default Org mode uses the standard minibuffer completion facilities 5610 for entering tags. However, it also implements another, quicker, tag 5611 selection method called @emph{fast tag selection}. This allows you to 5612 select and deselect tags with just a single key press. For this to 5613 work well you should assign unique letters to most of your commonly 5614 used tags. You can do this globally by configuring the variable 5615 @code{org-tag-alist} in your Emacs init file. For example, you may find 5616 the need to tag many items in different files with @samp{@@home}. In this 5617 case you can set something like: 5618 5619 @lisp 5620 (setq org-tag-alist '(("@@work" . ?w) ("@@home" . ?h) ("laptop" . ?l))) 5621 @end lisp 5622 5623 If the tag is only relevant to the file you are working on, then you 5624 can instead set the @samp{TAGS} keyword as: 5625 5626 @example 5627 #+TAGS: @@work(w) @@home(h) @@tennisclub(t) laptop(l) pc(p) 5628 @end example 5629 5630 5631 The tags interface shows the available tags in a splash window. If 5632 you want to start a new line after a specific tag, insert @samp{\n} into 5633 the tag list 5634 5635 @example 5636 #+TAGS: @@work(w) @@home(h) @@tennisclub(t) \n laptop(l) pc(p) 5637 @end example 5638 5639 5640 @noindent 5641 or write them in two lines: 5642 5643 @example 5644 #+TAGS: @@work(w) @@home(h) @@tennisclub(t) 5645 #+TAGS: laptop(l) pc(p) 5646 @end example 5647 5648 You can also group together tags that are mutually exclusive by using 5649 braces, as in: 5650 5651 @example 5652 #+TAGS: @{ @@work(w) @@home(h) @@tennisclub(t) @} laptop(l) pc(p) 5653 @end example 5654 5655 5656 @noindent 5657 you indicate that at most one of @samp{@@work}, @samp{@@home}, and @samp{@@tennisclub} 5658 should be selected. Multiple such groups are allowed. 5659 5660 Do not forget to press @kbd{C-c C-c} with point in one of these 5661 lines to activate any changes. 5662 5663 To set these mutually exclusive groups in the variable 5664 @code{org-tags-alist}, you must use the dummy tags @code{:startgroup} and 5665 @code{:endgroup} instead of the braces. Similarly, you can use @code{:newline} 5666 to indicate a line break. The previous example would be set globally 5667 by the following configuration: 5668 5669 @lisp 5670 (setq org-tag-alist '((:startgroup . nil) 5671 ("@@work" . ?w) ("@@home" . ?h) 5672 ("@@tennisclub" . ?t) 5673 (:endgroup . nil) 5674 ("laptop" . ?l) ("pc" . ?p))) 5675 @end lisp 5676 5677 If at least one tag has a selection key then pressing @kbd{C-c C-c} automatically presents you with a special interface, listing 5678 inherited tags, the tags of the current headline, and a list of all 5679 valid tags with corresponding keys@footnote{ Keys are automatically 5680 assigned to tags that have no configured keys.}. 5681 5682 Pressing keys assigned to tags adds or removes them from the list of 5683 tags in the current line. Selecting a tag in a group of mutually 5684 exclusive tags turns off any other tag from that group. 5685 5686 In this interface, you can also use the following special keys: 5687 5688 @table @asis 5689 @item @kbd{@key{TAB}} 5690 @kindex TAB 5691 Enter a tag in the minibuffer, even if the tag is not in the 5692 predefined list. You can complete on all tags present in the buffer 5693 and globally pre-defined tags from @code{org-tag-alist} and 5694 @code{org-tag-persistent-alist}. You can also add several tags: just 5695 separate them with a comma. 5696 5697 @item @kbd{@key{SPC}} 5698 @kindex SPC 5699 Clear all tags for this line. 5700 5701 @item @kbd{@key{RET}} 5702 @kindex RET 5703 Accept the modified set. 5704 5705 @item @kbd{C-g} 5706 @kindex C-g 5707 Abort without installing changes. 5708 5709 @item @kbd{q} 5710 @kindex q 5711 If @kbd{q} is not assigned to a tag, it aborts like 5712 @kbd{C-g}. 5713 5714 @item @kbd{!} 5715 @kindex ! 5716 Turn off groups of mutually exclusive tags. Use this to (as an 5717 exception) assign several tags from such a group. 5718 5719 @item @kbd{C-c} 5720 @kindex C-c C-c 5721 Toggle auto-exit after the next change (see below). If you are 5722 using expert mode, the first @kbd{C-c} displays the selection 5723 window. 5724 @end table 5725 5726 This method lets you assign tags to a headline with very few keys. 5727 With the above setup, you could clear the current tags and set 5728 @samp{@@home}, @samp{laptop} and @samp{pc} tags with just the following keys: 5729 @kbd{C-c C-c @key{SPC} h l p @key{RET}}. Switching from @samp{@@home} to @samp{@@work} 5730 would be done with @kbd{C-c C-c w @key{RET}} or alternatively with 5731 @kbd{C-c C-c C-c w}. Adding the non-predefined tag @samp{sarah} could 5732 be done with @kbd{C-c C-c @key{TAB} s a r a h @key{RET}}. 5733 5734 @vindex org-fast-tag-selection-single-key 5735 If you find that most of the time you need only a single key press to 5736 modify your list of tags, set the variable 5737 @code{org-fast-tag-selection-single-key}. Then you no longer have to press 5738 @kbd{@key{RET}} to exit fast tag selection---it exits after the first 5739 change. If you then occasionally need more keys, press @kbd{C-c} 5740 to turn off auto-exit for the current tag selection process (in 5741 effect: start selection with @kbd{C-c C-c C-c} instead of 5742 @kbd{C-c C-c}). If you set the variable to the value @code{expert}, 5743 the special window is not even shown for single-key tag selection, it 5744 comes up only when you press an extra @kbd{C-c}. 5745 5746 @vindex org-fast-tag-selection-maximum-tags 5747 The number of tags displayed in the fast tag selection interface is 5748 limited by @code{org-fast-tag-selection-maximum-tags} to avoid running out 5749 of keyboard keys. You can customize this variable. 5750 5751 @node Tag Hierarchy 5752 @section Tag Hierarchy 5753 5754 @cindex group tags 5755 @cindex tags, groups 5756 @cindex tags hierarchy 5757 5758 Tags can be defined in hierarchies. A tag can be defined as a @emph{group 5759 tag} for a set of other tags. The group tag can be seen as the 5760 ``broader term'' for its set of tags. Defining multiple group tags and 5761 nesting them creates a tag hierarchy. 5762 5763 One use-case is to create a taxonomy of terms (tags) that can be used 5764 to classify nodes in a document or set of documents. 5765 5766 When you search for a group tag, it return matches for all members in 5767 the group and its subgroups. In an agenda view, filtering by a group 5768 tag displays or hide headlines tagged with at least one of the members 5769 of the group or any of its subgroups. This makes tag searches and 5770 filters even more flexible. 5771 5772 You can set group tags by using brackets and inserting a colon between 5773 the group tag and its related tags---beware that all whitespaces are 5774 mandatory so that Org can parse this line correctly: 5775 5776 @example 5777 #+TAGS: [ GTD : Control Persp ] 5778 @end example 5779 5780 5781 In this example, @samp{GTD} is the group tag and it is related to two other 5782 tags: @samp{Control}, @samp{Persp}. Defining @samp{Control} and @samp{Persp} as group 5783 tags creates a hierarchy of tags: 5784 5785 @example 5786 #+TAGS: [ Control : Context Task ] 5787 #+TAGS: [ Persp : Vision Goal AOF Project ] 5788 @end example 5789 5790 That can conceptually be seen as a hierarchy of tags: 5791 5792 @itemize 5793 @item 5794 @samp{GTD} 5795 @itemize 5796 @item 5797 @samp{Persp} 5798 @itemize 5799 @item 5800 @samp{Vision} 5801 @item 5802 @samp{Goal} 5803 @item 5804 @samp{AOF} 5805 @item 5806 @samp{Project} 5807 @end itemize 5808 @item 5809 @samp{Control} 5810 @itemize 5811 @item 5812 @samp{Context} 5813 @item 5814 @samp{Task} 5815 @end itemize 5816 @end itemize 5817 @end itemize 5818 5819 You can use the @code{:startgrouptag}, @code{:grouptags} and @code{:endgrouptag} 5820 keyword directly when setting @code{org-tag-alist} directly: 5821 5822 @lisp 5823 (setq org-tag-alist '((:startgrouptag) 5824 ("GTD") 5825 (:grouptags) 5826 ("Control") 5827 ("Persp") 5828 (:endgrouptag) 5829 (:startgrouptag) 5830 ("Control") 5831 (:grouptags) 5832 ("Context") 5833 ("Task") 5834 (:endgrouptag))) 5835 @end lisp 5836 5837 The tags in a group can be mutually exclusive if using the same group 5838 syntax as is used for grouping mutually exclusive tags together; using 5839 curly brackets. 5840 5841 @example 5842 #+TAGS: @{ Context : @@Home @@Work @@Call @} 5843 @end example 5844 5845 5846 When setting @code{org-tag-alist} you can use @code{:startgroup} and @code{:endgroup} 5847 instead of @code{:startgrouptag} and @code{:endgrouptag} to make the tags 5848 mutually exclusive. 5849 5850 Furthermore, the members of a group tag can also be regular 5851 expressions, creating the possibility of a more dynamic and rule-based 5852 tag structure (see @ref{Regular Expressions}). The regular expressions in 5853 the group must be specified within curly brackets. Here is an 5854 expanded example: 5855 5856 @example 5857 #+TAGS: [ Vision : @{V@@.+@} ] 5858 #+TAGS: [ Goal : @{G@@.+@} ] 5859 #+TAGS: [ AOF : @{AOF@@.+@} ] 5860 #+TAGS: [ Project : @{P@@.+@} ] 5861 @end example 5862 5863 Searching for the tag @samp{Project} now lists all tags also including 5864 regular expression matches for @samp{P@@.+}, and similarly for tag searches 5865 on @samp{Vision}, @samp{Goal} and @samp{AOF}. For example, this would work well for 5866 a project tagged with a common project-identifier, e.g., 5867 @samp{P@@2014_OrgTags}. 5868 5869 @kindex C-c C-x q 5870 @findex org-toggle-tags-groups 5871 @vindex org-group-tags 5872 If you want to ignore group tags temporarily, toggle group tags 5873 support with @code{org-toggle-tags-groups}, bound to @kbd{C-c C-x q}. 5874 If you want to disable tag groups completely, set @code{org-group-tags} to 5875 @code{nil}. 5876 5877 @node Tag Searches 5878 @section Tag Searches 5879 5880 @cindex tag searches 5881 @cindex searching for tags 5882 5883 Once a system of tags has been set up, it can be used to collect 5884 related information into special lists. 5885 5886 @table @asis 5887 @item @kbd{C-c / m} or @kbd{C-c \} (@code{org-match-sparse-tree}) 5888 @kindex C-c / m 5889 @kindex C-c \ 5890 @findex org-match-sparse-tree 5891 Create a sparse tree with all headlines matching a tags search. 5892 With a @kbd{C-u} prefix argument, ignore headlines that are not 5893 a TODO line. 5894 5895 @item @kbd{M-x org-agenda m} (@code{org-tags-view}) 5896 @kindex m @r{(Agenda dispatcher)} 5897 @findex org-tags-view 5898 Create a global list of tag matches from all agenda files. See 5899 @ref{Matching tags and properties}. 5900 5901 @item @kbd{M-x org-agenda M} (@code{org-tags-view}) 5902 @kindex M @r{(Agenda dispatcher)} 5903 Create a global list of tag matches from all agenda files, but check 5904 only TODO items. 5905 @end table 5906 5907 These commands all prompt for a match string which allows basic 5908 Boolean logic like @samp{+boss+urgent-project1}, to find entries with tags 5909 @samp{boss} and @samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find 5910 entries which are tagged, like @samp{Kathy} or @samp{Sally}. The full syntax of 5911 the search string is rich and allows also matching against TODO 5912 keywords, entry levels and properties. For a complete description 5913 with many examples, see @ref{Matching tags and properties}. 5914 5915 @node Properties and Columns 5916 @chapter Properties and Columns 5917 5918 @cindex properties 5919 5920 A property is a key-value pair associated with an entry. Properties 5921 can be set so they are associated with a single entry, with every 5922 entry in a tree, or with the whole buffer. 5923 5924 There are two main applications for properties in Org mode. First, 5925 properties are like tags, but with a value. Imagine maintaining 5926 a file where you document bugs and plan releases for a piece of 5927 software. Instead of using tags like @samp{release_1}, @samp{release_2}, you 5928 can use a property, say @samp{Release}, that in different subtrees has 5929 different values, such as @samp{1.0} or @samp{2.0}. Second, you can use 5930 properties to implement (very basic) database capabilities in an Org 5931 buffer. Imagine keeping track of your music CDs, where properties 5932 could be things such as the album, artist, date of release, number of 5933 tracks, and so on. 5934 5935 Properties can be conveniently edited and viewed in column view (see 5936 @ref{Column View}). 5937 5938 @menu 5939 * Property Syntax:: How properties are spelled out. 5940 * Special Properties:: Access to other Org mode features. 5941 * Property Searches:: Matching property values. 5942 * Property Inheritance:: Passing values down a tree. 5943 * Column View:: Tabular viewing and editing. 5944 @end menu 5945 5946 @node Property Syntax 5947 @section Property Syntax 5948 5949 @cindex property syntax 5950 @cindex drawer, for properties 5951 5952 Properties are key--value pairs. When they are associated with 5953 a single entry or with a tree they need to be inserted into a special 5954 drawer (see @ref{Drawers}) with the name @samp{PROPERTIES}, which has to be 5955 located right below a headline, and its planning line (see @ref{Deadlines and Scheduling}) when applicable. Each property is specified on 5956 a single line, with the key---surrounded by colons---first, and the 5957 value after it. Keys are case-insensitive. Here is an example: 5958 5959 @example 5960 * CD collection 5961 ** Classic 5962 *** Goldberg Variations 5963 :PROPERTIES: 5964 :Title: Goldberg Variations 5965 :Composer: J.S. Bach 5966 :Artist: Glenn Gould 5967 :Publisher: Deutsche Grammophon 5968 :NDisks: 1 5969 :END: 5970 @end example 5971 5972 Depending on the value of @code{org-use-property-inheritance}, a property 5973 set this way is associated either with a single entry, or with the 5974 subtree defined by the entry, see @ref{Property Inheritance}. 5975 5976 You may define the allowed values for a particular property @samp{Xyz} by 5977 setting a property @samp{Xyz_ALL}. This special property is @emph{inherited}, 5978 so if you set it in a level 1 entry, it applies to the entire tree. 5979 When allowed values are defined, setting the corresponding property 5980 becomes easier and is less prone to typing errors. For the example 5981 with the CD collection, we can pre-define publishers and the number of 5982 disks in a box like this: 5983 5984 @example 5985 * CD collection 5986 :PROPERTIES: 5987 :NDisks_ALL: 1 2 3 4 5988 :Publisher_ALL: "Deutsche Grammophon" Philips EMI 5989 :END: 5990 @end example 5991 5992 Properties can be inserted at the buffer level. That means they apply 5993 before the first headline and can be inherited by all entries in a 5994 file. Property blocks defined before the first headline must be at 5995 the top of the buffer with only comments above them. 5996 5997 Properties can also be defined using lines like: 5998 5999 @cindex @samp{_ALL} suffix, in properties 6000 @cindex @samp{PROPERTY}, keyword 6001 @example 6002 #+PROPERTY: NDisks_ALL 1 2 3 4 6003 @end example 6004 6005 6006 @cindex @samp{+} suffix, in properties 6007 If you want to add to the value of an existing property, append a @samp{+} 6008 to the property name. The following results in the property @samp{var} 6009 having the value @samp{foo=1 bar=2}. 6010 6011 @example 6012 #+PROPERTY: var foo=1 6013 #+PROPERTY: var+ bar=2 6014 @end example 6015 6016 It is also possible to add to the values of inherited properties. The 6017 following results in the @samp{Genres} property having the value @samp{Classic 6018 Baroque} under the @samp{Goldberg Variations} subtree. 6019 6020 @example 6021 * CD collection 6022 ** Classic 6023 :PROPERTIES: 6024 :Genres: Classic 6025 :END: 6026 *** Goldberg Variations 6027 :PROPERTIES: 6028 :Title: Goldberg Variations 6029 :Composer: J.S. Bach 6030 :Artist: Glenn Gould 6031 :Publisher: Deutsche Grammophon 6032 :NDisks: 1 6033 :Genres+: Baroque 6034 :END: 6035 @end example 6036 6037 Note that a property can only have one entry per drawer. 6038 6039 @vindex org-global-properties 6040 Property values set with the global variable @code{org-global-properties} 6041 can be inherited by all entries in all Org files. 6042 6043 The following commands help to work with properties: 6044 6045 @table @asis 6046 @item @kbd{M-@key{TAB}} (@code{pcomplete}) 6047 @kindex M-TAB 6048 @findex pcomplete 6049 After an initial colon in a line, complete property keys. All keys 6050 used in the current file are offered as possible completions. 6051 6052 @item @kbd{C-c C-x p} (@code{org-set-property}) 6053 @kindex C-c C-x p 6054 @findex org-set-property 6055 Set a property. This prompts for a property name and a value. If 6056 necessary, the property drawer is created as well. 6057 6058 @item @kbd{C-u M-x org-insert-drawer} 6059 @findex org-insert-drawer 6060 Insert a property drawer into the current entry. The drawer is 6061 inserted early in the entry, but after the lines with planning 6062 information like deadlines. If before first headline the drawer is 6063 inserted at the top of the drawer after any potential comments. 6064 6065 @item @kbd{C-c C-c} (@code{org-property-action}) 6066 @kindex C-c C-c 6067 @findex org-property-action 6068 With point in a property drawer, this executes property commands. 6069 6070 @item @kbd{C-c C-c s} (@code{org-set-property}) 6071 @kindex C-c C-c s 6072 @findex org-set-property 6073 Set a property in the current entry. Both the property and the 6074 value can be inserted using completion. 6075 6076 @item @kbd{S-@key{RIGHT}} (@code{org-property-next-allowed-value}) 6077 @itemx @kbd{S-@key{LEFT}} (@code{org-property-previous-allowed-value}) 6078 @kindex S-RIGHT 6079 @kindex S-LEFT 6080 Switch property at point to the next/previous allowed value. 6081 6082 @item @kbd{C-c C-c d} (@code{org-delete-property}) 6083 @kindex C-c C-c d 6084 @findex org-delete-property 6085 Remove a property from the current entry. 6086 6087 @item @kbd{C-c C-c D} (@code{org-delete-property-globally}) 6088 @kindex C-c C-c D 6089 @findex org-delete-property-globally 6090 Globally remove a property, from all entries in the current file. 6091 6092 @item @kbd{C-c C-c c} (@code{org-compute-property-at-point}) 6093 @kindex C-c C-c c 6094 @findex org-compute-property-at-point 6095 Compute the property at point, using the operator and scope from the 6096 nearest column format definition. 6097 @end table 6098 6099 @node Special Properties 6100 @section Special Properties 6101 6102 @cindex properties, special 6103 6104 Special properties provide an alternative access method to Org mode 6105 features, like the TODO state or the priority of an entry, discussed 6106 in the previous chapters. This interface exists so that you can 6107 include these states in a column view (see @ref{Column View}), or to use 6108 them in queries. The following property names are special and should 6109 not be used as keys in the properties drawer: 6110 6111 @cindex @samp{ALLTAGS}, special property 6112 @cindex @samp{BLOCKED}, special property 6113 @cindex @samp{CLOCKSUM}, special property 6114 @cindex @samp{CLOCKSUM_T}, special property 6115 @cindex @samp{CLOSED}, special property 6116 @cindex @samp{DEADLINE}, special property 6117 @cindex @samp{FILE}, special property 6118 @cindex @samp{ITEM}, special property 6119 @cindex @samp{PRIORITY}, special property 6120 @cindex @samp{SCHEDULED}, special property 6121 @cindex @samp{TAGS}, special property 6122 @cindex @samp{TIMESTAMP}, special property 6123 @cindex @samp{TIMESTAMP_IA}, special property 6124 @cindex @samp{TODO}, special property 6125 @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 6126 @item @samp{ALLTAGS} 6127 @tab All tags, including inherited ones. 6128 @item @samp{BLOCKED} 6129 @tab @code{t} if task is currently blocked by children or siblings. 6130 @item @samp{CATEGORY} 6131 @tab The category of an entry. 6132 @item @samp{CLOCKSUM} 6133 @tab The sum of CLOCK intervals in the subtree. @code{org-clock-sum} 6134 @item 6135 @tab must be run first to compute the values in the current buffer. 6136 @item @samp{CLOCKSUM_T} 6137 @tab The sum of CLOCK intervals in the subtree for today. 6138 @item 6139 @tab @code{org-clock-sum-today} must be run first to compute the 6140 @item 6141 @tab values in the current buffer. 6142 @item @samp{CLOSED} 6143 @tab When was this entry closed? 6144 @item @samp{DEADLINE} 6145 @tab The deadline timestamp. 6146 @item @samp{FILE} 6147 @tab The filename the entry is located in. 6148 @item @samp{ITEM} 6149 @tab The headline of the entry. 6150 @item @samp{PRIORITY} 6151 @tab The priority of the entry, a string with a single letter. 6152 @item @samp{SCHEDULED} 6153 @tab The scheduling timestamp. 6154 @item @samp{TAGS} 6155 @tab The tags defined directly in the headline. 6156 @item @samp{TIMESTAMP} 6157 @tab The first active keyword-less timestamp in the entry.@footnote{For both @samp{TIMESTAMP} and @samp{TIMESTAMP_IA}: the word ``first'' 6158 refers to the first occurrence in the entry, not the earliest in time; 6159 the prefix @samp{CLOCK:} at the beginning of a clock entry is considered a 6160 keyword in this context; and timestamps inside property drawers are 6161 ignored.} 6162 @item @samp{TIMESTAMP_IA} 6163 @tab The first inactive keyword-less timestamp in the entry. 6164 @item @samp{TODO} 6165 @tab The TODO keyword of the entry. 6166 @end multitable 6167 6168 @node Property Searches 6169 @section Property Searches 6170 6171 @cindex properties, searching 6172 @cindex searching, of properties 6173 6174 To create sparse trees and special lists with selection based on 6175 properties, the same commands are used as for tag searches (see @ref{Tag Searches}). 6176 6177 @table @asis 6178 @item @kbd{C-c / m} or @kbd{C-c \} (@code{org-match-sparse-tree}) 6179 @kindex C-c / m 6180 @kindex C-c \ 6181 @findex org-match-sparse-tree 6182 Create a sparse tree with all matching entries. With 6183 a @kbd{C-u} prefix argument, ignore headlines that are not 6184 a TODO line. 6185 6186 @item @kbd{M-x org-agenda m} (@code{org-tags-view}) 6187 @kindex m @r{(Agenda dispatcher)} 6188 @findex org-tags-view 6189 Create a global list of tag/property matches from all agenda files. 6190 6191 @item @kbd{M-x org-agenda M} (@code{org-tags-view}) 6192 @kindex M @r{(Agenda dispatcher)} 6193 Create a global list of tag matches from all agenda files, but check 6194 only TODO items. 6195 @end table 6196 6197 The syntax for the search string is described in @ref{Matching tags and properties}. 6198 6199 There is also a special command for creating sparse trees based on a 6200 single property: 6201 6202 @table @asis 6203 @item @kbd{C-c / p} 6204 @kindex C-c / p 6205 Create a sparse tree based on the value of a property. This first 6206 prompts for the name of a property, and then for a value. A sparse 6207 tree is created with all entries that define this property with the 6208 given value. If you enclose the value in curly braces, it is 6209 interpreted as a regular expression and matched against the property 6210 values (see @ref{Regular Expressions}). 6211 @end table 6212 6213 @node Property Inheritance 6214 @section Property Inheritance 6215 6216 @cindex properties, inheritance 6217 @cindex inheritance, of properties 6218 6219 @vindex org-use-property-inheritance 6220 The outline structure of Org documents lends itself to an inheritance 6221 model of properties: if the parent in a tree has a certain property, 6222 the children can inherit this property. Org mode does not turn this 6223 on by default, because it can slow down property searches 6224 significantly and is often not needed. However, if you find 6225 inheritance useful, you can turn it on by setting the variable 6226 @code{org-use-property-inheritance}. It may be set to @code{t} to make all 6227 properties inherited from the parent, to a list of properties that 6228 should be inherited, or to a regular expression that matches inherited 6229 properties. If a property has the value @code{nil}, this is interpreted as 6230 an explicit un-define of the property, so that inheritance search 6231 stops at this value and returns @code{nil}. 6232 6233 Org mode has a few properties for which inheritance is hard-coded, at 6234 least for the special applications for which they are used: 6235 6236 @table @asis 6237 @item @code{COLUMNS} 6238 @cindex @samp{COLUMNS}, property 6239 The @samp{COLUMNS} property defines the format of column view (see 6240 @ref{Column View}). It is inherited in the sense that the level where 6241 a @samp{COLUMNS} property is defined is used as the starting point for 6242 a column view table, independently of the location in the subtree 6243 from where columns view is turned on. 6244 6245 @item @code{CATEGORY} 6246 @cindex @samp{CATEGORY}, property 6247 For agenda view, a category set through a @samp{CATEGORY} property 6248 applies to the entire subtree. 6249 6250 @item @code{ARCHIVE} 6251 @cindex @samp{ARCHIVE}, property 6252 For archiving, the @samp{ARCHIVE} property may define the archive 6253 location for the entire subtree (see @ref{Moving subtrees}). 6254 6255 @item @code{LOGGING} 6256 @cindex @samp{LOGGING}, property 6257 The @samp{LOGGING} property may define logging settings for an entry or 6258 a subtree (see @ref{Tracking TODO state changes}). 6259 @end table 6260 6261 @node Column View 6262 @section Column View 6263 6264 A great way to view and edit properties in an outline tree is @emph{column 6265 view}. In column view, each outline node is turned into a table row. 6266 Columns in this table provide access to properties of the entries. 6267 Org mode implements columns by overlaying a tabular structure over the 6268 headline of each item. While the headlines have been turned into 6269 a table row, you can still change the visibility of the outline tree. 6270 For example, you get a compact table by switching to ``contents'' 6271 view---@kbd{S-@key{TAB}} @kbd{S-@key{TAB}}, or simply @kbd{c} 6272 while column view is active---but you can still open, read, and edit 6273 the entry below each headline. Or, you can switch to column view 6274 after executing a sparse tree command and in this way get a table only 6275 for the selected items. Column view also works in agenda buffers (see 6276 @ref{Agenda Views}) where queries have collected selected items, possibly 6277 from a number of files. 6278 6279 @menu 6280 * Defining columns:: The COLUMNS format property. 6281 * Using column view:: How to create and use column view. 6282 * Capturing column view:: A dynamic block for column view. 6283 @end menu 6284 6285 @node Defining columns 6286 @subsection Defining columns 6287 6288 @cindex column view, for properties 6289 @cindex properties, column view 6290 6291 Setting up a column view first requires defining the columns. This is 6292 done by defining a column format line. 6293 6294 @menu 6295 * Scope of column definitions:: Where defined, where valid? 6296 * Column attributes:: Appearance and content of a column. 6297 @end menu 6298 6299 @node Scope of column definitions 6300 @subsubsection Scope of column definitions 6301 6302 To specify a format that only applies to a specific tree, add 6303 a @samp{COLUMNS} property to the top node of that tree, for example: 6304 6305 @example 6306 ** Top node for columns view 6307 :PROPERTIES: 6308 :COLUMNS: %25ITEM %TAGS %PRIORITY %TODO 6309 :END: 6310 @end example 6311 6312 A @samp{COLUMNS} property within a property drawer before first headline 6313 will apply to the entire file. As an addition to property drawers, 6314 keywords can also be defined for an entire file using a line like: 6315 6316 @cindex @samp{COLUMNS}, keyword 6317 @example 6318 #+COLUMNS: %25ITEM %TAGS %PRIORITY %TODO 6319 @end example 6320 6321 6322 If a @samp{COLUMNS} property is present in an entry, it defines columns for 6323 the entry itself, and for the entire subtree below it. Since the 6324 column definition is part of the hierarchical structure of the 6325 document, you can define columns on level 1 that are general enough 6326 for all sublevels, and more specific columns further down, when you 6327 edit a deeper part of the tree. 6328 6329 @node Column attributes 6330 @subsubsection Column attributes 6331 6332 A column definition sets the attributes of a column. The general 6333 definition looks like this: 6334 6335 @example 6336 %[WIDTH]PROPERTY[(TITLE)][@{SUMMARY-TYPE@}] 6337 @end example 6338 6339 6340 @noindent 6341 Except for the percent sign and the property name, all items are 6342 optional. The individual parts have the following meaning: 6343 6344 @table @asis 6345 @item @var{WIDTH} 6346 An integer specifying the width of the column in characters. If 6347 omitted, the width is determined automatically. 6348 6349 @item @var{PROPERTY} 6350 The property that should be edited in this column. Special 6351 properties representing meta data are allowed here as well (see 6352 @ref{Special Properties}). 6353 6354 @item @var{TITLE} 6355 The header text for the column. If omitted, the property name is 6356 used. 6357 6358 @item @var{SUMMARY-TYPE} 6359 The summary type. If specified, the column values for parent nodes 6360 are computed from the children@footnote{ If more than one summary type 6361 applies to the same property, the parent values are computed 6362 according to the first of them.}. 6363 6364 Supported summary types are: 6365 6366 @multitable {aaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 6367 @item @samp{+} 6368 @tab Sum numbers in this column. 6369 @item @samp{+;%.1f} 6370 @tab Like @samp{+}, but format result with @samp{%.1f}. 6371 @item @samp{$} 6372 @tab Currency, short for @samp{+;%.2f}. 6373 @item @samp{min} 6374 @tab Smallest number in column. 6375 @item @samp{max} 6376 @tab Largest number. 6377 @item @samp{mean} 6378 @tab Arithmetic mean of numbers. 6379 @item @samp{X} 6380 @tab Checkbox status, @samp{[X]} if all children are @samp{[X]}. 6381 @item @samp{X/} 6382 @tab Checkbox status, @samp{[n/m]}. 6383 @item @samp{X%} 6384 @tab Checkbox status, @samp{[n%]}. 6385 @item @samp{:} 6386 @tab Sum times, HH:MM, plain numbers are minutes. 6387 @item @samp{:min} 6388 @tab Smallest time value in column. 6389 @item @samp{:max} 6390 @tab Largest time value. 6391 @item @samp{:mean} 6392 @tab Arithmetic mean of time values. 6393 @item @samp{@@min} 6394 @tab Minimum age@footnote{An age can be defined as a duration, using units defined in 6395 @code{org-duration-units}, e.g., @samp{3d 1h}. If any value in the column is as 6396 such, the summary is also expressed as a duration.} (in days/hours/mins/seconds). 6397 @item @samp{@@max} 6398 @tab Maximum age (in days/hours/mins/seconds). 6399 @item @samp{@@mean} 6400 @tab Arithmetic mean of ages (in days/hours/mins/seconds). 6401 @item @samp{est+} 6402 @tab Add low-high estimates. 6403 @end multitable 6404 6405 @vindex org-columns-summary-types 6406 You can also define custom summary types by setting 6407 @code{org-columns-summary-types}. 6408 @end table 6409 6410 The @samp{est+} summary type requires further explanation. It is used for 6411 combining estimates, expressed as low-high ranges. For example, 6412 instead of estimating a particular task will take 5 days, you might 6413 estimate it as 5--6 days if you're fairly confident you know how much 6414 work is required, or 1--10 days if you do not really know what needs 6415 to be done. Both ranges average at 5.5 days, but the first represents 6416 a more predictable delivery. 6417 6418 When combining a set of such estimates, simply adding the lows and 6419 highs produces an unrealistically wide result. Instead, @samp{est+} adds 6420 the statistical mean and variance of the subtasks, generating a final 6421 estimate from the sum. For example, suppose you had ten tasks, each 6422 of which was estimated at 0.5 to 2 days of work. Straight addition 6423 produces an estimate of 5 to 20 days, representing what to expect if 6424 everything goes either extremely well or extremely poorly. In 6425 contrast, @samp{est+} estimates the full job more realistically, at 10--15 6426 days. 6427 6428 Here is an example for a complete columns definition, along with 6429 allowed values@footnote{ Please note that the @samp{COLUMNS} definition must be 6430 on a single line; it is wrapped here only because of formatting 6431 constraints.}. 6432 6433 @example 6434 :COLUMNS: %25ITEM %9Approved(Approved?)@{X@} %Owner %11Status \ 6435 %10Time_Estimate@{:@} %CLOCKSUM %CLOCKSUM_T 6436 :Owner_ALL: Tammy Mark Karl Lisa Don 6437 :Status_ALL: "In progress" "Not started yet" "Finished" "" 6438 :Approved_ALL: "[ ]" "[X]" 6439 @end example 6440 6441 @noindent 6442 The first column, @samp{%25ITEM}, means the first 25 characters of the item 6443 itself, i.e., of the headline. You probably always should start the 6444 column definition with the @samp{ITEM} specifier. The other specifiers 6445 create columns @samp{Owner} with a list of names as allowed values, for 6446 @samp{Status} with four different possible values, and for a checkbox field 6447 @samp{Approved}. When no width is given after the @samp{%} character, the 6448 column is exactly as wide as it needs to be in order to fully display 6449 all values. The @samp{Approved} column does have a modified title 6450 (@samp{Approved?}, with a question mark). Summaries are created for the 6451 @samp{Time_Estimate} column by adding time duration expressions like HH:MM, 6452 and for the @samp{Approved} column, by providing an @samp{[X]} status if all 6453 children have been checked. The @samp{CLOCKSUM} and @samp{CLOCKSUM_T} columns 6454 are special, they lists the sums of CLOCK intervals in the subtree, 6455 either for all clocks or just for today. 6456 6457 @node Using column view 6458 @subsection Using column view 6459 6460 @anchor{Turning column view on or off} 6461 @subsubheading Turning column view on or off 6462 6463 @table @asis 6464 @item @kbd{C-c C-x C-c} (@code{org-columns}) 6465 @kindex C-c C-x C-c 6466 @vindex org-columns 6467 @vindex org-columns-default-format 6468 Turn on column view. If point is before the first headline in the 6469 file, column view is turned on for the entire file, using the 6470 @samp{#+COLUMNS} definition. If point is somewhere inside the outline, 6471 this command searches the hierarchy, up from point, for a @samp{COLUMNS} 6472 property that defines a format. When one is found, the column view 6473 table is established for the tree starting at the entry that 6474 contains the @samp{COLUMNS} property. If no such property is found, the 6475 format is taken from the @samp{#+COLUMNS} line or from the variable 6476 @code{org-columns-default-format}, and column view is established for the 6477 current entry and its subtree. 6478 6479 @item @kbd{r} or @kbd{g} on a columns view line (@code{org-columns-redo}) 6480 @kindex r 6481 @kindex g 6482 @findex org-columns-redo 6483 Recreate the column view, to include recent changes made in the 6484 buffer. 6485 6486 @item @kbd{C-c C-c} or @kbd{q} on a columns view line (@code{org-columns-quit}) 6487 @kindex q 6488 @kindex C-c C-c 6489 @findex org-columns-quit 6490 Exit column view. 6491 @end table 6492 6493 @anchor{Editing values} 6494 @subsubheading Editing values 6495 6496 @table @asis 6497 @item @kbd{@key{LEFT}}, @kbd{@key{RIGHT}}, @kbd{@key{UP}}, @kbd{@key{DOWN}} 6498 Move through the column view from field to field. 6499 6500 @item @kbd{1..9,0} 6501 @kindex 1..9,0 6502 Directly select the Nth allowed value, @kbd{0} selects the 6503 10th value. 6504 6505 @item @kbd{n} or @kbd{S-@key{RIGHT}} (@code{org-columns-next-allowed-value}) 6506 @itemx @kbd{p} or @kbd{S-@key{LEFT}} (@code{org-columns-previous-allowed-value}) 6507 @kindex n 6508 @kindex S-RIGHT 6509 @kindex p 6510 @kindex S-LEFT 6511 @findex org-columns-next-allowed-value 6512 @findex org-columns-previous-allowed-value 6513 Switch to the next/previous allowed value of the field. For this, 6514 you have to have specified allowed values for a property. 6515 6516 @item @kbd{e} (@code{org-columns-edit-value}) 6517 @kindex e 6518 @findex org-columns-edit-value 6519 Edit the property at point. For the special properties, this 6520 invokes the same interface that you normally use to change that 6521 property. For example, the tag completion or fast selection 6522 interface pops up when editing a @samp{TAGS} property. 6523 6524 @item @kbd{C-c C-c} (@code{org-columns-toggle-or-columns-quit}) 6525 @kindex C-c C-c 6526 @findex org-columns-toggle-or-columns-quit 6527 When there is a checkbox at point, toggle it. Else exit column 6528 view. 6529 6530 @item @kbd{v} (@code{org-columns-show-value}) 6531 @kindex v 6532 @findex org-columns-show-value 6533 View the full value of this property. This is useful if the width 6534 of the column is smaller than that of the value. 6535 6536 @item @kbd{a} (@code{org-columns-edit-allowed}) 6537 @kindex a 6538 @findex org-columns-edit-allowed 6539 Edit the list of allowed values for this property. If the list is 6540 found in the hierarchy, the modified values is stored there. If no 6541 list is found, the new value is stored in the first entry that is 6542 part of the current column view. 6543 @end table 6544 6545 @anchor{Modifying column view on-the-fly} 6546 @subsubheading Modifying column view on-the-fly 6547 6548 @table @asis 6549 @item @kbd{<} (@code{org-columns-narrow}) 6550 @itemx @kbd{>} (@code{org-columns-widen}) 6551 @kindex < 6552 @kindex > 6553 @findex org-columns-narrow 6554 @findex org-columns-widen 6555 Make the column narrower/wider by one character. 6556 6557 @item @kbd{S-M-@key{RIGHT}} (@code{org-columns-new}) 6558 @kindex S-M-RIGHT 6559 @findex org-columns-new 6560 Insert a new column, to the left of the current column. 6561 6562 @item @kbd{S-M-@key{LEFT}} (@code{org-columns-delete}) 6563 @kindex S-M-LEFT 6564 @findex org-columns-delete 6565 Delete the current column. 6566 6567 @item @kbd{M-@key{LEFT}} (@code{org-columns-move-left}) 6568 @kindex M-LEFT 6569 @findex org-columns-move-left 6570 Move the current column left. 6571 6572 @item @kbd{M-@key{RIGHT}} (@code{org-columns-move-right}) 6573 @kindex M-RIGHT 6574 @findex org-columns-move-right 6575 Move the current column right. 6576 6577 @item @kbd{M-@key{UP}} (@code{org-columns-move-row-up}) 6578 @kindex M-UP 6579 @findex org-columns-move-row-up 6580 Move the current row up. 6581 6582 @item @kbd{M-@key{DOWN}} (@code{org-columns-move-row-down}) 6583 @kindex M-DOWN 6584 @findex org-columns-move-row-down 6585 Move the current row down. 6586 @end table 6587 6588 @node Capturing column view 6589 @subsection Capturing column view 6590 6591 Since column view is just an overlay over a buffer, it cannot be 6592 exported or printed directly. If you want to capture a column view, 6593 use a @samp{columnview} dynamic block (see @ref{Dynamic Blocks}). The frame of 6594 this block looks like this: 6595 6596 @cindex @samp{BEGIN columnview} 6597 @example 6598 * The column view 6599 #+BEGIN: columnview :hlines 1 :id "label" 6600 6601 #+END: 6602 @end example 6603 6604 This dynamic block has the following parameters: 6605 6606 @table @asis 6607 @item @samp{:id} 6608 This is the most important parameter. Column view is a feature that 6609 is often localized to a certain (sub)tree, and the capture block 6610 might be at a different location in the file. To identify the tree 6611 whose view to capture, you can use four values: 6612 6613 @table @asis 6614 @item @samp{local} 6615 Use the tree in which the capture block is located. 6616 6617 @item @samp{global} 6618 Make a global view, including all headings in the file. 6619 6620 @item @samp{file:FILENAME} 6621 Run column view at the top of the @var{FILENAME} file. 6622 6623 @item @samp{LABEL} 6624 @cindex @samp{ID}, property 6625 Call column view in the tree that has an @samp{ID} property with the 6626 value @var{LABEL}. You can use @kbd{M-x org-id-copy} to 6627 create a globally unique ID for the current entry and copy it to 6628 the kill-ring. 6629 @end table 6630 6631 @item @samp{:match} 6632 When set to a string, use this as a tags/property match filter to 6633 select only a subset of the headlines in the scope set by the @code{:id} 6634 parameter. 6635 @end table 6636 6637 6638 @table @asis 6639 @item @samp{:hlines} 6640 When @code{t}, insert an hline after every line. When a number N, insert 6641 an hline before each headline with level @code{<= N}. 6642 6643 @item @samp{:vlines} 6644 When non-@code{nil}, force column groups to get vertical lines. 6645 6646 @item @samp{:maxlevel} 6647 When set to a number, do not capture entries below this level. 6648 6649 @item @samp{:skip-empty-rows} 6650 When non-@code{nil}, skip rows where the only non-empty specifier of 6651 the column view is @samp{ITEM}. 6652 6653 @item @samp{:exclude-tags} 6654 List of tags to exclude from column view table: entries with these 6655 tags will be excluded from the column view. 6656 6657 @item @samp{:indent} 6658 When non-@code{nil}, indent each @samp{ITEM} field according to its level. 6659 6660 @item @samp{:link} 6661 When non-@code{nil}, link the @samp{ITEM} headlines in the table to their 6662 origins. 6663 6664 @item @samp{:format} 6665 Specify a column attribute (see @ref{Column attributes}) for the dynamic 6666 block. 6667 6668 @item @samp{:formatter} 6669 @cindex @samp{formatter}, dynamic block parameter 6670 @vindex org-columns-dblock-formatter 6671 A function to format column view data and insert it into the buffer. 6672 See the option @code{org-columns-dblock-formatter}. 6673 @end table 6674 6675 The following commands insert or update the dynamic block: 6676 6677 @table @asis 6678 @item @code{org-columns-insert-dblock} 6679 @kindex C-c C-x x 6680 @findex org-columns-insert-dblock 6681 Insert a dynamic block capturing a column view. Prompt for the 6682 scope or ID of the view. 6683 6684 This command can be invoked by calling 6685 @code{org-dynamic-block-insert-dblock} (@kbd{C-c C-x x}) and 6686 selecting ``columnview'' (see @ref{Dynamic Blocks}). 6687 6688 @item @kbd{C-c C-c} @kbd{C-c C-x C-u} (@code{org-dblock-update}) 6689 @kindex C-c C-c 6690 @kindex C-c C-x C-u 6691 @findex org-dblock-update 6692 Update dynamic block at point. Point needs to be on the @samp{#+BEGIN} 6693 line of the dynamic block. 6694 6695 @item @kbd{C-u C-c C-x C-u} (@code{org-update-all-dblocks}) 6696 @kindex C-u C-c C-x C-u 6697 Update all dynamic blocks (see @ref{Dynamic Blocks}). This is useful if 6698 you have several clock table blocks, column-capturing blocks or 6699 other dynamic blocks in a buffer. 6700 @end table 6701 6702 You can add formulas to the column view table and you may add plotting 6703 instructions in front of the table---these survive an update of the 6704 block. If there is a @samp{TBLFM} keyword after the table, the table is 6705 recalculated automatically after an update. 6706 6707 An alternative way to capture and process property values into a table 6708 is provided by Eric Schulte's @samp{org-collector.el}, which is a package 6709 in @samp{org-contrib}@footnote{ Contributed packages are not part of Emacs, but 6710 are distributed with the main distribution of Org---visit 6711 @uref{https://orgmode.org}.}. It provides a general API to collect 6712 properties from entries in a certain scope, and arbitrary Lisp 6713 expressions to process these values before inserting them into a table 6714 or a dynamic block. 6715 6716 @node Dates and Times 6717 @chapter Dates and Times 6718 6719 @cindex dates 6720 @cindex times 6721 @cindex timestamp 6722 @cindex date stamp 6723 6724 To assist project planning, TODO items can be labeled with a date 6725 and/or a time. The specially formatted string carrying the date and 6726 time information is called a @emph{timestamp} in Org mode. This may be 6727 a little confusing because timestamp is often used as indicating when 6728 something was created or last changed. However, in Org mode this term 6729 is used in a much wider sense. 6730 6731 Timestamps can be used to plan appointments, schedule tasks, set 6732 deadlines, track time, and more. The following sections describe 6733 the timestamp format and tooling that Org mode provides for common 6734 use cases dealing with time and time intervals. 6735 6736 @menu 6737 * Timestamps:: Assigning a time to a tree entry. 6738 * Creating Timestamps:: Commands to insert timestamps. 6739 * Deadlines and Scheduling:: Planning your work. 6740 * Clocking Work Time:: Tracking how long you spend on a task. 6741 * Effort Estimates:: Planning work effort in advance. 6742 * Timers:: Notes with a running timer. 6743 @end menu 6744 6745 @node Timestamps 6746 @section Timestamps 6747 6748 @cindex timestamps 6749 @cindex ranges, time 6750 @cindex date stamps 6751 @cindex deadlines 6752 @cindex scheduling 6753 6754 A timestamp is a specification of a date---possibly with a time or 6755 time range---in a special format, either @samp{<2003-09-16 Tue>} or 6756 @samp{<2003-09-16 Tue 09:39>} or @samp{<2003-09-16 Tue 12:00-12:30>}@footnote{The Org date format is inspired by the standard ISO 8601 6757 date/time format. To use an alternative format, see @ref{Custom time format}. The day name is optional when you type the date yourself. 6758 However, any date inserted or modified by Org adds that day name, for 6759 reading convenience.}. 6760 A timestamp can appear anywhere in the headline or body of an Org tree 6761 entry. Its presence causes entries to be shown on specific dates in 6762 the agenda (see @ref{Weekly/daily agenda}). We distinguish: 6763 6764 @table @asis 6765 @item Plain timestamp; Event; Appointment 6766 @cindex timestamp 6767 @cindex appointment 6768 A simple timestamp just assigns a date/time to an item. This is 6769 just like writing down an appointment or event in a paper agenda. 6770 In the agenda display, the headline of an entry associated with 6771 a plain timestamp is shown exactly on that date. There can be 6772 multiple timestamps in an item. 6773 6774 @example 6775 * Meet Peter at the movies 6776 <2006-11-01 Wed 19:15> 6777 * Discussion on climate change 6778 <2006-11-02 Thu 10:00-12:00> 6779 * My days off 6780 <2006-11-03 Fri> 6781 <2006-11-06 Mon> 6782 @end example 6783 6784 @item Timestamp with repeater interval 6785 @cindex timestamp, with repeater interval 6786 A timestamp may contain a @emph{repeater interval}, indicating that it 6787 applies not only on the given date, but again and again after 6788 a certain interval of N hours (h), days (d), weeks (w), months (m), 6789 or years (y). The following shows up in the agenda every Wednesday: 6790 6791 @example 6792 * Pick up Sam at school 6793 <2007-05-16 Wed 12:30 +1w> 6794 @end example 6795 6796 @item Diary-style expression entries 6797 @cindex diary style timestamps 6798 @cindex sexp timestamps 6799 6800 @findex org-date 6801 @findex org-anniversary 6802 @findex org-cyclic 6803 @findex org-block 6804 6805 For more complex date specifications, Org mode supports using the 6806 special expression diary entries implemented in the 6807 @ref{Special Diary Entries,Emacs Calendar package,,emacs,}@footnote{When working with the standard diary expression functions, you 6808 need to be very careful with the order of the arguments. That order 6809 depends evilly on the variable @code{calendar-date-style}. For example, to 6810 specify a date December 1, 2005, the call might look like 6811 @samp{(diary-date 12 1 2005)} or @samp{(diary-date 1 12 2005)} or @samp{(diary-date 6812 2005 12 1)}, depending on the settings. This has been the source of 6813 much confusion. Org mode users can resort to special versions of 6814 these functions, namely @code{org-date}, @code{org-anniversary}, @code{org-cyclic}, and 6815 @code{org-block}. These work just like the corresponding @code{diary-} 6816 functions, but with stable ISO order of arguments (year, month, day) 6817 wherever applicable, independent of the value of 6818 @code{calendar-date-style}.}. 6819 For example, with optional time: 6820 6821 @example 6822 * 22:00-23:00 The nerd meeting on every 2nd Thursday of the month 6823 <%%(diary-float t 4 2) 22:00-23:00> 6824 @end example 6825 6826 @item Time range 6827 @cindex time range 6828 6829 Time range is a timestamp having two time units connected by @samp{-} 6830 6831 @example 6832 * Discussion on climate change 6833 <2006-11-02 Thu 10:00-12:00> 6834 @end example 6835 6836 @item Time/Date range 6837 @cindex time range 6838 @cindex timerange 6839 @cindex date range 6840 Two timestamps connected by @samp{--} denote a range. In the agenda, the 6841 headline is shown on the first and last day of the range, and on any 6842 dates that are displayed and fall in the range. The first example 6843 specifies just the dates of the range while the second example 6844 specifies a time range for each date. 6845 6846 @example 6847 ** Meeting in Amsterdam 6848 <2004-08-23 Mon>--<2004-08-26 Thu> 6849 ** This weeks committee meetings 6850 <2004-08-23 Mon 10:00-11:00>--<2004-08-26 Thu 10:00-11:00> 6851 @end example 6852 6853 @item Inactive timestamp 6854 @cindex timestamp, inactive 6855 @cindex inactive timestamp 6856 Just like a plain timestamp, but with square brackets instead of 6857 angular ones. These timestamps are inactive in the sense that they 6858 do @emph{not} trigger an entry to show up in the agenda. 6859 6860 @example 6861 * Gillian comes late for the fifth time 6862 [2006-11-01 Wed] 6863 @end example 6864 @end table 6865 6866 @node Creating Timestamps 6867 @section Creating Timestamps 6868 6869 For Org mode to recognize timestamps, they need to be in the specific 6870 format. All commands listed below produce timestamps in the correct 6871 format. 6872 6873 @table @asis 6874 @item @kbd{C-c .} (@code{org-timestamp}) 6875 @kindex C-c . 6876 @findex org-time-stamp 6877 @findex org-timestamp 6878 Prompt for a date and insert a corresponding timestamp. When point 6879 is at an existing timestamp in the buffer, the command is used to 6880 modify this timestamp instead of inserting a new one. When this 6881 command is used twice in succession, a time range is inserted. 6882 6883 @kindex C-u C-c . 6884 @vindex org-time-stamp-rounding-minutes 6885 @vindex org-timestamp-rounding-minutes 6886 When called with a prefix argument, use the alternative format which 6887 contains date and time. The default time can be rounded to 6888 multiples of 5 minutes. See the option 6889 @code{org-timestamp-rounding-minutes}. 6890 6891 @kindex C-u C-u C-c . 6892 With two prefix arguments, insert an active timestamp with the 6893 current time without prompting. 6894 6895 @item @kbd{C-c !} (@code{org-timestamp-inactive}) 6896 @kindex C-c ! 6897 @kindex C-u C-c ! 6898 @kindex C-u C-u C-c ! 6899 @findex org-time-stamp-inactive 6900 @findex org-timestamp-inactive 6901 Like @kbd{C-c .}, but insert an inactive timestamp that does 6902 not cause an agenda entry. 6903 6904 @item @kbd{C-c C-c} 6905 @kindex C-c C-c 6906 Normalize timestamp, insert or fix day name if missing or wrong. 6907 6908 @item @kbd{C-c <} (@code{org-date-from-calendar}) 6909 @kindex C-c < 6910 @findex org-date-from-calendar 6911 Insert a timestamp corresponding to point date in the calendar. 6912 6913 @item @kbd{C-c >} (@code{org-goto-calendar}) 6914 @kindex C-c > 6915 @findex org-goto-calendar 6916 Access the Emacs calendar for the current date. If there is 6917 a timestamp in the current line, go to the corresponding date 6918 instead. 6919 6920 @item @kbd{C-c C-o} (@code{org-open-at-point}) 6921 @kindex C-c C-o 6922 @findex org-open-at-point 6923 Access the agenda for the date given by the timestamp or -range at 6924 point (see @ref{Weekly/daily agenda}). 6925 6926 @item @kbd{S-@key{LEFT}} (@code{org-timestamp-down-day}) 6927 @itemx @kbd{S-@key{RIGHT}} (@code{org-timestamp-up-day}) 6928 @kindex S-LEFT 6929 @kindex S-RIGHT 6930 @findex org-timestamp-down-day 6931 @findex org-timestamp-up-day 6932 Change date at point by one day. These key bindings conflict with 6933 shift-selection and related modes (see @ref{Conflicts}). 6934 6935 @item @kbd{S-@key{UP}} (@code{org-timestamp-up}) 6936 @itemx @kbd{S-@key{DOWN}} (@code{org-timestamp-down}) 6937 @kindex S-UP 6938 @kindex S-DOWN 6939 On the beginning or enclosing bracket of a timestamp, change its 6940 type. Within a timestamp, change the item under point. Point can 6941 be on a year, month, day, hour or minute. When the timestamp 6942 contains a time range like @samp{15:30-16:30}, modifying the first time 6943 also shifts the second, shifting the time block with constant 6944 length. To change the length, modify the second time. Note that if 6945 point is in a headline and not at a timestamp, these same keys 6946 modify the priority of an item (see @ref{Priorities}). The key bindings 6947 also conflict with shift-selection and related modes (see @ref{Conflicts}). 6948 6949 @item @kbd{C-c C-y} (@code{org-evaluate-time-range}) 6950 @kindex C-c C-y 6951 @findex org-evaluate-time-range 6952 @cindex evaluate time range 6953 Evaluate a time range by computing the difference between start and 6954 end. With a prefix argument, insert result after the time range (in 6955 a table: into the following column). 6956 @end table 6957 6958 @menu 6959 * The date/time prompt:: How Org mode helps you enter dates and times. 6960 * Custom time format:: Making dates look different. 6961 @end menu 6962 6963 @node The date/time prompt 6964 @subsection The date/time prompt 6965 6966 @cindex date, reading in minibuffer 6967 @cindex time, reading in minibuffer 6968 6969 @vindex org-read-date-prefer-future 6970 When Org mode prompts for a date/time, the default is shown in default 6971 date/time format, and the prompt therefore seems to ask for a specific 6972 format. But it in fact accepts date/time information in a variety of 6973 formats. Generally, the information should start at the beginning of 6974 the string. Org mode finds whatever information is in there and 6975 derives anything you have not specified from the @emph{default date and 6976 time}. The default is usually the current date and time, but when 6977 modifying an existing timestamp, or when entering the second stamp of 6978 a range, it is taken from the stamp in the buffer. When filling in 6979 information, Org mode assumes that most of the time you want to enter 6980 a date in the future: if you omit the month/year and the given 6981 day/month is @emph{before} today, it assumes that you mean a future 6982 date@footnote{See the variable @code{org-read-date-prefer-future}. You may set 6983 that variable to the symbol @code{time} to even make a time before now 6984 shift the date to tomorrow.}. If the date has been automatically shifted into the 6985 future, the time prompt shows this with @samp{(=>F)}. 6986 6987 For example, let's assume that today is @strong{June 13, 2006}. Here is how 6988 various inputs are interpreted, the items filled in by Org mode are in 6989 @strong{bold}. 6990 6991 @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 6992 @item @samp{3-2-5} 6993 @tab @result{} 2003-02-05 6994 @item @samp{2/5/3} 6995 @tab @result{} 2003-02-05 6996 @item @samp{14} 6997 @tab @result{} @strong{2006}-@strong{06}-14 6998 @item @samp{12} 6999 @tab @result{} @strong{2006}-@strong{07}-12 7000 @item @samp{2/5} 7001 @tab @result{} @strong{2007}-02-05 7002 @item @samp{Fri} 7003 @tab @result{} nearest Friday (default date or later) 7004 @item @samp{sep 15} 7005 @tab @result{} @strong{2006}-09-15 7006 @item @samp{feb 15} 7007 @tab @result{} @strong{2007}-02-15 7008 @item @samp{sep 12 9} 7009 @tab @result{} 2009-09-12 7010 @item @samp{12:45} 7011 @tab @result{} @strong{2006}-@strong{06}-@strong{13} 12:45 7012 @item @samp{22 sept 0:34} 7013 @tab @result{} @strong{2006}-09-22 0:34 7014 @item @samp{w4} 7015 @tab @result{} ISO week for of the current year @strong{2006} 7016 @item @samp{2012 w4 fri} 7017 @tab @result{} Friday of ISO week 4 in 2012 7018 @item @samp{2012-w04-5} 7019 @tab @result{} Same as above 7020 @end multitable 7021 7022 Furthermore you can specify a relative date by giving, as the @emph{first} 7023 thing in the input: a plus/minus sign, a number and a letter---@samp{h}, 7024 @samp{d}, @samp{w}, @samp{m} or @samp{y}---to indicate a change in hours, days, weeks, 7025 months, or years. With @samp{h} the date is relative to the current time, 7026 with the other letters and a single plus or minus, the date is 7027 relative to today at 00:00. With a double plus or minus, it is 7028 relative to the default date. If instead of a single letter, you use 7029 the abbreviation of day name, the date is the Nth such day, e.g.: 7030 7031 @multitable {aaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 7032 @item @samp{+0} 7033 @tab @result{} today 7034 @item @samp{.} 7035 @tab @result{} today 7036 @item @samp{+2h} 7037 @tab @result{} two hours from now 7038 @item @samp{+4d} 7039 @tab @result{} four days from today 7040 @item @samp{+4} 7041 @tab @result{} same as +4d 7042 @item @samp{+2w} 7043 @tab @result{} two weeks from today 7044 @item @samp{++5} 7045 @tab @result{} five days from default date 7046 @item @samp{+2tue} 7047 @tab @result{} second Tuesday from now 7048 @end multitable 7049 7050 @vindex parse-time-months 7051 @vindex parse-time-weekdays 7052 The function understands English month and weekday abbreviations. If 7053 you want to use un-abbreviated names and/or other languages, configure 7054 the variables @code{parse-time-months} and @code{parse-time-weekdays}. 7055 7056 @vindex org-read-date-force-compatible-dates 7057 Not all dates can be represented in a given Emacs implementation. By 7058 default Org mode forces dates into the compatibility range 1970--2037 7059 which works on all Emacs implementations. If you want to use dates 7060 outside of this range, read the docstring of the variable 7061 @code{org-read-date-force-compatible-dates}. 7062 7063 You can specify a time range by giving start and end times or by 7064 giving a start time and a duration (in HH:MM format). Use one or two 7065 dash(es) as the separator in the former case and use @samp{+} as the 7066 separator in the latter case, e.g.: 7067 7068 @multitable {aaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaa} 7069 @item @samp{11am-1:15pm} 7070 @tab @result{} 11:00-13:15 7071 @item @samp{11h-13h15} 7072 @tab @result{} same as above 7073 @item @samp{11am--1:15pm} 7074 @tab @result{} same as above 7075 @item @samp{11am+2:15} 7076 @tab @result{} same as above 7077 @end multitable 7078 7079 @cindex calendar, for selecting date 7080 @vindex org-popup-calendar-for-date-prompt 7081 Parallel to the minibuffer prompt, a calendar is popped up@footnote{ If you 7082 do not need/want the calendar, configure the variable 7083 @code{org-popup-calendar-for-date-prompt}.}. When you exit the date 7084 prompt, either by clicking on a date in the calendar, or by pressing 7085 @kbd{@key{RET}}, the date selected in the calendar is combined with the 7086 information entered at the prompt. You can control the calendar fully 7087 from the minibuffer: 7088 7089 @kindex < 7090 @kindex > 7091 @kindex M-v 7092 @kindex C-v 7093 @kindex mouse-1 7094 @kindex S-RIGHT 7095 @kindex S-LEFT 7096 @kindex S-DOWN 7097 @kindex S-UP 7098 @kindex M-S-RIGHT 7099 @kindex M-S-LEFT 7100 @kindex RET 7101 @kindex . 7102 @kindex C-. 7103 @multitable @columnfractions 0.25 0.55 7104 @item @kbd{@key{RET}} 7105 @tab Choose date at point in calendar. 7106 @item @kbd{mouse-1} 7107 @tab Select date by clicking on it. 7108 @item @kbd{S-@key{RIGHT}} 7109 @tab One day forward. 7110 @item @kbd{S-@key{LEFT}} 7111 @tab One day backward. 7112 @item @kbd{S-@key{DOWN}} 7113 @tab One week forward. 7114 @item @kbd{S-@key{UP}} 7115 @tab One week backward. 7116 @item @kbd{M-S-@key{RIGHT}} 7117 @tab One month forward. 7118 @item @kbd{M-S-@key{LEFT}} 7119 @tab One month backward. 7120 @item @kbd{>} 7121 @tab Scroll calendar forward by one month. 7122 @item @kbd{<} 7123 @tab Scroll calendar backward by one month. 7124 @item @kbd{M-v} 7125 @tab Scroll calendar forward by 3 months. 7126 @item @kbd{C-v} 7127 @tab Scroll calendar backward by 3 months. 7128 @item @kbd{C-.} 7129 @tab Select today's date@footnote{You can also use the calendar command @kbd{.} to jump to 7130 today's date, but if you are inserting an hour specification for your 7131 timestamp, @kbd{.} will then insert a dot after the hour. By contrast, 7132 @kbd{C-.} will always jump to today's date.} 7133 @end multitable 7134 7135 @vindex org-read-date-display-live 7136 The actions of the date/time prompt may seem complex, but I assure you 7137 they will grow on you, and you will start getting annoyed by pretty 7138 much any other way of entering a date/time out there. To help you 7139 understand what is going on, the current interpretation of your input 7140 is displayed live in the minibuffer@footnote{ If you find this distracting, 7141 turn off the display with @code{org-read-date-display-live}.}. 7142 7143 @node Custom time format 7144 @subsection Custom time format 7145 7146 @cindex custom date/time format 7147 @cindex time format, custom 7148 @cindex date format, custom 7149 7150 @vindex org-display-custom-times 7151 @vindex org-time-stamp-custom-formats 7152 @vindex org-timestamp-custom-formats 7153 Org mode uses the standard ISO notation for dates and times as it is 7154 defined in ISO 8601. If you cannot get used to this and require 7155 another representation of date and time to keep you happy, you can get 7156 it by customizing the variables @code{org-display-custom-times} and 7157 @code{org-timestamp-custom-formats}. 7158 7159 @table @asis 7160 @item @kbd{C-c C-x C-t} (@code{org-toggle-timestamp-overlays}) 7161 @kindex C-c C-x C-t 7162 @findex org-toggle-time-stamp-overlays 7163 @findex org-toggle-timestamp-overlays 7164 Toggle the display of custom formats for dates and times. 7165 @end table 7166 7167 Org mode needs the default format for scanning, so the custom 7168 date/time format does not @emph{replace} the default format. Instead, it 7169 is put @emph{over} the default format using text properties. This has the 7170 following consequences: 7171 7172 @itemize 7173 @item 7174 You cannot place point onto a timestamp anymore, only before or 7175 after. 7176 7177 @item 7178 The @kbd{S-@key{UP}} and @kbd{S-@key{DOWN}} keys can no longer be used 7179 to adjust each component of a timestamp. If point is at the 7180 beginning of the stamp, @kbd{S-@key{UP}} and @kbd{S-@key{DOWN}} change 7181 the stamp by one day, just like @kbd{S-@key{LEFT}} 7182 @kbd{S-@key{RIGHT}}. At the end of the stamp, change the time by one 7183 minute. 7184 7185 @item 7186 If the timestamp contains a range of clock times or a repeater, 7187 these are not overlaid, but remain in the buffer as they were. 7188 7189 @item 7190 When you delete a timestamp character-by-character, it only 7191 disappears from the buffer after @emph{all} (invisible) characters 7192 belonging to the ISO timestamp have been removed. 7193 7194 @item 7195 If the custom timestamp format is longer than the default and you 7196 are using dates in tables, table alignment will be messed up. If 7197 the custom format is shorter, things do work as expected. 7198 @end itemize 7199 7200 @node Deadlines and Scheduling 7201 @section Deadlines and Scheduling 7202 7203 A timestamp may be preceded by special keywords to facilitate 7204 planning. Both the timestamp and the keyword have to be positioned 7205 immediately after the task they refer to. 7206 7207 @table @asis 7208 @item @samp{DEADLINE} 7209 @cindex @samp{DEADLINE} marker 7210 Meaning: the task---most likely a TODO item, though not 7211 necessarily---is supposed to be finished on that date. 7212 7213 @vindex org-deadline-warning-days 7214 On the deadline date, the task is listed in the agenda. In 7215 addition, the agenda for @emph{today} carries a warning about the 7216 approaching or missed deadline, starting @code{org-deadline-warning-days} 7217 before the due date, and continuing until the entry is marked as 7218 done. An example: 7219 7220 @example 7221 *** TODO write article about the Earth for the Guide 7222 DEADLINE: <2004-02-29 Sun> 7223 The editor in charge is [[bbdb:Ford Prefect]] 7224 @end example 7225 7226 @vindex org-agenda-skip-deadline-prewarning-if-scheduled 7227 You can specify a different lead time for warnings for a specific 7228 deadlines using the following syntax. Here is an example with 7229 a warning period of 5 days @samp{DEADLINE: <2004-02-29 Sun -5d>}. This 7230 warning is deactivated if the task gets scheduled and you set 7231 @code{org-agenda-skip-deadline-prewarning-if-scheduled} to @code{t}. 7232 7233 @item @samp{SCHEDULED} 7234 @cindex @samp{SCHEDULED} marker 7235 Meaning: you are planning to start working on that task on the given 7236 date. 7237 7238 @vindex org-agenda-skip-scheduled-if-done 7239 The headline is listed under the given date@footnote{It will still be listed on that date after it has been marked 7240 as done. If you do not like this, set the variable 7241 @code{org-agenda-skip-scheduled-if-done}.}. In addition, 7242 a reminder that the scheduled date has passed is present in the 7243 compilation for @emph{today}, until the entry is marked as done, i.e., 7244 the task is automatically forwarded until completed. 7245 7246 @example 7247 *** TODO Call Trillian for a date on New Years Eve. 7248 SCHEDULED: <2004-12-25 Sat> 7249 @end example 7250 7251 @vindex org-scheduled-delay-days 7252 @vindex org-agenda-skip-scheduled-delay-if-deadline 7253 If you want to @emph{delay} the display of this task in the agenda, use 7254 @samp{SCHEDULED: <2004-12-25 Sat -2d>}: the task is still scheduled on 7255 the 25th but will appear two days later. In case the task contains 7256 a repeater, the delay is considered to affect all occurrences; if 7257 you want the delay to only affect the first scheduled occurrence of 7258 the task, use @samp{--2d} instead. See @code{org-scheduled-delay-days} and 7259 @code{org-agenda-skip-scheduled-delay-if-deadline} for details on how to 7260 control this globally or per agenda. 7261 7262 @quotation Important 7263 Scheduling an item in Org mode should @emph{not} be understood in the 7264 same way that we understand @emph{scheduling a meeting}. Setting a date 7265 for a meeting is just a simple appointment, you should mark this 7266 entry with a simple plain timestamp, to get this item shown on the 7267 date where it applies. This is a frequent misunderstanding by Org 7268 users. In Org mode, @emph{scheduling} means setting a date when you want 7269 to start working on an action item. 7270 7271 @end quotation 7272 @end table 7273 7274 You may use timestamps with repeaters in scheduling and deadline 7275 entries. Org mode issues early and late warnings based on the 7276 assumption that the timestamp represents the @emph{nearest instance} of the 7277 repeater. However, the use of diary expression entries like 7278 7279 @example 7280 <%%(diary-float t 42)> 7281 @end example 7282 7283 7284 @noindent 7285 in scheduling and deadline timestamps is limited. Org mode does not 7286 know enough about the internals of each function to issue early and 7287 late warnings. However, it shows the item on each day where the 7288 expression entry matches. 7289 7290 @menu 7291 * Inserting deadline/schedule:: Planning items. 7292 * Repeated tasks:: Items that show up again and again. 7293 @end menu 7294 7295 @node Inserting deadline/schedule 7296 @subsection Inserting deadlines or schedules 7297 7298 The following commands allow you to quickly insert a deadline or to 7299 schedule an item:@footnote{The @samp{SCHEDULED} and @samp{DEADLINE} dates are inserted on the line 7300 right below the headline. Do not put any text between this line and 7301 the headline.} 7302 7303 @table @asis 7304 @item @kbd{C-c C-d} (@code{org-deadline}) 7305 @kindex C-c C-d 7306 @findex org-deadline 7307 @vindex org-log-redeadline 7308 Insert @samp{DEADLINE} keyword along with a stamp. The insertion happens 7309 in the line directly following the headline. Remove any @samp{CLOSED} 7310 timestamp . When called with a prefix argument, also remove any 7311 existing deadline from the entry. Depending on the variable 7312 @code{org-log-redeadline}, take a note when changing an existing 7313 deadline@footnote{ Note the corresponding @samp{STARTUP} options 7314 @samp{logredeadline}, @samp{lognoteredeadline}, and @samp{nologredeadline}.}. 7315 7316 @item @kbd{C-c C-s} (@code{org-schedule}) 7317 @kindex C-c C-s 7318 @findex org-schedule 7319 @vindex org-log-reschedule 7320 Insert @samp{SCHEDULED} keyword along with a stamp. The insertion 7321 happens in the line directly following the headline. Remove any 7322 @samp{CLOSED} timestamp. When called with a prefix argument, also remove 7323 the scheduling date from the entry. Depending on the variable 7324 @code{org-log-reschedule}, take a note when changing an existing 7325 scheduling time@footnote{ Note the corresponding @samp{STARTUP} options 7326 @samp{logreschedule}, @samp{lognotereschedule}, and @samp{nologreschedule}.}. 7327 7328 @item @kbd{C-c / d} (@code{org-check-deadlines}) 7329 @kindex C-c / d 7330 @findex org-check-deadlines 7331 @cindex sparse tree, for deadlines 7332 @vindex org-deadline-warning-days 7333 Create a sparse tree with all deadlines that are either past-due, or 7334 which will become due within @code{org-deadline-warning-days}. With 7335 @kbd{C-u} prefix, show all deadlines in the file. With 7336 a numeric prefix, check that many days. For example, @kbd{C-1 C-c / d} shows all deadlines due tomorrow. 7337 7338 @item @kbd{C-c / b} (@code{org-check-before-date}) 7339 @kindex C-c / b 7340 @findex org-check-before-date 7341 Sparse tree for deadlines and scheduled items before a given date. 7342 7343 @item @kbd{C-c / a} (@code{org-check-after-date}) 7344 @kindex C-c / a 7345 @findex org-check-after-date 7346 Sparse tree for deadlines and scheduled items after a given date. 7347 @end table 7348 7349 Note that @code{org-schedule} and @code{org-deadline} supports setting the date 7350 by indicating a relative time e.g., @samp{+1d} sets the date to the next 7351 day after today, and @samp{--1w} sets the date to the previous week before 7352 any current timestamp. 7353 7354 @node Repeated tasks 7355 @subsection Repeated tasks 7356 7357 @cindex tasks, repeated 7358 @cindex repeated tasks 7359 7360 Some tasks need to be repeated again and again. Org mode helps to 7361 organize such tasks using a so-called repeater in a @samp{DEADLINE}, 7362 @samp{SCHEDULED}, or plain timestamps@footnote{Org does not repeat inactive timestamps, however. See 7363 @ref{Timestamps}.}. In the following example: 7364 7365 @example 7366 ** TODO Pay the rent 7367 DEADLINE: <2005-10-01 Sat +1m> 7368 @end example 7369 7370 @noindent 7371 the @samp{+1m} is a repeater; the intended interpretation is that the task 7372 has a deadline on @samp{<2005-10-01>} and repeats itself every (one) month 7373 starting from that time. You can use yearly, monthly, weekly, daily 7374 and hourly repeat cookies by using the @samp{y}, @samp{m}, @samp{w}, @samp{d} and @samp{h} 7375 letters. If you need both a repeater and a special warning period in 7376 a deadline entry, the repeater should come first and the warning 7377 period last 7378 7379 @example 7380 DEADLINE: <2005-10-01 Sat +1m -3d> 7381 @end example 7382 7383 7384 @vindex org-todo-repeat-to-state 7385 Deadlines and scheduled items produce entries in the agenda when they 7386 are over-due, so it is important to be able to mark such an entry as 7387 done once you have done so. When you mark a @samp{DEADLINE} or a 7388 @samp{SCHEDULED} with the TODO keyword @samp{DONE}, it no longer produces 7389 entries in the agenda. The problem with this is, however, is that 7390 then also the @emph{next} instance of the repeated entry will not be 7391 active. Org mode deals with this in the following way: when you try 7392 to mark such an entry as done, using @kbd{C-c C-t}, it shifts the 7393 base date of the repeating timestamp by the repeater interval, and 7394 immediately sets the entry state back to TODO@footnote{ In fact, the target 7395 state is taken from, in this sequence, the @samp{REPEAT_TO_STATE} property, 7396 the variable @code{org-todo-repeat-to-state} if it is a string, the 7397 previous TODO state if @code{org-todo-repeat-to-state} is @code{t}, or the first 7398 state of the TODO state sequence.}. In the example above, setting the 7399 state to @samp{DONE} would actually switch the date like this: 7400 7401 @example 7402 ** TODO Pay the rent 7403 DEADLINE: <2005-11-01 Tue +1m> 7404 @end example 7405 7406 When task contains multiple timestamps with repeater interval, all 7407 these timestamps are shifted. 7408 7409 To mark a task with a repeater as DONE, use @kbd{C-- 1 C-c C-t}, 7410 i.e., @code{org-todo} with a numeric prefix argument of @samp{-1}. 7411 7412 @vindex org-log-repeat 7413 A timestamp@footnote{You can change this using the option @code{org-log-repeat}, or the 7414 @samp{STARTUP} options @samp{logrepeat}, @samp{lognoterepeat}, and @samp{nologrepeat}. 7415 With @samp{lognoterepeat}, you will also be prompted for a note.} is added under the deadline, to keep a record that 7416 you actually acted on the previous instance of this deadline. 7417 7418 As a consequence of shifting the base date, this entry is no longer 7419 visible in the agenda when checking past dates, but all future 7420 instances will be visible. 7421 7422 With the @samp{+1m} cookie, the date shift is always exactly one month. So 7423 if you have not paid the rent for three months, marking this entry 7424 DONE still keeps it as an overdue deadline. Depending on the task, 7425 this may not be the best way to handle it. For example, if you forgot 7426 to call your father for 3 weeks, it does not make sense to call him 7427 3 times in a single day to make up for it. Finally, there are tasks, 7428 like changing batteries, which should always repeat a certain time 7429 @emph{after} the last time you did it. For these tasks, Org mode has 7430 special repeaters @samp{++} and @samp{.+}. For example: 7431 7432 @example 7433 ** TODO Call Father 7434 DEADLINE: <2008-02-10 Sun ++1w> 7435 Marking this DONE shifts the date by at least one week, but also 7436 by as many weeks as it takes to get this date into the future. 7437 However, it stays on a Sunday, even if you called and marked it 7438 done on Saturday. 7439 7440 ** TODO Empty kitchen trash 7441 DEADLINE: <2008-02-08 Fri 20:00 ++1d> 7442 Marking this DONE shifts the date by at least one day, and also 7443 by as many days as it takes to get the timestamp into the future. 7444 Since there is a time in the timestamp, the next deadline in the 7445 future will be on today's date if you complete the task before 7446 20:00. 7447 7448 ** TODO Check the batteries in the smoke detectors 7449 DEADLINE: <2005-11-01 Tue .+1m> 7450 Marking this DONE shifts the date to one month after today. 7451 7452 ** TODO Wash my hands 7453 DEADLINE: <2019-04-05 08:00 Fri .+1h> 7454 Marking this DONE shifts the date to exactly one hour from now. 7455 @end example 7456 7457 @vindex org-agenda-skip-scheduled-repeats-after-deadline 7458 You may have both scheduling and deadline information for a specific 7459 task. If the repeater is set for the scheduling information only, you 7460 probably want the repeater to be ignored after the deadline. If so, 7461 set the variable @code{org-agenda-skip-scheduled-repeats-after-deadline} to 7462 @code{t}. However, any scheduling information without a repeater is no 7463 longer relevant once the task is done, and thus, removed upon 7464 repeating the task. If you want both scheduling and deadline 7465 information to repeat after the same interval, set the same repeater 7466 for both timestamps. 7467 7468 An alternative to using a repeater is to create a number of copies of 7469 a task subtree, with dates shifted in each copy. The command 7470 @kbd{C-c C-x c} was created for this purpose; it is described in 7471 @ref{Structure Editing}. 7472 7473 @node Clocking Work Time 7474 @section Clocking Work Time 7475 7476 @cindex clocking time 7477 @cindex time clocking 7478 7479 Org mode allows you to clock the time you spend on specific tasks in 7480 a project. When you start working on an item, you can start the 7481 clock. When you stop working on that task, or when you mark the task 7482 done, the clock is stopped and the corresponding time interval is 7483 recorded. It also computes the total time spent on each 7484 subtree@footnote{Clocking only works if all headings are indented with less 7485 than 30 stars. This is a hard-coded limitation of @code{lmax} in 7486 @code{org-clock-sum}.} of a project. And it remembers a history or tasks 7487 recently clocked, so that you can jump quickly between a number of 7488 tasks absorbing your time. 7489 7490 To save the clock history across Emacs sessions, use: 7491 7492 @lisp 7493 (setq org-clock-persist 'history) 7494 (org-clock-persistence-insinuate) 7495 @end lisp 7496 7497 @vindex org-clock-persist 7498 When you clock into a new task after resuming Emacs, the incomplete 7499 clock@footnote{ To resume the clock under the assumption that you have 7500 worked on this task while outside Emacs, use @samp{(setq org-clock-persist 7501 t)}.} is retrieved (see @ref{Resolving idle time (1)}) and you are prompted 7502 about what to do with it. 7503 7504 @menu 7505 * Clocking commands:: Starting and stopping a clock. 7506 * The clock table:: Detailed reports. 7507 * Resolving idle time:: Resolving time when you've been idle. 7508 @end menu 7509 7510 @node Clocking commands 7511 @subsection Clocking commands 7512 7513 @table @asis 7514 @item @kbd{C-c C-x C-i} (@code{org-clock-in}) 7515 @kindex C-c C-x C-i 7516 @findex org-clock-in 7517 @vindex org-clock-into-drawer 7518 @vindex org-clock-continuously 7519 @cindex @samp{LOG_INTO_DRAWER}, property 7520 Start the clock on the current item (clock-in). This inserts the 7521 @samp{CLOCK} keyword together with a timestamp. If this is not the first 7522 clocking of this item, the multiple @samp{CLOCK} lines are wrapped into 7523 a @samp{LOGBOOK} drawer (see also the variable @code{org-clock-into-drawer}). 7524 You can also overrule the setting of this variable for a subtree by 7525 setting a @samp{CLOCK_INTO_DRAWER} or @samp{LOG_INTO_DRAWER} property. When 7526 called with a @kbd{C-u} prefix argument, select the task from 7527 a list of recently clocked tasks. With two @kbd{C-u C-u} 7528 prefixes, clock into the task at point and mark it as the default 7529 task; the default task is always be available with letter 7530 @kbd{d} when selecting a clocking task. With three @kbd{C-u C-u C-u} prefixes, force continuous clocking by starting the 7531 clock when the last clock stopped. 7532 7533 @cindex @samp{CLOCK_MODELINE_TOTAL}, property 7534 @cindex @samp{LAST_REPEAT}, property 7535 @vindex org-clock-mode-line-total 7536 @vindex org-clock-in-prepare-hook 7537 While the clock is running, Org shows the current clocking time in 7538 the mode line, along with the title of the task. The clock time 7539 shown is all time ever clocked for this task and its children. If 7540 the task has an effort estimate (see @ref{Effort Estimates}), the 7541 mode line displays the current clocking time against it@footnote{ To add 7542 an effort estimate ``on the fly'', hook a function doing this to 7543 @code{org-clock-in-prepare-hook}.}. If the task is a repeating one (see 7544 @ref{Repeated tasks}), show only the time since the last reset of the 7545 task@footnote{ The last reset of the task is recorded by the 7546 @samp{LAST_REPEAT} property.}. You can exercise more control over show 7547 time with the @samp{CLOCK_MODELINE_TOTAL} property. It may have the 7548 values @samp{current} to show only the current clocking instance, @samp{today} 7549 to show all time clocked on this tasks today---see also the variable 7550 @code{org-extend-today-until}, @code{all} to include all time, or @code{auto} which 7551 is the default@footnote{ See also the variable 7552 @code{org-clock-mode-line-total}.}. Clicking with @kbd{mouse-1} 7553 onto the mode line entry pops up a menu with clocking options. 7554 7555 @item @kbd{C-c C-x C-o} (@code{org-clock-out}) 7556 @kindex C-c C-x C-o 7557 @findex org-clock-out 7558 @vindex org-log-note-clock-out 7559 Stop the clock (clock-out). This inserts another timestamp at the 7560 same location where the clock was last started. It also directly 7561 computes the resulting time in inserts it after the time range as 7562 @samp{=>HH:MM}. See the variable @code{org-log-note-clock-out} for the 7563 possibility to record an additional note together with the clock-out 7564 timestamp@footnote{ The corresponding in-buffer setting is: @samp{#+STARTUP: 7565 lognoteclock-out}.}. 7566 7567 @item @kbd{C-c C-x C-x} (@code{org-clock-in-last}) 7568 @kindex C-c C-x C-x 7569 @findex org-clock-in-last 7570 @vindex org-clock-continuously 7571 Re-clock the last clocked task. With one @kbd{C-u} prefix 7572 argument, select the task from the clock history. With two 7573 @kbd{C-u} prefixes, force continuous clocking by starting the 7574 clock when the last clock stopped. 7575 7576 @item @kbd{C-c C-x C-e} (@code{org-clock-modify-effort-estimate}) 7577 @kindex C-c C-x C-e 7578 @findex org-clock-modify-effort-estimate 7579 Update the effort estimate for the current clock task. 7580 7581 @item @kbd{C-c C-c} or @kbd{C-c C-y} (@code{org-evaluate-time-range}) 7582 @kindex C-c C-c 7583 @kindex C-c C-y 7584 @findex org-evaluate-time-range 7585 Recompute the time interval after changing one of the timestamps. 7586 This is only necessary if you edit the timestamps directly. If you 7587 change them with @kbd{S-<cursor>} keys, the update is 7588 automatic. 7589 7590 @item @kbd{C-S-@key{UP}} (@code{org-clock-timestamps-up}) 7591 @itemx @kbd{C-S-@key{DOWN}} (@code{org-clock-timestamps-down}) 7592 @kindex C-S-UP 7593 @findex org-clock-timestamps-up 7594 @findex org-shiftcontrolup 7595 @kindex C-S-DOWN 7596 @findex org-clock-timestamps-down 7597 @findex org-shiftcontroldown 7598 On CLOCK log lines, increase/decrease both timestamps so that the 7599 clock duration keeps the same value. 7600 7601 @item @kbd{S-M-@key{UP}} (@code{org-timestamp-up}) 7602 @itemx @kbd{S-M-@key{DOWN}} (@code{org-timestamp-down}) 7603 @kindex S-M-UP 7604 @findex org-timestamp-up 7605 @findex org-shiftmetaup 7606 @kindex S-M-DOWN 7607 @findex org-timestamp-down 7608 @findex org-shiftmetadown 7609 On @samp{CLOCK} log lines, increase/decrease the timestamp at point and 7610 the one of the previous, or the next, clock timestamp by the same 7611 duration. For example, if you hit @kbd{S-M-@key{UP}} to increase 7612 a clocked-out timestamp by five minutes, then the clocked-in 7613 timestamp of the next clock is increased by five minutes. 7614 7615 Only @samp{CLOCK} logs created during current Emacs session are 7616 considered when adjusting next/previous timestamp. 7617 7618 @item @kbd{C-c C-t} (@code{org-todo}) 7619 @kindex C-c C-t 7620 @findex org-todo 7621 Changing the TODO state of an item to DONE automatically stops the 7622 clock if it is running in this same item. 7623 7624 @item @kbd{C-c C-x C-q} (@code{org-clock-cancel}) 7625 @kindex C-c C-x C-q 7626 @findex org-clock-cancel 7627 Cancel the current clock. This is useful if a clock was started by 7628 mistake, or if you ended up working on something else. 7629 7630 @item @kbd{C-c C-x C-j} (@code{org-clock-goto}) 7631 @kindex C-c C-x C-j 7632 @findex or-clock-goto 7633 Jump to the headline of the currently clocked in task. With 7634 a @kbd{C-u} prefix argument, select the target task from a list 7635 of recently clocked tasks. 7636 7637 @item @kbd{C-c C-x C-d} (@code{org-clock-display}) 7638 @kindex C-c C-x C-d 7639 @findex org-clock-display 7640 @vindex org-remove-highlights-with-change 7641 Display time summaries for each subtree in the current buffer. This 7642 puts overlays at the end of each headline, showing the total time 7643 recorded under that heading, including the time of any subheadings. 7644 You can use visibility cycling to study the tree, but the overlays 7645 disappear when you change the buffer (see variable 7646 @code{org-remove-highlights-with-change}) or press @kbd{C-c C-c}. 7647 @end table 7648 7649 The @kbd{l} key may be used in the agenda (see @ref{Weekly/daily agenda}) to show which tasks have been worked on or closed during 7650 a day. 7651 7652 @strong{Important:} note that both @code{org-clock-out} and @code{org-clock-in-last} 7653 can have a global keybinding and do not modify the window disposition. 7654 7655 @node The clock table 7656 @subsection The clock table 7657 7658 @cindex clocktable, dynamic block 7659 @cindex report, of clocked time 7660 7661 Org mode can produce quite complex reports based on the time clocking 7662 information. Such a report is called a @emph{clock table}, because it is 7663 formatted as one or several Org tables. 7664 7665 @table @asis 7666 @item @code{org-clock-report} 7667 @kindex C-c C-x x 7668 @findex org-clock-report 7669 Insert or update a clock table. When called with a prefix argument, 7670 jump to the first clock table in the current document and update it. 7671 The clock table includes archived trees. 7672 7673 This command can be invoked by calling 7674 @code{org-dynamic-block-insert-dblock} (@kbd{C-c C-x x}) and 7675 selecting ``clocktable'' (see @ref{Dynamic Blocks}). 7676 7677 @item @kbd{C-c C-c} or @kbd{C-c C-x C-u} (@code{org-dblock-update}) 7678 @kindex C-c C-c 7679 @kindex C-c C-x C-u 7680 @findex org-dblock-update 7681 Update dynamic block at point. Point needs to be in the @samp{BEGIN} 7682 line of the dynamic block. 7683 7684 @item @kbd{C-u C-c C-x C-u} 7685 @kindex C-u C-c C-x C-u 7686 Update all dynamic blocks (see @ref{Dynamic Blocks}). This is useful if 7687 you have several clock table blocks in a buffer. 7688 7689 @item @kbd{S-@key{LEFT}} 7690 @itemx @kbd{S-@key{RIGHT}} (@code{org-clocktable-try-shift}) 7691 @kindex S-LEFT 7692 @kindex S-RIGHT 7693 @findex org-clocktable-try-shift 7694 Shift the current @samp{:block} interval and update the table. Point 7695 needs to be in the @samp{#+BEGIN: clocktable} line for this command. If 7696 @samp{:block} is @samp{today}, it is shifted to @samp{today-1}, etc. 7697 @end table 7698 7699 Here is an example of the frame for a clock table as it is inserted 7700 into the buffer by @code{org-clock-report}: 7701 7702 @cindex @samp{BEGIN clocktable} 7703 @example 7704 #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file 7705 #+END: 7706 @end example 7707 7708 @vindex org-clocktable-defaults 7709 The @samp{#+BEGIN} line contains options to define the scope, structure, 7710 and formatting of the report. Defaults for all these options can be 7711 configured in the variable @code{org-clocktable-defaults}. 7712 7713 First there are options that determine which clock entries are to 7714 be selected: 7715 7716 @table @asis 7717 @item @samp{:maxlevel} 7718 Maximum level depth to which times are listed in the table. Clocks 7719 at deeper levels are summed into the upper level. 7720 7721 @item @samp{:scope} 7722 The scope to consider. This can be any of the following: 7723 7724 @multitable {aaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 7725 @item @samp{nil} 7726 @tab the current buffer or narrowed region 7727 @item @samp{file} 7728 @tab the full current buffer 7729 @item @samp{subtree} 7730 @tab the subtree where the clocktable is located 7731 @item @samp{treeN} 7732 @tab the surrounding level N tree, for example @samp{tree3} 7733 @item @samp{tree} 7734 @tab the surrounding level 1 tree 7735 @item @samp{agenda} 7736 @tab all agenda files 7737 @item @samp{("file" ...)} 7738 @tab scan these files 7739 @item @samp{FUNCTION} 7740 @tab scan files returned by calling @var{FUNCTION} with no argument 7741 @item @samp{file-with-archives} 7742 @tab current file and its archives 7743 @item @samp{agenda-with-archives} 7744 @tab all agenda files, including archives 7745 @end multitable 7746 7747 @item @samp{:block} 7748 The time block to consider. This block is specified either 7749 absolutely, or relative to the current time and may be any of these 7750 formats: 7751 7752 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaa} 7753 @item @samp{2007-12-31} 7754 @tab New year eve 2007 7755 @item @samp{2007-12} 7756 @tab December 2007 7757 @item @samp{2007-W50} 7758 @tab ISO-week 50 in 2007 7759 @item @samp{2007-Q2} 7760 @tab 2nd quarter in 2007 7761 @item @samp{2007} 7762 @tab the year 2007 7763 @item @samp{today}, @samp{yesterday}, @samp{today-N} 7764 @tab a relative day 7765 @item @samp{thisweek}, @samp{lastweek}, @samp{thisweek-N} 7766 @tab a relative week 7767 @item @samp{thismonth}, @samp{lastmonth}, @samp{thismonth-N} 7768 @tab a relative month 7769 @item @samp{thisyear}, @samp{lastyear}, @samp{thisyear-N} 7770 @tab a relative year 7771 @item @samp{untilnow}@footnote{When using @code{:step}, @code{untilnow} starts from the beginning of 7772 2003, not the beginning of time.} 7773 @tab all clocked time ever 7774 @end multitable 7775 7776 @vindex org-clock-display-default-range 7777 When this option is not set, Org falls back to the value in 7778 @code{org-clock-display-default-range}, which defaults to the current 7779 year. 7780 7781 Use @kbd{S-@key{LEFT}} or @kbd{S-@key{RIGHT}} to shift the time 7782 interval. 7783 7784 @item @samp{:tstart} 7785 A time string specifying when to start considering times. Relative 7786 times like @samp{"<-2w>"} can also be used. See @ref{Matching tags and properties} for relative time syntax. 7787 7788 @item @samp{:tend} 7789 A time string specifying when to stop considering times. Relative 7790 times like @samp{"<now>"} can also be used. See @ref{Matching tags and properties} for relative time syntax. 7791 7792 @item @samp{:wstart} 7793 The starting day of the week. The default is 1 for Monday. 7794 7795 @item @samp{:mstart} 7796 The starting day of the month. The default is 1 for the first. 7797 7798 @item @samp{:step} 7799 Set to @samp{day}, @samp{week}, @samp{semimonth}, @samp{month}, @samp{quarter}, or @samp{year} to split the 7800 table into chunks. To use this, either @samp{:block}, or @samp{:tstart} and 7801 @samp{:tend} are required. 7802 7803 @item @samp{:stepskip0} 7804 When non-@code{nil}, do not show steps that have zero time. 7805 7806 @item @samp{:fileskip0} 7807 When non-@code{nil}, do not show table sections from files which did not 7808 contribute. 7809 7810 @item @samp{:match} 7811 A tags match to select entries that should contribute. See 7812 @ref{Matching tags and properties} for the match syntax. 7813 @end table 7814 7815 @findex org-clocktable-write-default 7816 Then there are options that determine the formatting of the table. 7817 There options are interpreted by the function 7818 @code{org-clocktable-write-default}, but you can specify your own function 7819 using the @samp{:formatter} parameter. 7820 7821 @table @asis 7822 @item @samp{:emphasize} 7823 When non-@code{nil}, emphasize level one and level two items. 7824 7825 @item @samp{:lang} 7826 Language@footnote{ Language terms can be set through the variable 7827 @code{org-clock-clocktable-language-setup}.} to use for descriptive cells 7828 like ``Task''. 7829 7830 @item @samp{:link} 7831 Link the item headlines in the table to their origins. 7832 7833 @item @samp{:narrow} 7834 An integer to limit the width of the headline column in the Org 7835 table. If you write it like @samp{50!}, then the headline is also 7836 shortened in export. 7837 7838 @item @samp{:indent} 7839 Indent each headline field according to its level. 7840 7841 @item @samp{:filetitle} 7842 Show title in the file column if the file has a @samp{#+title}. 7843 7844 @item @samp{:hidefiles} 7845 Hide the file column when multiple files are used to produce the 7846 table. 7847 7848 @item @samp{:tcolumns} 7849 Number of columns to be used for times. If this is smaller than 7850 @samp{:maxlevel}, lower levels are lumped into one column. 7851 7852 @item @samp{:level} 7853 Should a level number column be included? 7854 7855 @item @samp{:sort} 7856 A cons cell containing the column to sort and a sorting type. E.g., 7857 @samp{:sort (1 . ?a)} sorts the first column alphabetically. 7858 7859 @item @samp{:compact} 7860 Abbreviation for @samp{:level nil :indent t :narrow 40! :tcolumns 1}. 7861 All are overwritten except if there is an explicit @samp{:narrow}. 7862 7863 @item @samp{:timestamp} 7864 A timestamp for the entry, when available. Look for @samp{SCHEDULED}, 7865 @samp{DEADLINE}, @samp{TIMESTAMP} and @samp{TIMESTAMP_IA} special properties (see 7866 @ref{Special Properties}), in this order. 7867 7868 @item @samp{:tags} 7869 When this flag is non-@code{nil}, show the headline's tags. 7870 7871 @item @samp{:properties} 7872 List of properties shown in the table. Each property gets its own 7873 column. 7874 7875 @item @samp{:inherit-props} 7876 When this flag is non-@code{nil}, the values for @samp{:properties} are 7877 inherited. 7878 7879 @item @samp{:formula} 7880 Content of a @samp{TBLFM} keyword to be added and evaluated. As 7881 a special case, @samp{:formula %} adds a column with % time. If you do 7882 not specify a formula here, any existing formula below the clock 7883 table survives updates and is evaluated. 7884 7885 @item @samp{:formatter} 7886 A function to format clock data and insert it into the buffer. 7887 @end table 7888 7889 To get a clock summary of the current level 1 tree, for the current 7890 day, you could write: 7891 7892 @example 7893 #+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t 7894 #+END: 7895 @end example 7896 7897 @noindent 7898 To use a specific time range you could write@footnote{ Note that all 7899 parameters must be specified in a single line---the line is broken 7900 here only to fit it into the manual.} 7901 7902 @example 7903 #+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>" 7904 :tend "<2006-08-10 Thu 12:00>" 7905 #+END: 7906 @end example 7907 7908 @noindent 7909 A range starting a week ago and ending right now could be written as 7910 7911 @example 7912 #+BEGIN: clocktable :tstart "<-1w>" :tend "<now>" 7913 #+END: 7914 @end example 7915 7916 @noindent 7917 A summary of the current subtree with % times would be 7918 7919 @example 7920 #+BEGIN: clocktable :scope subtree :link t :formula % 7921 #+END: 7922 @end example 7923 7924 @noindent 7925 A horizontally compact representation of everything clocked during 7926 last week would be 7927 7928 @example 7929 #+BEGIN: clocktable :scope agenda :block lastweek :compact t 7930 #+END: 7931 @end example 7932 7933 @node Resolving idle time 7934 @subsection Resolving idle time and continuous clocking 7935 7936 @anchor{Resolving idle time (1)} 7937 @subsubheading Resolving idle time 7938 7939 @cindex resolve idle time 7940 @cindex idle, resolve, dangling 7941 7942 If you clock in on a work item, and then walk away from your 7943 computer---perhaps to take a phone call---you often need to 7944 ``resolve'' the time you were away by either subtracting it from the 7945 current clock, or applying it to another one. 7946 7947 @vindex org-clock-idle-time 7948 @vindex org-clock-x11idle-program-name 7949 By customizing the variable @code{org-clock-idle-time} to some integer, 7950 such as 10 or 15, Emacs can alert you when you get back to your 7951 computer after being idle for that many minutes@footnote{On computers using macOS, idleness is based on actual user 7952 idleness, not just Emacs's idle time. For X11, you can install a 7953 utility program @samp{x11idle.c}, available in the @samp{org-contrib/} 7954 repository, or install the xprintidle package and set it to the 7955 variable @code{org-clock-x11idle-program-name} if you are running Debian, 7956 to get the same general treatment of idleness. On other systems, idle 7957 time refers to Emacs idle time only.}, and ask what 7958 you want to do with the idle time. There will be a question waiting 7959 for you when you get back, indicating how much idle time has passed 7960 constantly updated with the current amount, as well as a set of 7961 choices to correct the discrepancy: 7962 7963 @table @asis 7964 @item @kbd{k} 7965 @kindex k 7966 To keep some or all of the minutes and stay clocked in, press 7967 @kbd{k}. Org asks how many of the minutes to keep. Press 7968 @kbd{@key{RET}} to keep them all, effectively changing nothing, or 7969 enter a number to keep that many minutes. 7970 7971 @item @kbd{K} 7972 @kindex K 7973 If you use the shift key and press @kbd{K}, it keeps however 7974 many minutes you request and then immediately clock out of that 7975 task. If you keep all of the minutes, this is the same as just 7976 clocking out of the current task. 7977 7978 @item @kbd{s} 7979 @kindex s 7980 To keep none of the minutes, use @kbd{s} to subtract all the 7981 away time from the clock, and then check back in from the moment you 7982 returned. 7983 7984 @item @kbd{S} 7985 @kindex S 7986 To keep none of the minutes and just clock out at the start of the 7987 away time, use the shift key and press @kbd{S}. Remember that 7988 using shift always leave you clocked out, no matter which option you 7989 choose. 7990 7991 @item @kbd{C} 7992 @kindex C 7993 To cancel the clock altogether, use @kbd{C}. Note that if 7994 instead of canceling you subtract the away time, and the resulting 7995 clock amount is less than a minute, the clock is still canceled 7996 rather than cluttering up the log with an empty entry. 7997 @end table 7998 7999 What if you subtracted those away minutes from the current clock, and 8000 now want to apply them to a new clock? Simply clock in to any task 8001 immediately after the subtraction. Org will notice that you have 8002 subtracted time ``on the books'', so to speak, and will ask if you want 8003 to apply those minutes to the next task you clock in on. 8004 8005 There is one other instance when this clock resolution magic occurs. 8006 Say you were clocked in and hacking away, and suddenly your cat chased 8007 a mouse who scared a hamster that crashed into your UPS's power 8008 button! You suddenly lose all your buffers, but thanks to auto-save 8009 you still have your recent Org mode changes, including your last clock 8010 in. 8011 8012 If you restart Emacs and clock into any task, Org will notice that you 8013 have a dangling clock which was never clocked out from your last 8014 session. Using that clock's starting time as the beginning of the 8015 unaccounted-for period, Org will ask how you want to resolve that 8016 time. The logic and behavior is identical to dealing with away time 8017 due to idleness; it is just happening due to a recovery event rather 8018 than a set amount of idle time. 8019 8020 You can also check all the files visited by your Org agenda for 8021 dangling clocks at any time using @kbd{M-x org-resolve-clocks @key{RET}} (or @kbd{C-c C-x C-z}). 8022 8023 @anchor{Continuous clocking} 8024 @subsubheading Continuous clocking 8025 8026 @cindex continuous clocking 8027 8028 @vindex org-clock-continuously 8029 You may want to start clocking from the time when you clocked out the 8030 previous task. To enable this systematically, set 8031 @code{org-clock-continuously} to non-@code{nil}. Each time you clock in, Org 8032 retrieves the clock-out time of the last clocked entry for this 8033 session, and start the new clock from there. 8034 8035 If you only want this from time to time, use three universal prefix 8036 arguments with @code{org-clock-in} and two @kbd{C-u C-u} with 8037 @code{org-clock-in-last}. 8038 8039 @anchor{Clocking out automatically after some idle time} 8040 @subsubheading Clocking out automatically after some idle time 8041 8042 @cindex auto clocking out after idle time 8043 8044 @vindex org-clock-auto-clockout-timer 8045 When you often forget to clock out before being idle and you don't 8046 want to manually set the clocking time to take into account, you can 8047 set @code{org-clock-auto-clockout-timer} to a number of seconds and add 8048 @samp{(org-clock-auto-clockout-insinuate)} to your @samp{.emacs} file. 8049 8050 When the clock is running and Emacs is idle for more than this number 8051 of seconds, the clock will be clocked out automatically. 8052 8053 Use @samp{M-x org-clock-toggle-auto-clockout RET} to temporarily turn this 8054 on or off. 8055 8056 @node Effort Estimates 8057 @section Effort Estimates 8058 8059 @cindex effort estimates 8060 @cindex @samp{EFFORT}, property 8061 @vindex org-effort-property 8062 8063 If you want to plan your work in a very detailed way, or if you need 8064 to produce offers with quotations of the estimated work effort, you 8065 may want to assign effort estimates to entries. If you are also 8066 clocking your work, you may later want to compare the planned effort 8067 with the actual working time, a great way to improve planning 8068 estimates. 8069 8070 Effort estimates are stored in a special property @samp{EFFORT}. Multiple 8071 formats are supported, such as @samp{3:12}, @samp{1:23:45}, or @samp{1d3h5min}; see 8072 the file @samp{org-duration.el} for more detailed information about the 8073 format. 8074 8075 You can set the effort for an entry with the following commands: 8076 8077 @table @asis 8078 @item @kbd{C-c C-x e} (@code{org-set-effort}) 8079 @kindex C-c C-x e 8080 @findex org-set-effort 8081 Set the effort estimate for the current entry. With a prefix 8082 argument, set it to the next allowed value---see below. This 8083 command is also accessible from the agenda with the @kbd{e} 8084 key. 8085 8086 @item @kbd{C-c C-x C-e} (@code{org-clock-modify-effort-estimate}) 8087 @kindex C-c C-x C-e 8088 @findex org-clock-modify-effort-estimate 8089 Modify the effort estimate of the item currently being clocked. 8090 @end table 8091 8092 Clearly the best way to work with effort estimates is through column 8093 view (see @ref{Column View}). You should start by setting up discrete 8094 values for effort estimates, and a @samp{COLUMNS} format that displays 8095 these values together with clock sums---if you want to clock your 8096 time. For a specific buffer you can use: 8097 8098 @example 8099 #+PROPERTY: Effort_ALL 0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00 8100 #+COLUMNS: %40ITEM(Task) %17Effort(Estimated Effort)@{:@} %CLOCKSUM 8101 @end example 8102 8103 @noindent 8104 @vindex org-global-properties 8105 @vindex org-columns-default-format 8106 or, even better, you can set up these values globally by customizing 8107 the variables @code{org-global-properties} and 8108 @code{org-columns-default-format}. In particular if you want to use this 8109 setup also in the agenda, a global setup may be advised. 8110 8111 The way to assign estimates to individual items is then to switch to 8112 column mode, and to use @kbd{S-@key{RIGHT}} and @kbd{S-@key{LEFT}} to 8113 change the value. The values you enter are immediately summed up in 8114 the hierarchy. In the column next to it, any clocked time is 8115 displayed. 8116 8117 @vindex org-agenda-columns-add-appointments-to-effort-sum 8118 If you switch to column view in the daily/weekly agenda, the effort 8119 column summarizes the estimated work effort for each day@footnote{ Please 8120 note the pitfalls of summing hierarchical data in a flat list (see 8121 @ref{Agenda Column View}).}, and you can use this to find 8122 space in your schedule. To get an overview of the entire part of the 8123 day that is committed, you can set the option 8124 @code{org-agenda-columns-add-appointments-to-effort-sum}. The appointments 8125 on a day that take place over a specified time interval are then also 8126 added to the load estimate of the day. 8127 8128 Effort estimates can be used in secondary agenda filtering that is 8129 triggered with the @kbd{/} key in the agenda (see @ref{Agenda Commands}). If you have these estimates defined consistently, 8130 two or three key presses narrow down the list to stuff that fits into 8131 an available time slot. 8132 8133 @node Timers 8134 @section Taking Notes with a Relative Timer 8135 8136 @cindex relative timer 8137 @cindex countdown timer 8138 8139 Org provides two types of timers. There is a relative timer that 8140 counts up, which can be useful when taking notes during, for example, 8141 a meeting or a video viewing. There is also a countdown timer. 8142 8143 The relative and countdown are started with separate commands. 8144 8145 @table @asis 8146 @item @kbd{C-c C-x 0} (@code{org-timer-start}) 8147 @kindex C-c C-x 0 8148 @findex org-timer-start 8149 Start or reset the relative timer. By default, the timer is set 8150 to 0. When called with a @kbd{C-u} prefix, prompt the user for 8151 a starting offset. The prompt will default to a timer string at 8152 point (if any), providing a convenient way to restart taking notes 8153 after a break in the process. When called with a double prefix 8154 argument @kbd{C-u C-u}, change all timer strings in the active 8155 region by a certain amount. This can be used to fix timer strings 8156 if the timer was not started at exactly the right moment. 8157 8158 @item @kbd{C-c C-x ;} (@code{org-timer-set-timer}) 8159 @kindex C-c C-x ; 8160 @findex org-timer-set-timer 8161 @vindex org-timer-default-timer 8162 Start a countdown timer. The user is prompted for a duration. 8163 @code{org-timer-default-timer} sets the default countdown value. Giving 8164 a numeric prefix argument overrides this default value. This 8165 command is available as @kbd{;} in agenda buffers. 8166 @end table 8167 8168 Once started, relative and countdown timers are controlled with the 8169 same commands. 8170 8171 @table @asis 8172 @item @kbd{C-c C-x .} (@code{org-timer}) 8173 @kindex C-c C-x . 8174 @findex org-timer 8175 Insert a relative time into the buffer. The first time you use 8176 this, the timer starts. Using a prefix argument restarts it. 8177 8178 @item @kbd{C-c C-x -} (@code{org-timer-item}) 8179 @kindex C-c C-x - 8180 @findex org-timer-item 8181 Insert a description list item with the current relative time. With 8182 a prefix argument, first reset the timer to 0. 8183 8184 @item @kbd{M-@key{RET}} (@code{org-insert-heading}) 8185 @kindex M-RET 8186 @findex org-insert-heading 8187 Once the timer list is started, you can also use @kbd{M-@key{RET}} to 8188 insert new timer items. 8189 8190 @item @kbd{C-c C-x ,} (@code{org-timer-pause-or-continue}) 8191 @kindex C-c C-x , 8192 @findex org-timer-pause-or-continue 8193 Pause the timer, or continue it if it is already paused. 8194 8195 @item @kbd{C-c C-x _} (@code{org-timer-stop}) 8196 @kindex C-c C-x _ 8197 @findex org-timer-stop 8198 Stop the timer. After this, you can only start a new timer, not 8199 continue the old one. This command also removes the timer from the 8200 mode line. 8201 @end table 8202 8203 @node Refiling and Archiving 8204 @chapter Refiling and Archiving 8205 8206 @cindex refiling notes 8207 @cindex copying notes 8208 @cindex archiving 8209 8210 Once information is in the system, it may need to be moved around. 8211 Org provides Refile, Copy and Archive commands for this. Refile and 8212 Copy helps with moving and copying outlines. Archiving helps to keep 8213 the system compact and fast. 8214 8215 @menu 8216 * Refile and Copy:: Moving/copying a tree from one place to another. 8217 * Archiving:: What to do with finished products. 8218 @end menu 8219 8220 @node Refile and Copy 8221 @section Refile and Copy 8222 8223 @cindex refiling notes 8224 @cindex copying notes 8225 8226 When reviewing the captured data, you may want to refile or to copy 8227 some of the entries into a different list, for example into a project. 8228 Cutting, finding the right location, and then pasting the note is 8229 cumbersome. To simplify this process, you can use the following 8230 special command: 8231 8232 @table @asis 8233 @item @kbd{C-c C-w} (@code{org-refile}) 8234 @kindex C-c C-w 8235 @findex org-refile 8236 @vindex org-reverse-note-order 8237 @vindex org-refile-targets 8238 @vindex org-refile-use-outline-path 8239 @vindex org-outline-path-complete-in-steps 8240 @vindex org-refile-allow-creating-parent-nodes 8241 @vindex org-log-refile 8242 Refile the entry or region at point. This command offers possible 8243 locations for refiling the entry and lets you select one with 8244 completion. The item (or all items in the region) is filed below 8245 the target heading as a subitem. Depending on 8246 @code{org-reverse-note-order}, it is either the first or last subitem. 8247 8248 By default, all level 1 headlines in the current buffer are 8249 considered to be targets, but you can have more complex definitions 8250 across a number of files. See the variable @code{org-refile-targets} for 8251 details. If you would like to select a location via a 8252 file-path-like completion along the outline path, see the variables 8253 @code{org-refile-use-outline-path} and 8254 @code{org-outline-path-complete-in-steps}. If you would like to be able 8255 to create new nodes as new parents for refiling on the fly, check 8256 the variable @code{org-refile-allow-creating-parent-nodes}. When the 8257 variable @code{org-log-refile}@footnote{ Note the corresponding @samp{STARTUP} 8258 options @samp{logrefile}, @samp{lognoterefile}, and @samp{nologrefile}.} is set, a 8259 timestamp or a note is recorded whenever an entry is refiled. 8260 8261 @item @kbd{C-u C-c C-w} 8262 @kindex C-u C-c C-w 8263 Use the refile interface to jump to a heading. 8264 8265 @item @kbd{C-u C-u C-c C-w} (@code{org-refile-goto-last-stored}) 8266 @kindex C-u C-u C-c C-w 8267 @findex org-refile-goto-last-stored 8268 Jump to the location where @code{org-refile} last moved a tree to. 8269 8270 @item @kbd{C-2 C-c C-w} 8271 @kindex C-2 C-c C-w 8272 Refile as the child of the item currently being clocked. 8273 8274 @item @kbd{C-3 C-c C-w} 8275 @kindex C-3 C-c C-w 8276 @vindex org-refile-keep 8277 Refile and keep the entry in place. Also see @code{org-refile-keep} to 8278 make this the default behavior, and beware that this may result in 8279 duplicated @samp{ID} properties. 8280 8281 @item @kbd{C-0 C-c C-w} or @kbd{C-u C-u C-u C-c C-w} (@code{org-refile-cache-clear}) 8282 @kindex C-u C-u C-u C-c C-w 8283 @kindex C-0 C-c C-w 8284 @findex org-refile-cache-clear 8285 @vindex org-refile-use-cache 8286 Clear the target cache. Caching of refile targets can be turned on 8287 by setting @code{org-refile-use-cache}. To make the command see new 8288 possible targets, you have to clear the cache with this command. 8289 8290 @item @kbd{C-c M-w} (@code{org-refile-copy}) 8291 @kindex C-c M-w 8292 @findex org-refile-copy 8293 Copying works like refiling, except that the original note is not 8294 deleted. 8295 8296 @item @kbd{C-c C-M-w} (@code{org-refile-reverse}) 8297 @kindex C-c C-M-w 8298 @findex org-refile-reverse 8299 Works like refiling, except that it temporarily toggles how the 8300 value of @code{org-reverse-note-order} applies to the current buffer. So 8301 if @code{org-refile} would append the entry as the last entry under the 8302 target header, @code{org-refile-reverse} will prepend it as the first 8303 entry, and vice-versa. 8304 @end table 8305 8306 @node Archiving 8307 @section Archiving 8308 8309 @cindex archiving 8310 8311 When a project represented by a (sub)tree is finished, you may want to 8312 move the tree out of the way and to stop it from contributing to the 8313 agenda. Archiving is important to keep your working files compact and 8314 global searches like the construction of agenda views fast. 8315 8316 @table @asis 8317 @item @kbd{C-c C-x C-a} (@code{org-archive-subtree-default}) 8318 @kindex C-c C-x C-a 8319 @findex org-archive-subtree-default 8320 @vindex org-archive-default-command 8321 Archive the current entry using the command specified in the 8322 variable @code{org-archive-default-command}. 8323 @end table 8324 8325 @menu 8326 * Moving subtrees:: Moving a tree to an archive file. 8327 * Internal archiving:: Switch off a tree but keep it in the file. 8328 @end menu 8329 8330 @node Moving subtrees 8331 @subsection Moving a tree to an archive file 8332 8333 @cindex external archiving 8334 8335 The most common archiving action is to move a project tree to another 8336 file, the archive file. 8337 8338 @table @asis 8339 @item @kbd{C-c C-x C-s} or short @kbd{C-c $} (@code{org-archive-subtree}) 8340 @kindex C-c C-x C-s 8341 @kindex C-c $ 8342 @findex org-archive-subtree 8343 @vindex org-archive-location 8344 Archive the subtree starting at point position to the location given 8345 by @code{org-archive-location}. 8346 8347 @item @kbd{C-u C-c C-x C-s} 8348 @kindex C-u C-c C-x C-s 8349 Check if any direct children of the current headline could be moved 8350 to the archive. To do this, check each subtree for open TODO 8351 entries. If none is found, the command offers to move it to the 8352 archive location. If point is @emph{not} on a headline when this command 8353 is invoked, check level 1 trees. 8354 8355 @item @kbd{C-u C-u C-c C-x C-s} 8356 @kindex C-u C-u C-c C-x C-s 8357 As above, but check subtree for timestamps instead of TODO entries. 8358 The command offers to archive the subtree if it @emph{does} contain 8359 a timestamp, and that timestamp is in the past. 8360 @end table 8361 8362 @cindex archive locations 8363 The default archive location is a file in the same directory as the 8364 current file, with the name derived by appending @samp{_archive} to the 8365 current file name. You can also choose what heading to file archived 8366 items under, with the possibility to add them to a datetree in a file. 8367 For information and examples on how to specify the file and the 8368 heading, see the documentation string of the variable 8369 @code{org-archive-location}. 8370 8371 There is also an in-buffer option for setting this variable, for 8372 example: 8373 8374 @cindex @samp{ARCHIVE}, keyword 8375 @example 8376 #+ARCHIVE: %s_done:: 8377 @end example 8378 8379 8380 @cindex ARCHIVE, property 8381 If you would like to have a special archive location for a single 8382 entry or a (sub)tree, give the entry an @samp{ARCHIVE} property with the 8383 location as the value (see @ref{Properties and Columns}). 8384 8385 @vindex org-archive-save-context-info 8386 When a subtree is moved, it receives a number of special properties 8387 that record context information like the file from where the entry 8388 came, its outline path the archiving time etc. Configure the variable 8389 @code{org-archive-save-context-info} to adjust the amount of information 8390 added. 8391 8392 @vindex org-archive-subtree-save-file-p 8393 When @code{org-archive-subtree-save-file-p} is non-@code{nil}, save the target 8394 archive buffer. 8395 8396 @node Internal archiving 8397 @subsection Internal archiving 8398 8399 @cindex @samp{ARCHIVE}, tag 8400 If you want to just switch off---for agenda views---certain subtrees 8401 without moving them to a different file, you can use the @samp{ARCHIVE} 8402 tag. 8403 8404 A headline that is marked with the @samp{ARCHIVE} tag (see @ref{Tags}) stays at 8405 its location in the outline tree, but behaves in the following way: 8406 8407 @itemize 8408 @item 8409 @vindex org-cycle-open-archived-trees 8410 It does not open when you attempt to do so with a visibility cycling 8411 command (see @ref{Visibility Cycling}). You can force cycling archived 8412 subtrees with @kbd{C-c C-@key{TAB}}, or by setting the option 8413 @code{org-cycle-open-archived-trees}. Also normal outline commands, like 8414 @code{org-show-all}, open archived subtrees. 8415 8416 @item 8417 @vindex org-sparse-tree-open-archived-trees 8418 During sparse tree construction (see @ref{Sparse Trees}), matches in 8419 archived subtrees are not exposed, unless you configure the option 8420 @code{org-sparse-tree-open-archived-trees}. 8421 8422 @item 8423 @vindex org-agenda-skip-archived-trees 8424 During agenda view construction (see @ref{Agenda Views}), the content of 8425 archived trees is ignored unless you configure the option 8426 @code{org-agenda-skip-archived-trees}, in which case these trees are 8427 always included. In the agenda you can press @kbd{v a} to get 8428 archives temporarily included. 8429 8430 @item 8431 @vindex org-export-with-archived-trees 8432 Archived trees are not exported (see @ref{Exporting}), only the headline 8433 is. Configure the details using the variable 8434 @code{org-export-with-archived-trees}. 8435 8436 @item 8437 @vindex org-columns-skip-archived-trees 8438 Archived trees are excluded from column view unless the variable 8439 @code{org-columns-skip-archived-trees} is configured to @code{nil}. 8440 @end itemize 8441 8442 The following commands help manage the @samp{ARCHIVE} tag: 8443 8444 @table @asis 8445 @item @kbd{C-c C-x a} (@code{org-toggle-archive-tag}) 8446 @kindex C-c C-x a 8447 @findex org-toggle-archive-tag 8448 Toggle the archive tag for the current headline. When the tag is 8449 set, the headline changes to a shadowed face, and the subtree below 8450 it is hidden. 8451 8452 @item @kbd{C-u C-c C-x a} 8453 @kindex C-u C-c C-x a 8454 Check if any direct children of the current headline should be 8455 archived. To do this, check each subtree for open TODO entries. If 8456 none is found, the command offers to set the @samp{ARCHIVE} tag for the 8457 child. If point is @emph{not} on a headline when this command is 8458 invoked, check the level 1 trees. 8459 8460 @item @kbd{C-c C-@key{TAB}} (@code{org-cycle-force-archived}) 8461 @kindex C-c C-TAB 8462 Cycle a tree even if it is tagged with @samp{ARCHIVE}. 8463 8464 @item @kbd{C-c C-x A} (@code{org-archive-to-archive-sibling}) 8465 @kindex C-c C-x A 8466 @findex org-archive-to-archive-sibling 8467 Move the current entry to the @emph{Archive Sibling}. This is a sibling 8468 of the entry with the heading @samp{Archive} and the archive tag. The 8469 entry becomes a child of that sibling and in this way retains a lot 8470 of its original context, including inherited tags and approximate 8471 position in the outline. 8472 @end table 8473 8474 @node Capture and Attachments 8475 @chapter Capture and Attachments 8476 8477 @cindex capture 8478 @cindex attachments 8479 @cindex RSS feeds 8480 @cindex Atom feeds 8481 @cindex protocols, for external access 8482 8483 An important part of any organization system is the ability to quickly 8484 capture new ideas and tasks, and to associate reference material with 8485 them. Org does this using a process called @emph{capture}. It also can 8486 store files related to a task (@emph{attachments}) in a special directory. 8487 Finally, it can parse RSS feeds for information. To learn how to let 8488 external programs (for example a web browser) trigger Org to capture 8489 material, see @ref{Protocols}. 8490 8491 @menu 8492 * Capture:: Capturing new stuff. 8493 * Attachments:: Attach files to outlines. 8494 * RSS Feeds:: Getting input from RSS feeds. 8495 @end menu 8496 8497 @node Capture 8498 @section Capture 8499 8500 @cindex capture 8501 8502 Capture lets you quickly store notes with little interruption of your 8503 work flow. Org's method for capturing new items is heavily inspired 8504 by John Wiegley's excellent Remember package. 8505 8506 @menu 8507 * Setting up capture:: Where notes will be stored. 8508 * Using capture:: Commands to invoke and terminate capture. 8509 * Capture templates:: Define the outline of different note types. 8510 @end menu 8511 8512 @node Setting up capture 8513 @subsection Setting up capture 8514 8515 The following customization sets a default target file for notes. 8516 8517 @vindex org-default-notes-file 8518 @lisp 8519 (setq org-default-notes-file (concat org-directory "/notes.org")) 8520 @end lisp 8521 8522 You may also define a global key for capturing new material (see 8523 @ref{Activation}). 8524 8525 @node Using capture 8526 @subsection Using capture 8527 8528 @table @asis 8529 @item @kbd{M-x org-capture} (@code{org-capture}) 8530 @findex org-capture 8531 Display the capture templates menu. If you have templates defined 8532 (see @ref{Capture templates}), it offers these templates for selection or 8533 use a new Org outline node as the default template. It inserts the 8534 template into the target file and switch to an indirect buffer 8535 narrowed to this new node. You may then insert the information you 8536 want. 8537 8538 @item @kbd{C-c C-c} (@code{org-capture-finalize}) 8539 @kindex C-c C-c @r{(Capture buffer)} 8540 @findex org-capture-finalize 8541 Once you have finished entering information into the capture buffer, 8542 @kbd{C-c C-c} returns you to the window configuration before 8543 the capture process, so that you can resume your work without 8544 further distraction. When called with a prefix argument, finalize 8545 and then jump to the captured item. 8546 8547 @item @kbd{C-c C-w} (@code{org-capture-refile}) 8548 @kindex C-c C-w @r{(Capture buffer)} 8549 @findex org-capture-refile 8550 Finalize the capture process by refiling the note to a different 8551 place (see @ref{Refile and Copy}). Please realize that this is a normal 8552 refiling command that will be executed---so point position at the 8553 moment you run this command is important. If you have inserted 8554 a tree with a parent and children, first move point back to the 8555 parent. Any prefix argument given to this command is passed on to 8556 the @code{org-refile} command. 8557 8558 @item @kbd{C-c C-k} (@code{org-capture-kill}) 8559 @kindex C-c C-k @r{(Capture buffer)} 8560 @findex org-capture-kill 8561 Abort the capture process and return to the previous state. 8562 @end table 8563 8564 @kindex k c @r{(Agenda)} 8565 You can also call @code{org-capture} in a special way from the agenda, 8566 using the @kbd{k c} key combination. With this access, any 8567 timestamps inserted by the selected capture template defaults to the 8568 date at point in the agenda, rather than to the current date. 8569 8570 To find the locations of the last stored capture, use @code{org-capture} 8571 with prefix commands: 8572 8573 @table @asis 8574 @item @kbd{C-u M-x org-capture} 8575 Visit the target location of a capture template. You get to select 8576 the template in the usual way. 8577 8578 @item @kbd{C-u C-u M-x org-capture} 8579 Visit the last stored capture item in its buffer. 8580 @end table 8581 8582 @vindex org-bookmark-names-plist 8583 @vindex org-capture-last-stored 8584 You can also jump to the bookmark @code{org-capture-last-stored}, which is 8585 automatically created unless you customize @code{org-bookmark-names-plist}. 8586 8587 To insert the capture at point in an Org buffer, call @code{org-capture} 8588 with a @kbd{C-0} prefix argument. 8589 8590 @node Capture templates 8591 @subsection Capture templates 8592 8593 @cindex templates, for Capture 8594 8595 You can use templates for different types of capture items, and for 8596 different target locations. The easiest way to create such templates 8597 is through the customize interface. 8598 8599 @table @asis 8600 @item @kbd{C} 8601 @kindex C @r{(Capture menu} 8602 @vindex org-capture-templates 8603 Customize the variable @code{org-capture-templates}. 8604 @end table 8605 8606 Before we give the formal description of template definitions, let's 8607 look at an example. Say you would like to use one template to create 8608 general TODO entries, and you want to put these entries under the 8609 heading @samp{Tasks} in your file @samp{~/org/gtd.org}. Also, a date tree in 8610 the file @samp{journal.org} should capture journal entries. A possible 8611 configuration would look like: 8612 8613 @lisp 8614 (setq org-capture-templates 8615 '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Tasks") 8616 "* TODO %?\n %i\n %a") 8617 ("j" "Journal" entry (file+datetree "~/org/journal.org") 8618 "* %?\nEntered on %U\n %i\n %a"))) 8619 @end lisp 8620 8621 If you then press @kbd{t} from the capture menu, Org will prepare 8622 the template for you like this: 8623 8624 @example 8625 * TODO 8626 [[file:LINK TO WHERE YOU INITIATED CAPTURE]] 8627 @end example 8628 8629 @noindent 8630 During expansion of the template, @samp{%a} has been replaced by a link to 8631 the location from where you called the capture command. This can be 8632 extremely useful for deriving tasks from emails, for example. You 8633 fill in the task definition, press @kbd{C-c C-c} and Org returns 8634 you to the same place where you started the capture process. 8635 8636 To define special keys to capture to a particular template without 8637 going through the interactive template selection, you can create your 8638 key binding like this: 8639 8640 @lisp 8641 (define-key global-map (kbd "C-c x") 8642 (lambda () (interactive) (org-capture nil "x"))) 8643 @end lisp 8644 8645 @menu 8646 * Template elements:: What is needed for a complete template entry. 8647 * Template expansion:: Filling in information about time and context. 8648 * Templates in contexts:: Only show a template in a specific context. 8649 @end menu 8650 8651 @node Template elements 8652 @subsubsection Template elements 8653 8654 Now lets look at the elements of a template definition. Each entry in 8655 @code{org-capture-templates} is a list with the following items: 8656 8657 @table @asis 8658 @item keys 8659 The keys that selects the template, as a string, characters only, 8660 for example @samp{"a"}, for a template to be selected with a single key, 8661 or @samp{"bt"} for selection with two keys. When using several keys, 8662 keys using the same prefix key must be sequential in the list and 8663 preceded by a 2-element entry explaining the prefix key, for 8664 example: 8665 8666 @lisp 8667 ("b" "Templates for marking stuff to buy") 8668 @end lisp 8669 8670 If you do not define a template for the @kbd{C} key, this key 8671 opens the Customize buffer for this complex variable. 8672 8673 @item description 8674 A short string describing the template, shown during selection. 8675 8676 @item type 8677 The type of entry, a symbol. Valid values are: 8678 8679 @table @asis 8680 @item @code{entry} 8681 An Org mode node, with a headline. Will be filed as the child of 8682 the target entry or as a top-level entry. The target file should 8683 be an Org file. 8684 8685 @item @code{item} 8686 A plain list item, placed in the first plain list at the target 8687 location. Again the target file should be an Org file. 8688 8689 @item @code{checkitem} 8690 A checkbox item. This only differs from the plain list item by 8691 the default template. 8692 8693 @item @code{table-line} 8694 A new line in the first table at the target location. Where 8695 exactly the line will be inserted depends on the properties 8696 @code{:prepend} and @code{:table-line-pos} (see below). 8697 8698 @item @code{plain} 8699 Text to be inserted as it is. 8700 @end table 8701 8702 @item target 8703 @vindex org-default-notes-file 8704 @vindex org-directory 8705 @cindex date tree 8706 Specification of where the captured item should be placed. In Org 8707 files, targets usually define a node. Entries will become children 8708 of this node. Other types will be added to the table or list in the 8709 body of this node. Most target specifications contain a file name. 8710 If that file name is the empty string, it defaults to 8711 @code{org-default-notes-file}. A file can also be given as a variable or 8712 as a function called with no argument. When an absolute path is not 8713 specified for a target, it is taken as relative to @code{org-directory}. 8714 8715 Valid values are: 8716 8717 @table @asis 8718 @item @samp{(file "path/to/file")} 8719 Text will be placed at the beginning or end of that file. 8720 8721 @item @samp{(id "id of existing org entry")} 8722 Filing as child of this entry, or in the body of the entry. 8723 8724 @item @samp{(file+headline "filename" "node headline")} 8725 Fast configuration if the target heading is unique in the file. 8726 8727 @item @samp{(file+olp "filename" "Level 1 heading" "Level 2" ...)} 8728 For non-unique headings, the full path is safer. 8729 8730 @item @samp{(file+regexp "filename" "regexp to find location")} 8731 Use a regular expression to position point. 8732 8733 @item @samp{(file+olp+datetree "filename" [ "Level 1 heading" ...])} 8734 This target@footnote{Org used to offer four different targets for date/week tree 8735 capture. Now, Org automatically translates these to use 8736 @code{file+olp+datetree}, applying the @code{:time-prompt} and @code{:tree-type} 8737 properties. Please rewrite your date/week-tree targets using 8738 @code{file+olp+datetree} since the older targets are now deprecated.} creates a heading in a date tree@footnote{A date tree is an outline structure with years on the highest 8739 level, months or ISO weeks as sublevels and then dates on the lowest 8740 level. 8741 @example 8742 * 2022 8743 ** 2022-10 October 8744 *** 2022-10-07 Friday 8745 *** 2022-10-08 Saturday 8746 @end example 8747 TODO state, priority, tags, statistics cookies, and COMMENT keywords 8748 are allowed in the tree structure.} for 8749 today's date. If the optional outline path is given, the tree 8750 will be built under the node it is pointing to, instead of at top 8751 level. Check out the @code{:time-prompt} and @code{:tree-type} properties 8752 below for additional options. 8753 8754 @item @samp{(file+function "filename" function-finding-location)} 8755 A function to find the right location in the file. 8756 8757 @item @samp{(clock)} 8758 File to the entry that is currently being clocked. 8759 8760 @item @samp{(here)} 8761 The position of @samp{point}. 8762 8763 @item @samp{(function function-finding-location)} 8764 Most general way: write your own function which both visits the 8765 file and moves point to the right location. 8766 @end table 8767 8768 @item template 8769 The template for creating the capture item. If you leave this 8770 empty, an appropriate default template will be used. Otherwise this 8771 is a string with escape codes, which will be replaced depending on 8772 time and context of the capture call. You may also get this 8773 template string from a file@footnote{ When the file name is not absolute, 8774 Org assumes it is relative to @code{org-directory}.}, or dynamically, 8775 from a function using either syntax: 8776 8777 @example 8778 (file "/path/to/template-file") 8779 (function FUNCTION-RETURNING-THE-TEMPLATE) 8780 @end example 8781 8782 @item properties 8783 The rest of the entry is a property list of additional options. 8784 Recognized properties are: 8785 8786 @table @asis 8787 @item @code{:prepend} 8788 Normally new captured information will be appended at the target 8789 location (last child, last table line, last list item, @dots{}). 8790 Setting this property changes that. 8791 8792 @item @code{:immediate-finish} 8793 When set, do not offer to edit the information, just file it away 8794 immediately. This makes sense if the template only needs 8795 information that can be added automatically. 8796 8797 @item @code{:jump-to-captured} 8798 When set, jump to the captured entry when finished. 8799 8800 @item @code{:empty-lines} 8801 Set this to the number of lines to insert before and after the new 8802 item. Default 0, and the only other common value is 1. 8803 8804 @item @code{:empty-lines-after} 8805 Set this to the number of lines that should be inserted after the 8806 new item. Overrides @code{:empty-lines} for the number of lines 8807 inserted after. 8808 8809 @item @code{:empty-lines-before} 8810 Set this to the number of lines that should be inserted before the 8811 new item. Overrides @code{:empty-lines} for the number lines inserted 8812 before. 8813 8814 @item @code{:clock-in} 8815 Start the clock in this item. 8816 8817 @item @code{:clock-keep} 8818 Keep the clock running when filing the captured entry. 8819 8820 @item @code{:clock-resume} 8821 If starting the capture interrupted a clock, restart that clock 8822 when finished with the capture. Note that @code{:clock-keep} has 8823 precedence over @code{:clock-resume}. When setting both to non-@code{nil}, 8824 the current clock will run and the previous one will not be 8825 resumed. 8826 8827 @item @code{:time-prompt} 8828 Prompt for a date/time to be used for date/week trees and when 8829 filling the template. Without this property, capture uses the 8830 current date and time. Even if this property has not been set, 8831 you can force the same behavior by calling @code{org-capture} with 8832 a @kbd{C-1} prefix argument. 8833 8834 @item @code{:tree-type} 8835 Use @code{week} to make a week tree instead of the month-day tree, 8836 i.e., place the headings for each day under a heading with the 8837 current ISO week. Use @code{month} to group entries by month 8838 only. Default is to group entries by day. 8839 8840 @item @code{:unnarrowed} 8841 Do not narrow the target buffer, simply show the full buffer. 8842 Default is to narrow it so that you only see the new material. 8843 8844 @item @code{:table-line-pos} 8845 Specification of the location in the table where the new line 8846 should be inserted. It should be a string like @samp{II-3} meaning 8847 that the new line should become the third line before the second 8848 horizontal separator line. 8849 8850 @item @code{:kill-buffer} 8851 If the target file was not yet visited when capture was invoked, 8852 kill the buffer again after capture is completed. 8853 8854 @item @code{:no-save} 8855 Do not save the target file after finishing the capture. 8856 8857 @item @code{:refile-targets} 8858 Temporarily set @code{org-refile-targets} to the 8859 value of this property. 8860 8861 @item @code{:hook} 8862 A nullary function or list of nullary functions run before 8863 @code{org-capture-mode-hook} when the template is selected. 8864 @end table 8865 8866 @table @asis 8867 @item @code{:prepare-finalize} 8868 A nullary function or list of nullary functions run before 8869 @code{org-capture-prepare-finalize-hook} when the template is selected. 8870 8871 @item @code{:before-finalize} 8872 A nullary function or list of nullary functions run before 8873 @code{org-capture-before-finalize-hook} when the template is selected. 8874 8875 @item @code{:after-finalize} 8876 A nullary function or list of nullary functions run before 8877 @code{org-capture-after-finalize-hook} when the template is selected. 8878 @end table 8879 @end table 8880 8881 @node Template expansion 8882 @subsubsection Template expansion 8883 8884 In the template itself, special ``%-escapes''@footnote{ If you need one of 8885 these sequences literally, escape the @samp{%} with a backslash.} allow 8886 dynamic insertion of content. The templates are expanded in the order 8887 given here: 8888 8889 @table @asis 8890 @item @samp{%[FILE]} 8891 Insert the contents of the file given by @var{FILE}. 8892 8893 @item @samp{%(EXP)} 8894 Evaluate Elisp expression @var{EXP} and replace it with the 8895 result. The @var{EXP} form must return a string. Only 8896 placeholders pre-existing within the template, or introduced with 8897 @samp{%[file]}, are expanded this way. Since this happens after 8898 expanding non-interactive ``%-escapes'', those can be used to fill the 8899 expression. 8900 8901 @item @samp{%<FORMAT>} 8902 The result of format-time-string on the @var{FORMAT} 8903 specification. 8904 8905 @item @samp{%t} 8906 Timestamp, date only. 8907 8908 @item @samp{%T} 8909 Timestamp, with date and time. 8910 8911 @item @samp{%u}, @samp{%U} 8912 Like @samp{%t}, @samp{%T} above, but inactive timestamps. 8913 8914 @item @samp{%i} 8915 Initial content, the region when capture is called while the region 8916 is active. If there is text before @samp{%i} on the same line, such as 8917 indentation, and @samp{%i} is not inside a @samp{%(exp)} form, that prefix is 8918 added before every line in the inserted text. 8919 8920 @item @samp{%a} 8921 Annotation, normally the link created with @code{org-store-link}. 8922 8923 @item @samp{%A} 8924 Like @samp{%a}, but prompt for the description part. 8925 8926 @item @samp{%l} 8927 Like @samp{%a}, but only insert the literal link. 8928 8929 @item @samp{%L} 8930 Like @samp{%l}, but without brackets (the link content itself). 8931 8932 @item @samp{%c} 8933 Current kill ring head. 8934 8935 @item @samp{%x} 8936 Content of the X clipboard. 8937 8938 @item @samp{%k} 8939 Title of the currently clocked task. 8940 8941 @item @samp{%K} 8942 Link to the currently clocked task. 8943 8944 @item @samp{%n} 8945 User name (taken from @code{user-full-name}). 8946 8947 @item @samp{%f} 8948 File visited by current buffer when org-capture was called. 8949 8950 @item @samp{%F} 8951 Full path of the file or directory visited by current buffer. 8952 8953 @item @samp{%:keyword} 8954 Specific information for certain link types, see below. 8955 8956 @item @samp{%^g} 8957 Prompt for tags, with completion on tags in target file. 8958 8959 @item @samp{%^G} 8960 Prompt for tags, with completion all tags in all agenda files. 8961 8962 @item @samp{%^t} 8963 Like @samp{%t}, but prompt for date. Similarly @samp{%^T}, @samp{%^u}, @samp{%^U}. You 8964 may define a prompt like @samp{%^@{Birthday@}t}. 8965 8966 @item @samp{%^C} 8967 Interactive selection of which kill or clip to use. 8968 8969 @item @samp{%^L} 8970 Like @samp{%^C}, but insert as link. 8971 8972 @item @samp{%^@{PROP@}p} 8973 Prompt the user for a value for property @var{PROP}. You may 8974 specify a default value with @samp{%^@{PROP|default@}}. 8975 8976 @item @samp{%^@{PROMPT@}X}, X is one of g,G,t,T,u,U,C,L 8977 Prompt the user as in @samp{%^X}, but use the custom prompt string. You 8978 may specify a default value and completions with 8979 @samp{%^@{PROMPT|default|completion1|completion2|completion3...@}X}. 8980 8981 @item @samp{%^@{PROMPT@}} 8982 Prompt the user for a string and replace this sequence with it. You 8983 may specify a default value and a completion table with 8984 @samp{%^@{prompt|default|completion2|completion3...@}}. The arrow keys 8985 access a prompt-specific history. 8986 8987 @item @samp{%\N} 8988 Insert the text entered at the @var{N}th @samp{%^@{PROMPT@}}, where 8989 @var{N} is a number, starting from 1. 8990 8991 @item @samp{%?} 8992 After completing the template, position point here. 8993 @end table 8994 8995 @vindex org-store-link-props 8996 For specific link types, the following keywords are defined@footnote{ If 8997 you define your own link types (see @ref{Adding Hyperlink Types}), any 8998 property you store with @code{org-store-link-props} can be accessed in 8999 capture templates in a similar way.}: 9000 9001 @vindex org-link-from-user-regexp 9002 @multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 9003 @headitem Link type 9004 @tab Available keywords 9005 @item bbdb 9006 @tab @samp{%:name}, @samp{%:company} 9007 @item irc 9008 @tab @samp{%:server}, @samp{%:port}, @samp{%:nick} 9009 @item mh, rmail 9010 @tab @samp{%:type}, @samp{%:subject}, @samp{%:message-id} 9011 @item 9012 @tab @samp{%:from}, @samp{%:fromname}, @samp{%:fromaddress} 9013 @item 9014 @tab @samp{%:to}, @samp{%:toname}, @samp{%:toaddress} 9015 @item 9016 @tab @samp{%:date} (message date header field) 9017 @item 9018 @tab @samp{%:date-timestamp} (date as active timestamp) 9019 @item 9020 @tab @samp{%:date-timestamp-inactive} (date as inactive timestamp) 9021 @item 9022 @tab @samp{%:fromto} (either ``to NAME'' or ``from NAME'')@footnote{This is always the other, not the user. See the variable 9023 @code{org-link-from-user-regexp}.} 9024 @item gnus 9025 @tab @samp{%:group}, for messages also all email fields 9026 @item w3, w3m 9027 @tab @samp{%:url} 9028 @item info 9029 @tab @samp{%:file}, @samp{%:node} 9030 @item calendar 9031 @tab @samp{%:date} 9032 @item org-protocol 9033 @tab @samp{%:link}, @samp{%:description}, @samp{%:annotation} 9034 @end multitable 9035 9036 @node Templates in contexts 9037 @subsubsection Templates in contexts 9038 9039 @vindex org-capture-templates-contexts 9040 To control whether a capture template should be accessible from 9041 a specific context, you can customize 9042 @code{org-capture-templates-contexts}. Let's say, for example, that you 9043 have a capture template ``p'' for storing Gnus emails containing 9044 patches. Then you would configure this option like this: 9045 9046 @lisp 9047 (setq org-capture-templates-contexts 9048 '(("p" ((in-mode . "message-mode"))))) 9049 @end lisp 9050 9051 You can also tell that the command key @kbd{p} should refer to 9052 another template. In that case, add this command key like this: 9053 9054 @lisp 9055 (setq org-capture-templates-contexts 9056 '(("p" "q" ((in-mode . "message-mode"))))) 9057 @end lisp 9058 9059 See the docstring of the variable for more information. 9060 9061 @node Attachments 9062 @section Attachments 9063 9064 @cindex attachments 9065 9066 It is often useful to associate reference material with an outline 9067 node. Small chunks of plain text can simply be stored in the subtree 9068 of a project. Hyperlinks (see @ref{Hyperlinks}) can establish associations 9069 with files that live elsewhere on a local, or even remote, computer, 9070 like emails or source code files belonging to a project. 9071 9072 Another method is @emph{attachments}, which are files located in a 9073 directory belonging to an outline node. Org uses directories either 9074 named by a unique ID of each entry, or by a @samp{DIR} property. 9075 9076 @menu 9077 * Attachment defaults and dispatcher:: How to access attachment commands 9078 * Attachment options:: Configuring the attachment system 9079 * Attachment links:: Hyperlink access to attachments 9080 * Automatic version-control with Git:: Everything safely stored away 9081 * Attach from Dired:: Using dired to select an attachment 9082 @end menu 9083 9084 @node Attachment defaults and dispatcher 9085 @subsection Attachment defaults and dispatcher 9086 9087 By default, Org attach uses ID properties when adding attachments to 9088 outline nodes. This makes working with attachments fully automated. 9089 There is no decision needed for folder-name or location. ID-based 9090 directories are by default located in the @samp{data/} directory, which 9091 lives in the same directory where your Org file lives@footnote{ If you move 9092 entries or Org files from one directory to another, you may want to 9093 configure @code{org-attach-id-dir} to contain an absolute path.}. 9094 9095 When attachments are made using @code{org-attach} a default tag @samp{ATTACH} is 9096 added to the node that gets the attachments. 9097 9098 For more control over the setup, see @ref{Attachment options}. 9099 9100 The following commands deal with attachments: 9101 9102 @table @asis 9103 @item @kbd{C-c C-a} (@code{org-attach}) 9104 @kindex C-c C-a 9105 @findex org-attach 9106 The dispatcher for commands related to the attachment system. After 9107 these keys, a list of commands is displayed and you must press an 9108 additional key to select a command: 9109 9110 @table @asis 9111 @item @kbd{a} (@code{org-attach-attach}) 9112 @kindex C-c C-a a 9113 @findex org-attach-attach 9114 @vindex org-attach-method 9115 Select a file and move it into the task's attachment directory. 9116 The file is copied, moved, or linked, depending on 9117 @code{org-attach-method}. Note that hard links are not supported on 9118 all systems. 9119 9120 @item @kbd{c}/@kbd{m}/@kbd{l} 9121 @kindex C-c C-a c 9122 @kindex C-c C-a m 9123 @kindex C-c C-a l 9124 Attach a file using the copy/move/link method. Note that hard 9125 links are not supported on all systems. 9126 9127 @item @kbd{b} (@code{org-attach-buffer}) 9128 @kindex C-c C-a b 9129 @findex org-attach-buffer 9130 Select a buffer and save it as a file in the task's attachment 9131 directory. 9132 9133 @item @kbd{n} (@code{org-attach-new}) 9134 @kindex C-c C-a n 9135 @findex org-attach-new 9136 Create a new attachment as an Emacs buffer. 9137 9138 @item @kbd{z} (@code{org-attach-sync}) 9139 @kindex C-c C-a z 9140 @findex org-attach-sync 9141 Synchronize the current task with its attachment directory, in 9142 case you added attachments yourself. 9143 9144 @item @kbd{o} (@code{org-attach-open}) 9145 @kindex C-c C-a o 9146 @findex org-attach-open 9147 @vindex org-file-apps 9148 Open current task's attachment. If there is more than one, prompt 9149 for a file name first. Opening follows the rules set by 9150 @code{org-file-apps}. For more details, see the information on 9151 following hyperlinks (see @ref{Handling Links}). 9152 9153 @item @kbd{O} (@code{org-attach-open-in-emacs}) 9154 @kindex C-c C-a O 9155 @findex org-attach-open-in-emacs 9156 Also open the attachment, but force opening the file in Emacs. 9157 9158 @item @kbd{f} (@code{org-attach-reveal}) 9159 @kindex C-c C-a f 9160 @findex org-attach-reveal 9161 Open the current task's attachment directory. 9162 9163 @item @kbd{F} (@code{org-attach-reveal-in-emacs}) 9164 @kindex C-c C-a F 9165 @findex org-attach-reveal-in-emacs 9166 Also open the directory, but force using Dired in Emacs. 9167 9168 @item @kbd{d} (@code{org-attach-delete-one}) 9169 @kindex C-c C-a d 9170 Select and delete a single attachment. 9171 9172 @item @kbd{D} (@code{org-attach-delete-all}) 9173 @kindex C-c C-a D 9174 Delete all of a task's attachments. A safer way is to open the 9175 directory in Dired and delete from there. 9176 9177 @item @kbd{s} (@code{org-attach-set-directory}) 9178 @kindex C-c C-a s 9179 @cindex @samp{DIR}, property 9180 Set a specific directory as the entry's attachment directory. 9181 This works by putting the directory path into the @samp{DIR} 9182 property. 9183 9184 @item @kbd{S} (@code{org-attach-unset-directory}) 9185 @kindex C-c C-a S 9186 @cindex @samp{DIR}, property 9187 Remove the attachment directory. This command removes the @samp{DIR} 9188 property and asks the user to either move content inside that 9189 folder, if an @samp{ID} property is set, delete the content, or to 9190 leave the attachment directory as is but no longer attached to the 9191 outline node. 9192 @end table 9193 @end table 9194 9195 @node Attachment options 9196 @subsection Attachment options 9197 9198 There are a couple of options for attachments that are worth 9199 mentioning. 9200 9201 @table @asis 9202 @item @code{org-attach-id-dir} 9203 @vindex org-attach-id-dir 9204 The directory where attachments are stored when @samp{ID} is used as 9205 method. 9206 9207 @item @code{org-attach-dir-relative} 9208 @vindex org-attach-dir-relative 9209 When setting the @samp{DIR} property on a node using @kbd{C-c C-a s} 9210 (@code{org-attach-set-directory}), absolute links are entered by default. 9211 This option changes that to relative links. 9212 9213 @item @code{org-attach-use-inheritance} 9214 @vindex org-attach-use-inheritance 9215 By default folders attached to an outline node are inherited from 9216 parents according to @code{org-use-property-inheritance}. If one instead 9217 want to set inheritance specifically for Org attach that can be done 9218 using @code{org-attach-use-inheritance}. Inheriting documents through 9219 the node hierarchy makes a lot of sense in most cases. Especially 9220 when using attachment links (see @ref{Attachment links}). The following 9221 example shows one use case for attachment inheritance: 9222 9223 @example 9224 * Chapter A ... 9225 :PROPERTIES: 9226 :DIR: Chapter A/ 9227 :END: 9228 ** Introduction 9229 Some text 9230 9231 #+NAME: Image 1 9232 [[attachment:image 1.jpg]] 9233 @end example 9234 9235 Without inheritance one would not be able to resolve the link to 9236 @samp{image 1.jpg}, since the link is inside a sub-heading to @samp{Chapter 9237 A}. 9238 9239 Inheritance works the same way for both @samp{ID} and @samp{DIR} property. If 9240 both properties are defined on the same headline then @samp{DIR} takes 9241 precedence. This is also true if inheritance is enabled. If @samp{DIR} 9242 is inherited from a parent node in the outline, that property still 9243 takes precedence over an @samp{ID} property defined on the node itself. 9244 9245 @item @code{org-attach-method} 9246 @vindex org-attach-method 9247 When attaching files using the dispatcher @kbd{C-c C-a} it 9248 defaults to copying files. The behavior can be changed by 9249 customizing @code{org-attach-method}. Options are Copy, Move/Rename, 9250 Hard link or Symbolic link. 9251 9252 @item @code{org-attach-preferred-new-method} 9253 @vindex org-attach-preferred-new-method 9254 This customization lets you choose the default way to attach to 9255 nodes without existing @samp{ID} and @samp{DIR} property. It defaults to @code{id} 9256 but can also be set to @code{dir}, @code{ask} or @code{nil}. 9257 9258 @item @code{org-attach-archive-delete} 9259 @vindex org-attach-archive-delete 9260 Configure this to determine if attachments should be deleted or not 9261 when a subtree that has attachments is archived. 9262 9263 @item @code{org-attach-auto-tag} 9264 @vindex org-attach-auto-tag 9265 When attaching files to a heading it will be assigned a tag 9266 according to what is set here. 9267 9268 @item @code{org-attach-id-to-path-function-list} 9269 @vindex org-attach-id-to-path-function-list 9270 When @samp{ID} is used for attachments, the ID is parsed into a part of a 9271 directory-path. See @code{org-attach-id-uuid-folder-format} for the 9272 default function. Define a new one and add it as first element in 9273 @code{org-attach-id-to-path-function-list} if you want the folder 9274 structure in any other way. All functions in this list will be 9275 tried when resolving existing ID's into paths, to maintain backward 9276 compatibility with existing folders in your system. 9277 9278 @item @code{org-attach-store-link-p} 9279 @vindex org-attach-store-link-p 9280 Stores a link to the file that is being attached. The link is 9281 stored in @code{org-stored-links} for later insertion with @kbd{C-c C-l} (see @ref{Handling Links}). Depending on what option is set in 9282 @code{org-attach-store-link-p}, the link is stored to either the original 9283 location as a file link, the attachment location as an attachment 9284 link or to the attachment location as a file link. 9285 9286 @item @code{org-attach-commands} 9287 @vindex org-attach-commands 9288 List of all commands used in the attach dispatcher. 9289 9290 @item @code{org-attach-expert} 9291 @vindex org-attach-expert 9292 Do not show the splash buffer with the attach dispatcher when 9293 @code{org-attach-expert} is set to non-@code{nil}. 9294 @end table 9295 9296 See customization group @samp{Org Attach} if you want to change the 9297 default settings. 9298 9299 @node Attachment links 9300 @subsection Attachment links 9301 9302 Attached files and folders can be referenced using attachment links. 9303 This makes it easy to refer to the material added to an outline node. 9304 Especially if it was attached using the unique ID of the entry! 9305 9306 @example 9307 * TODO Some task 9308 :PROPERTIES: 9309 :ID: 95d50008-c12e-479f-a4f2-cc0238205319 9310 :END: 9311 See attached document for more information: [[attachment:info.org]] 9312 @end example 9313 9314 See @ref{External Links} for more information about these links. 9315 9316 @node Automatic version-control with Git 9317 @subsection Automatic version-control with Git 9318 9319 If the directory attached to an outline node is a Git repository, Org 9320 can be configured to automatically commit changes to that repository 9321 when it sees them. 9322 9323 To make Org mode take care of versioning of attachments for you, add 9324 the following to your Emacs config: 9325 9326 @lisp 9327 (require 'org-attach-git) 9328 @end lisp 9329 9330 @node Attach from Dired 9331 @subsection Attach from Dired 9332 9333 @cindex attach from Dired 9334 @findex org-attach-dired-to-subtree 9335 9336 It is possible to attach files to a subtree from a Dired buffer. To 9337 use this feature, have one window in Dired mode containing the file(s) 9338 to be attached and another window with point in the subtree that shall 9339 get the attachments. In the Dired window, with point on a file, 9340 @kbd{M-x org-attach-dired-to-subtree} attaches the file to the 9341 subtree using the attachment method set by variable 9342 @code{org-attach-method}. When files are marked in the Dired window then 9343 all marked files get attached. 9344 9345 Add the following lines to the Emacs init file to have @kbd{C-c C-x a} attach files in Dired buffers. 9346 9347 @lisp 9348 (add-hook 'dired-mode-hook 9349 (lambda () 9350 (define-key dired-mode-map 9351 (kbd "C-c C-x a") 9352 #'org-attach-dired-to-subtree))) 9353 @end lisp 9354 9355 The following code shows how to bind the previous command with 9356 a specific attachment method. 9357 9358 @lisp 9359 (add-hook 'dired-mode-hook 9360 (lambda () 9361 (define-key dired-mode-map (kbd "C-c C-x c") 9362 (lambda () 9363 (interactive) 9364 (let ((org-attach-method 'cp)) 9365 (call-interactively #'org-attach-dired-to-subtree)))))) 9366 @end lisp 9367 9368 @node RSS Feeds 9369 @section RSS Feeds 9370 9371 @cindex RSS feeds 9372 @cindex Atom feeds 9373 9374 Org can add and change entries based on information found in RSS feeds 9375 and Atom feeds. You could use this to make a task out of each new 9376 podcast in a podcast feed. Or you could use a phone-based 9377 note-creating service on the web to import tasks into Org. To access 9378 feeds, configure the variable @code{org-feed-alist}. The docstring of this 9379 variable has detailed information. With the following 9380 9381 @lisp 9382 (setq org-feed-alist 9383 '(("Slashdot" 9384 "https://rss.slashdot.org/Slashdot/slashdot" 9385 "~/txt/org/feeds.org" "Slashdot Entries"))) 9386 @end lisp 9387 9388 @noindent 9389 new items from the feed provided by @samp{rss.slashdot.org} result in new 9390 entries in the file @samp{~/org/feeds.org} under the heading @samp{Slashdot 9391 Entries}, whenever the following command is used: 9392 9393 @table @asis 9394 @item @kbd{C-c C-x g} (@code{org-feed-update-all}) 9395 @kindex C-c C-x g 9396 Collect items from the feeds configured in @code{org-feed-alist} and act 9397 upon them. 9398 9399 @item @kbd{C-c C-x G} (@code{org-feed-goto-inbox}) 9400 @kindex C-c C-x G 9401 Prompt for a feed name and go to the inbox configured for this feed. 9402 @end table 9403 9404 Under the same headline, Org creates a drawer @samp{FEEDSTATUS} in which it 9405 stores information about the status of items in the feed, to avoid 9406 adding the same item several times. 9407 9408 For more information, including how to read atom feeds, see 9409 @samp{org-feed.el} and the docstring of @code{org-feed-alist}. 9410 9411 @node Agenda Views 9412 @chapter Agenda Views 9413 9414 @cindex agenda views 9415 9416 Due to the way Org works, TODO items, time-stamped items, and tagged 9417 headlines can be scattered throughout a file or even a number of 9418 files. To get an overview of open action items, or of events that are 9419 important for a particular date, this information must be collected, 9420 sorted and displayed in an organized way. 9421 9422 Org can select items based on various criteria and display them in 9423 a separate buffer. Six different view types are provided: 9424 9425 @itemize 9426 @item 9427 an @emph{agenda} that is like a calendar and shows information for 9428 specific dates, 9429 9430 @item 9431 a @emph{TODO list} that covers all unfinished action items, 9432 9433 @item 9434 a @emph{match view}, showings headlines based on the tags, properties, 9435 and TODO state associated with them, 9436 9437 @item 9438 a @emph{text search view} that shows all entries from multiple files that 9439 contain specified keywords, 9440 9441 @item 9442 a @emph{stuck projects view} showing projects that currently do not move 9443 along, and 9444 9445 @item 9446 @emph{custom views} that are special searches and combinations of 9447 different views. 9448 @end itemize 9449 9450 The extracted information is displayed in a special @emph{agenda buffer}. 9451 This buffer is read-only, but provides commands to visit the 9452 corresponding locations in the original Org files, and even to edit 9453 these files remotely. 9454 9455 @vindex org-agenda-skip-comment-trees 9456 @vindex org-agenda-skip-archived-trees 9457 @cindex commented entries, in agenda views 9458 @cindex archived entries, in agenda views 9459 By default, the report ignores commented (see @ref{Comment Lines}) and 9460 archived (see @ref{Internal archiving}) entries. You can override this by 9461 setting @code{org-agenda-skip-comment-trees} and 9462 @code{org-agenda-skip-archived-trees} to @code{nil}. 9463 9464 @vindex org-agenda-window-setup 9465 @vindex org-agenda-restore-windows-after-quit 9466 Two variables control how the agenda buffer is displayed and whether 9467 the window configuration is restored when the agenda exits: 9468 @code{org-agenda-window-setup} and @code{org-agenda-restore-windows-after-quit}. 9469 9470 @menu 9471 * Agenda Files:: Files being searched for agenda information. 9472 * Agenda Dispatcher:: Keyboard access to agenda views. 9473 * Built-in Agenda Views:: What is available out of the box? 9474 * Presentation and Sorting:: How agenda items are prepared for display. 9475 * Agenda Commands:: Remote editing of Org trees. 9476 * Custom Agenda Views:: Defining special searches and views. 9477 * Exporting Agenda Views:: Writing a view to a file. 9478 * Agenda Column View:: Using column view for collected entries. 9479 @end menu 9480 9481 @node Agenda Files 9482 @section Agenda Files 9483 9484 @cindex agenda files 9485 @cindex files for agenda 9486 9487 @vindex org-agenda-files 9488 The information to be shown is normally collected from all @emph{agenda 9489 files}, the files listed in the variable @code{org-agenda-files}@footnote{ If 9490 the value of that variable is not a list, but a single file name, then 9491 the list of agenda files in maintained in that external file.}. If a 9492 directory is part of this list, all files with the extension @samp{.org} in 9493 this directory are part of the list. 9494 9495 Thus, even if you only work with a single Org file, that file should 9496 be put into the list@footnote{ When using the dispatcher, pressing 9497 @kbd{<} before selecting a command actually limits the command to 9498 the current file, and ignores @code{org-agenda-files} until the next 9499 dispatcher command.}. You can customize @code{org-agenda-files}, but the 9500 easiest way to maintain it is through the following commands 9501 9502 @table @asis 9503 @item @kbd{C-c [} (@code{org-agenda-file-to-front}) 9504 @kindex C-c [ 9505 @findex org-agenda-file-to-front 9506 @cindex files, adding to agenda list 9507 Add current file to the list of agenda files. The file is added to 9508 the front of the list. If it was already in the list, it is moved 9509 to the front. With a prefix argument, file is added/moved to the 9510 end. 9511 9512 @item @kbd{C-c ]} (@code{org-remove-file}) 9513 @kindex C-c ] 9514 @findex org-remove-file 9515 Remove current file from the list of agenda files. 9516 9517 @item @kbd{C-'} 9518 @itemx @kbd{C-,} (@code{org-cycle-agenda-files}) 9519 @kindex C-' 9520 @kindex C-, 9521 @findex org-cycle-agenda-files 9522 @cindex cycling, of agenda files 9523 Cycle through agenda file list, visiting one file after the other. 9524 9525 @item @kbd{M-x org-switchb} 9526 @findex org-switchb 9527 Command to use an Iswitchb-like interface to switch to and between 9528 Org buffers. 9529 @end table 9530 9531 @noindent 9532 The Org menu contains the current list of files and can be used to 9533 visit any of them. 9534 9535 If you would like to focus the agenda temporarily on a file not in 9536 this list, or on just one file in the list, or even on only a subtree 9537 in a file, then this can be done in different ways. For a single 9538 agenda command, you may press @kbd{<} once or several times in 9539 the dispatcher (see @ref{Agenda Dispatcher}). To restrict the agenda 9540 scope for an extended period, use the following commands: 9541 9542 @table @asis 9543 @item @kbd{C-c C-x <} (@code{org-agenda-set-restriction-lock}) 9544 @kindex C-c C-x < 9545 @findex org-agenda-set-restriction-lock 9546 Restrict the agenda to the current subtree. If there already is 9547 a restriction at point, remove it. When called with a universal 9548 prefix argument or with point before the first headline in a file, 9549 set the agenda scope to the entire file. This restriction remains 9550 in effect until removed with @kbd{C-c C-x >}, or by typing 9551 either @kbd{<} or @kbd{>} in the agenda dispatcher. If 9552 there is a window displaying an agenda view, the new restriction 9553 takes effect immediately. 9554 9555 @item @kbd{C-c C-x >} (@code{org-agenda-remove-restriction-lock}) 9556 @kindex C-c C-x > 9557 @findex org-agenda-remove-restriction-lock 9558 Remove the restriction created by @kbd{C-c C-x <}. 9559 @end table 9560 9561 When working with Speedbar, you can use the following commands in the 9562 Speedbar frame: 9563 9564 @table @asis 9565 @item @kbd{<} (@code{org-speedbar-set-agenda-restriction}) 9566 @findex org-speedbar-set-agenda-restriction 9567 Restrict the agenda to the item---either an Org file or a subtree in 9568 such a file---at point in the Speedbar frame. If agenda is already 9569 restricted there, remove the restriction. If there is a window 9570 displaying an agenda view, the new restriction takes effect 9571 immediately. 9572 9573 @item @kbd{>} (@code{org-agenda-remove-restriction-lock}) 9574 @findex org-agenda-remove-restriction-lock 9575 Remove the restriction. 9576 @end table 9577 9578 @node Agenda Dispatcher 9579 @section The Agenda Dispatcher 9580 9581 @cindex agenda dispatcher 9582 @cindex dispatching agenda commands 9583 9584 The views are created through a dispatcher, accessible with @kbd{M-x org-agenda}, or, better, bound to a global key (see @ref{Activation}). 9585 It displays a menu from which an additional letter is required to 9586 execute a command. The dispatcher offers the following default 9587 commands: 9588 9589 @table @asis 9590 @item @kbd{a} 9591 Create the calendar-like agenda (see @ref{Weekly/daily agenda}). 9592 9593 @item @kbd{t} 9594 @itemx @kbd{T} 9595 Create a list of all TODO items (see @ref{Global TODO list}). 9596 9597 @item @kbd{m} 9598 @itemx @kbd{M} 9599 Create a list of headlines matching a given expression (see 9600 @ref{Matching tags and properties}). 9601 9602 @item @kbd{s} 9603 @kindex s @r{(Agenda dispatcher)} 9604 Create a list of entries selected by a boolean expression of 9605 keywords and/or regular expressions that must or must not occur in 9606 the entry. 9607 9608 @item @kbd{/} 9609 @kindex / @r{(Agenda dispatcher)} 9610 @vindex org-agenda-text-search-extra-files 9611 Search for a regular expression in all agenda files and additionally 9612 in the files listed in @code{org-agenda-text-search-extra-files}. This 9613 uses the Emacs command @code{multi-occur}. A prefix argument can be used 9614 to specify the number of context lines for each match, the default 9615 is 1. 9616 9617 @item @kbd{#} 9618 Create a list of stuck projects (see @ref{Stuck projects}). 9619 9620 @item @kbd{!} 9621 Configure the list of stuck projects (see @ref{Stuck projects}). 9622 9623 @item @kbd{<} 9624 @kindex < @r{(Agenda dispatcher)} 9625 Restrict an agenda command to the current buffer@footnote{ For backward 9626 compatibility, you can also press @kbd{1} to restrict to the 9627 current buffer.}. If narrowing is in effect restrict to the 9628 narrowed part of the buffer. After pressing @kbd{<}, you still 9629 need to press the character selecting the command. 9630 9631 @item @kbd{< <} 9632 @kindex < < @r{(Agenda dispatcher)} 9633 If there is an active region, restrict the following agenda command 9634 to the region. Otherwise, restrict it to the current subtree. 9635 After pressing @kbd{< <}, you still need to press the character 9636 selecting the command. 9637 9638 @item @kbd{*} 9639 @kindex * @r{(Agenda dispatcher)} 9640 @vindex org-agenda-sticky 9641 @findex org-toggle-sticky-agenda 9642 Toggle sticky agenda views. By default, Org maintains only a single 9643 agenda buffer and rebuilds it each time you change the view, to make 9644 sure everything is always up to date. If you switch between views 9645 often and the build time bothers you, you can turn on sticky agenda 9646 buffers (make this the default by customizing the variable 9647 @code{org-agenda-sticky}). With sticky agendas, the dispatcher only 9648 switches to the selected view, you need to update it by hand with 9649 @kbd{r} or @kbd{g}. You can toggle sticky agenda view any 9650 time with @code{org-toggle-sticky-agenda}. 9651 @end table 9652 9653 You can also define custom commands that are accessible through the 9654 dispatcher, just like the default commands. This includes the 9655 possibility to create extended agenda buffers that contain several 9656 blocks together, for example the weekly agenda, the global TODO list 9657 and a number of special tags matches. See @ref{Custom Agenda Views}. 9658 9659 @node Built-in Agenda Views 9660 @section The Built-in Agenda Views 9661 9662 In this section we describe the built-in views. 9663 9664 @menu 9665 * Weekly/daily agenda:: The calendar page with current tasks. 9666 * Global TODO list:: All unfinished action items. 9667 * Matching tags and properties:: Structured information with fine-tuned search. 9668 * Search view:: Find entries by searching for text. 9669 * Stuck projects:: Find projects you need to review. 9670 @end menu 9671 9672 @node Weekly/daily agenda 9673 @subsection Weekly/daily agenda 9674 9675 @cindex agenda 9676 @cindex weekly agenda 9677 @cindex daily agenda 9678 9679 The purpose of the weekly/daily @emph{agenda} is to act like a page of 9680 a paper agenda, showing all the tasks for the current week or day. 9681 9682 @table @asis 9683 @item @kbd{M-x org-agenda a} (@code{org-agenda-list}) 9684 @kindex a @r{(Agenda dispatcher)} 9685 @findex org-agenda-list 9686 @cindex org-agenda, command 9687 Compile an agenda for the current week from a list of Org files. 9688 The agenda shows the entries for each day. With a numeric prefix 9689 argument@footnote{For backward compatibility, the universal prefix argument 9690 @kbd{C-u} causes all TODO entries to be listed before the agenda. 9691 This feature is deprecated, use the dedicated TODO list, or a block 9692 agenda instead (see @ref{Block agenda}).}---like @kbd{C-u 2 1 M-x org-agenda a}---you may 9693 set the number of days to be displayed. 9694 @end table 9695 9696 @vindex org-agenda-span 9697 @vindex org-agenda-start-day 9698 @vindex org-agenda-start-on-weekday 9699 The default number of days displayed in the agenda is set by the 9700 variable @code{org-agenda-span}. This variable can be set to any number of 9701 days you want to see by default in the agenda, or to a span name, such 9702 a @code{day}, @code{week}, @code{month} or @code{year}. For weekly agendas, the default 9703 is to start on the previous Monday (see 9704 @code{org-agenda-start-on-weekday}). You can also set the start date using 9705 a date shift: @samp{(setq org-agenda-start-day "+10d")} starts the agenda 9706 ten days from today in the future. @code{org-agenda-start-on-weekday} 9707 takes precedence over @code{org-agenda-start-day} in weekly and bi-weekly 9708 agendas. 9709 9710 Remote editing from the agenda buffer means, for example, that you can 9711 change the dates of deadlines and appointments from the agenda buffer. 9712 The commands available in the Agenda buffer are listed in @ref{Agenda Commands}. 9713 9714 @anchor{Calendar/Diary integration} 9715 @subsubheading Calendar/Diary integration 9716 9717 @cindex calendar integration 9718 @cindex diary integration 9719 9720 Emacs contains the calendar and diary by Edward@tie{}M@.@tie{}Reingold. The 9721 calendar displays a three-month calendar with holidays from different 9722 countries and cultures. The diary allows you to keep track of 9723 anniversaries, lunar phases, sunrise/set, recurrent appointments 9724 (weekly, monthly) and more. In this way, it is quite complementary to 9725 Org. It can be very useful to combine output from Org with the diary. 9726 9727 In order to include entries from the Emacs diary into Org mode's 9728 agenda, you only need to customize the variable 9729 9730 @lisp 9731 (setq org-agenda-include-diary t) 9732 @end lisp 9733 9734 @noindent 9735 After that, everything happens automatically. All diary entries 9736 including holidays, anniversaries, etc., are included in the agenda 9737 buffer created by Org mode. @kbd{@key{SPC}}, @kbd{@key{TAB}}, and 9738 @kbd{@key{RET}} can be used from the agenda buffer to jump to the diary 9739 file in order to edit existing diary entries. The @kbd{i} 9740 command to insert new entries for the current date works in the agenda 9741 buffer, as well as the commands @kbd{S}, @kbd{M}, and 9742 @kbd{C} to display Sunrise/Sunset times, show lunar phases and to 9743 convert to other calendars, respectively. @kbd{c} can be used to 9744 switch back and forth between calendar and agenda. 9745 9746 If you are using the diary only for expression entries and holidays, 9747 it is faster to not use the above setting, but instead to copy or even 9748 move the entries into an Org file. Org mode evaluates diary-style 9749 expression entries, and does it faster because there is no overhead 9750 for first creating the diary display. Note that the expression 9751 entries must start at the left margin, no whitespace is allowed before 9752 them, as seen in the following segment of an Org file:@footnote{ The 9753 variable @code{org-anniversary} used in the example is just like 9754 @code{diary-anniversary}, but the argument order is always according to ISO 9755 and therefore independent of the value of @code{calendar-date-style}.} 9756 9757 @example 9758 * Holidays 9759 :PROPERTIES: 9760 :CATEGORY: Holiday 9761 :END: 9762 %%(org-calendar-holiday) ; special function for holiday names 9763 9764 * Birthdays 9765 :PROPERTIES: 9766 :CATEGORY: Ann 9767 :END: 9768 %%(org-anniversary 1956 5 14) Arthur Dent is %d years old 9769 %%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old 9770 @end example 9771 9772 @anchor{Anniversaries from BBDB} 9773 @subsubheading Anniversaries from BBDB 9774 9775 @cindex BBDB, anniversaries 9776 @cindex anniversaries, from BBDB 9777 9778 @findex org-bbdb-anniversaries 9779 If you are using the Insidious Big Brother Database to store your 9780 contacts, you very likely prefer to store anniversaries in BBDB rather 9781 than in a separate Org or diary file. Org supports this and can show 9782 BBDB anniversaries as part of the agenda. All you need to do is to 9783 add the following to one of your agenda files: 9784 9785 @example 9786 * Anniversaries 9787 :PROPERTIES: 9788 :CATEGORY: Anniv 9789 :END: 9790 %%(org-bbdb-anniversaries) 9791 @end example 9792 9793 You can then go ahead and define anniversaries for a BBDB record. 9794 Basically, you need a field named @samp{anniversary} for the BBDB record 9795 which contains the date in the format @samp{YYYY-MM-DD} or @samp{MM-DD}, 9796 followed by a space and the class of the anniversary (@samp{birthday}, 9797 @samp{wedding}, or a format string). If you omit the class, it defaults to 9798 @samp{birthday}. Here are a few examples, the header for the file 9799 @samp{ol-bbdb.el} contains more detailed information. 9800 9801 @example 9802 1973-06-22 9803 06-22 9804 1955-08-02 wedding 9805 2008-04-14 %s released version 6.01 of Org mode, %d years ago 9806 @end example 9807 9808 After a change to BBDB, or for the first agenda display during an 9809 Emacs session, the agenda display suffers a short delay as Org updates 9810 its hash with anniversaries. However, from then on things will be 9811 very fast, much faster in fact than a long list of 9812 @samp{%%(diary-anniversary)} entries in an Org or Diary file. 9813 9814 @findex org-bbdb-anniversaries-future 9815 If you would like to see upcoming anniversaries with a bit of 9816 forewarning, you can use the following instead: 9817 9818 @example 9819 * Anniversaries 9820 :PROPERTIES: 9821 :CATEGORY: Anniv 9822 :END: 9823 %%(org-bbdb-anniversaries-future 3) 9824 @end example 9825 9826 That will give you three days' warning: on the anniversary date itself 9827 and the two days prior. The argument is optional: if omitted, it 9828 defaults to 7. 9829 9830 @anchor{Appointment reminders} 9831 @subsubheading Appointment reminders 9832 9833 @cindex @file{appt.el} 9834 @cindex appointment reminders 9835 @cindex appointment 9836 @cindex reminders 9837 9838 @cindex APPT_WARNTIME, keyword 9839 Org can interact with Emacs appointments notification facility. To 9840 add the appointments of your agenda files, use the command 9841 @code{org-agenda-to-appt}. This command lets you filter through the list 9842 of your appointments and add only those belonging to a specific 9843 category or matching a regular expression. It also reads 9844 a @samp{APPT_WARNTIME} property which overrides the value of 9845 @code{appt-message-warning-time} for this appointment. See the docstring 9846 for details. 9847 9848 @node Global TODO list 9849 @subsection The global TODO list 9850 9851 @cindex global TODO list 9852 @cindex TODO list, global 9853 9854 The global TODO list contains all unfinished TODO items formatted and 9855 collected into a single place. 9856 9857 @table @asis 9858 @item @kbd{M-x org-agenda t} (@code{org-todo-list}) 9859 @kindex t @r{(Agenda dispatcher)} 9860 @findex org-todo-list 9861 Show the global TODO list. This collects the TODO items from all 9862 agenda files (see @ref{Agenda Views}) into a single buffer. By default, 9863 this lists items with a state that is not a DONE state. The buffer 9864 is in Agenda mode, so there are commands to examine and manipulate 9865 the TODO entries directly from that buffer (see @ref{Agenda Commands}). 9866 9867 @item @kbd{M-x org-agenda T} (@code{org-todo-list}) 9868 @kindex T @r{(Agenda dispatcher)} 9869 @findex org-todo-list 9870 @cindex TODO keyword matching 9871 @vindex org-todo-keywords 9872 Like the above, but allows selection of a specific TODO keyword. 9873 You can also do this by specifying a prefix argument to 9874 @kbd{t}. You are prompted for a keyword, and you may also 9875 specify several keywords by separating them with @samp{|} as the boolean 9876 OR operator. With a numeric prefix, the Nth keyword in 9877 @code{org-todo-keywords} is selected. 9878 9879 @kindex r 9880 The @kbd{r} key in the agenda buffer regenerates it, and you 9881 can give a prefix argument to this command to change the selected 9882 TODO keyword, for example @kbd{3 r}. If you often need 9883 a search for a specific keyword, define a custom command for it (see 9884 @ref{Agenda Dispatcher}). 9885 9886 Matching specific TODO keywords can also be done as part of a tags 9887 search (see @ref{Tag Searches}). 9888 @end table 9889 9890 Remote editing of TODO items means that you can change the state of 9891 a TODO entry with a single key press. The commands available in the 9892 TODO list are described in @ref{Agenda Commands}. 9893 9894 @cindex sublevels, inclusion into TODO list 9895 Normally the global TODO list simply shows all headlines with TODO 9896 keywords. This list can become very long. There are two ways to keep 9897 it more compact: 9898 9899 @itemize 9900 @item 9901 @vindex org-agenda-todo-ignore-scheduled 9902 @vindex org-agenda-todo-ignore-deadlines 9903 @vindex org-agenda-todo-ignore-timestamp 9904 @vindex org-agenda-todo-ignore-with-date 9905 Some people view a TODO item that has been @emph{scheduled} for execution 9906 or have a @emph{deadline} (see @ref{Timestamps}) as no longer @emph{open}. 9907 Configure the variables @code{org-agenda-todo-ignore-scheduled} to 9908 exclude some or all scheduled items from the global TODO list, 9909 @code{org-agenda-todo-ignore-deadlines} to exclude some or all items with 9910 a deadline set, @code{org-agenda-todo-ignore-timestamp} to exclude some 9911 or all items with an active timestamp other than a DEADLINE or 9912 a SCHEDULED timestamp and/or @code{org-agenda-todo-ignore-with-date} to 9913 exclude items with at least one active timestamp. 9914 9915 @item 9916 @vindex org-agenda-todo-list-sublevels 9917 TODO items may have sublevels to break up the task into subtasks. 9918 In such cases it may be enough to list only the highest level TODO 9919 headline and omit the sublevels from the global list. Configure the 9920 variable @code{org-agenda-todo-list-sublevels} to get this behavior. 9921 @end itemize 9922 9923 @node Matching tags and properties 9924 @subsection Matching tags and properties 9925 9926 @cindex matching, of tags 9927 @cindex matching, of properties 9928 @cindex tags view 9929 @cindex match view 9930 9931 If headlines in the agenda files are marked with @emph{tags} (see @ref{Tags}), 9932 or have properties (see @ref{Properties and Columns}), you can select 9933 headlines based on this metadata and collect them into an agenda 9934 buffer. The match syntax described here also applies when creating 9935 sparse trees with @kbd{C-c / m}. 9936 9937 @table @asis 9938 @item @kbd{M-x org-agenda m} (@code{org-tags-view}) 9939 @kindex m @r{(Agenda dispatcher)} 9940 @findex org-tags-view 9941 Produce a list of all headlines that match a given set of tags. The 9942 command prompts for a selection criterion, which is a boolean logic 9943 expression with tags, like @samp{+work+urgent-withboss} or @samp{work|home} 9944 (see @ref{Tags}). If you often need a specific search, define a custom 9945 command for it (see @ref{Agenda Dispatcher}). 9946 9947 @item @kbd{M-x org-agenda M} (@code{org-tags-view}) 9948 @kindex M @r{(Agenda dispatcher)} 9949 @findex org-tags-view 9950 @vindex org-agenda-tags-todo-honor-ignore-options 9951 Like @kbd{m}, but only select headlines that are also TODO 9952 items. To exclude scheduled/deadline items, see the variable 9953 @code{org-agenda-tags-todo-honor-ignore-options}. Matching specific TODO 9954 keywords together with a tags match is also possible, see @ref{Tag Searches}. 9955 @end table 9956 9957 The commands available in the tags list are described in @ref{Agenda Commands}. 9958 9959 @cindex boolean logic, for agenda searches 9960 A search string can use Boolean operators @samp{&} for AND and @samp{|} for OR@. 9961 @samp{&} binds more strongly than @samp{|}. Parentheses are currently not 9962 implemented. Each element in the search is either a tag, a regular 9963 expression matching tags, or an expression like @samp{PROPERTY OPERATOR 9964 VALUE} with a comparison operator, accessing a property value. Each 9965 element may be preceded by @samp{-} to select against it, and @samp{+} is 9966 syntactic sugar for positive selection. The AND operator @samp{&} is 9967 optional when @samp{+} or @samp{-} is present. Here are some examples, using 9968 only tags. 9969 9970 @table @asis 9971 @item @samp{+work-boss} 9972 Select headlines tagged @samp{work}, but discard those also tagged 9973 @samp{boss}. 9974 9975 @item @samp{work|laptop} 9976 Selects lines tagged @samp{work} or @samp{laptop}. 9977 9978 @item @samp{work|laptop+night} 9979 Like before, but require the @samp{laptop} lines to be tagged also 9980 @samp{night}. 9981 @end table 9982 9983 @cindex regular expressions, with tags search 9984 Instead of a tag, you may also specify a regular expression enclosed 9985 in curly braces (see @ref{Regular Expressions}). For example, 9986 @samp{work+@{^boss.*@}} matches headlines that contain the tag @samp{:work:} and 9987 any tag @emph{starting} with @samp{boss}. 9988 9989 @cindex group tags, as regular expressions 9990 Group tags (see @ref{Tag Hierarchy}) are expanded as regular expressions. 9991 E.g., if @samp{work} is a group tag for the group @samp{:work:lab:conf:}, then 9992 searching for @samp{work} also searches for @samp{@{\(?:work\|lab\|conf\)@}} and 9993 searching for @samp{-work} searches for all headlines but those with one of 9994 the tags in the group (i.e., @samp{-@{\(?:work\|lab\|conf\)@}}). 9995 9996 @cindex TODO keyword matching, with tags search 9997 @cindex level, for tags/property match 9998 @cindex category, for tags/property match 9999 @vindex org-odd-levels-only 10000 You may also test for properties (see @ref{Properties and Columns}) at the 10001 same time as matching tags. The properties may be real properties, or 10002 special properties that represent other metadata (see @ref{Special Properties}). For example, the property @samp{TODO} represents the TODO 10003 keyword of the entry. Or, the property @samp{LEVEL} represents the level 10004 of an entry. So searching @samp{+LEVEL=3+boss-TODO="DONE"} lists all level 10005 three headlines that have the tag @samp{boss} and are @emph{not} marked with the 10006 TODO keyword @samp{DONE}. In buffers with @code{org-odd-levels-only} set, 10007 @samp{LEVEL} does not count the number of stars, but @samp{LEVEL=2} corresponds 10008 to 3 stars etc. 10009 10010 Here are more examples: 10011 10012 @table @asis 10013 @item @samp{work+TODO="WAITING"} 10014 Select @samp{work}-tagged TODO lines with the specific TODO keyword 10015 @samp{WAITING}. 10016 10017 @item @samp{work+TODO="WAITING"|home+TODO="WAITING"} 10018 Waiting tasks both at work and at home. 10019 @end table 10020 10021 When matching properties, a number of different operators can be used 10022 to test the value of a property. Here is a complex example: 10023 10024 @example 10025 +work-boss+PRIORITY="A"+Coffee="unlimited"+Effort<*2 10026 +With=@{Sarah\|Denny@}+SCHEDULED>="<2008-10-11>" 10027 @end example 10028 10029 @cindex operator, for property search 10030 @noindent 10031 The type of comparison depends on how the comparison value is written: 10032 10033 @itemize 10034 @item 10035 If the comparison value is a plain number, a numerical comparison is 10036 done, and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=}, @samp{>=}, and 10037 @samp{<>}. As a synonym for the equality operator @samp{=}, there is also 10038 @samp{==}; @samp{!=} and @samp{/=} are synonyms of the inequality operator @samp{<>}. 10039 10040 @item 10041 If the comparison value is enclosed in double-quotes, a string 10042 comparison is done, and the same operators are allowed. 10043 10044 @item 10045 If the comparison value is enclosed in double-quotes @emph{and} angular 10046 brackets (like @samp{DEADLINE<="<2008-12-24 18:30>"}), both values are 10047 assumed to be date/time specifications in the standard Org way, and 10048 the comparison is done accordingly. Valid values also include 10049 @samp{"<now>"} for now (including time), @samp{"<today>"}, and @samp{"<tomorrow>"} 10050 for these days at 0:00 hours, i.e., without a time specification. 10051 You can also use strings like @samp{"<+5d>"} or @samp{"<-2m>"} with units @samp{d}, 10052 @samp{w}, @samp{m}, and @samp{y} for day, week, month, and year, respectively. 10053 10054 @item 10055 If the comparison value is enclosed in curly braces, a regexp match 10056 is performed, with @samp{=} meaning that the regexp matches the property 10057 value, and @samp{<>} meaning that it does not match. 10058 10059 @item 10060 All operators may be optionally followed by an asterisk @samp{*}, like in 10061 @samp{<*}, @samp{!=*}, etc. Such @emph{starred operators} work like their regular, 10062 unstarred counterparts except that they match only headlines where 10063 the tested property is actually present. This is most useful for 10064 search terms that logically exclude results, like the inequality 10065 operator. 10066 @end itemize 10067 10068 So the search string in the example finds entries tagged @samp{work} but 10069 not @samp{boss}, which also have a priority value @samp{A}, a @samp{Coffee} property 10070 with the value @samp{unlimited}, an @samp{EFFORT} property that is numerically 10071 smaller than 2, a @samp{With} property that is matched by the regular 10072 expression @samp{Sarah\|Denny}, and that are scheduled on or after October 10073 11, 2008. 10074 10075 Note that the test on the @samp{EFFORT} property uses operator @samp{<*}, so 10076 that the search result will include only entries that actually have an 10077 @samp{EFFORT} property defined and with numerical value smaller than 2. 10078 With the regular @samp{<} operator, the search would handle entries without 10079 an @samp{EFFORT} property as having a zero effort and would include them in 10080 the result as well. 10081 10082 You can use all characters valid in property names when matching 10083 properties. However, you have to quote some characters in property 10084 names with backslashes when using them in search strings, namely all 10085 characters different from alphanumerics and underscores@footnote{ If you 10086 quote alphanumeric characters or underscores with a backslash, that 10087 backslash is ignored.}. For example, to search for all entries having 10088 a property @samp{boss-prio}, @samp{boss:prio}, or @samp{boss\prio}, respectively, 10089 with value @samp{C}, use search strings 10090 10091 @example 10092 boss\-prio="C" 10093 boss\:prio="C" 10094 boss\\prio="C" 10095 @end example 10096 10097 You can configure Org mode to use property inheritance during 10098 a search, but beware that this can slow down searches considerably. 10099 See @ref{Property Inheritance}, for details. 10100 10101 For backward compatibility, and also for typing speed, there is also 10102 a different way to test TODO states in a search. For this, terminate 10103 the tags/property part of the search string (which may include several 10104 terms connected with @samp{|}) with a @samp{/} and then specify a Boolean 10105 expression just for TODO keywords. The syntax is then similar to that 10106 for tags, but should be applied with care: for example, a positive 10107 selection on several TODO keywords cannot meaningfully be combined 10108 with boolean AND@. However, @emph{negative selection} combined with AND can 10109 be meaningful. To make sure that only lines are checked that actually 10110 have any TODO keyword (resulting in a speed-up), use @kbd{M-x org-agenda M}, or equivalently start the TODO part after the slash 10111 with @samp{!}. Using @kbd{M-x org-agenda M} or @samp{/!} does not match 10112 TODO keywords in a DONE state. Examples: 10113 10114 @table @asis 10115 @item @samp{work/WAITING} 10116 Same as @samp{work+TODO="WAITING"}. 10117 10118 @item @samp{work/!-WAITING-NEXT} 10119 Select @samp{work}-tagged TODO lines that are neither @samp{WAITING} nor 10120 @samp{NEXT}. 10121 10122 @item @samp{work/!+WAITING|+NEXT} 10123 Select @samp{work}-tagged TODO lines that are either @samp{WAITING} or @samp{NEXT}. 10124 @end table 10125 10126 @node Search view 10127 @subsection Search view 10128 10129 @cindex search view 10130 @cindex text search 10131 @cindex searching, for text 10132 10133 This agenda view is a general text search facility for Org mode 10134 entries. It is particularly useful to find notes. 10135 10136 @table @asis 10137 @item @kbd{M-x org-agenda s} (@code{org-search-view}) 10138 @kindex s @r{(Agenda dispatcher)} 10139 @findex org-search-view 10140 This is a special search that lets you select entries by matching 10141 a substring or specific words using a boolean logic. 10142 @end table 10143 10144 For example, the search string @samp{computer equipment} matches entries 10145 that contain @samp{computer equipment} as a substring, even if the two 10146 words are separated by more space or a line break. 10147 10148 Search view can also search for specific keywords in the entry, using 10149 Boolean logic. The search string @samp{+computer 10150 +wifi -ethernet -@{8\.11[bg]@}} matches note entries that contain the 10151 keywords @samp{computer} and @samp{wifi}, but not the keyword @samp{ethernet}, and 10152 which are also not matched by the regular expression @samp{8\.11[bg]}, 10153 meaning to exclude both @samp{8.11b} and @samp{8.11g}. The first @samp{+} is 10154 necessary to turn on boolean search, other @samp{+} characters are 10155 optional. For more details, see the docstring of the command 10156 @code{org-search-view}. 10157 10158 You can incrementally and conveniently adjust a boolean search from 10159 the agenda search view with the following keys 10160 10161 @multitable @columnfractions 0.1 0.6 10162 @item @kbd{[} 10163 @tab Add a positive search word 10164 @item @kbd{]} 10165 @tab Add a negative search word 10166 @item @kbd{@{} 10167 @tab Add a positive regular expression 10168 @item @kbd{@}} 10169 @tab Add a negative regular expression 10170 @end multitable 10171 10172 @vindex org-agenda-text-search-extra-files 10173 Note that in addition to the agenda files, this command also searches 10174 the files listed in @code{org-agenda-text-search-extra-files}. 10175 10176 @node Stuck projects 10177 @subsection Stuck projects 10178 10179 @pindex GTD, Getting Things Done 10180 10181 If you are following a system like David Allen's GTD to organize your 10182 work, one of the ``duties'' you have is a regular review to make sure 10183 that all projects move along. A @emph{stuck} project is a project that has 10184 no defined next actions, so it never shows up in the TODO lists Org 10185 mode produces. During the review, you need to identify such projects 10186 and define next actions for them. 10187 10188 @table @asis 10189 @item @kbd{M-x org-agenda #} (@code{org-agenda-list-stuck-projects}) 10190 @kindex # @r{(Agenda dispatcher)} 10191 @findex org-agenda-list-stuck-projects 10192 List projects that are stuck. 10193 10194 @item @kbd{M-x org-agenda !} 10195 @kindex ! @r{(Agenda dispatcher)} 10196 @vindex org-stuck-projects 10197 Customize the variable @code{org-stuck-projects} to define what a stuck 10198 project is and how to find it. 10199 @end table 10200 10201 You almost certainly need to configure this view before it works for 10202 you. The built-in default assumes that all your projects are level-2 10203 headlines, and that a project is not stuck if it has at least one 10204 entry marked with a TODO keyword @samp{TODO} or @samp{NEXT} or @samp{NEXTACTION}. 10205 10206 Let's assume that you, in your own way of using Org mode, identify 10207 projects with a tag @samp{:PROJECT:}, and that you use a TODO keyword 10208 @samp{MAYBE} to indicate a project that should not be considered yet. 10209 Let's further assume that the TODO keyword @samp{DONE} marks finished 10210 projects, and that @samp{NEXT} and @samp{TODO} indicate next actions. The tag 10211 @samp{:@@shop:} indicates shopping and is a next action even without the 10212 NEXT tag. Finally, if the project contains the special word @samp{IGNORE} 10213 anywhere, it should not be listed either. In this case you would 10214 start by identifying eligible projects with a tags/TODO match (see 10215 @ref{Tag Searches}) @samp{+PROJECT/-MAYBE-DONE}, and then check for @samp{TODO}, 10216 @samp{NEXT}, @samp{@@shop}, and @samp{IGNORE} in the subtree to identify projects that 10217 are not stuck. The correct customization for this is: 10218 10219 @lisp 10220 (setq org-stuck-projects 10221 '("+PROJECT/-MAYBE-DONE" ("NEXT" "TODO") ("@@shop") 10222 "\\<IGNORE\\>")) 10223 @end lisp 10224 10225 Note that if a project is identified as non-stuck, the subtree of this 10226 entry is searched for stuck projects. 10227 10228 @node Presentation and Sorting 10229 @section Presentation and Sorting 10230 10231 @cindex presentation, of agenda items 10232 10233 @vindex org-agenda-prefix-format 10234 @vindex org-agenda-tags-column 10235 Before displaying items in an agenda view, Org mode visually prepares 10236 the items and sorts them. Each item occupies a single line. The line 10237 starts with a @emph{prefix} that contains the @emph{category} (see @ref{Categories}) 10238 of the item and other important information. You can customize in 10239 which column tags are displayed through @code{org-agenda-tags-column}. You 10240 can also customize the prefix using the option 10241 @code{org-agenda-prefix-format}. This prefix is followed by a cleaned-up 10242 version of the outline headline associated with the item. 10243 10244 @menu 10245 * Categories:: Not all tasks are equal. 10246 * Time-of-day specifications:: How the agenda knows the time. 10247 * Sorting of agenda items:: The order of things. 10248 * Filtering/limiting agenda items:: Dynamically narrow the agenda. 10249 @end menu 10250 10251 @node Categories 10252 @subsection Categories 10253 10254 @cindex category 10255 @cindex @samp{CATEGORY}, keyword 10256 10257 The category is a broad label assigned to each agenda item. By 10258 default, the category is simply derived from the file name, but you 10259 can also specify it with a special line in the buffer, like 10260 this: 10261 10262 @example 10263 #+CATEGORY: Thesis 10264 @end example 10265 10266 10267 @cindex @samp{CATEGORY}, property 10268 If you would like to have a special category for a single entry or 10269 a (sub)tree, give the entry a @samp{CATEGORY} property with the special 10270 category you want to apply as the value. 10271 10272 @vindex org-agenda-category-icon-alist 10273 The display in the agenda buffer looks best if the category is not 10274 longer than 10 characters. You can set up icons for category by 10275 customizing the @code{org-agenda-category-icon-alist} variable. 10276 10277 @node Time-of-day specifications 10278 @subsection Time-of-day specifications 10279 10280 @cindex time-of-day specification 10281 10282 Org mode checks each agenda item for a time-of-day specification. The 10283 time can be part of the timestamp that triggered inclusion into the 10284 agenda, for example 10285 10286 @example 10287 <2005-05-10 Tue 19:00> 10288 @end example 10289 10290 10291 @noindent 10292 Time ranges can be specified with two timestamps: 10293 10294 @example 10295 <2005-05-10 Tue 20:30>--<2005-05-10 Tue 22:15> 10296 @end example 10297 10298 10299 @vindex org-agenda-search-headline-for-time 10300 In the headline of the entry itself, a time(range)---like @samp{12:45} or a 10301 @samp{8:30-1pm}---may also appear as plain text@footnote{ You can, however, 10302 disable this by setting @code{org-agenda-search-headline-for-time} variable 10303 to a @code{nil} value.}. 10304 10305 If the agenda integrates the Emacs diary (see @ref{Weekly/daily agenda}), 10306 time specifications in diary entries are recognized as well. 10307 10308 For agenda display, Org mode extracts the time and displays it in 10309 a standard 24 hour format as part of the prefix. The example times in 10310 the previous paragraphs would end up in the agenda like this: 10311 10312 @example 10313 8:30-13:00 Arthur Dent lies in front of the bulldozer 10314 12:45...... Ford Prefect arrives and takes Arthur to the pub 10315 19:00...... The Vogon reads his poem 10316 20:30-22:15 Marvin escorts the Hitchhikers to the bridge 10317 @end example 10318 10319 @cindex time grid 10320 If the agenda is in single-day mode, or for the display of today, the 10321 timed entries are embedded in a time grid, like 10322 10323 @example 10324 8:00...... ------------------ 10325 8:30-13:00 Arthur Dent lies in front of the bulldozer 10326 10:00...... ------------------ 10327 12:00...... ------------------ 10328 12:45...... Ford Prefect arrives and takes Arthur to the pub 10329 14:00...... ------------------ 10330 16:00...... ------------------ 10331 18:00...... ------------------ 10332 19:00...... The Vogon reads his poem 10333 20:00...... ------------------ 10334 20:30-22:15 Marvin escorts the Hitchhikers to the bridge 10335 @end example 10336 10337 @vindex org-agenda-use-time-grid 10338 @vindex org-agenda-time-grid 10339 The time grid can be turned on and off with the variable 10340 @code{org-agenda-use-time-grid}, and can be configured with 10341 @code{org-agenda-time-grid}. 10342 10343 @node Sorting of agenda items 10344 @subsection Sorting of agenda items 10345 10346 @cindex sorting, of agenda items 10347 @cindex priorities, of agenda items 10348 10349 Before being inserted into a view, the items are sorted. How this is 10350 done depends on the type of view. 10351 10352 @itemize 10353 @item 10354 @vindex org-agenda-files 10355 For the daily/weekly agenda, the items for each day are sorted. The 10356 default order is to first collect all items containing an explicit 10357 time-of-day specification. These entries are shown at the beginning 10358 of the list, as a @emph{schedule} for the day. After that, items remain 10359 grouped in categories, in the sequence given by @code{org-agenda-files}. 10360 Within each category, items are sorted by urgency, which is composed 10361 of the base priority (see @ref{Priorities}; 2000 for priority @samp{A}, 1000 10362 for @samp{B}, and 0 for @samp{C}), plus additional increments for overdue 10363 scheduled or deadline items. 10364 10365 @item 10366 For the TODO list, items remain in the order of categories, but 10367 within each category, sorting takes place according to urgency. The 10368 urgency used for sorting derives from the priority cookie, with 10369 additions depending on how close an item is to its due or scheduled 10370 date. 10371 10372 @item 10373 For tags matches, items are not sorted at all, but just appear in 10374 the sequence in which they are found in the agenda files. 10375 @end itemize 10376 10377 @vindex org-agenda-sorting-strategy 10378 Sorting can be customized using the variable 10379 @code{org-agenda-sorting-strategy}, and may also include criteria based on 10380 the estimated effort of an entry (see @ref{Effort Estimates}). 10381 10382 @node Filtering/limiting agenda items 10383 @subsection Filtering/limiting agenda items 10384 10385 @vindex org-agenda-category-filter-preset 10386 @vindex org-agenda-tag-filter-preset 10387 @vindex org-agenda-effort-filter-preset 10388 @vindex org-agenda-regexp-filter-preset 10389 Agenda built-in or custom commands are statically defined. Agenda 10390 filters and limits allow flexibly narrowing down the list of agenda 10391 entries. 10392 10393 @emph{Filters} only change the visibility of items, are very fast and are 10394 mostly used interactively@footnote{Custom agenda commands can preset a filter by binding one of 10395 the variables @code{org-agenda-tag-filter-preset}, 10396 @code{org-agenda-category-filter-preset}, @code{org-agenda-effort-filter-preset} 10397 or @code{org-agenda-regexp-filter-preset} as an option. This filter is 10398 then applied to the view and persists as a basic filter through 10399 refreshes and more secondary filtering. The filter is a global 10400 property of the entire agenda view---in a block agenda, you should 10401 only set this in the global options section, not in the section of an 10402 individual block.}. You can switch quickly between 10403 different filters without having to recreate the agenda. @emph{Limits} on 10404 the other hand take effect before the agenda buffer is populated, so 10405 they are mostly useful when defined as local variables within custom 10406 agenda commands. 10407 10408 @anchor{Filtering in the agenda} 10409 @subsubheading Filtering in the agenda 10410 10411 @cindex agenda filtering 10412 @cindex filtering entries, in agenda 10413 @cindex tag filtering, in agenda 10414 @cindex category filtering, in agenda 10415 @cindex top headline filtering, in agenda 10416 @cindex effort filtering, in agenda 10417 @cindex query editing, in agenda 10418 10419 The general filtering command is @code{org-agenda-filter}, bound to 10420 @kbd{/}. Before we introduce it, we describe commands for 10421 individual filter types. All filtering commands handle prefix 10422 arguments in the same way: A single @kbd{C-u} prefix negates the 10423 filter, so it removes lines selected by the filter. A double prefix 10424 adds the new filter condition to the one(s) already in place, so 10425 filter elements are accumulated. 10426 10427 @table @asis 10428 @item @kbd{\} (@code{org-agenda-filter-by-tag}) 10429 @findex org-agenda-filter-by-tag 10430 Filter the agenda view with respect to a tag. You are prompted for 10431 a tag selection letter; @kbd{@key{SPC}} means any tag at all. 10432 Pressing @kbd{@key{TAB}} at that prompt offers completion to select a 10433 tag, including any tags that do not have a selection character. The 10434 command then hides all entries that do not contain or inherit this 10435 tag. Pressing @kbd{+} or @kbd{-} at the prompt switches 10436 between filtering for and against the next tag. To clear the 10437 filter, press @kbd{\} twice (once to call the command again, 10438 and once at the prompt). 10439 10440 @item @kbd{<} (@code{org-agenda-filter-by-category}) 10441 @findex org-agenda-filter-by-category 10442 Filter by category of the line at point, and show only entries with 10443 this category. When called with a prefix argument, hide all entries 10444 with the category at point. To clear the filter, call this command 10445 again by pressing @kbd{<}. 10446 10447 @item @kbd{=} (@code{org-agenda-filter-by-regexp}) 10448 @findex org-agenda-filter-by-regexp 10449 Filter the agenda view by a regular expression: only show agenda 10450 entries matching the regular expression the user entered. To clear 10451 the filter, call the command again by pressing @kbd{=}. 10452 10453 @item @kbd{_} (@code{org-agenda-filter-by-effort}) 10454 @findex org-agenda-filter-by-effort 10455 Filter the agenda view with respect to effort estimates, so select 10456 tasks that take the right amount of time. You first need to set up 10457 a list of efforts globally, for example 10458 10459 @lisp 10460 (setq org-global-properties 10461 '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00"))) 10462 @end lisp 10463 10464 @vindex org-sort-agenda-noeffort-is-high 10465 You can then filter for an effort by first typing an operator, one 10466 of @kbd{<}, @kbd{>} and @kbd{=}, and then the 10467 one-digit index of an effort estimate in your array of allowed 10468 values, where @kbd{0} means the 10th value. The filter then 10469 restricts to entries with effort smaller-or-equal, equal, or 10470 larger-or-equal than the selected value. For application of the 10471 operator, entries without a defined effort are treated according to 10472 the value of @code{org-sort-agenda-noeffort-is-high}. To clear the 10473 filter, press @kbd{_} twice (once to call the command again, 10474 and once at the first prompt). 10475 10476 @item @kbd{^} (@code{org-agenda-filter-by-top-headline}) 10477 @findex org-agenda-filter-by-top-headline 10478 Filter the current agenda view and only display items that fall 10479 under the same top-level headline as the current entry. To clear 10480 the filter, call this command again by pressing @kbd{^}. 10481 10482 @item @kbd{/} (@code{org-agenda-filter}) 10483 @findex org-agenda-filter 10484 This is the unified interface to four of the five filter methods 10485 described above. At the prompt, specify different filter elements 10486 in a single string, with full completion support. For example, 10487 10488 @example 10489 +work-John+<0:10-/plot/ 10490 @end example 10491 10492 10493 selects entries with category @samp{work} and effort estimates below 10 10494 minutes, and deselects entries with tag @samp{John} or matching the 10495 regexp @samp{plot} (see @ref{Regular Expressions}). You can leave @samp{+} out if 10496 that does not lead to ambiguities. The sequence of elements is 10497 arbitrary. The filter syntax assumes that there is no overlap 10498 between categories and tags. Otherwise, tags take priority. If you 10499 reply to the prompt with the empty string, all filtering is removed. 10500 If a filter is specified, it replaces all current filters. But if 10501 you call the command with a double prefix argument, or if you add an 10502 additional @samp{+} (e.g., @samp{++work}) to the front of the string, the new 10503 filter elements are added to the active ones. A single prefix 10504 argument applies the entire filter in a negative sense. 10505 10506 @item @kbd{|} (@code{org-agenda-filter-remove-all}) 10507 Remove all filters in the current agenda view. 10508 @end table 10509 10510 @anchor{Computed tag filtering} 10511 @subsubheading Computed tag filtering 10512 10513 @vindex org-agenda-auto-exclude-function 10514 If the variable @code{org-agenda-auto-exclude-function} is set to 10515 a user-defined function, that function can select tags that should be 10516 used as a tag filter when requested. The function will be called with 10517 lower-case versions of all tags represented in the current view. The 10518 function should return @samp{"-tag"} if the filter should remove 10519 entries with that tag, @samp{"+tag"} if only entries with this tag should 10520 be kept, or @samp{nil} if that tag is irrelevant. For example, let's say 10521 you use a @samp{Net} tag to identify tasks which need network access, an 10522 @samp{Errand} tag for errands in town, and a @samp{Call} tag for making phone 10523 calls. You could auto-exclude these tags based on the availability of 10524 the Internet, and outside of business hours, with something like this: 10525 10526 @lisp 10527 (defun my-auto-exclude-fn (tag) 10528 (when (cond ((string= tag "net") 10529 (/= 0 (call-process "/sbin/ping" nil nil nil 10530 "-c1" "-q" "-t1" "mail.gnu.org"))) 10531 ((member tag '("errand" "call")) 10532 (let ((hr (nth 2 (decode-time)))) 10533 (or (< hr 8) (> hr 21))))) 10534 (concat "-" tag))) 10535 10536 (setq org-agenda-auto-exclude-function #'my-auto-exclude-fn) 10537 @end lisp 10538 10539 You can apply this self-adapting filter by using a triple prefix 10540 argument to @code{org-agenda-filter}, i.e.@tie{}press @kbd{C-u C-u C-u /}, 10541 or by pressing @kbd{@key{RET}} in @code{org-agenda-filter-by-tag}. 10542 10543 @anchor{Setting limits for the agenda} 10544 @subsubheading Setting limits for the agenda 10545 10546 @cindex limits, in agenda 10547 10548 Here is a list of options that you can set, either globally, or 10549 locally in your custom agenda views (see @ref{Custom Agenda Views}). 10550 10551 @table @asis 10552 @item @code{org-agenda-max-entries} 10553 @vindex org-agenda-max-entries 10554 Limit the number of entries. 10555 10556 @item @code{org-agenda-max-effort} 10557 @vindex org-agenda-max-effort 10558 Limit the duration of accumulated efforts (as minutes). 10559 10560 @item @code{org-agenda-max-todos} 10561 @vindex org-agenda-max-todos 10562 Limit the number of entries with TODO keywords. 10563 10564 @item @code{org-agenda-max-tags} 10565 @vindex org-agenda-max-tags 10566 Limit the number of tagged entries. 10567 @end table 10568 10569 When set to a positive integer, each option excludes entries from 10570 other categories: for example, @samp{(setq org-agenda-max-effort 100)} 10571 limits the agenda to 100 minutes of effort and exclude any entry that 10572 has no effort property. If you want to include entries with no effort 10573 property, use a negative value for @code{org-agenda-max-effort}. One 10574 useful setup is to use @code{org-agenda-max-entries} locally in a custom 10575 command. For example, this custom command displays the next five 10576 entries with a @samp{NEXT} TODO keyword. 10577 10578 @lisp 10579 (setq org-agenda-custom-commands 10580 '(("n" todo "NEXT" 10581 ((org-agenda-max-entries 5))))) 10582 @end lisp 10583 10584 Once you mark one of these five entry as DONE, rebuilding the agenda 10585 will again the next five entries again, including the first entry that 10586 was excluded so far. 10587 10588 You can also dynamically set temporary limits, which are lost when 10589 rebuilding the agenda: 10590 10591 @table @asis 10592 @item @kbd{~} (@code{org-agenda-limit-interactively}) 10593 @findex org-agenda-limit-interactively 10594 This prompts for the type of limit to apply and its value. 10595 @end table 10596 10597 @node Agenda Commands 10598 @section Commands in the Agenda Buffer 10599 10600 @cindex commands, in agenda buffer 10601 10602 Entries in the agenda buffer are linked back to the Org file or diary 10603 file where they originate. You are not allowed to edit the agenda 10604 buffer itself, but commands are provided to show and jump to the 10605 original entry location, and to edit the Org files ``remotely'' from the 10606 agenda buffer. In this way, all information is stored only once, 10607 removing the risk that your agenda and note files may diverge. 10608 10609 Some commands can be executed with mouse clicks on agenda lines. For 10610 the other commands, point needs to be in the desired line. 10611 10612 @anchor{Motion (1)} 10613 @subheading Motion 10614 10615 @cindex motion commands in agenda 10616 10617 @table @asis 10618 @item @kbd{n} (@code{org-agenda-next-line}) 10619 @kindex n 10620 @findex org-agenda-next-line 10621 Next line (same as @kbd{@key{DOWN}} and @kbd{C-n}). 10622 10623 @item @kbd{p} (@code{org-agenda-previous-line}) 10624 @kindex p 10625 @findex org-agenda-previous-line 10626 Previous line (same as @kbd{@key{UP}} and @kbd{C-p}). 10627 @end table 10628 10629 @anchor{View/Go to Org file} 10630 @subheading View/Go to Org file 10631 10632 @cindex view file commands in agenda 10633 10634 @table @asis 10635 @item @kbd{@key{SPC}} or @kbd{mouse-3} (@code{org-agenda-show-and-scroll-up}) 10636 @kindex SPC 10637 @kindex mouse-3 10638 @findex org-agenda-show-and-scroll-up 10639 Display the original location of the item in another window. 10640 With a prefix argument, make sure that drawers stay folded. 10641 10642 @item @kbd{L} (@code{org-agenda-recenter}) 10643 @findex org-agenda-recenter 10644 Display original location and recenter that window. 10645 10646 @item @kbd{@key{TAB}} or @kbd{mouse-2} (@code{org-agenda-goto}) 10647 @kindex TAB 10648 @kindex mouse-2 10649 @findex org-agenda-goto 10650 Go to the original location of the item in another window. 10651 10652 @item @kbd{@key{RET}} (@code{org-agenda-switch-to}) 10653 @kindex RET 10654 @findex org-agenda-switch-to 10655 Go to the original location of the item and delete other windows. 10656 10657 @item @kbd{F} (@code{org-agenda-follow-mode}) 10658 @kindex F 10659 @findex org-agenda-follow-mode 10660 @vindex org-agenda-start-with-follow-mode 10661 Toggle Follow mode. In Follow mode, as you move point through the 10662 agenda buffer, the other window always shows the corresponding 10663 location in the Org file. The initial setting for this mode in new 10664 agenda buffers can be set with the variable 10665 @code{org-agenda-start-with-follow-mode}. 10666 10667 @item @kbd{C-c C-x b} (@code{org-agenda-tree-to-indirect-buffer}) 10668 @kindex C-c C-x b 10669 @findex org-agenda-tree-to-indirect-buffer 10670 Display the entire subtree of the current item in an indirect 10671 buffer. With a numeric prefix argument N, go up to level N and then 10672 take that tree. If N is negative, go up that many levels. With 10673 a @kbd{C-u} prefix, do not remove the previously used indirect 10674 buffer. 10675 10676 @item @kbd{C-c C-o} (@code{org-agenda-open-link}) 10677 @kindex C-c C-o 10678 @findex org-agenda-open-link 10679 Follow a link in the entry. This offers a selection of any links in 10680 the text belonging to the referenced Org node. If there is only one 10681 link, follow it without a selection prompt. 10682 @end table 10683 10684 @anchor{Change display} 10685 @subheading Change display 10686 10687 @cindex change agenda display 10688 @cindex display changing, in agenda 10689 10690 @table @asis 10691 @item @kbd{A} 10692 @kindex A 10693 Interactively select another agenda view and append it to the 10694 current view. 10695 10696 @item @kbd{o} 10697 @kindex o 10698 Delete other windows. 10699 10700 @item @kbd{v d} or short @kbd{d} (@code{org-agenda-day-view}) 10701 @kindex v d 10702 @kindex d 10703 @findex org-agenda-day-view 10704 Switch to day view. When switching to day view, this setting 10705 becomes the default for subsequent agenda refreshes. A numeric 10706 prefix argument may be used to jump directly to a specific day of 10707 the year. For example, @kbd{32 d} jumps to February 1st. When 10708 setting day view, a year may be encoded in the prefix argument as 10709 well. For example, @kbd{200712 d} jumps to January 12, 2007. 10710 If such a year specification has only one or two digits, it is 10711 expanded into one of the 30 next years or the last 69 years. 10712 10713 @item @kbd{v w} or short @kbd{w} (@code{org-agenda-week-view}) 10714 @kindex v w 10715 @kindex w 10716 @findex org-agenda-week-view 10717 Switch to week view. When switching week view, this setting becomes 10718 the default for subsequent agenda refreshes. A numeric prefix 10719 argument may be used to jump directly to a specific day of the ISO 10720 week. For example @kbd{9 w} to ISO week number 9. When 10721 setting week view, a year may be encoded in the prefix argument as 10722 well. For example, @kbd{200712 w} jumps to week 12 in 2007. 10723 If such a year specification has only one or two digits, it is 10724 expanded into one of the 30 next years or the last 69 years. 10725 10726 @item @kbd{v m} (@code{org-agenda-month-view}) 10727 @kindex v m 10728 @findex org-agenda-month-view 10729 Switch to month view. Because month views are slow to create, they 10730 do not become the default for subsequent agenda refreshes. 10731 A numeric prefix argument may be used to jump directly to a specific 10732 day of the month. When setting month view, a year may be encoded in 10733 the prefix argument as well. For example, @kbd{200712 m} jumps 10734 to December, 2007. If such a year specification has only one or two 10735 digits, it is expanded into one of the 30 next years or the last 69 10736 years. 10737 10738 @item @kbd{v y} (@code{org-agenda-year-view}) 10739 @kindex v y 10740 @findex org-agenda-year-view 10741 Switch to year view. Because year views are slow to create, they do 10742 not become the default for subsequent agenda refreshes. A numeric 10743 prefix argument may be used to jump directly to a specific day of 10744 the year. 10745 10746 @item @kbd{v @key{SPC}} (@code{org-agenda-reset-view}) 10747 @kindex v SPC 10748 @findex org-agenda-reset-view 10749 @vindex org-agenda-span 10750 Reset the current view to @code{org-agenda-span}. 10751 10752 @item @kbd{f} (@code{org-agenda-later}) 10753 @kindex f 10754 @findex org-agenda-later 10755 Go forward in time to display the span following the current one. 10756 For example, if the display covers a week, switch to the following 10757 week. With a prefix argument, repeat that many times. 10758 10759 @item @kbd{b} (@code{org-agenda-earlier}) 10760 @kindex b 10761 @findex org-agenda-earlier 10762 Go backward in time to display earlier dates. 10763 10764 @item @kbd{.} (@code{org-agenda-goto-today}) 10765 @kindex . 10766 @findex org-agenda-goto-today 10767 Go to today. 10768 10769 @item @kbd{j} (@code{org-agenda-goto-date}) 10770 @kindex j 10771 @findex org-agenda-goto-date 10772 Prompt for a date and go there. 10773 10774 @item @kbd{J} (@code{org-agenda-clock-goto}) 10775 @kindex J 10776 @findex org-agenda-clock-goto 10777 Go to the currently clocked-in task @emph{in the agenda buffer}. 10778 10779 @item @kbd{D} (@code{org-agenda-toggle-diary}) 10780 @kindex D 10781 @findex org-agenda-toggle-diary 10782 Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}. 10783 10784 @item @kbd{v l} or @kbd{v L} or short @kbd{l} (@code{org-agenda-log-mode}) 10785 @kindex v l 10786 @kindex l 10787 @kindex v L 10788 @findex org-agenda-log-mode 10789 @vindex org-log-done 10790 @vindex org-agenda-log-mode-items 10791 Toggle Logbook mode. In Logbook mode, entries that were marked as 10792 done while logging was on (see the variable @code{org-log-done}) are 10793 shown in the agenda, as are entries that have been clocked on that 10794 day. You can configure the entry types that should be included in 10795 log mode using the variable @code{org-agenda-log-mode-items}. When 10796 called with a @kbd{C-u} prefix argument, show all possible 10797 logbook entries, including state changes. When called with two 10798 prefix arguments @kbd{C-u C-u}, show only logging information, 10799 nothing else. @kbd{v L} is equivalent to @kbd{C-u v l}. 10800 10801 @item @kbd{v [} or short @kbd{[} (@code{org-agenda-manipulate-query-add}) 10802 @kindex v [ 10803 @kindex [ 10804 @findex org-agenda-manipulate-query-add 10805 Include inactive timestamps into the current view. Only for 10806 weekly/daily agenda. 10807 10808 @item @kbd{v a} (@code{org-agenda-archives-mode}) 10809 @kindex v a 10810 @findex org-agenda-archives-mode 10811 @vindex org-agenda-start-with-archives-mode 10812 Toggle Archives mode. In Archives mode, trees that are archived 10813 (see @ref{Internal archiving}) are also scanned when producing the 10814 agenda. To exit archives mode, press @kbd{v a} again. The 10815 initial setting for this mode in new agenda buffers can set with the 10816 variable @code{org-agenda-start-with-archives-mode}, which can be set 10817 with the same values as @code{org-agenda-archives-mode}. 10818 10819 @item @kbd{v A} 10820 @kindex v A 10821 Toggle Archives mode. Include all archive files as well. 10822 10823 @item @kbd{v R} or short @kbd{R} (@code{org-agenda-clockreport-mode}) 10824 @kindex v R 10825 @kindex R 10826 @findex org-agenda-clockreport-mode 10827 @vindex org-agenda-start-with-clockreport-mode 10828 @vindex org-clock-report-include-clocking-task 10829 Toggle Clockreport mode. In Clockreport mode, the daily/weekly 10830 agenda always shows a table with the clocked times for the time span 10831 and file scope covered by the current agenda view. The initial 10832 setting for this mode in new agenda buffers can be set with the 10833 variable @code{org-agenda-start-with-clockreport-mode}. By using a 10834 prefix argument when toggling this mode (i.e., @kbd{C-u R}), 10835 the clock table does not show contributions from entries that are 10836 hidden by agenda filtering@footnote{ Only tags filtering is respected 10837 here, effort filtering is ignored.}. See also the variables 10838 @code{org-clock-report-include-clocking-task} and 10839 @code{org-agenda-clock-report-header}. 10840 10841 @item @kbd{v c} 10842 @kindex v c 10843 @vindex org-agenda-clock-consistency-checks 10844 Show overlapping clock entries, clocking gaps, and other clocking 10845 problems in the current agenda range. You can then visit clocking 10846 lines and fix them manually. See the variable 10847 @code{org-agenda-clock-consistency-checks} for information on how to 10848 customize the definition of what constituted a clocking problem. To 10849 return to normal agenda display, press @kbd{l} to exit Logbook 10850 mode. 10851 10852 @item @kbd{v E} or short @kbd{E} (@code{org-agenda-entry-text-mode}) 10853 @kindex v E 10854 @kindex E 10855 @findex org-agenda-entry-text-mode 10856 @vindex org-agenda-start-with-entry-text-mode 10857 @vindex org-agenda-entry-text-maxlines 10858 Toggle entry text mode. In entry text mode, a number of lines from 10859 the Org outline node referenced by an agenda line are displayed 10860 below the line. The maximum number of lines is given by the 10861 variable @code{org-agenda-entry-text-maxlines}. Calling this command 10862 with a numeric prefix argument temporarily modifies that number to 10863 the prefix value. 10864 10865 @item @kbd{G} (@code{org-agenda-toggle-time-grid}) 10866 @kindex G 10867 @vindex org-agenda-use-time-grid 10868 @vindex org-agenda-time-grid 10869 Toggle the time grid on and off. See also the variables 10870 @code{org-agenda-use-time-grid} and @code{org-agenda-time-grid}. 10871 10872 @item @kbd{r} (@code{org-agenda-redo}) 10873 @itemx @kbd{g} 10874 @kindex r 10875 @kindex g 10876 @findex org-agenda-redo 10877 Recreate the agenda buffer, for example to reflect the changes after 10878 modification of the timestamps of items with @kbd{S-@key{LEFT}} and 10879 @kbd{S-@key{RIGHT}}. When the buffer is the global TODO list, 10880 a prefix argument is interpreted to create a selective list for 10881 a specific TODO keyword. 10882 10883 @item @kbd{C-x C-s} or short @kbd{s} (@code{org-save-all-org-buffers}) 10884 @kindex C-x C-s 10885 @findex org-save-all-org-buffers 10886 @kindex s 10887 Save all Org buffers in the current Emacs session, and also the 10888 locations of IDs. 10889 10890 @item @kbd{C-c C-x C-c} (@code{org-agenda-columns}) 10891 @kindex C-c C-x C-c 10892 @findex org-agenda-columns 10893 @vindex org-columns-default-format 10894 Invoke column view (see @ref{Column View}) in the agenda buffer. The 10895 column view format is taken from the entry at point, or, if there is 10896 no entry at point, from the first entry in the agenda view. So 10897 whatever the format for that entry would be in the original buffer 10898 (taken from a property, from a @samp{COLUMNS} keyword, or from the 10899 default variable @code{org-columns-default-format}) is used in the 10900 agenda. 10901 10902 @item @kbd{C-c C-x >} (@code{org-agenda-remove-restriction-lock}) 10903 @kindex C-c C-x > 10904 @findex org-agenda-remove-restriction-lock 10905 Remove the restriction lock on the agenda, if it is currently 10906 restricted to a file or subtree (see @ref{Agenda Files}). 10907 10908 @item @kbd{M-@key{UP}} (@code{org-agenda-drag-line-backward}) 10909 @kindex M-UP 10910 @findex org-agenda-drag-line-backward 10911 Drag the line at point backward one line. With a numeric prefix 10912 argument, drag backward by that many lines. 10913 10914 Moving agenda lines does not persist after an agenda refresh and 10915 does not modify the contributing Org files. 10916 10917 @item @kbd{M-@key{DOWN}} (@code{org-agenda-drag-line-forward}) 10918 @kindex M-DOWN 10919 @findex org-agenda-drag-line-forward 10920 Drag the line at point forward one line. With a numeric prefix 10921 argument, drag forward by that many lines. 10922 @end table 10923 10924 @anchor{Remote editing} 10925 @subheading Remote editing 10926 10927 @cindex remote editing, from agenda 10928 10929 @table @asis 10930 @item @kbd{0--9} 10931 Digit argument. 10932 10933 @item @kbd{C-_} (@code{org-agenda-undo}) 10934 @kindex C-_ 10935 @findex org-agenda-undo 10936 @cindex undoing remote-editing events 10937 @cindex remote editing, undo 10938 Undo a change due to a remote editing command. The change is undone 10939 both in the agenda buffer and in the remote buffer. 10940 10941 @item @kbd{t} (@code{org-agenda-todo}) 10942 @kindex t 10943 @findex org-agenda-todo 10944 Change the TODO state of the item, both in the agenda and in the 10945 original Org file. A prefix arg is passed through to the @code{org-todo} 10946 command, so for example a @kbd{C-u} prefix are will trigger 10947 taking a note to document the state change. 10948 10949 @item @kbd{C-S-@key{RIGHT}} (@code{org-agenda-todo-nextset}) 10950 @kindex C-S-RIGHT 10951 @findex org-agenda-todo-nextset 10952 Switch to the next set of TODO keywords. 10953 10954 @item @kbd{C-S-@key{LEFT}}, @code{org-agenda-todo-previousset} 10955 @kindex C-S-LEFT 10956 Switch to the previous set of TODO keywords. 10957 10958 @item @kbd{C-k} (@code{org-agenda-kill}) 10959 @kindex C-k 10960 @findex org-agenda-kill 10961 @vindex org-agenda-confirm-kill 10962 Delete the current agenda item along with the entire subtree 10963 belonging to it in the original Org file. If the text to be deleted 10964 remotely is longer than one line, the kill needs to be confirmed by 10965 the user. See variable @code{org-agenda-confirm-kill}. 10966 10967 @item @kbd{C-c C-w} (@code{org-agenda-refile}) 10968 @kindex C-c C-w 10969 @findex org-agenda-refile 10970 Refile the entry at point. 10971 10972 @item @kbd{C-c C-x C-a} or short @kbd{a} (@code{org-agenda-archive-default-with-confirmation}) 10973 @kindex C-c C-x C-a 10974 @kindex a 10975 @findex org-agenda-archive-default-with-confirmation 10976 @vindex org-archive-default-command 10977 Archive the subtree corresponding to the entry at point using the 10978 default archiving command set in @code{org-archive-default-command}. 10979 When using the @kbd{a} key, confirmation is required. 10980 10981 @item @kbd{C-c C-x a} (@code{org-agenda-toggle-archive-tag}) 10982 @kindex C-c C-x a 10983 @findex org-agenda-toggle-archive-tag 10984 Toggle the archive tag (see @ref{Internal archiving}) for the current 10985 headline. 10986 10987 @item @kbd{C-c C-x A} (@code{org-agenda-archive-to-archive-sibling}) 10988 @kindex C-c C-x A 10989 @findex org-agenda-archive-to-archive-sibling 10990 Move the subtree corresponding to the current entry to its @emph{archive 10991 sibling}. 10992 10993 @item @kbd{C-c C-x C-s} or short @kbd{$} (@code{org-agenda-archive}) 10994 @kindex C-c C-x C-s 10995 @kindex $ 10996 @findex org-agenda-archive 10997 Archive the subtree corresponding to the current headline. This 10998 means the entry is moved to the configured archive location, most 10999 likely a different file. 11000 11001 @item @kbd{T} (@code{org-agenda-show-tags}) 11002 @kindex T 11003 @findex org-agenda-show-tags 11004 @vindex org-agenda-show-inherited-tags 11005 Show all tags associated with the current item. This is useful if 11006 you have turned off @code{org-agenda-show-inherited-tags}, but still want 11007 to see all tags of a headline occasionally. 11008 11009 @item @kbd{:} (@code{org-agenda-set-tags}) 11010 @kindex : 11011 @findex org-agenda-set-tags 11012 Set tags for the current headline. If there is an active region in 11013 the agenda, change a tag for all headings in the region. 11014 11015 @item @kbd{,} (@code{org-agenda-priority}) 11016 @kindex , 11017 @findex org-agenda-priority 11018 Set the priority for the current item. Org mode prompts for the 11019 priority character. If you reply with @kbd{@key{SPC}}, the priority 11020 cookie is removed from the entry. 11021 11022 @item @kbd{+} or @kbd{S-@key{UP}} (@code{org-agenda-priority-up}) 11023 @kindex + 11024 @kindex S-UP 11025 @findex org-agenda-priority-up 11026 Increase the priority of the current item. The priority is changed 11027 in the original buffer, but the agenda is not resorted. Use the 11028 @kbd{r} key for this. 11029 11030 @item @kbd{-} or @kbd{S-@key{DOWN}} (@code{org-agenda-priority-down}) 11031 @kindex - 11032 @kindex S-DOWN 11033 @findex org-agenda-priority-down 11034 Decrease the priority of the current item. 11035 11036 @item @kbd{C-c C-x e} or short @kbd{e} (@code{org-agenda-set-effort}) 11037 @kindex e 11038 @kindex C-c C-x e 11039 @findex org-agenda-set-effort 11040 Set the effort property for the current item. 11041 11042 @item @kbd{C-c C-z} or short @kbd{z} (@code{org-agenda-add-note}) 11043 @kindex z 11044 @kindex C-c C-z 11045 @findex org-agenda-add-note 11046 @vindex org-log-into-drawer 11047 Add a note to the entry. This note is recorded, and then filed to 11048 the same location where state change notes are put. Depending on 11049 @code{org-log-into-drawer}, this may be inside a drawer. 11050 11051 @item @kbd{C-c C-a} (@code{org-attach}) 11052 @kindex C-c C-a 11053 @findex org-attach 11054 Dispatcher for all command related to attachments. 11055 11056 @item @kbd{C-c C-s} (@code{org-agenda-schedule}) 11057 @kindex C-c C-s 11058 @findex org-agenda-schedule 11059 Schedule this item. With a prefix argument, remove the 11060 scheduling timestamp 11061 11062 @item @kbd{C-c C-d} (@code{org-agenda-deadline}) 11063 @kindex C-c C-d 11064 @findex org-agenda-deadline 11065 Set a deadline for this item. With a prefix argument, remove the 11066 deadline. 11067 11068 @item @kbd{S-@key{RIGHT}} (@code{org-agenda-do-date-later}) 11069 @kindex S-RIGHT 11070 @findex org-agenda-do-date-later 11071 Change the timestamp associated with the current line by one day 11072 into the future. If the date is in the past, the first call to this 11073 command moves it to today. With a numeric prefix argument, change 11074 it by that many days. For example, @kbd{3 6 5 S-@key{RIGHT}} changes 11075 it by a year. With a @kbd{C-u} prefix, change the time by one 11076 hour. If you immediately repeat the command, it will continue to 11077 change hours even without the prefix argument. With a double 11078 @kbd{C-u C-u} prefix, do the same for changing minutes. The 11079 stamp is changed in the original Org file, but the change is not 11080 directly reflected in the agenda buffer. Use @kbd{r} or 11081 @kbd{g} to update the buffer. 11082 11083 @item @kbd{S-@key{LEFT}} (@code{org-agenda-do-date-earlier}) 11084 @kindex S-LEFT 11085 @findex org-agenda-do-date-earlier 11086 Change the timestamp associated with the current line by one day 11087 into the past. 11088 11089 @item @kbd{>} (@code{org-agenda-date-prompt}) 11090 @kindex > 11091 @findex org-agenda-date-prompt 11092 Change the timestamp associated with the current line. The key 11093 @kbd{>} has been chosen, because it is the same as 11094 @kbd{S-.} on my keyboard. 11095 11096 @item @kbd{I} (@code{org-agenda-clock-in}) 11097 @kindex I 11098 @findex org-agenda-clock-in 11099 Start the clock on the current item. If a clock is running already, 11100 it is stopped first. 11101 11102 @item @kbd{O} (@code{org-agenda-clock-out}) 11103 @kindex O 11104 @findex org-agenda-clock-out 11105 Stop the previously started clock. 11106 11107 @item @kbd{X} (@code{org-agenda-clock-cancel}) 11108 @kindex X 11109 @findex org-agenda-clock-cancel 11110 Cancel the currently running clock. 11111 11112 @item @kbd{J} (@code{org-agenda-clock-goto}) 11113 @kindex J 11114 @findex org-agenda-clock-goto 11115 Jump to the running clock in another window. 11116 11117 @item @kbd{k} (@code{org-agenda-capture}) 11118 @kindex k 11119 @findex org-agenda-capture 11120 @cindex capturing, from agenda 11121 @vindex org-capture-use-agenda-date 11122 Like @code{org-capture}, but use the date at point as the default date 11123 for the capture template. See @code{org-capture-use-agenda-date} to make 11124 this the default behavior of @code{org-capture}. 11125 @end table 11126 11127 @anchor{Bulk remote editing selected entries} 11128 @subheading Bulk remote editing selected entries 11129 11130 @cindex remote editing, bulk, from agenda 11131 @vindex org-agenda-bulk-custom-functions 11132 11133 @table @asis 11134 @item @kbd{m} (@code{org-agenda-bulk-mark}) 11135 @kindex m 11136 @findex org-agenda-bulk-mark 11137 11138 Mark the entry at point for bulk action. If there is an active 11139 region in the agenda, mark the entries in the region. With numeric 11140 prefix argument, mark that many successive entries. 11141 11142 @item @kbd{*} (@code{org-agenda-bulk-mark-all}) 11143 @kindex * 11144 @findex org-agenda-bulk-mark-all 11145 11146 Mark all visible agenda entries for bulk action. 11147 11148 @item @kbd{u} (@code{org-agenda-bulk-unmark}) 11149 @kindex u 11150 @findex org-agenda-bulk-unmark 11151 11152 Unmark entry for bulk action. 11153 11154 @item @kbd{U} (@code{org-agenda-bulk-unmark-all}) 11155 @kindex U 11156 @findex org-agenda-bulk-unmark-all 11157 11158 Unmark all marked entries for bulk action. 11159 11160 @item @kbd{M-m} (@code{org-agenda-bulk-toggle}) 11161 @kindex M-m 11162 @findex org-agenda-bulk-toggle 11163 11164 Toggle mark of the entry at point for bulk action. 11165 11166 @item @kbd{M-*} (@code{org-agenda-bulk-toggle-all}) 11167 @kindex M-* 11168 @findex org-agenda-bulk-toggle-all 11169 11170 Toggle mark of every entry for bulk action. 11171 11172 @item @kbd{%} (@code{org-agenda-bulk-mark-regexp}) 11173 @kindex % 11174 @findex org-agenda-bulk-mark-regexp 11175 11176 Mark entries matching a regular expression for bulk action. 11177 11178 @item @kbd{B} (@code{org-agenda-bulk-action}) 11179 @kindex B 11180 @findex org-agenda-bulk-action 11181 @vindex org-agenda-bulk-persistent-marks 11182 11183 Bulk action: act on all marked entries in the agenda. This prompts 11184 for another key to select the action to be applied. The prefix 11185 argument to @kbd{B} is passed through to the @kbd{s} and 11186 @kbd{d} commands, to bulk-remove these special timestamps. By 11187 default, marks are removed after the bulk. If you want them to 11188 persist, set @code{org-agenda-bulk-persistent-marks} to @code{t} or hit 11189 @kbd{p} at the prompt. 11190 11191 @table @asis 11192 @item @kbd{p} 11193 Toggle persistent marks. 11194 11195 @item @kbd{$} 11196 Archive all selected entries. 11197 11198 @item @kbd{A} 11199 Archive entries by moving them to their respective archive 11200 siblings. 11201 11202 @item @kbd{t} 11203 Change TODO state. This prompts for a single TODO keyword and 11204 changes the state of all selected entries, bypassing blocking and 11205 suppressing logging notes---but not timestamps. 11206 11207 @item @kbd{+} 11208 Add a tag to all selected entries. 11209 11210 @item @kbd{-} 11211 Remove a tag from all selected entries. 11212 11213 @item @kbd{s} 11214 Schedule all items to a new date. To shift existing schedule 11215 dates by a fixed number of days, use something starting with 11216 double plus at the prompt, for example @samp{++8d} or @samp{++2w}. 11217 11218 @item @kbd{d} 11219 Set deadline to a specific date. 11220 11221 @item @kbd{r} 11222 Prompt for a single refile target and move all entries. The 11223 entries are no longer in the agenda; refresh (@kbd{g}) to 11224 bring them back. 11225 11226 @item @kbd{S} 11227 Reschedule randomly into the coming N days. N is prompted for. 11228 With a prefix argument (@kbd{C-u B S}), scatter only across 11229 weekdays. 11230 11231 @item @kbd{f} 11232 @vindex org-agenda-bulk-custom-functions 11233 Apply a function@footnote{ You can also create persistent custom 11234 functions through @code{org-agenda-bulk-custom-functions}.} to marked 11235 entries. For example, the function below sets the @samp{CATEGORY} 11236 property of the entries to @samp{web}. 11237 11238 @lisp 11239 (defun set-category () 11240 (interactive "P") 11241 (let ((marker (or (org-get-at-bol 'org-hd-marker) 11242 (org-agenda-error)))) 11243 (org-with-point-at marker 11244 (org-back-to-heading t) 11245 (org-set-property "CATEGORY" "web")))) 11246 @end lisp 11247 @end table 11248 @end table 11249 11250 @anchor{Calendar commands} 11251 @subheading Calendar commands 11252 11253 @cindex calendar commands, from agenda 11254 11255 @table @asis 11256 @item @kbd{c} (@code{org-agenda-goto-calendar}) 11257 @kindex c 11258 @findex org-agenda-goto-calendar 11259 Open the Emacs calendar and go to the date at point in the agenda. 11260 11261 @item @kbd{c} (@code{org-calendar-goto-agenda}) 11262 @kindex c 11263 @findex org-calendar-goto-agenda 11264 When in the calendar, compute and show the Org agenda for the date 11265 at point. 11266 11267 @item @kbd{i} (@code{org-agenda-diary-entry}) 11268 @kindex i 11269 @findex org-agenda-diary-entry 11270 11271 @cindex diary entries, creating from agenda 11272 Insert a new entry into the diary, using the date at point and (for 11273 block entries) the date at the mark. This adds to the Emacs diary 11274 file@footnote{ This file is parsed for the agenda when 11275 @code{org-agenda-include-diary} is set.}, in a way similar to the 11276 @kbd{i} command in the calendar. The diary file pops up in 11277 another window, where you can add the entry. 11278 11279 @vindex org-agenda-diary-file 11280 If you configure @code{org-agenda-diary-file} to point to an Org file, 11281 Org creates entries in that file instead. Most entries are stored 11282 in a date-based outline tree that will later make it easy to archive 11283 appointments from previous months/years. The tree is built under an 11284 entry with a @samp{DATE_TREE} property, or else with years as top-level 11285 entries. Emacs prompts you for the entry text---if you specify it, 11286 the entry is created in @code{org-agenda-diary-file} without further 11287 interaction. If you directly press @kbd{@key{RET}} at the prompt 11288 without typing text, the target file is shown in another window for 11289 you to finish the entry there. See also the @kbd{k r} command. 11290 11291 @item @kbd{M} (@code{org-agenda-phases-of-moon}) 11292 @kindex M 11293 @findex org-agenda-phases-of-moon 11294 Show the phases of the moon for the three months around current 11295 date. 11296 11297 @item @kbd{S} (@code{org-agenda-sunrise-sunset}) 11298 @kindex S 11299 @findex org-agenda-sunrise-sunset 11300 Show sunrise and sunset times. The geographical location must be 11301 set with calendar variables, see the documentation for the Emacs 11302 calendar. 11303 11304 @item @kbd{C} (@code{org-agenda-convert-date}) 11305 @kindex C 11306 @findex org-agenda-convert-date 11307 Convert the date at point into many other cultural and historic 11308 calendars. 11309 11310 @item @kbd{H} (@code{org-agenda-holidays}) 11311 @kindex H 11312 @findex org-agenda-holidays 11313 Show holidays for three months around point date. 11314 @end table 11315 11316 @anchor{Quit and exit} 11317 @subheading Quit and exit 11318 11319 @table @asis 11320 @item @kbd{q} (@code{org-agenda-quit}) 11321 @kindex q 11322 @findex org-agenda-quit 11323 11324 Quit agenda, remove the agenda buffer. 11325 11326 @item @kbd{x} (@code{org-agenda-exit}) 11327 @kindex x 11328 @findex org-agenda-exit 11329 11330 @cindex agenda files, removing buffers 11331 Exit agenda, remove the agenda buffer and all buffers loaded by 11332 Emacs for the compilation of the agenda. Buffers created by the 11333 user to visit Org files are not removed. 11334 @end table 11335 11336 @node Custom Agenda Views 11337 @section Custom Agenda Views 11338 11339 @cindex custom agenda views 11340 @cindex agenda views, custom 11341 11342 Custom agenda commands serve two purposes: to store and quickly access 11343 frequently used TODO and tags searches, and to create special 11344 composite agenda buffers. Custom agenda commands are accessible 11345 through the dispatcher (see @ref{Agenda Dispatcher}), just like the 11346 default commands. 11347 11348 @menu 11349 * Storing searches:: Type once, use often. 11350 * Block agenda:: All the stuff you need in a single buffer. 11351 * Setting options:: Changing the rules. 11352 @end menu 11353 11354 @node Storing searches 11355 @subsection Storing searches 11356 11357 The first application of custom searches is the definition of keyboard 11358 shortcuts for frequently used searches, either creating an agenda 11359 buffer, or a sparse tree (the latter covering of course only the 11360 current buffer). 11361 11362 @kindex C @r{(Agenda dispatcher)} 11363 @vindex org-agenda-custom-commands 11364 @cindex agenda views, main example 11365 @cindex agenda, as an agenda views 11366 @cindex agenda*, as an agenda views 11367 @cindex tags, as an agenda view 11368 @cindex todo, as an agenda view 11369 @cindex tags-todo 11370 @cindex todo-tree 11371 @cindex occur-tree 11372 @cindex tags-tree 11373 Custom commands are configured in the variable 11374 @code{org-agenda-custom-commands}. You can customize this variable, for 11375 example by pressing @kbd{C} from the agenda dispatcher (see @ref{Agenda Dispatcher}). You can also directly set it with Emacs Lisp in 11376 the Emacs init file. The following example contains all valid agenda 11377 views: 11378 11379 @lisp 11380 (setq org-agenda-custom-commands 11381 '(("x" agenda) 11382 ("y" agenda*) 11383 ("w" todo "WAITING") 11384 ("W" todo-tree "WAITING") 11385 ("u" tags "+boss-urgent") 11386 ("v" tags-todo "+boss-urgent") 11387 ("U" tags-tree "+boss-urgent") 11388 ("f" occur-tree "\\<FIXME\\>") 11389 ("h" . "HOME+Name tags searches") ;description for "h" prefix 11390 ("hl" tags "+home+Lisa") 11391 ("hp" tags "+home+Peter") 11392 ("hk" tags "+home+Kim"))) 11393 @end lisp 11394 11395 The initial string in each entry defines the keys you have to press 11396 after the dispatcher command in order to access the command. Usually 11397 this is just a single character, but if you have many similar 11398 commands, you can also define two-letter combinations where the first 11399 character is the same in several combinations and serves as a prefix 11400 key@footnote{ You can provide a description for a prefix key by inserting a 11401 cons cell with the prefix and the description.}. The second parameter 11402 is the search type, followed by the string or regular expression to be 11403 used for the matching. The example above will therefore define: 11404 11405 @table @asis 11406 @item @kbd{x} 11407 as a global search for agenda entries planned@footnote{@emph{Planned} means here that these entries have some planning 11408 information attached to them, like a timestamp, a scheduled or 11409 a deadline string. See @code{org-agenda-entry-types} on how to set what 11410 planning information is taken into account.} this week/day. 11411 11412 @item @kbd{y} 11413 as the same search, but only for entries with an hour specification 11414 like @samp{[h]h:mm}---think of them as appointments. 11415 11416 @item @kbd{w} 11417 as a global search for TODO entries with @samp{WAITING} as the TODO 11418 keyword. 11419 11420 @item @kbd{W} 11421 as the same search, but only in the current buffer and displaying 11422 the results as a sparse tree. 11423 11424 @item @kbd{u} 11425 as a global tags search for headlines tagged @samp{boss} but not 11426 @samp{urgent}. 11427 11428 @item @kbd{v} 11429 The same search, but limiting it to headlines that are also TODO 11430 items. 11431 11432 @item @kbd{U} 11433 as the same search, but only in the current buffer and displaying 11434 the result as a sparse tree. 11435 11436 @item @kbd{f} 11437 to create a sparse tree (again, current buffer only) with all 11438 entries containing the word @samp{FIXME}. 11439 11440 @item @kbd{h} 11441 as a prefix command for a @samp{HOME} tags search where you have to press 11442 an additional key (@kbd{l}, @kbd{p} or @kbd{k}) to 11443 select a name (Lisa, Peter, or Kim) as additional tag to match. 11444 @end table 11445 11446 Note that @code{*-tree} agenda views need to be called from an Org buffer 11447 as they operate on the current buffer only. 11448 11449 @node Block agenda 11450 @subsection Block agenda 11451 11452 @cindex block agenda 11453 @cindex agenda, with block views 11454 11455 Another possibility is the construction of agenda views that comprise 11456 the results of @emph{several} commands, each of which creates a block in 11457 the agenda buffer. The available commands include @code{agenda} for the 11458 daily or weekly agenda (as created with @kbd{a}) , @code{alltodo} for 11459 the global TODO list (as constructed with @kbd{t}), @code{stuck} for 11460 the list of stuck projects (as obtained with @kbd{#}) and the 11461 matching commands discussed above: @code{todo}, @code{tags}, and @code{tags-todo}. 11462 11463 Here are two examples: 11464 11465 @lisp 11466 (setq org-agenda-custom-commands 11467 '(("h" "Agenda and Home-related tasks" 11468 ((agenda "") 11469 (tags-todo "home") 11470 (tags "garden"))) 11471 ("o" "Agenda and Office-related tasks" 11472 ((agenda "") 11473 (tags-todo "work") 11474 (tags "office"))))) 11475 @end lisp 11476 11477 @noindent 11478 This defines @kbd{h} to create a multi-block view for stuff you 11479 need to attend to at home. The resulting agenda buffer contains your 11480 agenda for the current week, all TODO items that carry the tag @samp{home}, 11481 and also all lines tagged with @samp{garden}. Finally the command 11482 @kbd{o} provides a similar view for office tasks. 11483 11484 @node Setting options 11485 @subsection Setting options for custom commands 11486 11487 @cindex options, for custom agenda views 11488 11489 @vindex org-agenda-custom-commands 11490 Org mode contains a number of variables regulating agenda construction 11491 and display. The global variables define the behavior for all agenda 11492 commands, including the custom commands. However, if you want to 11493 change some settings just for a single custom view, you can do so. 11494 Setting options requires inserting a list of variable names and values 11495 at the right spot in @code{org-agenda-custom-commands}. For example: 11496 11497 @lisp 11498 (setq org-agenda-custom-commands 11499 '(("w" todo "WAITING" 11500 ((org-agenda-sorting-strategy '(priority-down)) 11501 (org-agenda-prefix-format " Mixed: "))) 11502 ("U" tags-tree "+boss-urgent" 11503 ((org-show-context-detail 'minimal))) 11504 ("N" search "" 11505 ((org-agenda-files '("~org/notes.org")) 11506 (org-agenda-text-search-extra-files nil))))) 11507 @end lisp 11508 11509 @noindent 11510 Now the @kbd{w} command sorts the collected entries only by 11511 priority, and the prefix format is modified to just say @samp{Mixed:} 11512 instead of giving the category of the entry. The sparse tags tree of 11513 @kbd{U} now turns out ultra-compact, because neither the headline 11514 hierarchy above the match, nor the headline following the match are 11515 shown. The command @kbd{N} does a text search limited to only 11516 a single file. 11517 11518 For command sets creating a block agenda, @code{org-agenda-custom-commands} 11519 has two separate spots for setting options. You can add options that 11520 should be valid for just a single command in the set, and options that 11521 should be valid for all commands in the set. The former are just 11522 added to the command entry; the latter must come after the list of 11523 command entries. Going back to the block agenda example (see @ref{Block agenda}), let's change the sorting strategy for the @kbd{h} 11524 commands to @code{priority-down}, but let's sort the results for @samp{garden} 11525 tags query in the opposite order, @code{priority-up}. This would look like 11526 this: 11527 11528 @lisp 11529 (setq org-agenda-custom-commands 11530 '(("h" "Agenda and Home-related tasks" 11531 ((agenda) 11532 (tags-todo "home") 11533 (tags "garden" 11534 ((org-agenda-sorting-strategy '(priority-up))))) 11535 ((org-agenda-sorting-strategy '(priority-down)))) 11536 ("o" "Agenda and Office-related tasks" 11537 ((agenda) 11538 (tags-todo "work") 11539 (tags "office"))))) 11540 @end lisp 11541 11542 As you see, the values and parentheses setting is a little complex. 11543 When in doubt, use the customize interface to set this variable---it 11544 fully supports its structure. Just one caveat: when setting options 11545 in this interface, the @emph{values} are just Lisp expressions. So if the 11546 value is a string, you need to add the double-quotes around the value 11547 yourself. 11548 11549 @vindex org-agenda-custom-commands-contexts 11550 To control whether an agenda command should be accessible from 11551 a specific context, you can customize 11552 @code{org-agenda-custom-commands-contexts}. Let's say for example that you 11553 have an agenda command @kbd{o} displaying a view that you only 11554 need when reading emails. Then you would configure this option like 11555 this: 11556 11557 @lisp 11558 (setq org-agenda-custom-commands-contexts 11559 '(("o" (in-mode . "message-mode")))) 11560 @end lisp 11561 11562 You can also tell that the command key @kbd{o} should refer to 11563 another command key @kbd{r}. In that case, add this command key 11564 like this: 11565 11566 @lisp 11567 (setq org-agenda-custom-commands-contexts 11568 '(("o" "r" (in-mode . "message-mode")))) 11569 @end lisp 11570 11571 See the docstring of the variable for more information. 11572 11573 @node Exporting Agenda Views 11574 @section Exporting Agenda Views 11575 11576 @cindex agenda views, exporting 11577 11578 If you are away from your computer, it can be very useful to have a 11579 printed version of some agenda views to carry around. Org mode can 11580 export custom agenda views as plain text, HTML@footnote{ For HTML you need 11581 to install Hrvoje Nikšić's @samp{htmlize.el} as an Emacs package from 11582 @uref{https://elpa.nongnu.org/, NonGNU ELPA} or from 11583 @uref{https://github.com/hniksic/emacs-htmlize, Hrvoje Nikšić's repository}.}, 11584 Postscript, PDF@footnote{To create PDF output, the Ghostscript ps2pdf utility must be 11585 installed on the system. Selecting a PDF file also creates the 11586 postscript file.}, and iCalendar files. If you 11587 want to do this only occasionally, use the following command: 11588 11589 @table @asis 11590 @item @kbd{C-x C-w} (@code{org-agenda-write}) 11591 @kindex C-x C-w 11592 @findex org-agenda-write 11593 @cindex exporting agenda views 11594 @cindex agenda views, exporting 11595 11596 @vindex org-agenda-exporter-settings 11597 Write the agenda view to a file. 11598 @end table 11599 11600 If you need to export certain agenda views frequently, you can 11601 associate any custom agenda command with a list of output file 11602 names@footnote{ If you want to store standard views like the weekly agenda 11603 or the global TODO list as well, you need to define custom commands 11604 for them in order to be able to specify file names.}. Here is an 11605 example that first defines custom commands for the agenda and the 11606 global TODO list, together with a number of files to which to export 11607 them. Then we define two block agenda commands and specify file names 11608 for them as well. File names can be relative to the current working 11609 directory, or absolute. 11610 11611 @lisp 11612 (setq org-agenda-custom-commands 11613 '(("X" agenda "" nil ("agenda.html" "agenda.ps")) 11614 ("Y" alltodo "" nil ("todo.html" "todo.txt" "todo.ps")) 11615 ("h" "Agenda and Home-related tasks" 11616 ((agenda "") 11617 (tags-todo "home") 11618 (tags "garden")) 11619 nil 11620 ("~/views/home.html")) 11621 ("o" "Agenda and Office-related tasks" 11622 ((agenda) 11623 (tags-todo "work") 11624 (tags "office")) 11625 nil 11626 ("~/views/office.ps" "~/calendars/office.ics")))) 11627 @end lisp 11628 11629 The extension of the file name determines the type of export. If it 11630 is @samp{.html}, Org mode uses the htmlize package to convert the buffer to 11631 HTML and save it to this file name. If the extension is @samp{.ps}, 11632 @code{ps-print-buffer-with-faces} is used to produce Postscript output. If 11633 the extension is @samp{.ics}, iCalendar export is run export over all files 11634 that were used to construct the agenda, and limit the export to 11635 entries listed in the agenda. Any other extension produces a plain 11636 ASCII file. 11637 11638 The export files are @emph{not} created when you use one of those 11639 commands interactively because this might use too much overhead. 11640 Instead, there is a special command to produce @emph{all} specified 11641 files in one step: 11642 11643 @table @asis 11644 @item @kbd{e} (@code{org-store-agenda-views}) 11645 @kindex e @r{(Agenda dispatcher)} 11646 @findex org-store-agenda-views 11647 Export all agenda views that have export file names associated with 11648 them. 11649 @end table 11650 11651 You can use the options section of the custom agenda commands to also 11652 set options for the export commands. For example: 11653 11654 @lisp 11655 (setq org-agenda-custom-commands 11656 '(("X" agenda "" 11657 ((ps-number-of-columns 2) 11658 (ps-landscape-mode t) 11659 (org-agenda-prefix-format " [ ] ") 11660 (org-agenda-with-colors nil) 11661 (org-agenda-remove-tags t)) 11662 ("theagenda.ps")))) 11663 @end lisp 11664 11665 @noindent 11666 @vindex org-agenda-exporter-settings 11667 This command sets two options for the Postscript exporter, to make it 11668 print in two columns in landscape format---the resulting page can be 11669 cut in two and then used in a paper agenda. The remaining settings 11670 modify the agenda prefix to omit category and scheduling information, 11671 and instead include a checkbox to check off items. We also remove the 11672 tags to make the lines compact, and we do not want to use colors for 11673 the black-and-white printer. Settings specified in 11674 @code{org-agenda-exporter-settings} also apply, e.g., 11675 11676 @lisp 11677 (setq org-agenda-exporter-settings 11678 '((ps-number-of-columns 2) 11679 (ps-landscape-mode t) 11680 (org-agenda-add-entry-text-maxlines 5) 11681 (htmlize-output-type 'css))) 11682 @end lisp 11683 11684 @noindent 11685 but the settings in @code{org-agenda-custom-commands} take precedence. 11686 11687 From the command line you may also use: 11688 11689 @example 11690 emacs -eval (org-batch-store-agenda-views) -kill 11691 @end example 11692 11693 @noindent 11694 or, if you need to modify some parameters@footnote{ Quoting depends on the 11695 system you use, please check the FAQ for examples.} 11696 11697 @example 11698 emacs -eval '(org-batch-store-agenda-views \ 11699 org-agenda-span (quote month) \ 11700 org-agenda-start-day "2007-11-01" \ 11701 org-agenda-include-diary nil \ 11702 org-agenda-files (quote ("~/org/project.org")))' \ 11703 -kill 11704 @end example 11705 11706 @noindent 11707 which creates the agenda views restricted to the file 11708 @samp{~/org/project.org}, without diary entries and with a 30-day extent. 11709 11710 You can also extract agenda information in a way that allows further 11711 processing by other programs. See @ref{Extracting Agenda Information}, for 11712 more information. 11713 11714 @node Agenda Column View 11715 @section Using Column View in the Agenda 11716 11717 @cindex column view, in agenda 11718 @cindex agenda, column view 11719 11720 Column view (see @ref{Column View}) is normally used to view and edit 11721 properties embedded in the hierarchical structure of an Org file. It 11722 can be quite useful to use column view also from the agenda, where 11723 entries are collected by certain criteria. 11724 11725 @table @asis 11726 @item @kbd{C-c C-x C-c} (@code{org-agenda-columns}) 11727 @kindex C-c C-x C-c 11728 @findex org-agenda-columns 11729 11730 Turn on column view in the agenda. 11731 @end table 11732 11733 To understand how to use this properly, it is important to realize 11734 that the entries in the agenda are no longer in their proper outline 11735 environment. This causes the following issues: 11736 11737 @enumerate 11738 @item 11739 @vindex org-columns-default-format-for-agenda 11740 @vindex org-columns-default-format 11741 Org needs to make a decision which columns format to use. Since 11742 the entries in the agenda are collected from different files, and 11743 different files may have different columns formats, this is a 11744 non-trivial problem. Org first checks if 11745 @code{org-overriding-columns-format} is currently set, and if so, takes 11746 the format from there. You should set this variable only in the 11747 @emph{local settings section} of a custom agenda command (see @ref{Custom Agenda Views}) to make it valid for that specific agenda view. If 11748 no such binding exists, it checks, in sequence, 11749 @code{org-columns-default-format-for-agenda}, the format associated with 11750 the first item in the agenda (through a property or a @samp{#+COLUMNS} 11751 setting in that buffer) and finally @code{org-columns-default-format}. 11752 11753 @item 11754 @cindex @samp{CLOCKSUM}, special property 11755 If any of the columns has a summary type defined (see @ref{Column attributes}), turning on column view in the agenda visits all 11756 relevant agenda files and make sure that the computations of this 11757 property are up to date. This is also true for the special 11758 @samp{CLOCKSUM} property. Org then sums the values displayed in the 11759 agenda. In the daily/weekly agenda, the sums cover a single day; 11760 in all other views they cover the entire block. 11761 11762 It is important to realize that the agenda may show the same entry 11763 @emph{twice}---for example as scheduled and as a deadline---and it may 11764 show two entries from the same hierarchy (for example a @emph{parent} 11765 and its @emph{child}). In these cases, the summation in the agenda 11766 leads to incorrect results because some values count double. 11767 11768 @item 11769 When the column view in the agenda shows the @samp{CLOCKSUM} property, 11770 that is always the entire clocked time for this item. So even in 11771 the daily/weekly agenda, the clocksum listed in column view may 11772 originate from times outside the current view. This has the 11773 advantage that you can compare these values with a column listing 11774 the planned total effort for a task---one of the major 11775 applications for column view in the agenda. If you want 11776 information about clocked time in the displayed period use clock 11777 table mode (press @kbd{R} in the agenda). 11778 11779 @item 11780 @cindex @samp{CLOCKSUM_T}, special property 11781 When the column view in the agenda shows the @samp{CLOCKSUM_T} property, 11782 that is always today's clocked time for this item. So even in the 11783 weekly agenda, the clocksum listed in column view only originates 11784 from today. This lets you compare the time you spent on a task for 11785 today, with the time already spent---via @samp{CLOCKSUM}---and with 11786 the planned total effort for it. 11787 @end enumerate 11788 11789 @node Markup for Rich Contents 11790 @chapter Markup for Rich Contents 11791 11792 Org is primarily about organizing and searching through your 11793 plain-text notes. However, it also provides a lightweight yet robust 11794 markup language for rich text formatting and more. For instance, you 11795 may want to center or emphasize text. Or you may need to insert 11796 a formula or image in your writing. Org offers syntax for all of this 11797 and more. Used in conjunction with the export framework (see 11798 @ref{Exporting}), you can author beautiful documents in Org---like the fine 11799 manual you are currently reading. 11800 11801 @menu 11802 * Paragraphs:: The basic unit of text. 11803 * Emphasis and Monospace:: Bold, italic, etc. 11804 * Subscripts and Superscripts:: Simple syntax for raising/lowering text. 11805 * Special Symbols:: Greek letters and other symbols. 11806 * Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents. 11807 * Literal Examples:: Source code examples with special formatting. 11808 * Images:: Display an image. 11809 * Captions:: Describe tables, images... 11810 * Horizontal Rules:: Make a line. 11811 * Creating Footnotes:: Edit and read footnotes. 11812 @end menu 11813 11814 @node Paragraphs 11815 @section Paragraphs 11816 11817 @cindex paragraphs, markup rules 11818 Paragraphs are separated by at least one empty line. If you need to 11819 enforce a line break within a paragraph, use @samp{\\} at the end of 11820 a line. 11821 11822 @cindex line breaks, markup rules 11823 To preserve the line breaks, indentation and blank lines in a region, 11824 but otherwise use normal formatting, you can use this construct, which 11825 can also be used to format poetry. 11826 11827 @cindex @samp{BEGIN_VERSE} 11828 @cindex verse blocks 11829 @example 11830 #+BEGIN_VERSE 11831 Great clouds overhead 11832 Tiny black birds rise and fall 11833 Snow covers Emacs 11834 11835 ---AlexSchroeder 11836 #+END_VERSE 11837 @end example 11838 11839 When quoting a passage from another document, it is customary to 11840 format this as a paragraph that is indented on both the left and the 11841 right margin. You can include quotations in Org documents like this: 11842 11843 @cindex @samp{BEGIN_QUOTE} 11844 @cindex quote blocks 11845 @example 11846 #+BEGIN_QUOTE 11847 Everything should be made as simple as possible, 11848 but not any simpler ---Albert Einstein 11849 #+END_QUOTE 11850 @end example 11851 11852 If you would like to center some text, do it like this: 11853 11854 @cindex @samp{BEGIN_CENTER} 11855 @cindex center blocks 11856 @example 11857 #+BEGIN_CENTER 11858 Everything should be made as simple as possible, \\ 11859 but not any simpler 11860 #+END_CENTER 11861 @end example 11862 11863 @node Emphasis and Monospace 11864 @section Emphasis and Monospace 11865 11866 @cindex underlined text, markup rules 11867 @cindex bold text, markup rules 11868 @cindex italic text, markup rules 11869 @cindex verbatim text, markup rules 11870 @cindex code text, markup rules 11871 @cindex strike-through text, markup rules 11872 11873 You can make words @samp{*bold*}, @samp{/italic/}, @samp{_underlined_}, @samp{=verbatim=} 11874 and @samp{~code~}, and, if you must, @samp{+strike-through+}. Text in the code 11875 and verbatim string is not processed for Org specific syntax; it is 11876 exported verbatim. Org provides a single command as entry point for 11877 inserting the marker character. 11878 11879 @table @asis 11880 @item @kbd{C-c C-x C-f} (@code{org-emphasize}) 11881 @kindex C-c C-x C-f 11882 @findex org-emphasize 11883 Prompt for a marker character and insert or change an emphasis. If 11884 there is an active region, change that region to a new emphasis. If 11885 there is no region, just insert the marker characters and position 11886 the cursor between them. 11887 @end table 11888 11889 @vindex org-fontify-emphasized-text 11890 To turn off fontification for marked up text, you can set 11891 @code{org-fontify-emphasized-text} to @code{nil}. To narrow down the list of 11892 the fontified markup syntax, you can customize 11893 @code{org-emphasis-alist}@footnote{ The markup will still be recognized. Just 11894 not highlighted visually in Emacs.}. 11895 11896 @vindex org-hide-emphasis-markers 11897 To hide the emphasis markup characters in your buffers, set 11898 @code{org-hide-emphasis-markers} to @code{t}. 11899 11900 Sometimes, when marked text also contains the marker character itself, 11901 the result may be unsettling. For example, 11902 11903 @example 11904 /One may expect this whole sentence to be italicized, but the 11905 following ~user/?variable~ contains =/= character, which effectively 11906 stops emphasis there./ 11907 @end example 11908 11909 You can use zero width space to help Org sorting out the ambiguity. 11910 See @ref{Escape Character} for more details. 11911 11912 @node Subscripts and Superscripts 11913 @section Subscripts and Superscripts 11914 11915 @cindex subscript 11916 @cindex superscript 11917 11918 @samp{^} and @samp{_} are used to indicate super- and subscripts. To increase 11919 the readability of ASCII text, it is not necessary, but OK, to 11920 surround multi-character sub- and superscripts with curly braces. For 11921 example 11922 11923 @example 11924 The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand, 11925 the radius of Alpha Centauri is R_@{Alpha Centauri@} = 1.28 x R_@{sun@}. 11926 @end example 11927 11928 @vindex org-use-sub-superscripts 11929 @vindex org-export-with-sub-superscripts 11930 If you write a text where the underscore is often used in a different 11931 context, Org's convention to always interpret these as subscripts can 11932 get in your way. Configure the variable @code{org-use-sub-superscripts} 11933 and/or @code{org-export-with-sub-superscripts} to change this convention. 11934 For example, when setting these variables to @code{@{@}}, @samp{a_b} is not 11935 displayed/exported@footnote{The underlying markup still remains a 11936 sub/superscript. Only the visual display and export behavior 11937 changes.} as a subscript, but @samp{a_@{b@}} is. 11938 11939 You can set both @code{org-use-sub-superscripts} 11940 @code{org-export-with-sub-superscripts} in a file using the export option 11941 @samp{^:} (see @ref{Export Settings}). For example, 11942 @samp{#+OPTIONS: ^:@{@}} sets the two options to @code{@{@}} and limits super- and 11943 subscripts to the curly bracket notation. 11944 11945 You can also toggle the visual display of super- and subscripts: 11946 11947 @table @asis 11948 @item @kbd{C-c C-x \} (@code{org-toggle-pretty-entities}) 11949 @kindex C-c C-x \ 11950 @findex org-toggle-pretty-entities 11951 This command formats sub- and superscripts in a WYSIWYM way. 11952 @end table 11953 11954 @vindex org-pretty-entities 11955 @vindex org-pretty-entities-include-sub-superscripts 11956 Set both @code{org-pretty-entities} and 11957 @code{org-pretty-entities-include-sub-superscripts} to @code{t} to start with 11958 super- and subscripts @emph{visually} interpreted as specified by the 11959 option @code{org-use-sub-superscripts}. 11960 11961 @node Special Symbols 11962 @section Special Symbols 11963 11964 @cindex math symbols 11965 @cindex special symbols 11966 @cindex entities 11967 11968 You can use @LaTeX{}-like syntax to insert special symbols---named 11969 entities---like @samp{\alpha} to indicate the Greek letter, or @samp{\to} to indicate 11970 an arrow. Completion for these symbols is available, just type @samp{\} 11971 and maybe a few letters, and press @kbd{M-@key{TAB}} to see possible 11972 completions. If you need such a symbol inside a word, terminate it 11973 with a pair of curly brackets. For example 11974 11975 @example 11976 Pro tip: Given a circle \Gamma of diameter d, the length of its 11977 circumference is \pi@{@}d. 11978 @end example 11979 11980 @findex org-entities-help 11981 @vindex org-entities-user 11982 A large number of entities is provided, with names taken from both 11983 HTML and @LaTeX{}; you can comfortably browse the complete list from 11984 a dedicated buffer using the command @code{org-entities-help}. It is also 11985 possible to provide your own special symbols in the variable 11986 @code{org-entities-user}. 11987 11988 During export, these symbols are transformed into the native format of 11989 the exporter backend. Strings like @samp{\alpha} are exported as @samp{α} in 11990 the HTML output, and as @samp{\(\alpha\)} in the @LaTeX{} output. Similarly, @samp{\nbsp} 11991 becomes @samp{ } in HTML and @samp{~} in @LaTeX{}. 11992 11993 @cindex special symbols, in-buffer display 11994 If you would like to see entities displayed as UTF-8 characters, use 11995 the following command@footnote{ You can turn this on by default by setting 11996 the variable @code{org-pretty-entities}, or on a per-file base with the 11997 @samp{STARTUP} option @samp{entitiespretty}.}: 11998 11999 @table @asis 12000 @item @kbd{C-c C-x \} (@code{org-toggle-pretty-entities}) 12001 @kindex C-c C-x \ 12002 @findex org-toggle-pretty-entities 12003 12004 Toggle display of entities as UTF-8 characters. This does not 12005 change the buffer content which remains plain ASCII, but it overlays 12006 the UTF-8 character for display purposes only. 12007 @end table 12008 12009 @cindex shy hyphen, special symbol 12010 @cindex dash, special symbol 12011 @cindex ellipsis, special symbol 12012 In addition to regular entities defined above, Org exports in a 12013 special way@footnote{ This behavior can be disabled with @samp{-} export setting 12014 (see @ref{Export Settings}).} the following commonly used character 12015 combinations: @samp{\-} is treated as a shy hyphen, @samp{--} and @samp{---} are 12016 converted into dashes, and @samp{...} becomes a compact set of dots. 12017 12018 @node Embedded @LaTeX{} 12019 @section Embedded @LaTeX{} 12020 12021 @cindex @TeX{} interpretation 12022 @cindex @LaTeX{} interpretation 12023 12024 Plain ASCII is normally sufficient for almost all note taking. 12025 Exceptions include scientific notes, which often require mathematical 12026 symbols and the occasional formula. @LaTeX{}@footnote{@LaTeX{} is a macro system based on Donald@tie{}E@.@tie{}Knuth's @TeX{} 12027 system. Many of the features described here as ``@LaTeX{}'' are really 12028 from @TeX{}, but for simplicity I am blurring this distinction.} is widely used to 12029 typeset scientific documents. Org mode supports embedding @LaTeX{} code 12030 into its files, because many academics are used to writing and reading 12031 @LaTeX{} source code, and because it can be readily processed to produce 12032 pretty output for a number of export backends. 12033 12034 @menu 12035 * @LaTeX{} fragments:: Complex formulas made easy. 12036 * Previewing @LaTeX{} fragments:: What will this snippet look like? 12037 * CD@LaTeX{} mode:: Speed up entering of formulas. 12038 @end menu 12039 12040 @node @LaTeX{} fragments 12041 @subsection @LaTeX{} fragments 12042 12043 @cindex @LaTeX{} fragments 12044 12045 @vindex org-format-latex-header 12046 Org mode can contain @LaTeX{} math fragments, and it supports ways to 12047 process these for several export backends. When exporting to @LaTeX{}, 12048 the code is left as it is. When exporting to HTML, Org can use either 12049 @uref{https://www.mathjax.org, MathJax} (see @ref{Math formatting in HTML export}) or transcode the math 12050 into images (see @ref{Previewing @LaTeX{} fragments}). 12051 12052 @LaTeX{} fragments do not need any special marking at all. The following 12053 snippets are identified as @LaTeX{} source code: 12054 12055 @itemize 12056 @item 12057 Environments of any kind@footnote{When MathJax is used, only the environments recognized by 12058 MathJax are processed. When dvipng, dvisvgm, or ImageMagick suite is 12059 used to create images, any @LaTeX{} environment is handled.}. The only requirement is that the 12060 @samp{\begin} statement appears on a new line, preceded by only 12061 whitespace. 12062 12063 @item 12064 Text within the usual @LaTeX{} math delimiters. Prefer @samp{\(...\)} for 12065 inline fragments. The @samp{$...$} alternative has some restrictions and 12066 may be a source of confusion. To avoid conflicts with currency 12067 specifications, single @samp{$} characters are only recognized as math 12068 delimiters if the enclosed text contains at most two line breaks, is 12069 directly attached to the @samp{$} characters with no whitespace in 12070 between, and if the closing @samp{$} is followed by whitespace or 12071 punctuation (but not a dash). 12072 12073 Sometimes, it may necessary to have a literal dollar symbol even 12074 when it is recognized as @LaTeX{} math delimiter. Org provides @samp{\dollar} and 12075 @samp{\USD} entities (see @ref{Special Symbols}) that are rendered as @samp{$} for 12076 such scenarios. Also, see @ref{Escape Character}. 12077 @end itemize 12078 12079 @noindent 12080 For example: 12081 12082 @example 12083 \begin@{equation@} % arbitrary environments, 12084 x=\sqrt@{b@} % even tables, figures, etc 12085 \end@{equation@} 12086 12087 If $a^2=b$ and \( b=2 \), then the solution must be 12088 either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \]. 12089 @end example 12090 12091 @vindex org-export-with-latex 12092 @LaTeX{} processing can be configured with the variable 12093 @code{org-export-with-latex}. The default setting is @code{t} which means 12094 MathJax for HTML, and no processing for ASCII and @LaTeX{} backends. 12095 You can also set this variable on a per-file basis using one of these 12096 lines: 12097 12098 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 12099 @item @samp{#+OPTIONS: tex:t} 12100 @tab Do the right thing automatically (MathJax) 12101 @item @samp{#+OPTIONS: tex:nil} 12102 @tab Do not process @LaTeX{} fragments at all 12103 @item @samp{#+OPTIONS: tex:verbatim} 12104 @tab Verbatim export, for jsMath or so 12105 @end multitable 12106 12107 @node Previewing @LaTeX{} fragments 12108 @subsection Previewing @LaTeX{} fragments 12109 12110 @cindex @LaTeX{} fragments, preview 12111 12112 @vindex org-preview-latex-default-process 12113 If you have a working @LaTeX{} installation and @samp{dvipng}, @samp{dvisvgm} or 12114 @samp{convert} installed@footnote{These are respectively available at 12115 @uref{https://sourceforge.net/projects/dvipng/}, @uref{http://dvisvgm.bplaced.net/} 12116 and from the ImageMagick suite. Choose the converter by setting the 12117 variable @code{org-preview-latex-default-process} accordingly.}, @LaTeX{} fragments can be processed to 12118 produce images of the typeset expressions to be used for inclusion 12119 while exporting to HTML (see @ref{@LaTeX{} fragments}), or for inline 12120 previewing within Org mode. 12121 12122 @vindex org-format-latex-options 12123 @vindex org-format-latex-header 12124 You can customize the variables @code{org-format-latex-options} and 12125 @code{org-format-latex-header} to influence some aspects of the preview. 12126 In particular, the @code{:scale} (and for HTML export, @code{:html-scale}) 12127 property of the former can be used to adjust the size of the preview 12128 images. 12129 12130 @table @asis 12131 @item @kbd{C-c C-x C-l} (@code{org-latex-preview}) 12132 @kindex C-c C-x C-l 12133 @findex org-latex-preview 12134 12135 Produce a preview image of the @LaTeX{} fragment at point and overlay 12136 it over the source code. If there is no fragment at point, process 12137 all fragments in the current entry---between two headlines. 12138 12139 When called with a single prefix argument, clear all images in the 12140 current entry. Two prefix arguments produce a preview image for all 12141 fragments in the buffer, while three of them clear all the images in 12142 that buffer. 12143 @end table 12144 12145 @vindex org-startup-with-latex-preview 12146 You can turn on the previewing of all @LaTeX{} fragments in a file with 12147 12148 @example 12149 #+STARTUP: latexpreview 12150 @end example 12151 12152 12153 To disable it, simply use 12154 12155 @example 12156 #+STARTUP: nolatexpreview 12157 @end example 12158 12159 @node CD@LaTeX{} mode 12160 @subsection Using CD@LaTeX{} to enter math 12161 12162 @cindex CD@LaTeX{} 12163 12164 CD@LaTeX{} mode is a minor mode that is normally used in combination with 12165 a major @LaTeX{} mode like AUC@TeX{} in order to speed-up insertion of 12166 environments and math templates. Inside Org mode, you can make use of 12167 some of the features of CD@LaTeX{} mode. You need to install 12168 @samp{cdlatex.el} and @samp{texmathp.el} (the latter comes also with AUC@TeX{}) 12169 from @uref{https://elpa.nongnu.org/, NonGNU ELPA} with the @uref{https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Installation.html, Emacs packaging system} or alternatively from 12170 @uref{https://staff.fnwi.uva.nl/c.dominik/Tools/cdlatex/}. Do not use 12171 CD@LaTeX{} mode itself under Org mode, but use the special version Org 12172 CD@LaTeX{} minor mode that comes as part of Org. Turn it on for the 12173 current buffer with @kbd{M-x org-cdlatex-mode}, or for all Org 12174 files with 12175 12176 @lisp 12177 (add-hook 'org-mode-hook #'turn-on-org-cdlatex) 12178 @end lisp 12179 12180 When this mode is enabled, the following features are present (for 12181 more details see the documentation of CD@LaTeX{} mode): 12182 12183 @table @asis 12184 @item @kbd{C-c @{} 12185 @kindex C-c @{ 12186 12187 Insert an environment template. 12188 12189 @item @kbd{@key{TAB}} 12190 @kindex TAB 12191 12192 The @kbd{@key{TAB}} key expands the template if point is inside a 12193 @LaTeX{} fragment@footnote{ Org mode has a method to test if point is inside 12194 such a fragment, see the documentation of the function 12195 @code{org-inside-LaTeX-fragment-p}.}. For example, @kbd{@key{TAB}} 12196 expands @samp{fr} to @samp{\frac@{@}@{@}} and position point correctly inside the 12197 first brace. Another @kbd{@key{TAB}} gets you into the second brace. 12198 12199 Even outside fragments, @kbd{@key{TAB}} expands environment 12200 abbreviations at the beginning of a line. For example, if you write 12201 @samp{equ} at the beginning of a line and press @kbd{@key{TAB}}, this 12202 abbreviation is expanded to an @samp{equation} environment. To get 12203 a list of all abbreviations, type @kbd{M-x cdlatex-command-help}. 12204 12205 @item @kbd{^} 12206 @itemx @kbd{_} 12207 @kindex _ 12208 @kindex ^ 12209 @vindex cdlatex-simplify-sub-super-scripts 12210 12211 Pressing @kbd{_} and @kbd{^} inside a @LaTeX{} fragment 12212 inserts these characters together with a pair of braces. If you use 12213 @kbd{@key{TAB}} to move out of the braces, and if the braces surround 12214 only a single character or macro, they are removed again (depending 12215 on the variable @code{cdlatex-simplify-sub-super-scripts}). 12216 12217 @item @kbd{`} 12218 @kindex ` 12219 12220 Pressing the backquote followed by a character inserts math macros, 12221 also outside @LaTeX{} fragments. If you wait more than 1.5 seconds 12222 after the backquote, a help window pops up. 12223 12224 @item @kbd{'} 12225 @kindex ' 12226 12227 Pressing the single-quote followed by another character modifies the 12228 @LaTeX{} symbol before point with an accent or a font. If you wait 12229 more than 1.5 seconds after the single-quote, a help window pops up. 12230 Character modification works only inside @LaTeX{} fragments; outside 12231 the quote is normal. 12232 @end table 12233 12234 @node Literal Examples 12235 @section Literal Examples 12236 12237 @cindex literal examples, markup rules 12238 @cindex code line references, markup rules 12239 12240 You can include literal examples that should not be subjected to 12241 markup. Such examples are typeset in monospace, so this is well 12242 suited for source code and similar examples. 12243 12244 @cindex @samp{BEGIN_EXAMPLE} 12245 @cindex example block 12246 @example 12247 #+BEGIN_EXAMPLE 12248 Some example from a text file. 12249 #+END_EXAMPLE 12250 @end example 12251 12252 @cindex comma escape, in literal examples 12253 There is one limitation, however. You must insert a comma right 12254 before lines starting with either @samp{*}, @samp{,*}, @samp{#+} or @samp{,#+}, as those 12255 may be interpreted as outlines nodes or some other special syntax. 12256 Org transparently strips these additional commas whenever it accesses 12257 the contents of the block. 12258 12259 @example 12260 #+BEGIN_EXAMPLE 12261 ,* I am no real headline 12262 #+END_EXAMPLE 12263 @end example 12264 12265 For simplicity when using small examples, you can also start the 12266 example lines with a colon followed by a space. There may also be 12267 additional whitespace before the colon: 12268 12269 @example 12270 Here is an example 12271 : Some example from a text file. 12272 @end example 12273 12274 @cindex formatting source code, markup rules 12275 @vindex org-latex-src-block-backend 12276 If the example is source code from a programming language, or any 12277 other text that can be marked up by Font Lock in Emacs, you can ask 12278 for the example to look like the fontified Emacs buffer@footnote{This works automatically for the HTML backend (it requires 12279 version 1.34 of the @samp{htmlize.el} package, which you need to install). 12280 Fontified code chunks in @LaTeX{} can be achieved using either the 12281 @uref{https://www.ctan.org/pkg/listings, listings} @LaTeX{} package, @uref{https://www.ctan.org/pkg/minted, minted} @LaTeX{} package, or by using 12282 @uref{https://elpa.gnu.org/packages/engrave-faces.html, engrave-faces} . Refer to @code{org-latex-src-block-backend} for details.}. This 12283 is done with the code block, where you also need to specify the name 12284 of the major mode that should be used to fontify the example@footnote{Source code in code blocks may also be evaluated either 12285 interactively or on export. See @ref{Working with Source Code} for more 12286 information on evaluating code blocks.}, 12287 see @ref{Structure Templates} for shortcuts to easily insert code blocks. 12288 12289 @cindex @samp{BEGIN_SRC} 12290 @cindex source block 12291 @example 12292 #+BEGIN_SRC emacs-lisp 12293 (defun org-xor (a b) 12294 "Exclusive or." 12295 (if a (not b) b)) 12296 #+END_SRC 12297 @end example 12298 12299 Both in @samp{example} and in @samp{src} snippets, you can add a @samp{-n} switch to 12300 the @samp{#+BEGIN} line@footnote{In the @samp{src} snippets, switches must be placed 12301 right after the language name and before the @ref{Structure of Code Blocks, , header arguments}}, to get the lines of the example numbered. 12302 The @samp{-n} takes an optional numeric argument specifying the starting 12303 line number of the block. If you use a @samp{+n} switch, the numbering 12304 from the previous numbered snippet is continued in the current one. 12305 The @samp{+n} switch can also take a numeric argument. This adds the value 12306 of the argument to the last line of the previous block to determine 12307 the starting line number. 12308 12309 @example 12310 #+BEGIN_SRC emacs-lisp -n 20 12311 ;; This exports with line number 20. 12312 (message "This is line 21") 12313 #+END_SRC 12314 12315 #+BEGIN_SRC emacs-lisp +n 10 12316 ;; This is listed as line 31. 12317 (message "This is line 32") 12318 #+END_SRC 12319 @end example 12320 12321 In literal examples, Org interprets strings like @samp{(ref:name)} as 12322 labels, and use them as targets for special hyperlinks like 12323 @samp{[[(name)]]}---i.e., the reference name enclosed in single 12324 parentheses. In HTML, hovering the mouse over such a link 12325 remote-highlights the corresponding code line@footnote{ This requires some 12326 Javascript which is @emph{not} automatically included in the HTML output: 12327 you have to customize the variable @samp{org-html-head-include-scripts} to 12328 @code{t} to have it included (it is @code{nil} by default).}, which is kind of cool. 12329 12330 You can also add a @samp{-r} switch which @emph{removes} the labels from the 12331 source code@footnote{ Adding @samp{-k} to @samp{-n -r} @emph{keeps} the labels in the 12332 source code while using line numbers for the links, which might be 12333 useful to explain those in an Org mode example code.}. With the @samp{-n} 12334 switch, links to these references are labeled by the line numbers from 12335 the code listing. Otherwise links use the labels with no parentheses. 12336 Here is an example: 12337 12338 @example 12339 #+BEGIN_SRC emacs-lisp -n -r 12340 (save-excursion (ref:sc) 12341 (goto-char (point-min)) (ref:jump) 12342 #+END_SRC 12343 In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]] 12344 jumps to point-min. 12345 @end example 12346 12347 @cindex indentation, in source blocks 12348 Source code and examples may be @emph{indented} in order to align nicely 12349 with the surrounding text, and in particular with plain list structure 12350 (see @ref{Plain Lists}). By default, Org only retains the relative 12351 indentation between lines, e.g., when exporting the contents of the 12352 block. However, you can use the @samp{-i} switch to also preserve the 12353 global indentation, if it does matter. See @ref{Editing Source Code}. 12354 12355 @vindex org-coderef-label-format 12356 If the syntax for the label format conflicts with the language syntax, 12357 use a @samp{-l} switch to change the format, for example 12358 12359 @example 12360 #+BEGIN_SRC pascal -n -r -l "((%s))" 12361 @end example 12362 12363 12364 @noindent 12365 See also the variable @code{org-coderef-label-format}. 12366 12367 HTML export also allows examples to be published as text areas (see 12368 @ref{Text areas in HTML export}). 12369 12370 Because the @samp{#+BEGIN} @dots{} @samp{#+END} patterns need to be added so often, 12371 a shortcut is provided (see @ref{Structure Templates}). 12372 12373 @table @asis 12374 @item @kbd{C-c '} (@code{org-edit-special}) 12375 @kindex C-c ' 12376 @findex org-edit-special 12377 Edit the source code example at point in its native mode. This 12378 works by switching to a temporary buffer with the source code. You 12379 need to exit by pressing @kbd{C-c '} again. The edited version 12380 then replaces the old version in the Org buffer. Fixed-width 12381 regions---where each line starts with a colon followed by a 12382 space---are edited using Artist mode@footnote{ You may select a different 12383 mode with the variable @code{org-edit-fixed-width-region-mode}.} to allow 12384 creating ASCII drawings easily. Using this command in an empty line 12385 creates a new fixed-width region. 12386 @end table 12387 12388 @cindex storing link, in a source code buffer 12389 Calling @code{org-store-link} (see @ref{Handling Links}) while editing a source 12390 code example in a temporary buffer created with @kbd{C-c '} 12391 prompts for a label. Make sure that it is unique in the current 12392 buffer, and insert it with the proper formatting like @samp{(ref:label)} at 12393 the end of the current line. Then the label is stored as a link 12394 @samp{(label)}, for retrieval with @kbd{C-c C-l}. 12395 12396 @node Images 12397 @section Images 12398 12399 @cindex inlining images 12400 @cindex images, markup rules 12401 An image is a link to an image file@footnote{ What Emacs considers to be an 12402 image depends on @code{image-file-name-extensions} and 12403 @code{image-file-name-regexps}.} that does not have a description part, for 12404 example 12405 12406 @example 12407 ./img/cat.jpg 12408 @end example 12409 12410 12411 If you wish to define a caption for the image (see @ref{Captions}) and 12412 maybe a label for internal cross-references (see @ref{Internal Links}), 12413 make sure that the link is on a line by itself and precede it with 12414 @samp{CAPTION} and @samp{NAME} keywords as follows: 12415 12416 @example 12417 #+CAPTION: This is the caption for the next figure link (or table) 12418 #+NAME: fig:SED-HR4049 12419 [[./img/a.jpg]] 12420 @end example 12421 12422 Such images can be displayed within the buffer with the following 12423 command: 12424 12425 @table @asis 12426 @item @kbd{C-c C-x C-v} (@code{org-toggle-inline-images}) 12427 @kindex C-c C-x C-v 12428 @findex org-toggle-inline-images 12429 @vindex org-startup-with-inline-images 12430 Toggle the inline display of linked images. When called with a 12431 prefix argument, also display images that do have a link 12432 description. You can ask for inline images to be displayed at 12433 startup by configuring the variable 12434 @code{org-startup-with-inline-images}@footnote{ The variable 12435 @code{org-startup-with-inline-images} can be set within a buffer with the 12436 @samp{STARTUP} options @samp{inlineimages} and @samp{noinlineimages}.}. 12437 @end table 12438 12439 12440 @vindex org-image-actual-width 12441 @vindex org-image-max-width 12442 @cindex @samp{ORG-IMAGE-ACTUAL-WIDTH}, property 12443 By default, Org mode displays inline images according to their 12444 actual width, but no wider than @code{fill-column} characters. 12445 12446 You can customize the displayed image width using 12447 @code{org-image-actual-width} variable (globally) or 12448 @samp{ORG-IMAGE-ACTUAL-WIDTH} property (subtree-level)@footnote{ The width can 12449 be customized in Emacs >= 24.1, built with imagemagick support.}. 12450 Their value can be the following: 12451 @itemize 12452 @item 12453 (default) Non-@code{nil}, use the actual width of images when inlining 12454 them. If the actual width is too wide, limit it according to 12455 @code{org-image-max-width}. 12456 @item 12457 When set to a number, use imagemagick (when available) to set the 12458 image's width to this value. 12459 @item 12460 When set to a number in a list, try to get the width from any 12461 @samp{#+ATTR.*} keyword if it matches a width specification like: 12462 @example 12463 #+ATTR_HTML: :width 300px 12464 @end example 12465 and fall back on that number if none is found. 12466 @item 12467 When set to @code{nil}, try to get the width from an @samp{#+ATTR.*} keyword 12468 and fall back on the original width or @code{org-image-max-width} if 12469 none is found. 12470 @end itemize 12471 12472 @code{org-image-max-width} limits the maximum displayed image width, but 12473 only when the image width is not set explicitly. Possible maximum 12474 width can be set to: 12475 @itemize 12476 @item 12477 (default) @code{fill-column}, limit width to @code{fill-column} number of 12478 characters. 12479 @item 12480 @code{window}, limit width to current window width. 12481 @item 12482 integer number, limit width to that specified number of pixels. 12483 @item 12484 @code{nil}, do not limit the width. 12485 @end itemize 12486 12487 @vindex org-image-align 12488 Org mode can left-align, center or right-align the display of inline 12489 images. This setting is controlled (globally) by @code{org-image-align}. 12490 Only standalone images are affected, corresponding to links with no 12491 surrounding text in their paragraph except for whitespace. Its 12492 value can be the following: 12493 @itemize 12494 @item 12495 (default) The symbol @code{left}, which inserts the image where the 12496 link appears in the buffer. 12497 @item 12498 The symbol @code{center}, which will preview links centered in the 12499 Emacs window. 12500 @item 12501 The symbol @code{right}, which will preview links right-aligned in the 12502 Emacs window. 12503 @end itemize 12504 12505 Inline image alignment can be specified for each link using the 12506 @samp{#+ATTR.*} keyword if it matches an alignment specification like: 12507 @example 12508 #+ATTR_HTML: :align center 12509 @end example 12510 Org will use the alignment specification from any @samp{#+ATTR.*} 12511 keyword, such as @samp{#+ATTR_HTML} or @samp{#+ATTR_LATEX}, but @samp{#+ATTR_ORG} 12512 (if present) will override the others. For instance, this link 12513 @example 12514 #+ATTR_HTML: :align right 12515 #+ATTR_ORG: :align center 12516 [[/path/to/image/file.png]] 12517 @end example 12518 will be displayed centered in Emacs but exported right-aligned to 12519 HTML@. 12520 12521 When @samp{#+ATTR_ORG} is not set, inline image alignment is also read 12522 from the @samp{:center} attribute supported by some export backends (like 12523 HTML, @LaTeX{} and Beamer.) 12524 12525 @vindex org-cycle-inline-images-display 12526 Inline images can also be displayed when cycling the folding state. 12527 When custom option @code{org-cycle-inline-images-display} is set, the 12528 visible inline images under subtree will be displayed automatically. 12529 12530 @node Captions 12531 @section Captions 12532 12533 @cindex captions, markup rules 12534 @cindex @samp{CAPTION}, keyword 12535 12536 You can assign a caption to a specific part of a document by inserting 12537 a @samp{CAPTION} keyword immediately before it: 12538 12539 @example 12540 #+CAPTION: This is the caption for the next table (or link) 12541 | ... | ... | 12542 |-----+-----| 12543 @end example 12544 12545 Optionally, the caption can take the form: 12546 12547 @example 12548 #+CAPTION[Short caption]: Longer caption. 12549 @end example 12550 12551 12552 Even though images and tables are prominent examples of captioned 12553 structures, the same caption mechanism can apply to many 12554 others---e.g., @LaTeX{} equations, source code blocks. Depending on the 12555 export backend, those may or may not be handled. 12556 12557 @node Horizontal Rules 12558 @section Horizontal Rules 12559 12560 @cindex horizontal rules, markup rules 12561 A line consisting of only dashes, and at least 5 of them, is exported 12562 as a horizontal line. 12563 12564 @node Creating Footnotes 12565 @section Creating Footnotes 12566 12567 @cindex footnotes 12568 12569 A footnote is started by a footnote marker in square brackets in 12570 column 0, no indentation allowed. It ends at the next footnote 12571 definition, headline, or after two consecutive empty lines. The 12572 footnote reference is simply the marker in square brackets, inside 12573 text. Markers always start with @samp{fn:}. For example: 12574 12575 @example 12576 The Org website[fn:1] now looks a lot better than it used to. 12577 ... 12578 [fn:50] The link is: https://orgmode.org 12579 @end example 12580 12581 Org mode extends the number-based syntax to @emph{named} footnotes and 12582 optional inline definition. Here are the valid references: 12583 12584 @table @asis 12585 @item @samp{[fn:NAME]} 12586 A named footnote reference, where @var{NAME} is a unique 12587 label word, or, for simplicity of automatic creation, a number. 12588 12589 @item @samp{[fn:: This is the inline definition of this footnote]} 12590 An anonymous footnote where the definition is given directly at the 12591 reference point. 12592 12593 @item @samp{[fn:NAME: a definition]} 12594 An inline definition of a footnote, which also specifies a name for 12595 the note. Since Org allows multiple references to the same note, 12596 you can then use @samp{[fn:NAME]} to create additional references. 12597 @end table 12598 12599 @vindex org-footnote-auto-label 12600 Footnote labels can be created automatically, or you can create names 12601 yourself. This is handled by the variable @code{org-footnote-auto-label} 12602 and its corresponding @samp{STARTUP} keywords. See the docstring of that 12603 variable for details. 12604 12605 The following command handles footnotes: 12606 12607 @table @asis 12608 @item @kbd{C-c C-x f} 12609 The footnote action command. 12610 12611 @kindex C-c C-x f 12612 When point is on a footnote reference, jump to the definition. When 12613 it is at a definition, jump to the---first---reference. 12614 12615 @vindex org-footnote-define-inline 12616 @vindex org-footnote-section 12617 Otherwise, create a new footnote. Depending on the variable 12618 @code{org-footnote-define-inline}@footnote{ The corresponding in-buffer 12619 setting is: @samp{#+STARTUP: fninline} or @samp{#+STARTUP: nofninline}.}, the 12620 definition is placed right into the text as part of the reference, 12621 or separately into the location determined by the variable 12622 @code{org-footnote-section}. 12623 12624 When this command is called with a prefix argument, a menu of 12625 additional options is offered: 12626 12627 @multitable @columnfractions 0.1 0.9 12628 @item @kbd{s} 12629 @tab Sort the footnote definitions by reference sequence. 12630 @item @kbd{r} 12631 @tab Renumber the simple @samp{fn:N} footnotes. 12632 @item @kbd{S} 12633 @tab Short for first @kbd{r}, then @kbd{s} action. 12634 @item @kbd{n} 12635 @tab Rename all footnotes into a @samp{fn:1} @dots{} @samp{fn:n} sequence. 12636 @item @kbd{d} 12637 @tab Delete the footnote at point, including definition and references. 12638 @end multitable 12639 12640 @vindex org-footnote-auto-adjust 12641 Depending on the variable @code{org-footnote-auto-adjust}@footnote{ The 12642 corresponding in-buffer options are @samp{#+STARTUP: fnadjust} and 12643 @samp{#+STARTUP: nofnadjust}.}, renumbering and sorting footnotes can be 12644 automatic after each insertion or deletion. 12645 12646 @item @kbd{C-c C-c} 12647 @kindex C-c C-c 12648 If point is on a footnote reference, jump to the definition. If it 12649 is at the definition, jump back to the reference. When called at 12650 a footnote location with a prefix argument, offer the same menu as 12651 @kbd{C-c C-x f}. 12652 12653 @item @kbd{C-c C-o} or @kbd{mouse-1/2} 12654 @kindex C-c C-o 12655 @kindex mouse-1 12656 @kindex mouse-2 12657 Footnote labels are also links to the corresponding definition or 12658 reference, and you can use the usual commands to follow these links. 12659 @end table 12660 12661 @node Exporting 12662 @chapter Exporting 12663 12664 @cindex exporting 12665 12666 At some point you might want to print your notes, publish them on the 12667 web, or share them with people not using Org. Org can convert and 12668 export documents to a variety of other formats while retaining as much 12669 structure (see @ref{Document Structure}) and markup (see @ref{Markup for Rich Contents}) as possible. 12670 12671 @cindex export backend 12672 @cindex export back-end 12673 The libraries responsible for translating Org files to other formats 12674 are called @emph{backends}. Org ships with support for the following 12675 backends: 12676 12677 @itemize 12678 @item 12679 @emph{ascii} (ASCII format) 12680 @item 12681 @emph{beamer} (@LaTeX{} Beamer format) 12682 @item 12683 @emph{html} (HTML format) 12684 @item 12685 @emph{icalendar} (iCalendar format) 12686 @item 12687 @emph{latex} (@LaTeX{} format) 12688 @item 12689 @emph{md} (Markdown format) 12690 @item 12691 @emph{odt} (OpenDocument Text format) 12692 @item 12693 @emph{org} (Org format) 12694 @item 12695 @emph{texinfo} (Texinfo format) 12696 @item 12697 @emph{man} (Man page format) 12698 @end itemize 12699 12700 Users can install libraries for additional formats from the Emacs 12701 packaging system. For easy discovery, these packages have a common 12702 naming scheme: @code{ox-NAME}, where @var{NAME} is a format. For 12703 example, @code{ox-koma-letter} for @emph{koma-letter} backend. More libraries 12704 can be found in the @samp{org-contrib} repository (see @ref{Installation}). 12705 12706 @vindex org-export-backends 12707 Org only loads backends for the following formats by default: ASCII, 12708 HTML, iCalendar, @LaTeX{}, and ODT@. Additional backends can be loaded 12709 in either of two ways: by configuring the @code{org-export-backends} 12710 variable, or by requiring libraries in the Emacs init file. For 12711 example, to load the Markdown backend, add this to your Emacs config: 12712 12713 @lisp 12714 (require 'ox-md) 12715 @end lisp 12716 12717 @menu 12718 * The Export Dispatcher:: The main interface. 12719 * Export Settings:: Common export settings. 12720 * Table of Contents:: The if and where of the table of contents. 12721 * Include Files:: Include additional files into a document. 12722 * Macro Replacement:: Use macros to create templates. 12723 * Comment Lines:: What will not be exported. 12724 * ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding. 12725 * Beamer Export:: Producing presentations and slides. 12726 * HTML Export:: Exporting to HTML. 12727 * @LaTeX{} Export:: Exporting to @LaTeX{} and processing to PDF. 12728 * Markdown Export:: Exporting to Markdown. 12729 * OpenDocument Text Export:: Exporting to OpenDocument Text. 12730 * Org Export:: Exporting to Org. 12731 * Texinfo Export:: Exporting to Texinfo. 12732 * iCalendar Export:: Exporting to iCalendar. 12733 * Other Built-in Backends:: Exporting to a man page. 12734 * Advanced Export Configuration:: Fine-tuning the export output. 12735 * Export Region:: Author tables and lists in Org syntax. 12736 @end menu 12737 12738 @node The Export Dispatcher 12739 @section The Export Dispatcher 12740 12741 @cindex dispatcher, for export commands 12742 @cindex export, dispatcher 12743 12744 The export dispatcher is the main interface for Org's exports. 12745 A hierarchical menu presents the currently configured export formats. 12746 Options are shown as easy toggle switches on the same screen. 12747 12748 @vindex org-export-dispatch-use-expert-ui 12749 Org also has a minimal prompt interface for the export dispatcher. 12750 When the variable @code{org-export-dispatch-use-expert-ui} is set to 12751 a non-@code{nil} value, Org prompts in the minibuffer. To switch back to 12752 the hierarchical menu, press @kbd{?}. 12753 12754 @table @asis 12755 @item @kbd{C-c C-e} (@code{org-export-dispatch}) 12756 @kindex C-c C-e 12757 @findex org-export-dispatch 12758 12759 Invokes the export dispatcher interface. The options show default 12760 settings. The @kbd{C-u} prefix argument preserves options from 12761 the previous export, including any subtree selections. 12762 @end table 12763 12764 Org exports the entire buffer by default. If the Org buffer has an 12765 active region, then Org exports just that region. 12766 12767 Within the dispatcher interface, the following key combinations can 12768 further alter what is exported, and how. 12769 12770 @table @asis 12771 @item @kbd{C-a} 12772 @kindex C-c C-e C-a 12773 12774 Toggle asynchronous export. Asynchronous export uses an external 12775 Emacs process with a specially configured initialization file to 12776 complete the exporting process in the background, without tying-up 12777 Emacs. This is particularly useful when exporting long documents. 12778 12779 Output from an asynchronous export is saved on the @emph{export stack}. 12780 To view this stack, call the export dispatcher with a double 12781 @kbd{C-u} prefix argument. If already in the export dispatcher 12782 menu, @kbd{&} displays the stack. 12783 12784 @vindex org-export-in-background 12785 You can make asynchronous export the default by setting 12786 @code{org-export-in-background}. 12787 12788 @vindex org-export-async-init-file 12789 You can set the initialization file used by the background process 12790 by setting @code{org-export-async-init-file}. 12791 12792 @item @kbd{C-b} 12793 @kindex C-c C-e C-b 12794 12795 Toggle body-only export. Useful for excluding headers and footers 12796 in the export. Affects only those backend formats that have 12797 sections like @samp{<head>...</head>} in HTML@. 12798 12799 @vindex org-export-body-only 12800 To make body-only export the default, customize the variable 12801 @code{org-export-body-only}. 12802 12803 @item @kbd{C-f} 12804 @kindex C-c C-e C-f 12805 12806 Toggle force-publishing export. Publish functions normally only 12807 publish changed files (see [BROKEN LINK: **Triggering Publication]). Forced 12808 publishing causes files to be published even if their timestamps do 12809 not indicate the file has been changed. 12810 12811 @vindex org-export-force-publishing 12812 To make forced publishing the default, customize the variable 12813 @code{org-export-force-publishing}. (This is similar to 12814 @code{org-publish-use-timestamps-flag}, but only affects the export 12815 dispatcher.) 12816 12817 @item @kbd{C-s} 12818 @kindex C-c C-e C-s 12819 12820 Toggle subtree export. When turned on, Org exports only the 12821 subtree starting from point position at the time the export 12822 dispatcher was invoked. Org uses the top heading of this subtree 12823 as the document's title. If point is not on a heading, Org uses the 12824 nearest enclosing header. If point is in the document preamble, Org 12825 signals an error and aborts export. 12826 12827 @vindex org-export-initial-scope 12828 To make subtree export the default, customize the variable 12829 @code{org-export-initial-scope}. 12830 12831 @item @kbd{C-v} 12832 @kindex C-c C-e C-v 12833 12834 Toggle visible-only export. This is useful for exporting only 12835 certain parts of an Org document by adjusting the visibility of 12836 particular headings. See also @ref{Sparse Trees}. 12837 12838 @vindex org-export-visible-only 12839 To make visible-only export the default, customize the variable 12840 @code{org-export-visible-only}. 12841 @end table 12842 12843 @node Export Settings 12844 @section Export Settings 12845 12846 @cindex options, for export 12847 @cindex Export, settings 12848 12849 @cindex @samp{OPTIONS}, keyword 12850 Export options can be set: globally with variables; for an individual 12851 file by making variables buffer-local with in-buffer settings (see 12852 @ref{In-buffer Settings}); by setting individual keywords or 12853 specifying them in compact form with the @samp{OPTIONS} keyword; or for 12854 a tree by setting properties (see @ref{Properties and Columns}). Options 12855 set at a specific level override options set at a more general level. 12856 12857 @cindex @samp{SETUPFILE}, keyword 12858 In-buffer settings may appear anywhere in the file, either directly or 12859 indirectly through a file included using @samp{#+SETUPFILE: filename or 12860 URL} syntax. Option keyword sets tailored to a particular backend 12861 can be inserted from the export dispatcher (see @ref{The Export Dispatcher}) using the @samp{Insert template} command by pressing 12862 @kbd{#}. To insert keywords individually, a good way to make 12863 sure the keyword is correct is to type @samp{#+} and then to use 12864 @kbd{M-@key{TAB}}@footnote{Many desktops intercept @kbd{M-@key{TAB}} to switch windows. 12865 Use @kbd{C-M-i} or @kbd{@key{ESC} @key{TAB}} instead.} for completion. 12866 12867 The export keywords available for every backend, and their equivalent 12868 global variables, include: 12869 12870 @table @asis 12871 @item @samp{AUTHOR} 12872 @cindex @samp{AUTHOR}, keyword 12873 @vindex user-full-name 12874 The document author (@code{user-full-name}). 12875 12876 @item @samp{CREATOR} 12877 @cindex @samp{CREATOR}, keyword 12878 @vindex org-expot-creator-string 12879 Entity responsible for output generation 12880 (@code{org-export-creator-string}). 12881 12882 @item @samp{DATE} 12883 @cindex @samp{DATE}, keyword 12884 @vindex org-export-date-timestamp-format 12885 A date or a timestamp@footnote{ The variable 12886 @code{org-export-date-timestamp-format} defines how this timestamp are 12887 exported.}. 12888 12889 @item @samp{EMAIL} 12890 @cindex @samp{EMAIL}, keyword 12891 @vindex user-mail-address 12892 The email address (@code{user-mail-address}). 12893 12894 @item @samp{LANGUAGE} 12895 @cindex @samp{LANGUAGE}, keyword 12896 @vindex org-export-default-language 12897 Language to use for translating certain strings 12898 (@code{org-export-default-language}). With @samp{#+LANGUAGE: fr}, for 12899 example, Org translates @samp{Table of contents} to the French @samp{Table des 12900 matières}@footnote{For export to @LaTeX{} format---or @LaTeX{}-related formats such as 12901 Beamer---, the @samp{org-latex-package-alist} variable needs further 12902 configuration. See @ref{@LaTeX{} specific export settings}.}. 12903 12904 @item @samp{SELECT_TAGS} 12905 @cindex @samp{SELECT_TAGS}, keyword 12906 @vindex org-export-select-tags 12907 List of tags that will, if present, be selected for export. The 12908 default value is @code{org-export-select-tags} @samp{("export")}. When a tree 12909 is tagged with @samp{export}, Org selects that tree and its subtrees for 12910 export, ignoring all the other sections that do not possess the 12911 @samp{export} tag. 12912 12913 When selectively exporting files with @samp{export} tags set, Org does 12914 not export any text that appears before the first headline. 12915 12916 Note that a file without the @samp{export} tags will export all its 12917 sections. 12918 12919 To select non-default tags for export, customize 12920 @code{org-export-select-tags} (globally) or add @samp{#+SELECT_TAGS: tag1 12921 tag2} to the document. 12922 12923 @item @samp{EXCLUDE_TAGS} 12924 @cindex @samp{EXCLUDE_TAGS}, keyword 12925 @vindex org-export-exclude-tags 12926 List of tags that will be excluded from export. The default value is 12927 @code{org-export-exclude-tags} @samp{("noexport")}. When a tree is tagged 12928 with @samp{noexport}, Org excludes that tree and its subtrees from 12929 export. 12930 12931 Entries tagged with @samp{noexport} are unconditionally excluded from the 12932 export, even if they have an @samp{export} tag. Even if a subtree is not 12933 exported, Org executes any code blocks contained there. 12934 12935 To select non-default tags for the exclusion, customize 12936 @code{org-export-exclude-tags} (globally) or add @samp{#+EXCLUDE_TAGS: tag1 12937 tag2} to the document. 12938 12939 @item @samp{TITLE} 12940 @cindex @samp{TITLE}, keyword 12941 @cindex document title 12942 Org displays this title. For long titles, use multiple @samp{#+TITLE} 12943 lines. 12944 12945 @item @samp{EXPORT_FILE_NAME} 12946 @cindex @samp{EXPORT_FILE_NAME}, keyword 12947 The name of the output file to be generated. Otherwise, Org 12948 generates the file name based on the buffer name and the extension 12949 based on the backend format. 12950 @end table 12951 12952 The @samp{OPTIONS} keyword is a compact form. To configure multiple 12953 options, use several @samp{OPTIONS} lines. @samp{OPTIONS} recognizes the 12954 following arguments. 12955 12956 @table @asis 12957 @item @code{'} 12958 @vindex org-export-with-smart-quotes 12959 Toggle smart quotes (@code{org-export-with-smart-quotes}). Depending on 12960 the language used, when activated, Org treats pairs of double quotes 12961 as primary quotes, pairs of single quotes as secondary quotes, and 12962 single quote marks as apostrophes. 12963 12964 @item @code{*} 12965 @vindex org-export-with-emphasize 12966 Toggle emphasized text (@code{org-export-with-emphasize}). 12967 12968 @item @code{-} 12969 @vindex org-export-with-special-strings 12970 Toggle conversion of special strings 12971 (@code{org-export-with-special-strings}). 12972 12973 @item @code{:} 12974 @vindex org-export-with-fixed-width 12975 Toggle fixed-width sections (@code{org-export-with-fixed-width}). 12976 12977 @item @code{<} 12978 @vindex org-export-with-timestamps 12979 Toggle inclusion of time/date active/inactive stamps 12980 (@code{org-export-with-timestamps}). 12981 12982 @item @code{\n} 12983 @vindex org-export-preserve-breaks 12984 Toggles whether to preserve line breaks 12985 (@code{org-export-preserve-breaks}). 12986 12987 @item @code{^} 12988 @vindex org-export-with-sub-superscripts 12989 Toggle @TeX{}-like syntax for sub- and superscripts. If you write 12990 @samp{^:@{@}}, @samp{a_@{b@}} is interpreted, but the simple @samp{a_b} is left as it 12991 is (@code{org-export-with-sub-superscripts}). 12992 12993 @item @code{arch} 12994 @vindex org-export-with-archived-trees 12995 Configure how archived trees are exported. When set to @code{headline}, 12996 the export process skips the contents and processes only the 12997 headlines (@code{org-export-with-archived-trees}). 12998 12999 @item @code{author} 13000 @vindex org-export-with-author 13001 Toggle inclusion of author name into exported file 13002 (@code{org-export-with-author}). 13003 13004 @item @code{expand-links} 13005 @vindex org-export-expand-links 13006 Toggle expansion of environment variables in file paths 13007 (@code{org-export-expand-links}). 13008 13009 @item @code{broken-links} 13010 @vindex org-export-with-broken-links 13011 Toggles if Org should continue exporting upon finding a broken 13012 internal link. When set to @code{mark}, Org clearly marks the problem 13013 link in the output (@code{org-export-with-broken-links}). 13014 13015 @item @code{c} 13016 @vindex org-export-with-clocks 13017 Toggle inclusion of @samp{CLOCK} keywords (@code{org-export-with-clocks}). 13018 13019 @item @code{creator} 13020 @vindex org-export-with-creator 13021 Toggle inclusion of creator information in the exported file 13022 (@code{org-export-with-creator}). 13023 13024 @item @code{d} 13025 @vindex org-export-with-drawers 13026 Toggles inclusion of drawers, or list of drawers to include, or list 13027 of drawers to exclude (@code{org-export-with-drawers}). 13028 13029 @item @code{date} 13030 @vindex org-export-with-date 13031 Toggle inclusion of a date into exported file 13032 (@code{org-export-with-date}). 13033 13034 @item @code{e} 13035 @vindex org-export-with-entities 13036 Toggle inclusion of entities (@code{org-export-with-entities}). 13037 13038 @item @code{email} 13039 @vindex org-export-with-email 13040 Toggle inclusion of the author's e-mail into exported file 13041 (@code{org-export-with-email}). 13042 13043 @item @code{f} 13044 @vindex org-export-with-footnotes 13045 Toggle the inclusion of footnotes (@code{org-export-with-footnotes}). 13046 13047 @item @code{H} 13048 @vindex org-export-headline-levels 13049 Set the number of headline levels for export 13050 (@code{org-export-headline-levels}). Below that level, headlines are 13051 treated differently. In most backends, they become list items. 13052 13053 @item @code{inline} 13054 @vindex org-export-with-inlinetasks 13055 Toggle inclusion of inlinetasks (@code{org-export-with-inlinetasks}). 13056 13057 @item @code{num} 13058 @vindex org-export-with-section-numbers 13059 @cindex @samp{UNNUMBERED}, property 13060 Toggle section-numbers (@code{org-export-with-section-numbers}). When 13061 set to number N, Org numbers only those headlines at level N or 13062 above. Set @samp{UNNUMBERED} property to non-@code{nil} to disable numbering 13063 of heading and subheadings entirely. Moreover, when the value is 13064 @samp{notoc} the headline, and all its children, do not appear in the 13065 table of contents either (see @ref{Table of Contents}). 13066 13067 @item @code{p} 13068 @vindex org-export-with-planning 13069 Toggle export of planning information (@code{org-export-with-planning}). 13070 ``Planning information'' comes from lines located right after the 13071 headline and contain any combination of these cookies: @samp{SCHEDULED}, 13072 @samp{DEADLINE}, or @samp{CLOSED}. 13073 13074 @item @code{pri} 13075 @vindex org-export-with-priority 13076 Toggle inclusion of priority cookies 13077 (@code{org-export-with-priority}). 13078 13079 @item @code{prop} 13080 @vindex org-export-with-properties 13081 Toggle inclusion of property drawers, or list the properties to 13082 include (@code{org-export-with-properties}). 13083 13084 @item @code{stat} 13085 @vindex org-export-with-statistics-cookies 13086 Toggle inclusion of statistics cookies 13087 (@code{org-export-with-statistics-cookies}). 13088 13089 @item @code{tags} 13090 @vindex org-export-with-tags 13091 Toggle inclusion of tags, may also be @code{not-in-toc} 13092 (@code{org-export-with-tags}). 13093 13094 @item @code{tasks} 13095 @vindex org-export-with-tasks 13096 Toggle inclusion of tasks (TODO items); or @code{nil} to remove all 13097 tasks; or @code{todo} to remove done tasks; or list the keywords to keep 13098 (@code{org-export-with-tasks}). 13099 13100 @item @code{tex} 13101 @vindex org-export-with-latex 13102 @code{nil} does not export; @code{t} exports; @code{verbatim} keeps everything in 13103 verbatim (@code{org-export-with-latex}). 13104 13105 @item @code{timestamp} 13106 @vindex org-export-time-stamp-file 13107 @vindex org-export-timestamp-file 13108 Toggle inclusion of the creation time in the exported file 13109 (@code{org-export-timestamp-file}). 13110 13111 @item @code{title} 13112 @vindex org-export-with-title 13113 Toggle inclusion of title (@code{org-export-with-title}). 13114 13115 @item @code{toc} 13116 @vindex org-export-with-toc 13117 Toggle inclusion of the table of contents, or set the level limit 13118 (@code{org-export-with-toc}). 13119 13120 @item @code{todo} 13121 @vindex org-export-with-todo-keywords 13122 Toggle inclusion of TODO keywords into exported text 13123 (@code{org-export-with-todo-keywords}). 13124 13125 @item @code{|} 13126 @vindex org-export-with-tables 13127 Toggle inclusion of tables (@code{org-export-with-tables}). 13128 @end table 13129 13130 When exporting subtrees, special node properties can override the 13131 above keywords. These properties have an @samp{EXPORT_} prefix. For 13132 example, @samp{DATE} becomes, @samp{EXPORT_DATE} when used for a specific 13133 subtree. Except for @samp{SETUPFILE}, all other keywords listed above 13134 have an @samp{EXPORT_} equivalent. 13135 13136 @cindex @samp{BIND}, keyword 13137 @vindex org-export-allow-bind-keywords 13138 If @code{org-export-allow-bind-keywords} is non-@code{nil}, Emacs variables can 13139 become buffer-local during export by using the @samp{BIND} keyword. Its 13140 syntax is @samp{#+BIND: variable value}. This is particularly useful for 13141 in-buffer settings that cannot be changed using keywords. 13142 13143 @node Table of Contents 13144 @section Table of Contents 13145 13146 @cindex table of contents 13147 @cindex list of tables 13148 @cindex list of listings 13149 13150 @cindex @samp{toc}, in @samp{OPTIONS} keyword 13151 @vindex org-export-with-toc 13152 The table of contents includes all headlines in the document. Its 13153 depth is therefore the same as the headline levels in the file. If 13154 you need to use a different depth, or turn it off entirely, set the 13155 @code{org-export-with-toc} variable accordingly. You can achieve the same 13156 on a per file basis, using the following @samp{toc} item in @samp{OPTIONS} 13157 keyword: 13158 13159 @example 13160 #+OPTIONS: toc:2 (only include two levels in TOC) 13161 #+OPTIONS: toc:nil (no default TOC at all) 13162 @end example 13163 13164 @cindex excluding entries from table of contents 13165 @cindex table of contents, exclude entries 13166 Org includes both numbered and unnumbered headlines in the table of 13167 contents@footnote{At the moment, some export backends do not obey this 13168 specification. For example, @LaTeX{} export excludes every unnumbered 13169 headline from the table of contents.}. If you need to exclude an unnumbered headline, 13170 along with all its children, set the @samp{UNNUMBERED} property to @samp{notoc} 13171 value. 13172 13173 @example 13174 * Subtree not numbered, not in table of contents either 13175 :PROPERTIES: 13176 :UNNUMBERED: notoc 13177 :END: 13178 @end example 13179 13180 @cindex @samp{TOC}, keyword 13181 Org normally inserts the table of contents in front of the exported 13182 document. To move the table of contents to a different location, 13183 first turn off the default with @code{org-export-with-toc} variable or with 13184 @samp{#+OPTIONS: toc:nil}. Then insert @samp{#+TOC: headlines N} at the desired 13185 location(s). 13186 13187 @example 13188 #+OPTIONS: toc:nil 13189 ... 13190 #+TOC: headlines 2 13191 @end example 13192 13193 To adjust the table of contents depth for a specific section of the 13194 Org document, append an additional @samp{local} parameter. This parameter 13195 becomes a relative depth for the current level. The following example 13196 inserts a local table of contents, with direct children only. 13197 13198 @example 13199 * Section 13200 #+TOC: headlines 1 local 13201 @end example 13202 13203 Note that for this feature to work properly in @LaTeX{} export, the Org 13204 file requires the inclusion of the titletoc package. Because of 13205 compatibility issues, titletoc has to be loaded @emph{before} hyperref. 13206 Customize the @code{org-latex-default-packages-alist} variable. 13207 13208 The following example inserts a table of contents that links to the 13209 children of the specified target. 13210 13211 @example 13212 * Target 13213 :PROPERTIES: 13214 :CUSTOM_ID: TargetSection 13215 :END: 13216 ** Heading A 13217 ** Heading B 13218 * Another section 13219 #+TOC: headlines 1 :target #TargetSection 13220 @end example 13221 13222 The @samp{:target} attribute is supported in HTML, Markdown, ODT, and ASCII export. 13223 13224 Use the @samp{TOC} keyword to generate list of tables---respectively, all 13225 listings---with captions. 13226 13227 @example 13228 #+TOC: listings 13229 #+TOC: tables 13230 @end example 13231 13232 @cindex @samp{ALT_TITLE}, property 13233 Normally Org uses the headline for its entry in the table of contents. 13234 But with @samp{ALT_TITLE} property, a different entry can be specified for 13235 the table of contents. 13236 13237 @node Include Files 13238 @section Include Files 13239 13240 @cindex include files, during export 13241 @cindex export, include files 13242 @cindex @samp{INCLUDE}, keyword 13243 13244 @ref{Summary of the export process, , During export}, you can include the content of another file. For 13245 example, to include your @samp{.emacs} file, you could use: 13246 13247 @example 13248 #+INCLUDE: "~/.emacs" src emacs-lisp 13249 @end example 13250 13251 13252 @noindent 13253 There are three positional arguments after the include keyword, they are: 13254 @enumerate 13255 @item 13256 The file name, this is the sole mandatory argument. Org neither 13257 checks for correctness or validates the content in any way. 13258 @item 13259 The block name to wrap the file content in. When this is 13260 @samp{example}, @samp{export}, or @samp{src} the content is escaped by 13261 @code{org-escape-code-in-string}. Arbitrary block names may be given, 13262 however block names starting with @samp{:} must be quoted, i.e. @samp{":name"}. 13263 @item 13264 The source code language to use for formatting the contents. This is relevant 13265 to both @samp{export} and @samp{src} block types. 13266 @end enumerate 13267 13268 @cindex @samp{minlevel}, include 13269 If an included file is not specified as having any markup language, 13270 Org assumes it be in Org format and proceeds as usual with a few 13271 exceptions. Org makes the footnote labels (see @ref{Creating Footnotes}) 13272 in the included file local to that file. The contents of the included 13273 file belong to the same structure---headline, item---containing the 13274 @samp{INCLUDE} keyword. In particular, headlines within the file become 13275 children of the current section. That behavior can be changed by 13276 providing an additional keyword parameter, @samp{:minlevel}. It shifts the 13277 headlines in the included file to become the lowest level. For 13278 example, this syntax makes the included file a sibling of the current 13279 top-level headline: 13280 13281 @example 13282 #+INCLUDE: "~/my-book/chapter2.org" :minlevel 1 13283 @end example 13284 13285 13286 @cindex @samp{lines}, include 13287 Inclusion of only portions of files are specified using ranges 13288 parameter with @samp{:lines} keyword. The line at the upper end of the 13289 range will not be included. The start and/or the end of the range may 13290 be omitted to use the obvious defaults. 13291 13292 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 13293 @item @samp{#+INCLUDE: "~/.emacs" :lines "5-10"} 13294 @tab Include lines 5 to 10, 10 excluded 13295 @item @samp{#+INCLUDE: "~/.emacs" :lines "-10"} 13296 @tab Include lines 1 to 10, 10 excluded 13297 @item @samp{#+INCLUDE: "~/.emacs" :lines "10-"} 13298 @tab Include lines from 10 to EOF 13299 @end multitable 13300 13301 Inclusions may specify a file-link to extract an object matched by 13302 @code{org-link-search}@footnote{Note that @code{org-link-search-must-match-exact-headline} is 13303 locally bound to non-@code{nil}. Therefore, @code{org-link-search} only matches 13304 headlines and named elements.} (see @ref{Search Options}). The 13305 ranges for @samp{:lines} keyword are relative to the requested element. 13306 Therefore, 13307 13308 @example 13309 #+INCLUDE: "./paper.org::*conclusion" :lines "1-20" 13310 @end example 13311 13312 13313 @noindent 13314 includes the first 20 lines of the headline named @samp{conclusion}. 13315 13316 @cindex @samp{only-contents}, include 13317 To extract only the contents of the matched object, set 13318 @samp{:only-contents} property to non-@code{nil}. This omits any planning lines 13319 or property drawers. For example, to include the body of the heading 13320 with the custom ID @samp{theory}, you can use 13321 13322 @example 13323 #+INCLUDE: "./paper.org::#theory" :only-contents t 13324 @end example 13325 13326 13327 The following command allows navigating to the included document: 13328 13329 @table @asis 13330 @item @kbd{C-c '} (@code{org-edit-special}) 13331 @kindex C-c ' 13332 @findex org-edit-special 13333 13334 Visit the included file at point. 13335 @end table 13336 13337 @node Macro Replacement 13338 @section Macro Replacement 13339 13340 @cindex macro replacement, during export 13341 @cindex @samp{MACRO}, keyword 13342 13343 @vindex org-export-global-macros 13344 Macros replace text snippets during export. Macros are defined 13345 globally in @code{org-export-global-macros}, or document-wise with the 13346 following syntax: 13347 13348 @example 13349 #+MACRO: name replacement text; $1, $2 are arguments 13350 @end example 13351 13352 13353 @noindent 13354 which can be referenced using @samp{@{@{@{name(arg1, arg2)@}@}@}}@footnote{Since commas separate the arguments, commas within arguments 13355 have to be escaped with the backslash character. So only those 13356 backslash characters before a comma need escaping with another 13357 backslash character.}. For 13358 example 13359 13360 @example 13361 #+MACRO: poem Rose is $1, violet's $2. Life's ordered: Org assists you. 13362 @{@{@{poem(red,blue)@}@}@} 13363 @end example 13364 13365 @noindent 13366 becomes 13367 13368 @example 13369 Rose is red, violet's blue. Life's ordered: Org assists you. 13370 @end example 13371 13372 13373 As a special case, Org parses any replacement text starting with 13374 @samp{(eval} as an Emacs Lisp expression and evaluates it accordingly. 13375 Within such templates, arguments become strings. Thus, the following 13376 macro 13377 13378 @example 13379 #+MACRO: gnustamp (eval (concat "GNU/" (capitalize $1))) 13380 @end example 13381 13382 13383 @noindent 13384 turns @samp{@{@{@{gnustamp(linux)@}@}@}} into @samp{GNU/Linux} during export. 13385 13386 Org recognizes macro references in following Org markup areas: 13387 paragraphs, headlines, verse blocks, tables cells and lists. Org also 13388 recognizes macro references in keywords, such as @samp{CAPTION}, @samp{TITLE}, 13389 @samp{AUTHOR}, @samp{DATE}, and for some backend specific export options. 13390 13391 Org comes with following pre-defined macros: 13392 13393 @table @asis 13394 @item @samp{@{@{@{keyword(NAME)@}@}@}} 13395 @itemx @samp{@{@{@{title@}@}@}} 13396 @itemx @samp{@{@{@{author@}@}@}} 13397 @itemx @samp{@{@{@{email@}@}@}} 13398 @cindex @samp{keyword}, macro 13399 @cindex @samp{title}, macro 13400 @cindex @samp{author}, macro 13401 @cindex @samp{email}, macro 13402 The @samp{keyword} macro collects all values from @var{NAME} 13403 keywords throughout the buffer, separated with white space. 13404 @samp{title}, @samp{author} and @samp{email} macros are shortcuts for, 13405 respectively, @samp{@{@{@{keyword(TITLE)@}@}@}}, @samp{@{@{@{keyword(AUTHOR)@}@}@}} and 13406 @samp{@{@{@{keyword(EMAIL)@}@}@}}. 13407 13408 @item @samp{@{@{@{date@}@}@}} 13409 @itemx @samp{@{@{@{date(FORMAT)@}@}@}} 13410 @cindex @samp{date}, macro 13411 This macro refers to the @samp{DATE} keyword. @var{FORMAT} is an 13412 optional argument to the @samp{date} macro that is used only if @samp{DATE} is 13413 a single timestamp. @var{FORMAT} should be a format string 13414 understood by @code{format-time-string}. 13415 13416 @item @samp{@{@{@{time(FORMAT)@}@}@}} 13417 @itemx @samp{@{@{@{modification-time(FORMAT, VC)@}@}@}} 13418 @cindex @samp{time}, macro 13419 @cindex @samp{modification-time}, macro 13420 These macros refer to the document's date and time of export and 13421 date and time of modification. @var{FORMAT} is a string 13422 understood by @code{format-time-string}. If the second argument to the 13423 @code{modification-time} macro is non-@code{nil}, Org uses @samp{vc.el} to retrieve 13424 the document's modification time from the version control system. 13425 Otherwise Org reads the file attributes. 13426 13427 @item @samp{@{@{@{input-file@}@}@}} 13428 @cindex @samp{input-file}, macro 13429 This macro refers to the filename of the exported file. 13430 13431 @item @samp{@{@{@{property(PROPERTY-NAME)@}@}@}} 13432 @itemx @samp{@{@{@{property(PROPERTY-NAME, SEARCH OPTION)@}@}@}} 13433 @cindex @samp{property}, macro 13434 This macro returns the value of property @var{PROPERTY-NAME} in 13435 the current entry. If @var{SEARCH-OPTION} (see @ref{Search Options}) refers to a remote entry, use it instead. 13436 13437 @item @samp{@{@{@{n@}@}@}} 13438 @itemx @samp{@{@{@{n(NAME)@}@}@}} 13439 @itemx @samp{@{@{@{n(NAME, ACTION)@}@}@}} 13440 @cindex @samp{n}, macro 13441 @cindex counter, macro 13442 This macro implements custom counters by returning the number of 13443 times the macro has been expanded so far while exporting the buffer. 13444 You can create more than one counter using different @var{NAME} 13445 values. If @var{ACTION} is @samp{-}, previous value of the counter 13446 is held, i.e., the specified counter is not incremented. If the 13447 value is a number, the specified counter is set to that value. If 13448 it is any other non-empty string, the specified counter is reset 13449 to 1. You may leave @var{NAME} empty to reset the default 13450 counter. 13451 @end table 13452 13453 @cindex @samp{results}, macro 13454 Moreover, inline source blocks (see @ref{Structure of Code Blocks}) use the 13455 special @samp{results} macro to mark their output. As such, you are 13456 advised against re-defining it, unless you know what you are doing. 13457 13458 @vindex org-hide-macro-markers 13459 The surrounding brackets can be made invisible by setting 13460 @code{org-hide-macro-markers} to a non-@code{nil} value. 13461 13462 Org expands macros at the very beginning of the export process. 13463 13464 @node Comment Lines 13465 @section Comment Lines 13466 13467 @cindex exporting, not 13468 13469 @cindex comment lines 13470 Lines starting with zero or more whitespace characters followed by one 13471 @samp{#} and a whitespace are treated as comments and, as such, are not 13472 exported. 13473 13474 @cindex @samp{BEGIN_COMMENT} 13475 @cindex comment block 13476 Likewise, regions surrounded by @samp{#+BEGIN_COMMENT} @dots{} @samp{#+END_COMMENT} 13477 are not exported. 13478 13479 @cindex comment trees 13480 Finally, a @samp{COMMENT} keyword at the beginning of an entry, but after 13481 any other keyword or priority cookie, comments out the entire subtree. 13482 In this case, the subtree is not exported and no code block within it 13483 is executed either@footnote{ For a less drastic behavior, consider using a 13484 select tag (see @ref{Export Settings}) instead.}. The command below 13485 helps changing the comment status of a headline. 13486 13487 @table @asis 13488 @item @kbd{C-c ;} (@code{org-toggle-comment}) 13489 @kindex C-c ; 13490 @findex org-toggle-comment 13491 13492 Toggle the @samp{COMMENT} keyword at the beginning of an entry. 13493 @end table 13494 13495 @node ASCII/Latin-1/UTF-8 export 13496 @section ASCII/Latin-1/UTF-8 export 13497 13498 @cindex ASCII export 13499 @cindex Latin-1 export 13500 @cindex UTF-8 export 13501 13502 ASCII export produces an output file containing only plain ASCII 13503 characters. This is the simplest and most direct text output. It 13504 does not contain any Org markup. Latin-1 and UTF-8 export use 13505 additional characters and symbols available in these encoding 13506 standards. All three of these export formats offer the most basic of 13507 text output for maximum portability. 13508 13509 @vindex org-ascii-text-width 13510 On export, Org fills and justifies text according to the text width 13511 set in @code{org-ascii-text-width}. 13512 13513 @vindex org-ascii-links-to-notes 13514 Org exports links using a footnote-like style where the descriptive 13515 part is in the text and the link is in a note before the next heading. 13516 See the variable @code{org-ascii-links-to-notes} for details. 13517 13518 @anchor{ASCII export commands} 13519 @subheading ASCII export commands 13520 13521 @table @asis 13522 @item @kbd{C-c C-e t a} (@code{org-ascii-export-to-ascii}) 13523 @itemx @kbd{C-c C-e t l} 13524 @itemx @kbd{C-c C-e t u} 13525 @kindex C-c C-e t a 13526 @kindex C-c C-e t l 13527 @kindex C-c C-e t u 13528 @findex org-ascii-export-to-ascii 13529 13530 Export as an ASCII file with a @samp{.txt} extension. For @samp{myfile.org}, 13531 Org exports to @samp{myfile.txt}, overwriting without warning. For 13532 @samp{myfile.txt}, Org exports to @samp{myfile.txt.txt} in order to prevent 13533 data loss. 13534 13535 @item @kbd{C-c C-e t A} (@code{org-ascii-export-to-ascii}) 13536 @itemx @kbd{C-c C-e t L} 13537 @itemx @kbd{C-c C-e t U} 13538 @kindex C-c C-e t A 13539 @kindex C-c C-e t L 13540 @kindex C-c C-e t U 13541 @findex org-ascii-export-as-ascii 13542 13543 Export to a temporary buffer. Does not create a file. 13544 @end table 13545 13546 @anchor{ASCII specific export settings} 13547 @subheading ASCII specific export settings 13548 13549 The ASCII export backend has one extra keyword for customizing ASCII 13550 output. Setting this keyword works similar to the general options 13551 (see @ref{Export Settings}). 13552 13553 @table @asis 13554 @item @samp{SUBTITLE} 13555 @cindex @samp{SUBTITLE}, keyword 13556 The document subtitle. For long subtitles, use multiple 13557 @samp{#+SUBTITLE} lines in the Org file. Org prints them on one 13558 continuous line, wrapping into multiple lines if necessary. 13559 @end table 13560 13561 @anchor{Header and sectioning structure} 13562 @subheading Header and sectioning structure 13563 13564 Org converts the first three outline levels into headlines for ASCII 13565 export. The remaining levels are turned into lists. To change this 13566 cut-off point where levels become lists, see @ref{Export Settings}. 13567 13568 @anchor{Quoting ASCII text} 13569 @subheading Quoting ASCII text 13570 13571 To insert text within the Org file by the ASCII backend, use one the 13572 following constructs, inline, keyword, or export block: 13573 13574 @cindex @samp{ASCII}, keyword 13575 @cindex @samp{BEGIN_EXPORT ascii} 13576 @example 13577 Inline text @@@@ascii:and additional text@@@@ within a paragraph. 13578 13579 #+ASCII: Some text 13580 13581 #+BEGIN_EXPORT ascii 13582 Org exports text in this block only when using ASCII backend. 13583 #+END_EXPORT 13584 @end example 13585 13586 @anchor{ASCII specific attributes} 13587 @subheading ASCII specific attributes 13588 13589 @cindex @samp{ATTR_ASCII}, keyword 13590 @cindex horizontal rules, in ASCII export 13591 13592 ASCII backend recognizes only one attribute, @samp{:width}, which 13593 specifies the width of a horizontal rule in number of characters. The 13594 keyword and syntax for specifying widths is: 13595 13596 @example 13597 #+ATTR_ASCII: :width 10 13598 ----- 13599 @end example 13600 13601 @anchor{ASCII special blocks} 13602 @subheading ASCII special blocks 13603 13604 @cindex special blocks, in ASCII export 13605 @cindex @samp{BEGIN_JUSTIFYLEFT} 13606 @cindex @samp{BEGIN_JUSTIFYRIGHT} 13607 13608 Besides @samp{#+BEGIN_CENTER} blocks (see @ref{Paragraphs}), ASCII backend has 13609 these two left and right justification blocks: 13610 13611 @example 13612 #+BEGIN_JUSTIFYLEFT 13613 It's just a jump to the left... 13614 #+END_JUSTIFYLEFT 13615 13616 #+BEGIN_JUSTIFYRIGHT 13617 ...and then a step to the right. 13618 #+END_JUSTIFYRIGHT 13619 @end example 13620 13621 @node Beamer Export 13622 @section Beamer Export 13623 13624 @cindex Beamer export 13625 13626 Org uses Beamer export to convert an Org file tree structure into 13627 high-quality interactive slides for presentations. Beamer is a @LaTeX{} 13628 document class for creating presentations in PDF, HTML, and other 13629 popular display formats. 13630 13631 @menu 13632 * Beamer export commands:: For creating Beamer documents. 13633 * Beamer specific export settings:: For customizing Beamer export. 13634 * Frames and Blocks in Beamer:: For composing Beamer slides. 13635 * Beamer specific syntax:: For using in Org documents. 13636 * Editing support:: Editing support. 13637 * A Beamer example:: A complete presentation. 13638 @end menu 13639 13640 @node Beamer export commands 13641 @subsection Beamer export commands 13642 13643 @table @asis 13644 @item @kbd{C-c C-e l b} (@code{org-beamer-export-to-latex}) 13645 @kindex C-c C-e l b 13646 @findex org-beamer-export-to-latex 13647 13648 Export as @LaTeX{} file with a @samp{.tex} extension. For @samp{myfile.org}, Org 13649 exports to @samp{myfile.tex}, overwriting without warning. 13650 13651 @item @kbd{C-c C-e l B} (@code{org-beamer-export-as-latex}) 13652 @kindex C-c C-e l B 13653 @findex org-beamer-export-as-latex 13654 13655 Export to a temporary buffer. Does not create a file. 13656 13657 @item @kbd{C-c C-e l P} (@code{org-beamer-export-to-pdf}) 13658 @kindex C-c C-e l P 13659 @findex org-beamer-export-to-pdf 13660 13661 Export as @LaTeX{} file and then convert it to PDF format. 13662 13663 @item @kbd{C-c C-e l O} 13664 @kindex C-c C-e l O 13665 13666 Export as @LaTeX{} file, convert it to PDF format, and then open the 13667 PDF file. 13668 @end table 13669 13670 @node Beamer specific export settings 13671 @subsection Beamer specific export settings 13672 13673 Beamer export backend has several additional keywords for customizing 13674 Beamer output. These keywords work similar to the general options 13675 settings (see @ref{Export Settings}). 13676 13677 @table @asis 13678 @item @samp{BEAMER_THEME} 13679 @cindex @samp{BEAMER_THEME}, keyword 13680 @vindex org-beamer-theme 13681 The Beamer layout theme (@code{org-beamer-theme}). Use square brackets 13682 for options. For example: 13683 13684 @example 13685 #+BEAMER_THEME: Rochester [height=20pt] 13686 @end example 13687 13688 @item @samp{BEAMER_FONT_THEME} 13689 @cindex @samp{BEAMER_FONT_THEME}, keyword 13690 The Beamer font theme. 13691 13692 @item @samp{BEAMER_INNER_THEME} 13693 @cindex @samp{BEAMER_INNER_THEME}, keyword 13694 The Beamer inner theme. 13695 13696 @item @samp{BEAMER_OUTER_THEME} 13697 @cindex @samp{BEAMER_OUTER_THEME}, keyword 13698 The Beamer outer theme. 13699 13700 @item @samp{BEAMER_HEADER} 13701 @cindex @samp{BEAMER_HEADER}, keyword 13702 Arbitrary lines inserted in the preamble, just before the @samp{hyperref} 13703 settings. 13704 13705 @item @samp{DESCRIPTION} 13706 @cindex @samp{DESCRIPTION}, keyword 13707 The document description. For long descriptions, use multiple 13708 @samp{DESCRIPTION} keywords. By default, @samp{hyperref} inserts 13709 @samp{DESCRIPTION} as metadata. Use @code{org-latex-hyperref-template} to 13710 configure document metadata. Use @code{org-latex-title-command} to 13711 configure typesetting of description as part of front matter. 13712 13713 @item @samp{KEYWORDS} 13714 @cindex @samp{KEYWORDS}, keyword 13715 The keywords for defining the contents of the document. Use 13716 multiple @samp{KEYWORDS} lines if necessary. By default, @samp{hyperref} 13717 inserts @samp{KEYWORDS} as metadata. Use @code{org-latex-hyperref-template} 13718 to configure document metadata. Use @code{org-latex-title-command} to 13719 configure typesetting of keywords as part of front matter. 13720 13721 @item @samp{SUBTITLE} 13722 @cindex @samp{SUBTITLE}, keyword 13723 Document's subtitle. For typesetting, use 13724 @code{org-beamer-subtitle-format} string. Use 13725 @code{org-latex-hyperref-template} to configure document metadata. Use 13726 @code{org-latex-title-command} to configure typesetting of subtitle as 13727 part of front matter. 13728 @end table 13729 13730 @node Frames and Blocks in Beamer 13731 @subsection Frames and Blocks in Beamer 13732 13733 Org transforms heading levels into Beamer's sectioning elements, 13734 frames and blocks. Any Org tree with a not-too-deep-level nesting 13735 should in principle be exportable as a Beamer presentation. 13736 13737 @itemize 13738 @item 13739 @vindex org-beamer-frame-level 13740 Org headlines become Beamer frames when the heading level in Org is 13741 equal to @code{org-beamer-frame-level} or @samp{H} value in a @samp{OPTIONS} line 13742 (see @ref{Export Settings}). 13743 13744 @cindex @samp{BEAMER_ENV}, property 13745 Org overrides headlines to frames conversion for the current tree of 13746 an Org file if it encounters the @samp{BEAMER_ENV} property set to 13747 @samp{frame} or @samp{fullframe}. Org ignores whatever 13748 @code{org-beamer-frame-level} happens to be for that headline level in 13749 the Org tree. In Beamer terminology, a full frame is a frame 13750 without its title. 13751 13752 @item 13753 Org exports a Beamer frame's objects as block environments. Org can 13754 enforce wrapping in special block types when @samp{BEAMER_ENV} property 13755 is set@footnote{If @samp{BEAMER_ENV} is set, Org export adds @samp{B_environment} tag 13756 to make it visible. The tag serves as a visual aid and has no 13757 semantic relevance.}. For valid values see 13758 @code{org-beamer-environments-default}. To add more values, see 13759 @code{org-beamer-environments-extra}. 13760 @vindex org-beamer-environments-default 13761 @vindex org-beamer-environments-extra 13762 13763 @item 13764 @cindex @samp{BEAMER_REF}, property 13765 If @samp{BEAMER_ENV} is set to @samp{appendix}, Org exports the entry as an 13766 appendix. When set to @samp{note}, Org exports the entry as a note 13767 within the frame or between frames, depending on the entry's heading 13768 level. When set to @samp{noteNH}, Org exports the entry as a note 13769 without its title. When set to @samp{againframe}, Org exports the entry 13770 with @samp{\againframe} command, which makes setting the @samp{BEAMER_REF} 13771 property mandatory because @samp{\againframe} needs frame to resume. 13772 13773 When @samp{ignoreheading} is set, Org export ignores the entry's headline 13774 but not its content. This is useful for inserting content between 13775 frames. It is also useful for properly closing a @samp{column} 13776 environment. 13777 13778 @cindex @samp{BEAMER_ACT}, property 13779 @cindex @samp{BEAMER_OPT}, property 13780 When @samp{BEAMER_ACT} is set for a headline, Org export translates that 13781 headline as an overlay or action specification. When enclosed in 13782 square brackets, Org export makes the overlay specification 13783 a default. Use @samp{BEAMER_OPT} to set any options applicable to the 13784 current Beamer frame or block. The Beamer export backend wraps 13785 with appropriate angular or square brackets. It also adds the 13786 @samp{fragile} option for any code that may require a verbatim block. 13787 13788 @cindex @samp{BEAMER_COL}, property 13789 To create a column on the Beamer slide, use the @samp{BEAMER_COL} 13790 property for its headline in the Org file. Set the value of 13791 @samp{BEAMER_COL} to a decimal number representing the fraction of the 13792 total text width. Beamer export uses this value to set the column's 13793 width and fills the column with the contents of the Org entry. If 13794 the Org entry has no specific environment defined, Beamer export 13795 ignores the heading. If the Org entry has a defined environment, 13796 Beamer export uses the heading as title. Behind the scenes, Beamer 13797 export automatically handles @LaTeX{} column separations for contiguous 13798 headlines. To manually adjust them for any unique configurations 13799 needs, use the @samp{BEAMER_ENV} property. 13800 @end itemize 13801 13802 @node Beamer specific syntax 13803 @subsection Beamer specific syntax 13804 13805 Since Org's Beamer export backend is an extension of the @LaTeX{} 13806 backend, it recognizes other @LaTeX{} specific syntax---for example, 13807 @samp{#+LATEX:} or @samp{#+ATTR_LATEX:}. See @ref{@LaTeX{} Export}, for details. 13808 13809 Beamer export wraps the table of contents generated with @samp{toc:t} 13810 @samp{OPTION} keyword in a @samp{frame} environment. Beamer export does not 13811 wrap the table of contents generated with @samp{TOC} keyword (see @ref{Table of Contents}). Use square brackets for specifying options. 13812 13813 @example 13814 #+TOC: headlines [currentsection] 13815 @end example 13816 13817 13818 Insert Beamer-specific code using the following constructs: 13819 13820 @cindex @samp{BEAMER}, keyword 13821 @cindex @samp{BEGIN_EXPORT beamer} 13822 @example 13823 #+BEAMER: \pause 13824 13825 #+BEGIN_EXPORT beamer 13826 Only Beamer export backend exports this. 13827 #+END_EXPORT 13828 13829 Text @@@@beamer:some code@@@@ within a paragraph. 13830 @end example 13831 13832 Inline constructs, such as the last one above, are useful for adding 13833 overlay specifications to objects with @code{bold}, @code{item}, @code{link}, 13834 @code{radio-target} and @code{target} types. Enclose the value in angular 13835 brackets and place the specification at the beginning of the object as 13836 shown in this example: 13837 13838 @example 13839 A *@@@@beamer:<2->@@@@useful* feature 13840 @end example 13841 13842 13843 @cindex @samp{ATTR_BEAMER}, keyword 13844 Beamer export recognizes the @samp{ATTR_BEAMER} keyword with the following 13845 attributes from Beamer configurations: @samp{:environment} for changing 13846 local Beamer environment, @samp{:overlay} for specifying Beamer overlays in 13847 angular or square brackets, and @samp{:options} for inserting optional 13848 arguments. 13849 13850 @example 13851 #+ATTR_BEAMER: :environment nonindentlist 13852 - item 1, not indented 13853 - item 2, not indented 13854 - item 3, not indented 13855 @end example 13856 13857 @example 13858 #+ATTR_BEAMER: :overlay <+-> 13859 - item 1 13860 - item 2 13861 @end example 13862 13863 @example 13864 #+ATTR_BEAMER: :options [Lagrange] 13865 Let $G$ be a finite group, and let $H$ be 13866 a subgroup of $G$. Then the order of $H$ divides the order of $G$. 13867 @end example 13868 13869 @node Editing support 13870 @subsection Editing support 13871 13872 Org Beamer mode is a special minor mode for faster editing of Beamer 13873 documents. 13874 13875 @example 13876 #+STARTUP: beamer 13877 @end example 13878 13879 13880 @table @asis 13881 @item @kbd{C-c C-b} (@code{org-beamer-select-environment}) 13882 @kindex C-c C-b 13883 @findex org-beamer-select-environment 13884 13885 Org Beamer mode provides this key for quicker selections in Beamer 13886 normal environments, and for selecting the @samp{BEAMER_COL} property. 13887 @end table 13888 13889 @node A Beamer example 13890 @subsection A Beamer example 13891 13892 Here is an example of an Org document ready for Beamer export. 13893 13894 @example 13895 #+TITLE: Example Presentation 13896 #+AUTHOR: Carsten Dominik 13897 #+OPTIONS: H:2 toc:t num:t 13898 #+LATEX_CLASS: beamer 13899 #+LATEX_CLASS_OPTIONS: [presentation] 13900 #+BEAMER_THEME: Madrid 13901 #+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) 13902 13903 * This is the first structural section 13904 13905 ** Frame 1 13906 *** Thanks to Eric Fraga :B_block: 13907 :PROPERTIES: 13908 :BEAMER_COL: 0.48 13909 :BEAMER_ENV: block 13910 :END: 13911 for the first viable Beamer setup in Org 13912 *** Thanks to everyone else :B_block: 13913 :PROPERTIES: 13914 :BEAMER_COL: 0.48 13915 :BEAMER_ACT: <2-> 13916 :BEAMER_ENV: block 13917 :END: 13918 for contributing to the discussion 13919 **** This will be formatted as a beamer note :B_note: 13920 :PROPERTIES: 13921 :BEAMER_env: note 13922 :END: 13923 ** Frame 2 (where we will not use columns) 13924 *** Request 13925 Please test this stuff! 13926 @end example 13927 13928 @node HTML Export 13929 @section HTML Export 13930 13931 @cindex HTML export 13932 13933 Org mode contains an HTML exporter with extensive HTML formatting 13934 compatible with XHTML 1.0 strict standard. 13935 13936 @menu 13937 * HTML export commands:: Invoking HTML export. 13938 * HTML specific export settings:: Settings for HTML export. 13939 * HTML doctypes:: Exporting various (X)HTML flavors. 13940 * HTML preamble and postamble:: Inserting preamble and postamble. 13941 * Bare HTML:: Exporting HTML without CSS, Javascript, etc. 13942 * Quoting HTML tags:: Using direct HTML in Org files. 13943 * Headlines in HTML export:: Formatting headlines. 13944 * Links in HTML export:: Inserting and formatting links. 13945 * Tables in HTML export:: How to modify the formatting of tables. 13946 * Images in HTML export:: How to insert figures into HTML output. 13947 * Math formatting in HTML export:: Beautiful math also on the web. 13948 * Text areas in HTML export:: An alternate way to show an example. 13949 * CSS support:: Changing the appearance of the output. 13950 * JavaScript support:: Info and folding in a web browser. 13951 @end menu 13952 13953 @node HTML export commands 13954 @subsection HTML export commands 13955 13956 @table @asis 13957 @item @kbd{C-c C-e h h} (@code{org-html-export-to-html}) 13958 @kindex C-c C-e h h 13959 @kindex C-c C-e h o 13960 @findex org-html-export-to-html 13961 13962 Export as HTML file with a @samp{.html} extension. For @samp{myfile.org}, Org 13963 exports to @samp{myfile.html}, overwriting without warning. @kbd{C-c C-e h o} exports to HTML and opens it in a web browser. 13964 13965 @item @kbd{C-c C-e h H} (@code{org-html-export-as-html}) 13966 @kindex C-c C-e h H 13967 @findex org-html-export-as-html 13968 13969 Exports to a temporary buffer. Does not create a file. 13970 @end table 13971 13972 @node HTML specific export settings 13973 @subsection HTML specific export settings 13974 13975 HTML export has a number of keywords, similar to the general options 13976 settings described in @ref{Export Settings}. 13977 13978 @table @asis 13979 @item @samp{DESCRIPTION} 13980 @cindex @samp{DESCRIPTION}, keyword 13981 This is the document's description, which the HTML exporter inserts 13982 it as a HTML meta tag in the HTML file. For long descriptions, use 13983 multiple @samp{DESCRIPTION} lines. The exporter takes care of wrapping 13984 the lines properly. 13985 13986 The exporter includes a number of other meta tags, which can be customized 13987 by modifying @code{org-html-meta-tags}. 13988 13989 @item @samp{HTML_DOCTYPE} 13990 @cindex @samp{HTML_DOCTYPE}, keyword 13991 @vindex org-html-doctype 13992 Specify the document type, for example: HTML5 (@code{org-html-doctype}). 13993 13994 @item @samp{HTML_CONTAINER} 13995 @cindex @samp{HTML_CONTAINER}, keyword 13996 @vindex org-html-container-element 13997 Specify the HTML container, such as @samp{div}, for wrapping sections and 13998 elements (@code{org-html-container-element}). 13999 14000 @item @samp{HTML_LINK_HOME} 14001 @cindex @samp{HTML_LINK_HOME}, keyword 14002 @vindex org-html-link-home 14003 The URL for home link (@code{org-html-link-home}). 14004 14005 @item @samp{HTML_LINK_UP} 14006 @cindex @samp{HTML_LINK_UP}, keyword 14007 @vindex org-html-link-up 14008 The URL for the up link of exported HTML pages (@code{org-html-link-up}). 14009 14010 @item @samp{HTML_MATHJAX} 14011 @cindex @samp{HTML_MATHJAX}, keyword 14012 @vindex org-html-mathjax-options 14013 Options for MathJax (@code{org-html-mathjax-options}). MathJax is used 14014 to typeset @LaTeX{} math in HTML documents. See @ref{Math formatting in HTML export}, for an example. 14015 14016 @item @samp{HTML_HEAD} 14017 @cindex @samp{HTML_HEAD}, keyword 14018 @vindex org-html-head 14019 Arbitrary lines for appending to the HTML document's head 14020 (@code{org-html-head}). 14021 14022 @item @samp{HTML_HEAD_EXTRA} 14023 @cindex @samp{HTML_HEAD_EXTRA}, keyword 14024 @vindex org-html-head-extra 14025 More arbitrary lines for appending to the HTML document's head 14026 (@code{org-html-head-extra}). 14027 14028 @item @samp{KEYWORDS} 14029 @cindex @samp{KEYWORDS}, keyword 14030 Keywords to describe the document's content. HTML exporter inserts 14031 these keywords as HTML meta tags. For long keywords, use multiple 14032 @samp{KEYWORDS} lines. 14033 14034 @item @samp{LATEX_HEADER} 14035 @cindex @samp{LATEX_HEADER}, keyword 14036 Arbitrary lines for appending to the preamble; HTML exporter appends 14037 when transcoding @LaTeX{} fragments to images (see @ref{Math formatting in HTML export}). 14038 14039 @item @samp{SUBTITLE} 14040 @cindex @samp{SUBTITLE}, keyword 14041 The document's subtitle. HTML exporter formats subtitle if document 14042 type is @samp{HTML5} and the CSS has a @samp{subtitle} class. 14043 @end table 14044 14045 Some of these keywords are explained in more detail in the following 14046 sections of the manual. 14047 14048 @node HTML doctypes 14049 @subsection HTML doctypes 14050 14051 Org can export to various (X)HTML flavors. 14052 14053 @vindex org-html-doctype 14054 @vindex org-html-doctype-alist 14055 Set the @code{org-html-doctype} variable for different (X)HTML variants. 14056 Depending on the variant, the HTML exporter adjusts the syntax of HTML 14057 conversion accordingly. Org includes the following ready-made 14058 variants: 14059 14060 @itemize 14061 @item 14062 @code{"html4-strict"} 14063 @item 14064 @code{"html4-transitional"} 14065 @item 14066 @code{"html4-frameset"} 14067 @item 14068 @code{"xhtml-strict"} 14069 @item 14070 @code{"xhtml-transitional"} 14071 @item 14072 @code{"xhtml-frameset"} 14073 @item 14074 @code{"xhtml-11"} 14075 @item 14076 @code{"html5"} 14077 @item 14078 @code{"xhtml5"} 14079 @end itemize 14080 14081 @noindent 14082 See the variable @code{org-html-doctype-alist} for details. The default is 14083 @code{"xhtml-strict"}. 14084 14085 @vindex org-html-html5-fancy 14086 @cindex @samp{HTML5}, export new elements 14087 Org's HTML exporter does not by default enable new block elements 14088 introduced with the HTML5 standard. To enable them, set 14089 @code{org-html-html5-fancy} to non-@code{nil}. Or use an @samp{OPTIONS} line in the 14090 file to set @samp{html5-fancy}. 14091 14092 HTML5 documents can have arbitrary @samp{#+BEGIN} @dots{} @samp{#+END} blocks. 14093 For example: 14094 14095 @example 14096 #+BEGIN_aside 14097 Lorem ipsum 14098 #+END_aside 14099 @end example 14100 14101 @noindent 14102 exports to: 14103 14104 @example 14105 <aside> 14106 <p>Lorem ipsum</p> 14107 </aside> 14108 @end example 14109 14110 @noindent 14111 while this: 14112 14113 @example 14114 #+ATTR_HTML: :controls controls :width 350 14115 #+BEGIN_video 14116 #+HTML: <source src="movie.mp4" type="video/mp4"> 14117 #+HTML: <source src="movie.ogg" type="video/ogg"> 14118 Your browser does not support the video tag. 14119 #+END_video 14120 @end example 14121 14122 @noindent 14123 exports to: 14124 14125 @example 14126 <video controls="controls" width="350"> 14127 <source src="movie.mp4" type="video/mp4"> 14128 <source src="movie.ogg" type="video/ogg"> 14129 <p>Your browser does not support the video tag.</p> 14130 </video> 14131 @end example 14132 14133 @vindex org-html-html5-elements 14134 When special blocks do not have a corresponding HTML5 element, the 14135 HTML exporter reverts to standard translation (see 14136 @code{org-html-html5-elements}). For example, @samp{#+BEGIN_lederhosen} exports 14137 to @code{<div class="lederhosen">}. 14138 14139 Special blocks cannot have headlines. For the HTML exporter to wrap 14140 the headline and its contents in @code{<section>} or @code{<article>} tags, set 14141 the @samp{HTML_CONTAINER} property for the headline. 14142 14143 @node HTML preamble and postamble 14144 @subsection HTML preamble and postamble 14145 14146 @vindex org-html-preamble 14147 @vindex org-html-postamble 14148 @vindex org-html-preamble-format 14149 @vindex org-html-postamble-format 14150 @vindex org-html-validation-link 14151 @vindex org-export-creator-string 14152 @vindex org-export-time-stamp-file 14153 14154 The HTML exporter has delineations for preamble and postamble. The 14155 default value for @code{org-html-preamble} is @code{t}, which makes the HTML 14156 exporter insert the preamble. See the variable 14157 @code{org-html-preamble-format} for the format string. 14158 14159 Set @code{org-html-preamble} to a string to override the default format 14160 string. If set to a function, the HTML exporter expects the function 14161 to return a string upon execution. The HTML exporter inserts this 14162 string in the preamble. The HTML exporter does not insert a preamble 14163 if @code{org-html-preamble} is set @code{nil}. 14164 14165 The above also applies to @code{org-html-postamble} and 14166 @code{org-html-postamble-format}. In addition, @code{org-html-postamble} can be 14167 set to @code{auto} (its default value), which makes the HTML exporter build 14168 a postamble from looking up author's name, email address, creator's 14169 name, and date. 14170 14171 @node Bare HTML 14172 @subsection Exporting to minimal HTML 14173 14174 If you want to output a minimal HTML file, with no CSS, no Javascript, 14175 no preamble or postamble, here are the variable you would need to set: 14176 14177 @vindex org-html-head 14178 @vindex org-html-head-extra 14179 @vindex org-html-head-include-default-style 14180 @vindex org-html-head-include-scripts 14181 @vindex org-html-preamble 14182 @vindex org-html-postamble 14183 @vindex org-html-use-infojs 14184 @lisp 14185 (setq org-html-head "" 14186 org-html-head-extra "" 14187 org-html-head-include-default-style nil 14188 org-html-head-include-scripts nil 14189 org-html-preamble nil 14190 org-html-postamble nil 14191 org-html-use-infojs nil) 14192 @end lisp 14193 14194 @node Quoting HTML tags 14195 @subsection Quoting HTML tags 14196 14197 The HTML export backend transforms @samp{<} and @samp{>} to @samp{<} and @samp{>}. 14198 To include raw HTML code in the Org file so the HTML export backend 14199 can insert that HTML code in the output, use this inline syntax: 14200 @samp{@@@@html:...@@@@}. For example: 14201 14202 @example 14203 @@@@html:<b>@@@@bold text@@@@html:</b>@@@@ 14204 @end example 14205 14206 14207 @cindex @samp{HTML}, keyword 14208 @cindex @samp{BEGIN_EXPORT html} 14209 For larger raw HTML code blocks, use these HTML export code blocks: 14210 14211 @example 14212 #+HTML: Literal HTML code for export 14213 14214 #+BEGIN_EXPORT html 14215 All lines between these markers are exported literally 14216 #+END_EXPORT 14217 @end example 14218 14219 @node Headlines in HTML export 14220 @subsection Headlines in HTML export 14221 14222 @cindex headlines, in HTML export 14223 14224 Headlines are exported to @samp{<h1>}, @samp{<h2>}, etc. Each headline gets the 14225 @samp{id} attribute from @samp{CUSTOM_ID} property, or a unique generated value, 14226 see @ref{Internal Links}. 14227 14228 @vindex org-html-self-link-headlines 14229 When @code{org-html-self-link-headlines} is set to a non-@code{nil} value, the 14230 text of the headlines is also wrapped in @samp{<a>} tags. These tags have 14231 a @samp{href} attribute making the headlines link to themselves. 14232 14233 @node Links in HTML export 14234 @subsection Links in HTML export 14235 14236 @cindex links, in HTML export 14237 @cindex internal links, in HTML export 14238 @cindex external links, in HTML export 14239 14240 The HTML export backend transforms Org's internal links (see 14241 @ref{Internal Links}) to equivalent HTML links in the output. The backend 14242 similarly handles Org's automatic links created by radio targets (see 14243 @ref{Radio Targets}) similarly. For Org links to external files, the 14244 backend transforms the links to @emph{relative} paths. 14245 14246 @vindex org-html-link-org-files-as-html 14247 For Org links to other @samp{.org} files, the backend automatically 14248 changes the file extension to @samp{.html} and makes file paths relative. 14249 If the @samp{.org} files have an equivalent @samp{.html} version at the same 14250 location, then the converted links should work without any further 14251 manual intervention. However, to disable this automatic path 14252 translation, set @code{org-html-link-org-files-as-html} to @code{nil}. When 14253 disabled, the HTML export backend substitutes the ID-based links in 14254 the HTML output. For more about linking files when publishing to 14255 a directory, see @ref{Publishing links}. 14256 14257 Org files can also have special directives to the HTML export 14258 backend. For example, by using @samp{#+ATTR_HTML} lines to specify new 14259 format attributes to @code{<a>} or @code{<img>} tags. This example shows 14260 changing the link's title and style: 14261 14262 @cindex @samp{ATTR_HTML}, keyword 14263 @example 14264 #+ATTR_HTML: :title The Org mode website :style color:red; 14265 [[https://orgmode.org]] 14266 @end example 14267 14268 @node Tables in HTML export 14269 @subsection Tables in HTML export 14270 14271 @cindex tables, in HTML 14272 @vindex org-export-html-table-tag 14273 14274 The HTML export backend uses @code{org-html-table-default-attributes} when 14275 exporting Org tables to HTML@. By default, the exporter does not draw 14276 frames and cell borders. To change for this for a table, use the 14277 following lines before the table in the Org file: 14278 14279 @cindex @samp{CAPTION}, keyword 14280 @cindex @samp{ATTR_HTML}, keyword 14281 @example 14282 #+CAPTION: This is a table with lines around and between cells 14283 #+ATTR_HTML: :border 2 :rules all :frame border 14284 @end example 14285 14286 The HTML export backend preserves column groupings in Org tables (see 14287 @ref{Column Groups}) when exporting to HTML@. 14288 14289 Additional options for customizing tables for HTML export. 14290 14291 @table @asis 14292 @item @code{org-html-table-align-individual-fields} 14293 @vindex org-html-table-align-individual-fields 14294 Non-@code{nil} attaches style attributes for alignment to each table 14295 field. 14296 14297 @item @code{org-html-table-caption-above} 14298 @vindex org-html-table-caption-above 14299 Non-@code{nil} places caption string at the beginning of the table. 14300 14301 @item @code{org-html-table-data-tags} 14302 @vindex org-html-table-data-tags 14303 Opening and ending tags for table data fields. 14304 14305 @item @code{org-html-table-default-attributes} 14306 @vindex org-html-table-default-attributes 14307 Default attributes and values for table tags. 14308 14309 @item @code{org-html-table-header-tags} 14310 @vindex org-html-table-header-tags 14311 Opening and ending tags for table's header fields. 14312 14313 @item @code{org-html-table-row-tags} 14314 @vindex org-html-table-row-tags 14315 Opening and ending tags for table rows. 14316 14317 @item @code{org-html-table-use-header-tags-for-first-column} 14318 @vindex org-html-table-use-header-tags-for-first-column 14319 Non-@code{nil} formats column one in tables with header tags. 14320 @end table 14321 14322 @node Images in HTML export 14323 @subsection Images in HTML export 14324 14325 @cindex images, inline in HTML 14326 @cindex inlining images in HTML 14327 14328 The HTML export backend has features to convert Org image links to 14329 HTML inline images and HTML clickable image links. 14330 14331 @vindex org-html-inline-images 14332 When the link in the Org file has no description, the HTML export 14333 backend by default in-lines that image. For example: 14334 @samp{[[file:myimg.jpg]]} is in-lined, while @samp{[[file:myimg.jpg][the image]]} links to the text, 14335 @samp{the image}. For more details, see the variable 14336 @code{org-html-inline-images}. 14337 14338 On the other hand, if the description part of the Org link is itself 14339 another link, such as @samp{file:} or @samp{http:} URL pointing to an image, the 14340 HTML export backend in-lines this image and links to the main image. 14341 This Org syntax enables the backend to link low-resolution thumbnail 14342 to the high-resolution version of the image, as shown in this example: 14343 14344 @example 14345 [[file:highres.jpg][file:thumb.jpg]] 14346 @end example 14347 14348 14349 To change attributes of in-lined images, use @samp{#+ATTR_HTML} lines in 14350 the Org file. This example shows realignment to right, and adds @code{alt} 14351 and @code{title} attributes in support of text viewers and modern web 14352 accessibility standards. 14353 14354 @cindex @samp{CAPTION}, keyword 14355 @cindex @samp{ATTR_HTML}, keyword 14356 @example 14357 #+CAPTION: A black cat stalking a spider 14358 #+ATTR_HTML: :alt cat/spider image :title Action! :align right 14359 [[./img/a.jpg]] 14360 @end example 14361 14362 The HTML export backend copies the @samp{http} links from the Org file 14363 as-is. 14364 14365 @node Math formatting in HTML export 14366 @subsection Math formatting in HTML export 14367 14368 @cindex MathJax 14369 @cindex dvipng 14370 @cindex dvisvgm 14371 @cindex ImageMagick 14372 14373 @vindex org-html-mathjax-options~ 14374 @LaTeX{} math snippets (see @ref{@LaTeX{} fragments}) can be displayed in two 14375 different ways on HTML pages. The default is to use the 14376 @uref{https://www.mathjax.org, MathJax}, which should work out of the box 14377 with Org@footnote{ By default, Org loads MathJax from 14378 @uref{https://www.jsdelivr.com/, jsDelivr}, as recommended in 14379 @uref{https://docs.mathjax.org/en/latest/web/start.html, Getting Started 14380 with MathJax Components}.}@footnote{Please note that exported formulas are part of an HTML 14381 document, and that signs such as @samp{<}, @samp{>}, or @samp{&} have special 14382 meanings. See @uref{https://docs.mathjax.org/en/latest/input/tex/html.html#tex-and-latex-in-html-documents, MathJax @TeX{} and @LaTeX{} in HTML documents}.}. Some MathJax display options can 14383 be configured via @code{org-html-mathjax-options}, or in the buffer. For 14384 example, with the following settings, 14385 14386 @example 14387 #+HTML_MATHJAX: align: left indent: 5em tagside: left 14388 @end example 14389 14390 @noindent 14391 equation labels are displayed on the left margin and equations are 14392 five em from the left margin. 14393 14394 @vindex org-html-mathjax-template 14395 See the docstring of @code{org-html-mathjax-options} for all supported 14396 variables. The MathJax template can be configure via 14397 @code{org-html-mathjax-template}. 14398 14399 If you prefer, you can also request that @LaTeX{} fragments are processed 14400 into small images that will be inserted into the browser page. Before 14401 the availability of MathJax, this was the default method for Org 14402 files. This method requires that the dvipng program, dvisvgm or 14403 ImageMagick suite is available on your system. You can still get this 14404 processing with 14405 14406 @example 14407 #+OPTIONS: tex:dvipng 14408 @end example 14409 14410 14411 @example 14412 #+OPTIONS: tex:dvisvgm 14413 @end example 14414 14415 14416 @noindent 14417 or 14418 14419 @example 14420 #+OPTIONS: tex:imagemagick 14421 @end example 14422 14423 @node Text areas in HTML export 14424 @subsection Text areas in HTML export 14425 14426 @cindex text areas, in HTML 14427 Before Org mode's Babel, one popular approach to publishing code in 14428 HTML was by using @samp{:textarea}. The advantage of this approach was 14429 that copying and pasting was built into browsers with simple 14430 JavaScript commands. Even editing before pasting was made simple. 14431 14432 The HTML export backend can create such text areas. It requires an 14433 @samp{#+ATTR_HTML} line as shown in the example below with the @samp{:textarea} 14434 option. This must be followed by either an example or a source code 14435 block. Other Org block types do not honor the @samp{:textarea} option. 14436 14437 By default, the HTML export backend creates a text area 80 characters 14438 wide and height just enough to fit the content. Override these 14439 defaults with @samp{:width} and @samp{:height} options on the @samp{#+ATTR_HTML} 14440 line. 14441 14442 @example 14443 #+ATTR_HTML: :textarea t :width 40 14444 #+BEGIN_EXAMPLE 14445 (defun org-xor (a b) 14446 "Exclusive or." 14447 (if a (not b) b)) 14448 #+END_EXAMPLE 14449 @end example 14450 14451 @node CSS support 14452 @subsection CSS support 14453 14454 @cindex CSS, for HTML export 14455 @cindex HTML export, CSS 14456 14457 @vindex org-export-html-todo-kwd-class-prefix 14458 @vindex org-export-html-tag-class-prefix 14459 You can modify the CSS style definitions for the exported file. The 14460 HTML exporter assigns the following special CSS classes@footnote{ If the 14461 classes on TODO keywords and tags lead to conflicts, use the variables 14462 @code{org-html-todo-kwd-class-prefix} and @code{org-html-tag-class-prefix} to 14463 make them unique.} to appropriate parts of the document---your style 14464 specifications may change these, in addition to any of the standard 14465 classes like for headlines, tables, etc. 14466 14467 @multitable {aaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 14468 @item @code{p.author} 14469 @tab author information, including email 14470 @item @code{p.date} 14471 @tab publishing date 14472 @item @code{p.creator} 14473 @tab creator info, about org mode version 14474 @item @code{.title} 14475 @tab document title 14476 @item @code{.subtitle} 14477 @tab document subtitle 14478 @item @code{.todo} 14479 @tab TODO keywords, all not-done states 14480 @item @code{.done} 14481 @tab the DONE keywords, all states that count as done 14482 @item @code{.WAITING} 14483 @tab each TODO keyword also uses a class named after itself 14484 @item @code{.timestamp} 14485 @tab timestamp 14486 @item @code{.timestamp-kwd} 14487 @tab keyword associated with a timestamp, like @samp{SCHEDULED} 14488 @item @code{.timestamp-wrapper} 14489 @tab span around keyword plus timestamp 14490 @item @code{.tag} 14491 @tab tag in a headline 14492 @item @code{._HOME} 14493 @tab each tag uses itself as a class, ``@@'' replaced by ``_'' 14494 @item @code{.target} 14495 @tab target for links 14496 @item @code{.linenr} 14497 @tab the line number in a code example 14498 @item @code{.code-highlighted} 14499 @tab for highlighting referenced code lines 14500 @item @code{div.outline-N} 14501 @tab div for outline level N (headline plus text) 14502 @item @code{div.outline-text-N} 14503 @tab extra div for text at outline level N 14504 @item @code{.section-number-N} 14505 @tab section number in headlines, different for each level 14506 @item @code{.figure-number} 14507 @tab label like ``Figure 1:'' 14508 @item @code{.table-number} 14509 @tab label like ``Table 1:'' 14510 @item @code{.listing-number} 14511 @tab label like ``Listing 1:'' 14512 @item @code{div.figure} 14513 @tab how to format an in-lined image 14514 @item @code{pre.src} 14515 @tab formatted source code 14516 @item @code{pre.example} 14517 @tab normal example 14518 @item @code{p.verse} 14519 @tab verse paragraph 14520 @item @code{div.footnotes} 14521 @tab footnote section headline 14522 @item @code{p.footnote} 14523 @tab footnote definition paragraph, containing a footnote 14524 @item @code{.footref} 14525 @tab a footnote reference number (always a <sup>) 14526 @item @code{.footnum} 14527 @tab footnote number in footnote definition (always <sup>) 14528 @item @code{.org-svg} 14529 @tab default class for a linked @samp{.svg} image 14530 @end multitable 14531 14532 @vindex org-html-style-default 14533 @vindex org-html-head 14534 @vindex org-html-head-extra 14535 @cindex @samp{HTML_INCLUDE_STYLE}, keyword 14536 The HTML export backend includes a compact default style in each 14537 exported HTML file. To override the default style with another style, 14538 use these keywords in the Org file. They will replace the global 14539 defaults the HTML exporter uses. 14540 14541 @cindex @samp{HTML_HEAD}, keyword 14542 @cindex @samp{HTML_HEAD_EXTRA}, keyword 14543 @example 14544 #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style1.css" /> 14545 #+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" /> 14546 @end example 14547 14548 @vindex org-html-head-include-default-style 14549 To just turn off the default style, customize 14550 @code{org-html-head-include-default-style} variable, or use this option 14551 line in the Org file. 14552 14553 @cindex @samp{html-style}, @samp{OPTIONS} item 14554 @example 14555 #+OPTIONS: html-style:nil 14556 @end example 14557 14558 14559 For longer style definitions, either use several @samp{HTML_HEAD} and 14560 @samp{HTML_HEAD_EXTRA} keywords, or use @code{<style> ... </style>} blocks 14561 around them. Both of these approaches can avoid referring to an 14562 external file. 14563 14564 @cindex @samp{HTML_CONTAINER_CLASS}, property 14565 @cindex @samp{HTML_HEADLINE_CLASS}, property 14566 In order to add styles to a subtree, use the @samp{HTML_CONTAINER_CLASS} 14567 property to assign a class to the tree. In order to specify CSS 14568 styles for a particular headline, you can use the ID specified in 14569 a @samp{CUSTOM_ID} property. You can also assign a specific class to 14570 a headline with the @samp{HTML_HEADLINE_CLASS} property. 14571 14572 Never change the @code{org-html-style-default} constant. Instead use other 14573 simpler ways of customizing as described above. 14574 14575 @node JavaScript support 14576 @subsection JavaScript supported display of web pages 14577 14578 Sebastian Rose has written a JavaScript program especially designed to 14579 allow two different ways of viewing HTML files created with Org. One 14580 is an @emph{Info}-like mode where each section is displayed separately and 14581 navigation can be done with the @kbd{n} and @kbd{p} keys, and some other 14582 keys as well, press @kbd{?} for an overview of the available keys. The 14583 second one has a @emph{folding} view, much like Org provides inside Emacs. 14584 The script is available at @uref{https://orgmode.org/org-info.js} and the 14585 documentation at @uref{https://orgmode.org/worg/code/org-info-js/}. The 14586 script is hosted on @uref{https://orgmode.org}, but for reliability, prefer 14587 installing it on your own web server. 14588 14589 To use this program, just add this line to the Org file: 14590 14591 @cindex @samp{INFOJS_OPT}, keyword 14592 @example 14593 #+INFOJS_OPT: view:info toc:nil 14594 @end example 14595 14596 14597 @noindent 14598 The HTML header now has the code needed to automatically invoke the 14599 script. For setting options, use the syntax from the above line for 14600 options described below: 14601 14602 @table @asis 14603 @item @samp{path:} 14604 The path to the script. The default is to grab the script from 14605 @uref{https://orgmode.org/org-info.js}, but you might want to have a local 14606 copy and use a path like @samp{../scripts/org-info.js}. 14607 14608 @item @samp{view:} 14609 Initial view when the website is first shown. Possible values are: 14610 14611 @multitable {aaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 14612 @item @samp{info} 14613 @tab Info-like interface with one section per page 14614 @item @samp{overview} 14615 @tab Folding interface, initially showing only top-level 14616 @item @samp{content} 14617 @tab Folding interface, starting with all headlines visible 14618 @item @samp{showall} 14619 @tab Folding interface, all headlines and text visible 14620 @end multitable 14621 14622 @item @samp{sdepth:} 14623 Maximum headline level still considered as an independent section 14624 for info and folding modes. The default is taken from 14625 @code{org-export-headline-levels}, i.e., the @samp{H} switch in @samp{OPTIONS}. If 14626 this is smaller than in @code{org-export-headline-levels}, each 14627 info/folding section can still contain child headlines. 14628 14629 @item @samp{toc:} 14630 Should the table of contents @emph{initially} be visible? Even when 14631 @samp{nil}, you can always get to the ``toc'' with @kbd{i}. 14632 14633 @item @samp{tdepth:} 14634 The depth of the table of contents. The defaults are taken from the 14635 variables @code{org-export-headline-levels} and @code{org-export-with-toc}. 14636 14637 @item @samp{ftoc:} 14638 Does the CSS of the page specify a fixed position for the ``toc''? If 14639 yes, the toc is displayed as a section. 14640 14641 @item @samp{ltoc:} 14642 Should there be short contents (children) in each section? Make 14643 this @samp{above} if the section should be above initial text. 14644 14645 @item @samp{mouse:} 14646 Headings are highlighted when the mouse is over them. Should be 14647 @samp{underline} (default) or a background color like @samp{#cccccc}. 14648 14649 @item @samp{buttons:} 14650 Should view-toggle buttons be everywhere? When @samp{nil} (the default), 14651 only one such button is present. 14652 @end table 14653 14654 @vindex org-infojs-options 14655 @vindex org-export-html-use-infojs 14656 You can choose default values for these options by customizing the 14657 variable @code{org-infojs-options}. If you always want to apply the script 14658 to your pages, configure the variable @code{org-export-html-use-infojs}. 14659 14660 @node @LaTeX{} Export 14661 @section @LaTeX{} Export 14662 14663 @cindex @LaTeX{} export 14664 @cindex PDF export 14665 14666 The @LaTeX{} export backend can handle complex documents, incorporate 14667 standard or custom @LaTeX{} document classes, generate documents using 14668 alternate @LaTeX{} engines, and produce fully linked PDF files with 14669 indexes, bibliographies, and tables of contents, destined for 14670 interactive online viewing or high-quality print publication. 14671 14672 While the details are covered in-depth in this section, here are some 14673 quick references to variables for the impatient: for engines, see 14674 @code{org-latex-compiler}; for build sequences, see 14675 @code{org-latex-pdf-process}; for packages, see 14676 @code{org-latex-default-packages-alist} and @code{org-latex-packages-alist}. 14677 14678 An important note about the @LaTeX{} export backend: it is sensitive to 14679 blank lines in the Org document. That's because @LaTeX{} itself depends 14680 on blank lines to tell apart syntactical elements, such as paragraphs. 14681 14682 The following sections expect users to be familiar with common @LaTeX{} 14683 terminology. You may refer to @uref{https://tug.org/begin.html} to get 14684 familiar with @LaTeX{} basics. Users with @LaTeX{} installed may also run 14685 @samp{texdoc latex} from terminal to open @LaTeX{} introduction @footnote{ The 14686 command will open a PDF file, which is also available for download 14687 from @uref{http://mirrors.ctan.org/info/latex-doc-ptr/latex-doc-ptr.pdf}} 14688 14689 @menu 14690 * @LaTeX{}/PDF export commands:: For producing @LaTeX{} and PDF documents. 14691 * @LaTeX{} specific export settings:: Unique to this @LaTeX{} backend. 14692 * @LaTeX{} header and sectioning:: Setting up the export file structure. 14693 * Quoting @LaTeX{} code:: Incorporating literal @LaTeX{} code. 14694 * Tables in @LaTeX{} export:: Options for exporting tables to @LaTeX{}. 14695 * Images in @LaTeX{} export:: How to insert figures into @LaTeX{} output. 14696 * Plain lists in @LaTeX{} export:: Attributes specific to lists. 14697 * Source blocks in @LaTeX{} export:: Attributes specific to source code blocks. 14698 * Example blocks in @LaTeX{} export:: Attributes specific to example blocks. 14699 * Special blocks in @LaTeX{} export:: Attributes specific to special blocks. 14700 * Horizontal rules in @LaTeX{} export:: Attributes specific to horizontal rules. 14701 * Verse blocks in @LaTeX{} export:: Attributes specific to special blocks. 14702 * Quote blocks in @LaTeX{} export:: Attributes specific to quote blocks. 14703 @end menu 14704 14705 @node @LaTeX{}/PDF export commands 14706 @subsection @LaTeX{}/PDF export commands 14707 14708 @table @asis 14709 @item @kbd{C-c C-e l l} (@code{org-latex-export-to-latex}) 14710 @kindex C-c C-e l l 14711 @findex org-latex-export-to-latex~ 14712 Export to a @LaTeX{} file with a @samp{.tex} extension. For @samp{myfile.org}, 14713 Org exports to @samp{myfile.tex}, overwriting without warning. 14714 14715 @item @kbd{C-c C-e l L} (@code{org-latex-export-as-latex}) 14716 @kindex C-c C-e l L 14717 @findex org-latex-export-as-latex 14718 Export to a temporary buffer. Do not create a file. 14719 14720 @item @kbd{C-c C-e l p} (@code{org-latex-export-to-pdf}) 14721 @kindex C-c C-e l p 14722 @findex org-latex-export-to-pdf 14723 Export as @LaTeX{} file and convert it to PDF file. 14724 14725 @item @kbd{C-c C-e l o} 14726 @kindex C-c C-e l o 14727 Export as @LaTeX{} file and convert it to PDF, then open the PDF using 14728 the default viewer. 14729 14730 @item @kbd{M-x org-export-region-as-latex} 14731 Convert the region to @LaTeX{} under the assumption that it was in Org 14732 mode syntax before. This is a global command that can be invoked in 14733 any buffer. 14734 @end table 14735 14736 @vindex org-latex-compiler 14737 @vindex org-latex-bibtex-compiler 14738 @vindex org-latex-default-packages-alist 14739 @cindex pdflatex 14740 @cindex xelatex 14741 @cindex lualatex 14742 @cindex @samp{LATEX_COMPILER}, keyword 14743 The @LaTeX{} export backend can use any of these @LaTeX{} engines: 14744 @samp{pdflatex}, @samp{xelatex}, and @samp{lualatex}. These engines compile @LaTeX{} 14745 files with different compilers, packages, and output options. The 14746 @LaTeX{} export backend finds the compiler version to use from 14747 @code{org-latex-compiler} variable or the @samp{#+LATEX_COMPILER} keyword in the 14748 Org file. See the docstring for the 14749 @code{org-latex-default-packages-alist} for loading packages with certain 14750 compilers. Also see @code{org-latex-bibtex-compiler} to set the 14751 bibliography compiler@footnote{This does not allow setting different bibliography compilers 14752 for different files. However, ``smart'' @LaTeX{} compilation systems, such 14753 as latexmk, can select the correct bibliography compiler.}. 14754 14755 @node @LaTeX{} specific export settings 14756 @subsection @LaTeX{} specific export settings 14757 14758 The @LaTeX{} export backend has several additional keywords for 14759 customizing @LaTeX{} output. Setting these keywords works similar to the 14760 general options (see @ref{Export Settings}). 14761 14762 @table @asis 14763 @item @samp{DESCRIPTION} 14764 @cindex @samp{DESCRIPTION}, keyword 14765 @vindex org-latex-hyperref-template 14766 @vindex org-latex-title-command 14767 The document's description. The description along with author name, 14768 keywords, and related file metadata are inserted in the output file 14769 by the hyperref package. See @code{org-latex-hyperref-template} for 14770 customizing metadata items. See @code{org-latex-title-command} for 14771 typesetting description into the document's front matter. Use 14772 multiple @samp{DESCRIPTION} keywords for long descriptions. 14773 14774 @item @samp{LANGUAGE} 14775 @cindex @samp{LANGUAGE}, keyword 14776 @vindex org-latex-packages-alist 14777 @vindex org-latex-language-alist 14778 @vindex org-export-default-language 14779 14780 Language code of the primary document language. When @samp{LANGUAGE} 14781 keyword is not not specified use the value of 14782 @code{org-export-default-language} (by default - @samp{en}, American English) 14783 14784 The list of language codes supported by Org is stored in the 14785 variable @code{org-latex-language-alist}. 14786 14787 In order to be effective, the @samp{babel} or @samp{polyglossia} 14788 packages---according to the @LaTeX{} compiler used---must be loaded 14789 with the appropriate language as argument. This can be accomplished 14790 by modifying the @code{org-latex-packages-alist} variable, e.g., with the 14791 following snippet (note that @samp{polyglossia} does not work with 14792 pdf@LaTeX{}): 14793 14794 @lisp 14795 (add-to-list 'org-latex-packages-alist 14796 '("AUTO" "babel" t ("pdflatex" "xelatex" "lualatex"))) 14797 (add-to-list 'org-latex-packages-alist 14798 '("AUTO" "polyglossia" t ("xelatex" "lualatex"))) 14799 @end lisp 14800 14801 @item @samp{LATEX_CLASS} 14802 @cindex @samp{LATEX_CLASS}, keyword 14803 @vindex org-latex-default-class 14804 @vindex org-latex-classes 14805 This is @LaTeX{} document class, such as @emph{article}, @emph{report}, @emph{book}, 14806 and so on, which contain predefined preamble and headline level 14807 mapping that the @LaTeX{} export backend needs. The backend reads 14808 the default class name from the @code{org-latex-default-class} variable. 14809 Org has @emph{article} as the default class. A valid default class must 14810 be an element of @code{org-latex-classes}. 14811 14812 @item @samp{LATEX_CLASS_OPTIONS} 14813 @cindex @samp{LATEX_CLASS_OPTIONS}, keyword 14814 Options the @LaTeX{} export backend uses when calling the @LaTeX{} 14815 document class. 14816 14817 @item @samp{LATEX_COMPILER} 14818 @cindex @samp{LATEX_COMPILER}, keyword 14819 @vindex org-latex-compiler 14820 The compiler, such as @samp{pdflatex}, @samp{xelatex}, @samp{lualatex}, for 14821 producing the PDF@. See @code{org-latex-compiler}. 14822 14823 @item @samp{LATEX_HEADER} 14824 @itemx @samp{LATEX_HEADER_EXTRA} 14825 @cindex @samp{LATEX_HEADER}, keyword 14826 @cindex @samp{LATEX_HEADER_EXTRA}, keyword 14827 @vindex org-latex-classes 14828 Arbitrary lines to add to the document's preamble, before the 14829 hyperref settings. See @code{org-latex-classes} for adjusting the 14830 structure and order of the @LaTeX{} headers. 14831 14832 @item @samp{KEYWORDS} 14833 @cindex @samp{KEYWORDS}, keyword 14834 @vindex org-latex-hyperref-template 14835 @vindex org-latex-title-command 14836 The keywords for the document. The description along with author 14837 name, keywords, and related file metadata are inserted in the output 14838 file by the hyperref package. See @code{org-latex-hyperref-template} for 14839 customizing metadata items. See @code{org-latex-title-command} for 14840 typesetting description into the document's front matter. Use 14841 multiple @samp{KEYWORDS} lines if necessary. 14842 14843 @item @samp{SUBTITLE} 14844 @cindex @samp{SUBTITLE}, keyword 14845 @vindex org-latex-subtitle-separate 14846 @vindex org-latex-subtitle-format 14847 The document's subtitle. It is typeset as per 14848 @code{org-latex-subtitle-format}. If @code{org-latex-subtitle-separate} is 14849 non-@code{nil}, it is typed outside of the @code{\title} macro. See 14850 @code{org-latex-hyperref-template} for customizing metadata items. See 14851 @code{org-latex-title-command} for typesetting description into the 14852 document's front matter. 14853 @end table 14854 14855 The following sections have further details. 14856 14857 @node @LaTeX{} header and sectioning 14858 @subsection @LaTeX{} header and sectioning structure 14859 14860 @cindex @LaTeX{} class 14861 @cindex @LaTeX{} sectioning structure 14862 @cindex @LaTeX{} header 14863 @cindex header, for @LaTeX{} files 14864 @cindex sectioning structure, for @LaTeX{} export 14865 14866 The @LaTeX{} export backend converts the first three of Org's outline 14867 levels into @LaTeX{} headlines. The remaining Org levels are exported as 14868 lists. To change this globally for the cut-off point between levels 14869 and lists, (see @ref{Export Settings}). 14870 14871 By default, the @LaTeX{} export backend uses the @emph{article} class. 14872 14873 @vindex org-latex-default-class 14874 @vindex org-latex-classes 14875 @vindex org-latex-default-packages-alist 14876 @vindex org-latex-packages-alist 14877 To change the default class globally, edit @code{org-latex-default-class}. 14878 To change the default class locally in an Org file, add option lines 14879 @samp{#+LATEX_CLASS: myclass}. To change the default class for just a part 14880 of the Org file, set a subtree property, @samp{EXPORT_LATEX_CLASS}. The 14881 class name entered here must be valid member of @code{org-latex-classes}. 14882 This variable defines a header template for each class into which the 14883 exporter splices the values of @code{org-latex-default-packages-alist} and 14884 @code{org-latex-packages-alist}. Use the same three variables to define 14885 custom sectioning or custom classes. 14886 14887 @cindex @samp{LATEX_CLASS}, keyword 14888 @cindex @samp{LATEX_CLASS_OPTIONS}, keyword 14889 @cindex @samp{EXPORT_LATEX_CLASS}, property 14890 @cindex @samp{EXPORT_LATEX_CLASS_OPTIONS}, property 14891 The @LaTeX{} export backend sends the @samp{LATEX_CLASS_OPTIONS} keyword and 14892 @samp{EXPORT_LATEX_CLASS_OPTIONS} property as options to the @LaTeX{} 14893 @code{\documentclass} macro. The options and the syntax for specifying 14894 them, including enclosing them in square brackets, follow @LaTeX{} 14895 conventions. 14896 14897 @example 14898 #+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn] 14899 @end example 14900 14901 14902 @cindex @samp{LATEX_HEADER}, keyword 14903 @cindex @samp{LATEX_HEADER_EXTRA}, keyword 14904 The @LaTeX{} export backend appends values from @samp{LATEX_HEADER} and 14905 @samp{LATEX_HEADER_EXTRA} keywords to the @LaTeX{} header. The docstring for 14906 @code{org-latex-classes} explains in more detail. Also note that @LaTeX{} 14907 export backend does not append @samp{LATEX_HEADER_EXTRA} to the header 14908 when previewing @LaTeX{} snippets (see @ref{Previewing @LaTeX{} fragments}). 14909 14910 A sample Org file with the above headers: 14911 14912 @example 14913 #+LATEX_CLASS: article 14914 #+LATEX_CLASS_OPTIONS: [a4paper] 14915 #+LATEX_HEADER: \usepackage@{xyz@} 14916 14917 * Headline 1 14918 some text 14919 * Headline 2 14920 some more text 14921 @end example 14922 14923 @cindex @samp{LANGUAGE}, keyword 14924 @vindex org-export-default-language 14925 @LaTeX{} packages @samp{babel} or @samp{polyglossia} can also be loaded in a 14926 document. The ``AUTO'' string will be replaced in both cases by the 14927 appropriate value for the @samp{LANGUAGE} keyword, if present in the 14928 document, or by the value of @code{org-export-default-language}. Let's see 14929 some examples in one or another case. 14930 14931 @samp{Babel} accepts the classic syntax and (in addition) the new syntax 14932 with the @samp{\babelprovide} command to load the languages using the new 14933 @samp{INI} files procedure. Keep in mind that there are a number of 14934 languages that are only served in babel using @samp{INI} files, so they 14935 cannot be declared using the classic syntax, but only using the 14936 @samp{\babelprovide} command (see 14937 @uref{https://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf}). 14938 Valid usage examples could be: 14939 14940 @example 14941 #+LATEX_HEADER: \usepackage[french,italian,AUTO]@{babel@} 14942 @end example 14943 14944 where ``AUTO'' is the main language. But it can also be loaded using 14945 the @samp{\babelprovide} command: 14946 14947 @example 14948 #+LATEX_HEADER: \usepackage[french,italian]@{babel@} 14949 #+LATEX_HEADER: \babelprovide[import, main]@{AUTO@} 14950 @end example 14951 14952 @samp{Polyglossia}, for this procedure to be effective, must be loaded 14953 using the same @samp{babel} classic syntax (but note that @emph{this is not} 14954 the actual polyglossia syntax). For example, suppose a document 14955 declares Polytonic Greek as the primary language, and French as the 14956 secondary language. In this case, it would be expressed as: 14957 14958 @example 14959 #+LANGUAGE: el-polyton 14960 #+LATEX_HEADER: \usepackage[french,AUTO]@{polyglossia@} 14961 @end example 14962 14963 This would produce in @LaTeX{} (with the actual @samp{polyglossia} syntax): 14964 14965 @example 14966 \usepackage@{polyglossia@} 14967 \setmainlanguage[variant=polytonic]@{greek@} 14968 \setotherlanguage@{french@} 14969 @end example 14970 14971 @node Quoting @LaTeX{} code 14972 @subsection Quoting @LaTeX{} code 14973 14974 When the available @LaTeX{} export customizations are not sufficient to 14975 fine-tune the desired output, it is possible to insert any arbitrary 14976 @LaTeX{} code (see @ref{Embedded @LaTeX{}}). There are three ways to embed such 14977 code in the Org file and they all use different quoting syntax. 14978 14979 @cindex inline, in @LaTeX{} export 14980 Inserting in-line quoted with @@ symbols: 14981 14982 @example 14983 Code embedded in-line @@@@latex:any arbitrary LaTeX code@@@@ in a paragraph. 14984 @end example 14985 14986 14987 @cindex @samp{LATEX}, keyword 14988 Inserting as one or more keyword lines in the Org file: 14989 14990 @example 14991 #+LATEX: any arbitrary LaTeX code 14992 @end example 14993 14994 14995 @cindex @samp{BEGIN_EXPORT latex} 14996 Inserting as an export block in the Org file, where the backend 14997 exports any code between begin and end markers: 14998 14999 @example 15000 #+BEGIN_EXPORT latex 15001 any arbitrary LaTeX code 15002 #+END_EXPORT 15003 @end example 15004 15005 @node Tables in @LaTeX{} export 15006 @subsection Tables in @LaTeX{} export 15007 15008 @cindex tables, in @LaTeX{} export 15009 15010 The @LaTeX{} export backend can pass several @LaTeX{} attributes for table 15011 contents and layout. Besides specifying a label (see @ref{Internal Links}) 15012 and a caption (see @ref{Captions}), the other valid @LaTeX{} attributes 15013 include: 15014 15015 @table @asis 15016 @item @samp{:mode} 15017 @vindex org-latex-default-table-mode 15018 The @LaTeX{} export backend wraps the table differently depending on 15019 the mode for accurate rendering of math symbols. Mode is either 15020 @samp{table}, @samp{math}, @samp{inline-math}, @samp{verbatim} or @samp{tabbing}. 15021 15022 For @samp{math} or @samp{inline-math} mode, @LaTeX{} export backend wraps the 15023 table in a math environment, but every cell in it is exported as-is. 15024 For @samp{tabbing} the @LaTeX{} tabbing environment is used and the correct 15025 tabbing delimiters @samp{\>} are used. 15026 The @LaTeX{} export backend determines the default mode from 15027 @code{org-latex-default-table-mode}. The @LaTeX{} export backend merges 15028 contiguous tables in the same mode into a single environment. 15029 15030 @item @samp{:environment} 15031 @vindex org-latex-default-table-environment 15032 Set the default @LaTeX{} table environment for the @LaTeX{} export 15033 backend to use when exporting Org tables. Common @LaTeX{} table 15034 environments are provided by these packages: tabularx, longtable, 15035 array, tabu, and bmatrix. For packages, such as tabularx and tabu, 15036 or any newer replacements, include them in the 15037 @code{org-latex-packages-alist} variable so the @LaTeX{} export backend can 15038 insert the appropriate load package headers in the converted @LaTeX{} 15039 file. Look in the docstring for the @code{org-latex-packages-alist} 15040 variable for configuring these packages for @LaTeX{} snippet previews, 15041 if any. 15042 15043 @item @samp{:caption} 15044 Use @samp{CAPTION} keyword to set a simple caption for a table (see 15045 @ref{Captions}). For custom captions, use @samp{:caption} attribute, which 15046 accepts raw @LaTeX{} code. @samp{:caption} value overrides @samp{CAPTION} value. 15047 15048 @item @samp{:float} 15049 @itemx @samp{:placement} 15050 The table environments by default are not floats in @LaTeX{}. To make 15051 them floating objects use @samp{:float} with one of the following 15052 options: @samp{t} (for a default @samp{table} environment), @samp{sideways} (for a 15053 @samp{sidewaystable} environment), @samp{multicolumn} (to span the table 15054 across multiple columns of a page in a @samp{table*} environment) and 15055 @samp{nil}. In addition to these three values, @samp{:float} can pass through 15056 any arbitrary value, for example a user-defined float type with the 15057 @samp{float} @LaTeX{} package. 15058 15059 @LaTeX{} floats can also have additional layout @samp{:placement} 15060 attributes. These are the usual @samp{[h t b p ! H]} permissions 15061 specified in square brackets. Note that for @samp{:float sideways} 15062 tables, the @LaTeX{} export backend ignores @samp{:placement} attributes. 15063 15064 @item @samp{:align} 15065 @itemx @samp{:font} 15066 @itemx @samp{:width} 15067 The @LaTeX{} export backend uses these attributes for regular tables 15068 to set their alignments, fonts, and widths. 15069 15070 @item @samp{:options} 15071 The @samp{:options} attribute allows adding an optional argument with 15072 a list of various table options (between brackets in @LaTeX{} export), 15073 since certain tabular environments, such as longtblr of the 15074 tabularray @LaTeX{} package, provides this structure. For example: 15075 @samp{:options remark@{Note@}=@{note@},remark@{Source@}=@{source@}}. 15076 15077 @item @samp{:spread} 15078 When @samp{:spread} is non-@code{nil}, the @LaTeX{} export backend spreads or 15079 shrinks the table by the @samp{:width} for tabu and longtabu 15080 environments. @samp{:spread} has no effect if @samp{:width} is not set. 15081 15082 @item @samp{:booktabs} 15083 @itemx @samp{:center} 15084 @itemx @samp{:rmlines} 15085 @vindex org-latex-tables-booktabs 15086 @vindex org-latex-tables-centered 15087 All three commands are toggles. @samp{:booktabs} brings in modern 15088 typesetting enhancements to regular tables. The booktabs package 15089 has to be loaded through @code{org-latex-packages-alist}. @samp{:center} is 15090 for centering the table. @samp{:rmlines} removes all but the very first 15091 horizontal line made of ASCII characters from ``table.el'' tables 15092 only. 15093 15094 @item @samp{:math-prefix} 15095 @itemx @samp{:math-suffix} 15096 @itemx @samp{:math-arguments} 15097 The @LaTeX{} export backend inserts @samp{:math-prefix} string value in 15098 a math environment before the table. The @LaTeX{} export backend 15099 inserts @samp{:math-suffix} string value in a math environment after the 15100 table. The @LaTeX{} export backend inserts @samp{:math-arguments} string 15101 value between the macro name and the table's contents. 15102 @samp{:math-arguments} comes in use for matrix macros that require more 15103 than one argument, such as @samp{qbordermatrix}. 15104 @end table 15105 15106 @LaTeX{} table attributes help formatting tables for a wide range of 15107 situations, such as matrix product or spanning multiple pages: 15108 15109 @example 15110 #+ATTR_LATEX: :environment longtable :align l|lp@{3cm@}r|l 15111 | ... | ... | 15112 | ... | ... | 15113 15114 #+ATTR_LATEX: :mode math :environment bmatrix :math-suffix \times 15115 | a | b | 15116 | c | d | 15117 #+ATTR_LATEX: :mode math :environment bmatrix 15118 | 1 | 2 | 15119 | 3 | 4 | 15120 @end example 15121 15122 Set the caption with the @LaTeX{} command 15123 @samp{\bicaption@{HeadingA@}@{HeadingB@}}: 15124 15125 @example 15126 #+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@} 15127 | ... | ... | 15128 | ... | ... | 15129 @end example 15130 15131 @node Images in @LaTeX{} export 15132 @subsection Images in @LaTeX{} export 15133 15134 @cindex images, inline in LaTeX 15135 @cindex inlining images in LaTeX 15136 @cindex @samp{ATTR_LATEX}, keyword 15137 15138 The @LaTeX{} export backend processes image links in Org files that do 15139 not have descriptions, such as these links @samp{[[file:img.jpg]]} or 15140 @samp{[[./img.jpg]]}, as direct image insertions in the final PDF output. In 15141 the PDF, they are no longer links but actual images embedded on the 15142 page. The @LaTeX{} export backend uses @samp{\includegraphics} macro to 15143 insert the image. But for TikZ (@uref{https://sourceforge.net/projects/pgf/}) 15144 images, the backend uses an @code{\input} macro wrapped within 15145 a @code{tikzpicture} environment. 15146 15147 For specifying image @samp{:width}, @samp{:height}, @samp{:scale} and other @samp{:options}, 15148 use this syntax: 15149 15150 @example 15151 #+ATTR_LATEX: :width 5cm :options angle=90 15152 [[./img/sed-hr4049.pdf]] 15153 @end example 15154 15155 A @samp{:scale} attribute overrides both @samp{:width} and @samp{:height} attributes. 15156 15157 For custom commands for captions, use the @samp{:caption} attribute. It 15158 overrides the default @samp{#+CAPTION} value: 15159 15160 @example 15161 #+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@} 15162 [[./img/sed-hr4049.pdf]] 15163 @end example 15164 15165 When captions follow the method as described in @ref{Captions}, the @LaTeX{} 15166 export backend wraps the picture in a floating @samp{figure} environment. 15167 To float an image without specifying a caption, set the @samp{:float} 15168 attribute to one of the following: 15169 15170 @table @asis 15171 @item @samp{t} 15172 For a default @samp{figure} environment. 15173 15174 @item @samp{multicolumn} 15175 To span the image across multiple columns of a page; the backend 15176 wraps the image in a @samp{figure*} environment. 15177 15178 @item @samp{wrap} 15179 For text to flow around the image on the right; the figure occupies 15180 the left half of the page. 15181 15182 @item @samp{sideways} 15183 For a new page with the image sideways, rotated ninety degrees, in 15184 a @samp{sidewaysfigure} environment; overrides @samp{:placement} setting. 15185 15186 @item @samp{nil} 15187 To avoid a @samp{:float} even if using a caption. 15188 15189 @item Any arbitrary value 15190 For example, a user-defined float type with the @samp{float} @LaTeX{} 15191 package. 15192 @end table 15193 15194 15195 Use the @samp{placement} attribute to modify a floating environment's 15196 placement. 15197 15198 @example 15199 #+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement @{r@}@{0.4\textwidth@} 15200 [[./img/hst.png]] 15201 @end example 15202 15203 @vindex org-latex-images-centered 15204 @cindex center image in LaTeX export 15205 @cindex image, centering in LaTeX export 15206 The @LaTeX{} export backend centers all images by default. Setting 15207 @samp{:center} to @samp{nil} disables centering. To disable centering globally, 15208 set @code{org-latex-images-centered} to @samp{nil}. 15209 15210 Set the @samp{:comment-include} attribute to non-@code{nil} value for the @LaTeX{} 15211 export backend to comment out the @samp{\includegraphics} macro. 15212 15213 @node Plain lists in @LaTeX{} export 15214 @subsection Plain lists in @LaTeX{} export 15215 15216 @cindex plain lists, in @LaTeX{} export 15217 @cindex @samp{ATTR_LATEX}, keyword 15218 The @LaTeX{} export backend accepts the @samp{environment} and @samp{options} 15219 attributes for plain lists. Both attributes work together for 15220 customizing lists, as shown in the examples: 15221 15222 @example 15223 #+LATEX_HEADER: \usepackage[inline]@{enumitem@} 15224 Some ways to say "Hello": 15225 #+ATTR_LATEX: :environment itemize* 15226 #+ATTR_LATEX: :options [label=@{@}, itemjoin=@{,@}, itemjoin*=@{, and@}] 15227 - Hola 15228 - Bonjour 15229 - Guten Tag. 15230 @end example 15231 15232 Since @LaTeX{} supports only four levels of nesting for lists, use an 15233 external package, such as @samp{enumitem} in @LaTeX{}, for levels deeper than 15234 four: 15235 15236 @example 15237 #+LATEX_HEADER: \usepackage@{enumitem@} 15238 #+LATEX_HEADER: \renewlist@{itemize@}@{itemize@}@{9@} 15239 #+LATEX_HEADER: \setlist[itemize]@{label=$\circ$@} 15240 - One 15241 - Two 15242 - Three 15243 - Four 15244 - Five 15245 @end example 15246 15247 @node Source blocks in @LaTeX{} export 15248 @subsection Source blocks in @LaTeX{} export 15249 15250 @cindex source blocks, in @LaTeX{} export 15251 @cindex @samp{ATTR_LATEX}, keyword 15252 15253 @vindex org-latex-src-block-backend 15254 @LaTeX{} export backend provides multiple ways to render src blocks in 15255 @LaTeX{}, according to the value of @code{org-latex-src-block-backend}. The 15256 default value @samp{verbatim} renders the src code verbatim, without any 15257 extra styling. Alternative values allow more colorful styling, but 15258 require additional @LaTeX{} (@samp{listings}, @samp{minted}), system (@samp{minted}), or 15259 Emacs (@samp{engraved}) packages. See the @code{org-latex-src-block-backend} 15260 docstring for more details. 15261 15262 The @LaTeX{} export backend can make source code blocks into floating 15263 objects through the attributes @samp{:float} and @samp{:options}. For @samp{:float}: 15264 15265 @table @asis 15266 @item @samp{t} 15267 Makes a source block float; by default floats any source block with 15268 a caption. 15269 15270 @item @samp{multicolumn} 15271 Spans the source block across multiple columns of a page. 15272 15273 @item @samp{nil} 15274 Avoids a @samp{:float} even if using a caption; useful for source code 15275 blocks that may not fit on a page. 15276 @end table 15277 15278 @example 15279 #+ATTR_LATEX: :float nil 15280 #+BEGIN_SRC emacs-lisp 15281 Lisp code that may not fit in a single page. 15282 #+END_SRC 15283 @end example 15284 15285 @vindex org-latex-listings-options 15286 @vindex org-latex-minted-options 15287 @vindex org-latex-engraved-options 15288 The @LaTeX{} export backend passes string values in @samp{:options} to @LaTeX{} 15289 packages for customization of that specific source block. In the 15290 example below, the @samp{:options} are set for Engraved or Minted. Minted 15291 is a source code highlighting @LaTeX{} package with many configurable 15292 options@footnote{ Minted uses an external Python package for code 15293 highlighting, which requires the flag @samp{-shell-escape} to be added to 15294 @code{org-latex-pdf-process}.}. Both Minted and Engraved are built on 15295 @uref{https://www.ctan.org/pkg/fvextra, fvextra}, and so support many of 15296 the same options. 15297 15298 @example 15299 #+ATTR_LATEX: :options mathescape 15300 #+BEGIN_SRC emacs-lisp 15301 (defun Fib (n) ; $n_i = n_@{i-2@} + n_@{i-1@}$ 15302 (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2))))) 15303 #+END_SRC 15304 @end example 15305 15306 To apply similar configuration options for all source blocks in a 15307 file, use the @code{org-latex-listings-options}, 15308 @code{org-latex-engraved-options}, and @code{org-latex-minted-options} 15309 variables. 15310 15311 @node Example blocks in @LaTeX{} export 15312 @subsection Example blocks in @LaTeX{} export 15313 15314 @cindex example blocks, in @LaTeX{} export 15315 @cindex verbatim blocks, in @LaTeX{} export 15316 @cindex @samp{ATTR_LATEX}, keyword 15317 15318 The @LaTeX{} export backend wraps the contents of example blocks in 15319 a @samp{verbatim} environment. To change this behavior to use another 15320 environment globally, specify an appropriate export filter (see 15321 @ref{Advanced Export Configuration}). To change this behavior to use 15322 another environment for each block, use the @samp{:environment} parameter 15323 to specify a custom environment. 15324 15325 @example 15326 #+ATTR_LATEX: :environment myverbatim 15327 #+BEGIN_EXAMPLE 15328 This sentence is false. 15329 #+END_EXAMPLE 15330 @end example 15331 15332 @node Special blocks in @LaTeX{} export 15333 @subsection Special blocks in @LaTeX{} export 15334 15335 @cindex special blocks, in @LaTeX{} export 15336 @cindex abstract, in @LaTeX{} export 15337 @cindex proof, in @LaTeX{} export 15338 @cindex @samp{ATTR_LATEX}, keyword 15339 15340 For other special blocks in the Org file, the @LaTeX{} export backend 15341 makes a special environment of the same name. The backend also takes 15342 @samp{:options}, if any, and appends as-is to that environment's opening 15343 string. For example: 15344 15345 @example 15346 #+BEGIN_abstract 15347 We demonstrate how to solve the Syracuse problem. 15348 #+END_abstract 15349 15350 #+ATTR_LATEX: :options [Proof of important theorem] 15351 #+BEGIN_proof 15352 ... 15353 Therefore, any even number greater than 2 is the sum of two primes. 15354 #+END_proof 15355 @end example 15356 15357 @noindent 15358 exports to 15359 15360 @example 15361 \begin@{abstract@} 15362 We demonstrate how to solve the Syracuse problem. 15363 \end@{abstract@} 15364 15365 \begin@{proof@}[Proof of important theorem] 15366 ... 15367 Therefore, any even number greater than 2 is the sum of two primes. 15368 \end@{proof@} 15369 @end example 15370 15371 If you need to insert a specific caption command, use @samp{:caption} 15372 attribute. It overrides standard @samp{CAPTION} value, if any. For 15373 example: 15374 15375 @example 15376 #+ATTR_LATEX: :caption \MyCaption@{HeadingA@} 15377 #+BEGIN_proof 15378 ... 15379 #+END_proof 15380 @end example 15381 15382 @node Horizontal rules in @LaTeX{} export 15383 @subsection Horizontal rules in @LaTeX{} export 15384 15385 @cindex horizontal rules, in @LaTeX{} export 15386 @cindex @samp{ATTR_LATEX}, keyword 15387 15388 The @LaTeX{} export backend converts horizontal rules by the specified 15389 @samp{:width} and @samp{:thickness} attributes. For example: 15390 15391 @example 15392 #+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt 15393 ----- 15394 @end example 15395 15396 @node Verse blocks in @LaTeX{} export 15397 @subsection Verse blocks in @LaTeX{} export 15398 15399 @cindex verse blocks, in @LaTeX{} export 15400 @cindex @samp{ATTR_LATEX}, keyword 15401 15402 The @LaTeX{} export backend accepts five attributes for verse blocks: 15403 @samp{:lines}, @samp{:center}, @samp{:versewidth}, @samp{:latexcode} and @samp{:literal}. The 15404 three first require the external @LaTeX{} package @samp{verse.sty}, which is 15405 an extension of the standard @LaTeX{} environment. 15406 15407 @table @asis 15408 @item @samp{:lines} 15409 To add marginal verse numbering. Its value is an 15410 integer, the sequence in which the verses should be numbered. 15411 @item @samp{:center} 15412 With value @samp{t} all the verses on the page are optically 15413 centered (a typographic convention for poetry), taking as a 15414 reference the longest verse, which must be indicated by the 15415 attribute @samp{:versewidth}. 15416 @item @samp{:versewidth} 15417 Its value is a literal text string with the longest 15418 verse. 15419 @item @samp{:latexcode} 15420 It accepts any arbitrary @LaTeX{} code that can be 15421 included within a @LaTeX{} @samp{verse} environment. 15422 @item @samp{:literal} 15423 With value t, all blank lines are preserved and 15424 exported as @samp{\vspace*@{\baselineskip@}}, including the blank lines 15425 before or after contents. Note that without the @samp{:literal} 15426 attribute, one or more blank lines between stanzas are exported as a 15427 single blank line, and any blank lines before or after the content 15428 are removed, which is more consistent with the syntax of the @LaTeX{} 15429 `verse' environment, and the one provided by the @samp{verse} package. 15430 If the @samp{verse} package is loaded, the vertical spacing between all 15431 stanzas can be controlled by the global length @samp{\stanzaskip} (see 15432 @uref{https://www.ctan.org/pkg/verse}). 15433 @end table 15434 15435 A complete example with Shakespeare's first sonnet: 15436 15437 @example 15438 #+ATTR_LATEX: :center t :latexcode \color@{red@} :lines 5 15439 #+ATTR_LATEX: :versewidth Feed’st thy light’s flame with self-substantial fuel, 15440 #+BEGIN_VERSE 15441 From fairest creatures we desire increase, 15442 That thereby beauty’s rose might never die, 15443 But as the riper should by time decease 15444 His tender heir might bear his memory 15445 But thou, contracted to thine own bright eyes, 15446 Feed’st thy light’s flame with self-substantial fuel, 15447 Making a famine where abundance lies, 15448 Thyself thy foe, to thy sweet self too cruel. 15449 Thou that art now the world’s fresh ornament, 15450 And only herald to the gaudy spring, 15451 Within thine own bud buriest thy content, 15452 And, tender churl, mak’st waste in niggardly. 15453 Pity the world, or else this glutton be, 15454 To eat the world’s due, by the grave and thee. 15455 #+END_VERSE 15456 @end example 15457 15458 @node Quote blocks in @LaTeX{} export 15459 @subsection Quote blocks in @LaTeX{} export 15460 15461 @cindex quote blocks, in @LaTeX{} export 15462 @cindex @samp{ATTR_LATEX}, keyword 15463 @cindex org-latex-default-quote-environment 15464 15465 The @LaTeX{} export backend accepts two attributes for quote blocks: 15466 @samp{:environment}, for an arbitrary quoting environment (the default 15467 value is that of @code{org-latex-default-quote-environment}: @code{"quote"}) and 15468 @samp{:options}. For example, to choose the environment @samp{quotation}, 15469 included as an alternative to @samp{quote} in standard @LaTeX{} classes: 15470 15471 @example 15472 #+ATTR_LATEX: :environment quotation 15473 #+BEGIN_QUOTE 15474 some text... 15475 #+END_QUOTE 15476 @end example 15477 15478 To choose the @samp{foreigndisplayquote} environment, included in the @LaTeX{} 15479 package @samp{csquotes}, with the @samp{german} option, use this syntax: 15480 15481 @example 15482 #+LATEX_HEADER:\usepackage[autostyle=true]@{csquotes@} 15483 #+ATTR_LATEX: :environment foreigndisplayquote :options @{german@} 15484 #+BEGIN_QUOTE 15485 some text in German... 15486 #+END_QUOTE 15487 @end example 15488 15489 @noindent 15490 which is exported to @LaTeX{} as 15491 15492 @example 15493 \begin@{foreigndisplayquote@}@{german@} 15494 some text in German... 15495 \end@{foreigndisplayquote@} 15496 @end example 15497 15498 @node Markdown Export 15499 @section Markdown Export 15500 15501 @cindex Markdown export 15502 15503 The Markdown export backend, ``md'', converts an Org file to Markdown 15504 format, as defined at @uref{https://daringfireball.net/projects/markdown/}. 15505 This is the original Markdown specification, developed by John Gruber 15506 and Aaron Swartz. 15507 15508 Since ``md'' backend is built on top of the HTML backend (see @ref{HTML Export}), it converts every Org construct not defined in Markdown 15509 syntax, such as tables, to HTML@. 15510 15511 Do note that the original markdown syntax has differences with other 15512 commonly used Markdown flavors. See 15513 @uref{https://en.wikipedia.org/wiki/Markdown} for more details. 15514 15515 @anchor{Markdown export commands} 15516 @subheading Markdown export commands 15517 15518 @table @asis 15519 @item @kbd{C-c C-e m m} (@code{org-md-export-to-markdown}) 15520 @kindex C-c C-c m m 15521 @findex org-md-export-to-markdown 15522 Export to a text file with Markdown syntax. For @samp{myfile.org}, Org 15523 exports to @samp{myfile.md}, overwritten without warning. 15524 15525 @item @kbd{C-c C-e m M} (@code{org-md-export-as-markdown}) 15526 @kindex C-c C-c m M 15527 @findex org-md-export-as-markdown 15528 Export to a temporary buffer. Does not create a file. 15529 15530 @item @kbd{C-c C-e m o} 15531 @kindex C-c C-e m o 15532 Export as a text file with Markdown syntax, then open it. 15533 @end table 15534 15535 @anchor{Header and sectioning structure (1)} 15536 @subheading Header and sectioning structure 15537 15538 @vindex org-md-headline-style 15539 Based on @code{org-md-headline-style}, Markdown export can generate 15540 headlines of both @emph{atx} and @emph{setext} types. @emph{setext} limits headline 15541 levels to two whereas @emph{atx} limits headline levels to six. @emph{mixed} 15542 exports headline levels one and two in @emph{setext}-style, and headline 15543 levels three through six as @emph{atx}-style headlines. Beyond these 15544 limits, the export backend converts headlines to lists. To set a 15545 limit to a level before the absolute limit (see @ref{Export Settings}). 15546 15547 @node OpenDocument Text Export 15548 @section OpenDocument Text Export 15549 15550 @cindex ODT 15551 @cindex OpenDocument 15552 @cindex export, OpenDocument 15553 @cindex LibreOffice 15554 15555 The ODT export backend handles creating of OpenDocument Text (ODT) 15556 format. Documents created by this exporter use the 15557 @cite{OpenDocument-v1.2 specification}@footnote{ See 15558 @uref{https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, Open 15559 Document Format for Office Applications (OpenDocument) Version 1.2}.} 15560 and are compatible with LibreOffice 3.4. 15561 15562 @menu 15563 * Pre-requisites for ODT export:: Required packages. 15564 * ODT export commands:: Invoking export. 15565 * ODT specific export settings:: Configuration options. 15566 * Extending ODT export:: Producing DOC, PDF files. 15567 * Applying custom styles:: Styling the output. 15568 * Links in ODT export:: Handling and formatting links. 15569 * Tables in ODT export:: Org tables conversions. 15570 * Images in ODT export:: Inserting images. 15571 * Math formatting in ODT export:: Formatting @LaTeX{} fragments. 15572 * Labels and captions in ODT export:: Rendering objects. 15573 * Literal examples in ODT export:: For source code and example blocks. 15574 * Advanced topics in ODT export:: For power users. 15575 @end menu 15576 15577 @node Pre-requisites for ODT export 15578 @subsection Pre-requisites for ODT export 15579 15580 @cindex zip 15581 15582 The ODT export backend relies on the zip program to create the final 15583 compressed ODT output. Check if @samp{zip} is locally available and 15584 executable. Without it, export cannot finish. 15585 15586 @node ODT export commands 15587 @subsection ODT export commands 15588 15589 @table @asis 15590 @item @kbd{C-c C-e o o} (@code{org-odt-export-to-odt}) 15591 @kindex C-c C-e o o 15592 @findex org-odt-export-to-odt 15593 Export as OpenDocument Text file. 15594 15595 @cindex @samp{EXPORT_FILE_NAME}, property 15596 @vindex org-odt-preferred-output-format 15597 15598 If @code{org-odt-preferred-output-format} is specified, the ODT export 15599 backend automatically converts the exported file to that format. 15600 15601 For @samp{myfile.org}, Org exports to @samp{myfile.odt}, overwriting without 15602 warning. The ODT export backend exports a region only if a region 15603 was active. 15604 15605 If the selected region is a single tree, the ODT export backend 15606 makes the tree head the document title. Incidentally, @kbd{C-c @@} selects the current subtree. If the tree head entry has, or 15607 inherits, an @samp{EXPORT_FILE_NAME} property, the ODT export backend 15608 uses that for file name. 15609 15610 @item @kbd{C-c C-e o O} 15611 @kindex C-c C-e o O 15612 Export as an OpenDocument Text file and open the resulting file. 15613 15614 @vindex org-export-odt-preferred-output-format 15615 If @code{org-export-odt-preferred-output-format} is specified, open the 15616 converted file instead. See @ref{Automatically exporting to other formats}. 15617 @end table 15618 15619 @node ODT specific export settings 15620 @subsection ODT specific export settings 15621 15622 The ODT export backend has several additional keywords for 15623 customizing ODT output. Setting these keywords works similar to the 15624 general options (see @ref{Export Settings}). 15625 15626 @table @asis 15627 @item @samp{DESCRIPTION} 15628 @cindex @samp{DESCRIPTION}, keyword 15629 This is the document's description, which the ODT export backend 15630 inserts as document metadata. For long descriptions, use multiple 15631 lines, prefixed with @samp{DESCRIPTION}. 15632 15633 @item @samp{KEYWORDS} 15634 @cindex @samp{KEYWORDS}, keyword 15635 The keywords for the document. The ODT export backend inserts the 15636 description along with author name, keywords, and related file 15637 metadata as metadata in the output file. Use multiple @samp{KEYWORDS} if 15638 necessary. 15639 15640 @item @samp{ODT_STYLES_FILE} 15641 @cindex @samp{ODT_STYLES_FILE}, keyword 15642 @vindex org-odt-styles-file 15643 The ODT export backend uses the @code{org-odt-styles-file} by default. 15644 See @ref{Applying custom styles} for details. 15645 15646 @item @samp{SUBTITLE} 15647 @cindex @samp{SUBTITLE}, keyword 15648 The document subtitle. 15649 @end table 15650 15651 @node Extending ODT export 15652 @subsection Extending ODT export 15653 15654 The ODT export backend can produce documents in other formats besides 15655 ODT using a specialized ODT converter process. Its common interface 15656 works with popular converters to produce formats such as @samp{doc}, or 15657 convert a document from one format, say @samp{csv}, to another format, say 15658 @samp{xls}. 15659 15660 @cindex @file{unoconv} 15661 @vindex org-odt-convert-process 15662 Customize @code{org-odt-convert-process} variable to point to @samp{unoconv}, 15663 which is the ODT's preferred converter. Working installations of 15664 LibreOffice would already have @samp{unoconv} installed. Alternatively, 15665 other converters may be substituted here. See @ref{Configuring a document converter}. 15666 15667 @anchor{Automatically exporting to other formats} 15668 @subsubheading Automatically exporting to other formats 15669 15670 @vindex org-odt-preferred-output-format 15671 If ODT format is just an intermediate step to get to other formats, 15672 such as @samp{doc}, @samp{docx}, @samp{rtf}, or @samp{pdf}, etc., then extend the ODT 15673 export backend to directly produce that format. Specify the final 15674 format in the @code{org-odt-preferred-output-format} variable. This is one 15675 way to extend (see @ref{ODT export commands}). 15676 15677 @anchor{Converting between document formats} 15678 @subsubheading Converting between document formats 15679 15680 The Org export backend is made to be inter-operable with a wide range 15681 of text document format converters. Newer generation converters, such 15682 as LibreOffice and Pandoc, can handle hundreds of formats at once. 15683 Org provides a consistent interaction with whatever converter is 15684 installed. Here are some generic commands: 15685 15686 @table @asis 15687 @item @kbd{M-x org-odt-convert} 15688 @findex org-odt-convert 15689 Convert an existing document from one format to another. With 15690 a prefix argument, opens the newly produced file. 15691 @end table 15692 15693 @node Applying custom styles 15694 @subsection Applying custom styles 15695 15696 @cindex styles, custom 15697 @cindex template, custom 15698 15699 The ODT export backend comes with many OpenDocument styles (see 15700 @ref{Working with OpenDocument style files}). To expand or further 15701 customize these built-in style sheets, either edit the style sheets 15702 directly or generate them using an application such as LibreOffice. 15703 The example here shows creating a style using LibreOffice. 15704 15705 @anchor{Applying custom styles the easy way} 15706 @subsubheading Applying custom styles: the easy way 15707 15708 @enumerate 15709 @item 15710 Create a sample @samp{example.org} file with settings as shown below, 15711 and export it to ODT format. 15712 15713 @example 15714 #+OPTIONS: H:10 num:t 15715 @end example 15716 15717 @item 15718 Open the above @samp{example.odt} using LibreOffice. Use the @emph{Stylist} 15719 to locate the target styles, which typically have the ``Org'' prefix. 15720 Open one, modify, and save as either OpenDocument Text (ODT) or 15721 OpenDocument Template (OTT) file. 15722 15723 @item 15724 @vindex org-odt-styles-file 15725 Customize the variable @code{org-odt-styles-file} and point it to the 15726 newly created file. For additional configuration options, see 15727 @ref{x-overriding-factory-styles, , Overriding factory styles}. 15728 15729 @cindex @samp{ODT_STYLES_FILE}, keyword 15730 To apply an ODT style to a particular file, use the 15731 @samp{ODT_STYLES_FILE} keyword as shown in the example below: 15732 15733 @example 15734 #+ODT_STYLES_FILE: "/path/to/example.ott" 15735 @end example 15736 15737 15738 @noindent 15739 or 15740 15741 @example 15742 #+ODT_STYLES_FILE: ("/path/to/file.ott" ("styles.xml" "image/hdr.png")) 15743 @end example 15744 @end enumerate 15745 15746 @anchor{Using third-party styles and templates} 15747 @subsubheading Using third-party styles and templates 15748 15749 The ODT export backend relies on many templates and style names. 15750 Using third-party styles and templates can lead to mismatches. 15751 Templates derived from built-in ODT templates and styles seem to have 15752 fewer problems. 15753 15754 @node Links in ODT export 15755 @subsection Links in ODT export 15756 15757 @cindex links, in ODT export 15758 15759 ODT exporter creates native cross-references for internal links. It 15760 creates Internet-style links for all other links. 15761 15762 A link with no description and pointing to a regular, un-itemized, 15763 outline heading is replaced with a cross-reference and section number 15764 of the heading. 15765 15766 A @samp{\ref@{label@}}-style reference to an image, table etc., is replaced 15767 with a cross-reference and sequence number of the labeled entity. See 15768 @ref{Labels and captions in ODT export}. 15769 15770 @node Tables in ODT export 15771 @subsection Tables in ODT export 15772 15773 @cindex tables, in ODT export 15774 15775 The ODT export backend handles native Org mode tables (see @ref{Tables}) 15776 and simple @samp{table.el} tables. Complex @samp{table.el} tables having column 15777 or row spans are not supported. Such tables are stripped from the 15778 exported document. 15779 15780 By default, the ODT export backend exports a table with top and 15781 bottom frames and with ruled lines separating row and column groups 15782 (see @ref{Column Groups}). All tables are typeset to occupy the same 15783 width. The ODT export backend honors any table alignments and 15784 relative widths for columns (see @ref{Column Width and Alignment}). 15785 15786 Note that the ODT export backend interprets column widths as weighted 15787 ratios, the default weight being 1. 15788 15789 @cindex @samp{ATTR_ODT}, keyword 15790 Specifying @samp{:rel-width} property on an @samp{ATTR_ODT} line controls the 15791 width of the table. For example: 15792 15793 @example 15794 #+ATTR_ODT: :rel-width 50 15795 | Area/Month | Jan | Feb | Mar | Sum | 15796 |---------------+-------+-------+-------+-------| 15797 | / | < | | | < | 15798 | <l13> | <r5> | <r5> | <r5> | <r6> | 15799 | North America | 1 | 21 | 926 | 948 | 15800 | Middle East | 6 | 75 | 844 | 925 | 15801 | Asia Pacific | 9 | 27 | 790 | 826 | 15802 |---------------+-------+-------+-------+-------| 15803 | Sum | 16 | 123 | 2560 | 2699 | 15804 @end example 15805 15806 On export, the above table takes 50% of text width area. The exporter 15807 sizes the columns in the ratio: 13:5:5:5:6. The first column is 15808 left-aligned and rest of the columns, right-aligned. Vertical rules 15809 separate the header and the last column. Horizontal rules separate 15810 the header and the last row. 15811 15812 For even more customization, create custom table styles and associate 15813 them with a table using the @samp{ATTR_ODT} keyword. See @ref{Customizing tables in ODT export}. 15814 15815 @node Images in ODT export 15816 @subsection Images in ODT export 15817 15818 @cindex images, embedding in ODT 15819 @cindex embedding images in ODT 15820 15821 @anchor{Embedding images} 15822 @subsubheading Embedding images 15823 15824 The ODT export backend processes image links in Org files that do not 15825 have descriptions, such as these links @samp{[[file:img.jpg]]} or @samp{[[./img.jpg]]}, 15826 as direct image insertions in the final output. Either of these 15827 examples works: 15828 15829 @example 15830 [[file:img.png]] 15831 @end example 15832 15833 15834 @example 15835 [[./img.png]] 15836 @end example 15837 15838 @anchor{Embedding clickable images} 15839 @subsubheading Embedding clickable images 15840 15841 For clickable images, provide a link whose description is another link 15842 to an image file. For example, to embed an image 15843 @samp{org-mode-unicorn.png} which when clicked jumps to @uref{https://orgmode.org} 15844 website, do the following 15845 15846 @example 15847 [[https://orgmode.org][./org-mode-unicorn.png]] 15848 @end example 15849 15850 @anchor{Sizing and scaling of embedded images} 15851 @subsubheading Sizing and scaling of embedded images 15852 15853 @cindex @samp{ATTR_ODT}, keyword 15854 15855 Control the size and scale of the embedded images with the @samp{ATTR_ODT} 15856 attribute. 15857 15858 @cindex identify, ImageMagick 15859 @vindex org-odt-pixels-per-inch 15860 The ODT export backend starts with establishing the size of the image 15861 in the final document. The dimensions of this size are measured in 15862 centimeters. The backend then queries the image file for its 15863 dimensions measured in pixels. For this measurement, the backend 15864 relies on ImageMagick's identify program or Emacs @code{create-image} and 15865 @code{image-size} API@. ImageMagick is the preferred choice for large file 15866 sizes or frequent batch operations. The backend then converts the 15867 pixel dimensions using @code{org-odt-pixels-per-inch} into the familiar 72 15868 dpi or 96 dpi. The default value for this is in 15869 @code{display-pixels-per-inch}, which can be tweaked for better results 15870 based on the capabilities of the output device. Here are some common 15871 image scaling operations: 15872 15873 @table @asis 15874 @item Explicitly size the image 15875 To embed @samp{img.png} as a 10 cm x 10 cm image, do the following: 15876 15877 @example 15878 #+ATTR_ODT: :width 10 :height 10 15879 [[./img.png]] 15880 @end example 15881 15882 @item Scale the image 15883 To embed @samp{img.png} at half its size, do the following: 15884 15885 @example 15886 #+ATTR_ODT: :scale 0.5 15887 [[./img.png]] 15888 @end example 15889 15890 @item Scale the image to a specific width 15891 To embed @samp{img.png} with a width of 10 cm while retaining the 15892 original height:width ratio, do the following: 15893 15894 @example 15895 #+ATTR_ODT: :width 10 15896 [[./img.png]] 15897 @end example 15898 15899 @item Scale the image to a specific height 15900 To embed @samp{img.png} with a height of 10 cm while retaining the 15901 original height:width ratio, do the following: 15902 15903 @example 15904 #+ATTR_ODT: :height 10 15905 [[./img.png]] 15906 @end example 15907 @end table 15908 15909 @anchor{Anchoring of images} 15910 @subsubheading Anchoring of images 15911 15912 @cindex @samp{ATTR_ODT}, keyword 15913 The ODT export backend can anchor images to @samp{as-char}, @samp{paragraph}, 15914 or @samp{page}. Set the preferred anchor using the @samp{:anchor} property of 15915 the @samp{ATTR_ODT} line. 15916 15917 To create an image that is anchored to a page: 15918 15919 @example 15920 #+ATTR_ODT: :anchor page 15921 [[./img.png]] 15922 @end example 15923 15924 @node Math formatting in ODT export 15925 @subsection Math formatting in ODT export 15926 15927 The ODT exporter has special support for handling math. 15928 15929 @menu 15930 * @LaTeX{} math snippets:: Embedding in @LaTeX{} format. 15931 * MathML and OpenDocument formula files:: Embedding in native format. 15932 @end menu 15933 15934 @node @LaTeX{} math snippets 15935 @subsubsection @LaTeX{} math snippets 15936 15937 @LaTeX{} math snippets (see @ref{@LaTeX{} fragments}) can be embedded in the ODT 15938 document in one of the following ways: 15939 15940 @table @asis 15941 @item MathML 15942 @cindex MathML 15943 Add this line to the Org file. This option is activated on 15944 a per-file basis. 15945 15946 @example 15947 #+OPTIONS: tex:t 15948 @end example 15949 15950 15951 With this option, @LaTeX{} fragments are first converted into MathML 15952 fragments using an external @LaTeX{}-to-MathML converter program. The 15953 resulting MathML fragments are then embedded as an OpenDocument 15954 Formula in the exported document. 15955 15956 @vindex org-latex-to-mathml-convert-command 15957 @vindex org-latex-to-mathml-jar-file 15958 You can specify the @LaTeX{}-to-MathML converter by customizing the 15959 variables @code{org-latex-to-mathml-convert-command} and 15960 @code{org-latex-to-mathml-jar-file}. 15961 15962 If you prefer to use MathToWeb@footnote{ See 15963 @uref{http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl, MathToWeb}.} 15964 as your converter, you can configure the above variables as shown 15965 below. 15966 15967 @lisp 15968 (setq org-latex-to-mathml-convert-command 15969 "java -jar %j -unicode -force -df %o %I" 15970 org-latex-to-mathml-jar-file 15971 "/path/to/mathtoweb.jar") 15972 @end lisp 15973 15974 @noindent 15975 or, to use @LaTeX{}ML@footnote{ See @uref{https://dlmf.nist.gov/LaTeXML/}.} 15976 instead, 15977 15978 @lisp 15979 (setq org-latex-to-mathml-convert-command 15980 "latexmlmath %i --presentationmathml=%o") 15981 @end lisp 15982 15983 To quickly verify the reliability of the @LaTeX{}-to-MathML 15984 converter, use the following commands: 15985 15986 @table @asis 15987 @item @kbd{M-x org-export-as-odf} 15988 Convert a @LaTeX{} math snippet to an OpenDocument formula (@samp{.odf}) 15989 file. 15990 15991 @item @kbd{M-x org-export-as-odf-and-open} 15992 Convert a @LaTeX{} math snippet to an OpenDocument formula (@samp{.odf}) 15993 file and open the formula file with the system-registered 15994 application. 15995 @end table 15996 15997 @item PNG images 15998 @cindex dvipng 15999 @cindex dvisvgm 16000 @cindex ImageMagick 16001 Add this line to the Org file. This option is activated on 16002 a per-file basis. 16003 16004 @example 16005 #+OPTIONS: tex:dvipng 16006 @end example 16007 16008 16009 @example 16010 #+OPTIONS: tex:dvisvgm 16011 @end example 16012 16013 16014 @noindent 16015 or 16016 16017 @example 16018 #+OPTIONS: tex:imagemagick 16019 @end example 16020 16021 16022 Under this option, @LaTeX{} fragments are processed into PNG or SVG 16023 images and the resulting images are embedded in the exported 16024 document. This method requires dvipng program, dvisvgm or 16025 ImageMagick programs. 16026 @end table 16027 16028 @node MathML and OpenDocument formula files 16029 @subsubsection MathML and OpenDocument formula files 16030 16031 When embedding @LaTeX{} math snippets in ODT documents is not reliable, 16032 there is one more option to try. Embed an equation by linking to its 16033 MathML (@samp{.mml}) source or its OpenDocument formula (@samp{.odf}) file as 16034 shown below: 16035 16036 @example 16037 [[./equation.mml]] 16038 @end example 16039 16040 16041 @noindent 16042 or 16043 16044 @example 16045 [[./equation.odf]] 16046 @end example 16047 16048 @node Labels and captions in ODT export 16049 @subsection Labels and captions in ODT export 16050 16051 ODT format handles labeling and captioning of objects based on their 16052 types. Inline images, tables, @LaTeX{} fragments, and Math formulas are 16053 numbered and captioned separately. Each object also gets a unique 16054 sequence number based on its order of first appearance in the Org 16055 file. Each category has its own sequence. A caption is just a label 16056 applied to these objects. 16057 16058 @example 16059 #+CAPTION: Bell curve 16060 #+NAME: fig:SED-HR4049 16061 [[./img/a.png]] 16062 @end example 16063 16064 When rendered, it may show as follows in the exported document: 16065 16066 @example 16067 Figure 2: Bell curve 16068 @end example 16069 16070 16071 @vindex org-odt-category-map-alist 16072 To modify the category component of the caption, customize the option 16073 @code{org-odt-category-map-alist}. For example, to tag embedded images 16074 with the string ``Illustration'' instead of the default string ``Figure'', 16075 use the following setting: 16076 16077 @lisp 16078 (setq org-odt-category-map-alist 16079 '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p))) 16080 @end lisp 16081 16082 With the above modification, the previous example changes to: 16083 16084 @example 16085 Illustration 2: Bell curve 16086 @end example 16087 16088 @node Literal examples in ODT export 16089 @subsection Literal examples in ODT export 16090 16091 The ODT export backend supports literal examples (see @ref{Literal Examples}) with full fontification. Internally, the ODT export 16092 backend relies on @samp{htmlfontify.el} to generate the style definitions 16093 needed for fancy listings. The auto-generated styles get @samp{OrgSrc} 16094 prefix and inherit colors from the faces used by Emacs Font Lock 16095 library for that source language. 16096 16097 @vindex org-odt-fontify-srcblocks 16098 For custom fontification styles, customize the 16099 @code{org-odt-create-custom-styles-for-srcblocks} option. 16100 16101 @vindex org-odt-create-custom-styles-for-srcblocks 16102 To turn off fontification of literal examples, customize the 16103 @code{org-odt-fontify-srcblocks} option. 16104 16105 @node Advanced topics in ODT export 16106 @subsection Advanced topics in ODT export 16107 16108 The ODT export backend has extensive features useful for power users 16109 and frequent uses of ODT formats. 16110 16111 @anchor{Configuring a document converter} 16112 @subsubheading Configuring a document converter 16113 16114 @cindex convert 16115 @cindex doc, docx, rtf 16116 @cindex converter 16117 16118 The ODT export backend works with popular converters with little or 16119 no extra configuration. See @ref{Extending ODT export}. The following is 16120 for unsupported converters or tweaking existing defaults. 16121 16122 @table @asis 16123 @item Register the converter 16124 @vindex org-export-odt-convert-processes 16125 Add the name of the converter to the @code{org-odt-convert-processes} 16126 variable. Note that it also requires how the converter is invoked 16127 on the command line. See the variable's docstring for details. 16128 16129 @item Configure its capabilities 16130 @vindex org-export-odt-convert-capabilities 16131 Specify which formats the converter can handle by customizing the 16132 variable @code{org-odt-convert-capabilities}. Use the entry for the 16133 default values in this variable for configuring the new converter. 16134 Also see its docstring for details. 16135 16136 @item Choose the converter 16137 @vindex org-export-odt-convert-process 16138 Select the newly added converter as the preferred one by customizing 16139 the option @code{org-odt-convert-process}. 16140 @end table 16141 16142 @anchor{Working with OpenDocument style files} 16143 @subsubheading Working with OpenDocument style files 16144 16145 @cindex styles, custom 16146 @cindex template, custom 16147 16148 This section explores the internals of the ODT exporter; the means by which 16149 it produces styled documents; the use of automatic and custom OpenDocument 16150 styles. 16151 16152 The ODT exporter relies on two files for generating its output. These 16153 files are bundled with the distribution under the directory pointed to 16154 by the variable @code{org-odt-styles-dir}. The two files are: 16155 16156 @table @asis 16157 @item @samp{OrgOdtStyles.xml} @anchor{x-orgodtstyles-xml} 16158 This file contributes to the @samp{styles.xml} file of the final ODT 16159 document. This file gets modified for the following purposes: 16160 16161 @enumerate 16162 @item 16163 To control outline numbering based on user settings; 16164 16165 @item 16166 To add styles generated by @samp{htmlfontify.el} for fontification of 16167 code blocks. 16168 @end enumerate 16169 16170 @item @samp{OrgOdtContentTemplate.xml} @anchor{x-orgodtcontenttemplate-xml} 16171 This file contributes to the @samp{content.xml} file of the final ODT 16172 document. The contents of the Org outline are inserted between the 16173 @samp{<office:text>} @dots{} @samp{</office:text>} elements of this file. 16174 16175 Apart from serving as a template file for the final @samp{content.xml}, 16176 the file serves the following purposes: 16177 16178 @enumerate 16179 @item 16180 It contains automatic styles for formatting of tables which are 16181 referenced by the exporter; 16182 16183 @item 16184 It contains @samp{<text:sequence-decl>} @dots{} @samp{</text:sequence-decl>} 16185 elements that control numbering of tables, images, equations, and 16186 similar entities. 16187 @end enumerate 16188 @end table 16189 16190 @anchor{x-overriding-factory-styles} The following two variables control 16191 the location from where the ODT exporter picks up the custom styles 16192 and content template files. Customize these variables to override the 16193 factory styles used by the exporter. 16194 16195 @table @asis 16196 @item @code{org-odt-styles-file} 16197 The ODT export backend uses the file pointed to by this variable, 16198 such as @samp{styles.xml}, for the final output. It can take one of the 16199 following values: 16200 16201 @table @asis 16202 @item @samp{FILE.xml} 16203 Use this file instead of the default @samp{styles.xml} 16204 16205 @item @samp{FILE.odt} or @samp{FILE.ott} 16206 Use the @samp{styles.xml} contained in the specified OpenDocument 16207 Text or Template file 16208 16209 @item @samp{FILE.odt} or @samp{FILE.ott} and a subset of included files 16210 Use the @samp{styles.xml} contained in the specified OpenDocument Text 16211 or Template file. Additionally extract the specified member files 16212 and embed those within the final ODT document. 16213 16214 Use this option if the @samp{styles.xml} file references additional 16215 files like header and footer images. 16216 16217 @item @code{nil} 16218 Use the default @samp{styles.xml}. 16219 @end table 16220 16221 @item @code{org-odt-content-template-file} 16222 Use this variable to specify the blank @samp{content.xml} used in the 16223 final output. 16224 @end table 16225 16226 @anchor{Creating one-off styles} 16227 @subsubheading Creating one-off styles 16228 16229 The ODT export backend can read embedded raw OpenDocument XML from 16230 the Org file. Such direct formatting is useful for one-off instances. 16231 16232 @table @asis 16233 @item Embedding ODT tags as part of regular text 16234 Enclose OpenDocument syntax in @samp{@@@@odt:...@@@@} for inline markup. For 16235 example, to highlight a region of text do the following: 16236 16237 @example 16238 @@@@odt:<text:span text:style-name="Highlight">This is highlighted 16239 text</text:span>@@@@. But this is regular text. 16240 @end example 16241 16242 @strong{Hint:} To see the above example in action, edit the @samp{styles.xml} 16243 (see @ref{x-orgodtstyles-xml, , Factory styles}) and add a custom @emph{Highlight} style as shown 16244 below: 16245 16246 @example 16247 <style:style style:name="Highlight" style:family="text"> 16248 <style:text-properties fo:background-color="#ff0000"/> 16249 </style:style> 16250 @end example 16251 16252 @item Embedding a one-line OpenDocument XML 16253 @cindex @samp{ODT}, keyword 16254 The ODT export backend can read one-liner options with @samp{#+ODT:} in 16255 the Org file. For example, to force a page break: 16256 16257 @example 16258 #+ODT: <text:p text:style-name="PageBreak"/> 16259 @end example 16260 16261 @strong{Hint:} To see the above example in action, edit your 16262 @samp{styles.xml} (see @ref{x-orgodtstyles-xml, , Factory styles}) and add a custom @samp{PageBreak} 16263 style as shown below. 16264 16265 @example 16266 <style:style style:name="PageBreak" style:family="paragraph" 16267 style:parent-style-name="Text_20_body"> 16268 <style:paragraph-properties fo:break-before="page"/> 16269 </style:style> 16270 @end example 16271 16272 @item Embedding a block of OpenDocument XML 16273 The ODT export backend can also read ODT export blocks for 16274 OpenDocument XML@. Such blocks use the @samp{#+BEGIN_EXPORT odt} 16275 @dots{} @samp{#+END_EXPORT} constructs. 16276 16277 For example, to create a one-off paragraph that uses bold text, do 16278 the following: 16279 16280 @example 16281 #+BEGIN_EXPORT odt 16282 <text:p text:style-name="Text_20_body_20_bold"> 16283 This paragraph is specially formatted and uses bold text. 16284 </text:p> 16285 #+END_EXPORT 16286 @end example 16287 @end table 16288 16289 @anchor{Customizing tables in ODT export} 16290 @subsubheading Customizing tables in ODT export 16291 16292 @cindex tables, in ODT export 16293 @cindex @samp{ATTR_ODT}, keyword 16294 16295 Override the default table format by specifying a custom table style 16296 with the @samp{#+ATTR_ODT} line. For a discussion on default formatting of 16297 tables, see @ref{Tables in ODT export}. 16298 16299 This feature closely mimics the way table templates are defined in the 16300 OpenDocument-v1.2 specification@footnote{ 16301 @uref{https://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, OpenDocument-v1.2 16302 Specification}}. 16303 16304 @vindex org-odt-table-styles 16305 For quick preview of this feature, install the settings below and export the 16306 table that follows: 16307 16308 @lisp 16309 (setq org-export-odt-table-styles 16310 (append org-export-odt-table-styles 16311 '(("TableWithHeaderRowAndColumn" "Custom" 16312 ((use-first-row-styles . t) 16313 (use-first-column-styles . t))) 16314 ("TableWithFirstRowandLastRow" "Custom" 16315 ((use-first-row-styles . t) 16316 (use-last-row-styles . t)))))) 16317 @end lisp 16318 16319 @example 16320 #+ATTR_ODT: :style TableWithHeaderRowAndColumn 16321 | Name | Phone | Age | 16322 | Peter | 1234 | 17 | 16323 | Anna | 4321 | 25 | 16324 @end example 16325 16326 The example above used @samp{Custom} template and installed two table 16327 styles @samp{TableWithHeaderRowAndColumn} and 16328 @samp{TableWithFirstRowandLastRow}. @strong{Important:} The OpenDocument styles 16329 needed for producing the above template were pre-defined. They are 16330 available in the section marked @samp{Custom Table Template} in 16331 @samp{OrgOdtContentTemplate.xml} (see @ref{x-orgodtcontenttemplate-xml, , Factory styles}). For adding new 16332 templates, define new styles there. 16333 16334 To use this feature proceed as follows: 16335 16336 @enumerate 16337 @item 16338 Create a table template@footnote{ See the @samp{<table:table-template>} 16339 element of the OpenDocument-v1.2 specification.}. 16340 16341 A table template is set of @samp{table-cell} and @samp{paragraph} styles for 16342 each of the following table cell categories: 16343 16344 @itemize 16345 @item 16346 Body 16347 @item 16348 First column 16349 @item 16350 Last column 16351 @item 16352 First row 16353 @item 16354 Last row 16355 @item 16356 Even row 16357 @item 16358 Odd row 16359 @item 16360 Even column 16361 @item 16362 Odd Column 16363 @end itemize 16364 16365 The names for the above styles must be chosen based on the name of 16366 the table template using a well-defined convention. 16367 16368 The naming convention is better illustrated with an example. For 16369 a table template with the name @samp{Custom}, the needed style names are 16370 listed in the following table. 16371 16372 @multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 16373 @headitem Cell type 16374 @tab Cell style 16375 @tab Paragraph style 16376 @item Body 16377 @tab @samp{CustomTableCell} 16378 @tab @samp{CustomTableParagraph} 16379 @item First column 16380 @tab @samp{CustomFirstColumnTableCell} 16381 @tab @samp{CustomFirstColumnTableParagraph} 16382 @item Last column 16383 @tab @samp{CustomLastColumnTableCell} 16384 @tab @samp{CustomLastColumnTableParagraph} 16385 @item First row 16386 @tab @samp{CustomFirstRowTableCell} 16387 @tab @samp{CustomFirstRowTableParagraph} 16388 @item Last row 16389 @tab @samp{CustomLastRowTableCell} 16390 @tab @samp{CustomLastRowTableParagraph} 16391 @item Even row 16392 @tab @samp{CustomEvenRowTableCell} 16393 @tab @samp{CustomEvenRowTableParagraph} 16394 @item Odd row 16395 @tab @samp{CustomOddRowTableCell} 16396 @tab @samp{CustomOddRowTableParagraph} 16397 @item Even column 16398 @tab @samp{CustomEvenColumnTableCell} 16399 @tab @samp{CustomEvenColumnTableParagraph} 16400 @item Odd column 16401 @tab @samp{CustomOddColumnTableCell} 16402 @tab @samp{CustomOddColumnTableParagraph} 16403 @end multitable 16404 16405 To create a table template with the name @samp{Custom}, define the above 16406 styles in the @samp{<office:automatic-styles>} @dots{} 16407 @samp{</office:automatic-styles>} element of the content template file 16408 (see @ref{x-orgodtcontenttemplate-xml, , Factory styles}). 16409 16410 @item 16411 Define a table style@footnote{ See the attributes @samp{table:template-name}, 16412 @samp{table:use-first-row-styles}, @samp{table:use-last-row-styles}, 16413 @samp{table:use-first-column-styles}, @samp{table:use-last-column-styles}, 16414 @samp{table:use-banding-rows-styles}, and 16415 @samp{table:use-banding-column-styles} of the @samp{<table:table>} element in 16416 the OpenDocument-v1.2 specification.}. 16417 16418 @vindex org-odt-table-styles 16419 To define a table style, create an entry for the style in the 16420 variable @code{org-odt-table-styles} and specify the following: 16421 16422 @itemize 16423 @item 16424 the name of the table template created in step (1), 16425 @item 16426 the set of cell styles in that template that are to be activated. 16427 @end itemize 16428 16429 For example, the entry below defines two different table styles 16430 @samp{TableWithHeaderRowAndColumn} and @samp{TableWithFirstRowandLastRow} 16431 based on the same template @samp{Custom}. The styles achieve their 16432 intended effect by selectively activating the individual cell 16433 styles in that template. 16434 16435 @lisp 16436 (setq org-export-odt-table-styles 16437 (append org-export-odt-table-styles 16438 '(("TableWithHeaderRowAndColumn" "Custom" 16439 ((use-first-row-styles . t) 16440 (use-first-column-styles . t))) 16441 ("TableWithFirstRowandLastRow" "Custom" 16442 ((use-first-row-styles . t) 16443 (use-last-row-styles . t)))))) 16444 @end lisp 16445 16446 @item 16447 Associate a table with the table style. 16448 16449 To do this, specify the table style created in step (2) as part of 16450 the @samp{ATTR_ODT} line as shown below. 16451 16452 @example 16453 #+ATTR_ODT: :style TableWithHeaderRowAndColumn 16454 | Name | Phone | Age | 16455 | Peter | 1234 | 17 | 16456 | Anna | 4321 | 25 | 16457 @end example 16458 @end enumerate 16459 16460 @anchor{Validating OpenDocument XML} 16461 @subsubheading Validating OpenDocument XML 16462 16463 Sometimes ODT format files may not open due to @samp{.odt} file corruption. 16464 To verify if such a file is corrupt, validate it against the 16465 OpenDocument Relax NG Compact (RNC) syntax schema. But first the 16466 @samp{.odt} files have to be decompressed using @samp{zip}. Note that @samp{.odt} 16467 files are ZIP archives: @ref{File Archives,,,emacs,}. The contents of 16468 ODT files are in XML@. For general help with validation---and 16469 schema-sensitive editing---of XML files: @ref{Introduction,,,nxml-mode,}. 16470 16471 @vindex org-export-odt-schema-dir 16472 Customize @code{org-odt-schema-dir} to point to a directory with 16473 OpenDocument RNC files and the needed schema-locating rules. The ODT 16474 export backend takes care of updating the 16475 @code{rng-schema-locating-files}. 16476 16477 @node Org Export 16478 @section Org Export 16479 16480 @cindex Org export 16481 @emph{org} export backend creates a normalized version of the Org document 16482 in current buffer. The exporter evaluates Babel code (see @ref{Evaluating Code Blocks}) and removes content specific to other backends. 16483 16484 @anchor{Org export commands} 16485 @subheading Org export commands 16486 16487 @table @asis 16488 @item @kbd{C-c C-e O o} (@code{org-org-export-to-org}) 16489 @kindex C-c C-e O o 16490 @findex org-org-export-to-org 16491 Export as an Org file with a @samp{.org} extension. For @samp{myfile.org}, 16492 Org exports to @samp{myfile.org.org}, overwriting without warning. 16493 16494 @item @kbd{C-c C-e O v} (~~) 16495 @kindex C-c C-e O v 16496 Export to an Org file, then open it. 16497 @end table 16498 16499 @node Texinfo Export 16500 @section Texinfo Export 16501 16502 @menu 16503 * Texinfo export commands:: Invoking commands. 16504 * Texinfo specific export settings:: Setting the environment. 16505 * Texinfo file header:: Generating the header. 16506 * Texinfo title and copyright page:: Creating preamble pages. 16507 * Info directory file:: Installing a manual in Info file hierarchy. 16508 * Headings and sectioning structure:: Building document structure. 16509 * Indices:: Creating indices. 16510 * Quoting Texinfo code:: Incorporating literal Texinfo code. 16511 * Plain lists in Texinfo export:: List attributes. 16512 * Tables in Texinfo export:: Table attributes. 16513 * Images in Texinfo export:: Image attributes. 16514 * Quotations in Texinfo export:: Quote block attributes. 16515 * Key bindings in Texinfo export:: @@kbd Texinfo command. 16516 * Special blocks in Texinfo export:: Special block attributes. 16517 * A Texinfo example:: Processing Org to Texinfo. 16518 @end menu 16519 16520 @node Texinfo export commands 16521 @subsection Texinfo export commands 16522 16523 @table @asis 16524 @item @kbd{C-c C-e i t} (@code{org-texinfo-export-to-texinfo}) 16525 @kindex C-c C-e i t 16526 @findex org-texinfo-export-to-texinfo 16527 Export as a Texinfo file with @samp{.texi} extension. For @samp{myfile.org}, 16528 Org exports to @samp{myfile.texi}, overwriting without warning. 16529 16530 @item @kbd{C-c C-e i i} (@code{org-texinfo-export-to-info}) 16531 @kindex C-c C-e i i 16532 @findex org-texinfo-export-to-info 16533 @vindex org-texinfo-info-process 16534 Export to Texinfo format first and then process it to make an Info 16535 file. To generate other formats, such as DocBook, customize the 16536 @code{org-texinfo-info-process} variable. 16537 @end table 16538 16539 @node Texinfo specific export settings 16540 @subsection Texinfo specific export settings 16541 16542 The Texinfo export backend has several additional keywords for 16543 customizing Texinfo output. Setting these keywords works similar to 16544 the general options (see @ref{Export Settings}). 16545 16546 @table @asis 16547 @item @samp{SUBTITLE} 16548 @cindex @samp{SUBTITLE}, keyword 16549 The document subtitle. 16550 16551 @item @samp{SUBAUTHOR} 16552 @cindex @samp{SUBAUTHOR}, keyword 16553 Additional authors for the document. 16554 16555 @item @samp{TEXINFO_FILENAME} 16556 @cindex @samp{TEXINFO_FILENAME}, keyword 16557 The Texinfo filename. 16558 16559 @item @samp{TEXINFO_CLASS} 16560 @cindex @samp{TEXINFO_CLASS}, keyword 16561 @vindex org-texinfo-default-class 16562 The default document class (@code{org-texinfo-default-class}), which must 16563 be a member of @code{org-texinfo-classes}. 16564 16565 @item @samp{TEXINFO_HEADER} 16566 @cindex @samp{TEXINFO_HEADER}, keyword 16567 Arbitrary lines inserted at the end of the header. 16568 16569 @item @samp{TEXINFO_POST_HEADER} 16570 @cindex @samp{TEXINFO_POST_HEADER}, keyword 16571 Arbitrary lines inserted after the end of the header. 16572 16573 @item @samp{TEXINFO_DIR_CATEGORY} 16574 @cindex @samp{TEXINFO_DIR_CATEGORY}, keyword 16575 The directory category of the document. Defaults to @code{Misc}. 16576 16577 @item @samp{TEXINFO_DIR_NAME} 16578 @cindex @samp{TEXINFO_DIR_NAME}, keyword 16579 The directory name of the document. 16580 This is the short name under which the @code{m} command will find your 16581 manual in the main Info directory. It defaults to the base name of 16582 the Texinfo file. 16583 16584 The full form of the Texinfo entry is @code{* DIRNAME: NODE.} where @code{NODE} 16585 is usually just @code{(FILENAME)}. Normally this option only provides the 16586 @code{DIRNAME} part, but if you need more control, it can also be the full 16587 entry (recognized by the presence of parentheses or a leading ~* ~). 16588 16589 @item @samp{TEXINFO_DIR_DESC} 16590 @cindex @samp{TEXINFO_DIR_DESC}, keyword 16591 The directory description of the document. 16592 Defaults to the title of the document. 16593 16594 @item @samp{TEXINFO_PRINTED_TITLE} 16595 @cindex @samp{TEXINFO_PRINTED_TITLE}, keyword 16596 The printed title of the document. 16597 @end table 16598 16599 @node Texinfo file header 16600 @subsection Texinfo file header 16601 16602 @cindex @samp{TEXINFO_FILENAME}, keyword 16603 After creating the header for a Texinfo file, the Texinfo backend 16604 automatically generates a name and destination path for the Info file. 16605 To override this default with a more sensible path and name, specify 16606 the @samp{TEXINFO_FILENAME} keyword. 16607 16608 @vindex org-texinfo-coding-system 16609 @cindex @samp{TEXINFO_HEADER}, keyword 16610 Along with the output's file name, the Texinfo header also contains 16611 language details (see @ref{Export Settings}) and encoding system as set in 16612 the @code{org-texinfo-coding-system} variable. Insert @samp{TEXINFO_HEADER} 16613 keywords for each additional command in the header, for example: 16614 16615 @example 16616 #+TEXINFO_HEADER: @@synindex 16617 @end example 16618 16619 16620 @cindex @samp{TEXINFO_CLASS}, keyword 16621 @vindex org-texinfo-classes 16622 Instead of repeatedly installing the same set of commands, define 16623 a class in @code{org-texinfo-classes} once, and then activate it in the 16624 document by setting the @samp{TEXINFO_CLASS} keyword to that class. 16625 16626 @node Texinfo title and copyright page 16627 @subsection Texinfo title and copyright page 16628 16629 @cindex @samp{TEXINFO_PRINTED_TITLE}, keyword 16630 The default template for hard copy output has a title page with 16631 @samp{TITLE} and @samp{AUTHOR} keywords (see @ref{Export Settings}). To replace the 16632 regular title with something different for the printed version, use 16633 the @samp{TEXINFO_PRINTED_TITLE} and @samp{SUBTITLE} keywords. Both expect raw 16634 Texinfo code for setting their values. 16635 16636 @cindex @samp{SUBAUTHOR}, keyword 16637 If one @samp{AUTHOR} line is not sufficient, add multiple @samp{SUBAUTHOR} 16638 keywords. They have to be set in raw Texinfo code. 16639 16640 @example 16641 #+AUTHOR: Jane Smith 16642 #+SUBAUTHOR: John Doe 16643 #+TEXINFO_PRINTED_TITLE: This Long Title@@@@inlinefmt@{tex,@@*@} Is Broken in @@TeX@{@} 16644 @end example 16645 16646 @cindex @samp{COPYING}, property 16647 Copying material is defined in a dedicated headline with a non-@code{nil} 16648 @samp{COPYING} property. The backend inserts the contents within 16649 a @samp{@@copying} command at the beginning of the document. The heading 16650 itself does not appear in the structure of the document. 16651 16652 Copyright information is printed on the back of the title page. 16653 16654 @example 16655 * Legalese 16656 :PROPERTIES: 16657 :COPYING: t 16658 :END: 16659 16660 This is a short example of a complete Texinfo file, version 1.0. 16661 16662 Copyright \copy 2016 Free Software Foundation, Inc. 16663 @end example 16664 16665 @node Info directory file 16666 @subsection Info directory file 16667 16668 @cindex @samp{dir} file, in Texinfo export 16669 @cindex Info directory file, in Texinfo export 16670 @cindex @code{install-info}, in Texinfo export 16671 16672 @cindex @samp{TEXINFO_DIR_CATEGORY}, keyword 16673 @cindex @samp{TEXINFO_DIR_NAME}, keyword 16674 @cindex @samp{TEXINFO_DIR_DESC}, keyword 16675 The end result of the Texinfo export process is the creation of an 16676 Info file. This Info file's metadata has variables for category, 16677 title, and description: @samp{TEXINFO_DIR_CATEGORY}, @samp{TEXINFO_DIR_NAME}, 16678 and @samp{TEXINFO_DIR_DESC} keywords that establish where in the Info 16679 hierarchy the file fits. 16680 16681 Here is an example that writes to the Info directory file: 16682 16683 @example 16684 #+TEXINFO_DIR_CATEGORY: Emacs 16685 #+TEXINFO_DIR_NAME: Org Mode 16686 #+TEXINFO_DIR_DESC: Outline-based notes management and organizer 16687 @end example 16688 16689 @node Headings and sectioning structure 16690 @subsection Headings and sectioning structure 16691 16692 @vindex org-texinfo-classes 16693 @vindex org-texinfo-default-class 16694 @cindex @samp{TEXINFO_CLASS}, keyword 16695 The Texinfo export backend uses a pre-defined scheme to convert Org 16696 headlines to equivalent Texinfo structuring commands. A scheme like 16697 this maps top-level headlines to numbered chapters tagged as 16698 @code{@@chapter} and lower-level headlines to unnumbered chapters tagged as 16699 @code{@@unnumbered}. To override such mappings to introduce @code{@@part} or 16700 other Texinfo structuring commands, define a new class in 16701 @code{org-texinfo-classes}. Activate the new class with the 16702 @samp{TEXINFO_CLASS} keyword. When no new class is defined and activated, 16703 the Texinfo export backend defaults to the 16704 @code{org-texinfo-default-class}. 16705 16706 If an Org headline's level has no associated Texinfo structuring 16707 command, or is below a certain threshold (see @ref{Export Settings}), then 16708 the Texinfo export backend makes it into a list item. 16709 16710 @cindex @samp{APPENDIX}, property 16711 The Texinfo export backend makes any headline with a non-@code{nil} 16712 @samp{APPENDIX} property into an appendix. This happens independent of the 16713 Org headline level or the @samp{TEXINFO_CLASS} keyword. 16714 16715 @cindex @samp{ALT_TITLE}, property 16716 @cindex @samp{DESCRIPTION}, property 16717 The Texinfo export backend creates a menu entry after the Org 16718 headline for each regular sectioning structure. To override this with 16719 a shorter menu entry, use the @samp{ALT_TITLE} property (see @ref{Table of Contents}). Texinfo menu entries also have an option for a longer 16720 @samp{DESCRIPTION} property. Here's an example that uses both to override 16721 the default menu entry: 16722 16723 @example 16724 * Controlling Screen Display 16725 :PROPERTIES: 16726 :ALT_TITLE: Display 16727 :DESCRIPTION: Controlling Screen Display 16728 :END: 16729 @end example 16730 16731 @cindex Top node, in Texinfo export 16732 The text before the first headline belongs to the @emph{Top} node, i.e., 16733 the node in which a reader enters an Info manual. As such, it is 16734 expected not to appear in printed output generated from the @samp{.texi} 16735 file. See @ref{The Top Node,,,texinfo,}, for more information. 16736 16737 @node Indices 16738 @subsection Indices 16739 16740 @cindex @samp{CINDEX}, keyword 16741 @cindex concept index, in Texinfo export 16742 @cindex @samp{FINDEX}, keyword 16743 @cindex function index, in Texinfo export 16744 @cindex @samp{KINDEX}, keyword 16745 @cindex keystroke index, in Texinfo export 16746 @cindex @samp{PINDEX}, keyword 16747 @cindex program index, in Texinfo export 16748 @cindex @samp{TINDEX}, keyword 16749 @cindex data type index, in Texinfo export 16750 @cindex @samp{VINDEX}, keyword 16751 @cindex variable index, in Texinfo export 16752 The Texinfo export backend recognizes these indexing keywords if used 16753 in the Org file: @samp{CINDEX}, @samp{FINDEX}, @samp{KINDEX}, @samp{PINDEX}, @samp{TINDEX} and 16754 @samp{VINDEX}. Write their value as verbatim Texinfo code; in particular, 16755 @samp{@{}, @samp{@}} and @samp{@@} characters need to be escaped with @samp{@@} if they do not 16756 belong to a Texinfo command. 16757 16758 @example 16759 #+CINDEX: Defining indexing entries 16760 @end example 16761 16762 16763 @cindex @samp{INDEX}, property 16764 For the backend to generate an index entry for a headline, set the 16765 @samp{INDEX} property to @samp{cp} or @samp{vr}. These abbreviations come from 16766 Texinfo that stand for concept index and variable index. The Texinfo 16767 manual has abbreviations for all other kinds of indexes. The backend 16768 exports the headline as an unnumbered chapter or section command, and 16769 then inserts the index after its contents. 16770 16771 @example 16772 * Concept Index 16773 :PROPERTIES: 16774 :INDEX: cp 16775 :END: 16776 @end example 16777 16778 @node Quoting Texinfo code 16779 @subsection Quoting Texinfo code 16780 16781 Use any of the following three methods to insert or escape raw Texinfo 16782 code: 16783 16784 @cindex @samp{TEXINFO}, keyword 16785 @cindex @samp{BEGIN_EXPORT texinfo} 16786 @example 16787 Richard @@@@texinfo:@@sc@{@@@@Stallman@@@@texinfo:@}@@@@ commence' GNU. 16788 16789 #+TEXINFO: @@need800 16790 This paragraph is preceded by... 16791 16792 #+BEGIN_EXPORT texinfo 16793 @@auindex Johnson, Mark 16794 @@auindex Lakoff, George 16795 #+END_EXPORT 16796 @end example 16797 16798 @node Plain lists in Texinfo export 16799 @subsection Plain lists in Texinfo export 16800 16801 @cindex lettered lists, in Texinfo export 16802 @cindex enum, Texinfo attribute 16803 The Texinfo export backend converts unordered and ordered lists in 16804 the Org file using the default command @samp{@@itemize}. 16805 16806 Ordered lists are numbered when exported to Texinfo format. Such 16807 numbering obeys any counter (see @ref{Plain Lists}) in the first item of 16808 the list. The @samp{:enum} attribute also let you start the list at a 16809 specific number, or switch to a lettered list, as illustrated here: 16810 16811 @example 16812 #+ATTR_TEXINFO: :enum A 16813 1. Alpha 16814 2. Bravo 16815 3. Charlie 16816 @end example 16817 16818 @cindex @samp{ATTR_TEXINFO}, keyword 16819 @cindex two-column tables, in Texinfo export 16820 @cindex table-type, Texinfo attribute 16821 The Texinfo export backend by default converts description lists in 16822 the Org file using the default command @samp{@@table}, which results in 16823 a table with two columns. To change this behavior, set @samp{:table-type} 16824 attribute to either @samp{ftable} or @samp{vtable} value. For more information, 16825 see @ref{Two-column Tables,,,texinfo,}. 16826 16827 @vindex org-texinfo-table-default-markup 16828 @cindex indic, Texinfo attribute 16829 The Texinfo export backend by default also applies a text highlight 16830 based on the defaults stored in @code{org-texinfo-table-default-markup}. 16831 To override the default highlight command, specify another one with 16832 the @samp{:indic} attribute. 16833 16834 @cindex multiple items in Texinfo lists 16835 @cindex sep, Texinfo attribute 16836 Org syntax is limited to one entry per list item. Nevertheless, the 16837 Texinfo export backend can split that entry according to any text 16838 provided through the @samp{:sep} attribute. Each part then becomes a new 16839 entry in the first column of the table. 16840 16841 The following example illustrates all the attributes above: 16842 16843 @example 16844 #+ATTR_TEXINFO: :table-type vtable :sep , :indic asis 16845 - foo, bar :: This is the common text for variables foo and bar. 16846 @end example 16847 16848 @noindent 16849 becomes 16850 16851 @example 16852 @@vtable @@asis 16853 @@item foo 16854 @@itemx bar 16855 This is the common text for variables foo and bar. 16856 @@end table 16857 @end example 16858 16859 The @samp{:compact} attribute is an alternative to the @samp{:sep} attribute, 16860 which allows writing each entry on its own line. If this attribute is 16861 non-@code{nil} and an item in a description list has no body but is 16862 followed by another item, then the second item is transcoded to 16863 @samp{@@itemx}. This example is transcoded to the same output as above. 16864 16865 @example 16866 #+ATTR_TEXINFO: :table-type vtable :indic asis :compact t 16867 - foo :: 16868 - bar :: 16869 This is the common text for variables foo and bar. 16870 @end example 16871 16872 Support for this compact syntax can also be enabled for all lists in 16873 a file using the @samp{compact-itemx} export option, or globally using the 16874 variable @code{org-texinfo-compact-itemx}. 16875 16876 The Texinfo export backend also supports two approaches to writing 16877 Texinfo definition commands (see @ref{Definition Commands,,,texinfo,}). 16878 One of them uses description lists and is described below, the other 16879 relies on special blocks (see @ref{Special blocks in Texinfo export}). 16880 16881 Items in a description list in an Org file that begin with @samp{Function:} 16882 or certain other prefixes are converted using Texinfo definition 16883 commands. This works even if other items in the same list do not have 16884 such a prefix; if necessary a single description list is converted 16885 using multiple tables (such as @samp{@@vtable}) and definition commands 16886 (such as @samp{@@defun}). 16887 16888 @example 16889 - Function: org-texinfo-drawer drawer contents info :: 16890 Transcode a DRAWER element from Org to Texinfo. 16891 @end example 16892 16893 @noindent 16894 becomes 16895 16896 @example 16897 @@defun org-texinfo-drawer drawer contents info :: 16898 Transcode a DRAWER element from Org to Texinfo. 16899 @@end defun 16900 @end example 16901 16902 The recognized prefixes are @samp{Command:}, @samp{Function:}, @samp{Macro:}, 16903 @samp{Special Form:}, @samp{Variable:} and @samp{User Option:}. These are the same 16904 prefixes that appear in the Info file for the respective definition 16905 commands. For example a @samp{Function:} item in the Org file is converted 16906 to a @samp{@@defun} command in the Texinfo file, which in turn is converted 16907 to a definition prefixed with @samp{-- Function:} in the Info file. 16908 16909 As a special case the prefix @samp{Key:} is also recognized. No Texinfo 16910 definition command exists for key bindings and the output in Info 16911 files also lacks the @samp{Key:} prefix. Even so this special case is 16912 supported because it provides a convenient shorthand, as illustrated 16913 here: 16914 16915 @example 16916 - Key: C-c C-c (do-something) :: 16917 This command does something. 16918 16919 - User Option: do-something-somehow :: 16920 This option controls how exactly ~do-something~ does its thing. 16921 @end example 16922 16923 @noindent 16924 becomes 16925 16926 @example 16927 @@table @@asis 16928 @@item @@kbd@{C-c C-c@} (@@code@{do-something@}) 16929 @@kindex C-c C-c 16930 @@findex do-something 16931 This command does something. 16932 @@end table 16933 16934 @@defopt do-something-somehow 16935 This option controls how exactly @@code@{do-something@} does its thing. 16936 @@end defopt 16937 @end example 16938 16939 @noindent 16940 Command in parenthesis, as done above, is optional. 16941 16942 @node Tables in Texinfo export 16943 @subsection Tables in Texinfo export 16944 16945 @cindex @samp{ATTR_TEXINFO}, keyword 16946 When exporting tables, the Texinfo export backend uses the widest 16947 cell width in each column. To override this and instead specify as 16948 fractions of line length, use the @samp{:columns} attribute. See example 16949 below. 16950 16951 @example 16952 #+ATTR_TEXINFO: :columns .5 .5 16953 | a cell | another cell | 16954 @end example 16955 16956 @node Images in Texinfo export 16957 @subsection Images in Texinfo export 16958 16959 @cindex @samp{ATTR_TEXINFO}, keyword 16960 Insert a file link to the image in the Org file, and the Texinfo 16961 export backend inserts the image. These links must have the usual 16962 supported image extensions and no descriptions. To scale the image, 16963 use @samp{:width} and @samp{:height} attributes. For alternate text, use @samp{:alt} 16964 and specify the text using Texinfo code, as shown in the example: 16965 16966 @example 16967 #+ATTR_TEXINFO: :width 1in :alt Alternate @@i@{text@} 16968 [[ridt.pdf]] 16969 @end example 16970 16971 @node Quotations in Texinfo export 16972 @subsection Quotations in Texinfo export 16973 16974 @cindex @samp{ATTR_TEXINFO}, keyword 16975 You can write the text of a quotation within a quote block (see 16976 @ref{Paragraphs}). You may also emphasize some text at the beginning of 16977 the quotation with the @samp{:tag} attribute. 16978 16979 @example 16980 #+ATTR_TEXINFO: :tag Warning 16981 #+BEGIN_QUOTE 16982 Striking your thumb with a hammer may cause severe pain and discomfort. 16983 #+END_QUOTE 16984 @end example 16985 16986 To specify the author of the quotation, use the @samp{:author} attribute. 16987 16988 @example 16989 #+ATTR_TEXINFO: :author King Arthur 16990 #+BEGIN_QUOTE 16991 The Lady of the Lake, her arm clad in the purest shimmering samite, 16992 held aloft Excalibur from the bosom of the water, signifying by divine 16993 providence that I, Arthur, was to carry Excalibur. That is why I am 16994 your king. 16995 #+END_QUOTE 16996 @end example 16997 16998 @node Key bindings in Texinfo export 16999 @subsection Key bindings in Texinfo export 17000 17001 Org does not provide any markup for key bindings that corresponds to 17002 Texinfo's @code{@@kbd} and @code{@@key} commands. One way to deal with this is to 17003 fall back to code syntax. @samp{~C-x SPC~}, for example, is transcoded to 17004 @code{@@code@{C-x SPC@}}. 17005 17006 A better approach is to define and use an Org macro named @code{kbd}. To 17007 make that easier the function @code{org-texinfo-kbd-macro} is provided, 17008 which is intended to be used like this: 17009 17010 @example 17011 #+macro: kbd (eval (org-texinfo-kbd-macro $1)) 17012 17013 Type @{@{@{kbd(C-c SPC)@}@}@}. 17014 @end example 17015 17016 @noindent 17017 which becomes 17018 17019 @example 17020 Type @@kbd@{C-c @@key@{SPC@}@}. 17021 @end example 17022 17023 @node Special blocks in Texinfo export 17024 @subsection Special blocks in Texinfo export 17025 17026 The Texinfo export backend supports two approaches to writing Texinfo 17027 definition commands. One of them is described here, the other in 17028 @ref{Plain lists in Texinfo export}. 17029 17030 @cindex @samp{ATTR_TEXINFO}, keyword 17031 17032 The Texinfo export backend converts special blocks to commands with 17033 the same name. It also adds any @samp{:options} attributes to the end of 17034 the command, as shown in this example: 17035 17036 @example 17037 #+ATTR_TEXINFO: :options org-org-export-to-org ... 17038 #+BEGIN_defun 17039 A somewhat obsessive function name. 17040 #+END_defun 17041 @end example 17042 17043 @noindent 17044 becomes 17045 17046 @example 17047 @@defun org-org-export-to-org ... 17048 A somewhat obsessive function name. 17049 @@end defun 17050 @end example 17051 17052 @node A Texinfo example 17053 @subsection A Texinfo example 17054 17055 Here is a more detailed example Org file. See 17056 @ref{GNU Sample Texts,,,texinfo,} for an equivalent example using 17057 Texinfo code. 17058 17059 @example 17060 #+TITLE: GNU Sample @{@{@{version@}@}@} 17061 #+SUBTITLE: for version @{@{@{version@}@}@}, @{@{@{updated@}@}@} 17062 #+AUTHOR: A.U. Thor 17063 #+EMAIL: bug-sample@@gnu.org 17064 17065 #+OPTIONS: ':t toc:t author:t email:t 17066 #+LANGUAGE: en 17067 17068 #+MACRO: version 2.0 17069 #+MACRO: updated last updated 4 March 2014 17070 17071 #+TEXINFO_FILENAME: sample.info 17072 #+TEXINFO_HEADER: @@syncodeindex pg cp 17073 17074 #+TEXINFO_DIR_CATEGORY: Texinfo documentation system 17075 #+TEXINFO_DIR_NAME: sample 17076 #+TEXINFO_DIR_DESC: Invoking sample 17077 17078 #+TEXINFO_PRINTED_TITLE: GNU Sample 17079 17080 This manual is for GNU Sample (version @{@{@{version@}@}@}, 17081 @{@{@{updated@}@}@}). 17082 17083 * Copying 17084 :PROPERTIES: 17085 :COPYING: t 17086 :END: 17087 17088 This manual is for GNU Sample (version @{@{@{version@}@}@}, 17089 @{@{@{updated@}@}@}), which is an example in the Texinfo documentation. 17090 17091 Copyright \copy 2016 Free Software Foundation, Inc. 17092 17093 #+BEGIN_QUOTE 17094 Permission is granted to copy, distribute and/or modify this 17095 document under the terms of the GNU Free Documentation License, 17096 Version 1.3 or any later version published by the Free Software 17097 Foundation; with no Invariant Sections, with no Front-Cover Texts, 17098 and with no Back-Cover Texts. A copy of the license is included in 17099 the section entitled "GNU Free Documentation License". 17100 #+END_QUOTE 17101 17102 * Invoking sample 17103 17104 #+PINDEX: sample 17105 #+CINDEX: invoking @@command@{sample@} 17106 17107 This is a sample manual. There is no sample program to invoke, but 17108 if there were, you could see its basic usage and command line 17109 options here. 17110 17111 * GNU Free Documentation License 17112 :PROPERTIES: 17113 :APPENDIX: t 17114 :END: 17115 17116 #+INCLUDE: fdl.org 17117 17118 * Index 17119 :PROPERTIES: 17120 :INDEX: cp 17121 :END: 17122 @end example 17123 17124 @node iCalendar Export 17125 @section iCalendar Export 17126 17127 @cindex iCalendar export 17128 17129 A large part of Org mode's interoperability success is its ability to 17130 easily export to or import from external applications. The iCalendar 17131 export backend takes calendar data from Org files and exports to the 17132 standard iCalendar format. 17133 17134 @vindex icalendar-export-sexp-enumeration-days 17135 By default, iCalendar export only includes headings that contain 17136 active timestamps or diary sexps@footnote{ Diary sexp events, except 17137 certain built-in types (see @code{icalendar-export-sexp-enumerate-all}), 17138 are exported up to @code{icalendar-export-sexp-enumeration-days} into 17139 future.}. 17140 17141 @vindex org-icalendar-include-todo 17142 The iCalendar export backend can also incorporate TODO entries based 17143 on the configuration of the @code{org-icalendar-include-todo} variable. 17144 The backend exports plain timestamps as @samp{VEVENT}, TODO items as 17145 @samp{VTODO}, and also create events from deadlines that are in non-TODO 17146 items. 17147 17148 @vindex org-icalendar-use-deadline 17149 @vindex org-icalendar-use-scheduled 17150 @vindex org-icalendar-todo-unscheduled-start 17151 The backend uses the deadlines and scheduling dates in Org TODO items 17152 for setting the start and due dates for the iCalendar TODO entry. 17153 Consult the @code{org-icalendar-use-deadline}, 17154 @code{org-icalendar-use-scheduled}, and 17155 @code{org-icalendar-todo-unscheduled-start} variables for more details. 17156 17157 @vindex org-icalendar-categories 17158 @vindex org-icalendar-alarm-time 17159 For tags on the headline, the iCalendar export backend makes them 17160 into iCalendar categories. To tweak the inheritance of tags and TODO 17161 states, configure the variable @code{org-icalendar-categories}. To assign 17162 clock alarms based on time, configure the @code{org-icalendar-alarm-time} 17163 variable. 17164 17165 @vindex org-icalendar-store-UID 17166 @cindex @samp{ID}, property 17167 The iCalendar format standard requires globally unique identifier---or 17168 UID---for each entry. The iCalendar export backend creates UIDs 17169 during export. To save a copy of the UID in the Org file set the 17170 variable @code{org-icalendar-store-UID}. The backend looks for the @samp{ID} 17171 property of the entry for reusing the same UID for subsequent 17172 exports. 17173 17174 Since a single Org entry can result in multiple iCalendar 17175 entries---timestamp, deadline, scheduled item, or TODO item---Org adds 17176 prefixes to the UID, depending on which part of the Org entry 17177 triggered the creation of the iCalendar entry. Prefixing ensures UIDs 17178 remains unique, yet enable synchronization programs trace the 17179 connections. 17180 17181 @table @asis 17182 @item @kbd{C-c C-e c f} (@code{org-icalendar-export-to-ics}) 17183 @kindex C-c C-e c f 17184 @findex org-icalendar-export-to-ics 17185 Create iCalendar entries from the current Org buffer and store them 17186 in the same directory, using a file extension @samp{.ics}. 17187 17188 @item @kbd{C-c C-e c a} (@code{org-icalendar-export-agenda-files}) 17189 @kindex C-c C-e c a 17190 @findex org-icalendar-export-agenda-files 17191 Create iCalendar entries from Org files in @code{org-agenda-files} and 17192 store in a separate iCalendar file for each Org file. 17193 17194 @item @kbd{C-c C-e c c} (@code{org-icalendar-combine-agenda-files}) 17195 @kindex C-c C-e c c 17196 @findex org-icalendar-combine-agenda-files 17197 @vindex org-icalendar-combined-agenda-file 17198 Create a combined iCalendar file from Org files in 17199 @code{org-agenda-files} and write it to 17200 @code{org-icalendar-combined-agenda-file} file name. 17201 @end table 17202 17203 @cindex @samp{SUMMARY}, property 17204 @cindex @samp{DESCRIPTION}, property 17205 @cindex @samp{LOCATION}, property 17206 @cindex @samp{TIMEZONE}, property 17207 @cindex @samp{CLASS}, property 17208 The iCalendar export backend includes @samp{SUMMARY}, @samp{DESCRIPTION}, 17209 @samp{LOCATION}, @samp{TIMEZONE} and @samp{CLASS} properties from the Org entries 17210 when exporting. To force the backend to inherit the @samp{LOCATION}, 17211 @samp{TIMEZONE} and @samp{CLASS} properties, configure the 17212 @code{org-use-property-inheritance} variable. 17213 17214 @samp{SUMMARY}, @samp{LOCATION}, and @samp{DESCRIPTION} properties can define 17215 multi-line summary, location, or description using @samp{<PROPERTY>+} 17216 syntax (see @ref{Property Syntax}): 17217 17218 @example 17219 * Meeting at location with multi-line address 17220 <2024-01-08 Mon 14:20-15:00> 17221 :PROPERTIES: 17222 :LOCATION: Someplace 17223 :LOCATION+: Some Street 5 17224 :LOCATION+: 12345 Small Town 17225 :END: 17226 @end example 17227 17228 17229 @vindex org-icalendar-include-body 17230 When Org entries do not have @samp{SUMMARY}, @samp{DESCRIPTION}, @samp{LOCATION} and 17231 @samp{CLASS} properties, the iCalendar export backend derives the summary 17232 from the headline, and derives the description from the body of the 17233 Org item. The @code{org-icalendar-include-body} variable limits the 17234 maximum number of characters of the content are turned into its 17235 description. 17236 17237 The @samp{TIMEZONE} property can be used to specify a per-entry time zone, 17238 and is applied to any entry with timestamp information. Time zones 17239 should be specified as per the IANA time zone database format, e.g., 17240 @samp{Asia/Almaty}. Alternately, the property value can be @samp{UTC}, to force 17241 UTC time for this entry only. 17242 17243 The @samp{CLASS} property can be used to specify a per-entry visibility 17244 class or access restrictions, and is applied to any entry with class 17245 information. The iCalendar standard defines three visibility classes: 17246 @table @asis 17247 @item @samp{PUBLIC} 17248 The entry is publicly visible (this is the default). 17249 @item @samp{CONFIDENTIAL} 17250 Only a limited group of clients get access to the 17251 event. 17252 @item @samp{PRIVATE} 17253 The entry can be retrieved only by its owner. 17254 @end table 17255 The server should treat unknown class properties the same as 17256 @samp{PRIVATE}. 17257 17258 @cindex @samp{ICAL-TTL}, keyword 17259 @vindex org-icalendar-ttl 17260 The exported iCalendar file can advise clients how often to check for 17261 updates. This duration can be set globally with the 17262 @code{org-icalendar-ttl} variable, or on a per-document basis with the 17263 @samp{ICAL-TTL} keyword. This option should be set using the iCalendar 17264 notation for time durations; consult the docstring of 17265 @code{org-icalendar-ttl} for more details. 17266 17267 Exporting to iCalendar format depends in large part on the 17268 capabilities of the destination application. Some are more lenient 17269 than others. Consult the Org mode FAQ for advice on specific 17270 applications. 17271 17272 @node Other Built-in Backends 17273 @section Other Built-in Backends 17274 17275 Other export backends included with Org are: 17276 17277 @itemize 17278 @item 17279 @samp{ox-man.el}: Export to a man page. 17280 @end itemize 17281 17282 To activate such backends, either customize @code{org-export-backends} or 17283 load directly with @samp{(require 'ox-man)}. On successful load, the 17284 backend adds new keys in the export dispatcher (see @ref{The Export Dispatcher}). 17285 17286 Follow the comment section of such files, for example, @samp{ox-man.el}, 17287 for usage and configuration details. 17288 17289 @node Advanced Export Configuration 17290 @section Advanced Export Configuration 17291 17292 @anchor{Export hooks} 17293 @subheading Export hooks 17294 17295 @vindex org-export-before-processing-hook 17296 @vindex org-export-before-processing-functions 17297 @vindex org-export-before-parsing-hook 17298 The export process executes two hooks before the actual exporting 17299 begins. The first hook, @code{org-export-before-processing-functions}, 17300 runs before any expansions of macros, Babel code, and include keywords 17301 in the buffer. The second hook, 17302 @code{org-export-before-parsing-functions}, runs before the buffer is 17303 parsed. 17304 17305 Functions added to these hooks are called with a single argument: the 17306 export backend actually used, as a symbol. You may use them for 17307 heavy duty structural modifications of the document. For example, you 17308 can remove every headline in the buffer during export like this: 17309 17310 @lisp 17311 (defun my-headline-removal (backend) 17312 "Remove all headlines in the current buffer. 17313 BACKEND is the export backend being used, as a symbol." 17314 (org-map-entries 17315 (lambda () 17316 (delete-region (point) (line-beginning-position 2)) 17317 ;; We need to tell `org-map-entries' to not skip over heading at 17318 ;; point. Otherwise, it would continue from _next_ heading. See 17319 ;; the docstring of `org-map-entries' for details. 17320 (setq org-map-continue-from (point))))) 17321 17322 (add-hook 'org-export-before-parsing-functions #'my-headline-removal) 17323 @end lisp 17324 17325 @anchor{Filters} 17326 @subheading Filters 17327 17328 @cindex Filters, exporting 17329 Filters are lists of functions to be applied to certain parts for 17330 a given backend. The output from the first function in the filter is 17331 passed on to the next function in the filter. The final output is the 17332 output from the final function in the filter. 17333 17334 The Org export process has many filter sets applicable to different 17335 types of objects, plain text, parse trees, export options, and final 17336 output formats. The filters are named after the element type or 17337 object type: @code{org-export-filter-TYPE-functions}, where @var{TYPE} 17338 is the type targeted by the filter. Valid types are: 17339 17340 @multitable @columnfractions 0.33 0.33 0.33 17341 @item body 17342 @tab bold 17343 @tab babel-call 17344 @item center-block 17345 @tab clock 17346 @tab code 17347 @item diary-sexp 17348 @tab drawer 17349 @tab dynamic-block 17350 @item entity 17351 @tab example-block 17352 @tab export-block 17353 @item export-snippet 17354 @tab final-output 17355 @tab fixed-width 17356 @item footnote-definition 17357 @tab footnote-reference 17358 @tab headline 17359 @item horizontal-rule 17360 @tab inline-babel-call 17361 @tab inline-src-block 17362 @item inlinetask 17363 @tab italic 17364 @tab item 17365 @item keyword 17366 @tab latex-environment 17367 @tab latex-fragment 17368 @item line-break 17369 @tab link 17370 @tab node-property 17371 @item options 17372 @tab paragraph 17373 @tab parse-tree 17374 @item plain-list 17375 @tab plain-text 17376 @tab planning 17377 @item property-drawer 17378 @tab quote-block 17379 @tab radio-target 17380 @item section 17381 @tab special-block 17382 @tab src-block 17383 @item statistics-cookie 17384 @tab strike-through 17385 @tab subscript 17386 @item superscript 17387 @tab table 17388 @tab table-cell 17389 @item table-row 17390 @tab target 17391 @tab timestamp 17392 @item underline 17393 @tab verbatim 17394 @tab verse-block 17395 @end multitable 17396 17397 Here is an example filter that replaces non-breaking spaces ~ ~ in the 17398 Org buffer with @samp{~} for the @LaTeX{} backend. 17399 17400 @lisp 17401 (defun my-latex-filter-nobreaks (text backend info) 17402 "Ensure \" \" are properly handled in LaTeX export." 17403 (when (org-export-derived-backend-p backend 'latex) 17404 (replace-regexp-in-string " " "~" text))) 17405 17406 (add-to-list 'org-export-filter-plain-text-functions 17407 'my-latex-filter-nobreaks) 17408 @end lisp 17409 17410 A filter requires three arguments: the code to be transformed, the 17411 name of the backend, and some optional information about the export 17412 process. The third argument can be safely ignored. Note the use of 17413 @code{org-export-derived-backend-p} predicate that tests for @emph{latex} 17414 backend or any other backend, such as @emph{beamer}, derived from 17415 @emph{latex}. 17416 17417 @anchor{Defining filters for individual files} 17418 @subheading Defining filters for individual files 17419 17420 The Org export can filter not just for backends, but also for 17421 specific files through the @samp{BIND} keyword. Here is an example with 17422 two filters; one removes brackets from time stamps, and the other 17423 removes strike-through text. The filter functions are defined in 17424 a code block in the same Org file, which is a handy location for 17425 debugging. 17426 17427 @example 17428 #+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp) 17429 #+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through) 17430 #+BEGIN_SRC emacs-lisp :exports results :results none 17431 (defun tmp-f-timestamp (s backend info) 17432 (replace-regexp-in-string "&[lg]t;\\|[][]" "" s)) 17433 (defun tmp-f-strike-through (s backend info) "") 17434 #+END_SRC 17435 @end example 17436 17437 @anchor{Summary of the export process} 17438 @subheading Summary of the export process 17439 17440 @findex org-export-as 17441 Org mode export is a multi-step process that works on a temporary copy 17442 of the buffer. The export process consists of 4 major steps: 17443 17444 @enumerate 17445 @item 17446 Process the temporary copy, making necessary changes to the buffer 17447 text; 17448 17449 @item 17450 Parse the buffer, converting plain Org markup into an abstract 17451 syntax tree (AST); 17452 17453 @item 17454 Convert the AST to text, as prescribed by the selected export 17455 backend; 17456 17457 @item 17458 Post-process the resulting exported text. 17459 @end enumerate 17460 17461 17462 @noindent 17463 Process temporary copy of the source Org buffer @footnote{Unless 17464 otherwise specified, each step of the export process only operates on 17465 the accessible portion of the buffer. When subtree export is selected 17466 (see @ref{The Export Dispatcher}), the buffer is narrowed to the body of 17467 the selected subtree, so that the rest of the buffer text, except 17468 export keywords, does not contribute to the export output.}: 17469 17470 @enumerate 17471 @item 17472 Execute @code{org-export-before-processing-functions} (see @ref{Export hooks}); 17473 17474 @item 17475 Expand @samp{#+include} keywords in the whole buffer (see 17476 @ref{Include Files}); 17477 17478 @item 17479 Remove commented subtrees in the whole buffer (see @ref{Comment Lines}); 17480 17481 @item 17482 Replace macros in the whole buffer (see @ref{Macro Replacement}); 17483 17484 @item 17485 When @code{org-export-use-babel} is non-nil (default), process code 17486 blocks: 17487 17488 @itemize 17489 @item 17490 Leave code blocks inside archived subtrees (see @ref{Internal archiving}) as is; 17491 17492 @item 17493 Evaluate all the other code blocks according to code block 17494 headers (see @ref{Limit code block evaluation}); 17495 17496 @item 17497 Remove code, results of evaluation, both, or neither according 17498 to @samp{:exports} header argument (see @ref{Exporting Code Blocks}). 17499 @end itemize 17500 @end enumerate 17501 17502 17503 @noindent 17504 Parse the temporary buffer, creating AST: 17505 17506 @enumerate 17507 @item 17508 Execute @code{org-export-before-parsing-functions} (see @ref{Export hooks}). 17509 The hook functions may still modify the buffer; 17510 17511 @item 17512 Calculate export option values according to subtree-specific export 17513 settings, in-buffer keywords, @samp{#+BIND} keywords, and buffer-local 17514 and global customization. The whole buffer is considered; 17515 17516 @item 17517 When @code{org-org-with-cite-processors} is non-nil (default), determine 17518 contributing bibliographies and record them into export options 17519 (see @ref{Citations}). The whole buffer is considered; 17520 17521 @item 17522 Execute @code{org-export-filter-options-functions}; 17523 17524 @item 17525 Parse the accessible portion of the temporary buffer to generate an 17526 AST@. The AST is a nested list of lists representing Org syntax 17527 elements (see @uref{https://orgmode.org/worg/dev/org-element-api.html, Org Element API} for more details): 17528 17529 @example 17530 (org-data ... 17531 (heading 17532 (section 17533 (paragraph (plain-text) (bold (plain-text)))) 17534 (heading) 17535 (heading (section ...)))) 17536 @end example 17537 17538 17539 Past this point, modifications to the temporary buffer no longer 17540 affect the export; Org export works only with the AST; 17541 17542 @item 17543 Remove elements that are not exported from the AST: 17544 17545 @itemize 17546 @item 17547 Headings according to @samp{SELECT_TAGS} and @samp{EXCLUDE_TAGS} export 17548 keywords; @samp{task}, @samp{inline}, @samp{arch} export options (see 17549 @ref{Export Settings}); 17550 17551 @item 17552 Comments; 17553 17554 @item 17555 Clocks, drawers, fixed-width environments, footnotes, @LaTeX{} 17556 environments and fragments, node properties, planning lines, 17557 property drawers, statistics cookies, timestamps, etc according 17558 to @samp{#+OPTIONS} keyword (see @ref{Export Settings}); 17559 17560 @item 17561 Table rows containing width and alignment markers, unless the 17562 selected export backend changes @code{:with-special-rows} export option 17563 to non-nil (see @ref{Column Width and Alignment}); 17564 17565 @item 17566 Table columns containing recalc marks (see @ref{Advanced features}). 17567 @end itemize 17568 17569 @item 17570 Expand environment variables in file link AST nodes according to 17571 the @samp{expand-links} export option (see @ref{Export Settings}); 17572 17573 @item 17574 Execute @code{org-export-filter-parse-tree-functions}. These 17575 functions can modify the AST by side effects; 17576 17577 @item 17578 When @code{org-org-with-cite-processors} is non-nil (default), replace 17579 citation AST nodes and @samp{#+print_bibliography} keyword AST nodes as 17580 prescribed by the selected citation export processor (see @ref{Citation export processors}). 17581 @end enumerate 17582 17583 17584 @noindent 17585 Convert the AST to text by traversing the AST nodes, depth-first: 17586 17587 @enumerate 17588 @item 17589 Convert the leaf nodes (without children) to text as prescribed 17590 by ``transcoders'' in the selected export backend 17591 @footnote{ See transcoders and @code{:translate-alist} in the docstrings 17592 of @code{org-export-define-backend} and @code{org-export-define-derived-backend}.}; 17593 17594 @item 17595 Pass the converted nodes through the corresponding export 17596 filters (see @ref{Filters}); 17597 17598 @item 17599 Concatenate all the converted child nodes to produce parent 17600 node contents; 17601 17602 @item 17603 Convert the nodes with children to text, passing the nodes 17604 themselves and their exported contents to the corresponding 17605 transcoders and then to the export filters (see @ref{Filters}). 17606 @end enumerate 17607 17608 17609 @noindent 17610 Post-process the exported text: 17611 17612 @enumerate 17613 @item 17614 Post-process the converted AST, as prescribed by the export 17615 backend. @footnote{ See @code{inner-template} in the docstring of @code{org-export-define-backend}.} 17616 This step usually adds generated content (like Table of Contents) 17617 to the exported text; 17618 17619 @item 17620 Execute @code{org-export-filter-body-functions}; 17621 17622 @item 17623 Unless body-only export is selected (see @ref{The Export Dispatcher}), 17624 add the necessary metadata to the final document, as prescribed 17625 by the export backend. Examples: Document author/title; HTML 17626 headers/footers; @LaTeX{} preamble; 17627 17628 @item 17629 When @code{org-org-with-cite-processors} is non-nil (default), add 17630 bibliography metadata, as prescribed by the citation export 17631 processor; 17632 17633 @item 17634 Execute @code{org-export-filter-final-output-functions}. 17635 @end enumerate 17636 17637 @anchor{Extending an existing backend} 17638 @subheading Extending an existing backend 17639 17640 Some parts of the conversion process can be extended for certain 17641 elements so as to introduce a new or revised translation. That is how 17642 the HTML export backend was extended to handle Markdown format. The 17643 extensions work seamlessly so any aspect of filtering not done by the 17644 extended backend is handled by the original backend. Of all the 17645 export customization in Org, extending is very powerful as it operates 17646 at the parser level. 17647 17648 For this example, make the @emph{ascii} backend display the language used 17649 in a source code block. Also make it display only when some attribute 17650 is non-@code{nil}, like the following: 17651 17652 @example 17653 #+ATTR_ASCII: :language t 17654 @end example 17655 17656 17657 Then extend ASCII backend with a custom ``my-ascii'' backend. 17658 17659 @lisp 17660 (defun my-ascii-src-block (src-block contents info) 17661 "Transcode a SRC-BLOCK element from Org to ASCII. 17662 CONTENTS is nil. INFO is a plist used as a communication 17663 channel." 17664 (if (not (org-export-read-attribute :attr_ascii src-block :language)) 17665 (org-export-with-backend 'ascii src-block contents info) 17666 (concat 17667 (format ",--[ %s ]--\n%s`----" 17668 (org-element-property :language src-block) 17669 (replace-regexp-in-string 17670 "^" "| " 17671 (org-element-normalize-string 17672 (org-export-format-code-default src-block info))))))) 17673 17674 (org-export-define-derived-backend 'my-ascii 'ascii 17675 :translate-alist '((src-block . my-ascii-src-block))) 17676 @end lisp 17677 17678 The @code{my-ascii-src-block} function looks at the attribute above the 17679 current element. If not true, hands over to @emph{ascii} backend. If 17680 true, which it is in this example, it creates a box around the code 17681 and leaves room for the inserting a string for language. The last 17682 form creates the new backend that springs to action only when 17683 translating @code{src-block} type elements. 17684 17685 To use the newly defined backend, evaluate the following from an Org 17686 buffer: 17687 17688 @lisp 17689 (org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*") 17690 @end lisp 17691 17692 Further steps to consider would be an interactive function, 17693 self-installing an item in the export dispatcher menu, and other 17694 user-friendly improvements. See 17695 @uref{https://orgmode.org/worg/dev/org-export-reference.html} for more 17696 details. 17697 17698 @node Export Region 17699 @section Export Region 17700 17701 Some export backends include commands to convert a region of Org 17702 formatted text to another format, such as HTML or @LaTeX{}. The 17703 conversion replaces the original source. Here are such commands: 17704 17705 @table @asis 17706 @item @code{org-export-region-to-ascii} 17707 @findex org-ascii-convert-region-to-ascii 17708 @findex org-export-region-to-ascii 17709 Convert the selected region into ASCII@. 17710 17711 @item @code{org-export-region-to-utf8} 17712 @findex org-ascii-convert-region-to-utf8 17713 @findex org-export-region-to-utf8 17714 Convert the selected region into UTF-8. 17715 17716 @item @code{org-export-region-to-html} 17717 @findex org-html-convert-region-to-html 17718 @findex org-export-region-to-html 17719 Convert the selected region into HTML@. 17720 17721 @item @code{org-export-region-to-latex} 17722 @findex org-latex-convert-region-to-latex 17723 @findex org-export-region-to-latex 17724 Convert the selected region into @LaTeX{}. 17725 17726 @item @code{org-export-region-to-texinfo} 17727 @findex org-texinfo-convert-region-to-texinfo 17728 @findex org-export-region-to-texinfo 17729 Convert the selected region into Texinfo. 17730 17731 @item @code{org-export-region-to-md} 17732 @findex org-md-convert-region-to-md 17733 @findex org-export-region-to-md 17734 Convert the selected region into Markdown. 17735 @end table 17736 17737 The in-place conversion is particularly handy for quick conversion of 17738 tables and lists in non-Org buffers. For example, in an HTML buffer, 17739 write a list in Org syntax, select it, and convert it to HTML with 17740 @kbd{M-x org-html-convert-region-to-html}. 17741 17742 @node Publishing 17743 @chapter Publishing 17744 17745 @cindex publishing 17746 17747 Org includes a publishing management system that allows you to 17748 configure automatic HTML conversion of @emph{projects} composed of 17749 interlinked Org files. You can also configure Org to automatically 17750 upload your exported HTML pages and related attachments, such as 17751 images and source code files, to a web server. 17752 17753 You can also use Org to convert files into PDF, or even combine HTML 17754 and PDF conversion so that files are available in both formats on the 17755 server. 17756 17757 Publishing has been contributed to Org by David O'Toole. 17758 17759 @menu 17760 * Configuration:: Defining projects. 17761 * Uploading Files:: How to get files up on the server. 17762 * Sample Configuration:: Example projects. 17763 * Triggering Publication:: Publication commands. 17764 @end menu 17765 17766 @node Configuration 17767 @section Configuration 17768 17769 Publishing needs significant configuration to specify files, 17770 destination and many other properties of a project. 17771 17772 @menu 17773 * Project alist:: The central configuration variable. 17774 * Sources and destinations:: From here to there. 17775 * Selecting files:: What files are part of the project? 17776 * Publishing action:: Setting the function doing the publishing. 17777 * Publishing options:: Tweaking HTML/@LaTeX{} export. 17778 * Publishing links:: Which links keep working after publishing? 17779 * Site map:: Generating a list of all pages. 17780 * Generating an index:: An index that reaches across pages. 17781 @end menu 17782 17783 @node Project alist 17784 @subsection The variable @code{org-publish-project-alist} 17785 17786 @cindex projects, for publishing 17787 17788 @vindex org-publish-project-alist 17789 Publishing is configured almost entirely through setting the value of 17790 one variable, called @code{org-publish-project-alist}. Each element of the 17791 list configures one project, and may be in one of the two following 17792 forms: 17793 17794 @lisp 17795 ("project-name" :property value :property value ...) 17796 @end lisp 17797 17798 @noindent 17799 i.e., a well-formed property list with alternating keys and values, 17800 or: 17801 17802 @lisp 17803 ("project-name" :components ("project-name" "project-name" ...)) 17804 @end lisp 17805 17806 In both cases, projects are configured by specifying property values. 17807 A project defines the set of files that are to be published, as well 17808 as the publishing configuration to use when publishing those files. 17809 When a project takes the second form listed above, the individual 17810 members of the @code{:components} property are taken to be sub-projects, 17811 which group together files requiring different publishing options. 17812 When you publish such a ``meta-project'', all the components are also 17813 published, in the sequence given. 17814 17815 @node Sources and destinations 17816 @subsection Sources and destinations for files 17817 17818 @cindex directories, for publishing 17819 17820 Most properties are optional, but some should always be set. In 17821 particular, Org needs to know where to look for source files, and 17822 where to put published files. 17823 17824 @table @asis 17825 @item @code{:base-directory} 17826 Directory containing publishing source files. 17827 17828 @item @code{:publishing-directory} 17829 Directory where output files are published. You can directly 17830 publish to a webserver using a file name syntax appropriate for the 17831 Emacs tramp package. Or you can publish to a local directory and 17832 use external tools to upload your website (see @ref{Uploading Files}). 17833 17834 @item @code{:preparation-function} 17835 Function or list of functions to be called before starting the 17836 publishing process, for example, to run @samp{make} for updating files to 17837 be published. Each preparation function is called with a single 17838 argument, the project property list. 17839 17840 @item @code{:completion-function} 17841 Function or list of functions called after finishing the publishing 17842 process, for example, to change permissions of the resulting files. 17843 Each completion function is called with a single argument, the 17844 project property list. 17845 @end table 17846 17847 @node Selecting files 17848 @subsection Selecting files 17849 17850 @cindex files, selecting for publishing 17851 17852 By default, all files with extension @samp{.org} in the base directory are 17853 considered part of the project. This can be modified by setting the 17854 following properties 17855 17856 @table @asis 17857 @item @code{:base-extension} 17858 Extension---without the dot---of source files. This actually is 17859 a regular expression. Set this to the symbol @code{any} if you want to 17860 get all files in @code{:base-directory}, even without extension. 17861 17862 @item @code{:exclude} 17863 Regular expression to match file names that should not be published, 17864 even though they have been selected on the basis of their extension. 17865 17866 @item @code{:include} 17867 List of files to be included regardless of @code{:base-extension} and 17868 @code{:exclude}. 17869 17870 @item @code{:recursive} 17871 Non-@code{nil} means, check base-directory recursively for files to 17872 publish. 17873 @end table 17874 17875 @node Publishing action 17876 @subsection Publishing action 17877 17878 @cindex action, for publishing 17879 17880 Publishing means that a file is copied to the destination directory 17881 and possibly transformed in the process. The default transformation 17882 is to export Org files as HTML files, and this is done by the function 17883 @code{org-html-publish-to-html} which calls the HTML exporter (see @ref{HTML Export}). But you can also publish your content as PDF files using 17884 @code{org-latex-publish-to-pdf}, or as ASCII, Texinfo, etc., using the 17885 corresponding functions. 17886 17887 If you want to publish the Org file as an @samp{.org} file but with 17888 @emph{archived}, @emph{commented}, and @emph{tag-excluded} trees removed, use 17889 @code{org-org-publish-to-org}. This produces @samp{file.org} and puts it in the 17890 publishing directory. If you want a htmlized version of this file, 17891 set the parameter @code{:htmlized-source} to @code{t}. It produces 17892 @samp{file.org.html} in the publishing directory@footnote{ If the publishing 17893 directory is the same as the source directory, @samp{file.org} is exported 17894 as @samp{file.org.org}, so you probably do not want to do this.}. 17895 17896 Other files like images only need to be copied to the publishing 17897 destination; for this you can use @code{org-publish-attachment}. For 17898 non-Org files, you always need to specify the publishing function: 17899 17900 @table @asis 17901 @item @code{:publishing-function} 17902 Function executing the publication of a file. This may also be 17903 a list of functions, which are all called in turn. 17904 17905 @item @code{:htmlized-source} 17906 Non-@code{nil} means, publish htmlized source. 17907 @end table 17908 17909 The function must accept three arguments: a property list containing 17910 at least a @code{:publishing-directory} property, the name of the file to 17911 be published, and the path to the publishing directory of the output 17912 file. It should take the specified file, make the necessary 17913 transformation, if any, and place the result into the destination 17914 folder. 17915 17916 @node Publishing options 17917 @subsection Options for the exporters 17918 17919 @cindex options, for publishing 17920 @cindex publishing options 17921 17922 The property list can be used to set many export options for the HTML 17923 and @LaTeX{} exporters. In most cases, these properties correspond to 17924 user variables in Org. The table below lists these properties along 17925 with the variable they belong to. See the documentation string for 17926 the respective variable for details. 17927 17928 @vindex org-publish-project-alist 17929 When a property is given a value in @code{org-publish-project-alist}, its 17930 setting overrides the value of the corresponding user variable, if 17931 any, during publishing. Options set within a file (see @ref{Export Settings}), however, override everything. 17932 17933 @anchor{Generic properties} 17934 @subsubheading Generic properties 17935 17936 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 17937 @item @code{:author} 17938 @tab @code{user-full-name} 17939 @item @code{:email} 17940 @tab @code{user-mail-address} 17941 @item @code{:language} 17942 @tab @code{org-export-default-language} 17943 @item @code{:select-tags} 17944 @tab @code{org-export-select-tags} 17945 @item @code{:exclude-tags} 17946 @tab @code{org-export-exclude-tags} 17947 @item @code{:creator} 17948 @tab @code{org-export-creator-string} 17949 @item @code{:headline-levels} 17950 @tab @code{org-export-headline-levels} 17951 @item @code{:preserve-breaks} 17952 @tab @code{org-export-preserve-breaks} 17953 @item @code{:section-numbers} 17954 @tab @code{org-export-with-section-numbers} 17955 @item @code{:time-stamp-file} 17956 @tab @code{org-export-timestamp-file} 17957 @item @code{:with-archived-trees} 17958 @tab @code{org-export-with-archived-trees} 17959 @item @code{:with-author} 17960 @tab @code{org-export-with-author} 17961 @item @code{:expand-links} 17962 @tab @code{org-export-expand-links} 17963 @item @code{:with-broken-links} 17964 @tab @code{org-export-with-broken-links} 17965 @item @code{:with-clocks} 17966 @tab @code{org-export-with-clocks} 17967 @item @code{:with-creator} 17968 @tab @code{org-export-with-creator} 17969 @item @code{:with-date} 17970 @tab @code{org-export-with-date} 17971 @item @code{:with-drawers} 17972 @tab @code{org-export-with-drawers} 17973 @item @code{:with-email} 17974 @tab @code{org-export-with-email} 17975 @item @code{:with-emphasize} 17976 @tab @code{org-export-with-emphasize} 17977 @item @code{:with-entities} 17978 @tab @code{org-export-with-entities} 17979 @item @code{:with-fixed-width} 17980 @tab @code{org-export-with-fixed-width} 17981 @item @code{:with-footnotes} 17982 @tab @code{org-export-with-footnotes} 17983 @item @code{:with-inlinetasks} 17984 @tab @code{org-export-with-inlinetasks} 17985 @item @code{:with-latex} 17986 @tab @code{org-export-with-latex} 17987 @item @code{:with-planning} 17988 @tab @code{org-export-with-planning} 17989 @item @code{:with-priority} 17990 @tab @code{org-export-with-priority} 17991 @item @code{:with-properties} 17992 @tab @code{org-export-with-properties} 17993 @item @code{:with-smart-quotes} 17994 @tab @code{org-export-with-smart-quotes} 17995 @item @code{:with-special-strings} 17996 @tab @code{org-export-with-special-strings} 17997 @item @code{:with-statistics-cookies} 17998 @tab @code{org-export-with-statistics-cookies} 17999 @item @code{:with-sub-superscript} 18000 @tab @code{org-export-with-sub-superscripts} 18001 @item @code{:with-toc} 18002 @tab @code{org-export-with-toc} 18003 @item @code{:with-tables} 18004 @tab @code{org-export-with-tables} 18005 @item @code{:with-tags} 18006 @tab @code{org-export-with-tags} 18007 @item @code{:with-tasks} 18008 @tab @code{org-export-with-tasks} 18009 @item @code{:with-timestamps} 18010 @tab @code{org-export-with-timestamps} 18011 @item @code{:with-title} 18012 @tab @code{org-export-with-title} 18013 @item @code{:with-todo-keywords} 18014 @tab @code{org-export-with-todo-keywords} 18015 @item @code{:with-cite-processors} 18016 @tab @code{org-export-process-citations} 18017 @item @code{:cite-export} 18018 @tab @code{org-cite-export-processors} 18019 @end multitable 18020 18021 @anchor{ASCII specific properties} 18022 @subsubheading ASCII specific properties 18023 18024 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 18025 @item @code{:ascii-bullets} 18026 @tab @code{org-ascii-bullets} 18027 @item @code{:ascii-caption-above} 18028 @tab @code{org-ascii-caption-above} 18029 @item @code{:ascii-charset} 18030 @tab @code{org-ascii-charset} 18031 @item @code{:ascii-global-margin} 18032 @tab @code{org-ascii-global-margin} 18033 @item @code{:ascii-format-drawer-function} 18034 @tab @code{org-ascii-format-drawer-function} 18035 @item @code{:ascii-format-inlinetask-function} 18036 @tab @code{org-ascii-format-inlinetask-function} 18037 @item @code{:ascii-headline-spacing} 18038 @tab @code{org-ascii-headline-spacing} 18039 @item @code{:ascii-indented-line-width} 18040 @tab @code{org-ascii-indented-line-width} 18041 @item @code{:ascii-inlinetask-width} 18042 @tab @code{org-ascii-inlinetask-width} 18043 @item @code{:ascii-inner-margin} 18044 @tab @code{org-ascii-inner-margin} 18045 @item @code{:ascii-links-to-notes} 18046 @tab @code{org-ascii-links-to-notes} 18047 @item @code{:ascii-list-margin} 18048 @tab @code{org-ascii-list-margin} 18049 @item @code{:ascii-paragraph-spacing} 18050 @tab @code{org-ascii-paragraph-spacing} 18051 @item @code{:ascii-quote-margin} 18052 @tab @code{org-ascii-quote-margin} 18053 @item @code{:ascii-table-keep-all-vertical-lines} 18054 @tab @code{org-ascii-table-keep-all-vertical-lines} 18055 @item @code{:ascii-table-use-ascii-art} 18056 @tab @code{org-ascii-table-use-ascii-art} 18057 @item @code{:ascii-table-widen-columns} 18058 @tab @code{org-ascii-table-widen-columns} 18059 @item @code{:ascii-text-width} 18060 @tab @code{org-ascii-text-width} 18061 @item @code{:ascii-underline} 18062 @tab @code{org-ascii-underline} 18063 @item @code{:ascii-verbatim-format} 18064 @tab @code{org-ascii-verbatim-format} 18065 @end multitable 18066 18067 @anchor{Beamer specific properties} 18068 @subsubheading Beamer specific properties 18069 18070 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 18071 @item @code{:headline-levels} 18072 @tab @code{org-beamer-frame-level} 18073 @item @code{:beamer-subtitle-format} 18074 @tab @code{org-beamer-subtitle-format} 18075 @item @code{:beamer-column-view-format} 18076 @tab @code{org-beamer-column-view-format} 18077 @item @code{:beamer-theme} 18078 @tab @code{org-beamer-theme} 18079 @item @code{:beamer-environments-extra} 18080 @tab @code{org-beamer-environments-extra} 18081 @item @code{:beamer-frame-default-options} 18082 @tab @code{org-beamer-frame-default-options} 18083 @item @code{:beamer-outline-frame-options} 18084 @tab @code{org-beamer-outline-frame-options} 18085 @item @code{:beamer-outline-frame-title} 18086 @tab @code{org-beamer-outline-frame-title} 18087 @end multitable 18088 18089 @anchor{HTML specific properties} 18090 @subsubheading HTML specific properties 18091 18092 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 18093 @item @code{:html-doctype} 18094 @tab @code{org-html-doctype} 18095 @item @code{:html-container} 18096 @tab @code{org-html-container-element} 18097 @item @code{:html-content-class} 18098 @tab @code{org-html-content-class} 18099 @item @code{:html-html5-fancy} 18100 @tab @code{org-html-html5-fancy} 18101 @item @code{:html-link-use-abs-url} 18102 @tab @code{org-html-link-use-abs-url} 18103 @item @code{:html-link-home} 18104 @tab @code{org-html-link-home} 18105 @item @code{:html-link-up} 18106 @tab @code{org-html-link-up} 18107 @item @code{:html-equation-reference-format} 18108 @tab @code{org-html-equation-reference-format} 18109 @item @code{:html-postamble} 18110 @tab @code{org-html-postamble} 18111 @item @code{:html-preamble} 18112 @tab @code{org-html-preamble} 18113 @item @code{:html-head} 18114 @tab @code{org-html-head} 18115 @item @code{:html-head-extra} 18116 @tab @code{org-html-head-extra} 18117 @item @code{:html-head-include-default-style} 18118 @tab @code{org-html-head-include-default-style} 18119 @item @code{:html-head-include-scripts} 18120 @tab @code{org-html-head-include-scripts} 18121 @item @code{:html-allow-name-attribute-in-anchors} 18122 @tab @code{org-html-allow-name-attribute-in-anchors} 18123 @item @code{:html-divs} 18124 @tab @code{org-html-divs} 18125 @item @code{:html-checkbox-type} 18126 @tab @code{org-html-checkbox-type} 18127 @item @code{:html-extension} 18128 @tab @code{org-html-extension} 18129 @item @code{:html-footnote-format} 18130 @tab @code{org-html-footnote-format} 18131 @item @code{:html-footnote-separator} 18132 @tab @code{org-html-footnote-separator} 18133 @item @code{:html-footnotes-section} 18134 @tab @code{org-html-footnotes-section} 18135 @item @code{:html-format-drawer-function} 18136 @tab @code{org-html-format-drawer-function} 18137 @item @code{:html-format-headline-function} 18138 @tab @code{org-html-format-headline-function} 18139 @item @code{:html-format-inlinetask-function} 18140 @tab @code{org-html-format-inlinetask-function} 18141 @item @code{:html-home/up-format} 18142 @tab @code{org-html-home/up-format} 18143 @item @code{:html-indent} 18144 @tab @code{org-html-indent} 18145 @item @code{:html-infojs-options} 18146 @tab @code{org-html-infojs-options} 18147 @item @code{:html-infojs-template} 18148 @tab @code{org-html-infojs-template} 18149 @item @code{:html-inline-image-rules} 18150 @tab @code{org-html-inline-image-rules} 18151 @item @code{:html-link-org-files-as-html} 18152 @tab @code{org-html-link-org-files-as-html} 18153 @item @code{:html-mathjax-options} 18154 @tab @code{org-html-mathjax-options} 18155 @item @code{:html-mathjax-template} 18156 @tab @code{org-html-mathjax-template} 18157 @item @code{:html-metadata-timestamp-format} 18158 @tab @code{org-html-metadata-timestamp-format} 18159 @item @code{:html-postamble-format} 18160 @tab @code{org-html-postamble-format} 18161 @item @code{:html-preamble-format} 18162 @tab @code{org-html-preamble-format} 18163 @item @code{:html-prefer-user-labels} 18164 @tab @code{org-html-prefer-user-labels} 18165 @item @code{:html-self-link-headlines} 18166 @tab @code{org-html-self-link-headlines} 18167 @item @code{:html-table-align-individual-fields} 18168 @tab @code{org-html-table-align-individual-fields} 18169 @item @code{:html-table-caption-above} 18170 @tab @code{org-html-table-caption-above} 18171 @item @code{:html-table-data-tags} 18172 @tab @code{org-html-table-data-tags} 18173 @item @code{:html-table-header-tags} 18174 @tab @code{org-html-table-header-tags} 18175 @item @code{:html-table-use-header-tags-for-first-column} 18176 @tab @code{org-html-table-use-header-tags-for-first-column} 18177 @item @code{:html-tag-class-prefix} 18178 @tab @code{org-html-tag-class-prefix} 18179 @item @code{:html-text-markup-alist} 18180 @tab @code{org-html-text-markup-alist} 18181 @item @code{:html-todo-kwd-class-prefix} 18182 @tab @code{org-html-todo-kwd-class-prefix} 18183 @item @code{:html-toplevel-hlevel} 18184 @tab @code{org-html-toplevel-hlevel} 18185 @item @code{:html-use-infojs} 18186 @tab @code{org-html-use-infojs} 18187 @item @code{:html-validation-link} 18188 @tab @code{org-html-validation-link} 18189 @item @code{:html-viewport} 18190 @tab @code{org-html-viewport} 18191 @item @code{:html-inline-images} 18192 @tab @code{org-html-inline-images} 18193 @item @code{:html-table-attributes} 18194 @tab @code{org-html-table-default-attributes} 18195 @item @code{:html-table-row-open-tag} 18196 @tab @code{org-html-table-row-open-tag} 18197 @item @code{:html-table-row-close-tag} 18198 @tab @code{org-html-table-row-close-tag} 18199 @item @code{:html-xml-declaration} 18200 @tab @code{org-html-xml-declaration} 18201 @item @code{:html-wrap-src-lines} 18202 @tab @code{org-html-wrap-src-lines} 18203 @item @code{:html-klipsify-src} 18204 @tab @code{org-html-klipsify-src} 18205 @item @code{:html-klipse-css} 18206 @tab @code{org-html-klipse-css} 18207 @item @code{:html-klipse-js} 18208 @tab @code{org-html-klipse-js} 18209 @item @code{:html-klipse-selection-script} 18210 @tab @code{org-html-klipse-selection-script} 18211 @item @code{:creator} 18212 @tab @code{org-html-creator-string} 18213 @item @code{:with-latex} 18214 @tab @code{org-html-with-latex} 18215 @end multitable 18216 18217 @anchor{@LaTeX{} specific properties} 18218 @subsubheading @LaTeX{} specific properties 18219 18220 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 18221 @item @code{:latex-class} 18222 @tab @code{org-latex-default-class} 18223 @item @code{:latex-active-timestamp-format} 18224 @tab @code{org-latex-active-timestamp-format} 18225 @item @code{:latex-caption-above} 18226 @tab @code{org-latex-caption-above} 18227 @item @code{:latex-classes} 18228 @tab @code{org-latex-classes} 18229 @item @code{:latex-default-figure-position} 18230 @tab @code{org-latex-default-figure-position} 18231 @item @code{:latex-default-table-environment} 18232 @tab @code{org-latex-default-table-environment} 18233 @item @code{:latex-default-quote-environment} 18234 @tab @code{org-latex-default-quote-environment} 18235 @item @code{:latex-default-table-mode} 18236 @tab @code{org-latex-default-table-mode} 18237 @item @code{:latex-default-footnote-command} 18238 @tab @code{org-latex-default-footnote-command} 18239 @item @code{:latex-diary-timestamp-format} 18240 @tab @code{org-latex-diary-timestamp-format} 18241 @item @code{:latex-engraved-options} 18242 @tab @code{org-latex-engraved-options} 18243 @item @code{:latex-engraved-preamble} 18244 @tab @code{org-latex-engraved-preamble} 18245 @item @code{:latex-engraved-theme} 18246 @tab @code{org-latex-engraved-theme} 18247 @item @code{:latex-footnote-defined-format} 18248 @tab @code{org-latex-footnote-defined-format} 18249 @item @code{:latex-footnote-separator} 18250 @tab @code{org-latex-footnote-separator} 18251 @item @code{:latex-format-drawer-function} 18252 @tab @code{org-latex-format-drawer-function} 18253 @item @code{:latex-format-headline-function} 18254 @tab @code{org-latex-format-headline-function} 18255 @item @code{:latex-format-inlinetask-function} 18256 @tab @code{org-latex-format-inlinetask-function} 18257 @item @code{:latex-hyperref-template} 18258 @tab @code{org-latex-hyperref-template} 18259 @item @code{:latex-image-default-scale} 18260 @tab @code{org-latex-image-default-scale} 18261 @item @code{:latex-image-default-height} 18262 @tab @code{org-latex-image-default-height} 18263 @item @code{:latex-image-default-option} 18264 @tab @code{org-latex-image-default-option} 18265 @item @code{:latex-image-default-width} 18266 @tab @code{org-latex-image-default-width} 18267 @item @code{:latex-images-centered} 18268 @tab @code{org-latex-images-centered} 18269 @item @code{:latex-inactive-timestamp-format} 18270 @tab @code{org-latex-inactive-timestamp-format} 18271 @item @code{:latex-inline-image-rules} 18272 @tab @code{org-latex-inline-image-rules} 18273 @item @code{:latex-link-with-unknown-path-format} 18274 @tab @code{org-latex-link-with-unknown-path-format} 18275 @item @code{:latex-src-block-backend} 18276 @tab @code{org-latex-src-block-backend} 18277 @item @code{:latex-listings-langs} 18278 @tab @code{org-latex-listings-langs} 18279 @item @code{:latex-listings-options} 18280 @tab @code{org-latex-listings-options} 18281 @item @code{:latex-listings-src-omit-language} 18282 @tab @code{org-latex-listings-src-omit-language} 18283 @item @code{:latex-minted-langs} 18284 @tab @code{org-latex-minted-langs} 18285 @item @code{:latex-minted-options} 18286 @tab @code{org-latex-minted-options} 18287 @item @code{:latex-prefer-user-labels} 18288 @tab @code{org-latex-prefer-user-labels} 18289 @item @code{:latex-subtitle-format} 18290 @tab @code{org-latex-subtitle-format} 18291 @item @code{:latex-subtitle-separate} 18292 @tab @code{org-latex-subtitle-separate} 18293 @item @code{:latex-table-scientific-notation} 18294 @tab @code{org-latex-table-scientific-notation} 18295 @item @code{:latex-tables-booktabs} 18296 @tab @code{org-latex-tables-booktabs} 18297 @item @code{:latex-tables-centered} 18298 @tab @code{org-latex-tables-centered} 18299 @item @code{:latex-text-markup-alist} 18300 @tab @code{org-latex-text-markup-alist} 18301 @item @code{:latex-title-command} 18302 @tab @code{org-latex-title-command} 18303 @item @code{:latex-toc-command} 18304 @tab @code{org-latex-toc-command} 18305 @item @code{:latex-compiler} 18306 @tab @code{org-latex-compiler} 18307 @end multitable 18308 18309 @anchor{Markdown specific properties} 18310 @subsubheading Markdown specific properties 18311 18312 @multitable {aaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaa} 18313 @item @code{:md-footnote-format} 18314 @tab @code{org-md-footnote-format} 18315 @item @code{:md-footnotes-section} 18316 @tab @code{org-md-footnotes-section} 18317 @item @code{:md-headline-style} 18318 @tab @code{org-md-headline-style} 18319 @item @code{:md-toplevel-hlevel} 18320 @tab @code{org-md-toplevel-hlevel} 18321 @end multitable 18322 18323 @anchor{ODT specific properties} 18324 @subsubheading ODT specific properties 18325 18326 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 18327 @item @code{:odt-styles-file} 18328 @tab @code{org-odt-styles-file} 18329 @item @code{:odt-content-template-file} 18330 @tab @code{org-odt-content-template-file} 18331 @item @code{:odt-display-outline-level} 18332 @tab @code{org-odt-display-outline-level} 18333 @item @code{:odt-fontify-srcblocks} 18334 @tab @code{org-odt-fontify-srcblocks} 18335 @item @code{:odt-format-drawer-function} 18336 @tab @code{org-odt-format-drawer-function} 18337 @item @code{:odt-format-headline-function} 18338 @tab @code{org-odt-format-headline-function} 18339 @item @code{:odt-format-inlinetask-function} 18340 @tab @code{org-odt-format-inlinetask-function} 18341 @item @code{:odt-inline-formula-rules} 18342 @tab @code{org-odt-inline-formula-rules} 18343 @item @code{:odt-inline-image-rules} 18344 @tab @code{org-odt-inline-image-rules} 18345 @item @code{:odt-pixels-per-inch} 18346 @tab @code{org-odt-pixels-per-inch} 18347 @item @code{:odt-table-styles} 18348 @tab @code{org-odt-table-styles} 18349 @item @code{:odt-use-date-fields} 18350 @tab @code{org-odt-use-date-fields} 18351 @item @code{:with-latex} 18352 @tab @code{org-odt-with-latex} 18353 @end multitable 18354 18355 @anchor{Texinfo specific properties} 18356 @subsubheading Texinfo specific properties 18357 18358 @multitable {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 18359 @item @code{:texinfo-class} 18360 @tab @code{org-texinfo-default-class} 18361 @item @code{:texinfo-classes} 18362 @tab @code{org-texinfo-classes} 18363 @item @code{:texinfo-format-headline-function} 18364 @tab @code{org-texinfo-format-headline-function} 18365 @item @code{:texinfo-node-description-column} 18366 @tab @code{org-texinfo-node-description-column} 18367 @item @code{:texinfo-active-timestamp-format} 18368 @tab @code{org-texinfo-active-timestamp-format} 18369 @item @code{:texinfo-inactive-timestamp-format} 18370 @tab @code{org-texinfo-inactive-timestamp-format} 18371 @item @code{:texinfo-diary-timestamp-format} 18372 @tab @code{org-texinfo-diary-timestamp-format} 18373 @item @code{:texinfo-link-with-unknown-path-format} 18374 @tab @code{org-texinfo-link-with-unknown-path-format} 18375 @item @code{:texinfo-tables-verbatim} 18376 @tab @code{org-texinfo-tables-verbatim} 18377 @item @code{:texinfo-table-scientific-notation} 18378 @tab @code{org-texinfo-table-scientific-notation} 18379 @item @code{:texinfo-table-default-markup} 18380 @tab @code{org-texinfo-table-default-markup} 18381 @item @code{:texinfo-text-markup-alist} 18382 @tab @code{org-texinfo-text-markup-alist} 18383 @item @code{:texinfo-format-drawer-function} 18384 @tab @code{org-texinfo-format-drawer-function} 18385 @item @code{:texinfo-format-inlinetask-function} 18386 @tab @code{org-texinfo-format-inlinetask-function} 18387 @item @code{:texinfo-compact-itemx} 18388 @tab @code{org-texinfo-compact-itemx} 18389 @item @code{:with-latex} 18390 @tab @code{org-texinfo-with-latex} 18391 @end multitable 18392 18393 @node Publishing links 18394 @subsection Publishing links 18395 18396 @cindex links, publishing 18397 18398 To create a link from one Org file to another, you would use something 18399 like @samp{[[file:foo.org][The foo]]} or simply @samp{[[file:foo.org]]} (see 18400 @ref{External Links}). When published, this link becomes a link to 18401 @samp{foo.html}. You can thus interlink the pages of your ``Org web'' 18402 project and the links will work as expected when you publish them to 18403 HTML@. If you also publish the Org source file and want to link to it, 18404 use an @samp{http} link instead of a @samp{file:} link, because @samp{file} links are 18405 converted to link to the corresponding @samp{.html} file. 18406 18407 Links to encrypted Org files, like @samp{[[file:foo.org.gpg]]} are also 18408 supported. 18409 18410 You may also link to related files, such as images. Provided you are 18411 careful with relative file names, and provided you have also 18412 configured Org to upload the related files, these links will work too. 18413 See @ref{Complex example}, for an example of this 18414 usage. 18415 18416 Links between published documents can contain some search options (see 18417 @ref{Search Options}), which will be resolved to the 18418 appropriate location in the linked file. For example, once published 18419 to HTML, the following links all point to a dedicated anchor in 18420 @samp{foo.html}. 18421 18422 @example 18423 [[file:foo.org::*heading]] 18424 [[file:foo.org::#custom-id]] 18425 [[file:foo.org::target]] 18426 @end example 18427 18428 @node Site map 18429 @subsection Generating a sitemap 18430 18431 @cindex sitemap, of published pages 18432 18433 @vindex org-publish-project-alist 18434 The following properties may be used to control publishing of 18435 a map of files for a given project. 18436 18437 @table @asis 18438 @item @code{:auto-sitemap} 18439 When non-@code{nil}, publish a sitemap during 18440 @code{org-publish-current-project} or @code{org-publish-all}. 18441 18442 @item @code{:sitemap-filename} 18443 Filename for output of sitemap. Defaults to @samp{sitemap.org}, which 18444 becomes @samp{sitemap.html}. 18445 18446 @item @code{:sitemap-title} 18447 Title of sitemap page. Defaults to name of file. 18448 18449 @item @code{:sitemap-style} 18450 Can be @code{list} (site-map is just an itemized list of the titles of 18451 the files involved) or @code{tree} (the directory structure of the 18452 source files is reflected in the site-map). Defaults to @code{tree}. 18453 18454 @item @code{:sitemap-format-entry} 18455 @findex org-publish-find-date 18456 @findex org-publish-find-property 18457 @findex org-publish-find-title 18458 With this option one can tell how a site-map entry is formatted in 18459 the site-map. It is a function called with three arguments: the 18460 file or directory name relative to base directory of the project, 18461 the site-map style and the current project. It is expected to 18462 return a string. Default value turns file names into links and use 18463 document titles as descriptions. For specific formatting needs, one 18464 can use @code{org-publish-find-date}, @code{org-publish-find-title} and 18465 @code{org-publish-find-property}, to retrieve additional information 18466 about published documents. 18467 18468 @item @code{:sitemap-function} 18469 Plug-in function to use for generation of the sitemap. It is called 18470 with two arguments: the title of the site-map and a representation 18471 of the files and directories involved in the project as a nested 18472 list, which can further be transformed using @code{org-list-to-generic}, 18473 @code{org-list-to-subtree} and alike. Default value generates a plain 18474 list of links to all files in the project. 18475 18476 @item @code{:sitemap-sort-folders} 18477 Where folders should appear in the sitemap. Set this to @code{first} 18478 (default) or @code{last} to display folders first or last, respectively. 18479 When set to @code{ignore}, folders are ignored altogether. Any other 18480 value mixes files and folders. This variable has no effect when 18481 site-map style is @code{tree}. 18482 18483 @item @code{:sitemap-sort-files} 18484 How the files are sorted in the site map. Set this to 18485 @code{alphabetically} (default), @code{chronologically} or 18486 @code{anti-chronologically}. @code{chronologically} sorts the files with 18487 older date first while @code{anti-chronologically} sorts the files with 18488 newer date first. @code{alphabetically} sorts the files alphabetically. 18489 The date of a file is retrieved with @code{org-publish-find-date}. 18490 18491 @item @code{:sitemap-ignore-case} 18492 Should sorting be case-sensitive? Default @code{nil}. 18493 @end table 18494 18495 @node Generating an index 18496 @subsection Generating an index 18497 18498 @cindex index, in a publishing project 18499 18500 Org mode can generate an index across the files of a publishing project. 18501 18502 @table @asis 18503 @item @code{:makeindex} 18504 When non-@code{nil}, generate in index in the file @samp{theindex.org} and 18505 publish it as @samp{theindex.html}. 18506 @end table 18507 18508 The file is created when first publishing a project with the 18509 @code{:makeindex} set. The file only contains a statement @samp{#+INCLUDE: 18510 "theindex.inc"}. You can then build around this include statement by 18511 adding a title, style information, etc. 18512 18513 @cindex @samp{INDEX}, keyword 18514 Index entries are specified with @samp{INDEX} keyword. An entry that 18515 contains an exclamation mark creates a sub item. 18516 18517 @example 18518 *** Curriculum Vitae 18519 #+INDEX: CV 18520 #+INDEX: Application!CV 18521 @end example 18522 18523 @node Uploading Files 18524 @section Uploading Files 18525 18526 @cindex rsync 18527 @cindex unison 18528 18529 For those people already utilizing third party sync tools such as 18530 Rsync or Unison, it might be preferable not to use the built-in remote 18531 publishing facilities of Org mode which rely heavily on Tramp. Tramp, 18532 while very useful and powerful, tends not to be so efficient for 18533 multiple file transfer and has been known to cause problems under 18534 heavy usage. 18535 18536 Specialized synchronization utilities offer several advantages. In 18537 addition to timestamp comparison, they also do content and 18538 permissions/attribute checks. For this reason you might prefer to 18539 publish your web to a local directory---possibly even @emph{in place} with 18540 your Org files---and then use Unison or Rsync to do the 18541 synchronization with the remote host. 18542 18543 Since Unison, for example, can be configured as to which files to 18544 transfer to a certain remote destination, it can greatly simplify the 18545 project publishing definition. Simply keep all files in the correct 18546 location, process your Org files with @code{org-publish} and let the 18547 synchronization tool do the rest. You do not need, in this scenario, 18548 to include attachments such as JPG, CSS or PNG files in the project 18549 definition since the third-party tool syncs them. 18550 18551 Publishing to a local directory is also much faster than to a remote 18552 one, so that you can afford more easily to republish entire projects. 18553 If you set @code{org-publish-use-timestamps-flag} to @code{nil}, you gain the 18554 main benefit of re-including any changed external files such as source 18555 example files you might include with @samp{INCLUDE} keyword. The timestamp 18556 mechanism in Org is not smart enough to detect if included files have 18557 been modified. 18558 18559 @node Sample Configuration 18560 @section Sample Configuration 18561 18562 Below we provide two example configurations. The first one is 18563 a simple project publishing only a set of Org files. The second 18564 example is more complex, with a multi-component project. 18565 18566 @menu 18567 * Simple example:: One-component publishing. 18568 * Complex example:: A multi-component publishing example. 18569 @end menu 18570 18571 @node Simple example 18572 @subsection Example: simple publishing configuration 18573 18574 This example publishes a set of Org files to the @samp{public_html} 18575 directory on the local machine. 18576 18577 @lisp 18578 (setq org-publish-project-alist 18579 '(("org" 18580 :base-directory "~/org/" 18581 :publishing-function org-html-publish-to-html 18582 :publishing-directory "~/public_html" 18583 :section-numbers nil 18584 :with-toc nil 18585 :html-head "<link rel=\"stylesheet\" 18586 href=\"../other/mystyle.css\" 18587 type=\"text/css\"/>"))) 18588 @end lisp 18589 18590 @node Complex example 18591 @subsection Example: complex publishing configuration 18592 18593 This more complicated example publishes an entire website, including 18594 Org files converted to HTML, image files, Emacs Lisp source code, and 18595 style sheets. The publishing directory is remote and private files 18596 are excluded. 18597 18598 To ensure that links are preserved, care should be taken to replicate 18599 your directory structure on the web server, and to use relative file 18600 paths. For example, if your Org files are kept in @samp{~/org/} and your 18601 publishable images in @samp{~/images/}, you would link to an image with 18602 18603 @example 18604 file:../images/myimage.png 18605 @end example 18606 18607 18608 On the web server, the relative path to the image should be the same. 18609 You can accomplish this by setting up an @samp{images/} folder in the right 18610 place on the web server, and publishing images to it. 18611 18612 @lisp 18613 (setq org-publish-project-alist 18614 `(("orgfiles" 18615 :base-directory "~/org/" 18616 :base-extension "org" 18617 :publishing-directory "/ssh:user@@host:~/html/notebook/" 18618 :publishing-function org-html-publish-to-html 18619 :exclude ,(rx (or "PrivateFile.org" (seq line-start "private/"))) ;; regexp 18620 :headline-levels 3 18621 :section-numbers nil 18622 :with-toc nil 18623 :html-head "<link rel=\"stylesheet\" 18624 href=\"../other/mystyle.css\" type=\"text/css\"/>" 18625 :html-preamble t) 18626 18627 ("images" 18628 :base-directory "~/images/" 18629 :base-extension "jpg\\|gif\\|png" 18630 :publishing-directory "/ssh:user@@host:~/html/images/" 18631 :publishing-function org-publish-attachment) 18632 18633 ("other" 18634 :base-directory "~/other/" 18635 :base-extension "css\\|el" 18636 :publishing-directory "/ssh:user@@host:~/html/other/" 18637 :publishing-function org-publish-attachment) 18638 ("website" :components ("orgfiles" "images" "other")))) 18639 @end lisp 18640 18641 @node Triggering Publication 18642 @section Triggering Publication 18643 18644 Once properly configured, Org can publish with the following commands: 18645 18646 @table @asis 18647 @item @kbd{C-c C-e P x} (@code{org-publish}) 18648 @kindex C-c C-e P x 18649 @findex org-publish 18650 Prompt for a specific project and publish all files that belong to 18651 it. 18652 18653 @item @kbd{C-c C-e P p} (@code{org-publish-current-project}) 18654 @kindex C-c C-e P p 18655 @findex org-publish-current-project 18656 Publish the project containing the current file. 18657 18658 @item @kbd{C-c C-e P f} (@code{org-publish-current-file}) 18659 @kindex C-c C-e P f 18660 @findex org-publish-current-file 18661 Publish only the current file. 18662 18663 @item @kbd{C-c C-e P a} (@code{org-publish-all}) 18664 @kindex C-c C-e P a 18665 @findex org-publish-all 18666 Publish every project. 18667 @end table 18668 18669 @vindex org-publish-use-timestamps-flag 18670 Org uses timestamps to track when a file has changed. The above 18671 functions normally only publish changed files. You can override this 18672 and force publishing of all files by giving a prefix argument to any 18673 of the commands above, or by customizing the variable 18674 @code{org-publish-use-timestamps-flag}. This may be necessary in 18675 particular if files include other files via @samp{SETUPFILE} or @samp{INCLUDE} 18676 keywords. 18677 18678 @node Citation handling 18679 @chapter Citation handling 18680 18681 @cindex citation 18682 @cindex citation processor 18683 18684 While links (see @ref{Hyperlinks}) are often sufficient to refer to 18685 external or internal information from Org, they have their limitations 18686 when referring to multiple targets or typesetting printed 18687 publications. 18688 18689 Org mode provides a more sophisticated markup to ``cite'' external 18690 resources. For example, consider the following Org mode snippet 18691 18692 @example 18693 #+bibliography: citationdata.bib 18694 18695 Org mode is used by various communities [cite:teaching: @@orgteaching; 18696 and TeX: @@orgtex]. [cite/author/caps:@@orgtex] uses Org mode to simplify 18697 writing scientific publications, while [cite/author/caps:@@orgteaching] 18698 experiment with Org babel to improve teaching. 18699 18700 #+print_bibliography: 18701 @end example 18702 18703 18704 Org mode will gather citation metadata from the @samp{#+bibliography} 18705 database and use it to typeset the exported document in arbitrary 18706 formats. For example, the snippet below shows ASCII export output. 18707 18708 @example 18709 Org mode is used by various communities (teaching: Birkenkrahe, Marcus, 18710 2023, and TeX: Somma, Emmanuele F, 2023). Somma, Emmanuele F uses Org 18711 mode to simplify writing scientific publications, while Birkenkrahe, 18712 Marcus experiment with Org babel to improve teaching. 18713 18714 Birkenkrahe, Marcus (2023). /Teaching Data Science with Literate 18715 Programming Tools/, MDPI. 18716 18717 Somma, Emmanuele F (2023). /Simplifying LaTeX with ORG-mode in Emacs/, 18718 TUGboat volume. 18719 @end example 18720 18721 18722 In addition to export, users can use completion to search and insert 18723 citations from the bibliography (via @code{org-cite-insert}). Citations 18724 also act like ordinary links, jumping to the citation metadata when 18725 ``following'' them using @code{org-open-at-point}. 18726 18727 You can customize every aspect (@emph{capability}) of citation handling 18728 using built-in or external @emph{citation processors}. 18729 18730 Org mode ships with several built-in citation processors tailored to 18731 work with @LaTeX{} export and Bib@TeX{} bibliographies (@samp{bibtex}, 18732 @samp{biblatex}, and @samp{natbib} processors), or with more generic formats 18733 described using @uref{https://citationstyles.org/, Citation Style 18734 Language} (@samp{csl} processor). 18735 The default citation processor is @samp{basic} - it works with arbitrary 18736 export formats and recognizes both Bib@TeX{} and CSL bibliographies. 18737 More citation processors are distributed as Emacs packages. 18738 18739 @vindex org-cite-activate-processor 18740 @vindex org-cite-follow-processor 18741 @vindex org-cite-insert-processor 18742 @vindex org-cite-export-processor 18743 Multiple citation processors can be mixed to meet your preferences. 18744 Configure @code{org-cite-activate-processor}, @code{org-cite-follow-processor}, 18745 @code{org-cite-insert-processor}, and @code{org-cite-export-processors} to 18746 select which processor to use for every citation capability: 18747 18748 @table @asis 18749 @item activate 18750 Fontification, tooltip preview, etc. 18751 @item follow 18752 At-point actions on citations via @code{org-open-at-point}. 18753 @item insert 18754 Add and edit citations via @code{org-cite-insert}. 18755 @item export 18756 Via different libraries for different target formats. 18757 @end table 18758 18759 @menu 18760 * Citations:: 18761 * Citation export processors:: 18762 * Bibliography printing:: 18763 @end menu 18764 18765 @node Citations 18766 @section Citations 18767 18768 @cindex bibliography 18769 18770 @vindex org-cite-global-bibliography 18771 Before adding citations, first set one-or-more bibliographies, either 18772 globally with @code{org-cite-global-bibliography}, or locally using one or 18773 more ``bibliography'' keywords. 18774 18775 @cindex @samp{BIBLIOGRAPHY}, keyword 18776 @example 18777 #+bibliography: SomeFile.bib 18778 #+bibliography: /some/other/file.json 18779 #+bibliography: "/some/file/with spaces/in its name.bib" 18780 @end example 18781 18782 Org mode uses all the local and global bibliographies combined to 18783 search for citation keys. 18784 18785 @kindex C-c C-x @@ 18786 @findex org-cite-insert 18787 One can then insert and edit citations using @code{org-cite-insert}, called 18788 with @kbd{C-c C-x @@}. 18789 18790 A @emph{citation} requires one or more citation @emph{key(s)}, elements 18791 identifying a reference in the bibliography. 18792 18793 @itemize 18794 @item 18795 Each citation is surrounded by brackets and uses the @samp{cite} type. 18796 18797 @item 18798 Each key starts with the character @samp{@@}. 18799 18800 @example 18801 [cite:@@key] 18802 @end example 18803 18804 @item 18805 Each key can be qualified by a @emph{prefix} (e.g.@tie{}``see '') and/or 18806 a @emph{suffix} (e.g.@tie{}``p.@tie{}123''), giving information useful or necessary 18807 for the comprehension of the citation but not included in the 18808 reference. 18809 18810 @example 18811 [cite:see @@key p. 123] 18812 @end example 18813 18814 @item 18815 A single citation can cite more than one reference ; the keys are 18816 separated by semicolons ; the formatting of such citation groups is 18817 specified by the style. 18818 18819 @example 18820 [cite:@@key1;@@key2;@@key3] 18821 @end example 18822 18823 @item 18824 One can also specify a stylistic variation for the citations by 18825 inserting a @samp{/} and a style name between the @samp{cite} keyword and the 18826 colon; this usually makes sense only for the author-year styles. 18827 18828 @example 18829 [cite/style:common prefix ;prefix @@key suffix; ... ; common suffix] 18830 @end example 18831 18832 18833 When @samp{style} is not specified, one of the two default styles are 18834 used 18835 18836 @itemize 18837 @item 18838 either the default style specified in the @samp{CITE_EXPORT} keyword 18839 (see @ref{Citation export processors}) 18840 18841 @example 18842 #+cite_export: basic numeric noauthor/bare 18843 [cite:@@key] is the same as [cite/noauthor/bare:@@key] 18844 @end example 18845 18846 @item 18847 or, if @samp{CITE_EXPORT} is not set, using the default @samp{nil} style 18848 18849 @example 18850 [cite:@@key] is the same as [cite/nil:@@key] 18851 @end example 18852 @end itemize 18853 @end itemize 18854 18855 18856 The only mandatory elements are: 18857 18858 @itemize 18859 @item 18860 The @samp{cite} keyword and the colon. 18861 @item 18862 The @samp{@@} character immediately preceding each key. 18863 @item 18864 The brackets surrounding the citation(s) (group). 18865 @end itemize 18866 18867 @node Citation export processors 18868 @section Citation export processors 18869 18870 Org currently includes the following export processors: 18871 18872 @itemize 18873 @item 18874 Two processors can export to a variety of formats, including @samp{latex} 18875 (and therefore @samp{pdf}), @samp{html}, @samp{odt} and plain (UTF8) text: 18876 18877 @table @asis 18878 @item basic 18879 a basic export processor, well adapted to situations 18880 where backward compatibility is not a requirement and formatting 18881 needs are minimal; 18882 18883 @item csl 18884 this export processor uses format files written in 18885 @uref{https://en.wikipedia.org/wiki/Citation_Style_Language, Citation 18886 Style Language} via 18887 @uref{https://github.com/andras-simonyi/citeproc-el, citeproc-el}; 18888 @end table 18889 18890 @item 18891 In contrast, three other processors target @LaTeX{} and @LaTeX{}-derived 18892 formats exclusively: 18893 18894 @table @asis 18895 @item bibtex 18896 this export processor uses Bib@TeX{}, the historical 18897 bibliographic processor used with @LaTeX{}, thus allowing the use of 18898 data and style files compatible with this processor (including a 18899 large number of publishers' styles). It only supports @LaTeX{}'s 18900 @samp{\cite} and @samp{\nocite} commands. 18901 18902 @item natbib 18903 as with the bibtex processor, but using the @LaTeX{} 18904 package @samp{natbib}, allowing more stylistic variants that @LaTeX{}'s 18905 @samp{\cite} command. 18906 18907 @item biblatex 18908 this backend allows the use of data and formats 18909 prepared for Bib@LaTeX{}, an alternate bibliographic processor used 18910 with @LaTeX{}, which overcomes some serious Bib@TeX{} limitations, but 18911 has not (yet?)@tie{}been widely adopted by publishers. 18912 @end table 18913 @end itemize 18914 18915 @cindex @samp{CITE_EXPORT}, keyword 18916 The @samp{CITE_EXPORT} keyword specifies the export processor, citation 18917 style, and bibliography style; for example (all arguments are 18918 optional) 18919 18920 @example 18921 #+cite_export: [export processor name] [bibliography style] [default citation style] 18922 #+cite_export: basic author-year author 18923 @end example 18924 18925 18926 @noindent 18927 specifies the @samp{basic} export processor with citations inserted as 18928 author's name and references indexed by author's names and year; 18929 18930 @example 18931 #+cite_export: csl /some/path/to/vancouver-brackets.csl 18932 @end example 18933 18934 18935 @noindent 18936 specifies the @samp{csl} processor and CSL style, which in this case 18937 defines numeric citations and numeric references according to the 18938 @samp{Vancouver} specification (as style used in many medical journals), 18939 following a typesetting variation putting citations between brackets; 18940 18941 @example 18942 #+cite_export: natbib kluwer 18943 @end example 18944 18945 18946 @noindent 18947 specifies the @samp{natbib} export processor with a label citation style 18948 conformant to the Harvard style and the specification of the 18949 Wolkers-Kluwer publisher; since it relies on the @code{bibtex} processor of 18950 your @LaTeX{} installation, it won't export to anything but PDF@. 18951 18952 @example 18953 #+cite_export: biblatex numeric,backend=bibtex 18954 @end example 18955 18956 18957 @vindex org-cite-biblatex-options 18958 @noindent 18959 specifies the @samp{biblatex} export processor with the default @samp{numeric} 18960 style and the @samp{bibtex} backend. Always define the style first and then 18961 the rest of load-time options for the @samp{biblatex} 18962 package. Alternatively, you can use the @code{key=val,key=val} format for 18963 the options as documented in the @samp{biblatex} package documentation: 18964 18965 @example 18966 #+cite_export: biblatex backend=bibtex,style=numeric 18967 @end example 18968 18969 18970 The @code{org-cite-biblatex-options} variable in your Emacs configuration 18971 uses this format. It will only export to PDF, since it relies on the 18972 @code{biblatex} processor of your @LaTeX{} installation. 18973 18974 @node Bibliography printing 18975 @section Bibliography printing 18976 18977 @cindex @samp{PRINT_BIBLIOGRAPHY}, keyword 18978 The @samp{PRINT_BIBLIOGRAPHY} keyword specifies where the bibliography 18979 should be printed (note the colon): 18980 18981 @example 18982 #+print_bibliography: 18983 @end example 18984 18985 18986 The bibliography printed by the @LaTeX{}-based export processors 18987 @samp{bibtex}, @samp{natbib} and @samp{biblatex} has a chapter or section heading by 18988 default, while the @samp{basic} and @samp{csl} processors print the list of 18989 bibliography entries without a heading. 18990 18991 A document may contain more than one @samp{PRINT_BIBLIOGRAPHY} keywords. 18992 Each of the keywords will trigger printing the bibliography. 18993 18994 The keywords can be used with or without additional options. Options 18995 can be used, for example, to print only entries that belong to a 18996 certain category or to control formatting. The set of supported 18997 @samp{PRINT_BIBLIOGRAPHY} options and their interpretation varies between 18998 the different citation export processors. Some export processors do 18999 not support passing options. 19000 19001 @menu 19002 * Bibliography options in the @samp{biblatex} and @samp{csl} export processors:: 19003 @end menu 19004 19005 @node Bibliography options in the @samp{biblatex} and @samp{csl} export processors 19006 @subsection Bibliography options in the @samp{biblatex} and @samp{csl} export processors 19007 19008 The @samp{biblatex} and @samp{csl} export processors support bibliography 19009 options through a property list attached to the @samp{PRINT_BIBLIOGRAPHY} 19010 keyword. For example, 19011 19012 @example 19013 #+print_bibliography: :keyword algebra :type book 19014 @end example 19015 19016 19017 Values including spaces must be surrounded with double quotes. If you 19018 need to use a key multiple times, you can separate its values with 19019 commas, but without any space in-between: 19020 19021 @example 19022 #+print_bibliography: :keyword "algebraic logic" :nottype article,book 19023 @end example 19024 19025 19026 The @samp{biblatex} export processor accepts all options supported by 19027 Bib@LaTeX{}'s @code{\printbibliography} command. 19028 19029 The @samp{csl} processor accepts the following options: 19030 19031 @table @asis 19032 @item @samp{:keyword <keyword(,keyword2...)>} 19033 Print only entries whose 19034 keyword field contains all given keywords. 19035 19036 @item @samp{:notkeyword <keyword(,keyword2...)>} 19037 Print only entries whose 19038 keyword field does not contain any of the given keywords. 19039 19040 @item @samp{:type <entrytype>} 19041 Print only entries whose type is 19042 @samp{<entrytype>}. Entry type is the Bib@TeX{}/Bib@LaTeX{} entry type if this 19043 information is available (the entry was read from a Bib@TeX{}/Bib@LaTeX{} 19044 bibliography) and the CSL entry type otherwise. 19045 19046 @item @samp{:nottype <entrytype(,entrytype2...)>} 19047 Print only entries whose 19048 type is not among the given entry types. Entry type is determined 19049 as in the case of @samp{:type}. 19050 19051 @item @samp{:csltype <entrytype>} 19052 Print only entries whose CSL entry type 19053 (possibly based on a conversion from Bib@TeX{}/Bib@LaTeX{} to CSL) is 19054 @samp{<entrytype>}. 19055 19056 @item @samp{:notcsltype <entrytype(,entrytype2...)>} 19057 Print only entries whose 19058 CSL entry type (possibly based on a conversion from Bib@TeX{}/Bib@LaTeX{} 19059 to CSL) is not among the listed entry types. 19060 19061 @item @samp{:filter <predicate>} 19062 Print only entries for which the given 19063 Emacs Lisp predicate returns a non-@code{nil} value. 19064 @end table 19065 19066 @node Working with Source Code 19067 @chapter Working with Source Code 19068 19069 @cindex source code, working with 19070 19071 Source code here refers to any plain text collection of computer 19072 instructions, possibly with comments, written using a human-readable 19073 programming language. Org can manage source code in an Org document 19074 when the source code is identified with begin and end markers. 19075 Working with source code begins with identifying source code blocks. 19076 A source code block can be placed almost anywhere in an Org document; 19077 it is not restricted to the preamble or the end of the document. 19078 However, Org cannot manage a source code block if it is placed inside 19079 an Org comment or within a fixed width section. 19080 19081 Here is an example source code block in the Emacs Lisp language: 19082 19083 @example 19084 #+BEGIN_SRC emacs-lisp 19085 (defun org-xor (a b) 19086 "Exclusive or." 19087 (if a (not b) b)) 19088 #+END_SRC 19089 @end example 19090 19091 Source code blocks are one of many Org block types, which also include 19092 ``center'', ``comment'', ``dynamic'', ``example'', ``export'', ``quote'', 19093 ``special'', and ``verse''. This section pertains to blocks between 19094 @samp{#+BEGIN_SRC} and @samp{#+END_SRC}. 19095 19096 Details of Org's facilities for working with source code are described 19097 in the following sections. 19098 19099 @menu 19100 * Features Overview:: Enjoy the versatility of source blocks. 19101 * Structure of Code Blocks:: Code block syntax described. 19102 * Using Header Arguments:: Different ways to set header arguments. 19103 * Environment of a Code Block:: Arguments, sessions, working directory... 19104 * Evaluating Code Blocks:: Place results of evaluation in the Org buffer. 19105 * Results of Evaluation:: Choosing a results type, post-processing... 19106 * Exporting Code Blocks:: Export contents and/or results. 19107 * Extracting Source Code:: Create pure source code files. 19108 * Languages:: List of supported code block languages. 19109 * Editing Source Code:: Language major-mode editing. 19110 * Noweb Reference Syntax:: Literate programming in Org mode. 19111 * Library of Babel:: Use and contribute to a library of useful code blocks. 19112 * Key bindings and Useful Functions:: Work quickly with code blocks. 19113 * Batch Execution:: Call functions from the command line. 19114 @end menu 19115 19116 @node Features Overview 19117 @section Features Overview 19118 19119 Org can manage the source code in the block delimited by @samp{#+BEGIN_SRC} 19120 @dots{} @samp{#+END_SRC} in several ways that can simplify housekeeping tasks 19121 essential to modern source code maintenance. Org can edit, format, 19122 extract, export, and publish source code blocks. Org can also compile 19123 and execute a source code block, then capture the results. The Org 19124 mode literature sometimes refers to source code blocks as @emph{live code} 19125 blocks because they can alter the content of the Org document or the 19126 material that it exports. Users can control the ``liveliness'' of each 19127 source code block by tweaking the header arguments (see @ref{Using Header Arguments}) for compiling, execution, extraction, and exporting. 19128 19129 For editing and formatting a source code block, Org uses an 19130 appropriate Emacs major mode that includes features specifically 19131 designed for source code in that language. 19132 19133 Org can extract one or more source code blocks and write them to one 19134 or more source files---a process known as @emph{tangling} in literate 19135 programming terminology. 19136 19137 For exporting and publishing, Org's backends can format a source code 19138 block appropriately, often with native syntax highlighting. 19139 19140 For executing and compiling a source code block, the user can 19141 configure Org to select the appropriate compiler. Org provides 19142 facilities to collect the result of the execution or compiler output, 19143 insert it into the Org document, and/or export it. In addition to 19144 text results, Org can insert links to other data types, including 19145 audio, video, and graphics. Org can also link a compiler error 19146 message to the appropriate line in the source code block. 19147 19148 An important feature of Org's management of source code blocks is the 19149 ability to pass variables, functions, and results to one another using 19150 a common syntax for source code blocks in any language. Although most 19151 literate programming facilities are restricted to one language or 19152 another, Org's language-agnostic approach lets the literate programmer 19153 match each programming task with the appropriate computer language and 19154 to mix them all together in a single Org document. This 19155 interoperability among languages explains why Org's source code 19156 management facility was named @emph{Org Babel} by its originators, Eric 19157 Schulte and Dan Davison. 19158 19159 Org mode fulfills the promise of easy verification and maintenance of 19160 publishing reproducible research by keeping text, data, code, 19161 configuration settings of the execution environment, the results of 19162 the execution, and associated narratives, claims, references, and 19163 internal and external links in a single Org document. 19164 19165 @node Structure of Code Blocks 19166 @section Structure of Code Blocks 19167 19168 @cindex code block, structure 19169 @cindex source code, block structure 19170 @cindex @samp{NAME} keyword, in source blocks 19171 @cindex @samp{BEGIN_SRC} 19172 19173 Org offers two ways to structure source code in Org documents: in 19174 a source code block, and directly inline. Both specifications are 19175 shown below. 19176 19177 A source code block conforms to this structure: 19178 19179 @example 19180 #+NAME: <name> 19181 #+BEGIN_SRC <language> <switches> <header arguments> 19182 <body> 19183 #+END_SRC 19184 @end example 19185 19186 Do not be put-off by having to remember the source block syntax. Org 19187 mode offers a command for wrapping existing text in a block (see 19188 @ref{Structure Templates}). Org also works with other completion systems 19189 in Emacs, some of which predate Org and have custom domain-specific 19190 languages for defining templates. Regular use of templates reduces 19191 errors, increases accuracy, and maintains consistency. 19192 19193 @cindex source code, inline 19194 An inline code block conforms to this structure: 19195 19196 @example 19197 src_<language>@{<body>@} 19198 @end example 19199 19200 19201 @noindent 19202 or 19203 19204 @example 19205 src_<language>[<header arguments>]@{<body>@} 19206 @end example 19207 19208 19209 @table @asis 19210 @item @samp{#+NAME: <name>} 19211 Optional. Names the source block so it can be called, like 19212 a function, from other source blocks or inline code to evaluate or 19213 to capture the results. Code from other blocks, other files, and 19214 from table formulas (see @ref{The Spreadsheet}) can use the name to 19215 reference a source block. This naming serves the same purpose as 19216 naming Org tables. Org mode requires unique names. For duplicate 19217 names, Org mode's behavior is undefined. Inline code blocks cannot 19218 have a name. 19219 19220 @item @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC} 19221 Mandatory. They mark the start and end of a block that Org 19222 requires. The @samp{#+BEGIN_SRC} line takes additional arguments, as 19223 described next. 19224 19225 @item @samp{<language>} 19226 @cindex language, in code blocks 19227 Optional. It is the identifier of the source code language in the 19228 block. See @ref{Languages}, for identifiers of supported languages. 19229 19230 When @samp{<language>} identifier is omitted, the block also cannot 19231 have @samp{<switches>} and @samp{<header arguments>}. 19232 19233 Language identifier is also used to fontify code blocks in Org 19234 buffers, when @code{org-src-fontify-natively} is set to non-@code{nil}. See 19235 @ref{Editing Source Code}. 19236 19237 @item @samp{<switches>} 19238 @cindex switches, in code blocks 19239 Optional. Switches provide finer control of the code execution, 19240 export, and format (see the discussion of switches in @ref{Literal Examples}). 19241 19242 @item @samp{<header arguments>} 19243 @cindex header arguments, in code blocks 19244 Optional. Heading arguments control many aspects of evaluation, 19245 export and tangling of code blocks (see @ref{Using Header Arguments}). 19246 Using Org's properties feature, header arguments can be selectively 19247 applied to the entire buffer or specific subtrees of the Org 19248 document. 19249 19250 @item @samp{<body>} 19251 Source code in the dialect of the specified language identifier. 19252 @end table 19253 19254 @node Using Header Arguments 19255 @section Using Header Arguments 19256 19257 Org comes with many header arguments common to all languages. New 19258 header arguments are added for specific languages as they become 19259 available for use in source code blocks. A header argument is 19260 specified with an initial colon followed by the argument's name in 19261 lowercase. 19262 19263 Since header arguments can be set in several ways, Org prioritizes 19264 them in case of overlaps or conflicts by giving local settings 19265 a higher priority. Header values in function calls, for example, 19266 override header values from global defaults. 19267 19268 @anchor{System-wide header arguments} 19269 @subheading System-wide header arguments 19270 19271 @vindex org-babel-default-header-args 19272 19273 @vindex org-babel-default-header-args 19274 System-wide values of header arguments can be specified by customizing 19275 the @code{org-babel-default-header-args} variable, which defaults to the 19276 following values: 19277 19278 @example 19279 :session => "none" 19280 :results => "replace" 19281 :exports => "code" 19282 :cache => "no" 19283 :noweb => "no" 19284 :hlines => "no" 19285 :tangle => "no" 19286 @end example 19287 19288 @vindex org-babel-default-inline-header-args 19289 Inline source blocks (see @ref{Structure of Code Blocks}) use slightly 19290 different default header arguments defined in 19291 @code{org-babel-default-inline-header-args}: 19292 19293 @example 19294 :session => "none" 19295 :results => "replace" 19296 :exports => "results" 19297 :hlines => "yes" 19298 @end example 19299 19300 The most notable difference between default header arguments for 19301 inline and normal source blocks is @samp{:exports} argument. For inline 19302 source blocks, results of evaluation are exported by default; not the 19303 code. 19304 19305 Unlike the default values, header arguments set using Org mode 19306 properties (see @ref{Header arguments in Org mode properties}) do apply to 19307 both the normal source blocks and inline source blocks. 19308 19309 The example below sets @samp{:noweb} header arguments to @samp{yes}, which makes 19310 Org expand @samp{:noweb} references by default. 19311 19312 @lisp 19313 (setq org-babel-default-header-args 19314 (cons '(:noweb . "yes") 19315 (assq-delete-all :noweb org-babel-default-header-args))) 19316 @end lisp 19317 19318 @cindex language specific default header arguments 19319 @cindex default header arguments per language 19320 Each language can have separate default header arguments by 19321 customizing the variable @code{org-babel-default-header-args:<LANG>}, where 19322 @var{<LANG>} is the name of the language. For details, see the 19323 language-specific online documentation at 19324 @uref{https://orgmode.org/worg/org-contrib/babel/}. 19325 19326 @anchor{Header arguments in Org mode properties} 19327 @subheading Header arguments in Org mode properties 19328 19329 For header arguments applicable to the buffer, use @samp{PROPERTY} keyword 19330 anywhere in the Org file (see @ref{Property Syntax}). 19331 19332 The following example makes all the R code blocks execute in the same 19333 session. Setting @samp{:results} to @samp{silent} ignores the results of 19334 executions for all blocks, not just R code blocks; no results inserted 19335 for any block. 19336 19337 @example 19338 #+PROPERTY: header-args:R :session *R* 19339 #+PROPERTY: header-args :results silent 19340 @end example 19341 19342 @vindex org-use-property-inheritance 19343 Header arguments set through Org's property drawers (see @ref{Property Syntax}) apply at the subtree level on down. Since these property 19344 drawers can appear anywhere in the file hierarchy, Org uses outermost 19345 call or source block to resolve the values. Org ignores 19346 @code{org-use-property-inheritance} setting. 19347 19348 In this example, @samp{:cache} defaults to @samp{yes} for all code blocks in the 19349 subtree. 19350 19351 @example 19352 * sample header 19353 :PROPERTIES: 19354 :header-args: :cache yes 19355 :END: 19356 @end example 19357 19358 @kindex C-c C-x p 19359 @findex org-set-property 19360 Properties defined through @code{org-set-property} function, bound to 19361 @kbd{C-c C-x p}, apply to all active languages. They override 19362 properties set in @code{org-babel-default-header-args}. 19363 19364 @cindex language specific header arguments properties 19365 @cindex header arguments per language 19366 Language-specific header arguments are also read from properties 19367 @samp{header-args:<LANG>} where @var{<LANG>} is the language 19368 identifier. For example, 19369 19370 @example 19371 * Heading 19372 :PROPERTIES: 19373 :header-args:clojure: :session *clojure-1* 19374 :header-args:R: :session *R* 19375 :END: 19376 ** Subheading 19377 :PROPERTIES: 19378 :header-args:clojure: :session *clojure-2* 19379 :END: 19380 @end example 19381 19382 @noindent 19383 would force separate sessions for Clojure blocks in @samp{Heading} and 19384 @samp{Subheading}, but use the same session for all R blocks. Blocks in 19385 @samp{Subheading} inherit settings from @samp{Heading}. 19386 19387 @anchor{Code block specific header arguments} 19388 @subheading Code block specific header arguments 19389 19390 Header arguments are most commonly set at the source code block level, 19391 on the @samp{#+BEGIN_SRC} line. Arguments set at this level take 19392 precedence over those set in the @code{org-babel-default-header-args} 19393 variable, and also those set as header properties. 19394 19395 In the following example, setting @samp{:results} to @samp{silent} makes it 19396 ignore results of the code execution. Setting @samp{:exports} to @samp{code} 19397 exports only the body of the code block to HTML or @LaTeX{}. 19398 19399 @example 19400 #+NAME: factorial 19401 #+BEGIN_SRC haskell :results silent :exports code :var n=0 19402 fac 0 = 1 19403 fac n = n * fac (n-1) 19404 #+END_SRC 19405 @end example 19406 19407 The same header arguments in an inline code block: 19408 19409 @example 19410 src_haskell[:exports both]@{fac 5@} 19411 @end example 19412 19413 19414 @cindex @samp{HEADER}, keyword 19415 Code block header arguments can span multiple lines using @samp{#+HEADER:} 19416 on each line. Note that Org currently accepts the plural spelling of 19417 @samp{#+HEADER:} only as a convenience for backward-compatibility. It may 19418 be removed at some point. 19419 19420 Multi-line header arguments on an unnamed code block: 19421 19422 @example 19423 #+HEADER: :var data1=1 19424 #+BEGIN_SRC emacs-lisp :var data2=2 19425 (message "data1:%S, data2:%S" data1 data2) 19426 #+END_SRC 19427 19428 #+RESULTS: 19429 : data1:1, data2:2 19430 @end example 19431 19432 Multi-line header arguments on a named code block: 19433 19434 @example 19435 #+NAME: named-block 19436 #+HEADER: :var data=2 19437 #+BEGIN_SRC emacs-lisp 19438 (message "data:%S" data) 19439 #+END_SRC 19440 19441 #+RESULTS: named-block 19442 : data:2 19443 @end example 19444 19445 @anchor{Header arguments in function calls} 19446 @subheading Header arguments in function calls 19447 19448 Header arguments in function calls are the most specific and override 19449 all other settings in case of an overlap. They get the highest 19450 priority. Two @samp{#+CALL:} examples are shown below. For the complete 19451 syntax of @samp{CALL} keyword, see @ref{Evaluating Code Blocks}. 19452 19453 In this example, @samp{:exports results} header argument is applied to the 19454 evaluation of the @samp{#+CALL:} line. 19455 19456 @example 19457 #+CALL: factorial(n=5) :exports results 19458 @end example 19459 19460 19461 In this example, @samp{:session special} header argument is applied to the 19462 evaluation of @samp{factorial} code block. 19463 19464 @example 19465 #+CALL: factorial[:session special](n=5) 19466 @end example 19467 19468 @node Environment of a Code Block 19469 @section Environment of a Code Block 19470 19471 @anchor{Passing arguments} 19472 @subheading Passing arguments 19473 19474 @cindex passing arguments to code blocks 19475 @cindex arguments, in code blocks 19476 @cindex @samp{var}, header argument 19477 Use @samp{var} for passing arguments to source code blocks. The specifics 19478 of variables in code blocks vary by the source language and are 19479 covered in the language-specific documentation. The syntax for @samp{var}, 19480 however, is the same for all languages. This includes declaring 19481 a variable, and assigning a default value. 19482 19483 The following syntax is used to pass arguments to code blocks using 19484 the @samp{var} header argument. 19485 19486 @example 19487 :var NAME=ASSIGN 19488 @end example 19489 19490 19491 @noindent 19492 @var{NAME} is the name of the variable bound in the code block 19493 body. @var{ASSIGN} is a literal value, such as a string, 19494 a number, a reference to a table, a list, a literal example, another 19495 code block---with or without arguments---or the results of evaluating 19496 a code block. @var{ASSIGN} may specify a filename for references 19497 to elements in a different file, using a @samp{:} to separate the filename 19498 from the reference. 19499 19500 @example 19501 :var NAME=FILE:REFERENCE 19502 @end example 19503 19504 19505 When @samp{FILE} does not exist, the reference is searched in the current 19506 file, using the verbatim reference. This way, 19507 @samp{:var table=tbl:example} will be searched inside the current buffer. 19508 19509 Here are examples of passing values by reference: 19510 19511 @table @asis 19512 @item table 19513 A table named with a @samp{NAME} keyword. 19514 19515 @example 19516 #+NAME: example-table 19517 | 1 | 19518 | 2 | 19519 | 3 | 19520 | 4 | 19521 19522 #+NAME: table-length 19523 #+BEGIN_SRC emacs-lisp :var table=example-table 19524 (length table) 19525 #+END_SRC 19526 19527 #+RESULTS: table-length 19528 : 4 19529 @end example 19530 19531 When passing a table, you can treat specially the row, or the 19532 column, containing labels for the columns, or the rows, in the 19533 table. 19534 19535 @cindex @samp{colnames}, header argument 19536 The @samp{colnames} header argument accepts @samp{yes}, @samp{no}, or @samp{nil} values. 19537 The default value is @samp{nil}: if an input table has column 19538 names---because the second row is a horizontal rule---then Org 19539 removes the column names, processes the table, puts back the column 19540 names, and then writes the table to the results block. Using @samp{yes}, 19541 Org does the same to the first non-hline row, even if the initial 19542 table does not contain any horizontal rule. When set to @samp{no}, Org 19543 does not pre-process column names at all. 19544 19545 @example 19546 #+NAME: less-cols 19547 | a | 19548 |---| 19549 | b | 19550 | c | 19551 19552 #+BEGIN_SRC python :var tab=less-cols :colnames nil 19553 return [[val + '*' for val in row] for row in tab] 19554 #+END_SRC 19555 19556 #+RESULTS: 19557 | a | 19558 |----| 19559 | b* | 19560 | c* | 19561 @end example 19562 19563 @cindex @samp{rownames}, header argument 19564 Similarly, the @samp{rownames} header argument can take two values: @samp{yes} 19565 or @samp{no}. When set to @samp{yes}, Org removes the first column, processes 19566 the table, puts back the first column, and then writes the table to 19567 the results block. The default is @samp{no}, which means Org does not 19568 pre-process the first column. Note that Emacs Lisp code blocks 19569 ignore @samp{rownames} header argument because of the ease of 19570 table-handling in Emacs. 19571 19572 @example 19573 #+NAME: with-rownames 19574 | one | 1 | 2 | 3 | 4 | 5 | 19575 | two | 6 | 7 | 8 | 9 | 10 | 19576 19577 #+BEGIN_SRC python :var tab=with-rownames :rownames yes 19578 return [[val + 10 for val in row] for row in tab] 19579 #+END_SRC 19580 19581 #+RESULTS: 19582 | one | 11 | 12 | 13 | 14 | 15 | 19583 | two | 16 | 17 | 18 | 19 | 20 | 19584 @end example 19585 @end table 19586 19587 To refer to a table in another file, join the filename and table name with 19588 a colon, for example: @samp{:var table=other-file.org:example-table}. 19589 19590 @table @asis 19591 @item list 19592 A simple named list. 19593 19594 @example 19595 #+NAME: example-list 19596 - simple 19597 - not 19598 - nested 19599 - list 19600 19601 #+BEGIN_SRC emacs-lisp :var x=example-list 19602 (print x) 19603 #+END_SRC 19604 19605 #+RESULTS: 19606 | simple | list | 19607 @end example 19608 19609 Note that only the top level list items are passed along. Nested 19610 list items are ignored. 19611 19612 @item code block without arguments 19613 A code block name, as assigned by @samp{NAME} keyword from the example 19614 above, optionally followed by parentheses. 19615 19616 @example 19617 #+BEGIN_SRC emacs-lisp :var length=table-length() 19618 (* 2 length) 19619 #+END_SRC 19620 19621 #+RESULTS: 19622 : 8 19623 @end example 19624 19625 @item code block with arguments 19626 A code block name, as assigned by @samp{NAME} keyword, followed by 19627 parentheses and optional arguments passed within the parentheses. 19628 The block is evaluated with point at its location. 19629 19630 @example 19631 #+NAME: double 19632 #+BEGIN_SRC emacs-lisp :var input=8 19633 (* 2 input) 19634 #+END_SRC 19635 19636 #+RESULTS: double 19637 : 16 19638 19639 #+NAME: squared 19640 #+BEGIN_SRC emacs-lisp :var input=double(input=1) 19641 (* input input) 19642 #+END_SRC 19643 19644 #+RESULTS: squared 19645 : 4 19646 @end example 19647 19648 @item literal example, or code block contents 19649 A code block or literal example block named with a @samp{NAME} keyword, 19650 followed by brackets (optional for example blocks). 19651 19652 @example 19653 #+NAME: literal-example 19654 #+BEGIN_EXAMPLE 19655 A literal example 19656 on two lines 19657 #+END_EXAMPLE 19658 19659 #+NAME: read-literal-example 19660 #+BEGIN_SRC emacs-lisp :var x=literal-example[] 19661 (concatenate #'string x " for you.") 19662 #+END_SRC 19663 19664 #+RESULTS: read-literal-example 19665 : A literal example 19666 : on two lines for you. 19667 @end example 19668 @end table 19669 19670 Indexing variable values enables referencing portions of a variable. 19671 Indexes are 0 based with negative values counting backwards from the 19672 end. If an index is separated by commas then each subsequent section 19673 indexes as the next dimension. Note that this indexing occurs 19674 @emph{before} other table-related header arguments are applied, such as 19675 @samp{hlines}, @samp{colnames} and @samp{rownames}. The following example assigns 19676 the last cell of the first row the table @samp{example-table} to the 19677 variable @samp{data}: 19678 19679 @example 19680 #+NAME: example-table 19681 | 1 | a | 19682 | 2 | b | 19683 | 3 | c | 19684 | 4 | d | 19685 19686 #+BEGIN_SRC emacs-lisp :var data=example-table[0,-1] 19687 data 19688 #+END_SRC 19689 19690 #+RESULTS: 19691 : a 19692 @end example 19693 19694 Two integers separated by a colon reference a range of variable 19695 values. In that case the entire inclusive range is referenced. For 19696 example the following assigns the middle three rows of @samp{example-table} 19697 to @samp{data}. 19698 19699 @example 19700 #+NAME: example-table 19701 | 1 | a | 19702 | 2 | b | 19703 | 3 | c | 19704 | 4 | d | 19705 | 5 | 3 | 19706 19707 #+BEGIN_SRC emacs-lisp :var data=example-table[1:3] 19708 data 19709 #+END_SRC 19710 19711 #+RESULTS: 19712 | 2 | b | 19713 | 3 | c | 19714 | 4 | d | 19715 @end example 19716 19717 To pick the entire range, use an empty index, or the single character 19718 @samp{*}. @samp{0:-1} does the same thing. Example below shows how to 19719 reference the first column only. 19720 19721 @example 19722 #+NAME: example-table 19723 | 1 | a | 19724 | 2 | b | 19725 | 3 | c | 19726 | 4 | d | 19727 19728 #+BEGIN_SRC emacs-lisp :var data=example-table[,0] 19729 data 19730 #+END_SRC 19731 19732 #+RESULTS: 19733 | 1 | 2 | 3 | 4 | 19734 @end example 19735 19736 Index referencing can be used for tables and code blocks. Index 19737 referencing can handle any number of dimensions. Commas delimit 19738 multiple dimensions, as shown below. 19739 19740 @example 19741 #+NAME: 3D 19742 #+BEGIN_SRC emacs-lisp 19743 '(((1 2 3) (4 5 6) (7 8 9)) 19744 ((10 11 12) (13 14 15) (16 17 18)) 19745 ((19 20 21) (22 23 24) (25 26 27))) 19746 #+END_SRC 19747 19748 #+BEGIN_SRC emacs-lisp :var data=3D[1,,1] 19749 data 19750 #+END_SRC 19751 19752 #+RESULTS: 19753 | 11 | 14 | 17 | 19754 @end example 19755 19756 Note that row names and column names are not removed prior to variable 19757 indexing. You need to take them into account, even when @samp{colnames} or 19758 @samp{rownames} header arguments remove them. 19759 19760 Emacs lisp code can also set the values for variables. To 19761 differentiate a value from Lisp code, Org interprets any value 19762 starting with @samp{(}, @samp{[}, @samp{'} or @samp{`} as Emacs Lisp code. The result of 19763 evaluating that code is then assigned to the value of that variable. 19764 The following example shows how to reliably query and pass the file 19765 name of the Org mode buffer to a code block using headers. We need 19766 reliability here because the file's name could change once the code in 19767 the block starts executing. 19768 19769 @example 19770 #+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both 19771 wc -w $filename 19772 #+END_SRC 19773 @end example 19774 19775 Note that values read from tables and lists are not mistakenly 19776 evaluated as Emacs Lisp code, as illustrated in the following example. 19777 19778 @example 19779 #+NAME: table 19780 | (a b c) | 19781 19782 #+HEADER: :var data=table[0,0] 19783 #+BEGIN_SRC perl 19784 $data 19785 #+END_SRC 19786 19787 #+RESULTS: 19788 : (a b c) 19789 @end example 19790 19791 @anchor{Using sessions} 19792 @subheading Using sessions 19793 19794 @cindex using sessions in code blocks 19795 @cindex @samp{session}, header argument 19796 Two code blocks can share the same environment. The @samp{session} header 19797 argument is for running multiple source code blocks under one session. 19798 Org runs code blocks with the same session name in the same 19799 interpreter process. 19800 19801 @table @asis 19802 @item @samp{none} 19803 Default. Each code block gets a new interpreter process to execute. 19804 The process terminates once the block is evaluated. 19805 19806 @item @var{STRING} 19807 Any string besides @samp{none} turns that string into the name of that 19808 session. For example, @samp{:session STRING} names it @samp{STRING}. If 19809 @samp{session} has no value, then the session name is derived from the 19810 source language identifier. Subsequent blocks with the same source 19811 code language use the same session. Depending on the language, 19812 state variables, code from other blocks, and the overall interpreted 19813 environment may be shared. Some interpreted languages support 19814 concurrent sessions when subsequent source code language blocks 19815 change session names. 19816 @end table 19817 19818 Only languages that provide interactive evaluation can have session 19819 support. Not all languages provide this support, such as C and ditaa. 19820 Even languages, such as Python and Haskell, that do support 19821 interactive evaluation impose limitations on allowable language 19822 constructs that can run interactively. Org inherits those limitations 19823 for those code blocks running in a session. 19824 19825 @anchor{Choosing a working directory} 19826 @subheading Choosing a working directory 19827 19828 @cindex working directory, in a code block 19829 @cindex @samp{dir}, header argument 19830 @cindex @samp{mkdirp}, header argument 19831 The @samp{dir} header argument specifies the default directory during code 19832 block execution. If it is absent, then the directory associated with 19833 the current buffer is used. In other words, supplying @samp{:dir 19834 DIRECTORY} temporarily has the same effect as changing the current 19835 directory with @kbd{M-x cd @key{RET} DIRECTORY}, and then not setting 19836 @samp{dir}. Under the surface, @samp{dir} simply sets the value of the Emacs 19837 variable @code{default-directory}. Setting @samp{mkdirp} header argument to 19838 a non-@code{nil} value creates the directory, if necessary. 19839 19840 Setting @samp{dir} to the symbol @code{attach} or the string @code{"'attach"} will 19841 set @samp{dir} to the directory returned by @code{(org-attach-dir)}, set @samp{:mkdir 19842 yes}, and insert any file paths, as when using @samp{:results file}, which 19843 are under the node's attachment directory using @samp{attachment:} links 19844 instead of the usual @samp{file:} links. Any returned path outside of the 19845 attachment directory will use @samp{file:} links as per usual. 19846 19847 For example, to save the plot file in the @samp{Work/} folder of the home 19848 directory---notice tilde is expanded: 19849 19850 @example 19851 #+BEGIN_SRC R :file myplot.png :dir ~/Work 19852 matplot(matrix(rnorm(100), 10), type="l") 19853 #+END_SRC 19854 @end example 19855 19856 To evaluate the code block on a remote machine, supply a remote 19857 directory name using Tramp syntax. For example: 19858 19859 @example 19860 #+BEGIN_SRC R :file plot.png :dir /scp:dand@@yakuba.princeton.edu: 19861 plot(1:10, main=system("hostname", intern=TRUE)) 19862 #+END_SRC 19863 @end example 19864 19865 Org first captures the text results as usual for insertion in the Org 19866 file. Then Org also inserts a link to the remote file, thanks to 19867 Emacs Tramp. Org constructs the remote path to the file name from 19868 @samp{dir} and @code{default-directory}, as illustrated here: 19869 19870 @example 19871 [[file:/scp:dand@@yakuba.princeton.edu:/home/dand/plot.png][plot.png]] 19872 @end example 19873 19874 19875 When @samp{dir} is used with @samp{session}, Org sets the starting directory for 19876 a new session. But Org does not alter the directory of an already 19877 existing session. 19878 19879 Do not use @samp{dir} with @samp{:exports results} or with @samp{:exports both} to 19880 avoid Org inserting incorrect links to remote files. That is because 19881 Org does not expand @code{default directory} to avoid some underlying 19882 portability issues. 19883 19884 @anchor{Inserting headers and footers} 19885 @subheading Inserting headers and footers 19886 19887 @cindex headers, in code blocks 19888 @cindex footers, in code blocks 19889 @cindex @samp{prologue}, header argument 19890 The @samp{prologue} header argument is for appending to the top of the code 19891 block for execution, like a reset instruction. For example, you may 19892 use @samp{:prologue "reset"} in a Gnuplot code block or, for every such 19893 block: 19894 19895 @lisp 19896 (add-to-list 'org-babel-default-header-args:gnuplot 19897 '((:prologue . "reset"))) 19898 19899 @end lisp 19900 19901 @cindex @samp{epilogue}, header argument 19902 Likewise, the value of the @samp{epilogue} header argument is for appending 19903 to the end of the code block for execution. 19904 19905 @node Evaluating Code Blocks 19906 @section Evaluating Code Blocks 19907 19908 @cindex code block, evaluating 19909 @cindex source code, evaluating 19910 @cindex @samp{RESULTS}, keyword 19911 19912 A note about security: With code evaluation comes the risk of harm. 19913 Org safeguards by prompting for user's permission before executing any 19914 code in the source block. To customize this safeguard, or disable it, 19915 see @ref{Code Evaluation Security}. 19916 19917 @anchor{How to evaluate source code} 19918 @subheading How to evaluate source code 19919 19920 Org captures the results of the code block evaluation and inserts them 19921 in the Org file, right after the code block. The insertion point is 19922 after a newline and the @samp{RESULTS} keyword. Org creates the @samp{RESULTS} 19923 keyword if one is not already there. More details in @ref{Results of Evaluation}. 19924 19925 By default, Org enables only Emacs Lisp code blocks for execution. 19926 See @ref{Languages} to enable other languages. 19927 19928 @kindex C-c C-c 19929 @kindex C-c C-v e 19930 @findex org-babel-execute-src-block 19931 Org provides many ways to execute code blocks. @kbd{C-c C-c} or 19932 @kbd{C-c C-v e} with the point on a code block@footnote{ The option 19933 @code{org-babel-no-eval-on-ctrl-c-ctrl-c} can be used to remove code 19934 evaluation from the @kbd{C-c C-c} key binding.} calls the 19935 @code{org-babel-execute-src-block} function, which executes the code in the 19936 block, collects the results, and inserts them in the buffer. 19937 19938 @cindex @samp{CALL}, keyword 19939 @vindex org-babel-inline-result-wrap 19940 By calling a named code block@footnote{Actually, the constructs @samp{call_<name>()} and @samp{src_<lang>@{@}} 19941 are not evaluated when they appear in a keyword (see @ref{In-buffer Settings}).} from an Org mode buffer or 19942 a table. Org can call the named code blocks from the current Org mode 19943 buffer or from the ``Library of Babel'' (see @ref{Library of Babel}). 19944 19945 The syntax for @samp{CALL} keyword is: 19946 19947 @example 19948 #+CALL: <name>(<arguments>) 19949 #+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments> 19950 @end example 19951 19952 The syntax for inline named code blocks is: 19953 19954 @example 19955 ... call_<name>(<arguments>) ... 19956 ... call_<name>[<inside header arguments>](<arguments>)[<end header arguments>] ... 19957 @end example 19958 19959 When inline syntax is used, the result is wrapped based on the 19960 variable @code{org-babel-inline-result-wrap}, which by default is set to 19961 @code{"=%s="} to produce verbatim text suitable for markup. 19962 19963 @table @asis 19964 @item @samp{<name>} 19965 This is the name of the code block (see @ref{Structure of Code Blocks}) 19966 to be evaluated in the current document. If the block is located in 19967 another file, start @samp{<name>} with the file name followed by 19968 a colon. For example, in order to execute a block named @samp{clear-data} 19969 in @samp{file.org}, you can write the following: 19970 19971 @example 19972 #+CALL: file.org:clear-data() 19973 @end example 19974 19975 @item @samp{<arguments>} 19976 Org passes arguments to the code block using standard function call 19977 syntax. For example, a @samp{#+CALL:} line that passes @samp{4} to a code 19978 block named @samp{double}, which declares the header argument @samp{:var n=2}, 19979 would be written as: 19980 19981 @example 19982 #+CALL: double(n=4) 19983 @end example 19984 19985 19986 @noindent 19987 Note how this function call syntax is different from the header 19988 argument syntax. 19989 19990 @item @samp{<inside header arguments>} 19991 Org passes inside header arguments to the named code block using the 19992 header argument syntax. Inside header arguments apply to code block 19993 evaluation. For example, @samp{[:results output]} collects results 19994 printed to stdout during code execution of that block. Note how 19995 this header argument syntax is different from the function call 19996 syntax. 19997 19998 @item @samp{<end header arguments>} 19999 End header arguments affect the results returned by the code block. 20000 For example, @samp{:results html} wraps the results in a @samp{#+BEGIN_EXPORT 20001 html} block before inserting the results in the Org buffer. 20002 @end table 20003 20004 @anchor{Limit code block evaluation} 20005 @subheading Limit code block evaluation 20006 20007 @cindex @samp{eval}, header argument 20008 @cindex control code block evaluation 20009 The @samp{eval} header argument can limit evaluation of specific code 20010 blocks and @samp{CALL} keyword. It is useful for protection against 20011 evaluating untrusted code blocks by prompting for a confirmation. 20012 20013 @table @asis 20014 @item @samp{yes} 20015 Org evaluates the source code, possibly asking permission according 20016 to @code{org-confirm-babel-evaluate}. 20017 20018 @item @samp{never} or @samp{no} 20019 Org never evaluates the source code. 20020 20021 @item @samp{query} 20022 Org prompts the user for permission to evaluate the source code. 20023 20024 @item @samp{never-export} or @samp{no-export} 20025 Org does not evaluate the source code when exporting, yet the user 20026 can evaluate it interactively. 20027 20028 @item @samp{query-export} 20029 Org prompts the user for permission to evaluate the source code 20030 during export. 20031 @end table 20032 20033 If @samp{eval} header argument is not set, then Org determines whether to 20034 evaluate the source code from the @code{org-confirm-babel-evaluate} 20035 variable (see @ref{Code Evaluation Security}). 20036 20037 @anchor{Cache results of evaluation} 20038 @subheading Cache results of evaluation 20039 20040 @cindex @samp{cache}, header argument 20041 @cindex cache results of code evaluation 20042 The @samp{cache} header argument is for caching results of evaluating code 20043 blocks. Caching results can avoid re-evaluating a code block that 20044 have not changed since the previous run. To benefit from the cache 20045 and avoid redundant evaluations, the source block must have a result 20046 already present in the buffer, and neither the header 20047 arguments---including the value of @samp{var} references---nor the text of 20048 the block itself has changed since the result was last computed. This 20049 feature greatly helps avoid long-running calculations. For some edge 20050 cases, however, the cached results may not be reliable. 20051 20052 The caching feature is best for when code blocks are pure functions, 20053 that is functions that return the same value for the same input 20054 arguments (see @ref{Environment of a Code Block}), and that do not have 20055 side effects, and do not rely on external variables other than the 20056 input arguments. Functions that depend on a timer, file system 20057 objects, and random number generators are clearly unsuitable for 20058 caching. 20059 20060 A note of warning: when @samp{cache} is used in a session, caching may 20061 cause unexpected results. 20062 20063 When the caching mechanism tests for any source code changes, it does 20064 not expand noweb style references (see @ref{Noweb Reference Syntax}). 20065 20066 The @samp{cache} header argument can have one of two values: @samp{yes} or @samp{no}. 20067 20068 @table @asis 20069 @item @samp{no} 20070 Default. No caching of results; code block evaluated every time. 20071 20072 @item @samp{yes} 20073 Whether to run the code or return the cached results is determined 20074 by comparing the SHA1 hash value of the combined code block and 20075 arguments passed to it. This hash value is packed on the 20076 @samp{#+RESULTS:} line from previous evaluation. When hash values match, 20077 Org does not evaluate the code block. When hash values mismatch, 20078 Org evaluates the code block, inserts the results, recalculates the 20079 hash value, and updates @samp{#+RESULTS:} line. 20080 @end table 20081 20082 In this example, both functions are cached. But @samp{caller} runs only if 20083 the result from @samp{random} has changed since the last run. 20084 20085 @example 20086 #+NAME: random 20087 #+BEGIN_SRC R :cache yes 20088 runif(+1) 20089 #+END_SRC 20090 20091 #+RESULTS[a2a72cd647ad44515fab62e144796432793d68e1]: random 20092 0.4659510825295 20093 20094 #+NAME: caller 20095 #+BEGIN_SRC emacs-lisp :var x=random :cache yes 20096 x 20097 #+END_SRC 20098 20099 #+RESULTS[bec9c8724e397d5df3b696502df3ed7892fc4f5f]: caller 20100 0.254227238707244 20101 @end example 20102 20103 @node Results of Evaluation 20104 @section Results of Evaluation 20105 20106 @cindex code block, results of evaluation 20107 @cindex source code, results of evaluation 20108 20109 @cindex @samp{results}, header argument 20110 How Org handles results of a code block execution depends on many 20111 header arguments working together. The primary determinant, however, 20112 is the @samp{results} header argument. It accepts four classes of options. 20113 Each code block can take only one option per class: 20114 20115 @table @asis 20116 @item Collection 20117 For how the results should be collected from the code block; 20118 20119 @item Type 20120 For which type of result the code block will return; affects how Org 20121 processes and inserts results in the Org buffer; 20122 20123 @item Format 20124 For the result; affects how Org processes results; 20125 20126 @item Handling 20127 For inserting results once they are properly formatted. 20128 @end table 20129 20130 @anchor{Collection} 20131 @subheading Collection 20132 20133 Collection options specify the results. Choose one of the options; 20134 they are mutually exclusive. 20135 20136 @table @asis 20137 @item @samp{value} 20138 Default for most Babel libraries@footnote{Actually, the constructs @samp{call_<name>()} and @samp{src_<lang>@{@}} 20139 are not evaluated when they appear in a keyword (see @ref{In-buffer Settings}).}. Functional mode. Org 20140 gets the value by wrapping the code in a function definition in the 20141 language of the source block. That is why when using @samp{:results 20142 value}, code should execute like a function and return a value. For 20143 languages like Python, an explicit @code{return} statement is mandatory 20144 when using @samp{:results value}. Result is the value returned by the 20145 last statement in the code block. 20146 20147 When evaluating the code block in a session (see @ref{Environment of a Code Block}), Org passes the code to an interpreter running as an 20148 interactive Emacs inferior process. Org gets the value from the 20149 source code interpreter's last statement output. Org has to use 20150 language-specific methods to obtain the value. For example, from 20151 the variable @code{_} in Ruby, and the value of @code{.Last.value} in R@. 20152 20153 @item @samp{output} 20154 Scripting mode. Org passes the code to an external process running 20155 the interpreter. Org returns the contents of the standard output 20156 stream as text results. 20157 20158 When using a session, Org passes the code to the interpreter running 20159 as an interactive Emacs inferior process. Org concatenates any text 20160 output from the interpreter and returns the collection as a result. 20161 @end table 20162 20163 @anchor{Type} 20164 @subheading Type 20165 20166 Type tells what result types to expect from the execution of the code 20167 block. Choose one of the options; they are mutually exclusive. 20168 20169 The default behavior is to automatically determine the result type. 20170 The result type detection depends on the code block language, as 20171 described in the documentation for individual languages. See 20172 @ref{Languages}. 20173 20174 @table @asis 20175 @item @samp{table} 20176 @itemx @samp{vector} 20177 Interpret the results as an Org table. If the result is a single 20178 value, create a table with one row and one column. Usage example: 20179 @samp{:results value table}. 20180 20181 @cindex @samp{hlines}, header argument 20182 In-between each table row or below the table headings, sometimes 20183 results have horizontal lines, which are also known as ``hlines''. 20184 The @samp{hlines} argument with the default @samp{no} value strips such lines 20185 from the input table. For most code, this is desirable, or else 20186 those @samp{hline} symbols raise unbound variable errors. A @samp{yes} 20187 accepts such lines, as demonstrated in the following example. 20188 20189 @example 20190 #+NAME: many-cols 20191 | a | b | c | 20192 |---+---+---| 20193 | d | e | f | 20194 |---+---+---| 20195 | g | h | i | 20196 20197 #+NAME: no-hline 20198 #+BEGIN_SRC python :var tab=many-cols :hlines no 20199 return tab 20200 #+END_SRC 20201 20202 #+RESULTS: no-hline 20203 | a | b | c | 20204 | d | e | f | 20205 | g | h | i | 20206 20207 #+NAME: hlines 20208 #+BEGIN_SRC python :var tab=many-cols :hlines yes 20209 return tab 20210 #+END_SRC 20211 20212 #+RESULTS: hlines 20213 | a | b | c | 20214 |---+---+---| 20215 | d | e | f | 20216 |---+---+---| 20217 | g | h | i | 20218 @end example 20219 20220 @item @samp{list} 20221 Interpret the results as an Org list. If the result is a single 20222 value, create a list of one element. 20223 20224 @item @samp{scalar} 20225 @itemx @samp{verbatim} 20226 Interpret literally and insert as quoted text. Do not create 20227 a table. Usage example: @samp{:results value verbatim}. 20228 20229 @item @samp{file} 20230 Interpret as a filename. Save the results of execution of the code 20231 block to that file, then insert a link to it. You can control both 20232 the filename and the description associated to the link. 20233 20234 @cindex @samp{file}, header argument 20235 @cindex @samp{output-dir}, header argument 20236 Org first tries to generate the filename from the value of the 20237 @samp{file} header argument and the directory specified using the 20238 @samp{output-dir} header arguments. If @samp{output-dir} is not specified, 20239 Org assumes it is the current directory. 20240 20241 @example 20242 #+BEGIN_SRC asymptote :results value file :file circle.pdf :output-dir img/ 20243 size(2cm); 20244 draw(unitcircle); 20245 #+END_SRC 20246 @end example 20247 20248 @cindex @samp{file-ext}, header argument 20249 If @samp{file} header argument is missing, Org generates the base name of 20250 the output file from the name of the code block, and its extension 20251 from the @samp{file-ext} header argument. In that case, both the name 20252 and the extension are mandatory. 20253 20254 Result can also be interpreted as path to file. See @samp{:results 20255 link}. 20256 20257 @example 20258 #+name: circle 20259 #+BEGIN_SRC asymptote :results value file :file-ext pdf 20260 size(2cm); 20261 draw(unitcircle); 20262 #+END_SRC 20263 @end example 20264 20265 @cindex @samp{file-desc}, header argument 20266 The @samp{file-desc} header argument defines the description (see @ref{Link Format}) for the link. If @samp{file-desc} is present but has no value, 20267 the @samp{file} value is used as the link description. When this 20268 argument is not present, the description is omitted. If you want to 20269 provide the @samp{file-desc} argument but omit the description, you can 20270 provide it with an empty vector (i.e., :file-desc []). 20271 20272 @cindex @samp{sep}, header argument 20273 By default, Org assumes that a table written to a file has 20274 TAB-delimited output. You can choose a different separator with 20275 the @samp{sep} header argument. 20276 20277 @cindex @samp{file-mode}, header argument 20278 The @samp{file-mode} header argument defines the file permissions. To 20279 make it executable, use @samp{:file-mode (identity #o755)}. 20280 20281 @example 20282 #+BEGIN_SRC shell :results file :file script.sh :file-mode (identity #o755) 20283 echo "#!/bin/bash" 20284 echo "echo Hello World" 20285 #+END_SRC 20286 @end example 20287 @end table 20288 20289 @anchor{Format} 20290 @subheading Format 20291 20292 Format pertains to the type of the result returned by the code block. 20293 Choose one of the options; they are mutually exclusive. The default 20294 follows from the type specified above. 20295 20296 @table @asis 20297 @item @samp{raw} 20298 Interpreted as raw Org mode. Inserted directly into the buffer. 20299 Aligned if it is a table. Usage example: @samp{:results value raw}. 20300 20301 @item @samp{code} 20302 Result enclosed in a code block. Useful for parsing. Usage 20303 example: @samp{:results value code}. 20304 20305 @item @samp{drawer} 20306 Results are added directly to the Org file as with @samp{raw}, but are 20307 wrapped in a @samp{RESULTS} drawer or results macro (for inline code 20308 blocks), for later scripting and automated processing. 20309 Usage example: @samp{:results value drawer}. 20310 20311 @item @samp{html} 20312 Results enclosed in a @samp{BEGIN_EXPORT html} block. Usage example: 20313 @samp{:results value html}. 20314 20315 @item @samp{latex} 20316 Results enclosed in a @samp{BEGIN_EXPORT latex} block. Usage example: 20317 @samp{:results value latex}. 20318 20319 @item @samp{link} 20320 @itemx @samp{graphics} 20321 When used along with @samp{file} type, the result is a link to the file 20322 specified in @samp{:file} header argument. However, unlike plain @samp{file} 20323 type, code block output is not written to the disk. The block is 20324 expected to generate the file by its side-effects only, as in the 20325 following example: 20326 20327 @example 20328 #+begin_src shell :results file link :file "org-mode-unicorn.svg" 20329 wget -c "https://orgmode.org/resources/img/org-mode-unicorn.svg" 20330 #+end_src 20331 20332 #+RESULTS: 20333 [[file:org-mode-unicorn.svg]] 20334 @end example 20335 20336 If @samp{:file} header argument is omitted, interpret source block result 20337 as the file path. 20338 20339 @item @samp{org} 20340 Results enclosed in a @samp{BEGIN_SRC org} block. For comma-escape, 20341 either @kbd{@key{TAB}} in the block, or export the file. Usage 20342 example: @samp{:results value org}. 20343 20344 @item @samp{pp} 20345 Result converted to pretty-print source code. Enclosed in a code 20346 block. Languages supported: Emacs Lisp, Python, and Ruby. Usage 20347 example: @samp{:results value pp}. 20348 @end table 20349 20350 20351 @cindex @samp{wrap}, header argument 20352 The @samp{wrap} header argument unconditionally marks the results block by 20353 appending strings to @samp{#+BEGIN_} and @samp{#+END_}. If no string is 20354 specified, Org wraps the results in a @samp{#+BEGIN_results} 20355 @dots{} @samp{#+END_results} block. It takes precedent over the @samp{results} 20356 value listed above. E.g., 20357 20358 @example 20359 #+BEGIN_SRC emacs-lisp :results html :wrap EXPORT markdown 20360 "<blink>Welcome back to the 90's</blink>" 20361 #+END_SRC 20362 20363 #+RESULTS: 20364 #+BEGIN_EXPORT markdown 20365 <blink>Welcome back to the 90's</blink> 20366 #+END_EXPORT 20367 @end example 20368 20369 @anchor{Handling} 20370 @subheading Handling 20371 20372 Handling options after collecting the results. Choose one of the 20373 options; they are mutually exclusive. 20374 20375 @table @asis 20376 @item @samp{replace} 20377 Default. Insert results in the Org buffer. Remove previous 20378 results. Usage example: @samp{:results output replace}. 20379 20380 @item @samp{silent} 20381 Do not insert results in the Org mode buffer, but echo them in the 20382 minibuffer. Usage example: @samp{:results output silent}. 20383 20384 @item @samp{none} 20385 Compute results, but do not do anything with them. No inserting in 20386 the Org mode buffer nor echo them in the minibuffer. The results 20387 can still be used when referenced from another code block. 20388 Usage example: @samp{:results none}. 20389 20390 @item @samp{discard} 20391 Ignore the results completely. This option is similar to @samp{none}, 20392 but no processing is performed on the return value. Calling the 20393 code block programmatically (see @ref{How to evaluate source code}) or by 20394 reference (see @ref{Passing arguments} and @ref{Noweb Reference Syntax}) will 20395 always yield @code{nil}. 20396 20397 @item @samp{append} 20398 Append results to the Org buffer. Latest results are at the bottom. 20399 Does not remove previous results. Usage example: @samp{:results output 20400 append}. 20401 20402 @item @samp{prepend} 20403 Prepend results to the Org buffer. Latest results are at the top. 20404 Does not remove previous results. Usage example: @samp{:results output 20405 prepend}. 20406 @end table 20407 20408 @anchor{Post-processing} 20409 @subheading Post-processing 20410 20411 @cindex @samp{post}, header argument 20412 @cindex @samp{*this*}, in @samp{post} header argument 20413 The @samp{post} header argument is for post-processing results from block 20414 evaluation. When @samp{post} has any value, Org binds the results to 20415 @code{*this*} variable for easy passing to @samp{var} header argument 20416 specifications (see @ref{Environment of a Code Block}). That makes results 20417 available to other code blocks, or even for direct Emacs Lisp code 20418 execution. 20419 20420 The following two examples illustrate @samp{post} header argument in 20421 action. The first one shows how to attach an @samp{ATTR_LATEX} keyword 20422 using @samp{post}. 20423 20424 @example 20425 #+NAME: attr_wrap 20426 #+BEGIN_SRC sh :var data="" :var width="\\textwidth" :results output 20427 echo "#+ATTR_LATEX: :width $width" 20428 echo "$data" 20429 #+END_SRC 20430 20431 #+HEADER: :file /tmp/it.png 20432 #+BEGIN_SRC dot :post attr_wrap(width="5cm", data=*this*) :results drawer 20433 digraph@{ 20434 a -> b; 20435 b -> c; 20436 c -> a; 20437 @} 20438 #+end_src 20439 20440 #+RESULTS: 20441 :RESULTS: 20442 #+ATTR_LATEX :width 5cm 20443 [[file:/tmp/it.png]] 20444 :END: 20445 @end example 20446 20447 The second example shows use of @samp{colnames} header argument in @samp{post} 20448 to pass data between code blocks. 20449 20450 @example 20451 #+NAME: round-tbl 20452 #+BEGIN_SRC emacs-lisp :var tbl="" fmt="%.3f" 20453 (mapcar (lambda (row) 20454 (mapcar (lambda (cell) 20455 (if (numberp cell) 20456 (format fmt cell) 20457 cell)) 20458 row)) 20459 tbl) 20460 #+end_src 20461 20462 #+BEGIN_SRC R :colnames yes :post round-tbl[:colnames yes](*this*) 20463 set.seed(42) 20464 data.frame(foo=rnorm(1)) 20465 #+END_SRC 20466 20467 #+RESULTS: 20468 | foo | 20469 |-------| 20470 | 1.371 | 20471 @end example 20472 20473 @node Exporting Code Blocks 20474 @section Exporting Code Blocks 20475 20476 @cindex code block, exporting 20477 @cindex source code, exporting 20478 20479 It is possible to export the @emph{code} of code blocks, the @emph{results} of 20480 code block evaluation, @emph{both} the code and the results of code block 20481 evaluation, or @emph{none}. Org defaults to exporting @emph{code} for most 20482 languages and @emph{results} for inline code blocks. For some languages, 20483 such as ditaa, Org defaults to @emph{results} both in ordinary source 20484 blocks and in inline source blocks. To export just the body of code 20485 blocks, see @ref{Literal Examples}. To selectively export subtrees of an 20486 Org document, see @ref{Exporting}. 20487 20488 @cindex @samp{exports}, header argument 20489 The @samp{exports} header argument is to specify if that part of the Org 20490 file is exported to, say, HTML or @LaTeX{} formats. 20491 20492 @table @asis 20493 @item @samp{code} 20494 The default. The body of code is included into the exported file. 20495 Example: @samp{:exports code}. 20496 20497 @item @samp{results} 20498 The results of evaluation of the code is included in the exported 20499 file. Example: @samp{:exports results}. 20500 20501 @item @samp{both} 20502 Both the code and results of evaluation are included in the exported 20503 file. Example: @samp{:exports both}. 20504 20505 @item @samp{none} 20506 Neither the code nor the results of evaluation is included in the 20507 exported file. Whether the code is evaluated at all depends on 20508 other options. Example: @samp{:exports none}. 20509 @end table 20510 20511 If a source block is named using @samp{NAME} keyword, the same name will be 20512 assigned to the results of evaluation. This way, fuzzy links pointing 20513 to the named source blocks exported using @samp{:exports results} will 20514 remain valid and point to the results of evaluation. 20515 20516 Results of evaluation of a named block can also be explicitly named 20517 using a separate @samp{NAME} keyword. The name value set via @samp{NAME} 20518 keyword will be preferred over the parent source block. 20519 20520 @example 20521 #+NAME: code name 20522 #+BEGIN_SRC emacs-lisp :exports both value 20523 (+ 1 2) 20524 #+END_SRC 20525 20526 #+NAME: results name 20527 #+RESULTS: code name 20528 3 20529 20530 This [[code name][link]] will point to the code block. 20531 Another [[results name][link]] will point to the results. 20532 @end example 20533 20534 20535 Explicit setting of the result name may be necessary when a named code 20536 block is exported using @samp{:exports both}. Links to such block may 20537 arbitrarily point either to the code block or to its results when 20538 results do not have a distinct name. 20539 20540 Note that all the links pointing to a source block exported using 20541 @samp{:exports none} will be broken. This will make export process fail, 20542 unless broken links are allowed during export (see @ref{Export Settings}). 20543 20544 @vindex org-export-use-babel 20545 To stop Org from evaluating code blocks to speed exports, use the 20546 header argument @samp{:eval never-export} (see @ref{Evaluating Code Blocks}). 20547 To stop Org from evaluating code blocks for greater security, set the 20548 @code{org-export-use-babel} variable to @code{nil}, but understand that header 20549 arguments will have no effect. 20550 20551 Turning off evaluation comes in handy when batch processing. For 20552 example, markup languages for wikis, which have a high risk of 20553 untrusted code. Stopping code block evaluation also stops evaluation 20554 of all header arguments of the code block. This may not be desirable 20555 in some circumstances. So during export, to allow evaluation of just 20556 the header arguments but not any code evaluation in the source block, 20557 set @samp{:eval never-export} (see @ref{Evaluating Code Blocks}). 20558 20559 Org never evaluates code blocks in commented subtrees when exporting 20560 (see @ref{Comment Lines}). On the other hand, Org does evaluate code 20561 blocks in subtrees excluded from export (see @ref{Export Settings}). 20562 20563 @node Extracting Source Code 20564 @section Extracting Source Code 20565 20566 @cindex tangling 20567 @cindex source code, extracting 20568 @cindex code block, extracting source code 20569 20570 Extracting source code from code blocks is a basic task in literate 20571 programming. Org has features to make this easy. In literate 20572 programming parlance, documents on creation are @emph{woven} with code and 20573 documentation, and on export, the code is tangled for execution by 20574 a computer. Org facilitates weaving and tangling for producing, 20575 maintaining, sharing, and exporting literate programming documents. 20576 Org provides extensive customization options for extracting source 20577 code. 20578 20579 When Org tangles code blocks, it expands, merges, and transforms them. 20580 Then Org recomposes them into one or more separate files, as 20581 configured through the options. During this tangling process, Org 20582 expands variables in the source code, and resolves any noweb style 20583 references (see @ref{Noweb Reference Syntax}). 20584 20585 @anchor{Header arguments} 20586 @subheading Header arguments 20587 20588 @cindex @samp{tangle}, header argument 20589 The @samp{tangle} header argument specifies if the code block is exported 20590 to source file(s). 20591 20592 @table @asis 20593 @item @samp{yes} 20594 Export the code block to source file. The file name for the source 20595 file is derived from the name of the Org file, and the file 20596 extension is derived from the source code language identifier. 20597 Example: @samp{:tangle yes}. 20598 20599 @item @samp{no} 20600 The default. Do not extract the code in a source code file. 20601 Example: @samp{:tangle no}. 20602 20603 @item @var{FILENAME} 20604 Export the code block to source file whose file name is derived from 20605 any string passed to the @samp{tangle} header argument. Org derives the 20606 file name as being relative to the directory of the Org file's 20607 location. Example: @samp{:tangle FILENAME}. 20608 @end table 20609 20610 @cindex @samp{mkdirp}, header argument 20611 The @samp{mkdirp} header argument creates parent directories for tangled 20612 files if the directory does not exist. A @samp{yes} value enables 20613 directory creation whereas @samp{no} inhibits it. 20614 20615 @cindex @samp{comments}, header argument 20616 The @samp{comments} header argument controls inserting comments into 20617 tangled files. These are above and beyond whatever comments may 20618 already exist in the code block. 20619 20620 @table @asis 20621 @item @samp{no} 20622 The default. Do not insert any extra comments during tangling. 20623 20624 @item @samp{link} 20625 Wrap the code block in comments. Include links pointing back to the 20626 place in the Org file from where the code was tangled. 20627 20628 @item @samp{yes} 20629 Kept for backward compatibility; same as @samp{link}. 20630 20631 @item @samp{org} 20632 Nearest headline text from Org file is inserted as comment. The 20633 exact text that is inserted is picked from the leading context of 20634 the source block. 20635 20636 @item @samp{both} 20637 Includes both @samp{link} and @samp{org} options. 20638 20639 @item @samp{noweb} 20640 Includes @samp{link} option, expands noweb references (see @ref{Noweb Reference Syntax}), and wraps them in link comments inside the body 20641 of the code block. 20642 @end table 20643 20644 @cindex @samp{padline}, header argument 20645 The @samp{padline} header argument controls insertion of newlines to pad 20646 source code in the tangled file. 20647 20648 @table @asis 20649 @item @samp{yes} 20650 Default. Insert a newline before and after each code block in the 20651 tangled file. 20652 20653 @item @samp{no} 20654 Do not insert newlines to pad the tangled code blocks. 20655 @end table 20656 20657 @cindex @samp{shebang}, header argument 20658 The @samp{shebang} header argument can turn results into executable script 20659 files. By setting it to a string value---for example, @samp{:shebang 20660 "#!/bin/bash"}---Org inserts that string as the first line of the 20661 tangled file that the code block is extracted to. Org then turns on 20662 the tangled file's executable permission. 20663 20664 @cindex @samp{tangle-mode}, header argument 20665 The @samp{tangle-mode} header argument specifies what permissions to set 20666 for tangled files by @code{set-file-modes}. Permissions are given by an 20667 octal value, which can be provided calling the @code{identity} function on 20668 an elisp octal value. For instance, to create a read-only file one may 20669 use @samp{:tangle-mode (identity #o444)}. To reduce the verbosity required, 20670 a octal shorthand is defined, @samp{oXXX} (@samp{o} for octal). Using this, our 20671 read-only example is @samp{:tangle-mode o444}. Omitting the @samp{o} prefix will 20672 cause the argument to be interpreted as an integer, which can lead to 20673 unexpected results (@samp{444} is the same as @samp{o674}). 20674 Two other shorthands are recognized, ls-style strings like 20675 @samp{rw-r--r--}, and chmod-style permissions like @samp{g+w}. 20676 Note that chmod-style permissions are based on 20677 @code{org-babel-tangle-default-file-mode}, which is @samp{#o544} by default. 20678 20679 When @samp{:tangle-mode} and @samp{:shebang} are both specified, the give 20680 @samp{:tangle-mode} will override the permissions from @samp{:shebang}. When 20681 multiple source code blocks tangle to a single file with conflicting 20682 @samp{:tangle-mode} header arguments, Org's behavior is undefined. 20683 20684 @cindex @samp{no-expand}, header argument 20685 By default Org expands code blocks during tangling. The @samp{no-expand} 20686 header argument turns off such expansions. Note that one side-effect 20687 of expansion by @code{org-babel-expand-src-block} also assigns values (see 20688 @ref{Environment of a Code Block}) to variables. Expansions also replace 20689 noweb references with their targets (see @ref{Noweb Reference Syntax}). 20690 Some of these expansions may cause premature assignment, hence this 20691 option. This option makes a difference only for tangling. It has no 20692 effect when exporting since code blocks for execution have to be 20693 expanded anyway. 20694 20695 @anchor{Functions} 20696 @subheading Functions 20697 20698 @table @asis 20699 @item @code{org-babel-tangle} 20700 @findex org-babel-tangle 20701 @kindex C-c C-v t 20702 Tangle the current file. Bound to @kbd{C-c C-v t}. 20703 20704 With prefix argument only tangle the current code block. 20705 20706 @item @code{org-babel-tangle-file} 20707 @findex org-babel-tangle-file 20708 @kindex C-c C-v f 20709 Choose a file to tangle. Bound to @kbd{C-c C-v f}. 20710 @end table 20711 20712 @anchor{Tangle hooks} 20713 @subheading Tangle hooks 20714 20715 @table @asis 20716 @item @code{org-babel-pre-tangle-hook} 20717 @vindex org-babel-pre-tangle-hook 20718 This hook is run before the tangle process begins. The active 20719 buffer is buffer to be tangled. 20720 20721 @item @code{org-babel-tangle-body-hook} 20722 @vindex org-babel-tangle-body-hook 20723 This hook is run from a temporary buffer containing expanded code of 20724 every tangled code block. The hook can modify the expanded code as 20725 needed. The contents of the current buffer will be used as actual 20726 code block expansion. 20727 20728 @item @code{org-babel-post-tangle-hook} 20729 @vindex org-babel-post-tangle-hook 20730 This hook is run from within code files tangled by 20731 @code{org-babel-tangle}, making it suitable for post-processing, 20732 compilation, and evaluation of code in the tangled files. 20733 20734 @item @code{org-babel-tangle-finished-hook} 20735 @vindex org-babel-tangle-finished-hook 20736 This hook is run after post-tangle hooks, in the original buffer. 20737 @end table 20738 20739 @anchor{Jumping between code and Org} 20740 @subheading Jumping between code and Org 20741 20742 @findex org-babel-tangle-jump-to-org 20743 Debuggers normally link errors and messages back to the source code. 20744 But for tangled files, we want to link back to the Org file, not to 20745 the tangled source file. To make this extra jump, Org uses 20746 @code{org-babel-tangle-jump-to-org} function with two additional source 20747 code block header arguments: 20748 20749 @enumerate 20750 @item 20751 Set @samp{padline} to true---this is the default setting. 20752 @item 20753 Set @samp{comments} to @samp{link}, which makes Org insert links to the Org 20754 file. 20755 @end enumerate 20756 20757 @node Languages 20758 @section Languages 20759 20760 @cindex babel, languages 20761 @cindex source code, languages 20762 @cindex code block, languages 20763 20764 Code blocks in dozens of languages are supported. See Worg website 20765 for @uref{https://orgmode.org/worg/org-contrib/babel/languages/index.html, language specific documentation}. 20766 20767 @vindex org-babel-load-languages 20768 By default, only Emacs Lisp is enabled for evaluation. To enable or 20769 disable other languages, customize the @code{org-babel-load-languages} 20770 variable either through the Emacs customization interface, or by 20771 adding code to the init file as shown next. 20772 20773 In this example, evaluation is disabled for Emacs Lisp, and enabled 20774 for R@. 20775 20776 @lisp 20777 (org-babel-do-load-languages 20778 'org-babel-load-languages 20779 '((emacs-lisp . nil) 20780 (R . t))) 20781 @end lisp 20782 20783 Note that this is not the only way to enable a language. Org also 20784 enables languages when loaded with @code{require} statement. For example, 20785 the following enables execution of Clojure code blocks: 20786 20787 @lisp 20788 (require 'ob-clojure) 20789 @end lisp 20790 20791 @node Editing Source Code 20792 @section Editing Source Code 20793 20794 @cindex code block, editing 20795 @cindex source code, editing 20796 20797 @kindex C-c ' 20798 Use @kbd{C-c '} to edit the current code block. It opens a new 20799 major mode edit buffer containing the body of the source code block, 20800 ready for any edits. Use @kbd{C-c '} again to close the buffer 20801 and return to the Org buffer. 20802 20803 @kindex C-x C-s 20804 @vindex org-edit-src-auto-save-idle-delay 20805 @cindex auto-save, in code block editing 20806 @kbd{C-x C-s} saves the buffer and updates the contents of the 20807 Org buffer. Set @code{org-edit-src-auto-save-idle-delay} to save the base 20808 buffer after a certain idle delay time. Set 20809 @code{org-edit-src-turn-on-auto-save} to auto-save this buffer into 20810 a separate file using Auto-save mode. 20811 20812 While editing the source code in the major mode, the Org Src minor 20813 mode remains active. It provides these customization variables as 20814 described below. For even more variables, look in the customization 20815 group @code{org-edit-structure}. 20816 20817 @table @asis 20818 @item @code{org-src-lang-modes} 20819 @vindex org-src-lang-modes 20820 If an Emacs major-mode named @code{<LANG>-mode} exists, where 20821 @var{<LANG>} is the language identifier from code block's 20822 header line, then the edit buffer uses that major mode. Use this 20823 variable to arbitrarily map language identifiers to major modes. 20824 20825 When language identifier is omitted in the src block, Org mode's 20826 behavior is undefined. 20827 20828 @item @code{org-src-window-setup} 20829 @vindex org-src-window-setup 20830 For specifying Emacs window arrangement when the new edit buffer is 20831 created. 20832 20833 @item @code{org-src-preserve-indentation} 20834 @cindex indentation, in code blocks 20835 @vindex org-src-preserve-indentation 20836 Default is @code{nil}. Source code is indented. This indentation 20837 applies during export or tangling, and depending on the context, may 20838 alter leading spaces and tabs. When non-@code{nil}, source code is 20839 aligned with the leftmost column. No lines are modified during 20840 export or tangling, which is very useful for white-space sensitive 20841 languages, such as Python. 20842 20843 @item @code{org-src-ask-before-returning-to-edit-buffer} 20844 @vindex org-src-ask-before-returning-to-edit-buffer 20845 When @code{nil}, Org returns to the edit buffer without further prompts. 20846 The default prompts for a confirmation. 20847 @end table 20848 20849 @vindex org-src-fontify-natively 20850 @vindex org-src-block-faces 20851 Fontification of code blocks can give visual separation of text and 20852 code on the display page. Set @code{org-src-fontify-natively} to non-@code{nil} 20853 to turn on native code fontification in the @emph{Org} buffer. The 20854 fontification follows the major mode used to edit the code block (see 20855 @code{org-src-lang-modes} above). 20856 20857 To further customize the appearance of @code{org-block} for specific 20858 languages, customize @code{org-src-block-faces}. The following example 20859 shades the background of regular blocks, and colors source blocks only 20860 for Python and Emacs Lisp languages. 20861 20862 @lisp 20863 (require 'color) 20864 (set-face-attribute 'org-block nil :background 20865 (color-darken-name 20866 (face-attribute 'default :background) 3)) 20867 20868 (setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF")) 20869 ("python" (:background "#E5FFB8")))) 20870 @end lisp 20871 20872 @node Noweb Reference Syntax 20873 @section Noweb Reference Syntax 20874 20875 @cindex code block, noweb reference 20876 @cindex syntax, noweb 20877 @cindex source code, noweb reference 20878 20879 @cindex @samp{noweb-ref}, header argument 20880 Source code blocks can include references to other source code blocks, 20881 using a noweb@footnote{ For noweb literate programming details, see 20882 @uref{https://www.cs.tufts.edu/~nr/noweb/}.} style syntax: 20883 20884 @example 20885 <<CODE-BLOCK-ID>> 20886 @end example 20887 20888 20889 @noindent 20890 where @var{CODE-BLOCK-ID} refers to either the @samp{NAME} of a single 20891 source code block, or a collection of one or more source code blocks 20892 sharing the same @samp{noweb-ref} header argument (see @ref{Using Header Arguments}). Org can replace such references with the source code of 20893 the block or blocks being referenced, or, in the case of a single 20894 source code block named with @samp{NAME}, with the results of an evaluation 20895 of that block. 20896 20897 @cindex @samp{noweb}, header argument 20898 The @samp{noweb} header argument controls expansion of noweb syntax 20899 references. Expansions occur when source code blocks are evaluated, 20900 tangled, or exported. 20901 20902 @table @asis 20903 @item @samp{no} 20904 Default. No expansion of noweb syntax references in the body of the 20905 code when evaluating, tangling, or exporting. 20906 20907 @item @samp{yes} 20908 Expansion of noweb syntax references in the body of the code block 20909 when evaluating, tangling, or exporting. 20910 20911 @item @samp{tangle} 20912 Expansion of noweb syntax references in the body of the code block 20913 when tangling. No expansion when evaluating or exporting. 20914 20915 @item @samp{strip-tangle} 20916 Expansion of noweb syntax references in the body of the code block 20917 when evaluating or exporting. Removes noweb syntax references 20918 when exporting. 20919 20920 @item @samp{no-export} 20921 Expansion of noweb syntax references in the body of the code block 20922 when evaluating or tangling. No expansion when exporting. 20923 20924 @item @samp{strip-export} 20925 Expansion of noweb syntax references in the body of the code block 20926 when expanding prior to evaluating or tangling. Removes noweb 20927 syntax references when exporting. 20928 20929 @item @samp{eval} 20930 Expansion of noweb syntax references in the body of the code block 20931 only before evaluating. 20932 @end table 20933 20934 In the most simple case, the contents of a single source block is 20935 inserted within other blocks. Thus, in following example, 20936 20937 @example 20938 #+NAME: initialization 20939 #+BEGIN_SRC emacs-lisp 20940 (setq sentence "Never a foot too far, even.") 20941 #+END_SRC 20942 20943 #+BEGIN_SRC emacs-lisp :noweb yes 20944 <<initialization>> 20945 (reverse sentence) 20946 #+END_SRC 20947 @end example 20948 20949 @noindent 20950 the second code block is expanded as 20951 20952 @example 20953 #+BEGIN_SRC emacs-lisp :noweb yes 20954 (setq sentence "Never a foot too far, even.") 20955 (reverse sentence) 20956 #+END_SRC 20957 @end example 20958 20959 Note that noweb expansion does not automatically carry over @samp{:var} 20960 header arguments@footnote{In the following example, attempting to evaluate 20961 the second code block will give an error, because the variables 20962 defined in the first code block will not be defined in the second 20963 block. 20964 @example 20965 #+NAME: get-prompt 20966 #+BEGIN_SRC emacs-lisp :var prompt="root> " :var command="ls" 20967 (concat prompt command) 20968 #+END_SRC 20969 #+RESULTS: get-prompt 20970 : root> ls 20971 #+BEGIN_SRC emacs-lisp :noweb yes 20972 <<get-prompt>> 20973 #+END_SRC 20974 @end example 20975 The previous block is expanded without setting @code{prompt} and @code{command} 20976 values. 20977 @example 20978 #+BEGIN_SRC emacs-lisp 20979 (concat prompt command) 20980 #+END_SRC 20981 @end example 20982 }. 20983 20984 You may also include the contents of multiple blocks sharing a common 20985 @samp{noweb-ref} header argument, which can be set at the file, subtree, 20986 or code block level. In the example Org file shown next, the body of 20987 the source code in each block is extracted for concatenation to a pure 20988 code file when tangled. 20989 20990 @example 20991 #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh 20992 <<fullest-disk>> 20993 #+END_SRC 20994 * the mount point of the fullest disk 20995 :PROPERTIES: 20996 :header-args: :noweb-ref fullest-disk 20997 :END: 20998 20999 ** query all mounted disks 21000 #+BEGIN_SRC sh 21001 df \ 21002 #+END_SRC 21003 21004 ** strip the header row 21005 #+BEGIN_SRC sh 21006 |sed '1d' \ 21007 #+END_SRC 21008 21009 ** output mount point of fullest disk 21010 #+BEGIN_SRC sh 21011 |awk '@{if (u < +$5) @{u = +$5; m = $6@}@} END @{print m@}' 21012 #+END_SRC 21013 @end example 21014 21015 @cindex @samp{noweb-sep}, header argument 21016 By default a newline separates each noweb reference concatenation. To 21017 use a different separator, edit the @samp{noweb-sep} header argument. 21018 21019 Alternatively, Org can include the results of evaluation of a single 21020 code block rather than its body [@footnote{The reference is evaluated with 21021 point at the referenced block, using its header arguments (including 21022 inherited)}. Evaluation occurs when parentheses, possibly including 21023 arguments, are appended to the code block name, as shown below. 21024 21025 @example 21026 <<NAME(optional arguments)>> 21027 @end example 21028 21029 21030 Note that in this case, a code block name set by @samp{NAME} keyword is 21031 required; the reference set by @samp{noweb-ref} will not work when 21032 evaluation is desired. 21033 21034 Here is an example that demonstrates how the exported content changes 21035 when noweb style references are used with parentheses versus without. 21036 Given: 21037 21038 @example 21039 #+NAME: some-code 21040 #+BEGIN_SRC python :var num=0 :results output :exports none 21041 print(num*10) 21042 #+END_SRC 21043 @end example 21044 21045 @noindent 21046 this code block: 21047 21048 @example 21049 #+BEGIN_SRC text :noweb yes 21050 <<some-code>> 21051 #+END_SRC 21052 @end example 21053 21054 @noindent 21055 expands to: 21056 21057 @example 21058 print(num*10) 21059 @end example 21060 21061 21062 Below, a similar noweb style reference is used, but with parentheses, 21063 while setting a variable @samp{num} to 10: 21064 21065 @example 21066 #+BEGIN_SRC text :noweb yes 21067 <<some-code(num=10)>> 21068 #+END_SRC 21069 @end example 21070 21071 @noindent 21072 Note that the expansion now contains the results of the code block 21073 @samp{some-code}, not the code block itself: 21074 21075 @example 21076 100 21077 @end example 21078 21079 21080 Noweb insertions honor prefix characters that appear before the noweb 21081 syntax reference. This behavior is illustrated in the following 21082 example. Because the @samp{<<example>>} noweb reference appears behind the 21083 SQL comment syntax, each line of the expanded noweb reference is 21084 commented. With: 21085 21086 @example 21087 #+NAME: example 21088 #+BEGIN_SRC text 21089 this is the 21090 multi-line body of example 21091 #+END_SRC 21092 @end example 21093 21094 @noindent 21095 this code block: 21096 21097 @example 21098 #+BEGIN_SRC sql :noweb yes 21099 ---<<example>> 21100 #+END_SRC 21101 @end example 21102 21103 @noindent 21104 expands to: 21105 21106 @example 21107 #+BEGIN_SRC sql :noweb yes 21108 ---this is the 21109 ---multi-line body of example 21110 #+END_SRC 21111 @end example 21112 21113 Since this change does not affect noweb replacement text without 21114 newlines in them, inline noweb references are acceptable. 21115 21116 This feature can also be used for management of indentation in 21117 exported code snippets. With: 21118 21119 @example 21120 #+NAME: if-true 21121 #+BEGIN_SRC python :exports none 21122 print('do things when true') 21123 #+end_src 21124 21125 #+name: if-false 21126 #+begin_src python :exports none 21127 print('do things when false') 21128 #+end_src 21129 @end example 21130 21131 @noindent 21132 this code block: 21133 21134 @example 21135 #+begin_src python :noweb yes :results output 21136 if true: 21137 <<if-true>> 21138 else: 21139 <<if-false>> 21140 #+end_src 21141 @end example 21142 21143 @noindent 21144 expands to: 21145 21146 @example 21147 if true: 21148 print('do things when true') 21149 else: 21150 print('do things when false') 21151 @end example 21152 21153 This prefix behavior can be turned off in a block by setting the 21154 @samp{noweb-prefix} header argument to @samp{no}, as in: 21155 21156 @example 21157 #+BEGIN_SRC elisp :noweb-prefix no 21158 (setq example-data "<<example>>") 21159 #+END_SRC 21160 @end example 21161 21162 @noindent 21163 which expands to: 21164 21165 @example 21166 (setq example-data "this is the 21167 multi-line body of example") 21168 @end example 21169 21170 When in doubt about the outcome of a source code block expansion, you 21171 can preview the results with the following command: 21172 21173 @table @asis 21174 @item @kbd{C-c C-v v} or @kbd{C-c C-v C-v} (@code{org-babel-expand-src-block}) 21175 @findex org-babel-expand-src-block 21176 @kindex C-c C-v v 21177 @kindex C-c C-v C-v 21178 Expand the current source code block according to its header 21179 arguments and pop open the results in a preview buffer. 21180 @end table 21181 21182 @node Library of Babel 21183 @section Library of Babel 21184 21185 @cindex babel, library of 21186 @cindex source code, library 21187 @cindex code block, library 21188 21189 The ``Library of Babel'' is a collection of code blocks. Like 21190 a function library, these code blocks can be called from other Org 21191 files. A collection of useful code blocks is available on @uref{https://orgmode.org/worg/library-of-babel.html, Worg}. For 21192 remote code block evaluation syntax, see @ref{Evaluating Code Blocks}. 21193 21194 @kindex C-c C-v i 21195 @findex org-babel-lob-ingest 21196 For any user to add code to the library, first save the code in 21197 regular code blocks of an Org file, and then load the Org file with 21198 @code{org-babel-lob-ingest}, which is bound to @kbd{C-c C-v i}. 21199 21200 @node Key bindings and Useful Functions 21201 @section Key bindings and Useful Functions 21202 21203 @cindex code block, key bindings 21204 21205 Many common Org mode key sequences are re-bound depending on 21206 the context. 21207 21208 Active key bindings in code blocks: 21209 21210 @kindex C-c C-c 21211 @findex org-babel-execute-src-block 21212 @kindex C-c C-o 21213 @findex org-babel-open-src-block-result 21214 @kindex M-UP 21215 @findex org-babel-load-in-session 21216 @kindex M-DOWN 21217 @findex org-babel-pop-to-session 21218 @multitable @columnfractions 0.2 0.55 21219 @headitem Key binding 21220 @tab Function 21221 @item @kbd{C-c C-c} 21222 @tab @code{org-babel-execute-src-block} 21223 @item @kbd{C-c C-o} 21224 @tab @code{org-babel-open-src-block-result} 21225 @item @kbd{M-@key{UP}} 21226 @tab @code{org-babel-load-in-session} 21227 @item @kbd{M-@key{DOWN}} 21228 @tab @code{org-babel-pop-to-session} 21229 @end multitable 21230 21231 Active key bindings in Org mode buffer: 21232 21233 @kindex C-c C-v p 21234 @kindex C-c C-v C-p 21235 @kindex C-c C-v n 21236 @kindex C-c C-v C-n 21237 @kindex C-c C-v e 21238 @kindex C-c C-v C-e 21239 @kindex C-c C-v o 21240 @kindex C-c C-v C-o 21241 @kindex C-c C-v v 21242 @kindex C-c C-v C-v 21243 @kindex C-c C-v u 21244 @kindex C-c C-v C-u 21245 @kindex C-c C-v g 21246 @kindex C-c C-v C-g 21247 @kindex C-c C-v r 21248 @kindex C-c C-v C-r 21249 @kindex C-c C-v b 21250 @kindex C-c C-v C-b 21251 @kindex C-c C-v s 21252 @kindex C-c C-v C-s 21253 @kindex C-c C-v d 21254 @kindex C-c C-v C-d 21255 @kindex C-c C-v t 21256 @kindex C-c C-v C-t 21257 @kindex C-c C-v f 21258 @kindex C-c C-v C-f 21259 @kindex C-c C-v c 21260 @kindex C-c C-v C-c 21261 @kindex C-c C-v j 21262 @kindex C-c C-v C-j 21263 @kindex C-c C-v l 21264 @kindex C-c C-v C-l 21265 @kindex C-c C-v i 21266 @kindex C-c C-v C-i 21267 @kindex C-c C-v I 21268 @kindex C-c C-v C-I 21269 @kindex C-c C-v z 21270 @kindex C-c C-v C-z 21271 @kindex C-c C-v a 21272 @kindex C-c C-v C-a 21273 @kindex C-c C-v h 21274 @kindex C-c C-v C-h 21275 @kindex C-c C-v x 21276 @kindex C-c C-v C-x 21277 @findex org-babel-previous-src-block 21278 @findex org-babel-next-src-block 21279 @findex org-babel-execute-maybe 21280 @findex org-babel-open-src-block-result 21281 @findex org-babel-expand-src-block 21282 @findex org-babel-goto-src-block-head 21283 @findex org-babel-goto-named-src-block 21284 @findex org-babel-goto-named-result 21285 @findex org-babel-execute-buffer 21286 @findex org-babel-execute-subtree 21287 @findex org-babel-demarcate-block 21288 @findex org-babel-tangle 21289 @findex org-babel-tangle-file 21290 @findex org-babel-check-src-block 21291 @findex org-babel-insert-header-arg 21292 @findex org-babel-load-in-session 21293 @findex org-babel-lob-ingest 21294 @findex org-babel-view-src-block-info 21295 @findex org-babel-switch-to-session-with-code 21296 @findex org-babel-sha1-hash 21297 @findex org-babel-describe-bindings 21298 @findex org-babel-do-key-sequence-in-edit-buffer 21299 @multitable @columnfractions 0.45 0.55 21300 @headitem Key binding 21301 @tab Function 21302 @item @kbd{C-c C-v p} or @kbd{C-c C-v C-p} 21303 @tab @code{org-babel-previous-src-block} 21304 @item @kbd{C-c C-v n} or @kbd{C-c C-v C-n} 21305 @tab @code{org-babel-next-src-block} 21306 @item @kbd{C-c C-v e} or @kbd{C-c C-v C-e} 21307 @tab @code{org-babel-execute-maybe} 21308 @item @kbd{C-c C-v o} or @kbd{C-c C-v C-o} 21309 @tab @code{org-babel-open-src-block-result} 21310 @item @kbd{C-c C-v v} or @kbd{C-c C-v C-v} 21311 @tab @code{org-babel-expand-src-block} 21312 @item @kbd{C-c C-v u} or @kbd{C-c C-v C-u} 21313 @tab @code{org-babel-goto-src-block-head} 21314 @item @kbd{C-c C-v g} or @kbd{C-c C-v C-g} 21315 @tab @code{org-babel-goto-named-src-block} 21316 @item @kbd{C-c C-v r} or @kbd{C-c C-v C-r} 21317 @tab @code{org-babel-goto-named-result} 21318 @item @kbd{C-c C-v b} or @kbd{C-c C-v C-b} 21319 @tab @code{org-babel-execute-buffer} 21320 @item @kbd{C-c C-v s} or @kbd{C-c C-v C-s} 21321 @tab @code{org-babel-execute-subtree} 21322 @item @kbd{C-c C-v d} or @kbd{C-c C-v C-d} 21323 @tab @code{org-babel-demarcate-block} 21324 @item @kbd{C-c C-v t} or @kbd{C-c C-v C-t} 21325 @tab @code{org-babel-tangle} 21326 @item @kbd{C-c C-v f} or @kbd{C-c C-v C-f} 21327 @tab @code{org-babel-tangle-file} 21328 @item @kbd{C-c C-v c} or @kbd{C-c C-v C-c} 21329 @tab @code{org-babel-check-src-block} 21330 @item @kbd{C-c C-v j} or @kbd{C-c C-v C-j} 21331 @tab @code{org-babel-insert-header-arg} 21332 @item @kbd{C-c C-v l} or @kbd{C-c C-v C-l} 21333 @tab @code{org-babel-load-in-session} 21334 @item @kbd{C-c C-v i} or @kbd{C-c C-v C-i} 21335 @tab @code{org-babel-lob-ingest} 21336 @item @kbd{C-c C-v I} or @kbd{C-c C-v C-I} 21337 @tab @code{org-babel-view-src-block-info} 21338 @item @kbd{C-c C-v z} or @kbd{C-c C-v C-z} 21339 @tab @code{org-babel-switch-to-session-with-code} 21340 @item @kbd{C-c C-v a} or @kbd{C-c C-v C-a} 21341 @tab @code{org-babel-sha1-hash} 21342 @item @kbd{C-c C-v h} or @kbd{C-c C-v C-h} 21343 @tab @code{org-babel-describe-bindings} 21344 @item @kbd{C-c C-v x} or @kbd{C-c C-v C-x} 21345 @tab @code{org-babel-do-key-sequence-in-edit-buffer} 21346 @end multitable 21347 21348 @node Batch Execution 21349 @section Batch Execution 21350 21351 @cindex code block, batch execution 21352 @cindex source code, batch execution 21353 21354 Org mode features, including working with source code facilities can 21355 be invoked from the command line. This enables building shell scripts 21356 for batch processing, running automated system tasks, and expanding 21357 Org mode's usefulness. 21358 21359 The sample script shows batch processing of multiple files using 21360 @code{org-babel-tangle}. 21361 21362 @example 21363 #!/bin/sh 21364 # Tangle files with Org mode 21365 # 21366 emacs -Q --batch --eval " 21367 (progn 21368 (require 'ob-tangle) 21369 (dolist (file command-line-args-left) 21370 (with-current-buffer (find-file-noselect file) 21371 (org-babel-tangle)))) 21372 " "$@@" 21373 @end example 21374 21375 @node Miscellaneous 21376 @chapter Miscellaneous 21377 21378 @menu 21379 * Completion:: @kbd{M-@key{TAB}} guesses completions. 21380 * Structure Templates:: Quick insertion of structural elements. 21381 * Speed Keys:: Electric commands at the beginning of a headline. 21382 * Clean View:: Getting rid of leading stars in the outline. 21383 * Execute commands in the active region:: Execute commands on multiple items in Org or agenda view. 21384 * Dynamic Headline Numbering:: Display and update outline numbering. 21385 * The Very Busy @kbd{C-c C-c} Key:: When in doubt, press @kbd{C-c C-c}. 21386 * In-buffer Settings:: Overview of keywords. 21387 * Regular Expressions:: Elisp regular expressions. 21388 * Org Syntax:: Formal description of Org's syntax. 21389 * Documentation Access:: Read documentation about current syntax. 21390 * Escape Character:: Prevent Org from interpreting your writing. 21391 * Code Evaluation Security:: Org files evaluate in-line code. 21392 * Interaction:: With other Emacs packages. 21393 * TTY Keys:: Using Org on a tty. 21394 * Protocols:: External access to Emacs and Org. 21395 * Org Crypt:: Encrypting Org files. 21396 * Org Mobile:: Viewing and capture on a mobile device. 21397 * Drag and Drop & @code{yank-media}:: Dropping and pasting files and images 21398 @end menu 21399 21400 @node Completion 21401 @section Completion 21402 21403 @cindex completion, of @TeX{} symbols 21404 @cindex completion, of TODO keywords 21405 @cindex completion, of dictionary words 21406 @cindex completion, of option keywords 21407 @cindex completion, of tags 21408 @cindex completion, of property keys 21409 @cindex completion, of link abbreviations 21410 @cindex @TeX{} symbol completion 21411 @cindex TODO keywords completion 21412 @cindex dictionary word completion 21413 @cindex option keyword completion 21414 @cindex tag completion 21415 @cindex link abbreviations, completion of 21416 21417 Org has in-buffer completions. Unlike minibuffer completions, which 21418 are useful for quick command interactions, Org's in-buffer completions 21419 are more suitable for content creation in Org documents. Type one or 21420 more letters and invoke the hot key to complete the text in-place. 21421 Depending on the context and the keys, Org offers different types of 21422 completions. No minibuffer is involved. Such mode-specific hot keys 21423 have become an integral part of Emacs and Org provides several 21424 shortcuts. 21425 21426 @table @asis 21427 @item @kbd{M-@key{TAB}} 21428 @kindex M-TAB 21429 21430 Complete word at point. 21431 21432 @itemize 21433 @item 21434 At the beginning of an empty headline, complete TODO keywords. 21435 21436 @item 21437 After @samp{\}, complete @TeX{} symbols supported by the exporter. 21438 21439 @item 21440 After @samp{:} in a headline, complete tags. Org deduces the list of 21441 tags from the @samp{TAGS} in-buffer option (see @ref{Setting Tags}), the 21442 variable @code{org-tag-alist}, or from all tags used in the current 21443 buffer. 21444 21445 @item 21446 After @samp{:} and not in a headline, complete property keys. The list 21447 of keys is constructed dynamically from all keys used in the 21448 current buffer. 21449 21450 @item 21451 After @samp{[[}, complete link abbreviations (see @ref{Link Abbreviations}). 21452 21453 @item 21454 After @samp{[[*}, complete headlines in the current buffer so that they 21455 can be used in search links like: @samp{[[*find this headline]]} 21456 21457 @item 21458 After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or 21459 file-specific @samp{OPTIONS}. After option keyword is complete, 21460 pressing @kbd{M-@key{TAB}} again inserts example settings for this 21461 keyword. 21462 21463 @item 21464 After @samp{STARTUP} keyword, complete startup items. 21465 21466 @item 21467 When point is anywhere else, complete dictionary words using 21468 Ispell. 21469 @end itemize 21470 @end table 21471 21472 @node Structure Templates 21473 @section Structure Templates 21474 21475 @cindex template insertion 21476 @cindex insertion, of templates 21477 21478 With just a few keystrokes, it is possible to insert empty structural 21479 blocks, such as @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC}, or to wrap existing 21480 text in such a block. 21481 21482 @table @asis 21483 @item @kbd{C-c C-,} (@code{org-insert-structure-template}) 21484 @findex org-insert-structure-template 21485 @kindex C-c C-, 21486 Prompt for a type of block structure, and insert the block at point. 21487 If the region is active, it is wrapped in the block. First prompts 21488 the user for keys, which are used to look up a structure type from 21489 the variable below. If the key is @kbd{@key{TAB}}, @kbd{@key{RET}}, 21490 or @kbd{@key{SPC}}, the user is prompted to enter a block type. 21491 @end table 21492 21493 @vindex org-structure-template-alist 21494 Available structure types are defined in 21495 @code{org-structure-template-alist}, see the docstring for adding or 21496 changing values. 21497 21498 @cindex Tempo 21499 @cindex template expansion 21500 @cindex insertion, of templates 21501 @vindex org-tempo-keywords-alist 21502 Org Tempo expands snippets to structures defined in 21503 @code{org-structure-template-alist} and @code{org-tempo-keywords-alist}. For 21504 example, @kbd{< s @key{TAB}} creates a code block. Enable it by 21505 customizing @code{org-modules} or add @samp{(require 'org-tempo)} to your Emacs 21506 init file@footnote{ For more information, please refer to the commentary 21507 section in @samp{org-tempo.el}.}. 21508 21509 @multitable @columnfractions 0.1 0.9 21510 @item @kbd{a} 21511 @tab @samp{#+BEGIN_EXPORT ascii} @dots{} @samp{#+END_EXPORT} 21512 @item @kbd{c} 21513 @tab @samp{#+BEGIN_CENTER} @dots{} @samp{#+END_CENTER} 21514 @item @kbd{C} 21515 @tab @samp{#+BEGIN_COMMENT} @dots{} @samp{#+END_COMMENT} 21516 @item @kbd{e} 21517 @tab @samp{#+BEGIN_EXAMPLE} @dots{} @samp{#+END_EXAMPLE} 21518 @item @kbd{E} 21519 @tab @samp{#+BEGIN_EXPORT} @dots{} @samp{#+END_EXPORT} 21520 @item @kbd{h} 21521 @tab @samp{#+BEGIN_EXPORT html} @dots{} @samp{#+END_EXPORT} 21522 @item @kbd{l} 21523 @tab @samp{#+BEGIN_EXPORT latex} @dots{} @samp{#+END_EXPORT} 21524 @item @kbd{q} 21525 @tab @samp{#+BEGIN_QUOTE} @dots{} @samp{#+END_QUOTE} 21526 @item @kbd{s} 21527 @tab @samp{#+BEGIN_SRC} @dots{} @samp{#+END_SRC} 21528 @item @kbd{v} 21529 @tab @samp{#+BEGIN_VERSE} @dots{} @samp{#+END_VERSE} 21530 @end multitable 21531 21532 @node Speed Keys 21533 @section Speed Keys 21534 21535 @cindex speed keys 21536 21537 Single keystrokes can execute custom commands in an Org file when 21538 point is on a headline. Without the extra burden of a meta or 21539 modifier key, Speed Keys can speed navigation or execute custom 21540 commands. Besides faster navigation, Speed Keys may come in handy on 21541 small mobile devices that do not have full keyboards. Speed Keys may 21542 also work on TTY devices known for their problems when entering Emacs 21543 key chords. 21544 21545 @vindex org-use-speed-commands 21546 By default, Org has Speed Keys disabled. To activate Speed Keys, set 21547 the variable @code{org-use-speed-commands} to a non-@code{nil} value. To 21548 trigger a Speed Key, point must be at the beginning of an Org 21549 headline, before any of the stars. 21550 21551 @vindex org-speed-commands 21552 @findex org-speed-command-help 21553 Org comes with a pre-defined list of Speed Keys. To add or modify 21554 Speed Keys, customize the option @code{org-speed-commands}. For more 21555 details, see the variable's docstring. With Speed Keys activated, 21556 @kbd{M-x org-speed-command-help}, or @kbd{?} when point is at the 21557 beginning of an Org headline, shows currently active Speed Keys, 21558 including the user-defined ones. 21559 21560 @node Clean View 21561 @section A Cleaner Outline View 21562 21563 @cindex hiding leading stars 21564 @cindex dynamic indentation 21565 @cindex odd-levels-only outlines 21566 @cindex clean outline view 21567 21568 Org's outline with stars and no indents can look cluttered for short 21569 documents. For @emph{book-like} long documents, the effect is not as 21570 noticeable. Org provides an alternate stars and indentation scheme, 21571 as shown on the right in the following table. It displays only one 21572 star and indents text to line up with the heading: 21573 21574 @example 21575 * Top level headline | * Top level headline 21576 ** Second level | * Second level 21577 *** Third level | * Third level 21578 some text | some text 21579 *** Third level | * Third level 21580 more text | more text 21581 * Another top level headline | * Another top level headline 21582 @end example 21583 21584 Org can achieve this in two ways, (1) by just displaying the buffer in 21585 this way without changing it, or (2) by actually indenting every line 21586 in the desired amount with hard spaces and hiding leading stars. 21587 21588 @menu 21589 * Org Indent Mode:: 21590 * Hard indentation:: 21591 @end menu 21592 21593 @node Org Indent Mode 21594 @subsection Org Indent Mode 21595 21596 @cindex Indent mode 21597 @findex org-indent-mode 21598 To display the buffer in the indented view, activate Org Indent minor 21599 mode, using @kbd{M-x org-indent-mode}. Text lines that are not 21600 headlines are prefixed with virtual spaces to vertically align with 21601 the headline text@footnote{Org Indent mode also sets @code{wrap-prefix} correctly for 21602 indenting and wrapping long lines of headlines or text. This minor 21603 mode also handles Visual Line mode and directly applied settings 21604 through @code{word-wrap}.}. 21605 21606 @vindex org-indent-indentation-per-level 21607 To make more horizontal space, the headlines are shifted by two 21608 characters. Configure @code{org-indent-indentation-per-level} variable for 21609 a different number. 21610 21611 @vindex org-indent-mode-turns-on-hiding-stars 21612 @vindex org-indent-mode-turns-off-org-adapt-indentation 21613 By default, Org Indent mode turns off @code{org-adapt-indentation} and does 21614 hide leading stars by locally setting @code{org-hide-leading-stars} to @code{t}: 21615 only one star on each headline is visible, the rest are masked with 21616 the same font color as the background. If you want to customize this 21617 default behavior, see @code{org-indent-mode-turns-on-hiding-stars} and 21618 @code{org-indent-mode-turns-off-org-adapt-indentation}. 21619 21620 @vindex org-startup-indented 21621 To globally turn on Org Indent mode for all files, customize the 21622 variable @code{org-startup-indented}. To control it for individual files, 21623 use @samp{STARTUP} keyword as follows: 21624 21625 @example 21626 #+STARTUP: indent 21627 #+STARTUP: noindent 21628 @end example 21629 21630 @node Hard indentation 21631 @subsection Hard indentation 21632 21633 It is possible to use hard spaces to achieve the indentation instead, 21634 if the bare ASCII file should have the indented look also outside 21635 Emacs@footnote{This works, but requires extra effort. Org Indent mode is 21636 more convenient for most applications.}. With Org's support, you have to indent all lines to 21637 line up with the outline headers. You would use these settings@footnote{ 21638 @code{org-adapt-indentation} can also be set to @samp{'headline-data}, in which 21639 case only data lines below the headline will be indented.}: 21640 21641 @lisp 21642 (setq org-adapt-indentation t 21643 org-hide-leading-stars t 21644 org-odd-levels-only t) 21645 @end lisp 21646 21647 @table @asis 21648 @item @emph{Indentation of text below headlines} (@code{org-adapt-indentation}) 21649 @vindex org-adapt-indentation 21650 The first setting modifies paragraph filling, line wrapping, and 21651 structure editing commands to preserving or adapting the indentation 21652 as appropriate. 21653 21654 @item @emph{Hiding leading stars} (@code{org-hide-leading-stars}) 21655 @vindex org-hide-leading-stars 21656 @vindex org-hide, face 21657 The second setting makes leading stars invisible by applying the 21658 face @code{org-hide} to them. For per-file preference, use these file 21659 @samp{STARTUP} options: 21660 21661 @example 21662 #+STARTUP: hidestars 21663 #+STARTUP: showstars 21664 @end example 21665 21666 @item @emph{Odd levels} (@code{org-odd-levels-only}) 21667 @vindex org-odd-levels-only 21668 The third setting makes Org use only odd levels, 1, 3, 5, @dots{}, in 21669 the outline to create more indentation. On a per-file level, 21670 control this with: 21671 21672 @example 21673 #+STARTUP: odd 21674 #+STARTUP: oddeven 21675 @end example 21676 21677 To convert a file between single and double stars layouts, use 21678 @kbd{M-x org-convert-to-odd-levels} and @kbd{M-x org-convert-to-oddeven-levels}. 21679 @end table 21680 21681 @node Execute commands in the active region 21682 @section Execute commands in the active region 21683 21684 @vindex org-loop-over-headlines-in-active-region 21685 When in an Org buffer and the region is active, some commands will 21686 apply to all the subtrees in the active region. For example, hitting 21687 @kbd{C-c C-s} when multiple headlines are within the active region will 21688 successively prompt you for a new schedule date and time. To disable 21689 this, set the option @code{org-loop-over-headlines-in-active-region} to 21690 non-@code{t}, activate the region and run the command normally. 21691 21692 @vindex org-agenda-loop-over-headlines-in-active-region 21693 @code{org-agenda-loop-over-headlines-in-active-region} is the equivalent 21694 option of the agenda buffer, where you can also use @ref{Bulk remote editing selected entries, , bulk editing of 21695 selected entries}. 21696 21697 Not all commands can loop in the active region and what subtrees or 21698 headlines are considered can be refined: see the docstrings of these 21699 options for more details. 21700 21701 @node Dynamic Headline Numbering 21702 @section Dynamic Headline Numbering 21703 21704 @cindex Org Num mode 21705 @cindex number headlines 21706 The Org Num minor mode, toggled with @kbd{M-x org-num-mode}, 21707 displays outline numbering on top of headlines. It also updates it 21708 automatically upon changes to the structure of the document. 21709 21710 @vindex org-num-max-level 21711 @vindex org-num-skip-tags 21712 @vindex org-num-skip-commented 21713 @vindex org-num-skip-unnumbered 21714 By default, all headlines are numbered. You can limit numbering to 21715 specific headlines according to their level, tags, @samp{COMMENT} keyword, 21716 or @samp{UNNUMBERED} property. Set @code{org-num-max-level}, 21717 @code{org-num-skip-tags}, @code{org-num-skip-commented}, 21718 @code{org-num-skip-unnumbered}, or @code{org-num-skip-footnotes} accordingly. 21719 21720 @vindex org-num-skip-footnotes 21721 If @code{org-num-skip-footnotes} is non-@code{nil}, footnotes sections (see 21722 @ref{Creating Footnotes}) are not numbered either. 21723 21724 @vindex org-num-face 21725 @vindex org-num-format-function 21726 You can control how the numbering is displayed by setting 21727 @code{org-num-face} and @code{org-num-format-function}. 21728 21729 @vindex org-startup-numerated 21730 You can also turn this mode globally for all Org files by setting the 21731 option @code{org-startup-numerated} to @samp{t}, or locally on a file by using 21732 @samp{#+startup: num}. 21733 21734 @node The Very Busy @kbd{C-c C-c} Key 21735 @section The Very Busy @kbd{C-c C-c} Key 21736 21737 @kindex C-c C-c 21738 @cindex @kbd{C-c C-c}, overview 21739 21740 The @kbd{C-c C-c} key in Org serves many purposes depending on 21741 the context. It is probably the most over-worked, multi-purpose key 21742 combination in Org. Its uses are well documented throughout this 21743 manual, but here is a consolidated list for easy reference. 21744 21745 @itemize 21746 @item 21747 If column view (see @ref{Column View}) is on, exit column view. 21748 21749 @item 21750 If any highlights shown in the buffer from the creation of a sparse 21751 tree, or from clock display, remove such highlights. 21752 21753 @item 21754 If point is in one of the special @samp{KEYWORD} lines, scan the buffer 21755 for these lines and update the information. Also reset the Org file 21756 cache used to temporary store the contents of URLs used as values 21757 for keywords like @samp{SETUPFILE}. 21758 21759 @item 21760 If point is inside a table, realign the table. 21761 21762 @item 21763 If point is on a @samp{TBLFM} keyword, re-apply the formulas to the 21764 entire table. 21765 21766 @item 21767 If the current buffer is a capture buffer, close the note and file 21768 it. With a prefix argument, also jump to the target location after 21769 saving the note. 21770 21771 @item 21772 If point is on a @samp{<<<target>>>}, update radio targets and 21773 corresponding links in this buffer. 21774 21775 @item 21776 If point is on a property line or at the start or end of a property 21777 drawer, offer property commands. 21778 21779 @item 21780 If point is at a footnote reference, go to the corresponding 21781 definition, and @emph{vice versa}. 21782 21783 @item 21784 If point is on a statistics cookie, update it. 21785 21786 @item 21787 If point is in a plain list item with a checkbox, toggle the status 21788 of the checkbox. 21789 21790 @item 21791 If point is on a numbered item in a plain list, renumber the ordered 21792 list. 21793 21794 @item 21795 If point is on the @samp{#+BEGIN} line of a dynamic block, the block is 21796 updated. 21797 21798 @item 21799 If point is at a timestamp, fix the day name in the timestamp. 21800 @end itemize 21801 21802 @node In-buffer Settings 21803 @section Summary of In-Buffer Settings 21804 21805 @cindex in-buffer settings 21806 @cindex special keywords 21807 21808 In-buffer settings start with @samp{#+}, followed by a keyword, a colon, 21809 one or more spaces, and then a word for each setting. Org accepts 21810 multiple settings on the same line. Org also accepts multiple lines 21811 for a keyword. This manual describes these settings throughout. A 21812 summary follows here. 21813 21814 @cindex refresh set-up 21815 @kbd{C-c C-c} activates any changes to the in-buffer settings. 21816 Closing and reopening the Org file in Emacs also activates the 21817 changes. 21818 21819 @table @asis 21820 @item @samp{#+ARCHIVE: %s_done::} 21821 @cindex @samp{ARCHIVE}, keyword 21822 @vindex org-archive-location 21823 Sets the archive location of the agenda file. The corresponding 21824 variable is @code{org-archive-location}. 21825 21826 @item @samp{#+CATEGORY} 21827 @cindex @samp{CATEGORY}, keyword 21828 Sets the category of the agenda file, which applies to the entire 21829 document. 21830 21831 @item @samp{#+COLUMNS: %25ITEM ...} 21832 @cindex @samp{COLUMNS}, property 21833 Set the default format for columns view. This format applies when 21834 columns view is invoked in locations where no @samp{COLUMNS} property 21835 applies. 21836 21837 @item @samp{#+CONSTANTS: name1=value1 ...} 21838 @cindex @samp{CONSTANTS}, keyword 21839 @vindex org-table-formula-constants 21840 @vindex org-table-formula 21841 Set file-local values for constants that table formulas can use. 21842 This line sets the local variable 21843 @code{org-table-formula-constants-local}. The global version of this 21844 variable is @code{org-table-formula-constants}. 21845 21846 @item @samp{#+FILETAGS: :tag1:tag2:tag3:} 21847 @cindex @samp{FILETAGS}, keyword 21848 Set tags that all entries in the file inherit from, including the 21849 top-level entries. 21850 21851 @item @samp{#+LINK: linkword replace} 21852 @cindex @samp{LINK}, keyword 21853 @vindex org-link-abbrev-alist 21854 Each line specifies one abbreviation for one link. Use multiple 21855 @samp{LINK} keywords for more, see @ref{Link Abbreviations}. The 21856 corresponding variable is @code{org-link-abbrev-alist}. 21857 21858 @item @samp{#+PRIORITIES: highest lowest default} 21859 @cindex @samp{PRIORITIES}, keyword 21860 @vindex org-priority-highest 21861 @vindex org-priority-lowest 21862 @vindex org-priority-default 21863 This line sets the limits and the default for the priorities. All 21864 three must be either letters A--Z or numbers 0--9. The highest 21865 priority must have a lower ASCII number than the lowest priority. 21866 21867 @item @samp{#+PROPERTY: Property_Name Value} 21868 @cindex @samp{PROPERTY}, keyword 21869 This line sets a default inheritance value for entries in the 21870 current buffer, most useful for specifying the allowed values of 21871 a property. 21872 21873 @item @samp{#+SETUPFILE: file} 21874 @cindex @samp{SETUPFILE}, keyword 21875 The setup file or a URL pointing to such file is for additional 21876 in-buffer settings. Org loads this file and parses it for any 21877 settings in it when Org opens the main file. If URL is 21878 specified, the contents are downloaded and stored in a temporary 21879 file cache. @kbd{C-c C-c} on the settings line re-parses and 21880 re-loads the file, and also resets the temporary file cache. 21881 21882 Org also parses and loads @emph{in-buffer settings} from the setup file 21883 during normal exporting process. Org parses the @emph{in-buffer 21884 settings} as if it was included in the containing Org buffer. The 21885 rest of the contents of setup file is ignored. 21886 21887 To visit the setup file---not a URL---use @kbd{C-c '} while point 21888 is on the line with the setup file name. 21889 21890 @item @samp{#+STARTUP:} 21891 @cindex @samp{STARTUP}, keyword 21892 Startup options Org uses when first visiting a file. 21893 21894 @vindex org-startup-folded 21895 The first set of options deals with the initial visibility of the 21896 outline tree. The corresponding variable for global default 21897 settings is @code{org-startup-folded} with a default value of 21898 @code{showeverything}. 21899 21900 @multitable {aaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaa} 21901 @item @samp{overview} 21902 @tab Top-level headlines only. 21903 @item @samp{content} 21904 @tab All headlines. 21905 @item @samp{showall} 21906 @tab No folding on any entry. 21907 @item @samp{show2levels} 21908 @tab Headline levels 1-2. 21909 @item @samp{show3levels} 21910 @tab Headline levels 1-3. 21911 @item @samp{show4levels} 21912 @tab Headline levels 1-4. 21913 @item @samp{show5levels} 21914 @tab Headline levels 1-5. 21915 @item @samp{showeverything} 21916 @tab Show even drawer contents. 21917 @end multitable 21918 21919 @vindex org-startup-indented 21920 Dynamic virtual indentation is controlled by the variable 21921 @code{org-startup-indented}@footnote{ Note that Org Indent mode also sets the 21922 @code{wrap-prefix} property, such that Visual Line mode (or purely 21923 setting @code{word-wrap}) wraps long lines, including headlines, 21924 correctly indented.}. 21925 21926 @multitable {aaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 21927 @item @samp{indent} 21928 @tab Start with Org Indent mode turned on. 21929 @item @samp{noindent} 21930 @tab Start with Org Indent mode turned off. 21931 @end multitable 21932 21933 @vindex org-startup-numerated 21934 Dynamic virtual numeration of headlines is controlled by the variable 21935 @code{org-startup-numerated}. 21936 21937 @multitable {aaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 21938 @item @samp{num} 21939 @tab Start with Org num mode turned on. 21940 @item @samp{nonum} 21941 @tab Start with Org num mode turned off. 21942 @end multitable 21943 21944 @vindex org-startup-align-all-tables 21945 Aligns tables consistently upon visiting a file. The 21946 corresponding variable is @code{org-startup-align-all-tables} with 21947 @code{nil} as default value. 21948 21949 @multitable {aaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 21950 @item @samp{align} 21951 @tab Align all tables. 21952 @item @samp{noalign} 21953 @tab Do not align tables on startup. 21954 @end multitable 21955 21956 @vindex org-startup-shrink-all-tables 21957 Shrink table columns with a width cookie. The corresponding 21958 variable is @code{org-startup-shrink-all-tables} with @code{nil} as 21959 default value. 21960 21961 @vindex org-startup-with-inline-images 21962 When visiting a file, inline images can be automatically 21963 displayed. The corresponding variable is 21964 @code{org-startup-with-inline-images}, with a default value @code{nil} to 21965 avoid delays when visiting a file. 21966 21967 @multitable {aaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 21968 @item @samp{inlineimages} 21969 @tab Show inline images. 21970 @item @samp{noinlineimages} 21971 @tab Do not show inline images on startup. 21972 @end multitable 21973 21974 @vindex org-link-descriptive 21975 Bracket links in Org buffers are displayed hiding the link path and 21976 brackets. For example, @samp{[[https://orgmode.org][Org Website]]} is, 21977 by default, displayed as ``Org Website'', hiding the link itself and 21978 just displaying its description. Alternatively, the links can be 21979 displayed in full. The corresponding variable is 21980 @code{org-link-descriptive}. 21981 21982 @multitable {aaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 21983 @item @samp{descriptivelinks} 21984 @tab Hide path and brackets in links. 21985 @item @samp{literallinks} 21986 @tab Do not hide anything. 21987 @end multitable 21988 21989 @vindex org-log-done 21990 @vindex org-log-note-clock-out 21991 @vindex org-log-repeat 21992 Logging the closing and reopening of TODO items and clock 21993 intervals can be configured using these options (see variables 21994 @code{org-log-done}, @code{org-log-note-clock-out}, and @code{org-log-repeat}). 21995 21996 @multitable {aaaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 21997 @item @samp{logdone} 21998 @tab Record a timestamp when an item is marked as done. 21999 @item @samp{lognotedone} 22000 @tab Record timestamp and a note when DONE@. 22001 @item @samp{nologdone} 22002 @tab Do not record when items are marked as done. 22003 @item @samp{logrepeat} 22004 @tab Record a time when reinstating a repeating item. 22005 @item @samp{lognoterepeat} 22006 @tab Record a note when reinstating a repeating item. 22007 @item @samp{nologrepeat} 22008 @tab Do not record when reinstating repeating item. 22009 @item @samp{lognoteclock-out} 22010 @tab Record a note when clocking out. 22011 @item @samp{nolognoteclock-out} 22012 @tab Do not record a note when clocking out. 22013 @item @samp{logreschedule} 22014 @tab Record a timestamp when scheduling time changes. 22015 @item @samp{lognotereschedule} 22016 @tab Record a note when scheduling time changes. 22017 @item @samp{nologreschedule} 22018 @tab Do not record when a scheduling date changes. 22019 @item @samp{logredeadline} 22020 @tab Record a timestamp when deadline changes. 22021 @item @samp{lognoteredeadline} 22022 @tab Record a note when deadline changes. 22023 @item @samp{nologredeadline} 22024 @tab Do not record when a deadline date changes. 22025 @item @samp{logrefile} 22026 @tab Record a timestamp when refiling. 22027 @item @samp{lognoterefile} 22028 @tab Record a note when refiling. 22029 @item @samp{nologrefile} 22030 @tab Do not record when refiling. 22031 @end multitable 22032 22033 @vindex org-hide-leading-stars 22034 @vindex org-odd-levels-only 22035 Here are the options for hiding leading stars in outline 22036 headings, and for indenting outlines. The corresponding 22037 variables are @code{org-hide-leading-stars} and 22038 @code{org-odd-levels-only}, both with a default setting @code{nil} 22039 (meaning @samp{showstars} and @samp{oddeven}). 22040 22041 @multitable {aaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 22042 @item @samp{hidestars} 22043 @tab Make all but one of the stars starting a headline invisible. 22044 @item @samp{showstars} 22045 @tab Show all stars starting a headline. 22046 @item @samp{indent} 22047 @tab Virtual indentation according to outline level. 22048 @item @samp{noindent} 22049 @tab No virtual indentation according to outline level. 22050 @item @samp{odd} 22051 @tab Allow only odd outline levels (1, 3, @dots{}). 22052 @item @samp{oddeven} 22053 @tab Allow all outline levels. 22054 @end multitable 22055 22056 @vindex org-display-custom-times 22057 @vindex org-timestamp-custom-formats 22058 @vindex org-time-stamp-custom-formats 22059 To turn on custom format overlays over timestamps (variables 22060 @code{org-display-custom-times} and 22061 @code{org-timestamp-custom-formats}), use: 22062 22063 @multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaa} 22064 @item @samp{customtime} 22065 @tab Overlay custom time format. 22066 @end multitable 22067 22068 @vindex constants-unit-system 22069 The following options influence the table spreadsheet (variable 22070 @code{constants-unit-system}). 22071 22072 @multitable {aaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 22073 @item @samp{constcgs} 22074 @tab @samp{constants.el} should use the c-g-s unit system. 22075 @item @samp{constSI} 22076 @tab @samp{constants.el} should use the SI unit system. 22077 @end multitable 22078 22079 @vindex org-footnote-define-inline 22080 @vindex org-footnote-auto-label 22081 @vindex org-footnote-auto-adjust 22082 To influence footnote settings, use the following keywords. The 22083 corresponding variables are @code{org-footnote-define-inline}, 22084 @code{org-footnote-auto-label}, and @code{org-footnote-auto-adjust}. 22085 22086 @multitable {aaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 22087 @item @samp{fninline} 22088 @tab Define footnotes inline. 22089 @item @samp{fnnoinline} 22090 @tab Define footnotes in separate section. 22091 @item @samp{fnlocal} 22092 @tab Define footnotes near first reference, but not inline. 22093 @item @samp{fnprompt} 22094 @tab Prompt for footnote labels. 22095 @item @samp{fnauto} 22096 @tab Create @samp{[fn:1]}-like labels automatically (default). 22097 @item @samp{fnconfirm} 22098 @tab Offer automatic label for editing or confirmation. 22099 @item @samp{fnadjust} 22100 @tab Automatically renumber and sort footnotes. 22101 @item @samp{nofnadjust} 22102 @tab Do not renumber and sort automatically. 22103 @item @samp{fnanon} 22104 @tab Create anonymous footnotes with @code{org-footnote-new}. 22105 @end multitable 22106 22107 @vindex org-hide-block-startup 22108 @vindex org-hide-drawer-startup 22109 To hide blocks or drawers on startup, use these keywords. The 22110 corresponding variables are @code{org-hide-block-startup} and 22111 @code{org-hide-drawer-startup}. 22112 22113 @multitable {aaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 22114 @item @samp{hideblocks} 22115 @tab Hide all begin/end blocks on startup. 22116 @item @samp{nohideblocks} 22117 @tab Do not hide blocks on startup. 22118 @item @samp{hidedrawers} 22119 @tab Hide all begin/end blocks on startup. 22120 @item @samp{nohidedrawers} 22121 @tab Do not hide blocks on startup. 22122 @end multitable 22123 @end table 22124 22125 22126 @vindex org-pretty-entities 22127 The display of entities as UTF-8 characters is governed by the 22128 variable @code{org-pretty-entities} and the keywords 22129 22130 @multitable {aaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 22131 @item @samp{entitiespretty} 22132 @tab Show entities as UTF-8 characters where possible. 22133 @item @samp{entitiesplain} 22134 @tab Leave entities plain. 22135 @end multitable 22136 22137 @table @asis 22138 @item @samp{#+TAGS: TAG1(c1) TAG2(c2)} 22139 @cindex @samp{TAGS}, keyword 22140 @vindex org-tag-alist 22141 These lines (several such lines are allowed) specify the valid tags 22142 in this file, and (potentially) the corresponding @emph{fast tag 22143 selection} keys. The corresponding variable is @code{org-tag-alist}. 22144 22145 @item @samp{#+TODO:}, @samp{#+SEQ_TODO:}, @samp{#+TYP_TODO:} 22146 @cindex @samp{SEQ_TODO}, keyword 22147 @cindex @samp{TODO}, keyword 22148 @cindex @samp{TYP_TODO}, keyword 22149 @vindex org-todo-keywords 22150 These lines set the TODO keywords and their interpretation in the 22151 current file. The corresponding variable is @code{org-todo-keywords}. 22152 @end table 22153 22154 @node Regular Expressions 22155 @section Regular Expressions 22156 22157 @cindex regular expressions syntax 22158 @cindex regular expressions, in searches 22159 22160 Org, as an Emacs mode, makes use of Elisp regular expressions for 22161 searching, matching and filtering. Elisp regular expressions have a 22162 somewhat different syntax then some common standards. Most notably, 22163 alternation is indicated using @samp{\|} and matching groups are denoted by 22164 @samp{\(...\)}. For example the string @samp{home\|work} matches either @samp{home} 22165 or @samp{work}. 22166 22167 For more information, see @ref{Regexps,Regular Expressions in Emacs,,emacs,}. 22168 22169 @node Org Syntax 22170 @section Org Syntax 22171 22172 A reference document providing a formal description of Org's syntax is 22173 available as @uref{https://orgmode.org/worg/org-syntax.html, a draft on Worg}, initially written by Nicolas Goaziou. 22174 It defines Org's core internal concepts such as ``headlines'', 22175 ``sections'', ``affiliated keywords'', ``(greater) elements'' and ``objects''. 22176 Each part of an Org document belongs to one of the previous 22177 categories. 22178 22179 To explore the abstract structure of an Org buffer, run this in 22180 a buffer: 22181 22182 @example 22183 M-: (org-element-parse-buffer) <RET> 22184 @end example 22185 22186 22187 @noindent 22188 It outputs a list containing the buffer's content represented as an 22189 abstract structure. The export engine relies on the information 22190 stored in this list. Most interactive commands---e.g., for structure 22191 editing---also rely on the syntactic meaning of the surrounding 22192 context. 22193 22194 @cindex syntax checker 22195 @cindex linter 22196 @findex org-lint 22197 You can probe the syntax of your documents with the command 22198 22199 @example 22200 M-x org-lint <RET> 22201 @end example 22202 22203 22204 @noindent 22205 It runs a number of checks to find common mistakes. It then displays 22206 their location in a dedicated buffer, along with a description and 22207 a ``trust level'', since false-positive are possible. From there, you 22208 can operate on the reports with the following keys: 22209 22210 @multitable @columnfractions 0.22 0.78 22211 @item @kbd{C-j}, @kbd{@key{TAB}} 22212 @tab Display the offending line 22213 @item @kbd{@key{RET}} 22214 @tab Move point to the offending line 22215 @item @kbd{g} 22216 @tab Check the document again 22217 @item @kbd{h} 22218 @tab Hide all reports from the same checker 22219 @item @kbd{i} 22220 @tab Also remove them from all subsequent checks 22221 @item @kbd{S} 22222 @tab Sort reports by the column at point 22223 @end multitable 22224 22225 @node Documentation Access 22226 @section Context Dependent Documentation 22227 22228 @cindex documentation 22229 @cindex Info 22230 22231 @findex org-info-find-node 22232 @kindex C-c C-x I 22233 @kbd{C-c C-x I} in an Org file tries to open a suitable section 22234 of the Org manual depending on the syntax at point. For example, 22235 using it on a headline displays ``Document Structure'' section. 22236 22237 @kbd{q} closes the Info window. 22238 22239 @node Escape Character 22240 @section Escape Character 22241 22242 @cindex escape character 22243 @cindex zero width space 22244 You may sometimes want to write text that looks like Org syntax, but 22245 should really read as plain text. Org may use a specific escape 22246 character in some situations, i.e., a backslash in macros (see @ref{Macro Replacement}) and links (see @ref{Link Format}), or a comma in source and 22247 example blocks (see @ref{Literal Examples}). In the general case, however, 22248 we suggest to use the zero width space. You can insert one with any 22249 of the following: 22250 22251 @example 22252 C-x 8 <RET> zero width space <RET> 22253 C-x 8 <RET> 200B <RET> 22254 @end example 22255 22256 22257 For example, in order to write @samp{[[1,2]]} as-is in your document, you 22258 may write instead 22259 22260 @example 22261 [X[1,2]] 22262 @end example 22263 22264 22265 where @samp{X} denotes the zero width space character. 22266 22267 @node Code Evaluation Security 22268 @section Code Evaluation and Security Issues 22269 22270 Unlike plain text, running code comes with risk. Each source code 22271 block, in terms of risk, is equivalent to an executable file. Org 22272 therefore puts a few confirmation prompts by default. This is to 22273 alert the casual user from accidentally running untrusted code. 22274 22275 For users who do not run code blocks or write code regularly, Org's 22276 default settings should suffice. However, some users may want to 22277 tweak the prompts for fewer interruptions. To weigh the risks of 22278 automatic execution of code blocks, here are some details about code 22279 evaluation. 22280 22281 Org evaluates code in the following circumstances: 22282 22283 @table @asis 22284 @item @emph{Source code blocks} 22285 Org evaluates source code blocks in an Org file during export. Org 22286 also evaluates a source code block with the @kbd{C-c C-c} key 22287 chord. Users exporting or running code blocks must load files only 22288 from trusted sources. Be wary of customizing variables that remove 22289 or alter default security measures. 22290 22291 @defopt org-confirm-babel-evaluate 22292 When @code{t}, Org prompts the user for confirmation before executing 22293 each code block. When @code{nil}, Org executes code blocks without 22294 prompting the user for confirmation. When this option is set to 22295 a custom function, Org invokes the function with these two 22296 arguments: the source code language and the body of the code block. 22297 The custom function must return either a @code{t} or @code{nil}, which 22298 determines if the user is prompted. Each source code language can 22299 be handled separately through this function argument. 22300 @end defopt 22301 22302 For example, here is how to execute ditaa code blocks without 22303 prompting: 22304 22305 @lisp 22306 (defun my-org-confirm-babel-evaluate (lang body) 22307 (not (string= lang "ditaa"))) ;don't ask for ditaa 22308 (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate) 22309 @end lisp 22310 22311 @item @emph{Following @samp{shell} and @samp{elisp} links} 22312 Org has two link types that can directly evaluate code (see 22313 @ref{External Links}). Because such code is not visible, these links 22314 have a potential risk. Org therefore prompts the user when it 22315 encounters such links. The customization variables are: 22316 22317 @defopt org-link-shell-confirm-function 22318 Function that prompts the user before executing a shell link. 22319 @end defopt 22320 22321 @defopt org-link-elisp-confirm-function 22322 Function that prompts the user before executing an Emacs Lisp link. 22323 @end defopt 22324 22325 @item @emph{Formulas in tables} 22326 Formulas in tables (see @ref{The Spreadsheet}) are code that is evaluated 22327 either by the Calc interpreter, or by the Emacs Lisp interpreter. 22328 @end table 22329 22330 @node Interaction 22331 @section Interaction with Other Packages 22332 22333 @cindex packages, interaction with other 22334 22335 Org's compatibility and the level of interaction with other Emacs 22336 packages are documented here. 22337 22338 @menu 22339 * Cooperation:: Packages Org cooperates with. 22340 * Conflicts:: Packages that lead to conflicts. 22341 @end menu 22342 22343 @node Cooperation 22344 @subsection Packages that Org cooperates with 22345 22346 @table @asis 22347 @item @samp{calc.el} by Dave Gillespie 22348 @cindex @file{calc.el} 22349 22350 Org uses the Calc package for implementing spreadsheet functionality 22351 in its tables (see @ref{The Spreadsheet}). Org also uses Calc for 22352 embedded calculations. See @ref{Embedded Mode,GNU Emacs Calc Manual,,calc,}. 22353 22354 @item @samp{constants.el} by Carsten Dominik 22355 @cindex @file{constants.el} 22356 @vindex org-table-formula-constants 22357 22358 Org can use names for constants in formulas in tables. Org can also 22359 use calculation suffixes for units, such as @samp{M} for @samp{Mega}. For a 22360 standard collection of such constants, install the @samp{constants} 22361 package. Install version 2.0 of this package, available at 22362 @uref{https://github.com/cdominik/constants-for-Emacs}. Org checks if the 22363 function @code{constants-get} has been autoloaded. Installation 22364 instructions are in the file @samp{constants.el}. 22365 22366 @item @samp{cdlatex.el} by Carsten Dominik 22367 @cindex @file{cdlatex.el} 22368 22369 Org mode can make use of the CD@LaTeX{} package to efficiently enter 22370 @LaTeX{} fragments into Org files. See @ref{CD@LaTeX{} mode}. 22371 22372 @item @samp{imenu.el} by Ake Stenhoff and Lars Lindberg 22373 @cindex @file{imenu.el} 22374 22375 Imenu creates dynamic menus based on an index of items in a file. 22376 Org mode supports Imenu menus. Enable it with a mode hook as 22377 follows: 22378 22379 @lisp 22380 (add-hook 'org-mode-hook 22381 (lambda () (imenu-add-to-menubar "Imenu"))) 22382 @end lisp 22383 22384 @vindex org-imenu-depth 22385 By default the index is two levels deep---you can modify the 22386 depth using the option @code{org-imenu-depth}. 22387 22388 Org activates Imenu support only in the buffers opened after loading 22389 Imenu library. To enable Imenu support in an already opened Org 22390 buffer, reload Org. 22391 22392 @item @samp{speedbar.el} by Eric@tie{}M@.@tie{}Ludlam 22393 @cindex @file{speedbar.el} 22394 22395 Speedbar package creates a special Emacs frame for displaying files 22396 and index items in files. Org mode supports Speedbar; users can 22397 drill into Org files directly from the Speedbar. The @kbd{<} 22398 in the Speedbar frame tweaks the agenda commands to that file or to 22399 a subtree. 22400 22401 @item @samp{table.el} by Takaaki Ota 22402 @cindex table editor, @file{table.el} 22403 @cindex @file{table.el} 22404 22405 Complex ASCII tables with automatic line wrapping, column- and 22406 row-spanning, and alignment can be created using the Emacs table 22407 package by Takaaki Ota. Org mode recognizes such tables and exports 22408 them properly. @kbd{C-c '} to edit these tables in a special 22409 buffer, much like Org's code blocks. Because of interference with 22410 other Org mode functionality, Takaaki Ota tables cannot be edited 22411 directly in the Org buffer. 22412 22413 @table @asis 22414 @item @kbd{C-c '} (@code{org-edit-special}) 22415 @kindex C-c ' 22416 @findex org-edit-special 22417 Edit a @samp{table.el} table. Works when point is in a @samp{table.el} 22418 table. 22419 22420 @item @kbd{C-c ~} (@code{org-table-create-with-table.el}) 22421 @kindex C-c ~ 22422 @findex org-table-create-with-table.el 22423 Insert a @samp{table.el} table. If there is already a table at point, 22424 this command converts it between the @samp{table.el} format and the Org 22425 mode format. See the documentation string of the command 22426 @code{org-convert-table} for the restrictions under which this is 22427 possible. 22428 @end table 22429 @end table 22430 22431 @node Conflicts 22432 @subsection Packages that conflict with Org mode 22433 22434 @cindex shift-selection 22435 @vindex org-support-shift-select 22436 In Emacs, shift-selection combines motions of point with shift key to 22437 enlarge regions. Emacs sets this mode by default. This conflicts 22438 with Org's use of @kbd{S-<cursor>} commands to change timestamps, 22439 TODO keywords, priorities, and item bullet types, etc. Since 22440 @kbd{S-<cursor>} commands outside of specific contexts do not do 22441 anything, Org offers the variable @code{org-support-shift-select} for 22442 customization. Org mode accommodates shift selection by (i) making it 22443 available outside of the special contexts where special commands 22444 apply, and (ii) extending an existing active region even if point 22445 moves across a special context. 22446 22447 @table @asis 22448 @item @samp{cua.el} by Kim@tie{}F@.@tie{}Storm 22449 @cindex @file{cua.el} 22450 @vindex org-replace-disputed-keys 22451 Org key bindings conflict with @kbd{S-<cursor>} keys used by 22452 CUA mode. For Org to relinquish these bindings to CUA mode, 22453 configure the variable @code{org-replace-disputed-keys}. When set, Org 22454 moves the following key bindings in Org files, and in the agenda 22455 buffer---but not during date selection. 22456 22457 @multitable @columnfractions 0.4 0.4 22458 @item @kbd{S-@key{UP}} @result{} @kbd{M-p} 22459 @tab @kbd{S-@key{DOWN}} @result{} @kbd{M-n} 22460 @item @kbd{S-@key{LEFT}} @result{} @kbd{M--} 22461 @tab @kbd{S-@key{RIGHT}} @result{} @kbd{M-+} 22462 @item @kbd{C-S-@key{LEFT}} @result{} @kbd{M-S--} 22463 @tab @kbd{C-S-@key{RIGHT}} @result{} @kbd{M-S-+} 22464 @end multitable 22465 22466 @vindex org-disputed-keys 22467 Yes, these are unfortunately more difficult to remember. If you 22468 want to have other replacement keys, look at the variable 22469 @code{org-disputed-keys}. 22470 22471 @item @samp{ecomplete.el} by Lars Magne Ingebrigtsen 22472 @cindex @file{ecomplete.el} 22473 Ecomplete provides ``electric'' address completion in address header 22474 lines in message buffers. Sadly Orgtbl mode cuts Ecomplete's power 22475 supply: no completion happens when Orgtbl mode is enabled in message 22476 buffers while entering text in address header lines. If one wants 22477 to use ecomplete one should @emph{not} follow the advice to automagically 22478 turn on Orgtbl mode in message buffers (see @ref{Orgtbl Mode}), 22479 but instead---after filling in the message headers---turn on Orgtbl 22480 mode manually when needed in the messages body. 22481 22482 @item @samp{filladapt.el} by Kyle Jones 22483 @cindex @file{filladapt.el} 22484 Org mode tries to do the right thing when filling paragraphs, list 22485 items and other elements. Many users reported problems using both 22486 @samp{filladapt.el} and Org mode, so a safe thing to do is to disable 22487 filladapt like this: 22488 22489 @lisp 22490 (add-hook 'org-mode-hook 'turn-off-filladapt-mode) 22491 @end lisp 22492 22493 @item @samp{viper.el} by Michael Kifer 22494 @cindex @file{viper.el} 22495 @kindex C-c / 22496 22497 Viper uses @kbd{C-c /} and therefore makes this key not access 22498 the corresponding Org mode command @code{org-sparse-tree}. You need to 22499 find another key for this command, or override the key in 22500 @code{viper-vi-global-user-map} with 22501 22502 @lisp 22503 (define-key viper-vi-global-user-map "C-c /" 'org-sparse-tree) 22504 @end lisp 22505 22506 @item @samp{windmove.el} by Hovav Shacham 22507 @cindex @file{windmove.el} 22508 22509 This package also uses the @kbd{S-<cursor>} keys, so everything 22510 written in the paragraph above about CUA mode also applies here. If 22511 you want to make the windmove function active in locations where Org 22512 mode does not have special functionality on @kbd{S-<cursor>}, 22513 add this to your configuration: 22514 22515 @lisp 22516 ;; Make windmove work in Org mode: 22517 (add-hook 'org-shiftup-final-hook 'windmove-up) 22518 (add-hook 'org-shiftleft-final-hook 'windmove-left) 22519 (add-hook 'org-shiftdown-final-hook 'windmove-down) 22520 (add-hook 'org-shiftright-final-hook 'windmove-right) 22521 @end lisp 22522 22523 @item @samp{yasnippet.el} 22524 @cindex @file{yasnippet.el} 22525 The way Org mode binds the @kbd{@key{TAB}} key (binding to @code{[tab]} 22526 instead of @code{"\t"}) overrules YASnippet's access to this key. The 22527 following code fixed this problem: 22528 22529 @lisp 22530 (add-hook 'org-mode-hook 22531 (lambda () 22532 (setq-local yas/trigger-key [tab]) 22533 (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand))) 22534 @end lisp 22535 22536 The latest version of YASnippet does not play well with Org mode. 22537 If the above code does not fix the conflict, start by defining 22538 the following function: 22539 22540 @lisp 22541 (defun yas/org-very-safe-expand () 22542 (let ((yas/fallback-behavior 'return-nil)) (yas/expand))) 22543 @end lisp 22544 22545 Then, tell Org mode to use that function: 22546 22547 @lisp 22548 (add-hook 'org-mode-hook 22549 (lambda () 22550 (make-variable-buffer-local 'yas/trigger-key) 22551 (setq yas/trigger-key [tab]) 22552 (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand) 22553 (define-key yas/keymap [tab] 'yas/next-field))) 22554 @end lisp 22555 @end table 22556 22557 @node TTY Keys 22558 @section Using Org on a TTY 22559 22560 @cindex tty key bindings 22561 22562 Org provides alternative key bindings for TTY and modern mobile 22563 devices that cannot perform movement commands on point and key 22564 bindings with modifier keys. Some of these workarounds may be more 22565 cumbersome than necessary. Users should look into customizing these 22566 further based on their usage needs. For example, the normal 22567 @kbd{S-<cursor>} for editing timestamp might be better with 22568 @kbd{C-c .} chord. 22569 22570 @multitable @columnfractions 0.2 0.28 0.15 0.21 22571 @headitem Default 22572 @tab Alternative 1 22573 @tab Speed key 22574 @tab Alternative 2 22575 @item @kbd{S-@key{TAB}} 22576 @tab @kbd{C-u @key{TAB}} 22577 @tab @kbd{C} 22578 @tab 22579 @item @kbd{M-@key{LEFT}} 22580 @tab @kbd{C-c C-x l} 22581 @tab @kbd{l} 22582 @tab @kbd{Esc @key{LEFT}} 22583 @item @kbd{M-S-@key{LEFT}} 22584 @tab @kbd{C-c C-x L} 22585 @tab @kbd{L} 22586 @tab 22587 @item @kbd{M-@key{RIGHT}} 22588 @tab @kbd{C-c C-x r} 22589 @tab @kbd{r} 22590 @tab @kbd{Esc @key{RIGHT}} 22591 @item @kbd{M-S-@key{RIGHT}} 22592 @tab @kbd{C-c C-x R} 22593 @tab @kbd{R} 22594 @tab 22595 @item @kbd{M-@key{UP}} 22596 @tab @kbd{C-c C-x u} 22597 @tab 22598 @tab @kbd{Esc @key{UP}} 22599 @item @kbd{M-S-@key{UP}} 22600 @tab @kbd{C-c C-x U} 22601 @tab @kbd{U} 22602 @tab 22603 @item @kbd{M-@key{DOWN}} 22604 @tab @kbd{C-c C-x d} 22605 @tab 22606 @tab @kbd{Esc @key{DOWN}} 22607 @item @kbd{M-S-@key{DOWN}} 22608 @tab @kbd{C-c C-x D} 22609 @tab @kbd{D} 22610 @tab 22611 @item @kbd{S-@key{RET}} 22612 @tab @kbd{C-c C-x c} 22613 @tab 22614 @tab 22615 @item @kbd{M-@key{RET}} 22616 @tab @kbd{C-c C-x m} 22617 @tab 22618 @tab @kbd{Esc @key{RET}} 22619 @item @kbd{M-S-@key{RET}} 22620 @tab @kbd{C-c C-x M} 22621 @tab 22622 @tab 22623 @item @kbd{S-@key{LEFT}} 22624 @tab @kbd{C-c @key{LEFT}} 22625 @tab 22626 @tab 22627 @item @kbd{S-@key{RIGHT}} 22628 @tab @kbd{C-c @key{RIGHT}} 22629 @tab 22630 @tab 22631 @item @kbd{S-@key{UP}} 22632 @tab @kbd{C-c @key{UP}} 22633 @tab 22634 @tab 22635 @item @kbd{S-@key{DOWN}} 22636 @tab @kbd{C-c @key{DOWN}} 22637 @tab 22638 @tab 22639 @item @kbd{C-S-@key{LEFT}} 22640 @tab @kbd{C-c C-x @key{LEFT}} 22641 @tab 22642 @tab 22643 @item @kbd{C-S-@key{RIGHT}} 22644 @tab @kbd{C-c C-x @key{RIGHT}} 22645 @tab 22646 @tab 22647 @item @kbd{C-c C-,} 22648 @tab @kbd{C-c C-x s} 22649 @tab 22650 @tab 22651 @end multitable 22652 22653 @node Protocols 22654 @section Protocols for External Access 22655 22656 @cindex protocols, for external access 22657 22658 Org protocol is a tool to trigger custom actions in Emacs from 22659 external applications. Any application that supports calling external 22660 programs with an URL as argument may be used with this functionality. 22661 For example, you can configure bookmarks in your web browser to send a 22662 link to the current page to Org and create a note from it using 22663 capture (see @ref{Capture}). You can also create a bookmark that tells 22664 Emacs to open the local source file of a remote website you are 22665 browsing. 22666 22667 @cindex Org protocol, set-up 22668 @cindex Installing Org protocol 22669 In order to use Org protocol from an application, you need to register 22670 @samp{org-protocol://} as a valid scheme-handler. External calls are 22671 passed to Emacs through the @samp{emacsclient} command, so you also need to 22672 ensure an Emacs server is running. More precisely, when the 22673 application calls 22674 22675 @example 22676 emacsclient "org-protocol://PROTOCOL?key1=val1&key2=val2" 22677 @end example 22678 22679 22680 @noindent 22681 Emacs calls the handler associated to @var{PROTOCOL} with 22682 argument @samp{(:key1 val1 :key2 val2)}. 22683 22684 @cindex protocol, new protocol 22685 @cindex defining new protocols 22686 Org protocol comes with three predefined protocols, detailed in the 22687 following sections. Configure @code{org-protocol-protocol-alist} to define 22688 your own. 22689 22690 @menu 22691 * The @code{store-link} protocol:: Store a link, push URL to kill-ring. 22692 * The @code{capture} protocol:: Fill a buffer with external information. 22693 * The @code{open-source} protocol:: Edit published contents. 22694 @end menu 22695 22696 @node The @code{store-link} protocol 22697 @subsection The @code{store-link} protocol 22698 22699 @cindex store-link protocol 22700 @cindex protocol, store-link 22701 22702 Using the @code{store-link} handler, you can copy links, to that they can 22703 be inserted using @kbd{M-x org-insert-link} or yanking. More 22704 precisely, the command 22705 22706 @example 22707 emacsclient "org-protocol://store-link?url=URL&title=TITLE" 22708 @end example 22709 22710 22711 @noindent 22712 stores the following link: 22713 22714 @example 22715 [[URL][TITLE]] 22716 @end example 22717 22718 22719 In addition, @var{URL} is pushed on the kill-ring for yanking. 22720 You need to encode @var{URL} and @var{TITLE} if they contain 22721 slashes, and probably quote those for the shell. 22722 22723 To use this feature from a browser, add a bookmark with an arbitrary 22724 name, e.g., @samp{Org: store-link} and enter this as @emph{Location}: 22725 22726 @example 22727 javascript:location.href='org-protocol://store-link?' + 22728 new URLSearchParams(@{url:location.href, title:document.title@}); 22729 @end example 22730 22731 Title is an optional parameter. Another expression was recommended earlier: 22732 22733 @example 22734 javascript:location.href='org-protocol://store-link?url='+ 22735 encodeURIComponent(location.href); 22736 @end example 22737 22738 The latter form is compatible with older Org versions from 9.0 to 9.4. 22739 22740 @node The @code{capture} protocol 22741 @subsection The @code{capture} protocol 22742 22743 @cindex capture protocol 22744 @cindex protocol, capture 22745 22746 Activating the ``capture'' handler pops up a @samp{Capture} buffer in Emacs, 22747 using acapture template. 22748 22749 @example 22750 emacsclient "org-protocol://capture?template=X&url=URL&title=TITLE&body=BODY" 22751 @end example 22752 22753 22754 To use this feature, add a bookmark with an arbitrary name, e.g., 22755 @samp{Org: capture}, and enter this as @samp{Location}: 22756 22757 @example 22758 javascript:location.href='org-protocol://capture?' + 22759 new URLSearchParams(@{ 22760 template: 'x', url: window.location.href, 22761 title: document.title, body: window.getSelection()@}); 22762 @end example 22763 22764 You might have seen another expression: 22765 22766 @example 22767 javascript:location.href='org-protocol://capture?template=x'+ 22768 '&url='+encodeURIComponent(window.location.href)+ 22769 '&title='+encodeURIComponent(document.title)+ 22770 '&body='+encodeURIComponent(window.getSelection()); 22771 @end example 22772 22773 It is a bit more cluttered than the former one, but it is compatible 22774 with previous Org versions 9.0-9.4. In these versions encoding of 22775 space as ``+'' character was not supported by URI decoder. 22776 22777 @vindex org-protocol-default-template-key 22778 The capture template to be used can be specified in the bookmark (like 22779 @samp{X} above). If unspecified, the template key is set in the variable 22780 @code{org-protocol-default-template-key}. The following template 22781 placeholders are available: 22782 22783 @example 22784 %:link The URL 22785 %:description The webpage title 22786 %:annotation Equivalent to [[%:link][%:description]] 22787 %i The selected text 22788 @end example 22789 22790 @node The @code{open-source} protocol 22791 @subsection The @code{open-source} protocol 22792 22793 @cindex open-source protocol 22794 @cindex protocol, open-source 22795 22796 The @code{open-source} handler is designed to help with editing local 22797 sources when reading a document. To that effect, you can use 22798 a bookmark with the following location: 22799 22800 @example 22801 javascript:location.href='org-protocol://open-source?&url='+ 22802 encodeURIComponent(location.href) 22803 @end example 22804 22805 @vindex org-protocol-project-alist 22806 The variable @code{org-protocol-project-alist} maps URLs to local file 22807 names, by stripping URL parameters from the end and replacing the 22808 @code{:base-url} with @code{:working-directory} and @code{:online-suffix} with 22809 @code{:working-suffix}. For example, assuming you own a local copy of 22810 @samp{https://orgmode.org/worg/} contents at @samp{/home/user/worg}, you can set 22811 @code{org-protocol-project-alist} to the following 22812 22813 @lisp 22814 (setq org-protocol-project-alist 22815 '(("Worg" 22816 :base-url "https://orgmode.org/worg/" 22817 :working-directory "/home/user/worg/" 22818 :online-suffix ".html" 22819 :working-suffix ".org"))) 22820 @end lisp 22821 22822 @noindent 22823 If you are now browsing 22824 @samp{https://orgmode.org/worg/org-contrib/org-protocol.html} and find 22825 a typo or have an idea about how to enhance the documentation, simply 22826 click the bookmark and start editing. 22827 22828 @cindex rewritten URL in open-source protocol 22829 @cindex protocol, open-source rewritten URL 22830 However, such mapping may not always yield the desired results. 22831 Suppose you maintain an online store located at @samp{https://example.com/}. 22832 The local sources reside in @samp{/home/user/example/}. It is common 22833 practice to serve all products in such a store through one file and 22834 rewrite URLs that do not match an existing file on the server. That 22835 way, a request to @samp{https://example.com/print/posters.html} might be 22836 rewritten on the server to something like 22837 @samp{https://example.com/shop/products.php/posters.html.php}. The 22838 @code{open-source} handler probably cannot find a file named 22839 @samp{/home/user/example/print/posters.html.php} and fails. 22840 22841 Such an entry in @code{org-protocol-project-alist} may hold an additional 22842 property @code{:rewrites}. This property is a list of cons cells, each of 22843 which maps a regular expression to a path relative to the 22844 @code{:working-directory}. 22845 22846 Now map the URL to the path @samp{/home/user/example/products.php} by 22847 adding @code{:rewrites} rules like this: 22848 22849 @lisp 22850 (setq org-protocol-project-alist 22851 '(("example.com" 22852 :base-url "https://example.com/" 22853 :working-directory "/home/user/example/" 22854 :online-suffix ".php" 22855 :working-suffix ".php" 22856 :rewrites (("example.com/print/" . "products.php") 22857 ("example.com/$" . "index.php"))))) 22858 @end lisp 22859 22860 @noindent 22861 Since @samp{example.com/$} is used as a regular expression, it maps 22862 @samp{https://example.com/}, @samp{https://example.com}, 22863 @samp{https://www.example.com/} and similar to 22864 @samp{/home/user/example/index.php}. 22865 22866 The @code{:rewrites} rules are searched as a last resort if and only if no 22867 existing file name is matched. 22868 22869 @cindex protocol, open-source, set-up mapping 22870 @cindex mappings in open-source protocol 22871 @findex org-protocol-create 22872 @findex org-protocol-create-for-org 22873 Two functions can help you filling @code{org-protocol-project-alist} with 22874 valid contents: @code{org-protocol-create} and 22875 @code{org-protocol-create-for-org}. The latter is of use if you're editing 22876 an Org file that is part of a publishing project. 22877 22878 @node Org Crypt 22879 @section Org Crypt 22880 22881 Org Crypt encrypts the text of an entry, but not the headline, or 22882 properties. Behind the scene, it uses the @ref{Top,Emacs EasyPG Library,,epa,} to 22883 encrypt and decrypt files, and EasyPG needs a correct @ref{Top,GnuPG,,gnupg,} setup. 22884 22885 @vindex org-crypt-tag-matcher 22886 Any text below a headline that has a @samp{crypt} tag is automatically 22887 encrypted when the file is saved. To use a different tag, customize 22888 the @code{org-crypt-tag-matcher} setting. 22889 22890 Here is a suggestion for Org Crypt settings in Emacs init file: 22891 22892 @lisp 22893 (require 'org-crypt) 22894 (org-crypt-use-before-save-magic) 22895 (setq org-tags-exclude-from-inheritance '("crypt")) 22896 22897 (setq org-crypt-key nil) 22898 ;; GPG key to use for encryption. 22899 ;; nil means use symmetric encryption unconditionally. 22900 ;; "" means use symmetric encryption unless heading sets CRYPTKEY property. 22901 22902 (setq auto-save-default nil) 22903 ;; Auto-saving does not cooperate with org-crypt.el: so you need to 22904 ;; turn it off if you plan to use org-crypt.el quite often. Otherwise, 22905 ;; you'll get an (annoying) message each time you start Org. 22906 22907 ;; To turn it off only locally, you can insert this: 22908 ;; 22909 ;; # -*- buffer-auto-save-file-name: nil; -*- 22910 @end lisp 22911 22912 It's possible to use different keys for different headings by 22913 specifying the respective key as property @samp{CRYPTKEY}, e.g.: 22914 22915 @example 22916 * Totally secret :crypt: 22917 :PROPERTIES: 22918 :CRYPTKEY: 0x0123456789012345678901234567890123456789 22919 :END: 22920 @end example 22921 22922 Note that the @samp{CRYPTKEY} property is only effective when 22923 @code{org-crypt-key} is non-@code{nil}. If @code{org-crypt-key} is @code{nil}, Org uses 22924 symmetric encryption unconditionally. 22925 22926 Excluding the @samp{crypt} tag from inheritance prevents already encrypted 22927 text from being encrypted again. 22928 22929 @node Org Mobile 22930 @section Org Mobile 22931 22932 @cindex smartphone 22933 22934 Org Mobile is a protocol for synchronizing Org files between Emacs and 22935 other applications, e.g., on mobile devices. It enables offline-views 22936 and capture support for an Org mode system that is rooted on a ``real'' 22937 computer. The external application can also record changes to 22938 existing entries. 22939 22940 This appendix describes Org's support for agenda view formats 22941 compatible with Org Mobile. It also describes synchronizing changes, 22942 such as to notes, between the mobile application and the computer. 22943 22944 To change tags and TODO states in the mobile application, first 22945 customize the variables @code{org-todo-keywords}, @code{org-tag-alist} and 22946 @code{org-tag-persistent-alist}. These should cover all the important tags 22947 and TODO keywords, even if Org files use only some of them. Though 22948 the mobile application is expected to support in-buffer settings, it 22949 is required to understand TODO states @emph{sets} (see @ref{Per-file keywords}) and @emph{mutually exclusive} tags (see @ref{Setting Tags}) only for those set in these variables. 22950 22951 @menu 22952 * Setting up the staging area:: For the mobile device. 22953 * Pushing to the mobile application:: Uploading Org files and agendas. 22954 * Pulling from the mobile application:: Integrating captured and flagged items. 22955 @end menu 22956 22957 @node Setting up the staging area 22958 @subsection Setting up the staging area 22959 22960 @vindex org-mobile-directory 22961 The mobile application needs access to a file directory on 22962 a server@footnote{For a server to host files, consider using a WebDAV server, 22963 such as @uref{https://nextcloud.com, Nextcloud}. Additional help is at this @uref{https://orgmode.org/worg/org-faq.html#mobileorg_webdav, FAQ entry}.} to interact with Emacs. Pass its location through 22964 the @code{org-mobile-directory} variable. If you can mount that directory 22965 locally just set the variable to point to that directory: 22966 22967 @lisp 22968 (setq org-mobile-directory "~/orgmobile/") 22969 @end lisp 22970 22971 Alternatively, by using TRAMP (see @ref{Top,TRAMP User Manual,,tramp,}), 22972 @code{org-mobile-directory} may point to a remote directory accessible 22973 through, for example, SSH, SCP, or DAVS: 22974 22975 @lisp 22976 (setq org-mobile-directory "/davs:user@@remote.host:/org/webdav/") 22977 @end lisp 22978 22979 @vindex org-mobile-encryption 22980 With a public server, consider encrypting the files. Org also 22981 requires OpenSSL installed on the local computer. To turn on 22982 encryption, set the same password in the mobile application and in 22983 Emacs. Set the password in the variable 22984 @code{org-mobile-use-encryption}@footnote{ If Emacs is configured for safe 22985 storing of passwords, then configure the variable 22986 @code{org-mobile-encryption-password}; please read the docstring of that 22987 variable.}. Note that even after the mobile application encrypts the 22988 file contents, the file name remains visible on the file systems of 22989 the local computer, the server, and the mobile device. 22990 22991 @node Pushing to the mobile application 22992 @subsection Pushing to the mobile application 22993 22994 @findex org-mobile-push 22995 @vindex org-mobile-files 22996 The command @code{org-mobile-push} copies files listed in 22997 @code{org-mobile-files} into the staging area. Files include agenda files 22998 (as listed in @code{org-agenda-files}). Customize @code{org-mobile-files} to 22999 add other files. File names are staged with paths relative to 23000 @code{org-directory}, so all files should be inside this directory@footnote{ 23001 Symbolic links in @code{org-directory} need to have the same name as their 23002 targets.}. 23003 23004 Push creates a special Org file @samp{agendas.org} with custom agenda views 23005 defined by the user@footnote{While creating the agendas, Org mode forces @samp{ID} properties 23006 on all referenced entries, so that these entries can be uniquely 23007 identified if Org Mobile flags them for further action. To avoid 23008 setting properties configure the variable 23009 @code{org-mobile-force-id-on-agenda-items} to @code{nil}. Org mode then relies 23010 on outline paths, assuming they are unique.}. 23011 23012 Finally, Org writes the file @samp{index.org}, containing links to other 23013 files. The mobile application reads this file first from the server 23014 to determine what other files to download for agendas. For faster 23015 downloads, it is expected to only read files whose checksums@footnote{ 23016 Checksums are stored automatically in the file @samp{checksums.dat}.} have 23017 changed. 23018 23019 @node Pulling from the mobile application 23020 @subsection Pulling from the mobile application 23021 23022 @findex org-mobile-pull 23023 The command @code{org-mobile-pull} synchronizes changes with the server. 23024 More specifically, it first pulls the Org files for viewing. It then 23025 appends captured entries and pointers to flagged or changed entries to 23026 the file @samp{mobileorg.org} on the server. Org ultimately integrates its 23027 data in an inbox file format, through the following steps: 23028 23029 @enumerate 23030 @item 23031 @vindex org-mobile-inbox-for-pull 23032 Org moves all entries found in @samp{mobileorg.org}@footnote{ The file will 23033 be empty after this operation.} and appends them to the file 23034 pointed to by the variable @code{org-mobile-inbox-for-pull}. It should 23035 reside neither in the staging area nor on the server. Each 23036 captured entry and each editing event is a top-level entry in the 23037 inbox file. 23038 23039 @item 23040 @cindex @samp{FLAGGED}, tag 23041 After moving the entries, Org processes changes to the shared 23042 files. Some of them are applied directly and without user 23043 interaction. Examples include changes to tags, TODO state, 23044 headline and body text. Entries requiring further action are 23045 tagged as @samp{FLAGGED}. Org marks entries with problems with an error 23046 message in the inbox. They have to be resolved manually. 23047 23048 @item 23049 Org generates an agenda view for flagged entries for user 23050 intervention to clean up. For notes stored in flagged entries, Org 23051 displays them in the echo area when point is on the corresponding 23052 agenda item. 23053 23054 @table @asis 23055 @item @kbd{?} 23056 Pressing @kbd{?} displays the entire flagged note in another 23057 window. Org also pushes it to the kill ring. To store flagged 23058 note as a normal note, use @kbd{? z C-y C-c C-c}. Pressing 23059 @kbd{?} twice does these things: first it removes the 23060 @samp{FLAGGED} tag; second, it removes the flagged note from the 23061 property drawer; third, it signals that manual editing of the 23062 flagged entry is now finished. 23063 @end table 23064 @end enumerate 23065 23066 @kindex ? @r{(Agenda dispatcher)} 23067 From the agenda dispatcher, @kbd{?} returns to the view to finish 23068 processing flagged entries. Note that these entries may not be the 23069 most recent since the mobile application searches files that were last 23070 pulled. To get an updated agenda view with changes since the last 23071 pull, pull again. 23072 23073 @node Drag and Drop & @code{yank-media} 23074 @section Drag and Drop & @code{yank-media} 23075 23076 @cindex dropping files 23077 @cindex dragging files 23078 @cindex drag and drop 23079 @cindex dnd 23080 @vindex org-yank-dnd-method 23081 Org mode supports drag and drop (DnD) of files. By default, Org asks 23082 the user what must be done with the dropped file: attach it, insert 23083 @samp{file:} link, or open the file. Customize @code{org-yank-dnd-method} to 23084 set the default DnD action. 23085 23086 When DnD method is ``attach'', Org mode first consults DnD metadata to 23087 decide the attach method. For example, when file/files are dragged 23088 from a file manager, Org may attach by copying or by moving. 23089 23090 @vindex org-yank-dnd-default-attach-method 23091 If Org cannot figure out which attachment method to use from the 23092 metadata, it defaults to @code{org-yank-dnd-default-attach-method} @footnote{By 23093 default, @code{org-yank-dnd-default-attach-method} is set to nil -- use the same 23094 value as @code{org-attach-method} (@code{cp} by default).} 23095 23096 @cindex pasting files, images from clipboard 23097 Starting from Emacs 29, Org mode supports @code{yank-media} command to yank 23098 images from the clipboard and files from a file manager. 23099 23100 @vindex org-yank-image-save-method 23101 When yanking images from clipboard, Org saves the image on disk and 23102 inserts the image link to Org buffer. Images are either saved as 23103 attachments to heading (default) or to a globally defined directory. 23104 The save location is controlled by @code{org-yank-image-save-method}. 23105 23106 @vindex org-yank-image-file-name-function 23107 The yanked images are saved under automatically generated name. You 23108 can customize @code{org-yank-image-file-name-function} to make Org query 23109 the image names or change the naming scheme. 23110 23111 When yanking files copied from a file manager, Org respects the value 23112 of @code{org-yank-dnd-method}. Image files pasted this way also respect 23113 the value of @code{org-yank-image-save-method} when the action to perform 23114 is @samp{attach}. 23115 23116 @node Hacking 23117 @appendix Hacking 23118 23119 @cindex hacking 23120 23121 This appendix describes some ways a user can extend the functionality 23122 of Org. 23123 23124 @menu 23125 * Hooks:: How to reach into Org's internals. 23126 * Add-on Packages:: Available extensions. 23127 * Adding Hyperlink Types:: New custom link types. 23128 * Adding Export Backends:: How to write new export backends. 23129 * Tables in Arbitrary Syntax:: Orgtbl for LaTeX and other programs. 23130 * Dynamic Blocks:: Automatically filled blocks. 23131 * Special Agenda Views:: Customized views. 23132 * Speeding Up Your Agendas:: Tips on how to speed up your agendas. 23133 * Extracting Agenda Information:: Post-processing agenda information. 23134 * Using the Property API:: Writing programs that use entry properties. 23135 * Using the Mapping API:: Mapping over all or selected entries. 23136 @end menu 23137 23138 @node Hooks 23139 @appendixsec Hooks 23140 23141 @cindex hooks 23142 23143 Org has a large number of hook variables for adding functionality. A 23144 complete list of hooks with documentation is maintained by the Worg 23145 project at @uref{https://orgmode.org/worg/doc.html#hooks}. 23146 23147 @node Add-on Packages 23148 @appendixsec Add-on Packages 23149 23150 @cindex add-on packages 23151 23152 Various authors wrote a large number of add-on packages for Org. Some 23153 of these packages used to be part of the @samp{org-mode} repository but are 23154 now hosted in a separate @samp{org-contrib} repository 23155 @uref{https://git.sr.ht/~bzg/org-contrib, here}. A Worg page with more 23156 information is at: @uref{https://orgmode.org/worg/org-contrib/}. 23157 23158 @node Adding Hyperlink Types 23159 @appendixsec Adding Hyperlink Types 23160 23161 @cindex hyperlinks, adding new types 23162 23163 Org has many built-in hyperlink types (see @ref{Hyperlinks}), and an 23164 interface for adding new link types. The following example shows the 23165 process of adding Org links to Unix man pages, which look like this 23166 23167 @example 23168 [[man:printf][The printf manual]] 23169 @end example 23170 23171 23172 @noindent 23173 The following @samp{ol-man.el} file implements it 23174 23175 @lisp 23176 ;;; ol-man.el - Support for links to man pages in Org mode 23177 (require 'ol) 23178 23179 (org-link-set-parameters "man" 23180 :follow #'org-man-open 23181 :export #'org-man-export 23182 :store #'org-man-store-link) 23183 23184 (defcustom org-man-command 'man 23185 "The Emacs command to be used to display a man page." 23186 :group 'org-link 23187 :type '(choice (const man) (const woman))) 23188 23189 (defun org-man-open (path _) 23190 "Visit the manpage on PATH. 23191 PATH should be a topic that can be thrown at the man command." 23192 (funcall org-man-command path)) 23193 23194 (defun org-man-store-link (&optional _interactive?) 23195 "Store a link to a man page." 23196 (when (memq major-mode '(Man-mode woman-mode)) 23197 ;; This is a man page, we do make this link. 23198 (let* ((page (org-man-get-page-name)) 23199 (link (concat "man:" page)) 23200 (description (format "Man page for %s" page))) 23201 (org-link-store-props 23202 :type "man" 23203 :link link 23204 :description description)))) 23205 23206 (defun org-man-get-page-name () 23207 "Extract the page name from the buffer name." 23208 ;; This works for both `Man-mode' and `woman-mode'. 23209 (if (string-match " \\(\\S-+\\)\\*" (buffer-name)) 23210 (match-string 1 (buffer-name)) 23211 (error "Cannot create link to this man page"))) 23212 23213 (defun org-man-export (link description format _) 23214 "Export a man page link from Org files." 23215 (let ((path (format "http://man.he.net/?topic=%s§ion=all" link)) 23216 (desc (or description link))) 23217 (pcase format 23218 (`html (format "<a target=\"_blank\" href=\"%s\">%s</a>" path desc)) 23219 (`latex (format "\\href@{%s@}@{%s@}" path desc)) 23220 (`texinfo (format "@@uref@{%s,%s@}" path desc)) 23221 (`ascii (format "%s (%s)" desc path)) 23222 (t path)))) 23223 23224 (provide ol-man) 23225 ;;; ol-man.el ends here 23226 @end lisp 23227 23228 @noindent 23229 To activate links to man pages in Org, enter this in the Emacs init 23230 file: 23231 23232 @lisp 23233 (require 'ol-man) 23234 @end lisp 23235 23236 @noindent 23237 A review of @samp{ol-man.el}: 23238 23239 @enumerate 23240 @item 23241 First, @samp{(require 'ol)} ensures that @samp{ol.el} is loaded. 23242 23243 @item 23244 @findex org-link-set-parameters 23245 @vindex org-link-parameters 23246 Then @code{org-link-set-parameters} defines a new link type with @samp{man} 23247 prefix and associates functions for following, exporting and 23248 storing such links. See the variable @code{org-link-parameters} for 23249 a complete list of possible associations. 23250 23251 @item 23252 The rest of the file implements necessary variables and functions. 23253 23254 For example, @code{org-man-store-link} is responsible for storing a link 23255 when @code{org-store-link} (see @ref{Handling Links}) is called from a buffer 23256 displaying a man page. It is passed an argument @code{interactive?} 23257 which this function does not use, but other store functions use to 23258 behave differently when a link is stored interactively by the user. 23259 It first checks if the major mode is appropriate. If check fails, 23260 the function returns @code{nil}, which means it isn't responsible for 23261 creating a link to the current buffer. Otherwise the function 23262 makes a link string by combining the @samp{man:} prefix with the man 23263 topic. It also provides a default description. The function 23264 @code{org-insert-link} can insert it back into an Org buffer later on. 23265 @end enumerate 23266 23267 @node Adding Export Backends 23268 @appendixsec Adding Export Backends 23269 23270 @cindex Export, writing backends 23271 23272 Org's export engine makes it easy for writing new backends. The 23273 framework on which the engine was built makes it easy to derive new 23274 backends from existing ones. 23275 23276 @findex org-export-define-backend 23277 @findex org-export-define-derived-backend 23278 The two main entry points to the export engine are: 23279 @code{org-export-define-backend} and @code{org-export-define-derived-backend}. 23280 To grok these functions, see @samp{ox-latex.el} for an example of defining 23281 a new backend from scratch, and @samp{ox-beamer.el} for an example of 23282 deriving from an existing engine. 23283 23284 For creating a new backend from scratch, first set its name as 23285 a symbol in an alist consisting of elements and export functions. To 23286 make the backend visible to the export dispatcher, set @code{:menu-entry} 23287 keyword. For export options specific to this backend, set the 23288 @code{:options-alist}. 23289 23290 For creating a new backend from an existing one, set 23291 @code{:translate-alist} to an alist of export functions. This alist 23292 replaces the parent backend functions. 23293 23294 For complete documentation, see @uref{https://orgmode.org/worg/dev/org-export-reference.html, the Org Export Reference on Worg}. 23295 23296 @node Tables in Arbitrary Syntax 23297 @appendixsec Tables in Arbitrary Syntax 23298 23299 @cindex tables, in other modes 23300 @cindex lists, in other modes 23301 @cindex Orgtbl mode 23302 23303 Due to Org's success in handling tables with Orgtbl, a frequently 23304 requested feature is the use of Org's table functions in other modes, 23305 e.g., @LaTeX{}. This would be hard to do in a general way without 23306 complicated customization nightmares. Moreover, that would take Org 23307 away from its simplicity roots that Orgtbl has proven. There is, 23308 however, an alternate approach to accomplishing the same. 23309 23310 This approach involves implementing a custom @emph{translate} function that 23311 operates on a native Org @emph{source table} to produce a table in another 23312 format. This strategy would keep the excellently working Orgtbl 23313 simple and isolate complications, if any, confined to the translate 23314 function. To add more alien table formats, we just add more translate 23315 functions. Also the burden of developing custom translate functions 23316 for new table formats is in the hands of those who know those formats 23317 best. 23318 23319 @menu 23320 * Radio tables:: Sending and receiving radio tables. 23321 * A @LaTeX{} example:: Step by step, almost a tutorial. 23322 * Translator functions:: Copy and modify. 23323 @end menu 23324 23325 @node Radio tables 23326 @appendixsubsec Radio tables 23327 23328 @cindex radio tables 23329 23330 Radio tables are target locations for translated tables that are not near 23331 their source. Org finds the target location and inserts the translated 23332 table. 23333 23334 The key to finding the target location is the magic words @samp{BEGIN/END 23335 RECEIVE ORGTBL}. They have to appear as comments in the current mode. 23336 If the mode is C, then: 23337 23338 @example 23339 /* BEGIN RECEIVE ORGTBL table_name */ 23340 /* END RECEIVE ORGTBL table_name */ 23341 @end example 23342 23343 At the location of source, Org needs a special line to direct Orgtbl 23344 to translate and to find the target for inserting the translated 23345 table. For example: 23346 23347 @cindex @samp{ORGTBL}, keyword 23348 @example 23349 #+ORGTBL: SEND table_name translation_function arguments ... 23350 @end example 23351 23352 23353 @noindent 23354 @samp{table_name} is the table's reference name, which is also used in the 23355 receiver lines, and the @samp{translation_function} is the Lisp function 23356 that translates. This line, in addition, may also contain alternating 23357 key and value arguments at the end. The translation function gets 23358 these values as a property list. A few standard parameters are 23359 already recognized and acted upon before the translation function is 23360 called: 23361 23362 @table @asis 23363 @item @samp{:skip N} 23364 Skip the first N lines of the table. Hlines do count; include them 23365 if they are to be skipped. 23366 23367 @item @samp{:skipcols (n1 n2 ...)} 23368 List of columns to be skipped. First Org automatically discards 23369 columns with calculation marks and then sends the table to the 23370 translator function, which then skips columns as specified in 23371 @samp{skipcols}. 23372 @end table 23373 23374 To keep the source table intact in the buffer without being disturbed 23375 when the source file is compiled or otherwise being worked on, use one 23376 of these strategies: 23377 23378 @itemize 23379 @item 23380 Place the table in a block comment. For example, in C mode you 23381 could wrap the table between @samp{/*} and @samp{*/} lines. 23382 23383 @item 23384 Put the table after an ``end'' statement. For example @code{\bye} in @TeX{} 23385 and @code{\end@{document@}} in @LaTeX{}. 23386 23387 @item 23388 Comment and un-comment each line of the table during edits. The 23389 @kbd{M-x orgtbl-toggle-comment} command makes toggling easy. 23390 @end itemize 23391 23392 @node A @LaTeX{} example 23393 @appendixsubsec A @LaTeX{} example of radio tables 23394 23395 @cindex @LaTeX{}, and Orgtbl mode 23396 23397 To wrap a source table in @LaTeX{}, use the @samp{comment} environment 23398 provided by @samp{comment.sty}@footnote{ @uref{https://www.ctan.org/pkg/comment}}. To 23399 activate it, put @code{\usepackage@{comment@}} in the document header. 23400 Orgtbl mode inserts a radio table skeleton@footnote{By default this works only for @LaTeX{}, HTML, and Texinfo. 23401 Configure the variable @code{orgtbl-radio-table-templates} to install 23402 templates for other modes.} with the command 23403 @kbd{M-x orgtbl-insert-radio-table}, which prompts for a table 23404 name. For example, if @samp{salesfigures} is the name, the template 23405 inserts: 23406 23407 @example 23408 % BEGIN RECEIVE ORGTBL salesfigures 23409 % END RECEIVE ORGTBL salesfigures 23410 \begin@{comment@} 23411 #+ORGTBL: SEND salesfigures orgtbl-to-latex 23412 | | | 23413 \end@{comment@} 23414 @end example 23415 23416 @vindex LaTeX-verbatim-environments 23417 @noindent 23418 The line @samp{#+ORGTBL: SEND} tells Orgtbl mode to use the function 23419 @code{orgtbl-to-latex} to convert the table to @LaTeX{} format, then insert 23420 the table at the target (receive) location named @samp{salesfigures}. Now 23421 the table is ready for data entry. It can even use spreadsheet 23422 features@footnote{If the @samp{TBLFM} keyword contains an odd number of dollar 23423 characters, this may cause problems with Font Lock in @LaTeX{} mode. As 23424 shown in the example you can fix this by adding an extra line inside 23425 the @samp{comment} environment that is used to balance the dollar 23426 expressions. If you are using AUC@TeX{} with the font-latex library, 23427 a much better solution is to add the @samp{comment} environment to the 23428 variable @code{LaTeX-verbatim-environments}.}: 23429 23430 @example 23431 % BEGIN RECEIVE ORGTBL salesfigures 23432 % END RECEIVE ORGTBL salesfigures 23433 \begin@{comment@} 23434 #+ORGTBL: SEND salesfigures orgtbl-to-latex 23435 | Month | Days | Nr sold | per day | 23436 |-------+------+---------+---------| 23437 | Jan | 23 | 55 | 2.4 | 23438 | Feb | 21 | 16 | 0.8 | 23439 | March | 22 | 278 | 12.6 | 23440 #+TBLFM: $4=$3/$2;%.1f 23441 % $ (optional extra dollar to keep Font Lock happy, see footnote) 23442 \end@{comment@} 23443 @end example 23444 23445 After editing, @kbd{C-c C-c} inserts the translated table at the 23446 target location, between the two marker lines. 23447 23448 For hand-made custom tables, note that the translator needs to skip 23449 the first two lines of the source table. Also the command has to 23450 @emph{splice} out the target table without the header and footer. 23451 23452 @example 23453 \begin@{tabular@}@{lrrr@} 23454 Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\ 23455 % BEGIN RECEIVE ORGTBL salesfigures 23456 % END RECEIVE ORGTBL salesfigures 23457 \end@{tabular@} 23458 % 23459 \begin@{comment@} 23460 #+ORGTBL: SEND salesfigures orgtbl-to-latex :splice t :skip 2 23461 | Month | Days | Nr sold | per day | 23462 |-------+------+---------+---------| 23463 | Jan | 23 | 55 | 2.4 | 23464 | Feb | 21 | 16 | 0.8 | 23465 | March | 22 | 278 | 12.6 | 23466 #+TBLFM: $4=$3/$2;%.1f 23467 \end@{comment@} 23468 @end example 23469 23470 The @LaTeX{} translator function @code{orgtbl-to-latex} is already part of 23471 Orgtbl mode and uses a @samp{tabular} environment to typeset the table and 23472 marks horizontal lines with @code{\hline}. For additional parameters to 23473 control output, see @ref{Translator functions}: 23474 23475 @table @asis 23476 @item @samp{:splice BOOLEAN} 23477 When @{@{@{var(BOOLEAN@}@}@} is non-@code{nil}, return only table body lines; 23478 i.e., not wrapped in @samp{tabular} environment. Default is @code{nil}. 23479 23480 @item @samp{:fmt FMT} 23481 Format string to warp each field. It should contain @samp{%s} for the 23482 original field value. For example, to wrap each field value in 23483 dollar symbol, you could use @samp{:fmt "$%s$"}. Format can also wrap 23484 a property list with column numbers and formats, for example @samp{:fmt 23485 (2 "$%s$" 4 "%s\\%%")}. In place of a string, a function of one 23486 argument can be used; the function must return a formatted string. 23487 23488 @item @samp{:efmt EFMT} 23489 Format numbers as exponentials. The spec should have @samp{%s} twice for 23490 inserting mantissa and exponent, for example @samp{"%s\\times10^@{%s@}"}. This 23491 may also be a property list with column numbers and formats, for 23492 example @samp{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After 23493 @var{EFMT} has been applied to a value, @var{FMT}---see 23494 above---is also applied. Functions with two arguments can be 23495 supplied instead of strings. By default, no special formatting is 23496 applied. 23497 @end table 23498 23499 @node Translator functions 23500 @appendixsubsec Translator functions 23501 23502 @cindex HTML, and Orgtbl mode 23503 @cindex translator function 23504 23505 @findex orgtbl-to-csv 23506 @findex orgtbl-to-tsv 23507 @findex orgtbl-to-latex 23508 @findex orgtbl-to-html 23509 @findex orgtbl-to-texinfo 23510 @findex orgtbl-to-unicode 23511 @findex orgtbl-to-orgtbl 23512 @findex orgtbl-to-generic 23513 Orgtbl mode has built-in translator functions: @code{orgtbl-to-csv} 23514 (comma-separated values), @code{orgtbl-to-tsv} (TAB-separated values), 23515 @code{orgtbl-to-latex}, @code{orgtbl-to-html}, @code{orgtbl-to-texinfo}, 23516 @code{orgtbl-to-unicode} and @code{orgtbl-to-orgtbl}. They use the generic 23517 translator, @code{orgtbl-to-generic}, which delegates translations to 23518 various export backends. 23519 23520 Properties passed to the function through the @samp{ORGTBL SEND} line take 23521 precedence over properties defined inside the function. For example, 23522 this overrides the default @LaTeX{} line endings, @code{\\}, with @code{\\[2mm]}: 23523 23524 @example 23525 #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]" 23526 @end example 23527 23528 23529 For a new language translator, define a converter function. It can be 23530 a generic function, such as shown in this example. It marks 23531 a beginning and ending of a table with @samp{!BTBL!} and @samp{!ETBL!}; 23532 a beginning and ending of lines with @samp{!BL!} and @samp{!EL!}; and uses a TAB 23533 for a field separator: 23534 23535 @lisp 23536 (defun orgtbl-to-language (table params) 23537 "Convert the orgtbl-mode TABLE to language." 23538 (orgtbl-to-generic 23539 table 23540 (org-combine-plists 23541 '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t") 23542 params))) 23543 @end lisp 23544 23545 @noindent 23546 The documentation for the @code{orgtbl-to-generic} function shows 23547 a complete list of parameters, each of which can be passed through to 23548 @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function using 23549 that generic function. 23550 23551 For complicated translations the generic translator function could be 23552 replaced by a custom translator function. Such a custom function must 23553 take two arguments and return a single string containing the formatted 23554 table. The first argument is the table whose lines are a list of 23555 fields or the symbol @code{hline}. The second argument is the property 23556 list consisting of parameters specified in the @samp{#+ORGTBL: SEND} line. 23557 Please share your translator functions by posting them to the Org 23558 users mailing list, at @email{mailto:emacs-orgmode@@gnu.org}. 23559 23560 @node Dynamic Blocks 23561 @appendixsec Dynamic Blocks 23562 23563 @cindex dynamic blocks 23564 23565 Org supports @emph{dynamic blocks} in Org documents. They are inserted 23566 with begin and end markers like any other code block, but the contents 23567 are updated automatically by a user function. 23568 23569 @kindex C-c C-x x 23570 @findex org-dynamic-block-insert-dblock 23571 You can insert a dynamic block with @code{org-dynamic-block-insert-dblock}, 23572 which is bound to @kbd{C-c C-x x} by default. For example, 23573 @kbd{C-c C-x x c l o c k t a b l e @key{RET}} inserts a table that 23574 updates the work time (see @ref{Clocking Work Time}). 23575 23576 Dynamic blocks can have names and function parameters. The syntax is 23577 similar to source code block specifications: 23578 23579 @example 23580 #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ... 23581 ... 23582 #+END: 23583 @end example 23584 23585 These commands update dynamic blocks: 23586 23587 @table @asis 23588 @item @kbd{C-c C-x C-u} (@code{org-dblock-update}) 23589 @kindex C-c C-x C-u 23590 @findex org-dblock-update 23591 Update dynamic block at point. 23592 23593 @item @kbd{C-u C-c C-x C-u} 23594 @kindex C-u C-c C-x C-u 23595 Update all dynamic blocks in the current file. 23596 @end table 23597 23598 Before updating a dynamic block, Org removes content between the 23599 @samp{BEGIN} and @samp{END} markers. Org then reads the parameters on the 23600 @samp{BEGIN} line for passing to the writer function as a plist. The 23601 previous content of the dynamic block becomes erased from the buffer 23602 and appended to the plist under @code{:content}. 23603 23604 The syntax for naming a writer function with a dynamic block labeled 23605 @samp{myblock} is: @code{org-dblock-write:myblock}. 23606 23607 The following is an example of a dynamic block and a block writer function 23608 that updates the time when the function was last run: 23609 23610 @example 23611 #+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M" 23612 ... 23613 #+END: 23614 @end example 23615 23616 @noindent 23617 The dynamic block's writer function: 23618 23619 @lisp 23620 (defun org-dblock-write:block-update-time (params) 23621 (let ((fmt (or (plist-get params :format) "%d. %m. %Y"))) 23622 (insert "Last block update at: " 23623 (format-time-string fmt)))) 23624 @end lisp 23625 23626 To keep dynamic blocks up-to-date in an Org file, use the function, 23627 @code{org-update-all-dblocks} in hook, such as @code{before-save-hook}. The 23628 @code{org-update-all-dblocks} function does not run if the file is not in 23629 Org mode. 23630 23631 @findex org-narrow-to-block 23632 Dynamic blocks, like any other block, can be narrowed with 23633 @code{org-narrow-to-block}. 23634 23635 @node Special Agenda Views 23636 @appendixsec Special Agenda Views 23637 23638 @cindex agenda views, user-defined 23639 23640 @vindex org-agenda-skip-function 23641 @vindex org-agenda-skip-function-global 23642 Org provides a special hook to further limit items in agenda views: 23643 @code{agenda}, @code{agenda*}@footnote{ The @code{agenda*} view is the same as @code{agenda} 23644 except that it only considers @emph{appointments}, i.e., scheduled and 23645 deadline items that have a time specification @samp{[h]h:mm} in their 23646 timestamps.}, @code{todo}, @code{alltodo}, @code{tags}, @code{tags-todo}, @code{tags-tree}. 23647 Specify a custom function that tests inclusion of every matched item 23648 in the view. This function can also skip as much as is needed. 23649 23650 For a global condition applicable to agenda views, use the 23651 @code{org-agenda-skip-function-global} variable. Org uses a global 23652 condition with @code{org-agenda-skip-function} for custom searching. 23653 23654 This example defines a function for a custom view showing TODO items 23655 with @samp{waiting} status. Manually this is a multi-step search process, 23656 but with a custom view, this can be automated as follows: 23657 23658 The custom function searches the subtree for the @samp{waiting} tag and 23659 returns @code{nil} on match. Otherwise it gives the location from where 23660 the search continues. 23661 23662 @lisp 23663 (defun my-skip-unless-waiting () 23664 "Skip trees that are not waiting" 23665 (let ((subtree-end (save-excursion (org-end-of-subtree t)))) 23666 (if (re-search-forward ":waiting:" subtree-end t) 23667 nil ; tag found, do not skip 23668 subtree-end))) ; tag not found, continue after end of subtree 23669 @end lisp 23670 23671 To use this custom function in a custom agenda command: 23672 23673 @lisp 23674 (org-add-agenda-custom-command 23675 '("b" todo "PROJECT" 23676 ((org-agenda-skip-function 'my-skip-unless-waiting) 23677 (org-agenda-overriding-header "Projects waiting for something: ")))) 23678 @end lisp 23679 23680 @vindex org-agenda-overriding-header 23681 Note that this also binds @code{org-agenda-overriding-header} to a more 23682 meaningful string suitable for the agenda view. 23683 23684 @vindex org-odd-levels-only 23685 @vindex org-agenda-skip-function 23686 @findex org-agenda-skip-entry-if 23687 @findex org-agenda-skip-subtree-if 23688 Search for entries with a limit set on levels for the custom search. 23689 This is a general approach to creating custom searches in Org. To 23690 include all levels, use @samp{LEVEL>0}@footnote{ Note that, for 23691 @code{org-odd-levels-only}, a level number corresponds to order in the 23692 hierarchy, not to the number of stars.}. Then to selectively pick the 23693 matched entries, use @code{org-agenda-skip-function}, which also accepts 23694 Lisp forms, such as @code{org-agenda-skip-entry-if} and 23695 @code{org-agenda-skip-subtree-if}. For example: 23696 23697 @table @asis 23698 @item @samp{(org-agenda-skip-entry-if 'scheduled)} 23699 Skip current entry if it has been scheduled. 23700 23701 @item @samp{(org-agenda-skip-entry-if 'notscheduled)} 23702 Skip current entry if it has not been scheduled. 23703 23704 @item @samp{(org-agenda-skip-entry-if 'deadline)} 23705 Skip current entry if it has a deadline. 23706 23707 @item @samp{(org-agenda-skip-entry-if 'scheduled 'deadline)} 23708 Skip current entry if it has a deadline, or if it is scheduled. 23709 23710 @item @samp{(org-agenda-skip-entry-if 'todo '("TODO" "WAITING"))} 23711 Skip current entry if the TODO keyword is TODO or WAITING@. 23712 23713 @item @samp{(org-agenda-skip-entry-if 'todo 'done)} 23714 Skip current entry if the TODO keyword marks a DONE state. 23715 23716 @item @samp{(org-agenda-skip-entry-if 'timestamp)} 23717 Skip current entry if it has any timestamp, may also be deadline or 23718 scheduled. 23719 23720 @item @samp{(org-agenda-skip-entry-if 'regexp "regular expression")} 23721 Skip current entry if the regular expression matches in the entry. 23722 23723 @item @samp{(org-agenda-skip-entry-if 'notregexp "regular expression")} 23724 Skip current entry unless the regular expression matches. 23725 23726 @item @samp{(org-agenda-skip-subtree-if 'regexp "regular expression")} 23727 Same as above, but check and skip the entire subtree. 23728 @end table 23729 23730 The following is an example of a search for @samp{waiting} without the 23731 special function: 23732 23733 @lisp 23734 (org-add-agenda-custom-command 23735 '("b" todo "PROJECT" 23736 ((org-agenda-skip-function '(org-agenda-skip-subtree-if 23737 'regexp ":waiting:")) 23738 (org-agenda-overriding-header "Projects waiting for something: ")))) 23739 @end lisp 23740 23741 @node Speeding Up Your Agendas 23742 @appendixsec Speeding Up Your Agendas 23743 23744 @cindex agenda views, optimization 23745 23746 Some agenda commands slow down when the Org files grow in size or 23747 number. Here are tips to speed up: 23748 23749 @itemize 23750 @item 23751 Reduce the number of Org agenda files to avoid slowdowns due to hard drive 23752 accesses. 23753 23754 @item 23755 Reduce the number of DONE and archived headlines so agenda 23756 operations that skip over these can finish faster. 23757 23758 @item 23759 Do not dim blocked tasks: 23760 @vindex org-agenda-dim-blocked-tasks 23761 23762 @lisp 23763 (setq org-agenda-dim-blocked-tasks nil) 23764 @end lisp 23765 23766 @item 23767 Stop preparing agenda buffers on startup: 23768 @vindex org-startup-folded 23769 @vindex org-agenda-inhibit-startup 23770 23771 @lisp 23772 (setq org-agenda-inhibit-startup t) 23773 @end lisp 23774 23775 @item 23776 Disable tag inheritance for agendas: 23777 @vindex org-agenda-show-inherited-tags 23778 @vindex org-agenda-use-tag-inheritance 23779 23780 @lisp 23781 (setq org-agenda-use-tag-inheritance nil) 23782 @end lisp 23783 23784 @vindex org-agenda-ignore-properties 23785 @item 23786 Disable parsing of some properties: 23787 23788 @lisp 23789 (setq org-agenda-ignore-properties '(stats)) 23790 @end lisp 23791 23792 This will disable parsing and updating statistic cookies. 23793 @end itemize 23794 23795 These options can be applied to selected agenda views. For more 23796 details about generation of agenda views, see the docstrings for the 23797 relevant variables, and this @uref{https://orgmode.org/worg/agenda-optimization.html, dedicated Worg page} for agenda 23798 optimization. 23799 23800 @node Extracting Agenda Information 23801 @appendixsec Extracting Agenda Information 23802 23803 @cindex agenda, pipe 23804 @cindex scripts, for agenda processing 23805 23806 Org provides commands to access agendas through Emacs batch mode. 23807 Through this command-line interface, agendas are automated for further 23808 processing or printing. 23809 23810 @vindex org-agenda-custom-commands 23811 @findex org-batch-agenda 23812 @code{org-batch-agenda} creates an agenda view in ASCII and outputs to 23813 standard output. This command takes one string parameter. When 23814 string consists of a single character, Org uses it as a key to 23815 @code{org-agenda-custom-commands}. These are the same ones available 23816 through the agenda dispatcher (see @ref{Agenda Dispatcher}). 23817 23818 This example command line directly prints the TODO list to the printer: 23819 23820 @example 23821 emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr 23822 @end example 23823 23824 23825 When the string parameter length is two or more characters, Org 23826 matches it with tags/TODO strings. For example, this example command 23827 line prints items tagged with @samp{shop}, but excludes items tagged with 23828 @samp{NewYork}: 23829 23830 @example 23831 emacs -batch -l ~/.emacs \ 23832 -eval '(org-batch-agenda "+shop-NewYork")' | lpr 23833 @end example 23834 23835 @noindent 23836 An example showing on-the-fly parameter modifications: 23837 23838 @example 23839 emacs -batch -l ~/.emacs \ 23840 -eval '(org-batch-agenda "a" \ 23841 org-agenda-span (quote month) \ 23842 org-agenda-include-diary nil \ 23843 org-agenda-files (quote ("~/org/project.org")))' \ 23844 | lpr 23845 @end example 23846 23847 @noindent 23848 which produces an agenda for the next 30 days from just the 23849 @samp{~/org/projects.org} file. 23850 23851 @findex org-batch-agenda-csv 23852 For structured processing of agenda output, use @code{org-batch-agenda-csv} 23853 with the following fields: 23854 23855 @table @asis 23856 @item category 23857 The category of the item 23858 @item head 23859 The headline, without TODO keyword, TAGS and PRIORITY 23860 @item type 23861 The type of the agenda entry, can be 23862 23863 @multitable {aaaaaaaaaaaaaaaaaaa} {aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} 23864 @item @code{todo} 23865 @tab selected in TODO match 23866 @item @code{tagsmatch} 23867 @tab selected in tags match 23868 @item @code{diary} 23869 @tab imported from diary 23870 @item @code{deadline} 23871 @tab a deadline 23872 @item @code{scheduled} 23873 @tab scheduled 23874 @item @code{timestamp} 23875 @tab appointment, selected by timestamp 23876 @item @code{closed} 23877 @tab entry was closed on date 23878 @item @code{upcoming-deadline} 23879 @tab warning about nearing deadline 23880 @item @code{past-scheduled} 23881 @tab forwarded scheduled item 23882 @item @code{block} 23883 @tab entry has date block including date 23884 @end multitable 23885 23886 @item todo 23887 The TODO keyword, if any 23888 @item tags 23889 All tags including inherited ones, separated by colons 23890 @item date 23891 The relevant date, like @samp{2007-2-14} 23892 @item time 23893 The time, like @samp{15:00-16:50} 23894 @item extra 23895 String with extra planning info 23896 @item priority-l 23897 The priority letter if any was given 23898 @item priority-n 23899 The computed numerical priority 23900 @end table 23901 23902 If the selection of the agenda item was based on a timestamp, 23903 including those items with @samp{DEADLINE} and @samp{SCHEDULED} keywords, then 23904 Org includes date and time in the output. 23905 23906 If the selection of the agenda item was based on a timestamp (or 23907 deadline/scheduled), then Org includes date and time in the output. 23908 23909 Here is an example of a post-processing script in Perl. It takes the 23910 CSV output from Emacs and prints with a checkbox: 23911 23912 @example 23913 #!/usr/bin/perl 23914 23915 # define the Emacs command to run 23916 $cmd = "emacs -batch -l ~/.emacs -eval '(org-batch-agenda-csv \"t\")'"; 23917 23918 # run it and capture the output 23919 $agenda = qx@{$cmd 2>/dev/null@}; 23920 23921 # loop over all lines 23922 foreach $line (split(/\n/,$agenda)) @{ 23923 # get the individual values 23924 ($category,$head,$type,$todo,$tags,$date,$time,$extra, 23925 $priority_l,$priority_n) = split(/,/,$line); 23926 # process and print 23927 print "[ ] $head\n"; 23928 @} 23929 @end example 23930 23931 @node Using the Property API 23932 @appendixsec Using the Property API 23933 23934 @cindex API, for properties 23935 @cindex properties, API 23936 23937 Here is a description of the functions that can be used to work with 23938 properties. 23939 23940 @defun org-entry-properties &optional pom which 23941 Get all properties of the entry at point-or-marker @var{POM}. 23942 This includes the TODO keyword, the tags, time strings for deadline, 23943 scheduled, and clocking, and any additional properties defined in the 23944 entry. The return value is an alist. Keys may occur multiple times 23945 if the property key was used several times. @var{POM} may also 23946 be @code{nil}, in which case the current entry is used. If 23947 @var{WHICH} is @code{nil} or @code{all}, get all properties. If 23948 @var{WHICH} is @code{special} or @code{standard}, only get that subclass. 23949 @end defun 23950 23951 @vindex org-use-property-inheritance 23952 @findex org-insert-property-drawer 23953 @defun org-entry-get pom property &optional inherit 23954 Get value of @var{PROPERTY} for entry at point-or-marker 23955 @var{POM}. By default, this only looks at properties defined 23956 locally in the entry. If @var{INHERIT} is non-@code{nil} and the 23957 entry does not have the property, then also check higher levels of the 23958 hierarchy. If @var{INHERIT} is the symbol @code{selective}, use 23959 inheritance if and only if the setting of 23960 @code{org-use-property-inheritance} selects @var{PROPERTY} for 23961 inheritance. 23962 @end defun 23963 23964 @defun org-entry-delete pom property 23965 Delete the property @var{PROPERTY} from entry at point-or-marker 23966 @var{POM}. 23967 @end defun 23968 23969 @defun org-entry-put pom property value 23970 Set @var{PROPERTY} to @var{VALUES} for entry at 23971 point-or-marker POM@. 23972 @end defun 23973 23974 @defun org-buffer-property-keys &optional include-specials 23975 Get all property keys in the current buffer. 23976 @end defun 23977 23978 @defun org-insert-property-drawer 23979 Insert a property drawer for the current entry. 23980 @end defun 23981 23982 @defun org-entry-put-multivalued-property pom property &rest values 23983 Set @var{PROPERTY} at point-or-marker @var{POM} to 23984 @var{VALUES}. @var{VALUES} should be a list of strings. 23985 They are concatenated, with spaces as separators. 23986 @end defun 23987 23988 @defun org-entry-get-multivalued-property pom property 23989 Treat the value of the property @var{PROPERTY} as 23990 a whitespace-separated list of values and return the values as a list 23991 of strings. 23992 @end defun 23993 23994 @defun org-entry-add-to-multivalued-property pom property value 23995 Treat the value of the property @var{PROPERTY} as 23996 a whitespace-separated list of values and make sure that 23997 @var{VALUE} is in this list. 23998 @end defun 23999 24000 @defun org-entry-remove-from-multivalued-property pom property value 24001 Treat the value of the property @var{PROPERTY} as 24002 a whitespace-separated list of values and make sure that 24003 @var{VALUE} is @emph{not} in this list. 24004 @end defun 24005 24006 @defun org-entry-member-in-multivalued-property pom property value 24007 Treat the value of the property @var{PROPERTY} as 24008 a whitespace-separated list of values and check if @var{VALUE} is 24009 in this list. 24010 @end defun 24011 24012 @defopt org-property-allowed-value-functions 24013 Hook for functions supplying allowed values for a specific property. 24014 The functions must take a single argument, the name of the property, 24015 and return a flat list of allowed values. If @samp{:ETC} is one of the 24016 values, use the values as completion help, but allow also other values 24017 to be entered. The functions must return @code{nil} if they are not 24018 responsible for this property. 24019 @end defopt 24020 24021 @node Using the Mapping API 24022 @appendixsec Using the Mapping API 24023 24024 @cindex API, for mapping 24025 @cindex mapping entries, API 24026 24027 Org has sophisticated mapping capabilities to find all entries 24028 satisfying certain criteria. Internally, this functionality is used 24029 to produce agenda views, but there is also an API that can be used to 24030 execute arbitrary functions for each or selected entries. The main 24031 entry point for this API is: 24032 24033 @defun org-map-entries func &optional match scope &rest skip 24034 Call @var{FUNC} at each headline selected by @var{MATCH} in 24035 @var{SCOPE}. 24036 24037 @var{FUNC} is a function or a Lisp form. With point positioned 24038 at the beginning of the headline, call the function without arguments. 24039 Org returns a list of return values of calls to the function. 24040 24041 To avoid preserving point, Org wraps the call to @var{FUNC} in 24042 @code{save-excursion} form. After evaluation, Org moves point to the end 24043 of the line that was just processed. Search continues from that point 24044 forward. This may not always work as expected under some conditions, 24045 such as if the current subtree was removed by a previous archiving 24046 operation. In such rare circumstances, Org skips the next entry 24047 entirely when it should not. To stop Org from such skips, make 24048 @var{FUNC} set the variable @code{org-map-continue-from} to a specific 24049 buffer position. 24050 24051 @var{MATCH} is a tags/property/TODO match. Org iterates only 24052 matched headlines. Org iterates over all headlines when 24053 @var{MATCH} is @code{nil} or @code{t}. 24054 24055 @var{SCOPE} determines the scope of this command. It can be any 24056 of: 24057 24058 @table @asis 24059 @item @code{nil} 24060 The current buffer, respecting the restriction, if any. 24061 24062 @item @code{tree} 24063 The subtree started with the entry at point. 24064 24065 @item @code{region} 24066 The entries within the active region, if any. 24067 24068 @item @code{file} 24069 The current buffer, without restriction. 24070 24071 @item @code{file-with-archives} 24072 The current buffer, and any archives associated with it. 24073 24074 @item @code{agenda} 24075 All agenda files. 24076 24077 @item @code{agenda-with-archives} 24078 All agenda files with any archive files associated with them. 24079 24080 @item list of filenames 24081 If this is a list, all files in the list are scanned. 24082 @end table 24083 24084 @noindent 24085 The remaining arguments are treated as settings for the scanner's 24086 skipping facilities. Valid arguments are: 24087 24088 @table @asis 24089 @item @code{archive} 24090 Skip trees with the @samp{ARCHIVE} tag. 24091 24092 @item @code{comment} 24093 Skip trees with the COMMENT keyword. 24094 24095 @item function or Lisp form 24096 @vindex org-agenda-skip-function 24097 Used as value for @code{org-agenda-skip-function}, so whenever the 24098 function returns @code{t}, @var{FUNC} is called for that entry and 24099 search continues from the point where the function leaves it. 24100 @end table 24101 @end defun 24102 24103 The mapping routine can call any arbitrary function, even functions 24104 that change meta data or query the property API (see @ref{Using the Property API}). Here are some handy functions: 24105 24106 @defun org-todo &optional arg 24107 Change the TODO state of the entry. See the docstring of the 24108 functions for the many possible values for the argument 24109 @var{ARG}. 24110 @end defun 24111 24112 @defun org-priority &optional action 24113 Change the priority of the entry. See the docstring of this function 24114 for the possible values for @var{ACTION}. 24115 @end defun 24116 24117 @defun org-toggle-tag tag &optional onoff 24118 Toggle the tag @var{TAG} in the current entry. Setting 24119 @var{ONOFF} to either @code{on} or @code{off} does not toggle tag, but 24120 ensure that it is either on or off. 24121 @end defun 24122 24123 @defun org-promote 24124 Promote the current entry. 24125 @end defun 24126 24127 @defun org-demote 24128 Demote the current entry. 24129 @end defun 24130 24131 This example turns all entries tagged with @samp{TOMORROW} into TODO 24132 entries with keyword @samp{UPCOMING}. Org ignores entries in comment trees 24133 and archive trees. 24134 24135 @lisp 24136 (org-map-entries '(org-todo "UPCOMING") 24137 "+TOMORROW" 'file 'archive 'comment) 24138 @end lisp 24139 24140 The following example counts the number of entries with TODO keyword 24141 @samp{WAITING}, in all agenda files. 24142 24143 @lisp 24144 (length (org-map-entries t "/+WAITING" 'agenda)) 24145 @end lisp 24146 24147 @node History and Acknowledgments 24148 @appendix History and Acknowledgments 24149 24150 @anchor{From Carsten} 24151 @appendixsec From Carsten 24152 24153 Org was born in 2003, out of frustration over the user interface of 24154 the Emacs Outline mode. I was trying to organize my notes and 24155 projects, and using Emacs seemed to be the natural way to go. 24156 However, having to remember eleven different commands with two or 24157 three keys per command, only to hide and show parts of the outline 24158 tree, that seemed entirely unacceptable to me. Also, when using 24159 outlines to take notes, I constantly wanted to restructure the tree, 24160 organizing it parallel to my thoughts and plans. @emph{Visibility cycling} 24161 and @emph{structure editing} were originally implemented in the package 24162 @samp{outline-magic.el}, but quickly moved to the more general @samp{org.el}. 24163 As this environment became comfortable for project planning, the next 24164 step was adding @emph{TODO entries}, basic @emph{timestamps}, and @emph{table 24165 support}. These areas highlighted the two main goals that Org still 24166 has today: to be a new, outline-based, plain text mode with innovative 24167 and intuitive editing features, and to incorporate project planning 24168 functionality directly into a notes file. 24169 24170 Since the first release, literally thousands of emails to me or to the 24171 @email{mailto:emacs-orgmode@@gnu.org, mailing list} have provided a constant stream of bug reports, feedback, 24172 new ideas, and sometimes patches and add-on code. Many thanks to 24173 everyone who has helped to improve this package. I am trying to keep 24174 here a list of the people who had significant influence in shaping one 24175 or more aspects of Org. The list may not be complete, if I have 24176 forgotten someone, please accept my apologies and let me know. 24177 24178 Before I get to this list, a few special mentions are in order: 24179 24180 @table @asis 24181 @item Bastien Guerry 24182 Bastien has written a large number of extensions to Org (most of 24183 them integrated into the core by now), including the @LaTeX{} exporter 24184 and the plain list parser. His support during the early days was 24185 central to the success of this project. Bastien also invented Worg, 24186 helped establishing the Web presence of Org, and sponsored hosting 24187 costs for the orgmode.org website. Bastien stepped in as maintainer 24188 of Org between 2011 and 2013, at a time when I desperately needed 24189 a break. 24190 24191 @item Eric Schulte and Dan Davison 24192 Eric and Dan are jointly responsible for the Org Babel system, which 24193 turns Org into a multi-language environment for evaluating code and 24194 doing literate programming and reproducible research. This has 24195 become one of Org's killer features that define what Org is today. 24196 24197 @item John Wiegley 24198 John has contributed a number of great ideas and patches directly to 24199 Org, including the attachment system (@samp{org-attach.el}), integration 24200 with Apple Mail (@samp{org-mac-message.el}), hierarchical dependencies of 24201 TODO items, habit tracking (@samp{org-habits.el}), and encryption 24202 (@samp{org-crypt.el}). Also, the capture system is really an extended 24203 copy of his great @samp{remember.el}. 24204 24205 @item Sebastian Rose 24206 Without Sebastian, the HTML/XHTML publishing of Org would be the 24207 pitiful work of an ignorant amateur. Sebastian has pushed this part 24208 of Org onto a much higher level. He also wrote @samp{org-info.js}, 24209 a JavaScript program for displaying webpages derived from Org using 24210 an Info-like or a folding interface with single-key navigation. 24211 @end table 24212 24213 See below for the full list of contributions! Again, please let me 24214 know what I am missing here! 24215 24216 @anchor{From Bastien} 24217 @appendixsec From Bastien 24218 24219 I (Bastien) have been maintaining Org between 2011 and 2013. This 24220 appendix would not be complete without adding a few more 24221 acknowledgments and thanks. 24222 24223 I am first grateful to Carsten for his trust while handing me over the 24224 maintainership of Org. His unremitting support is what really helped 24225 me getting more confident over time, with both the community and the 24226 code. 24227 24228 When I took over maintainership, I knew I would have to make Org more 24229 collaborative than ever, as I would have to rely on people that are 24230 more knowledgeable than I am on many parts of the code. Here is 24231 a list of the persons I could rely on, they should really be 24232 considered co-maintainers, either of the code or the community: 24233 24234 @table @asis 24235 @item Eric Schulte 24236 Eric is maintaining the Babel parts of Org. His reactivity here 24237 kept me away from worrying about possible bugs here and let me focus 24238 on other parts. 24239 24240 @item Nicolas Goaziou 24241 Nicolas is maintaining the consistency of the deepest parts of Org. 24242 His work on @samp{org-element.el} and @samp{ox.el} has been outstanding, and 24243 it opened the doors for many new ideas and features. He rewrote 24244 many of the old exporters to use the new export engine, and helped 24245 with documenting this major change. More importantly (if that's 24246 possible), he has been more than reliable during all the work done 24247 for Org 8.0, and always very reactive on the mailing list. 24248 24249 @item Achim Gratz 24250 Achim rewrote the building process of Org, turning some @emph{ad hoc} 24251 tools into a flexible and conceptually clean process. He patiently 24252 coped with the many hiccups that such a change can create for users. 24253 24254 @item Nick Dokos 24255 The Org mode mailing list would not be such a nice place without 24256 Nick, who patiently helped users so many times. It is impossible to 24257 overestimate such a great help, and the list would not be so active 24258 without him. 24259 @end table 24260 24261 I received support from so many users that it is clearly impossible to 24262 be fair when shortlisting a few of them, but Org's history would not 24263 be complete if the ones above were not mentioned in this manual. 24264 24265 @anchor{List of Contributions} 24266 @appendixsec List of Contributions 24267 24268 @itemize 24269 @item 24270 Russell Adams came up with the idea for drawers. 24271 24272 @item 24273 Thomas Baumann wrote @samp{ol-bbdb.el} and @samp{ol-mhe.el}. 24274 24275 @item 24276 Christophe Bataillon created the great unicorn logo that we use on 24277 the Org mode website. 24278 24279 @item 24280 Alex Bochannek provided a patch for rounding timestamps. 24281 24282 @item 24283 Jan Böcker wrote @samp{ol-docview.el}. 24284 24285 @item 24286 Brad Bozarth showed how to pull RSS feed data into Org files. 24287 24288 @item 24289 Tom Breton wrote @samp{org-choose.el}. 24290 24291 @item 24292 Charles Cave's suggestion sparked the implementation of templates 24293 for Remember, which are now templates for capture. 24294 24295 @item 24296 Timothy E Chapman worked on a complete overhaul of the orgmode.org 24297 website in 2020 and helped fixing various bugs. 24298 24299 @item 24300 Pavel Chalmoviansky influenced the agenda treatment of items with 24301 specified time. 24302 24303 @item 24304 Gregory Chernov patched support for Lisp forms into table 24305 calculations and improved XEmacs compatibility, in particular by 24306 porting @samp{nouline.el} to XEmacs. 24307 24308 @item 24309 Sacha Chua suggested copying some linking code from Planner. 24310 24311 @item 24312 Baoqiu Cui contributed the DocBook exporter. 24313 24314 @item 24315 Eddward DeVilla proposed and tested checkbox statistics. He also 24316 came up with the idea of properties, and that there should be an API 24317 for them. 24318 24319 @item 24320 Nick Dokos tracked down several nasty bugs. 24321 24322 @item 24323 Kees Dullemond used to edit projects lists directly in HTML and so 24324 inspired some of the early development, including HTML export. He 24325 also asked for a way to narrow wide table columns. 24326 24327 @item 24328 Thomas@tie{}S@.@tie{}Dye contributed documentation on Worg and helped 24329 integrating the Org Babel documentation into the manual. 24330 24331 @item 24332 Christian Egli converted the documentation into Texinfo format, 24333 inspired the agenda, patched CSS formatting into the HTML exporter, 24334 and wrote @samp{org-taskjuggler.el}. 24335 24336 @item 24337 David Emery provided a patch for custom CSS support in exported HTML 24338 agendas. 24339 24340 @item 24341 Nic Ferrier contributed mailcap and XOXO support. 24342 24343 @item 24344 Miguel@tie{}A@.@tie{}Figueroa-Villanueva implemented hierarchical checkboxes. 24345 24346 @item 24347 John Foerch figured out how to make incremental search show context 24348 around a match in a hidden outline tree. 24349 24350 @item 24351 Raimar Finken wrote @samp{org-git-line.el}. 24352 24353 @item 24354 Mikael Fornius works as a mailing list moderator. 24355 24356 @item 24357 Austin Frank works as a mailing list moderator. 24358 24359 @item 24360 Eric Fraga drove the development of Beamer export with ideas and 24361 testing. 24362 24363 @item 24364 Barry Gidden did proofreading the manual in preparation for the book 24365 publication through Network Theory Ltd. 24366 24367 @item 24368 Niels Giesen had the idea to automatically archive DONE trees. 24369 24370 @item 24371 Nicolas Goaziou rewrote much of the plain list code. 24372 24373 @item 24374 Kai Grossjohann pointed out key-binding conflicts with other 24375 packages. 24376 24377 @item 24378 Brian Gough of Network Theory Ltd publishes the Org mode manual as 24379 a book. 24380 24381 @item 24382 Bernt Hansen has driven much of the support for auto-repeating 24383 tasks, task state change logging, and the clocktable. His clear 24384 explanations have been critical when we started to adopt the Git 24385 version control system. 24386 24387 @item 24388 Manuel Hermenegildo has contributed various ideas, small fixes and 24389 patches. 24390 24391 @item 24392 Phil Jackson wrote @samp{ol-irc.el}. 24393 24394 @item 24395 Scott Jaderholm proposed footnotes, control over whitespace between 24396 folded entries, and column view for properties. 24397 24398 @item 24399 Matt Jones wrote MobileOrg Android. 24400 24401 @item 24402 Tokuya Kameshima wrote @samp{org-wl.el} and @samp{org-mew.el}. 24403 24404 @item 24405 Shidai Liu (``Leo'') asked for embedded @LaTeX{} and tested it. He also 24406 provided frequent feedback and some patches. 24407 24408 @item 24409 Matt Lundin has proposed last-row references for table formulas and 24410 named invisible anchors. He has also worked a lot on the FAQ@. 24411 24412 @item 24413 David Maus wrote @samp{org-atom.el}, maintains the issues file for Org, 24414 and is a prolific contributor on the mailing list with competent 24415 replies, small fixes and patches. 24416 24417 @item 24418 Jason@tie{}F@.@tie{}McBrayer suggested agenda export to CSV format. 24419 24420 @item 24421 Kyle Meyer helped setting up the @uref{https://public-inbox.org/, public-inbox} archive of the @uref{https://orgmode.org/list/, Org 24422 mailing list} and has been fixing many bugs. 24423 24424 @item 24425 Max Mikhanosha came up with the idea of refiling. 24426 24427 @item 24428 Dmitri Minaev sent a patch to set priority limits on a per-file 24429 basis. 24430 24431 @item 24432 Stefan Monnier provided a patch to keep the Emacs Lisp compiler 24433 happy. 24434 24435 @item 24436 Richard Moreland wrote MobileOrg for the iPhone. 24437 24438 @item 24439 Rick Moynihan proposed allowing multiple TODO sequences in a file 24440 and being able to quickly restrict the agenda to a subtree. 24441 24442 @item 24443 Todd Neal provided patches for links to Info files and Elisp forms. 24444 24445 @item 24446 Greg Newman refreshed the unicorn logo into its current form. 24447 24448 @item 24449 Tim O'Callaghan suggested in-file links, search options for general 24450 file links, and tags. 24451 24452 @item 24453 Osamu Okano wrote @samp{orgcard2ref.pl}, a Perl program to create a text 24454 version of the reference card. 24455 24456 @item 24457 Takeshi Okano translated the manual and David O'Toole's tutorial 24458 into Japanese. 24459 24460 @item 24461 Oliver Oppitz suggested multi-state TODO items. 24462 24463 @item 24464 Scott Otterson sparked the introduction of descriptive text for 24465 links, among other things. 24466 24467 @item 24468 Pete Phillips helped during the development of the TAGS feature, 24469 and provided frequent feedback. 24470 24471 @item 24472 Martin Pohlack provided the code snippet to bundle character 24473 insertion into bundles of 20 for undo. 24474 24475 @item 24476 Ihor Radchenko helped with fixing bugs and improving the user 24477 experience regarding Org's speed. 24478 24479 @item 24480 T@.@tie{}V@.@tie{}Raman reported bugs and suggested improvements. 24481 24482 @item 24483 Matthias Rempe (Oelde) provided ideas, Windows support, and quality 24484 control. 24485 24486 @item 24487 Paul Rivier provided the basic implementation of named footnotes. 24488 He also acted as mailing list moderator for some time. 24489 24490 @item 24491 Kevin Rogers contributed code to access VM files on remote hosts. 24492 24493 @item 24494 Frank Ruell solved the mystery of the @samp{keymapp nil} bug, a conflict 24495 with @samp{allout.el}. 24496 24497 @item 24498 Jason Riedy generalized the send-receive mechanism for Orgtbl 24499 tables with extensive patches. 24500 24501 @item 24502 Philip Rooke created the Org reference card, provided lots of 24503 feedback, developed and applied standards to the Org documentation. 24504 24505 @item 24506 Christian Schlauer proposed angular brackets around links, among 24507 other things. 24508 24509 @item 24510 Paul Sexton wrote @samp{org-ctags.el}. 24511 24512 @item 24513 Tom Shannon's @samp{organizer-mode.el} inspired linking to VM/BBDB/Gnus. 24514 24515 @item 24516 Ilya Shlyakhter proposed the Archive Sibling, line numbering in 24517 literal examples, and remote highlighting for referenced code lines. 24518 24519 @item 24520 Stathis Sideris wrote the @samp{ditaa.jar} ASCII to PNG converter that is 24521 now packaged into the @uref{https://git.sr.ht/~bzg/org-contrib, org-contrib} repository. 24522 24523 @item 24524 Daniel Sinder came up with the idea of internal archiving by locking 24525 subtrees. 24526 24527 @item 24528 Dale Smith proposed link abbreviations. 24529 24530 @item 24531 James TD Smith has contributed a large number of patches for 24532 useful tweaks and features. 24533 24534 @item 24535 Adam Spiers asked for global linking commands, inspired the link 24536 extension system, added support for Mairix, and proposed the mapping 24537 API@. 24538 24539 @item 24540 Ulf Stegemann created the table to translate special symbols to 24541 HTML, @LaTeX{}, UTF-8, Latin-1 and ASCII@. 24542 24543 @item 24544 Andy Stewart contributed code to @samp{ol-w3m.el}, to copy 24545 HTML content with links transformation to Org syntax. 24546 24547 @item 24548 David O'Toole wrote @samp{org-publish.el} and drafted the 24549 manual chapter about publishing. 24550 24551 @item 24552 Jambunathan@tie{}K@.@tie{}contributed the ODT exporter. 24553 24554 @item 24555 Sebastien Vauban reported many issues with @LaTeX{} and Beamer export 24556 and enabled source code highlighting in Gnus. 24557 24558 @item 24559 Stefan Vollmar organized a video-recorded talk at the 24560 Max-Planck-Institute for Neurology. He also inspired the creation 24561 of a concept index for HTML export. 24562 24563 @item 24564 Jürgen Vollmer contributed code generating the table of contents in 24565 HTML output. 24566 24567 @item 24568 Samuel Wales has provided important feedback and bug reports. 24569 24570 @item 24571 Chris Wallace provided a patch implementing the @samp{QUOTE} block. 24572 24573 @item 24574 David Wainberg suggested archiving, and improvements to the 24575 linking system. 24576 24577 @item 24578 Carsten Wimmer suggested some changes and helped fix a bug in 24579 linking to Gnus. 24580 24581 @item 24582 Roland Winkler requested additional key bindings to make Org work on 24583 a TTY@. 24584 24585 @item 24586 Piotr Zielinski wrote @samp{org-mouse.el}, proposed agenda 24587 blocks and contributed various ideas and code snippets. 24588 24589 @item 24590 Marco Wahl wrote @samp{ol-eww.el}. 24591 @end itemize 24592 24593 @node GNU Free Documentation License 24594 @appendix GNU Free Documentation License 24595 24596 @center Version 1.3, 3 November 2008 24597 24598 @display 24599 Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. 24600 @uref{https://fsf.org/} 24601 24602 Everyone is permitted to copy and distribute verbatim copies 24603 of this license document, but changing it is not allowed. 24604 @end display 24605 24606 @enumerate 0 24607 @item 24608 PREAMBLE 24609 24610 The purpose of this License is to make a manual, textbook, or other 24611 functional and useful document @dfn{free} 24612 in the sense of freedom: to assure everyone the effective freedom 24613 to copy and redistribute it, with or without modifying it, either 24614 commercially or noncommercially. Secondarily, this License 24615 preserves for the author and publisher a way to get credit for 24616 their work, while not being considered responsible for 24617 modifications made by others. 24618 24619 This License is a kind of ``copyleft'', which means that derivative 24620 works of the document must themselves be free in the same sense. 24621 It complements the GNU General Public License, which is a copyleft 24622 license designed for free software. 24623 24624 We have designed this License in order to use it for manuals for 24625 free software, because free software needs free documentation: 24626 a free program should come with manuals providing the same freedoms 24627 that the software does. But this License is not limited to 24628 software manuals; it can be used for any textual work, regardless 24629 of subject matter or whether it is published as a printed book. We 24630 recommend this License principally for works whose purpose is 24631 instruction or reference. 24632 24633 @item 24634 APPLICABILITY AND DEFINITIONS 24635 24636 This License applies to any manual or other work, in any medium, 24637 that contains a notice placed by the copyright holder saying it can 24638 be distributed under the terms of this License. Such a notice 24639 grants a world-wide, royalty-free license, unlimited in duration, 24640 to use that work under the conditions stated herein. The 24641 ``Document'', below, refers to any such manual or work. Any member 24642 of the public is a licensee, and is addressed as ``you''. You accept 24643 the license if you copy, modify or distribute the work in a way 24644 requiring permission under copyright law. 24645 24646 A ``Modified Version'' of the Document means any work containing the 24647 Document or a portion of it, either copied verbatim, or with 24648 modifications and/or translated into another language. 24649 24650 A ``Secondary Section'' is a named appendix or a front-matter section 24651 of the Document that deals exclusively with the relationship of the 24652 publishers or authors of the Document to the Document's overall 24653 subject (or to related matters) and contains nothing that could 24654 fall directly within that overall subject. (Thus, if the Document 24655 is in part a textbook of mathematics, a Secondary Section may not 24656 explain any mathematics.) The relationship could be a matter of 24657 historical connection with the subject or with related matters, or 24658 of legal, commercial, philosophical, ethical or political position 24659 regarding them. 24660 24661 The ``Invariant Sections'' are certain Secondary Sections whose 24662 titles are designated, as being those of Invariant Sections, in the 24663 notice that says that the Document is released under this License. 24664 If a section does not fit the above definition of Secondary then it 24665 is not allowed to be designated as Invariant. The Document may 24666 contain zero Invariant Sections. If the Document does not identify 24667 any Invariant Sections then there are none. 24668 24669 The ``Cover Texts'' are certain short passages of text that are 24670 listed, as Front-Cover Texts or Back-Cover Texts, in the notice 24671 that says that the Document is released under this License. 24672 A Front-Cover Text may be at most 5 words, and a Back-Cover Text 24673 may be at most 25 words. 24674 24675 A ``Transparent'' copy of the Document means a machine-readable copy, 24676 represented in a format whose specification is available to the 24677 general public, that is suitable for revising the document 24678 straightforwardly with generic text editors or (for images composed 24679 of pixels) generic paint programs or (for drawings) some widely 24680 available drawing editor, and that is suitable for input to text 24681 formatters or for automatic translation to a variety of formats 24682 suitable for input to text formatters. A copy made in an otherwise 24683 Transparent file format whose markup, or absence of markup, has 24684 been arranged to thwart or discourage subsequent modification by 24685 readers is not Transparent. An image format is not Transparent if 24686 used for any substantial amount of text. A copy that is not 24687 ``Transparent'' is called ``Opaque''. 24688 24689 Examples of suitable formats for Transparent copies include plain 24690 ASCII without markup, Texinfo input format, @LaTeX{} input format, 24691 SGML or XML using a publicly available DTD, and standard-conforming 24692 simple HTML, PostScript or PDF designed for human modification. 24693 Examples of transparent image formats include PNG, XCF and JPG@. 24694 Opaque formats include proprietary formats that can be read and 24695 edited only by proprietary word processors, SGML or XML for which 24696 the DTD and/or processing tools are not generally available, and 24697 the machine-generated HTML, PostScript or PDF produced by some word 24698 processors for output purposes only. 24699 24700 The ``Title Page'' means, for a printed book, the title page itself, 24701 plus such following pages as are needed to hold, legibly, the 24702 material this License requires to appear in the title page. For 24703 works in formats which do not have any title page as such, ``Title 24704 Page'' means the text near the most prominent appearance of the 24705 work's title, preceding the beginning of the body of the text. 24706 24707 The ``publisher'' means any person or entity that distributes copies 24708 of the Document to the public. 24709 24710 A section ``Entitled XYZ'' means a named subunit of the Document 24711 whose title either is precisely XYZ or contains XYZ in parentheses 24712 following text that translates XYZ in another language. (Here XYZ 24713 stands for a specific section name mentioned below, such as 24714 ``Acknowledgements'', ``Dedications'', ``Endorsements'', or ``History''.) 24715 To ``Preserve the Title'' of such a section when you modify the 24716 Document means that it remains a section ``Entitled XYZ'' according 24717 to this definition. 24718 24719 The Document may include Warranty Disclaimers next to the notice 24720 which states that this License applies to the Document. These 24721 Warranty Disclaimers are considered to be included by reference in 24722 this License, but only as regards disclaiming warranties: any other 24723 implication that these Warranty Disclaimers may have is void and 24724 has no effect on the meaning of this License. 24725 24726 @item 24727 VERBATIM COPYING 24728 24729 You may copy and distribute the Document in any medium, either 24730 commercially or noncommercially, provided that this License, the 24731 copyright notices, and the license notice saying this License 24732 applies to the Document are reproduced in all copies, and that you 24733 add no other conditions whatsoever to those of this License. You 24734 may not use technical measures to obstruct or control the reading 24735 or further copying of the copies you make or distribute. However, 24736 you may accept compensation in exchange for copies. If you 24737 distribute a large enough number of copies you must also follow the 24738 conditions in section 3. 24739 24740 You may also lend copies, under the same conditions stated above, 24741 and you may publicly display copies. 24742 24743 @item 24744 COPYING IN QUANTITY 24745 24746 If you publish printed copies (or copies in media that commonly 24747 have printed covers) of the Document, numbering more than 100, and 24748 the Document's license notice requires Cover Texts, you must 24749 enclose the copies in covers that carry, clearly and legibly, all 24750 these Cover Texts: Front-Cover Texts on the front cover, and 24751 Back-Cover Texts on the back cover. Both covers must also clearly 24752 and legibly identify you as the publisher of these copies. The 24753 front cover must present the full title with all words of the title 24754 equally prominent and visible. You may add other material on the 24755 covers in addition. Copying with changes limited to the covers, as 24756 long as they preserve the title of the Document and satisfy these 24757 conditions, can be treated as verbatim copying in other respects. 24758 24759 If the required texts for either cover are too voluminous to fit 24760 legibly, you should put the first ones listed (as many as fit 24761 reasonably) on the actual cover, and continue the rest onto 24762 adjacent pages. 24763 24764 If you publish or distribute Opaque copies of the Document 24765 numbering more than 100, you must either include a machine-readable 24766 Transparent copy along with each Opaque copy, or state in or with 24767 each Opaque copy a computer-network location from which the general 24768 network-using public has access to download using public-standard 24769 network protocols a complete Transparent copy of the Document, free 24770 of added material. If you use the latter option, you must take 24771 reasonably prudent steps, when you begin distribution of Opaque 24772 copies in quantity, to ensure that this Transparent copy will 24773 remain thus accessible at the stated location until at least one 24774 year after the last time you distribute an Opaque copy (directly or 24775 through your agents or retailers) of that edition to the public. 24776 24777 It is requested, but not required, that you contact the authors of 24778 the Document well before redistributing any large number of copies, 24779 to give them a chance to provide you with an updated version of the 24780 Document. 24781 24782 @item 24783 MODIFICATIONS 24784 24785 You may copy and distribute a Modified Version of the Document 24786 under the conditions of sections 2 and 3 above, provided that you 24787 release the Modified Version under precisely this License, with the 24788 Modified Version filling the role of the Document, thus licensing 24789 distribution and modification of the Modified Version to whoever 24790 possesses a copy of it. In addition, you must do these things in 24791 the Modified Version: 24792 24793 @enumerate A 24794 @item 24795 Use in the Title Page (and on the covers, if any) a title 24796 distinct from that of the Document, and from those of previous 24797 versions (which should, if there were any, be listed in the 24798 History section of the Document). You may use the same title as 24799 a previous version if the original publisher of that version 24800 gives permission. 24801 24802 @item 24803 List on the Title Page, as authors, one or more persons or 24804 entities responsible for authorship of the modifications in the 24805 Modified Version, together with at least five of the principal 24806 authors of the Document (all of its principal authors, if it has 24807 fewer than five), unless they release you from this requirement. 24808 24809 @item 24810 State on the Title page the name of the publisher of the 24811 Modified Version, as the publisher. 24812 24813 @item 24814 Preserve all the copyright notices of the Document. 24815 24816 @item 24817 Add an appropriate copyright notice for your modifications 24818 adjacent to the other copyright notices. 24819 24820 @item 24821 Include, immediately after the copyright notices, a license 24822 notice giving the public permission to use the Modified Version 24823 under the terms of this License, in the form shown in the 24824 Addendum below. 24825 24826 @item 24827 Preserve in that license notice the full lists of Invariant 24828 Sections and required Cover Texts given in the Document's 24829 license notice. 24830 24831 @item 24832 Include an unaltered copy of this License. 24833 24834 @item 24835 Preserve the section Entitled ``History'', Preserve its Title, and 24836 add to it an item stating at least the title, year, new authors, 24837 and publisher of the Modified Version as given on the Title 24838 Page. If there is no section Entitled ``History'' in the Document, 24839 create one stating the title, year, authors, and publisher of 24840 the Document as given on its Title Page, then add an item 24841 describing the Modified Version as stated in the previous 24842 sentence. 24843 24844 @item 24845 Preserve the network location, if any, given in the Document 24846 for public access to a Transparent copy of the Document, and 24847 likewise the network locations given in the Document for 24848 previous versions it was based on. These may be placed in the 24849 ``History'' section. You may omit a network location for a work 24850 that was published at least four years before the Document 24851 itself, or if the original publisher of the version it refers 24852 to gives permission. 24853 24854 @item 24855 For any section Entitled ``Acknowledgements'' or ``Dedications'', 24856 Preserve the Title of the section, and preserve in the section 24857 all the substance and tone of each of the contributor 24858 acknowledgements and/or dedications given therein. 24859 24860 @item 24861 Preserve all the Invariant Sections of the Document, unaltered 24862 in their text and in their titles. Section numbers or the 24863 equivalent are not considered part of the section titles. 24864 24865 @item 24866 Delete any section Entitled ``Endorsements''. Such a section may 24867 not be included in the Modified Version. 24868 24869 @item 24870 Do not retitle any existing section to be Entitled 24871 ``Endorsements'' or to conflict in title with any Invariant 24872 Section. 24873 24874 @item 24875 Preserve any Warranty Disclaimers. 24876 @end enumerate 24877 24878 If the Modified Version includes new front-matter sections or 24879 appendices that qualify as Secondary Sections and contain no material 24880 copied from the Document, you may at your option designate some or all 24881 of these sections as invariant. To do this, add their titles to the 24882 list of Invariant Sections in the Modified Version's license notice. 24883 These titles must be distinct from any other section titles. 24884 24885 You may add a section Entitled ``Endorsements'', provided it contains 24886 nothing but endorsements of your Modified Version by various 24887 parties---for example, statements of peer review or that the text has 24888 been approved by an organization as the authoritative definition of a 24889 standard. 24890 24891 You may add a passage of up to five words as a Front-Cover Text, and a 24892 passage of up to 25 words as a Back-Cover Text, to the end of the list 24893 of Cover Texts in the Modified Version. Only one passage of 24894 Front-Cover Text and one of Back-Cover Text may be added by (or 24895 through arrangements made by) any one entity. If the Document already 24896 includes a cover text for the same cover, previously added by you or 24897 by arrangement made by the same entity you are acting on behalf of, 24898 you may not add another; but you may replace the old one, on explicit 24899 permission from the previous publisher that added the old one. 24900 24901 The author(s) and publisher(s) of the Document do not by this License 24902 give permission to use their names for publicity for or to assert or 24903 imply endorsement of any Modified Version. 24904 24905 @item 24906 COMBINING DOCUMENTS 24907 24908 You may combine the Document with other documents released under 24909 this License, under the terms defined in section 4 above for 24910 modified versions, provided that you include in the combination all 24911 of the Invariant Sections of all of the original documents, 24912 unmodified, and list them all as Invariant Sections of your 24913 combined work in its license notice, and that you preserve all 24914 their Warranty Disclaimers. 24915 24916 The combined work need only contain one copy of this License, and 24917 multiple identical Invariant Sections may be replaced with a single 24918 copy. If there are multiple Invariant Sections with the same name 24919 but different contents, make the title of each such section unique 24920 by adding at the end of it, in parentheses, the name of the 24921 original author or publisher of that section if known, or else 24922 a unique number. Make the same adjustment to the section titles in 24923 the list of Invariant Sections in the license notice of the 24924 combined work. 24925 24926 In the combination, you must combine any sections Entitled 24927 ``History'' in the various original documents, forming one section 24928 Entitled ``History''; likewise combine any sections Entitled 24929 ``Acknowledgements'', and any sections Entitled ``Dedications''. You 24930 must delete all sections Entitled ``Endorsements.'' 24931 24932 @item 24933 COLLECTIONS OF DOCUMENTS 24934 24935 You may make a collection consisting of the Document and other 24936 documents released under this License, and replace the individual 24937 copies of this License in the various documents with a single copy 24938 that is included in the collection, provided that you follow the 24939 rules of this License for verbatim copying of each of the documents 24940 in all other respects. 24941 24942 You may extract a single document from such a collection, and 24943 distribute it individually under this License, provided you insert 24944 a copy of this License into the extracted document, and follow this 24945 License in all other respects regarding verbatim copying of that 24946 document. 24947 24948 @item 24949 AGGREGATION WITH INDEPENDENT WORKS 24950 24951 A compilation of the Document or its derivatives with other 24952 separate and independent documents or works, in or on a volume of 24953 a storage or distribution medium, is called an ``aggregate'' if the 24954 copyright resulting from the compilation is not used to limit the 24955 legal rights of the compilation's users beyond what the individual 24956 works permit. When the Document is included in an aggregate, this 24957 License does not apply to the other works in the aggregate which 24958 are not themselves derivative works of the Document. 24959 24960 If the Cover Text requirement of section 3 is applicable to these 24961 copies of the Document, then if the Document is less than one half 24962 of the entire aggregate, the Document's Cover Texts may be placed 24963 on covers that bracket the Document within the aggregate, or the 24964 electronic equivalent of covers if the Document is in electronic 24965 form. Otherwise they must appear on printed covers that bracket 24966 the whole aggregate. 24967 24968 @item 24969 TRANSLATION 24970 24971 Translation is considered a kind of modification, so you may 24972 distribute translations of the Document under the terms of 24973 section 4. Replacing Invariant Sections with translations requires 24974 special permission from their copyright holders, but you may 24975 include translations of some or all Invariant Sections in addition 24976 to the original versions of these Invariant Sections. You may 24977 include a translation of this License, and all the license notices 24978 in the Document, and any Warranty Disclaimers, provided that you 24979 also include the original English version of this License and the 24980 original versions of those notices and disclaimers. In case of 24981 a disagreement between the translation and the original version of 24982 this License or a notice or disclaimer, the original version will 24983 prevail. 24984 24985 If a section in the Document is Entitled ``Acknowledgements'', 24986 ``Dedications'', or ``History'', the requirement (section 4) to 24987 Preserve its Title (section 1) will typically require changing the 24988 actual title. 24989 24990 @item 24991 TERMINATION 24992 24993 You may not copy, modify, sublicense, or distribute the Document 24994 except as expressly provided under this License. Any attempt 24995 otherwise to copy, modify, sublicense, or distribute it is void, 24996 and will automatically terminate your rights under this License. 24997 24998 However, if you cease all violation of this License, then your 24999 license from a particular copyright holder is reinstated (a) 25000 provisionally, unless and until the copyright holder explicitly and 25001 finally terminates your license, and (b) permanently, if the 25002 copyright holder fails to notify you of the violation by some 25003 reasonable means prior to 60 days after the cessation. 25004 25005 Moreover, your license from a particular copyright holder is 25006 reinstated permanently if the copyright holder notifies you of the 25007 violation by some reasonable means, this is the first time you have 25008 received notice of violation of this License (for any work) from 25009 that copyright holder, and you cure the violation prior to 30 days 25010 after your receipt of the notice. 25011 25012 Termination of your rights under this section does not terminate 25013 the licenses of parties who have received copies or rights from you 25014 under this License. If your rights have been terminated and not 25015 permanently reinstated, receipt of a copy of some or all of the 25016 same material does not give you any rights to use it. 25017 25018 @item 25019 FUTURE REVISIONS OF THIS LICENSE 25020 25021 The Free Software Foundation may publish new, revised versions of 25022 the GNU Free Documentation License from time to time. Such new 25023 versions will be similar in spirit to the present version, but may 25024 differ in detail to address new problems or concerns. See 25025 @uref{https://www.gnu.org/copyleft/}. 25026 25027 Each version of the License is given a distinguishing version 25028 number. If the Document specifies that a particular numbered 25029 version of this License ``or any later version'' applies to it, you 25030 have the option of following the terms and conditions either of 25031 that specified version or of any later version that has been 25032 published (not as a draft) by the Free Software Foundation. If 25033 the Document does not specify a version number of this License, 25034 you may choose any version ever published (not as a draft) by the 25035 Free Software Foundation. If the Document specifies that a proxy 25036 can decide which future versions of this License can be used, that 25037 proxy's public statement of acceptance of a version permanently 25038 authorizes you to choose that version for the Document. 25039 25040 @item 25041 RELICENSING 25042 25043 ``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any 25044 World Wide Web server that publishes copyrightable works and also 25045 provides prominent facilities for anybody to edit those works. 25046 A public wiki that anybody can edit is an example of such 25047 a server. A ``Massive Multiauthor Collaboration'' (or ``MMC'') 25048 contained in the site means any set of copyrightable works thus 25049 published on the MMC site. 25050 25051 ``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0 25052 license published by Creative Commons Corporation, 25053 a not-for-profit corporation with a principal place of business in 25054 San Francisco, California, as well as future copyleft versions of 25055 that license published by that same organization. 25056 25057 ``Incorporate'' means to publish or republish a Document, in whole 25058 or in part, as part of another Document. 25059 25060 An MMC is ``eligible for relicensing'' if it is licensed under this 25061 License, and if all works that were first published under this 25062 License somewhere other than this MMC, and subsequently 25063 incorporated in whole or in part into the MMC, (1) had no cover 25064 texts or invariant sections, and (2) were thus incorporated prior 25065 to November 1, 2008. 25066 25067 The operator of an MMC Site may republish an MMC contained in the 25068 site under CC-BY-SA on the same site at any time before August 1, 25069 2009, provided the MMC is eligible for relicensing. 25070 @end enumerate 25071 25072 @page 25073 25074 @anchor{ADDENDUM How to use this License for your documents} 25075 @appendixsec ADDENDUM: How to use this License for your documents 25076 25077 To use this License in a document you have written, include a copy of 25078 the License in the document and put the following copyright and 25079 license notices just after the title page: 25080 25081 @example 25082 Copyright (C) YEAR YOUR NAME. 25083 Permission is granted to copy, distribute and/or modify this document 25084 under the terms of the GNU Free Documentation License, Version 1.3 25085 or any later version published by the Free Software Foundation; 25086 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover 25087 Texts. A copy of the license is included in the section entitled ``GNU 25088 Free Documentation License''. 25089 @end example 25090 25091 If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, 25092 replace the ``with@dots{}Texts.''@tie{}line with this: 25093 25094 @example 25095 with the Invariant Sections being LIST THEIR TITLES, with 25096 the Front-Cover Texts being LIST, and with the Back-Cover Texts 25097 being LIST. 25098 @end example 25099 25100 If you have Invariant Sections without Cover Texts, or some other 25101 combination of the three, merge those two alternatives to suit the 25102 situation. 25103 25104 If your document contains nontrivial examples of program code, we 25105 recommend releasing these examples in parallel under your choice of 25106 free software license, such as the GNU General Public License, to 25107 permit their use in free software. 25108 25109 @node Main Index 25110 @chapter Main Index 25111 25112 @printindex cp 25113 25114 @node Key Index 25115 @chapter Key Index 25116 25117 @printindex ky 25118 25119 @node Command and Function Index 25120 @chapter Command and Function Index 25121 25122 @printindex fn 25123 25124 @node Variable Index 25125 @chapter Variable Index 25126 25127 This is not a complete index of variables and faces, only the ones 25128 that are mentioned in the manual. For a more complete list, use 25129 @kbd{M-x org-customize} and then click yourself through the tree. 25130 25131 @printindex vr 25132 25133 @bye