aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorRasmus2017-06-21 13:20:20 +0200
committerRasmus2017-06-22 11:54:18 +0200
commit5cecd275820df825c51bf9a27fcc7e35f30ff273 (patch)
treeb3f72e63953613d565e6d5a35bec97f158eb603c /doc
parent386a3da920482b8cb3e962fb944d135c8a770e26 (diff)
downloademacs-5cecd275820df825c51bf9a27fcc7e35f30ff273.tar.gz
emacs-5cecd275820df825c51bf9a27fcc7e35f30ff273.zip
Update Org to v9.0.9
Please see etc/ORG-NEWS for details.
Diffstat (limited to 'doc')
-rw-r--r--doc/misc/org.texi9875
1 files changed, 5357 insertions, 4518 deletions
diff --git a/doc/misc/org.texi b/doc/misc/org.texi
index fca5185337e..272788b1a11 100644
--- a/doc/misc/org.texi
+++ b/doc/misc/org.texi
@@ -4,7 +4,8 @@
4@settitle The Org Manual 4@settitle The Org Manual
5@include docstyle.texi 5@include docstyle.texi
6 6
7@set VERSION 8.2.9 7@set VERSION 9.0.9
8@set DATE 2017-06-22
8 9
9@c Version and Contact Info 10@c Version and Contact Info
10@set MAINTAINERSITE @uref{http://orgmode.org,maintainers web page} 11@set MAINTAINERSITE @uref{http://orgmode.org,maintainers web page}
@@ -284,8 +285,8 @@ modify this GNU manual.''
284 285
285@subtitle Release @value{VERSION} 286@subtitle Release @value{VERSION}
286@author by Carsten Dominik 287@author by Carsten Dominik
287with contributions by David O'Toole, Bastien Guerry, Philip Rooke, Dan 288with contributions by Bastien Guerry, Nicolas Goaziou, Eric Schulte,
288Davison, Eric Schulte, Thomas Dye, Jambunathan K and Nicolas Goaziou. 289Jambunathan K, Dan Davison, Thomas Dye, David O'Toole, and Philip Rooke.
289 290
290@c The following two commands start the copyright page. 291@c The following two commands start the copyright page.
291@page 292@page
@@ -293,13 +294,14 @@ Davison, Eric Schulte, Thomas Dye, Jambunathan K and Nicolas Goaziou.
293@insertcopying 294@insertcopying
294@end titlepage 295@end titlepage
295 296
297@c Output the short table of contents at the beginning.
298@shortcontents
299
296@c Output the table of contents at the beginning. 300@c Output the table of contents at the beginning.
297@contents 301@contents
298 302
299@ifnottex 303@ifnottex
300@c FIXME These hand-written next,prev,up node pointers make editing a lot 304
301@c harder. There should be no need for them, makeinfo can do it
302@c automatically for any document with a normal structure.
303@node Top, Introduction, (dir), (dir) 305@node Top, Introduction, (dir), (dir)
304@top Org Mode Manual 306@top Org Mode Manual
305 307
@@ -308,23 +310,23 @@ Davison, Eric Schulte, Thomas Dye, Jambunathan K and Nicolas Goaziou.
308 310
309@menu 311@menu
310* Introduction:: Getting started 312* Introduction:: Getting started
311* Document Structure:: A tree works like your brain 313* Document structure:: A tree works like your brain
312* Tables:: Pure magic for quick formatting 314* Tables:: Pure magic for quick formatting
313* Hyperlinks:: Notes in context 315* Hyperlinks:: Notes in context
314* TODO Items:: Every tree branch can be a TODO item 316* TODO items:: Every tree branch can be a TODO item
315* Tags:: Tagging headlines and matching sets of tags 317* Tags:: Tagging headlines and matching sets of tags
316* Properties and Columns:: Storing information about an entry 318* Properties and columns:: Storing information about an entry
317* Dates and Times:: Making items useful for planning 319* Dates and times:: Making items useful for planning
318* Capture - Refile - Archive:: The ins and outs for projects 320* Capture - Refile - Archive:: The ins and outs for projects
319* Agenda Views:: Collecting information into views 321* Agenda views:: Collecting information into views
320* Markup:: Prepare text for rich export 322* Markup:: Prepare text for rich export
321* Exporting:: Sharing and publishing notes 323* Exporting:: Sharing and publishing notes
322* Publishing:: Create a web site of linked Org files 324* Publishing:: Create a web site of linked Org files
323* Working With Source Code:: Export, evaluate, and tangle code blocks 325* Working with source code:: Export, evaluate, and tangle code blocks
324* Miscellaneous:: All the rest which did not fit elsewhere 326* Miscellaneous:: All the rest which did not fit elsewhere
325* Hacking:: How to hack your way around 327* Hacking:: How to hack your way around
326* MobileOrg:: Viewing and capture on a mobile device 328* MobileOrg:: Viewing and capture on a mobile device
327* History and Acknowledgments:: How Org came into being 329* History and acknowledgments:: How Org came into being
328* GNU Free Documentation License:: The license for this documentation. 330* GNU Free Documentation License:: The license for this documentation.
329* Main Index:: An index of Org's concepts and features 331* Main Index:: An index of Org's concepts and features
330* Key Index:: Key bindings and where they are described 332* Key Index:: Key bindings and where they are described
@@ -363,11 +365,6 @@ Visibility cycling
363* Initial visibility:: Setting the initial visibility state 365* Initial visibility:: Setting the initial visibility state
364* Catching invisible edits:: Preventing mistakes when editing invisible parts 366* Catching invisible edits:: Preventing mistakes when editing invisible parts
365 367
366Global and local cycling
367
368* Initial visibility:: Setting the initial visibility state
369* Catching invisible edits:: Preventing mistakes when editing invisible parts
370
371Tables 368Tables
372 369
373* Built-in table editor:: Simple tables 370* Built-in table editor:: Simple tables
@@ -434,7 +431,7 @@ Tags
434 431
435* Tag inheritance:: Tags use the tree structure of the outline 432* Tag inheritance:: Tags use the tree structure of the outline
436* Setting tags:: How to assign tags to a headline 433* Setting tags:: How to assign tags to a headline
437* Tag groups:: Use one tag to search for several tags 434* Tag hierarchy:: Create a hierarchy of tags
438* Tag searches:: Searching for combinations of tags 435* Tag searches:: Searching for combinations of tags
439 436
440Properties and columns 437Properties and columns
@@ -464,8 +461,7 @@ Dates and times
464* Deadlines and scheduling:: Planning your work 461* Deadlines and scheduling:: Planning your work
465* Clocking work time:: Tracking how long you spend on a task 462* Clocking work time:: Tracking how long you spend on a task
466* Effort estimates:: Planning work effort in advance 463* Effort estimates:: Planning work effort in advance
467* Relative timer:: Notes with a running timer 464* Timers:: Notes with a running timer
468* Countdown timer:: Starting a countdown timer for a task
469 465
470Creating timestamps 466Creating timestamps
471 467
@@ -487,7 +483,7 @@ Capture - Refile - Archive
487 483
488* Capture:: Capturing new stuff 484* Capture:: Capturing new stuff
489* Attachments:: Add files to tasks 485* Attachments:: Add files to tasks
490* RSS Feeds:: Getting input from RSS feeds 486* RSS feeds:: Getting input from RSS feeds
491* Protocols:: External (e.g., Browser) access to Emacs and Org 487* Protocols:: External (e.g., Browser) access to Emacs and Org
492* Refile and copy:: Moving/copying a tree from one place to another 488* Refile and copy:: Moving/copying a tree from one place to another
493* Archiving:: What to do with finished projects 489* Archiving:: What to do with finished projects
@@ -517,7 +513,7 @@ Agenda views
517* Presentation and sorting:: How agenda items are prepared for display 513* Presentation and sorting:: How agenda items are prepared for display
518* Agenda commands:: Remote editing of Org trees 514* Agenda commands:: Remote editing of Org trees
519* Custom agenda views:: Defining special searches and views 515* Custom agenda views:: Defining special searches and views
520* Exporting Agenda Views:: Writing a view to a file 516* Exporting agenda views:: Writing a view to a file
521* Agenda column view:: Using column view for collected entries 517* Agenda column view:: Using column view for collected entries
522 518
523The built-in agenda views 519The built-in agenda views
@@ -540,114 +536,127 @@ Custom agenda views
540 536
541* Storing searches:: Type once, use often 537* Storing searches:: Type once, use often
542* Block agenda:: All the stuff you need in a single buffer 538* Block agenda:: All the stuff you need in a single buffer
543* Setting Options:: Changing the rules 539* Setting options:: Changing the rules
544 540
545Markup for rich export 541Markup for rich export
546 542
547* Structural markup elements:: The basic structure as seen by the exporter 543* Paragraphs:: The basic unit of text
544* Emphasis and monospace:: Bold, italic, etc.
545* Horizontal rules:: Make a line
548* Images and tables:: Images, tables and caption mechanism 546* Images and tables:: Images, tables and caption mechanism
549* Literal examples:: Source code examples with special formatting 547* Literal examples:: Source code examples with special formatting
550* Include files:: Include additional files into a document 548* Special symbols:: Greek letters and other symbols
551* Index entries:: Making an index 549* Subscripts and superscripts:: Simple syntax for raising/lowering text
552* Macro replacement:: Use macros to create templates
553* Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents 550* Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents
554* Special blocks:: Containers targeted at export back-ends
555
556Structural markup elements
557
558* Document title:: Where the title is taken from
559* Headings and sections:: The document structure as seen by the exporter
560* Table of contents:: The if and where of the table of contents
561* Lists:: Lists
562* Paragraphs:: Paragraphs
563* Footnote markup:: Footnotes
564* Emphasis and monospace:: Bold, italic, etc.
565* Horizontal rules:: Make a line
566* Comment lines:: What will *not* be exported
567 551
568Embedded @LaTeX{} 552Embedded @LaTeX{}
569 553
570* Special symbols:: Greek letters and other symbols
571* Subscripts and superscripts:: Simple syntax for raising/lowering text
572* @LaTeX{} fragments:: Complex formulas made easy 554* @LaTeX{} fragments:: Complex formulas made easy
573* Previewing @LaTeX{} fragments:: What will this snippet look like? 555* Previewing @LaTeX{} fragments:: What will this snippet look like?
574* CDLaTeX mode:: Speed up entering of formulas 556* CDLaTeX mode:: Speed up entering of formulas
575 557
576Exporting 558Exporting
577 559
578* The Export Dispatcher:: The main exporter interface 560* The export dispatcher:: The main interface
579* Export back-ends:: Built-in export formats 561* Export settings:: Common export settings
580* Export settings:: Generic export settings 562* Table of contents:: The if and where of the table of contents
563* Include files:: Include additional files into a document
564* Macro replacement:: Use macros to create templates
565* Comment lines:: What will not be exported
581* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding 566* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding
582* Beamer export:: Exporting as a Beamer presentation 567* Beamer export:: Exporting as a Beamer presentation
583* HTML export:: Exporting to HTML 568* HTML export:: Exporting to HTML
584* @LaTeX{} and PDF export:: Exporting to @LaTeX{}, and processing to PDF 569* @LaTeX{} export:: Exporting to @LaTeX{}, and processing to PDF
585* Markdown export:: Exporting to Markdown 570* Markdown export:: Exporting to Markdown
586* OpenDocument Text export:: Exporting to OpenDocument Text 571* OpenDocument Text export:: Exporting to OpenDocument Text
587* Org export:: Exporting to Org 572* Org export:: Exporting to Org
588* Texinfo export:: Exporting to Texinfo 573* Texinfo export:: Exporting to Texinfo
589* iCalendar export:: Exporting to iCalendar 574* iCalendar export:: Exporting to iCalendar
590* Other built-in back-ends:: Exporting to a man page 575* Other built-in back-ends:: Exporting to a man page
591* Export in foreign buffers:: Author tables and lists in Org syntax
592* Advanced configuration:: Fine-tuning the export output 576* Advanced configuration:: Fine-tuning the export output
577* Export in foreign buffers:: Author tables and lists in Org syntax
578
579Beamer export
580
581* Beamer export commands:: For creating Beamer documents.
582* Beamer specific export settings:: For customizing Beamer export.
583* Sectioning Frames and Blocks in Beamer:: For composing Beamer slides.
584* Beamer specific syntax:: For using in Org documents.
585* Editing support:: For using helper functions.
586* A Beamer example:: A complete presentation.
593 587
594HTML export 588HTML export
595 589
596* HTML Export commands:: How to invoke HTML export 590* HTML Export commands:: Invoking HTML export
597* HTML doctypes:: Org can export to various (X)HTML flavors 591* HTML Specific export settings:: Settings for HTML export
598* HTML preamble and postamble:: How to insert a preamble and a postamble 592* HTML doctypes:: Exporting various (X)HTML flavors
599* Quoting HTML tags:: Using direct HTML in Org mode 593* HTML preamble and postamble:: Inserting preamble and postamble
600* Links in HTML export:: How links will be interpreted and formatted 594* Quoting HTML tags:: Using direct HTML in Org files
601* Tables in HTML export:: How to modify the formatting of tables 595* Links in HTML export:: Interpreting and formatting links
602* Images in HTML export:: How to insert figures into HTML output 596* Tables in HTML export:: Formatting and modifying tables
603* Math formatting in HTML export:: Beautiful math also on the web 597* Images in HTML export:: Inserting figures with HTML output
604* Text areas in HTML export:: An alternative way to show an example 598* Math formatting in HTML export:: Handling math equations
605* CSS support:: Changing the appearance of the output 599* Text areas in HTML export:: Showing an alternate approach, an example
606* JavaScript support:: Info and Folding in a web browser 600* CSS support:: Styling HTML output
607 601* JavaScript support:: Folding scripting in the web browser
608@LaTeX{} and PDF export 602
609 603@LaTeX{} export
610* @LaTeX{} export commands:: How to export to LaTeX and PDF 604
611* Header and sectioning:: Setting up the export file structure 605* @LaTeX{} export commands:: For producing @LaTeX{} and PDF documents.
612* Quoting @LaTeX{} code:: Incorporating literal @LaTeX{} code 606* @LaTeX{} specific export settings:: Unique to this @LaTeX{} back-end.
613* @LaTeX{} specific attributes:: Controlling @LaTeX{} output 607* @LaTeX{} header and sectioning:: For file structure.
608* Quoting @LaTeX{} code:: Directly in the Org document.
609* Tables in @LaTeX{} export:: Attributes specific to tables.
610* Images in @LaTeX{} export:: Attributes specific to images.
611* Plain lists in @LaTeX{} export:: Attributes specific to lists.
612* Source blocks in @LaTeX{} export:: Attributes specific to source code blocks.
613* Example blocks in @LaTeX{} export:: Attributes specific to example blocks.
614* Special blocks in @LaTeX{} export:: Attributes specific to special blocks.
615* Horizontal rules in @LaTeX{} export:: Attributes specific to horizontal rules.
614 616
615OpenDocument Text export 617OpenDocument Text export
616 618
617* Pre-requisites for ODT export:: What packages ODT exporter relies on 619* Pre-requisites for ODT export:: Required packages.
618* ODT export commands:: How to invoke ODT export 620* ODT export commands:: Invoking export.
619* Extending ODT export:: How to produce @samp{doc}, @samp{pdf} files 621* ODT specific export settings:: Configuration options.
620* Applying custom styles:: How to apply custom styles to the output 622* Extending ODT export:: Producing @file{.doc}, @file{.pdf} files.
621* Links in ODT export:: How links will be interpreted and formatted 623* Applying custom styles:: Styling the output.
622* Tables in ODT export:: How Tables are exported 624* Links in ODT export:: Handling and formatting links.
623* Images in ODT export:: How to insert images 625* Tables in ODT export:: Org table conversions.
624* Math formatting in ODT export:: How @LaTeX{} fragments are formatted 626* Images in ODT export:: Inserting images.
625* Labels and captions in ODT export:: How captions are rendered 627* Math formatting in ODT export:: Formatting @LaTeX{} fragments.
626* Literal examples in ODT export:: How source and example blocks are formatted 628* Labels and captions in ODT export:: Rendering objects.
627* Advanced topics in ODT export:: Read this if you are a power user 629* Literal examples in ODT export:: For source code and example blocks.
630* Advanced topics in ODT export:: For power users.
628 631
629Math formatting in ODT export 632Math formatting in ODT export
630 633
631* Working with @LaTeX{} math snippets:: How to embed @LaTeX{} math fragments 634* Working with @LaTeX{} math snippets:: Embedding in @LaTeX{} format.
632* Working with MathML or OpenDocument formula files:: How to embed equations in native format 635* Working with MathML or OpenDocument formula files:: Embedding in native format.
633 636
634Advanced topics in ODT export 637Advanced topics in ODT export
635 638
636* Configuring a document converter:: How to register a document converter 639* Configuring a document converter:: Registering a document converter.
637* Working with OpenDocument style files:: Explore the internals 640* Working with OpenDocument style files:: Exploring internals.
638* Creating one-off styles:: How to produce custom highlighting etc 641* Creating one-off styles:: Customizing styles, highlighting.
639* Customizing tables in ODT export:: How to define and use Table templates 642* Customizing tables in ODT export:: Defining table templates.
640* Validating OpenDocument XML:: How to debug corrupt OpenDocument files 643* Validating OpenDocument XML:: Debugging corrupted OpenDocument files.
641 644
642Texinfo export 645Texinfo export
643 646
644* Texinfo export commands:: How to invoke Texinfo export 647* Texinfo export commands:: Invoking commands.
645* Document preamble:: File header, title and copyright page 648* Texinfo specific export settings:: Setting the environment.
646* Headings and sectioning structure:: Building document structure 649* Texinfo file header:: Generating the header.
647* Indices:: Creating indices 650* Texinfo title and copyright page:: Creating preamble pages.
648* Quoting Texinfo code:: Incorporating literal Texinfo code 651* Info directory file:: Installing a manual in Info file hierarchy.
649* Texinfo specific attributes:: Controlling Texinfo output 652* Headings and sectioning structure:: Building document structure.
650* An example:: 653* Indices:: Creating indices.
654* Quoting Texinfo code:: Incorporating literal Texinfo code.
655* Plain lists in Texinfo export:: List attributes.
656* Tables in Texinfo export:: Table attributes.
657* Images in Texinfo export:: Image attributes.
658* Special blocks in Texinfo export:: Special block attributes.
659* A Texinfo example:: Processing Org to Texinfo.
651 660
652Publishing 661Publishing
653 662
@@ -694,36 +703,32 @@ Header arguments
694 703
695Using header arguments 704Using header arguments
696 705
697* System-wide header arguments:: Set global default values 706* System-wide header arguments:: Set globally, language-specific
698* Language-specific header arguments:: Set default values by language 707* Language-specific header arguments:: Set in the Org file's headers
699* Header arguments in Org mode properties:: Set default values for a buffer or heading 708* Header arguments in Org mode properties:: Set in the Org file
700* Language-specific header arguments in Org mode properties:: Set language-specific default values for a buffer or heading 709* Language-specific mode properties::
701* Code block specific header arguments:: The most common way to set values 710* Code block specific header arguments:: The most commonly used method
702* Header arguments in function calls:: The most specific level 711* Arguments in function calls:: The most specific level, takes highest priority
703 712
704Specific header arguments 713Specific header arguments
705 714
706* var:: Pass arguments to code blocks 715* var:: Pass arguments to @samp{src} code blocks
707* results:: Specify the type of results and how they will 716* results:: Specify results type; how to collect
708 be collected and handled 717* file:: Specify a path for output file
709* file:: Specify a path for file output
710* file-desc:: Specify a description for file results 718* file-desc:: Specify a description for file results
711* dir:: Specify the default (possibly remote) 719* file-ext:: Specify an extension for file output
712 directory for code block execution 720* output-dir:: Specify a directory for output file
713* exports:: Export code and/or results 721* dir:: Specify the default directory for code block execution
714* tangle:: Toggle tangling and specify file name 722* exports:: Specify exporting code, results, both, none
715* mkdirp:: Toggle creation of parent directories of target 723* tangle:: Toggle tangling; or specify file name
716 files during tangling 724* mkdirp:: Toggle for parent directory creation for target files during tangling
717* comments:: Toggle insertion of comments in tangled 725* comments:: Toggle insertion of comments in tangled code files
718 code files 726* padline:: Control insertion of padding lines in tangled code files
719* padline:: Control insertion of padding lines in tangled 727* no-expand:: Turn off variable assignment and noweb expansion during tangling
720 code files
721* no-expand:: Turn off variable assignment and noweb
722 expansion during tangling
723* session:: Preserve the state of code evaluation 728* session:: Preserve the state of code evaluation
724* noweb:: Toggle expansion of noweb references 729* noweb:: Toggle expansion of noweb references
725* noweb-ref:: Specify block's noweb reference resolution target 730* noweb-ref:: Specify block's noweb reference resolution target
726* noweb-sep:: String used to separate noweb references 731* noweb-sep:: String to separate noweb references
727* cache:: Avoid re-evaluating unchanged code blocks 732* cache:: Avoid re-evaluating unchanged code blocks
728* sep:: Delimiter for writing tabular results outside Org 733* sep:: Delimiter for writing tabular results outside Org
729* hlines:: Handle horizontal lines in tables 734* hlines:: Handle horizontal lines in tables
@@ -733,22 +738,22 @@ Specific header arguments
733* tangle-mode:: Set permission of tangled files 738* tangle-mode:: Set permission of tangled files
734* eval:: Limit evaluation of specific code blocks 739* eval:: Limit evaluation of specific code blocks
735* wrap:: Mark source block evaluation results 740* wrap:: Mark source block evaluation results
736* post:: Post processing of code block results 741* post:: Post processing of results of code block evaluation
737* prologue:: Text to prepend to code block body 742* prologue:: Text to prepend to body of code block
738* epilogue:: Text to append to code block body 743* epilogue:: Text to append to body of code block
739 744
740Miscellaneous 745Miscellaneous
741 746
742* Completion:: M-TAB knows what you need 747* Completion:: M-TAB guesses completions
743* Easy Templates:: Quick insertion of structural elements 748* Easy templates:: Quick insertion of structural elements
744* Speed keys:: Electric commands at the beginning of a headline 749* Speed keys:: Electric commands at the beginning of a headline
745* Code evaluation security:: Org mode files evaluate inline code 750* Code evaluation security:: Org mode files evaluate inline code
746* Customization:: Adapting Org to your taste 751* Customization:: Adapting Org to changing tastes
747* In-buffer settings:: Overview of the #+KEYWORDS 752* In-buffer settings:: Overview of the #+KEYWORDS
748* The very busy C-c C-c key:: When in doubt, press C-c C-c 753* The very busy C-c C-c key:: When in doubt, press C-c C-c
749* Clean view:: Getting rid of leading stars in the outline 754* Clean view:: Getting rid of leading stars in the outline
750* TTY keys:: Using Org on a tty 755* TTY keys:: Using Org on a tty
751* Interaction:: Other Emacs packages 756* Interaction:: With other Emacs packages
752* org-crypt:: Encrypting Org files 757* org-crypt:: Encrypting Org files
753 758
754Interaction with other packages 759Interaction with other packages
@@ -780,14 +785,14 @@ Tables and lists in arbitrary syntax
780 785
781MobileOrg 786MobileOrg
782 787
783* Setting up the staging area:: Where to interact with the mobile device 788* Setting up the staging area:: For the mobile device
784* Pushing to MobileOrg:: Uploading Org files and agendas 789* Pushing to MobileOrg:: Uploading Org files and agendas
785* Pulling from MobileOrg:: Integrating captured and flagged items 790* Pulling from MobileOrg:: Integrating captured and flagged items
786 791
787@end detailmenu 792@end detailmenu
788@end menu 793@end menu
789 794
790@node Introduction, Document Structure, Top, Top 795@node Introduction
791@chapter Introduction 796@chapter Introduction
792@cindex introduction 797@cindex introduction
793 798
@@ -799,79 +804,65 @@ MobileOrg
799* Conventions:: Typesetting conventions in the manual 804* Conventions:: Typesetting conventions in the manual
800@end menu 805@end menu
801 806
802@node Summary, Installation, Introduction, Introduction 807@node Summary
803@section Summary 808@section Summary
804@cindex summary 809@cindex summary
805 810
806Org is a mode for keeping notes, maintaining TODO lists, and doing 811Org is a mode for keeping notes, maintaining TODO lists, and project planning
807project planning with a fast and effective plain-text system. 812with a fast and effective plain-text system. It also is an authoring system
808 813with unique support for literate programming and reproducible research.
809Org develops organizational tasks around NOTES files that contain 814
810lists or information about projects as plain text. Org is 815Org is implemented on top of Outline mode, which makes it possible to keep
811implemented on top of Outline mode, which makes it possible to keep the 816the content of large files well structured. Visibility cycling and structure
812content of large files well structured. Visibility cycling and 817editing help to work with the tree. Tables are easily created with a
813structure editing help to work with the tree. Tables are easily created 818built-in table editor. Plain text URL-like links connect to websites,
814with a built-in table editor. Org supports TODO items, deadlines, 819emails, Usenet messages, BBDB entries, and any files related to the projects.
815timestamps, and scheduling. It dynamically compiles entries into an 820
816agenda that utilizes and smoothly integrates much of the Emacs calendar 821Org develops organizational tasks around notes files that contain lists or
817and diary. Plain text URL-like links connect to websites, emails, 822information about projects as plain text. Project planning and task
818Usenet messages, BBDB entries, and any files related to the projects. 823management makes use of metadata which is part of an outline node. Based on
819For printing and sharing notes, an Org file can be exported as a 824this data, specific entries can be extracted in queries and create dynamic
820structured ASCII file, as HTML, or (TODO and agenda items only) as an 825@i{agenda views} that also integrate the Emacs calendar and diary. Org can
821iCalendar file. It can also serve as a publishing tool for a set of 826be used to implement many different project planning schemes, such as David
822linked web pages. 827Allen's GTD system.
823 828
824As a project planning environment, Org works by adding metadata to outline 829Org files can serve as a single source authoring system with export to many
825nodes. Based on this data, specific entries can be extracted in queries and 830different formats such as HTML, @LaTeX{}, Open Document, and Markdown. New
826create dynamic @i{agenda views}. 831export backends can be derived from existing ones, or defined from scratch.
827 832
828Org mode contains the Org Babel environment which allows you to work with 833Org files can include source code blocks, which makes Org uniquely suited for
829embedded source code blocks in a file, to facilitate code evaluation, 834authoring technical documents with code examples. Org source code blocks are
830documentation, and literate programming techniques. 835fully functional; they can be evaluated in place and their results can be
831 836captured in the file. This makes it possible to create a single file
832Org's automatic, context-sensitive table editor with spreadsheet 837reproducible research compendium.
833capabilities can be integrated into any major mode by activating the 838
834minor Orgtbl mode. Using a translation step, it can be used to maintain 839Org keeps simple things simple. When first fired up, it should feel like a
835tables in arbitrary file types, for example in @LaTeX{}. The structure 840straightforward, easy to use outliner. Complexity is not imposed, but a
836editing and list creation capabilities can be used outside Org with 841large amount of functionality is available when needed. Org is a toolbox.
837the minor Orgstruct mode. 842Many users actually run only a (very personal) fraction of Org's capabilities, and
838 843know that there is more whenever they need it.
839Org keeps simple things simple. When first fired up, it should 844
840feel like a straightforward, easy to use outliner. Complexity is not 845All of this is achieved with strictly plain text files, the most portable and
841imposed, but a large amount of functionality is available when you need 846future-proof file format. Org runs in Emacs. Emacs is one of the most
842it. Org is a toolbox and can be used in different ways and for different 847widely ported programs, so that Org mode is available on every major
843ends, for example: 848platform.
844
845@example
846@r{@bullet{} an outline extension with visibility cycling and structure editing}
847@r{@bullet{} an ASCII system and table editor for taking structured notes}
848@r{@bullet{} a TODO list editor}
849@r{@bullet{} a full agenda and planner with deadlines and work scheduling}
850@pindex GTD, Getting Things Done
851@r{@bullet{} an environment in which to implement David Allen's GTD system}
852@r{@bullet{} a simple hypertext system, with HTML and @LaTeX{} export}
853@r{@bullet{} a publishing tool to create a set of interlinked web pages}
854@r{@bullet{} an environment for literate programming}
855@end example
856 849
857@cindex FAQ 850@cindex FAQ
858There is a website for Org which provides links to the newest 851There is a website for Org which provides links to the newest
859version of Org, as well as additional information, frequently asked 852version of Org, as well as additional information, frequently asked
860questions (FAQ), links to tutorials, etc. This page is located at 853questions (FAQ), links to tutorials, etc. This page is located at
861@uref{http://orgmode.org}. 854@uref{http://orgmode.org}.
862
863@cindex print edition 855@cindex print edition
864The version 7.3 of this manual is available as a
865@uref{http://www.network-theory.co.uk/org/manual/, paperback book from Network
866Theory Ltd.}
867 856
868@page 857An earlier version (7.3) of this manual is available as a
858@uref{http://www.network-theory.co.uk/org/manual/, paperback book from
859Network Theory Ltd.}
869 860
861@page
870 862
871@node Installation, Activation, Summary, Introduction 863@node Installation
872@section Installation 864@section Installation
873@cindex installation 865@cindex installation
874@cindex XEmacs
875 866
876Org is part of recent distributions of GNU Emacs, so you normally don't need 867Org is part of recent distributions of GNU Emacs, so you normally don't need
877to install it. If, for one reason or another, you want to install Org on top 868to install it. If, for one reason or another, you want to install Org on top
@@ -895,7 +886,7 @@ been visited, i.e., where no Org built-in function have been loaded.
895Otherwise autoload Org functions will mess up the installation. 886Otherwise autoload Org functions will mess up the installation.
896 887
897Then, to make sure your Org configuration is taken into account, initialize 888Then, to make sure your Org configuration is taken into account, initialize
898the package system with @code{(package-initialize)} in your @file{.emacs} 889the package system with @code{(package-initialize)} in your Emacs init file
899before setting any Org option. If you want to use Org's package repository, 890before setting any Org option. If you want to use Org's package repository,
900check out the @uref{http://orgmode.org/elpa.html, Org ELPA page}. 891check out the @uref{http://orgmode.org/elpa.html, Org ELPA page}.
901 892
@@ -903,7 +894,7 @@ check out the @uref{http://orgmode.org/elpa.html, Org ELPA page}.
903 894
904You can download Org latest release from @uref{http://orgmode.org/, Org's 895You can download Org latest release from @uref{http://orgmode.org/, Org's
905website}. In this case, make sure you set the load-path correctly in your 896website}. In this case, make sure you set the load-path correctly in your
906@file{.emacs}: 897Emacs init file:
907 898
908@lisp 899@lisp
909(add-to-list 'load-path "~/path/to/orgdir/lisp") 900(add-to-list 'load-path "~/path/to/orgdir/lisp")
@@ -945,7 +936,7 @@ For more detailed explanations on Org's build system, please check the Org
945Build System page on @uref{http://orgmode.org/worg/dev/org-build-system.html, 936Build System page on @uref{http://orgmode.org/worg/dev/org-build-system.html,
946Worg}. 937Worg}.
947 938
948@node Activation, Feedback, Installation, Introduction 939@node Activation
949@section Activation 940@section Activation
950@cindex activation 941@cindex activation
951@cindex autoload 942@cindex autoload
@@ -957,14 +948,6 @@ Worg}.
957@findex org-store-link 948@findex org-store-link
958@findex org-iswitchb 949@findex org-iswitchb
959 950
960Since Emacs 22.2, files with the @file{.org} extension use Org mode by
961default. If you are using an earlier version of Emacs, add this line to your
962@file{.emacs} file:
963
964@lisp
965(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
966@end lisp
967
968Org mode buffers need font-lock to be turned on: this is the default in 951Org mode buffers need font-lock to be turned on: this is the default in
969Emacs@footnote{If you don't use font-lock globally, turn it on in Org buffer 952Emacs@footnote{If you don't use font-lock globally, turn it on in Org buffer
970with @code{(add-hook 'org-mode-hook 'turn-on-font-lock)}}. 953with @code{(add-hook 'org-mode-hook 'turn-on-font-lock)}}.
@@ -979,15 +962,15 @@ suggested bindings for these keys, please modify the keys to your own
979liking. 962liking.
980@lisp 963@lisp
981(global-set-key "\C-cl" 'org-store-link) 964(global-set-key "\C-cl" 'org-store-link)
982(global-set-key "\C-cc" 'org-capture)
983(global-set-key "\C-ca" 'org-agenda) 965(global-set-key "\C-ca" 'org-agenda)
966(global-set-key "\C-cc" 'org-capture)
984(global-set-key "\C-cb" 'org-iswitchb) 967(global-set-key "\C-cb" 'org-iswitchb)
985@end lisp 968@end lisp
986 969
987@cindex Org mode, turning on 970@cindex Org mode, turning on
988With this setup, all files with extension @samp{.org} will be put 971Files with the @file{.org} extension use Org mode by default. To turn on Org
989into Org mode. As an alternative, make the first line of a file look 972mode in a file that does not have the extension @file{.org}, make the first
990like this: 973line of a file look like this:
991 974
992@example 975@example
993MY PROJECTS -*- mode: org; -*- 976MY PROJECTS -*- mode: org; -*-
@@ -999,17 +982,12 @@ the file's name is. See also the variable
999@code{org-insert-mode-line-in-empty-file}. 982@code{org-insert-mode-line-in-empty-file}.
1000 983
1001Many commands in Org work on the region if the region is @i{active}. To make 984Many commands in Org work on the region if the region is @i{active}. To make
1002use of this, you need to have @code{transient-mark-mode} 985use of this, you need to have @code{transient-mark-mode} turned on, which is
1003(@code{zmacs-regions} in XEmacs) turned on. In Emacs 23 this is the default, 986the default. If you do not like @code{transient-mark-mode}, you can create
1004in Emacs 22 you need to do this yourself with 987an active region by using the mouse to select a region, or pressing
1005@lisp
1006(transient-mark-mode 1)
1007@end lisp
1008@noindent If you do not like @code{transient-mark-mode}, you can create an
1009active region by using the mouse to select a region, or pressing
1010@kbd{C-@key{SPC}} twice before moving the cursor. 988@kbd{C-@key{SPC}} twice before moving the cursor.
1011 989
1012@node Feedback, Conventions, Activation, Introduction 990@node Feedback
1013@section Feedback 991@section Feedback
1014@cindex feedback 992@cindex feedback
1015@cindex bug reports 993@cindex bug reports
@@ -1018,6 +996,8 @@ active region by using the mouse to select a region, or pressing
1018 996
1019If you find problems with Org, or if you have questions, remarks, or ideas 997If you find problems with Org, or if you have questions, remarks, or ideas
1020about it, please mail to the Org mailing list @email{emacs-orgmode@@gnu.org}. 998about it, please mail to the Org mailing list @email{emacs-orgmode@@gnu.org}.
999You can subscribe to the list
1000@uref{https://lists.gnu.org/mailman/listinfo/emacs-orgmode, on this web page}.
1021If you are not a member of the mailing list, your mail will be passed to the 1001If you are not a member of the mailing list, your mail will be passed to the
1022list after a moderator has approved it@footnote{Please consider subscribing 1002list after a moderator has approved it@footnote{Please consider subscribing
1023to the mailing list, in order to minimize the work the mailing list 1003to the mailing list, in order to minimize the work the mailing list
@@ -1028,13 +1008,13 @@ version of Org available---if you are running an outdated version, it is
1028quite possible that the bug has been fixed already. If the bug persists, 1008quite possible that the bug has been fixed already. If the bug persists,
1029prepare a report and provide as much information as possible, including the 1009prepare a report and provide as much information as possible, including the
1030version information of Emacs (@kbd{M-x emacs-version @key{RET}}) and Org 1010version information of Emacs (@kbd{M-x emacs-version @key{RET}}) and Org
1031(@kbd{M-x org-version RET}), as well as the Org related setup in 1011(@kbd{M-x org-version RET}), as well as the Org related setup in the Emacs
1032@file{.emacs}. The easiest way to do this is to use the command 1012init file. The easiest way to do this is to use the command
1033@example 1013@example
1034@kbd{M-x org-submit-bug-report RET} 1014@kbd{M-x org-submit-bug-report RET}
1035@end example 1015@end example
1036@noindent which will put all this information into an Emacs mail buffer so 1016@noindent which will put all this information into an Emacs mail buffer so
1037that you only need to add your description. If you re not sending the Email 1017that you only need to add your description. If you are not sending the Email
1038from within Emacs, please copy and paste the content into your Email program. 1018from within Emacs, please copy and paste the content into your Email program.
1039 1019
1040Sometimes you might face a problem due to an error in your Emacs or Org mode 1020Sometimes you might face a problem due to an error in your Emacs or Org mode
@@ -1097,8 +1077,7 @@ To do this, use
1097or select @code{Org -> Refresh/Reload -> Reload Org uncompiled} from the 1077or select @code{Org -> Refresh/Reload -> Reload Org uncompiled} from the
1098menu. 1078menu.
1099@item 1079@item
1100Go to the @code{Options} menu and select @code{Enter Debugger on Error} 1080Go to the @code{Options} menu and select @code{Enter Debugger on Error}.
1101(XEmacs has this option in the @code{Troubleshooting} sub-menu).
1102@item 1081@item
1103Do whatever you have to do to hit the error. Don't forget to 1082Do whatever you have to do to hit the error. Don't forget to
1104document the steps you take. 1083document the steps you take.
@@ -1108,7 +1087,7 @@ screen. Save this buffer to a file (for example using @kbd{C-x C-w}) and
1108attach it to your bug report. 1087attach it to your bug report.
1109@end enumerate 1088@end enumerate
1110 1089
1111@node Conventions, , Feedback, Introduction 1090@node Conventions
1112@section Typesetting conventions used in this manual 1091@section Typesetting conventions used in this manual
1113 1092
1114@subsubheading TODO keywords, tags, properties, etc. 1093@subsubheading TODO keywords, tags, properties, etc.
@@ -1132,21 +1111,20 @@ special meaning are written with all capitals.
1132@end table 1111@end table
1133 1112
1134Moreover, Org uses @i{option keywords} (like @code{#+TITLE} to set the title) 1113Moreover, Org uses @i{option keywords} (like @code{#+TITLE} to set the title)
1135and @i{environment keywords} (like @code{#+BEGIN_HTML} to start a @code{HTML} 1114and @i{environment keywords} (like @code{#+BEGIN_EXPORT html} to start
1136environment). They are written in uppercase in the manual to enhance its 1115a @code{HTML} environment). They are written in uppercase in the manual to
1137readability, but you can use lowercase in your Org files@footnote{Easy 1116enhance its readability, but you can use lowercase in your Org file.
1138templates insert lowercase keywords and Babel dynamically inserts
1139@code{#+results}.}.
1140 1117
1141@subsubheading Keybindings and commands 1118@subsubheading Key bindings and commands
1142@kindex C-c a 1119@kindex C-c a
1143@findex org-agenda 1120@findex org-agenda
1144@kindex C-c c 1121@kindex C-c c
1145@findex org-capture 1122@findex org-capture
1146 1123
1147The manual suggests two global keybindings: @kbd{C-c a} for @code{org-agenda} 1124The manual suggests a few global key bindings, in particular @kbd{C-c a} for
1148and @kbd{C-c c} for @code{org-capture}. These are only suggestions, but the 1125@code{org-agenda} and @kbd{C-c c} for @code{org-capture}. These are only
1149rest of the manual assumes that you are using these keybindings. 1126suggestions, but the rest of the manual assumes that these key bindings are in
1127place in order to list commands by key access.
1150 1128
1151Also, the manual lists both the keys and the corresponding commands for 1129Also, the manual lists both the keys and the corresponding commands for
1152accessing a functionality. Org mode often uses the same key for different 1130accessing a functionality. Org mode often uses the same key for different
@@ -1159,7 +1137,7 @@ will be listed to call @code{org-table-move-column-right}. If you prefer,
1159you can compile the manual without the command names by unsetting the flag 1137you can compile the manual without the command names by unsetting the flag
1160@code{cmdnames} in @file{org.texi}. 1138@code{cmdnames} in @file{org.texi}.
1161 1139
1162@node Document Structure, Tables, Introduction, Top 1140@node Document structure
1163@chapter Document structure 1141@chapter Document structure
1164@cindex document structure 1142@cindex document structure
1165@cindex structure of document 1143@cindex structure of document
@@ -1182,7 +1160,7 @@ edit the structure of the document.
1182* Org syntax:: Formal description of Org's syntax 1160* Org syntax:: Formal description of Org's syntax
1183@end menu 1161@end menu
1184 1162
1185@node Outlines, Headlines, Document Structure, Document Structure 1163@node Outlines
1186@section Outlines 1164@section Outlines
1187@cindex outlines 1165@cindex outlines
1188@cindex Outline mode 1166@cindex Outline mode
@@ -1196,7 +1174,7 @@ currently being worked on. Org greatly simplifies the use of
1196outlines by compressing the entire show/hide functionality into a single 1174outlines by compressing the entire show/hide functionality into a single
1197command, @command{org-cycle}, which is bound to the @key{TAB} key. 1175command, @command{org-cycle}, which is bound to the @key{TAB} key.
1198 1176
1199@node Headlines, Visibility cycling, Outlines, Document Structure 1177@node Headlines
1200@section Headlines 1178@section Headlines
1201@cindex headlines 1179@cindex headlines
1202@cindex outline tree 1180@cindex outline tree
@@ -1209,7 +1187,7 @@ start with one or more stars, on the left margin@footnote{See the variables
1209@code{org-special-ctrl-a/e}, @code{org-special-ctrl-k}, and 1187@code{org-special-ctrl-a/e}, @code{org-special-ctrl-k}, and
1210@code{org-ctrl-k-protect-subtree} to configure special behavior of @kbd{C-a}, 1188@code{org-ctrl-k-protect-subtree} to configure special behavior of @kbd{C-a},
1211@kbd{C-e}, and @kbd{C-k} in headlines.} @footnote{Clocking only works with 1189@kbd{C-e}, and @kbd{C-k} in headlines.} @footnote{Clocking only works with
1212headings indented less then 30 stars.}. For example: 1190headings indented less than 30 stars.}. For example:
1213 1191
1214@example 1192@example
1215* Top level headline 1193* Top level headline
@@ -1222,7 +1200,12 @@ headings indented less then 30 stars.}. For example:
1222* Another top level headline 1200* Another top level headline
1223@end example 1201@end example
1224 1202
1225@noindent Some people find the many stars too noisy and would prefer an 1203@vindex org-footnote-section
1204@noindent Note that a headline named after @code{org-footnote-section},
1205which defaults to @samp{Footnotes}, is considered as special. A subtree with
1206this headline will be silently ignored by exporting functions.
1207
1208Some people find the many stars too noisy and would prefer an
1226outline that has whitespace followed by a single star as headline 1209outline that has whitespace followed by a single star as headline
1227starters. @ref{Clean view}, describes a setup to realize this. 1210starters. @ref{Clean view}, describes a setup to realize this.
1228 1211
@@ -1233,7 +1216,7 @@ least two empty lines, one empty line will remain visible after folding
1233the subtree, in order to structure the collapsed view. See the 1216the subtree, in order to structure the collapsed view. See the
1234variable @code{org-cycle-separator-lines} to modify this behavior. 1217variable @code{org-cycle-separator-lines} to modify this behavior.
1235 1218
1236@node Visibility cycling, Motion, Headlines, Document Structure 1219@node Visibility cycling
1237@section Visibility cycling 1220@section Visibility cycling
1238@cindex cycling, visibility 1221@cindex cycling, visibility
1239@cindex visibility cycling 1222@cindex visibility cycling
@@ -1247,7 +1230,7 @@ variable @code{org-cycle-separator-lines} to modify this behavior.
1247* Catching invisible edits:: Preventing mistakes when editing invisible parts 1230* Catching invisible edits:: Preventing mistakes when editing invisible parts
1248@end menu 1231@end menu
1249 1232
1250@node Global and local cycling, Initial visibility, Visibility cycling, Visibility cycling 1233@node Global and local cycling
1251@subsection Global and local cycling 1234@subsection Global and local cycling
1252 1235
1253Outlines make it possible to hide parts of the text in the buffer. 1236Outlines make it possible to hide parts of the text in the buffer.
@@ -1299,7 +1282,7 @@ tables, @kbd{S-@key{TAB}} jumps to the previous field.
1299@orgcmd{C-u C-u @key{TAB},org-set-startup-visibility} 1282@orgcmd{C-u C-u @key{TAB},org-set-startup-visibility}
1300Switch back to the startup visibility of the buffer (@pxref{Initial visibility}). 1283Switch back to the startup visibility of the buffer (@pxref{Initial visibility}).
1301@cindex show all, command 1284@cindex show all, command
1302@orgcmd{C-u C-u C-u @key{TAB},show-all} 1285@orgcmd{C-u C-u C-u @key{TAB},outline-show-all}
1303Show all, including drawers. 1286Show all, including drawers.
1304@cindex revealing context 1287@cindex revealing context
1305@orgcmd{C-c C-r,org-reveal} 1288@orgcmd{C-c C-r,org-reveal}
@@ -1310,37 +1293,25 @@ exposed by a sparse tree command (@pxref{Sparse trees}) or an agenda command
1310level, all sibling headings. With a double prefix argument, also show the 1293level, all sibling headings. With a double prefix argument, also show the
1311entire subtree of the parent. 1294entire subtree of the parent.
1312@cindex show branches, command 1295@cindex show branches, command
1313@orgcmd{C-c C-k,show-branches} 1296@orgcmd{C-c C-k,outline-show-branches}
1314Expose all the headings of the subtree, CONTENT view for just one subtree. 1297Expose all the headings of the subtree, CONTENT view for just one subtree.
1315@cindex show children, command 1298@cindex show children, command
1316@orgcmd{C-c @key{TAB},show-children} 1299@orgcmd{C-c @key{TAB},outline-show-children}
1317Expose all direct children of the subtree. With a numeric prefix argument N, 1300Expose all direct children of the subtree. With a numeric prefix argument N,
1318expose all children down to level N@. 1301expose all children down to level N@.
1319@orgcmd{C-c C-x b,org-tree-to-indirect-buffer} 1302@orgcmd{C-c C-x b,org-tree-to-indirect-buffer}
1320Show the current subtree in an indirect buffer@footnote{The indirect 1303Show the current subtree in an indirect buffer@footnote{The indirect buffer
1321buffer 1304(@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual}) will contain the entire
1322@ifinfo 1305buffer, but will be narrowed to the current tree. Editing the indirect
1323(@pxref{Indirect Buffers,,,emacs,GNU Emacs Manual}) 1306buffer will also change the original buffer, but without affecting visibility
1324@end ifinfo 1307in that buffer.}. With a numeric prefix argument N, go up to level N and
1325@ifnotinfo 1308then take that tree. If N is negative then go up that many levels. With a
1326(see the Emacs manual for more information about indirect buffers) 1309@kbd{C-u} prefix, do not remove the previously used indirect buffer.
1327@end ifnotinfo
1328will contain the entire buffer, but will be narrowed to the current
1329tree. Editing the indirect buffer will also change the original buffer,
1330but without affecting visibility in that buffer.}. With a numeric
1331prefix argument N, go up to level N and then take that tree. If N is
1332negative then go up that many levels. With a @kbd{C-u} prefix, do not remove
1333the previously used indirect buffer.
1334@orgcmd{C-c C-x v,org-copy-visible} 1310@orgcmd{C-c C-x v,org-copy-visible}
1335Copy the @i{visible} text in the region into the kill ring. 1311Copy the @i{visible} text in the region into the kill ring.
1336@end table 1312@end table
1337 1313
1338@menu 1314@node Initial visibility
1339* Initial visibility:: Setting the initial visibility state
1340* Catching invisible edits:: Preventing mistakes when editing invisible parts
1341@end menu
1342
1343@node Initial visibility, Catching invisible edits, Global and local cycling, Visibility cycling
1344@subsection Initial visibility 1315@subsection Initial visibility
1345 1316
1346@cindex visibility, initialize 1317@cindex visibility, initialize
@@ -1366,14 +1337,10 @@ following lines anywhere in the buffer:
1366#+STARTUP: showeverything 1337#+STARTUP: showeverything
1367@end example 1338@end example
1368 1339
1369The startup visibility options are ignored when the file is open for the
1370first time during the agenda generation: if you want the agenda to honor
1371the startup visibility, set @code{org-agenda-inhibit-startup} to @code{nil}.
1372
1373@cindex property, VISIBILITY 1340@cindex property, VISIBILITY
1374@noindent 1341@noindent
1375Furthermore, any entries with a @samp{VISIBILITY} property (@pxref{Properties 1342Furthermore, any entries with a @samp{VISIBILITY} property (@pxref{Properties
1376and Columns}) will get their visibility adapted accordingly. Allowed values 1343and columns}) will get their visibility adapted accordingly. Allowed values
1377for this property are @code{folded}, @code{children}, @code{content}, and 1344for this property are @code{folded}, @code{children}, @code{content}, and
1378@code{all}. 1345@code{all}.
1379 1346
@@ -1384,7 +1351,7 @@ requested by startup options and @samp{VISIBILITY} properties in individual
1384entries. 1351entries.
1385@end table 1352@end table
1386 1353
1387@node Catching invisible edits, , Initial visibility, Visibility cycling 1354@node Catching invisible edits
1388@subsection Catching invisible edits 1355@subsection Catching invisible edits
1389 1356
1390@vindex org-catch-invisible-edits 1357@vindex org-catch-invisible-edits
@@ -1395,7 +1362,7 @@ confused on what has been edited and how to undo the mistake. Setting
1395docstring of this option on how Org should catch invisible edits and process 1362docstring of this option on how Org should catch invisible edits and process
1396them. 1363them.
1397 1364
1398@node Motion, Structure editing, Visibility cycling, Document Structure 1365@node Motion
1399@section Motion 1366@section Motion
1400@cindex motion, between headlines 1367@cindex motion, between headlines
1401@cindex jumping, to headlines 1368@cindex jumping, to headlines
@@ -1403,9 +1370,9 @@ them.
1403The following commands jump to other headlines in the buffer. 1370The following commands jump to other headlines in the buffer.
1404 1371
1405@table @asis 1372@table @asis
1406@orgcmd{C-c C-n,outline-next-visible-heading} 1373@orgcmd{C-c C-n,org-next-visible-heading}
1407Next heading. 1374Next heading.
1408@orgcmd{C-c C-p,outline-previous-visible-heading} 1375@orgcmd{C-c C-p,org-previous-visible-heading}
1409Previous heading. 1376Previous heading.
1410@orgcmd{C-c C-f,org-forward-same-level} 1377@orgcmd{C-c C-f,org-forward-same-level}
1411Next heading same level. 1378Next heading same level.
@@ -1435,7 +1402,7 @@ q @r{Quit}
1435See also the option @code{org-goto-interface}. 1402See also the option @code{org-goto-interface}.
1436@end table 1403@end table
1437 1404
1438@node Structure editing, Sparse trees, Motion, Document Structure 1405@node Structure editing
1439@section Structure editing 1406@section Structure editing
1440@cindex structure editing 1407@cindex structure editing
1441@cindex headline, promotion and demotion 1408@cindex headline, promotion and demotion
@@ -1451,24 +1418,23 @@ See also the option @code{org-goto-interface}.
1451@table @asis 1418@table @asis
1452@orgcmd{M-@key{RET},org-insert-heading} 1419@orgcmd{M-@key{RET},org-insert-heading}
1453@vindex org-M-RET-may-split-line 1420@vindex org-M-RET-may-split-line
1454Insert a new heading/item with the same level than the one at point. 1421Insert a new heading/item with the same level as the one at point.
1455If the cursor is in a plain list item, a new item is created 1422
1456(@pxref{Plain lists}). To prevent this behavior in lists, call the 1423If the command is used at the @emph{beginning} of a line, and if there is
1457command with a prefix argument. When this command is used in the 1424a heading or a plain list item (@pxref{Plain lists}) at point, the new
1458middle of a line, the line is split and the rest of the line becomes 1425heading/item is created @emph{before} the current line. When used at the
1459the new item or headline@footnote{If you do not want the line to be 1426beginning of a regular line of text, turn that line into a heading.
1460split, customize the variable @code{org-M-RET-may-split-line}.}. If 1427
1461the command is used at the @emph{beginning} of a headline, the new 1428When this command is used in the middle of a line, the line is split and the
1462headline is created before the current line. If the command is used 1429rest of the line becomes the new item or headline. If you do not want the
1463at the @emph{end} of a folded subtree (i.e., behind the ellipses at 1430line to be split, customize @code{org-M-RET-may-split-line}.
1464the end of a headline), then a headline will be 1431
1465inserted after the end of the subtree. Calling this command with 1432Calling the command with a @kbd{C-u} prefix unconditionally inserts a new
1466@kbd{C-u C-u} will unconditionally respect the headline's content and 1433heading at the end of the current subtree, thus preserving its contents.
1467create a new item at the end of the parent subtree. 1434With a double @kbd{C-u C-u} prefix, the new heading is created at the end of
1435the parent subtree instead.
1468@orgcmd{C-@key{RET},org-insert-heading-respect-content} 1436@orgcmd{C-@key{RET},org-insert-heading-respect-content}
1469Just like @kbd{M-@key{RET}}, except when adding a new heading below the 1437Insert a new heading at the end of the current subtree.
1470current heading, the new heading is placed after the body instead of before
1471it. This command works from anywhere in the entry.
1472@orgcmd{M-S-@key{RET},org-insert-todo-heading} 1438@orgcmd{M-S-@key{RET},org-insert-todo-heading}
1473@vindex org-treat-insert-todo-heading-as-state-change 1439@vindex org-treat-insert-todo-heading-as-state-change
1474Insert new TODO entry with same level as current heading. See also the 1440Insert new TODO entry with same level as current heading. See also the
@@ -1572,33 +1538,29 @@ inside a table (@pxref{Tables}), the Meta-Cursor keys have different
1572functionality. 1538functionality.
1573 1539
1574 1540
1575@node Sparse trees, Plain lists, Structure editing, Document Structure 1541@node Sparse trees
1576@section Sparse trees 1542@section Sparse trees
1577@cindex sparse trees 1543@cindex sparse trees
1578@cindex trees, sparse 1544@cindex trees, sparse
1579@cindex folding, sparse trees 1545@cindex folding, sparse trees
1580@cindex occur, command 1546@cindex occur, command
1581 1547
1582@vindex org-show-hierarchy-above 1548@vindex org-show-context-detail
1583@vindex org-show-following-heading
1584@vindex org-show-siblings
1585@vindex org-show-entry-below
1586An important feature of Org mode is the ability to construct @emph{sparse 1549An important feature of Org mode is the ability to construct @emph{sparse
1587trees} for selected information in an outline tree, so that the entire 1550trees} for selected information in an outline tree, so that the entire
1588document is folded as much as possible, but the selected information is made 1551document is folded as much as possible, but the selected information is made
1589visible along with the headline structure above it@footnote{See also the 1552visible along with the headline structure above it@footnote{See also the
1590variables @code{org-show-hierarchy-above}, @code{org-show-following-heading}, 1553variable @code{org-show-context-detail} to decide how much context is shown
1591@code{org-show-siblings}, and @code{org-show-entry-below} for detailed 1554around each match.}. Just try it out and you will see immediately how it
1592control on how much context is shown around each match.}. Just try it out 1555works.
1593and you will see immediately how it works.
1594 1556
1595Org mode contains several commands creating such trees, all these 1557Org mode contains several commands for creating such trees, all these
1596commands can be accessed through a dispatcher: 1558commands can be accessed through a dispatcher:
1597 1559
1598@table @asis 1560@table @asis
1599@orgcmd{C-c /,org-sparse-tree} 1561@orgcmd{C-c /,org-sparse-tree}
1600This prompts for an extra key to select a sparse-tree creating command. 1562This prompts for an extra key to select a sparse-tree creating command.
1601@orgcmd{C-c / r,org-occur} 1563@orgcmdkkc{C-c / r,C-c / /,org-occur}
1602@vindex org-remove-highlights-with-change 1564@vindex org-remove-highlights-with-change
1603Prompts for a regexp and shows a sparse tree with all matches. If 1565Prompts for a regexp and shows a sparse tree with all matches. If
1604the match is in a headline, the headline is made visible. If the match is in 1566the match is in a headline, the headline is made visible. If the match is in
@@ -1639,13 +1601,11 @@ tags, or properties and will be discussed later in this manual.
1639@cindex printing sparse trees 1601@cindex printing sparse trees
1640@cindex visible text, printing 1602@cindex visible text, printing
1641To print a sparse tree, you can use the Emacs command 1603To print a sparse tree, you can use the Emacs command
1642@code{ps-print-buffer-with-faces} which does not print invisible parts 1604@code{ps-print-buffer-with-faces} which does not print invisible parts of the
1643of the document @footnote{This does not work under XEmacs, because 1605document. Or you can use @kbd{C-c C-e C-v} to export only the visible part
1644XEmacs uses selective display for outlining, not text properties.}. 1606of the document and print the resulting file.
1645Or you can use @kbd{C-c C-e C-v} to export only the visible part of
1646the document and print the resulting file.
1647 1607
1648@node Plain lists, Drawers, Sparse trees, Document Structure 1608@node Plain lists
1649@section Plain lists 1609@section Plain lists
1650@cindex plain lists 1610@cindex plain lists
1651@cindex lists, plain 1611@cindex lists, plain
@@ -1714,25 +1674,23 @@ In that case, all items are closed. Here is an example:
1714 But in the end, no individual scenes matter but the film as a whole. 1674 But in the end, no individual scenes matter but the film as a whole.
1715 Important actors in this film are: 1675 Important actors in this film are:
1716 - @b{Elijah Wood} :: He plays Frodo 1676 - @b{Elijah Wood} :: He plays Frodo
1717 - @b{Sean Austin} :: He plays Sam, Frodo's friend. I still remember 1677 - @b{Sean Astin} :: He plays Sam, Frodo's friend. I still remember
1718 him very well from his role as Mikey Walsh in @i{The Goonies}. 1678 him very well from his role as Mikey Walsh in @i{The Goonies}.
1719@end group 1679@end group
1720@end example 1680@end example
1721 1681
1722Org supports these lists by tuning filling and wrapping commands to deal with 1682Org supports these lists by tuning filling and wrapping commands to deal with
1723them correctly@footnote{Org only changes the filling settings for Emacs. For 1683them correctly, and by exporting them properly (@pxref{Exporting}). Since
1724XEmacs, you should use Kyle E. Jones' @file{filladapt.el}. To turn this on, 1684indentation is what governs the structure of these lists, many structural
1725put into @file{.emacs}: @code{(require 'filladapt)}}, and by exporting them 1685constructs like @code{#+BEGIN_...} blocks can be indented to signal that they
1726properly (@pxref{Exporting}). Since indentation is what governs the 1686belong to a particular item.
1727structure of these lists, many structural constructs like @code{#+BEGIN_...}
1728blocks can be indented to signal that they belong to a particular item.
1729 1687
1730@vindex org-list-demote-modify-bullet 1688@vindex org-list-demote-modify-bullet
1731@vindex org-list-indent-offset 1689@vindex org-list-indent-offset
1732If you find that using a different bullet for a sub-list (than that used for 1690If you find that using a different bullet for a sub-list (than that used for
1733the current list-level) improves readability, customize the variable 1691the current list-level) improves readability, customize the variable
1734@code{org-list-demote-modify-bullet}. To get a greater difference of 1692@code{org-list-demote-modify-bullet}. To get a greater difference of
1735indentation between items and theirs sub-items, customize 1693indentation between items and their sub-items, customize
1736@code{org-list-indent-offset}. 1694@code{org-list-indent-offset}.
1737 1695
1738@vindex org-list-automatic-rules 1696@vindex org-list-automatic-rules
@@ -1824,10 +1782,10 @@ Cycle the entire list level through the different itemize/enumerate bullets
1824(@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}) or a subset of them, 1782(@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}) or a subset of them,
1825depending on @code{org-plain-list-ordered-item-terminator}, the type of list, 1783depending on @code{org-plain-list-ordered-item-terminator}, the type of list,
1826and its indentation. With a numeric prefix argument N, select the Nth bullet 1784and its indentation. With a numeric prefix argument N, select the Nth bullet
1827from this list. If there is an active region when calling this, selected 1785from this list. If there is an active region when calling this, all selected
1828text will be changed into an item. With a prefix argument, all lines will be 1786lines are converted to list items. With a prefix argument, selected text is
1829converted to list items. If the first line already was a list item, any item 1787changed into a single item. If the first line already was a list item, any
1830marker will be removed from the list. Finally, even without an active 1788item marker will be removed from the list. Finally, even without an active
1831region, a normal line will be converted into a list item. 1789region, a normal line will be converted into a list item.
1832@kindex C-c * 1790@kindex C-c *
1833@item C-c * 1791@item C-c *
@@ -1853,20 +1811,17 @@ numerically, alphabetically, by time, by checked status for check lists,
1853or by a custom function. 1811or by a custom function.
1854@end table 1812@end table
1855 1813
1856@node Drawers, Blocks, Plain lists, Document Structure 1814@node Drawers
1857@section Drawers 1815@section Drawers
1858@cindex drawers 1816@cindex drawers
1859@cindex #+DRAWERS
1860@cindex visibility cycling, drawers 1817@cindex visibility cycling, drawers
1861 1818
1862@vindex org-drawers
1863@cindex org-insert-drawer 1819@cindex org-insert-drawer
1864@kindex C-c C-x d 1820@kindex C-c C-x d
1865Sometimes you want to keep information associated with an entry, but you 1821Sometimes you want to keep information associated with an entry, but you
1866normally don't want to see it. For this, Org mode has @emph{drawers}. 1822normally don't want to see it. For this, Org mode has @emph{drawers}. They
1867Drawers need to be configured with the option @code{org-drawers}@footnote{You 1823can contain anything but a headline and another drawer. Drawers look like
1868can define additional drawers on a per-file basis with a line like 1824this:
1869@code{#+DRAWERS: HIDDEN STATE}}. Drawers look like this:
1870 1825
1871@example 1826@example
1872** This is a headline 1827** This is a headline
@@ -1880,18 +1835,21 @@ can define additional drawers on a per-file basis with a line like
1880You can interactively insert drawers at point by calling 1835You can interactively insert drawers at point by calling
1881@code{org-insert-drawer}, which is bound to @key{C-c C-x d}. With an active 1836@code{org-insert-drawer}, which is bound to @key{C-c C-x d}. With an active
1882region, this command will put the region inside the drawer. With a prefix 1837region, this command will put the region inside the drawer. With a prefix
1883argument, this command calls @code{org-insert-property-drawer} and add a 1838argument, this command calls @code{org-insert-property-drawer} and add
1884property drawer right below the current headline. Completion over drawer 1839a property drawer right below the current headline. Completion over drawer
1885keywords is also possible using @key{M-TAB}. 1840keywords is also possible using @kbd{M-@key{TAB}}@footnote{Many desktops
1841intercept @kbd{M-@key{TAB}} to switch windows. Use @kbd{C-M-i} or
1842@kbd{@key{ESC} @key{TAB}} instead for completion (@pxref{Completion}).}.
1886 1843
1887Visibility cycling (@pxref{Visibility cycling}) on the headline will hide and 1844Visibility cycling (@pxref{Visibility cycling}) on the headline will hide and
1888show the entry, but keep the drawer collapsed to a single line. In order to 1845show the entry, but keep the drawer collapsed to a single line. In order to
1889look inside the drawer, you need to move the cursor to the drawer line and 1846look inside the drawer, you need to move the cursor to the drawer line and
1890press @key{TAB} there. Org mode uses the @code{PROPERTIES} drawer for 1847press @key{TAB} there. Org mode uses the @code{PROPERTIES} drawer for
1891storing properties (@pxref{Properties and Columns}), and you can also arrange 1848storing properties (@pxref{Properties and columns}), and you can also arrange
1892for state change notes (@pxref{Tracking TODO state changes}) and clock times 1849for state change notes (@pxref{Tracking TODO state changes}) and clock times
1893(@pxref{Clocking work time}) to be stored in a drawer @code{LOGBOOK}. If you 1850(@pxref{Clocking work time}) to be stored in a drawer @code{LOGBOOK}. If you
1894want to store a quick note in the LOGBOOK drawer, in a similar way to state changes, use 1851want to store a quick note in the LOGBOOK drawer, in a similar way to state
1852changes, use
1895 1853
1896@table @kbd 1854@table @kbd
1897@kindex C-c C-z 1855@kindex C-c C-z
@@ -1900,12 +1858,13 @@ Add a time-stamped note to the LOGBOOK drawer.
1900@end table 1858@end table
1901 1859
1902@vindex org-export-with-drawers 1860@vindex org-export-with-drawers
1861@vindex org-export-with-properties
1903You can select the name of the drawers which should be exported with 1862You can select the name of the drawers which should be exported with
1904@code{org-export-with-drawers}. In that case, drawer contents will appear in 1863@code{org-export-with-drawers}. In that case, drawer contents will appear in
1905export output. Property drawers are not affected by this variable and are 1864export output. Property drawers are not affected by this variable: configure
1906never exported. 1865@code{org-export-with-properties} instead.
1907 1866
1908@node Blocks, Footnotes, Drawers, Document Structure 1867@node Blocks
1909@section Blocks 1868@section Blocks
1910 1869
1911@vindex org-hide-block-startup 1870@vindex org-hide-block-startup
@@ -1924,18 +1883,17 @@ or on a per-file basis by using
1924#+STARTUP: nohideblocks 1883#+STARTUP: nohideblocks
1925@end example 1884@end example
1926 1885
1927@node Footnotes, Orgstruct mode, Blocks, Document Structure 1886@node Footnotes
1928@section Footnotes 1887@section Footnotes
1929@cindex footnotes 1888@cindex footnotes
1930 1889
1931Org mode supports the creation of footnotes. In contrast to the 1890Org mode supports the creation of footnotes.
1932@file{footnote.el} package, Org mode's footnotes are designed for work on
1933a larger document, not only for one-off documents like emails.
1934 1891
1935A footnote is started by a footnote marker in square brackets in column 0, no 1892A footnote is started by a footnote marker in square brackets in column 0, no
1936indentation allowed. It ends at the next footnote definition, headline, or 1893indentation allowed. It ends at the next footnote definition, headline, or
1937after two consecutive empty lines. The footnote reference is simply the 1894after two consecutive empty lines. The footnote reference is simply the
1938marker in square brackets, inside text. For example: 1895marker in square brackets, inside text. Markers always start with
1896@code{fn:}. For example:
1939 1897
1940@example 1898@example
1941The Org homepage[fn:1] now looks a lot better than it used to. 1899The Org homepage[fn:1] now looks a lot better than it used to.
@@ -1944,23 +1902,16 @@ The Org homepage[fn:1] now looks a lot better than it used to.
1944@end example 1902@end example
1945 1903
1946Org mode extends the number-based syntax to @emph{named} footnotes and 1904Org mode extends the number-based syntax to @emph{named} footnotes and
1947optional inline definition. Using plain numbers as markers (as 1905optional inline definition. Here are the valid references:
1948@file{footnote.el} does) is supported for backward compatibility, but not
1949encouraged because of possible conflicts with @LaTeX{} snippets (@pxref{Embedded
1950@LaTeX{}}). Here are the valid references:
1951 1906
1952@table @code 1907@table @code
1953@item [1]
1954A plain numeric footnote marker. Compatible with @file{footnote.el}, but not
1955recommended because something like @samp{[1]} could easily be part of a code
1956snippet.
1957@item [fn:name] 1908@item [fn:name]
1958A named footnote reference, where @code{name} is a unique label word, or, for 1909A named footnote reference, where @code{name} is a unique label word, or, for
1959simplicity of automatic creation, a number. 1910simplicity of automatic creation, a number.
1960@item [fn:: This is the inline definition of this footnote] 1911@item [fn::This is the inline definition of this footnote]
1961A @LaTeX{}-like anonymous footnote where the definition is given directly at the 1912A @LaTeX{}-like anonymous footnote where the definition is given directly at the
1962reference point. 1913reference point.
1963@item [fn:name: a definition] 1914@item [fn:name:a definition]
1964An inline definition of a footnote, which also specifies a name for the note. 1915An inline definition of a footnote, which also specifies a name for the note.
1965Since Org allows multiple references to the same note, you can then use 1916Since Org allows multiple references to the same note, you can then use
1966@code{[fn:name]} to create additional references. 1917@code{[fn:name]} to create additional references.
@@ -2007,9 +1958,7 @@ r @r{Renumber the simple @code{fn:N} footnotes. Automatic renumbering}
2007S @r{Short for first @code{r}, then @code{s} action.} 1958S @r{Short for first @code{r}, then @code{s} action.}
2008n @r{Normalize the footnotes by collecting all definitions (including} 1959n @r{Normalize the footnotes by collecting all definitions (including}
2009 @r{inline definitions) into a special section, and then numbering them} 1960 @r{inline definitions) into a special section, and then numbering them}
2010 @r{in sequence. The references will then also be numbers. This is} 1961 @r{in sequence. The references will then also be numbers.}
2011 @r{meant to be the final step before finishing a document (e.g., sending}
2012 @r{off an email).}
2013d @r{Delete the footnote at point, and all definitions of and references} 1962d @r{Delete the footnote at point, and all definitions of and references}
2014 @r{to it.} 1963 @r{to it.}
2015@end example 1964@end example
@@ -2029,9 +1978,17 @@ location with a prefix argument, offer the same menu as @kbd{C-c C-x f}.
2029@item C-c C-o @r{or} mouse-1/2 1978@item C-c C-o @r{or} mouse-1/2
2030Footnote labels are also links to the corresponding definition/reference, and 1979Footnote labels are also links to the corresponding definition/reference, and
2031you can use the usual commands to follow these links. 1980you can use the usual commands to follow these links.
1981
1982@vindex org-edit-footnote-reference
1983@kindex C-c '
1984@item C-c '
1985@item C-c '
1986Edit the footnote definition corresponding to the reference at point in
1987a seperate window. The window can be closed by pressing @kbd{C-c '}.
1988
2032@end table 1989@end table
2033 1990
2034@node Orgstruct mode, Org syntax, Footnotes, Document Structure 1991@node Orgstruct mode
2035@section The Orgstruct minor mode 1992@section The Orgstruct minor mode
2036@cindex Orgstruct mode 1993@cindex Orgstruct mode
2037@cindex minor mode for structure editing 1994@cindex minor mode for structure editing
@@ -2066,7 +2023,7 @@ Lisp files, you will be able to fold and unfold headlines in Emacs Lisp
2066commented lines. Some commands like @code{org-demote} are disabled when the 2023commented lines. Some commands like @code{org-demote} are disabled when the
2067prefix is set, but folding/unfolding will work correctly. 2024prefix is set, but folding/unfolding will work correctly.
2068 2025
2069@node Org syntax, , Orgstruct mode, Document Structure 2026@node Org syntax
2070@section Org syntax 2027@section Org syntax
2071@cindex Org syntax 2028@cindex Org syntax
2072 2029
@@ -2088,7 +2045,11 @@ abstract structure. The export engine relies on the information stored in
2088this list. Most interactive commands (e.g., for structure editing) also 2045this list. Most interactive commands (e.g., for structure editing) also
2089rely on the syntactic meaning of the surrounding context. 2046rely on the syntactic meaning of the surrounding context.
2090 2047
2091@node Tables, Hyperlinks, Document Structure, Top 2048@cindex syntax checker
2049@cindex linter
2050You can check syntax in your documents using @code{org-lint} command.
2051
2052@node Tables
2092@chapter Tables 2053@chapter Tables
2093@cindex tables 2054@cindex tables
2094@cindex editing tables 2055@cindex editing tables
@@ -2106,7 +2067,7 @@ calculations are supported using the Emacs @file{calc} package
2106* Org-Plot:: Plotting from org tables 2067* Org-Plot:: Plotting from org tables
2107@end menu 2068@end menu
2108 2069
2109@node Built-in table editor, Column width and alignment, Tables, Tables 2070@node Built-in table editor
2110@section The built-in table editor 2071@section The built-in table editor
2111@cindex table editor, built-in 2072@cindex table editor, built-in
2112 2073
@@ -2155,12 +2116,13 @@ unpredictable for you, configure the options
2155@table @kbd 2116@table @kbd
2156@tsubheading{Creation and conversion} 2117@tsubheading{Creation and conversion}
2157@orgcmd{C-c |,org-table-create-or-convert-from-region} 2118@orgcmd{C-c |,org-table-create-or-convert-from-region}
2158Convert the active region to table. If every line contains at least one 2119Convert the active region to a table. If every line contains at least one
2159TAB character, the function assumes that the material is tab separated. 2120TAB character, the function assumes that the material is tab separated.
2160If every line contains a comma, comma-separated values (CSV) are assumed. 2121If every line contains a comma, comma-separated values (CSV) are assumed.
2161If not, lines are split at whitespace into fields. You can use a prefix 2122If not, lines are split at whitespace into fields. You can use a prefix
2162argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u 2123argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u
2163C-u} forces TAB, and a numeric argument N indicates that at least N 2124C-u} forces TAB, @kbd{C-u C-u C-u} will prompt for a regular expression to
2125match the separator, and a numeric argument N indicates that at least N
2164consecutive spaces, or alternatively a TAB will be the separator. 2126consecutive spaces, or alternatively a TAB will be the separator.
2165@* 2127@*
2166If there is no active region, this command creates an empty Org 2128If there is no active region, this command creates an empty Org
@@ -2171,7 +2133,10 @@ table. But it is easier just to start typing, like
2171@orgcmd{C-c C-c,org-table-align} 2133@orgcmd{C-c C-c,org-table-align}
2172Re-align the table and don't move to another field. 2134Re-align the table and don't move to another field.
2173@c 2135@c
2174@orgcmd{<TAB>,org-table-next-field} 2136@orgcmd{C-c SPC,org-table-blank-field}
2137Blank the field at point.
2138@c
2139@orgcmd{TAB,org-table-next-field}
2175Re-align the table, move to the next field. Creates a new row if 2140Re-align the table, move to the next field. Creates a new row if
2176necessary. 2141necessary.
2177@c 2142@c
@@ -2224,8 +2189,10 @@ point is before the first column, you will be prompted for the sorting
2224column. If there is an active region, the mark specifies the first line 2189column. If there is an active region, the mark specifies the first line
2225and the sorting column, while point should be in the last line to be 2190and the sorting column, while point should be in the last line to be
2226included into the sorting. The command prompts for the sorting type 2191included into the sorting. The command prompts for the sorting type
2227(alphabetically, numerically, or by time). When called with a prefix 2192(alphabetically, numerically, or by time). You can sort in normal or
2228argument, alphabetic sorting will be case-sensitive. 2193reverse order. You can also supply your own key extraction and comparison
2194functions. When called with a prefix argument, alphabetic sorting will be
2195case-sensitive.
2229 2196
2230@tsubheading{Regions} 2197@tsubheading{Regions}
2231@orgcmd{C-c C-x M-w,org-table-copy-region} 2198@orgcmd{C-c C-x M-w,org-table-copy-region}
@@ -2322,7 +2289,7 @@ it off with
2322@noindent Then the only table command that still works is 2289@noindent Then the only table command that still works is
2323@kbd{C-c C-c} to do a manual re-align. 2290@kbd{C-c C-c} to do a manual re-align.
2324 2291
2325@node Column width and alignment, Column groups, Built-in table editor, Tables 2292@node Column width and alignment
2326@section Column width and alignment 2293@section Column width and alignment
2327@cindex narrow columns in tables 2294@cindex narrow columns in tables
2328@cindex alignment in tables 2295@cindex alignment in tables
@@ -2333,11 +2300,11 @@ of number-like versus non-number fields in the column.
2333 2300
2334Sometimes a single field or a few fields need to carry more text, leading to 2301Sometimes a single field or a few fields need to carry more text, leading to
2335inconveniently wide columns. Or maybe you want to make a table with several 2302inconveniently wide columns. Or maybe you want to make a table with several
2336columns having a fixed width, regardless of content. To set@footnote{This 2303columns having a fixed width, regardless of content. To set the width of
2337feature does not work on XEmacs.} the width of a column, one field anywhere 2304a column, one field anywhere in the column may contain just the string
2338in the column may contain just the string @samp{<N>} where @samp{N} is an 2305@samp{<N>} where @samp{N} is an integer specifying the width of the column in
2339integer specifying the width of the column in characters. The next re-align 2306characters. The next re-align will then set the width of this column to this
2340will then set the width of this column to this value. 2307value.
2341 2308
2342@example 2309@example
2343@group 2310@group
@@ -2374,7 +2341,7 @@ on a per-file basis with:
2374@end example 2341@end example
2375 2342
2376If you would like to overrule the automatic alignment of number-rich columns 2343If you would like to overrule the automatic alignment of number-rich columns
2377to the right and of string-rich column to the left, you can use @samp{<r>}, 2344to the right and of string-rich columns to the left, you can use @samp{<r>},
2378@samp{<c>}@footnote{Centering does not work inside Emacs, but it does have an 2345@samp{<c>}@footnote{Centering does not work inside Emacs, but it does have an
2379effect when exporting to HTML.} or @samp{<l>} in a similar fashion. You may 2346effect when exporting to HTML.} or @samp{<l>} in a similar fashion. You may
2380also combine alignment and field width like this: @samp{<r10>}. 2347also combine alignment and field width like this: @samp{<r10>}.
@@ -2382,30 +2349,29 @@ also combine alignment and field width like this: @samp{<r10>}.
2382Lines which only contain these formatting cookies will be removed 2349Lines which only contain these formatting cookies will be removed
2383automatically when exporting the document. 2350automatically when exporting the document.
2384 2351
2385@node Column groups, Orgtbl mode, Column width and alignment, Tables 2352@node Column groups
2386@section Column groups 2353@section Column groups
2387@cindex grouping columns in tables 2354@cindex grouping columns in tables
2388 2355
2389When Org exports tables, it does so by default without vertical 2356When Org exports tables, it does so by default without vertical lines because
2390lines because that is visually more satisfying in general. Occasionally 2357that is visually more satisfying in general. Occasionally however, vertical
2391however, vertical lines can be useful to structure a table into groups 2358lines can be useful to structure a table into groups of columns, much like
2392of columns, much like horizontal lines can do for groups of rows. In 2359horizontal lines can do for groups of rows. In order to specify column
2393order to specify column groups, you can use a special row where the 2360groups, you can use a special row where the first field contains only
2394first field contains only @samp{/}. The further fields can either 2361@samp{/}. The further fields can either contain @samp{<} to indicate that
2395contain @samp{<} to indicate that this column should start a group, 2362this column should start a group, @samp{>} to indicate the end of a group, or
2396@samp{>} to indicate the end of a column, or @samp{<>} (no space between @samp{<} 2363@samp{<>} (no space between @samp{<} and @samp{>}) to make a column a group
2397and @samp{>}) to make a column 2364of its own. Boundaries between column groups will upon export be marked with
2398a group of its own. Boundaries between column groups will upon export be 2365vertical lines. Here is an example:
2399marked with vertical lines. Here is an example: 2366
2400 2367@example
2401@example 2368| N | N^2 | N^3 | N^4 | ~sqrt(n)~ | ~sqrt[4](N)~ |
2402| N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | 2369|---+-----+-----+-----+-----------+--------------|
2403|---+-----+-----+-----+---------+------------| 2370| / | < | | > | < | > |
2404| / | < | | > | < | > | 2371| 1 | 1 | 1 | 1 | 1 | 1 |
2405| 1 | 1 | 1 | 1 | 1 | 1 | 2372| 2 | 4 | 8 | 16 | 1.4142 | 1.1892 |
2406| 2 | 4 | 8 | 16 | 1.4142 | 1.1892 | 2373| 3 | 9 | 27 | 81 | 1.7321 | 1.3161 |
2407| 3 | 9 | 27 | 81 | 1.7321 | 1.3161 | 2374|---+-----+-----+-----+-----------+--------------|
2408|---+-----+-----+-----+---------+------------|
2409#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1))) 2375#+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
2410@end example 2376@end example
2411 2377
@@ -2418,7 +2384,7 @@ every vertical line you would like to have:
2418| / | < | | | < | | 2384| / | < | | | < | |
2419@end example 2385@end example
2420 2386
2421@node Orgtbl mode, The spreadsheet, Column groups, Tables 2387@node Orgtbl mode
2422@section The Orgtbl minor mode 2388@section The Orgtbl minor mode
2423@cindex Orgtbl mode 2389@cindex Orgtbl mode
2424@cindex minor mode for tables 2390@cindex minor mode for tables
@@ -2439,7 +2405,7 @@ construct @LaTeX{} tables with the underlying ease and power of
2439Orgtbl mode, including spreadsheet capabilities. For details, see 2405Orgtbl mode, including spreadsheet capabilities. For details, see
2440@ref{Tables in arbitrary syntax}. 2406@ref{Tables in arbitrary syntax}.
2441 2407
2442@node The spreadsheet, Org-Plot, Orgtbl mode, Tables 2408@node The spreadsheet
2443@section The spreadsheet 2409@section The spreadsheet
2444@cindex calculations, in tables 2410@cindex calculations, in tables
2445@cindex spreadsheet capabilities 2411@cindex spreadsheet capabilities
@@ -2468,7 +2434,7 @@ formula, moving these references by arrow keys
2468* Advanced features:: Field and column names, parameters and automatic recalc 2434* Advanced features:: Field and column names, parameters and automatic recalc
2469@end menu 2435@end menu
2470 2436
2471@node References, Formula syntax for Calc, The spreadsheet, The spreadsheet 2437@node References
2472@subsection References 2438@subsection References
2473@cindex references 2439@cindex references
2474 2440
@@ -2554,7 +2520,7 @@ format at least for the first field (i.e the reference must start with
2554@example 2520@example
2555$1..$3 @r{first three fields in the current row} 2521$1..$3 @r{first three fields in the current row}
2556$P..$Q @r{range, using column names (see under Advanced)} 2522$P..$Q @r{range, using column names (see under Advanced)}
2557$<<<..$>> @r{start in third column, continue to the one but last} 2523$<<<..$>> @r{start in third column, continue to the last but one}
2558@@2$1..@@4$3 @r{6 fields between these two fields (same as @code{A2..C4})} 2524@@2$1..@@4$3 @r{6 fields between these two fields (same as @code{A2..C4})}
2559@@-1$-2..@@-1 @r{3 fields in the row above, starting from 2 columns on the left} 2525@@-1$-2..@@-1 @r{3 fields in the row above, starting from 2 columns on the left}
2560@@I..II @r{between first and second hline, short for @code{@@I..@@II}} 2526@@I..II @r{between first and second hline, short for @code{@@I..@@II}}
@@ -2572,21 +2538,28 @@ for Calc}.
2572@cindex row, of field coordinates 2538@cindex row, of field coordinates
2573@cindex column, of field coordinates 2539@cindex column, of field coordinates
2574 2540
2575For Calc formulas and Lisp formulas @code{@@#} and @code{$#} can be used to 2541One of the very first actions during evaluation of Calc formulas and Lisp
2576get the row or column number of the field where the formula result goes. 2542formulas is to substitute @code{@@#} and @code{$#} in the formula with the
2577The traditional Lisp formula equivalents are @code{org-table-current-dline} 2543row or column number of the field where the current result will go to. The
2578and @code{org-table-current-column}. Examples: 2544traditional Lisp formula equivalents are @code{org-table-current-dline} and
2545@code{org-table-current-column}. Examples:
2579 2546
2580@example 2547@table @code
2581if(@@# % 2, $#, string("")) @r{column number on odd lines only} 2548@item if(@@# % 2, $#, string(""))
2582$3 = remote(FOO, @@@@#$2) @r{copy column 2 from table FOO into} 2549Insert column number on odd rows, set field to empty on even rows.
2583 @r{column 3 of the current table} 2550@item $2 = '(identity remote(FOO, @@@@#$1))
2584@end example 2551Copy text or values of each row of column 1 of the table named @code{FOO}
2552into column 2 of the current table.
2553@item @@3 = 2 * remote(FOO, @@1$$#)
2554Insert the doubled value of each column of row 1 of the table named
2555@code{FOO} into row 3 of the current table.
2556@end table
2585 2557
2586@noindent For the second example, table FOO must have at least as many rows 2558@noindent For the second/third example, the table named @code{FOO} must have
2587as the current table. Note that this is inefficient@footnote{The computation time scales as 2559at least as many rows/columns as the current table. Note that this is
2588O(N^2) because table FOO is parsed for each field to be copied.} for large 2560inefficient@footnote{The computation time scales as O(N^2) because the table
2589number of rows. 2561named @code{FOO} is parsed for each field to be read.} for large number of
2562rows/columns.
2590 2563
2591@subsubheading Named references 2564@subsubheading Named references
2592@cindex named references 2565@cindex named references
@@ -2608,7 +2581,7 @@ line like
2608@noindent 2581@noindent
2609@vindex constants-unit-system 2582@vindex constants-unit-system
2610@pindex constants.el 2583@pindex constants.el
2611Also properties (@pxref{Properties and Columns}) can be used as 2584Also properties (@pxref{Properties and columns}) can be used as
2612constants in table formulas: for a property @samp{:Xyz:} use the name 2585constants in table formulas: for a property @samp{:Xyz:} use the name
2613@samp{$PROP_Xyz}, and the property will be searched in the current 2586@samp{$PROP_Xyz}, and the property will be searched in the current
2614outline entry and in the hierarchy above it. If you have the 2587outline entry and in the hierarchy above it. If you have the
@@ -2647,7 +2620,13 @@ table in that entry. REF is an absolute field or range reference as
2647described above for example @code{@@3$3} or @code{$somename}, valid in the 2620described above for example @code{@@3$3} or @code{$somename}, valid in the
2648referenced table. 2621referenced table.
2649 2622
2650@node Formula syntax for Calc, Formula syntax for Lisp, References, The spreadsheet 2623Indirection of NAME-OR-ID: When NAME-OR-ID has the format @code{@@ROW$COLUMN}
2624it will be substituted with the name or ID found in this field of the current
2625table. For example @code{remote($1, @@>$2)} => @code{remote(year_2013,
2626@@>$1)}. The format @code{B3} is not supported because it can not be
2627distinguished from a plain table name or ID.
2628
2629@node Formula syntax for Calc
2651@subsection Formula syntax for Calc 2630@subsection Formula syntax for Calc
2652@cindex formula syntax, Calc 2631@cindex formula syntax, Calc
2653@cindex syntax, of formulas 2632@cindex syntax, of formulas
@@ -2762,7 +2741,7 @@ should be padded with 0 to the full size.
2762You can add your own Calc functions defined in Emacs Lisp with @code{defmath} 2741You can add your own Calc functions defined in Emacs Lisp with @code{defmath}
2763and use them in formula syntax for Calc. 2742and use them in formula syntax for Calc.
2764 2743
2765@node Formula syntax for Lisp, Durations and time values, Formula syntax for Calc, The spreadsheet 2744@node Formula syntax for Lisp
2766@subsection Emacs Lisp forms as formulas 2745@subsection Emacs Lisp forms as formulas
2767@cindex Lisp forms, as table formulas 2746@cindex Lisp forms, as table formulas
2768 2747
@@ -2798,7 +2777,7 @@ Add columns 1 and 2, equivalent to Calc's @code{$1+$2}.
2798Compute the sum of columns 1 to 4, like Calc's @code{vsum($1..$4)}. 2777Compute the sum of columns 1 to 4, like Calc's @code{vsum($1..$4)}.
2799@end table 2778@end table
2800 2779
2801@node Durations and time values, Field and range formulas, Formula syntax for Lisp, The spreadsheet 2780@node Durations and time values
2802@subsection Durations and time values 2781@subsection Durations and time values
2803@cindex Duration, computing 2782@cindex Duration, computing
2804@cindex Time, computing 2783@cindex Time, computing
@@ -2817,7 +2796,7 @@ formulas or Elisp formulas:
2817@end group 2796@end group
2818@end example 2797@end example
2819 2798
2820Input duration values must be of the form @code{[HH:MM[:SS]}, where seconds 2799Input duration values must be of the form @code{HH:MM[:SS]}, where seconds
2821are optional. With the @code{T} flag, computed durations will be displayed 2800are optional. With the @code{T} flag, computed durations will be displayed
2822as @code{HH:MM:SS} (see the first formula above). With the @code{t} flag, 2801as @code{HH:MM:SS} (see the first formula above). With the @code{t} flag,
2823computed durations will be displayed according to the value of the option 2802computed durations will be displayed according to the value of the option
@@ -2828,7 +2807,7 @@ example above).
2828Negative duration values can be manipulated as well, and integers will be 2807Negative duration values can be manipulated as well, and integers will be
2829considered as seconds in addition and subtraction. 2808considered as seconds in addition and subtraction.
2830 2809
2831@node Field and range formulas, Column formulas, Durations and time values, The spreadsheet 2810@node Field and range formulas
2832@subsection Field and range formulas 2811@subsection Field and range formulas
2833@cindex field formula 2812@cindex field formula
2834@cindex range formula 2813@cindex range formula
@@ -2845,13 +2824,13 @@ current field will be replaced with the result.
2845Formulas are stored in a special line starting with @samp{#+TBLFM:} directly 2824Formulas are stored in a special line starting with @samp{#+TBLFM:} directly
2846below the table. If you type the equation in the 4th field of the 3rd data 2825below the table. If you type the equation in the 4th field of the 3rd data
2847line in the table, the formula will look like @samp{@@3$4=$1+$2}. When 2826line in the table, the formula will look like @samp{@@3$4=$1+$2}. When
2848inserting/deleting/swapping column and rows with the appropriate commands, 2827inserting/deleting/swapping columns and rows with the appropriate commands,
2849@i{absolute references} (but not relative ones) in stored formulas are 2828@i{absolute references} (but not relative ones) in stored formulas are
2850modified in order to still reference the same field. To avoid this from 2829modified in order to still reference the same field. To avoid this, in
2851happening, in particular in range references, anchor ranges at the table 2830particular in range references, anchor ranges at the table borders (using
2852borders (using @code{@@<}, @code{@@>}, @code{$<}, @code{$>}), or at hlines 2831@code{@@<}, @code{@@>}, @code{$<}, @code{$>}), or at hlines using the
2853using the @code{@@I} notation. Automatic adaptation of field references does 2832@code{@@I} notation. Automatic adaptation of field references does of course
2854of course not happen if you edit the table structure with normal editing 2833not happen if you edit the table structure with normal editing
2855commands---then you must fix the equations yourself. 2834commands---then you must fix the equations yourself.
2856 2835
2857Instead of typing an equation into the field, you may also use the following 2836Instead of typing an equation into the field, you may also use the following
@@ -2884,7 +2863,7 @@ can also be used to assign a formula to some but not all fields in a row.
2884Named field, see @ref{Advanced features}. 2863Named field, see @ref{Advanced features}.
2885@end table 2864@end table
2886 2865
2887@node Column formulas, Lookup functions, Field and range formulas, The spreadsheet 2866@node Column formulas
2888@subsection Column formulas 2867@subsection Column formulas
2889@cindex column formula 2868@cindex column formula
2890@cindex formula, for table column 2869@cindex formula, for table column
@@ -2908,7 +2887,7 @@ and the current field replaced with the result. If the field contains only
2908@samp{=}, the previously stored formula for this column is used. For each 2887@samp{=}, the previously stored formula for this column is used. For each
2909column, Org will only remember the most recently used formula. In the 2888column, Org will only remember the most recently used formula. In the
2910@samp{#+TBLFM:} line, column formulas will look like @samp{$4=$1+$2}. The 2889@samp{#+TBLFM:} line, column formulas will look like @samp{$4=$1+$2}. The
2911left-hand side of a column formula can not be the name of column, it must be 2890left-hand side of a column formula cannot be the name of column, it must be
2912the numeric column reference or @code{$>}. 2891the numeric column reference or @code{$>}.
2913 2892
2914Instead of typing an equation into the field, you may also use the 2893Instead of typing an equation into the field, you may also use the
@@ -2923,7 +2902,7 @@ stores it. With a numeric prefix argument(e.g., @kbd{C-5 C-c =}) the command
2923will apply it to that many consecutive fields in the current column. 2902will apply it to that many consecutive fields in the current column.
2924@end table 2903@end table
2925 2904
2926@node Lookup functions, Editing and debugging formulas, Column formulas, The spreadsheet 2905@node Lookup functions
2927@subsection Lookup functions 2906@subsection Lookup functions
2928@cindex lookup functions in tables 2907@cindex lookup functions in tables
2929@cindex table lookup functions 2908@cindex table lookup functions
@@ -2967,7 +2946,7 @@ matching cells, rank results, group data etc. For practical examples
2967see @uref{http://orgmode.org/worg/org-tutorials/org-lookups.html, this 2946see @uref{http://orgmode.org/worg/org-tutorials/org-lookups.html, this
2968tutorial on Worg}. 2947tutorial on Worg}.
2969 2948
2970@node Editing and debugging formulas, Updating the table, Lookup functions, The spreadsheet 2949@node Editing and debugging formulas
2971@subsection Editing and debugging formulas 2950@subsection Editing and debugging formulas
2972@cindex formula editing 2951@cindex formula editing
2973@cindex editing, of table formulas 2952@cindex editing, of table formulas
@@ -3026,7 +3005,9 @@ a Lisp formula, format the formula according to Emacs Lisp rules.
3026Another @key{TAB} collapses the formula back again. In the open 3005Another @key{TAB} collapses the formula back again. In the open
3027formula, @key{TAB} re-indents just like in Emacs Lisp mode. 3006formula, @key{TAB} re-indents just like in Emacs Lisp mode.
3028@orgcmd{M-@key{TAB},lisp-complete-symbol} 3007@orgcmd{M-@key{TAB},lisp-complete-symbol}
3029Complete Lisp symbols, just like in Emacs Lisp mode. 3008Complete Lisp symbols, just like in Emacs Lisp mode.@footnote{Many desktops
3009intercept @kbd{M-@key{TAB}} to switch windows. Use @kbd{C-M-i} or
3010@kbd{@key{ESC} @key{TAB}} instead for completion (@pxref{Completion}).}
3030@kindex S-@key{up} 3011@kindex S-@key{up}
3031@kindex S-@key{down} 3012@kindex S-@key{down}
3032@kindex S-@key{left} 3013@kindex S-@key{left}
@@ -3118,7 +3099,7 @@ turn on formula debugging in the @code{Tbl} menu and repeat the
3118calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a 3099calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a
3119field. Detailed information will be displayed. 3100field. Detailed information will be displayed.
3120 3101
3121@node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet 3102@node Updating the table
3122@subsection Updating the table 3103@subsection Updating the table
3123@cindex recomputing table fields 3104@cindex recomputing table fields
3124@cindex updating, table 3105@cindex updating, table
@@ -3155,7 +3136,7 @@ Iterate all tables in the current buffer, in order to converge table-to-table
3155dependencies. 3136dependencies.
3156@end table 3137@end table
3157 3138
3158@node Advanced features, , Updating the table, The spreadsheet 3139@node Advanced features
3159@subsection Advanced features 3140@subsection Advanced features
3160 3141
3161If you want the recalculation of fields to happen automatically, or if you 3142If you want the recalculation of fields to happen automatically, or if you
@@ -3260,17 +3241,23 @@ functions.
3260@end group 3241@end group
3261@end example 3242@end example
3262 3243
3263@node Org-Plot, , The spreadsheet, Tables 3244@node Org-Plot
3264@section Org-Plot 3245@section Org-Plot
3265@cindex graph, in tables 3246@cindex graph, in tables
3266@cindex plot tables using Gnuplot 3247@cindex plot tables using Gnuplot
3267@cindex #+PLOT 3248@cindex #+PLOT
3268 3249
3269Org-Plot can produce 2D and 3D graphs of information stored in org tables 3250Org-Plot can produce graphs of information stored in org tables, either
3270using @file{Gnuplot} @uref{http://www.gnuplot.info/} and @file{gnuplot-mode} 3251graphically or in ASCII-art.
3252
3253@subheading Graphical plots using @file{Gnuplot}
3254
3255Org-Plot produces 2D and 3D graphs using @file{Gnuplot}
3256@uref{http://www.gnuplot.info/} and @file{gnuplot-mode}
3271@uref{http://xafs.org/BruceRavel/GnuplotMode}. To see this in action, ensure 3257@uref{http://xafs.org/BruceRavel/GnuplotMode}. To see this in action, ensure
3272that you have both Gnuplot and Gnuplot mode installed on your system, then 3258that you have both Gnuplot and Gnuplot mode installed on your system, then
3273call @code{org-plot/gnuplot} on the following table. 3259call @kbd{C-c " g} or @kbd{M-x org-plot/gnuplot @key{RET}} on the following
3260table.
3274 3261
3275@example 3262@example
3276@group 3263@group
@@ -3288,8 +3275,8 @@ call @code{org-plot/gnuplot} on the following table.
3288Notice that Org Plot is smart enough to apply the table's headers as labels. 3275Notice that Org Plot is smart enough to apply the table's headers as labels.
3289Further control over the labels, type, content, and appearance of plots can 3276Further control over the labels, type, content, and appearance of plots can
3290be exercised through the @code{#+PLOT:} lines preceding a table. See below 3277be exercised through the @code{#+PLOT:} lines preceding a table. See below
3291for a complete list of Org-plot options. For more information and examples 3278for a complete list of Org-plot options. The @code{#+PLOT:} lines are
3292see the Org-plot tutorial at 3279optional. For more information and examples see the Org-plot tutorial at
3293@uref{http://orgmode.org/worg/org-tutorials/org-plot.html}. 3280@uref{http://orgmode.org/worg/org-tutorials/org-plot.html}.
3294 3281
3295@subsubheading Plot Options 3282@subsubheading Plot Options
@@ -3345,7 +3332,48 @@ may still want to specify the plot type, as that can impact the content of
3345the data file. 3332the data file.
3346@end table 3333@end table
3347 3334
3348@node Hyperlinks, TODO Items, Tables, Top 3335@subheading ASCII bar plots
3336
3337While the cursor is on a column, typing @kbd{C-c " a} or
3338@kbd{M-x orgtbl-ascii-plot @key{RET}} create a new column containing an
3339ASCII-art bars plot. The plot is implemented through a regular column
3340formula. When the source column changes, the bar plot may be updated by
3341refreshing the table, for example typing @kbd{C-u C-c *}.
3342
3343@example
3344@group
3345| Sede | Max cites | |
3346|---------------+-----------+--------------|
3347| Chile | 257.72 | WWWWWWWWWWWW |
3348| Leeds | 165.77 | WWWWWWWh |
3349| Sao Paolo | 71.00 | WWW; |
3350| Stockholm | 134.19 | WWWWWW: |
3351| Morelia | 257.56 | WWWWWWWWWWWH |
3352| Rochefourchat | 0.00 | |
3353#+TBLFM: $3='(orgtbl-ascii-draw $2 0.0 257.72 12)
3354@end group
3355@end example
3356
3357The formula is an elisp call:
3358@lisp
3359(orgtbl-ascii-draw COLUMN MIN MAX WIDTH)
3360@end lisp
3361
3362@table @code
3363@item COLUMN
3364 is a reference to the source column.
3365
3366@item MIN MAX
3367 are the minimal and maximal values displayed. Sources values
3368 outside this range are displayed as @samp{too small}
3369 or @samp{too large}.
3370
3371@item WIDTH
3372 is the width in characters of the bar-plot. It defaults to @samp{12}.
3373
3374@end table
3375
3376@node Hyperlinks
3349@chapter Hyperlinks 3377@chapter Hyperlinks
3350@cindex hyperlinks 3378@cindex hyperlinks
3351 3379
@@ -3363,7 +3391,7 @@ other files, Usenet articles, emails, and much more.
3363* Custom searches:: When the default search is not enough 3391* Custom searches:: When the default search is not enough
3364@end menu 3392@end menu
3365 3393
3366@node Link format, Internal links, Hyperlinks, Hyperlinks 3394@node Link format
3367@section Link format 3395@section Link format
3368@cindex link format 3396@cindex link format
3369@cindex format, of links 3397@cindex format, of links
@@ -3394,7 +3422,7 @@ missing bracket hides the link internals again. To show the
3394internal structure of all links, use the menu entry 3422internal structure of all links, use the menu entry
3395@code{Org->Hyperlinks->Literal links}. 3423@code{Org->Hyperlinks->Literal links}.
3396 3424
3397@node Internal links, External links, Link format, Hyperlinks 3425@node Internal links
3398@section Internal links 3426@section Internal links
3399@cindex internal links 3427@cindex internal links
3400@cindex links, internal 3428@cindex links, internal
@@ -3419,8 +3447,8 @@ a @i{dedicated target}: the same string in double angular brackets, like
3419@cindex #+NAME 3447@cindex #+NAME
3420If no dedicated target exists, the link will then try to match the exact name 3448If no dedicated target exists, the link will then try to match the exact name
3421of an element within the buffer. Naming is done with the @code{#+NAME} 3449of an element within the buffer. Naming is done with the @code{#+NAME}
3422keyword, which has to be put the line before the element it refers to, as in 3450keyword, which has to be put in the line before the element it refers to, as
3423the following example 3451in the following example
3424 3452
3425@example 3453@example
3426#+NAME: My Target 3454#+NAME: My Target
@@ -3465,7 +3493,7 @@ earlier.
3465* Radio targets:: Make targets trigger links in plain text 3493* Radio targets:: Make targets trigger links in plain text
3466@end menu 3494@end menu
3467 3495
3468@node Radio targets, , Internal links, Internal links 3496@node Radio targets
3469@subsection Radio targets 3497@subsection Radio targets
3470@cindex radio targets 3498@cindex radio targets
3471@cindex targets, radio 3499@cindex targets, radio
@@ -3481,7 +3509,7 @@ for radio targets only when the file is first loaded into Emacs. To
3481update the target list during editing, press @kbd{C-c C-c} with the 3509update the target list during editing, press @kbd{C-c C-c} with the
3482cursor on or at a target. 3510cursor on or at a target.
3483 3511
3484@node External links, Handling links, Internal links, Hyperlinks 3512@node External links
3485@section External links 3513@section External links
3486@cindex links, external 3514@cindex links, external
3487@cindex external links 3515@cindex external links
@@ -3504,42 +3532,44 @@ string followed by a colon. There can be no space after the colon. The
3504following list shows examples for each link type. 3532following list shows examples for each link type.
3505 3533
3506@example 3534@example
3507http://www.astro.uva.nl/~dominik @r{on the web} 3535http://www.astro.uva.nl/~dominik @r{on the web}
3508doi:10.1000/182 @r{DOI for an electronic resource} 3536doi:10.1000/182 @r{DOI for an electronic resource}
3509file:/home/dominik/images/jupiter.jpg @r{file, absolute path} 3537file:/home/dominik/images/jupiter.jpg @r{file, absolute path}
3510/home/dominik/images/jupiter.jpg @r{same as above} 3538/home/dominik/images/jupiter.jpg @r{same as above}
3511file:papers/last.pdf @r{file, relative path} 3539file:papers/last.pdf @r{file, relative path}
3512./papers/last.pdf @r{same as above} 3540./papers/last.pdf @r{same as above}
3513file:/myself@@some.where:papers/last.pdf @r{file, path on remote machine} 3541file:/ssh:myself@@some.where:papers/last.pdf @r{file, path on remote machine}
3514/myself@@some.where:papers/last.pdf @r{same as above} 3542/ssh:myself@@some.where:papers/last.pdf @r{same as above}
3515file:sometextfile::NNN @r{file, jump to line number} 3543file:sometextfile::NNN @r{file, jump to line number}
3516file:projects.org @r{another Org file} 3544file:projects.org @r{another Org file}
3517file:projects.org::some words @r{text search in Org file}@footnote{ 3545file:projects.org::some words @r{text search in Org file}@footnote{
3518The actual behavior of the search will depend on the value of 3546The actual behavior of the search will depend on the value of
3519the option @code{org-link-search-must-match-exact-headline}. If its value 3547the option @code{org-link-search-must-match-exact-headline}. If its value
3520is @code{nil}, then a fuzzy text search will be done. If it is t, then only the 3548is @code{nil}, then a fuzzy text search will be done. If it is @code{t}, then only
3521exact headline will be matched. If the value is @code{'query-to-create}, 3549the exact headline will be matched, ignoring spaces and cookies. If the
3522then an exact headline will be searched; if it is not found, then the user 3550value is @code{query-to-create}, then an exact headline will be searched; if
3523will be queried to create it.} 3551it is not found, then the user will be queried to create it.}
3524file:projects.org::*task title @r{heading search in Org file} 3552file:projects.org::*task title @r{heading search in Org file}@footnote{
3525file+sys:/path/to/file @r{open via OS, like double-click} 3553Headline searches always match the exact headline, ignoring
3526file+emacs:/path/to/file @r{force opening by Emacs} 3554spaces and cookies. If the headline is not found and the value of the option
3527docview:papers/last.pdf::NNN @r{open in doc-view mode at page} 3555@code{org-link-search-must-match-exact-headline} is @code{query-to-create},
3528id:B7423F4D-2E8A-471B-8810-C40F074717E9 @r{Link to heading by ID} 3556then the user will be queried to create it.}
3529news:comp.emacs @r{Usenet link} 3557docview:papers/last.pdf::NNN @r{open in doc-view mode at page}
3530mailto:adent@@galaxy.net @r{Mail link} 3558id:B7423F4D-2E8A-471B-8810-C40F074717E9 @r{Link to heading by ID}
3531mhe:folder @r{MH-E folder link} 3559news:comp.emacs @r{Usenet link}
3532mhe:folder#id @r{MH-E message link} 3560mailto:adent@@galaxy.net @r{Mail link}
3533rmail:folder @r{RMAIL folder link} 3561mhe:folder @r{MH-E folder link}
3534rmail:folder#id @r{RMAIL message link} 3562mhe:folder#id @r{MH-E message link}
3535gnus:group @r{Gnus group link} 3563rmail:folder @r{RMAIL folder link}
3536gnus:group#id @r{Gnus article link} 3564rmail:folder#id @r{RMAIL message link}
3537bbdb:R.*Stallman @r{BBDB link (with regexp)} 3565gnus:group @r{Gnus group link}
3538irc:/irc.com/#emacs/bob @r{IRC link} 3566gnus:group#id @r{Gnus article link}
3539info:org#External links @r{Info node link} 3567bbdb:R.*Stallman @r{BBDB link (with regexp)}
3540shell:ls *.org @r{A shell command} 3568irc:/irc.com/#emacs/bob @r{IRC link}
3541elisp:org-agenda @r{Interactive Elisp command} 3569info:org#External links @r{Info node or index link}
3542elisp:(find-file-other-frame "Elisp.org") @r{Elisp form to evaluate} 3570shell:ls *.org @r{A shell command}
3571elisp:org-agenda @r{Interactive Elisp command}
3572elisp:(find-file-other-frame "Elisp.org") @r{Elisp form to evaluate}
3543@end example 3573@end example
3544 3574
3545@cindex VM links 3575@cindex VM links
@@ -3550,13 +3580,13 @@ to VM or Wanderlust messages are available when you load the corresponding
3550libraries from the @code{contrib/} directory: 3580libraries from the @code{contrib/} directory:
3551 3581
3552@example 3582@example
3553vm:folder @r{VM folder link} 3583vm:folder @r{VM folder link}
3554vm:folder#id @r{VM message link} 3584vm:folder#id @r{VM message link}
3555vm://myself@@some.where.org/folder#id @r{VM on remote machine} 3585vm://myself@@some.where.org/folder#id @r{VM on remote machine}
3556vm-imap:account:folder @r{VM IMAP folder link} 3586vm-imap:account:folder @r{VM IMAP folder link}
3557vm-imap:account:folder#id @r{VM IMAP message link} 3587vm-imap:account:folder#id @r{VM IMAP message link}
3558wl:folder @r{WANDERLUST folder link} 3588wl:folder @r{WANDERLUST folder link}
3559wl:folder#id @r{WANDERLUST message link} 3589wl:folder#id @r{WANDERLUST message link}
3560@end example 3590@end example
3561 3591
3562For customizing Org to add new link types @ref{Adding hyperlink types}. 3592For customizing Org to add new link types @ref{Adding hyperlink types}.
@@ -3582,7 +3612,7 @@ as links. If spaces must be part of the link (for example in
3582@samp{bbdb:Richard Stallman}), or if you need to remove ambiguities 3612@samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
3583about the end of the link, enclose them in square brackets. 3613about the end of the link, enclose them in square brackets.
3584 3614
3585@node Handling links, Using links outside Org, External links, Hyperlinks 3615@node Handling links
3586@section Handling links 3616@section Handling links
3587@cindex links, handling 3617@cindex links, handling
3588 3618
@@ -3614,9 +3644,9 @@ will be stored. In addition or alternatively (depending on the value of
3614be created and/or used to construct a link@footnote{The library 3644be created and/or used to construct a link@footnote{The library
3615@file{org-id.el} must first be loaded, either through @code{org-customize} by 3645@file{org-id.el} must first be loaded, either through @code{org-customize} by
3616enabling @code{org-id} in @code{org-modules}, or by adding @code{(require 3646enabling @code{org-id} in @code{org-modules}, or by adding @code{(require
3617'org-id)} in your @file{.emacs}.}. So using this command in Org buffers will 3647'org-id)} in your Emacs init file.}. So using this command in Org buffers
3618potentially create two links: a human-readable from the custom ID, and one 3648will potentially create two links: a human-readable from the custom ID, and
3619that is globally unique and works even if the entry is moved from file to 3649one that is globally unique and works even if the entry is moved from file to
3620file. Later, when inserting the link, you need to decide which one to use. 3650file. Later, when inserting the link, you need to decide which one to use.
3621 3651
3622@b{Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus}@* 3652@b{Email/News clients: VM, Rmail, Wanderlust, MH-E, Gnus}@*
@@ -3624,7 +3654,7 @@ Pretty much all Emacs mail clients are supported. The link will point to the
3624current article, or, in some GNUS buffers, to the group. The description is 3654current article, or, in some GNUS buffers, to the group. The description is
3625constructed from the author and the subject. 3655constructed from the author and the subject.
3626 3656
3627@b{Web browsers: W3 and W3M}@* 3657@b{Web browsers: Eww, W3 and W3M}@*
3628Here the link will be the current URL, with the page title as description. 3658Here the link will be the current URL, with the page title as description.
3629 3659
3630@b{Contacts: BBDB}@* 3660@b{Contacts: BBDB}@*
@@ -3656,7 +3686,8 @@ entry referenced by the current line.
3656@cindex completion, of links 3686@cindex completion, of links
3657@cindex inserting links 3687@cindex inserting links
3658@vindex org-keep-stored-link-after-insertion 3688@vindex org-keep-stored-link-after-insertion
3659Insert a link@footnote{ Note that you don't have to use this command to 3689@vindex org-link-parameters
3690Insert a link@footnote{Note that you don't have to use this command to
3660insert a link. Links in Org are plain text, and you can type or paste them 3691insert a link. Links in Org are plain text, and you can type or paste them
3661straight into the buffer. By using this command, the links are automatically 3692straight into the buffer. By using this command, the links are automatically
3662enclosed in double brackets, and you will be asked for the optional 3693enclosed in double brackets, and you will be asked for the optional
@@ -3679,11 +3710,12 @@ them with @key{up} and @key{down} (or @kbd{M-p/n}).
3679valid link prefixes like @samp{http:} or @samp{ftp:}, including the prefixes 3710valid link prefixes like @samp{http:} or @samp{ftp:}, including the prefixes
3680defined through link abbreviations (@pxref{Link abbreviations}). If you 3711defined through link abbreviations (@pxref{Link abbreviations}). If you
3681press @key{RET} after inserting only the @var{prefix}, Org will offer 3712press @key{RET} after inserting only the @var{prefix}, Org will offer
3682specific completion support for some link types@footnote{This works by 3713specific completion support for some link types@footnote{This works if
3683calling a special function @code{org-PREFIX-complete-link}.} For 3714a completion function is defined in the @samp{:complete} property of a link
3684example, if you type @kbd{file @key{RET}}, file name completion (alternative 3715in @code{org-link-parameters}.} For example, if you type @kbd{file
3685access: @kbd{C-u C-c C-l}, see below) will be offered, and after @kbd{bbdb 3716@key{RET}}, file name completion (alternative access: @kbd{C-u C-c C-l}, see
3686@key{RET}} you can complete contact names. 3717below) will be offered, and after @kbd{bbdb @key{RET}} you can complete
3718contact names.
3687@orgkey C-u C-c C-l 3719@orgkey C-u C-c C-l
3688@cindex file name completion 3720@cindex file name completion
3689@cindex completion, of file names 3721@cindex completion, of file names
@@ -3729,8 +3761,8 @@ the link at point.
3729@kindex mouse-1 3761@kindex mouse-1
3730@item mouse-2 3762@item mouse-2
3731@itemx mouse-1 3763@itemx mouse-1
3732On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o} 3764On links, @kbd{mouse-1} and @kbd{mouse-2} will open the link just as @kbd{C-c
3733would. Under Emacs 22 and later, @kbd{mouse-1} will also follow a link. 3765C-o} would.
3734@c 3766@c
3735@kindex mouse-3 3767@kindex mouse-3
3736@item mouse-3 3768@item mouse-3
@@ -3778,7 +3810,7 @@ to @kbd{C-n} and @kbd{C-p}
3778@end lisp 3810@end lisp
3779@end table 3811@end table
3780 3812
3781@node Using links outside Org, Link abbreviations, Handling links, Hyperlinks 3813@node Using links outside Org
3782@section Using links outside Org 3814@section Using links outside Org
3783 3815
3784You can insert and follow links that have Org syntax not only in 3816You can insert and follow links that have Org syntax not only in
@@ -3791,7 +3823,7 @@ yourself):
3791(global-set-key "\C-c o" 'org-open-at-point-global) 3823(global-set-key "\C-c o" 'org-open-at-point-global)
3792@end lisp 3824@end lisp
3793 3825
3794@node Link abbreviations, Search options, Using links outside Org, Hyperlinks 3826@node Link abbreviations
3795@section Link abbreviations 3827@section Link abbreviations
3796@cindex link abbreviations 3828@cindex link abbreviations
3797@cindex abbreviation, links 3829@cindex abbreviation, links
@@ -3830,8 +3862,8 @@ url-encode the tag (see the example above, where we need to encode
3830the URL parameter.) Using @samp{%(my-function)} will pass the tag 3862the URL parameter.) Using @samp{%(my-function)} will pass the tag
3831to a custom function, and replace it by the resulting string. 3863to a custom function, and replace it by the resulting string.
3832 3864
3833If the replacement text don't contain any specifier, it will simply 3865If the replacement text doesn't contain any specifier, the tag will simply be
3834be appended to the string in order to create the link. 3866appended in order to create the link.
3835 3867
3836Instead of a string, you may also specify a function that will be 3868Instead of a string, you may also specify a function that will be
3837called with the tag as the only argument to create the link. 3869called with the tag as the only argument to create the link.
@@ -3855,12 +3887,17 @@ can define them in the file with
3855 3887
3856@noindent 3888@noindent
3857In-buffer completion (@pxref{Completion}) can be used after @samp{[} to 3889In-buffer completion (@pxref{Completion}) can be used after @samp{[} to
3858complete link abbreviations. You may also define a function 3890complete link abbreviations. You may also define a function that implements
3859@code{org-PREFIX-complete-link} that implements special (e.g., completion) 3891special (e.g., completion) support for inserting such a link with @kbd{C-c
3860support for inserting such a link with @kbd{C-c C-l}. Such a function should 3892C-l}. Such a function should not accept any arguments, and return the full
3861not accept any arguments, and return the full link with prefix. 3893link with prefix. You can add a completion function to a link like this:
3894
3895@lisp
3896(org-link-set-parameters ``type'' :complete #'some-function)
3897@end lisp
3898
3862 3899
3863@node Search options, Custom searches, Link abbreviations, Hyperlinks 3900@node Search options
3864@section Search options in file links 3901@section Search options in file links
3865@cindex search option in file links 3902@cindex search option in file links
3866@cindex file links, searching 3903@cindex file links, searching
@@ -3912,7 +3949,7 @@ to search the current file. For example, @code{[[file:::find me]]} does
3912a search for @samp{find me} in the current file, just as 3949a search for @samp{find me} in the current file, just as
3913@samp{[[find me]]} would. 3950@samp{[[find me]]} would.
3914 3951
3915@node Custom searches, , Search options, Hyperlinks 3952@node Custom searches
3916@section Custom Searches 3953@section Custom Searches
3917@cindex custom search strings 3954@cindex custom search strings
3918@cindex search strings, custom 3955@cindex search strings, custom
@@ -3936,7 +3973,7 @@ variables for more information. Org actually uses this mechanism
3936for Bib@TeX{} database files, and you can use the corresponding code as 3973for Bib@TeX{} database files, and you can use the corresponding code as
3937an implementation example. See the file @file{org-bibtex.el}. 3974an implementation example. See the file @file{org-bibtex.el}.
3938 3975
3939@node TODO Items, Tags, Hyperlinks, Top 3976@node TODO items
3940@chapter TODO items 3977@chapter TODO items
3941@cindex TODO items 3978@cindex TODO items
3942 3979
@@ -3961,7 +3998,7 @@ methods to give you an overview of all the things that you have to do.
3961* Checkboxes:: Tick-off lists 3998* Checkboxes:: Tick-off lists
3962@end menu 3999@end menu
3963 4000
3964@node TODO basics, TODO extensions, TODO Items, TODO Items 4001@node TODO basics
3965@section Basic TODO functionality 4002@section Basic TODO functionality
3966 4003
3967Any headline becomes a TODO item when it starts with the word 4004Any headline becomes a TODO item when it starts with the word
@@ -4022,7 +4059,7 @@ N, show the tree for the Nth keyword in the option @code{org-todo-keywords}.
4022With two prefix arguments, find all TODO states, both un-done and done. 4059With two prefix arguments, find all TODO states, both un-done and done.
4023@orgcmd{C-c a t,org-todo-list} 4060@orgcmd{C-c a t,org-todo-list}
4024Show the global TODO list. Collects the TODO items (with not-DONE states) 4061Show the global TODO list. Collects the TODO items (with not-DONE states)
4025from all agenda files (@pxref{Agenda Views}) into a single buffer. The new 4062from all agenda files (@pxref{Agenda views}) into a single buffer. The new
4026buffer will be in @code{agenda-mode}, which provides commands to examine and 4063buffer will be in @code{agenda-mode}, which provides commands to examine and
4027manipulate the TODO entries from the new buffer (@pxref{Agenda commands}). 4064manipulate the TODO entries from the new buffer (@pxref{Agenda commands}).
4028@xref{Global TODO list}, for more information. 4065@xref{Global TODO list}, for more information.
@@ -4035,7 +4072,7 @@ Insert a new TODO entry below the current one.
4035Changing a TODO state can also trigger tag changes. See the docstring of the 4072Changing a TODO state can also trigger tag changes. See the docstring of the
4036option @code{org-todo-state-tags-triggers} for details. 4073option @code{org-todo-state-tags-triggers} for details.
4037 4074
4038@node TODO extensions, Progress logging, TODO basics, TODO Items 4075@node TODO extensions
4039@section Extended use of TODO keywords 4076@section Extended use of TODO keywords
4040@cindex extended TODO keywords 4077@cindex extended TODO keywords
4041 4078
@@ -4059,7 +4096,7 @@ TODO items in particular (@pxref{Tags}).
4059* TODO dependencies:: When one task needs to wait for others 4096* TODO dependencies:: When one task needs to wait for others
4060@end menu 4097@end menu
4061 4098
4062@node Workflow states, TODO types, TODO extensions, TODO extensions 4099@node Workflow states
4063@subsection TODO keywords as workflow states 4100@subsection TODO keywords as workflow states
4064@cindex TODO workflow 4101@cindex TODO workflow
4065@cindex workflow states as TODO keywords 4102@cindex workflow states as TODO keywords
@@ -4090,7 +4127,7 @@ define many keywords, you can use in-buffer completion
4090buffer. Changing a TODO state can be logged with a timestamp, see 4127buffer. Changing a TODO state can be logged with a timestamp, see
4091@ref{Tracking TODO state changes}, for more information. 4128@ref{Tracking TODO state changes}, for more information.
4092 4129
4093@node TODO types, Multiple sets in one file, Workflow states, TODO extensions 4130@node TODO types
4094@subsection TODO keywords as types 4131@subsection TODO keywords as types
4095@cindex TODO types 4132@cindex TODO types
4096@cindex names as TODO keywords 4133@cindex names as TODO keywords
@@ -4122,7 +4159,7 @@ Lucy has to do, you would use @kbd{C-3 C-c / t}. To collect Lucy's items
4122from all agenda files into a single buffer, you would use the numeric prefix 4159from all agenda files into a single buffer, you would use the numeric prefix
4123argument as well when creating the global TODO list: @kbd{C-3 C-c a t}. 4160argument as well when creating the global TODO list: @kbd{C-3 C-c a t}.
4124 4161
4125@node Multiple sets in one file, Fast access to TODO states, TODO types, TODO extensions 4162@node Multiple sets in one file
4126@subsection Multiple keyword sets in one file 4163@subsection Multiple keyword sets in one file
4127@cindex TODO keyword sets 4164@cindex TODO keyword sets
4128 4165
@@ -4164,14 +4201,14 @@ These keys jump from one TODO subset to the next. In the above example,
4164@kindex S-@key{left} 4201@kindex S-@key{left}
4165@item S-@key{right} 4202@item S-@key{right}
4166@itemx S-@key{left} 4203@itemx S-@key{left}
4167@kbd{S-@key{<left>}} and @kbd{S-@key{<right>}} and walk through @emph{all} 4204@kbd{S-@key{left}} and @kbd{S-@key{right}} and walk through @emph{all}
4168keywords from all sets, so for example @kbd{S-@key{<right>}} would switch 4205keywords from all sets, so for example @kbd{S-@key{right}} would switch
4169from @code{DONE} to @code{REPORT} in the example above. See also 4206from @code{DONE} to @code{REPORT} in the example above. See also
4170@ref{Conflicts}, for a discussion of the interaction with 4207@ref{Conflicts}, for a discussion of the interaction with
4171@code{shift-selection-mode}. 4208@code{shift-selection-mode}.
4172@end table 4209@end table
4173 4210
4174@node Fast access to TODO states, Per-file keywords, Multiple sets in one file, TODO extensions 4211@node Fast access to TODO states
4175@subsection Fast access to TODO states 4212@subsection Fast access to TODO states
4176 4213
4177If you would like to quickly change an entry to an arbitrary TODO state 4214If you would like to quickly change an entry to an arbitrary TODO state
@@ -4196,7 +4233,7 @@ state through the tags interface (@pxref{Setting tags}), in case you like to
4196mingle the two concepts. Note that this means you need to come up with 4233mingle the two concepts. Note that this means you need to come up with
4197unique keys across both sets of keywords.} 4234unique keys across both sets of keywords.}
4198 4235
4199@node Per-file keywords, Faces for TODO keywords, Fast access to TODO states, TODO extensions 4236@node Per-file keywords
4200@subsection Setting up keywords for individual files 4237@subsection Setting up keywords for individual files
4201@cindex keyword options 4238@cindex keyword options
4202@cindex per-file keywords 4239@cindex per-file keywords
@@ -4205,11 +4242,10 @@ unique keys across both sets of keywords.}
4205@cindex #+SEQ_TODO 4242@cindex #+SEQ_TODO
4206 4243
4207It can be very useful to use different aspects of the TODO mechanism in 4244It can be very useful to use different aspects of the TODO mechanism in
4208different files. For file-local settings, you need to add special lines 4245different files. For file-local settings, you need to add special lines to
4209to the file which set the keywords and interpretation for that file 4246the file which set the keywords and interpretation for that file only. For
4210only. For example, to set one of the two examples discussed above, you 4247example, to set one of the two examples discussed above, you need one of the
4211need one of the following lines, starting in column zero anywhere in the 4248following lines anywhere in the file:
4212file:
4213 4249
4214@example 4250@example
4215#+TODO: TODO FEEDBACK VERIFY | DONE CANCELED 4251#+TODO: TODO FEEDBACK VERIFY | DONE CANCELED
@@ -4243,7 +4279,7 @@ Org mode is activated after visiting a file. @kbd{C-c C-c} with the
4243cursor in a line starting with @samp{#+} is simply restarting Org mode 4279cursor in a line starting with @samp{#+} is simply restarting Org mode
4244for the current buffer.}. 4280for the current buffer.}.
4245 4281
4246@node Faces for TODO keywords, TODO dependencies, Per-file keywords, TODO extensions 4282@node Faces for TODO keywords
4247@subsection Faces for TODO keywords 4283@subsection Faces for TODO keywords
4248@cindex faces, for TODO keywords 4284@cindex faces, for TODO keywords
4249 4285
@@ -4271,10 +4307,11 @@ special face and use that. A string is interpreted as a color. The option
4271@code{org-faces-easy-properties} determines if that color is interpreted as a 4307@code{org-faces-easy-properties} determines if that color is interpreted as a
4272foreground or a background color. 4308foreground or a background color.
4273 4309
4274@node TODO dependencies, , Faces for TODO keywords, TODO extensions 4310@node TODO dependencies
4275@subsection TODO dependencies 4311@subsection TODO dependencies
4276@cindex TODO dependencies 4312@cindex TODO dependencies
4277@cindex dependencies, of TODO states 4313@cindex dependencies, of TODO states
4314@cindex TODO dependencies, NOBLOCKING
4278 4315
4279@vindex org-enforce-todo-dependencies 4316@vindex org-enforce-todo-dependencies
4280@cindex property, ORDERED 4317@cindex property, ORDERED
@@ -4303,6 +4340,16 @@ example:
4303** TODO c, needs to wait for (a) and (b) 4340** TODO c, needs to wait for (a) and (b)
4304@end example 4341@end example
4305 4342
4343You can ensure an entry is never blocked by using the @code{NOBLOCKING}
4344property:
4345
4346@example
4347* This entry is never blocked
4348 :PROPERTIES:
4349 :NOBLOCKING: t
4350 :END:
4351@end example
4352
4306@table @kbd 4353@table @kbd
4307@orgcmd{C-c C-x o,org-toggle-ordered-property} 4354@orgcmd{C-c C-x o,org-toggle-ordered-property}
4308@vindex org-track-ordered-property-with-tag 4355@vindex org-track-ordered-property-with-tag
@@ -4319,7 +4366,7 @@ Change TODO state, circumventing any state blocking.
4319@vindex org-agenda-dim-blocked-tasks 4366@vindex org-agenda-dim-blocked-tasks
4320If you set the option @code{org-agenda-dim-blocked-tasks}, TODO entries 4367If you set the option @code{org-agenda-dim-blocked-tasks}, TODO entries
4321that cannot be closed because of such dependencies will be shown in a dimmed 4368that cannot be closed because of such dependencies will be shown in a dimmed
4322font or even made invisible in agenda views (@pxref{Agenda Views}). 4369font or even made invisible in agenda views (@pxref{Agenda views}).
4323 4370
4324@cindex checkboxes and TODO dependencies 4371@cindex checkboxes and TODO dependencies
4325@vindex org-enforce-todo-dependencies 4372@vindex org-enforce-todo-dependencies
@@ -4333,7 +4380,7 @@ between entries in different trees or files, check out the contributed
4333module @file{org-depend.el}. 4380module @file{org-depend.el}.
4334 4381
4335@page 4382@page
4336@node Progress logging, Priorities, TODO extensions, TODO Items 4383@node Progress logging
4337@section Progress logging 4384@section Progress logging
4338@cindex progress logging 4385@cindex progress logging
4339@cindex logging, of progress 4386@cindex logging, of progress
@@ -4351,7 +4398,7 @@ work time}.
4351* Tracking your habits:: How consistent have you been? 4398* Tracking your habits:: How consistent have you been?
4352@end menu 4399@end menu
4353 4400
4354@node Closing items, Tracking TODO state changes, Progress logging, Progress logging 4401@node Closing items
4355@subsection Closing items 4402@subsection Closing items
4356 4403
4357The most basic logging is to keep track of @emph{when} a certain TODO 4404The most basic logging is to keep track of @emph{when} a certain TODO
@@ -4387,7 +4434,7 @@ In the timeline (@pxref{Timeline}) and in the agenda
4387display the TODO items with a @samp{CLOSED} timestamp on each day, 4434display the TODO items with a @samp{CLOSED} timestamp on each day,
4388giving you an overview of what has been done. 4435giving you an overview of what has been done.
4389 4436
4390@node Tracking TODO state changes, Tracking your habits, Closing items, Progress logging 4437@node Tracking TODO state changes
4391@subsection Tracking TODO state changes 4438@subsection Tracking TODO state changes
4392@cindex drawer, for state change recording 4439@cindex drawer, for state change recording
4393 4440
@@ -4470,7 +4517,7 @@ settings like @code{TODO(!)}. For example
4470 :END: 4517 :END:
4471@end example 4518@end example
4472 4519
4473@node Tracking your habits, , Tracking TODO state changes, Progress logging 4520@node Tracking your habits
4474@subsection Tracking your habits 4521@subsection Tracking your habits
4475@cindex habits 4522@cindex habits
4476 4523
@@ -4506,6 +4553,10 @@ actual habit with some history:
4506@example 4553@example
4507** TODO Shave 4554** TODO Shave
4508 SCHEDULED: <2009-10-17 Sat .+2d/4d> 4555 SCHEDULED: <2009-10-17 Sat .+2d/4d>
4556 :PROPERTIES:
4557 :STYLE: habit
4558 :LAST_REPEAT: [2009-10-19 Mon 00:36]
4559 :END:
4509 - State "DONE" from "TODO" [2009-10-15 Thu] 4560 - State "DONE" from "TODO" [2009-10-15 Thu]
4510 - State "DONE" from "TODO" [2009-10-12 Mon] 4561 - State "DONE" from "TODO" [2009-10-12 Mon]
4511 - State "DONE" from "TODO" [2009-10-10 Sat] 4562 - State "DONE" from "TODO" [2009-10-10 Sat]
@@ -4516,10 +4567,6 @@ actual habit with some history:
4516 - State "DONE" from "TODO" [2009-09-19 Sat] 4567 - State "DONE" from "TODO" [2009-09-19 Sat]
4517 - State "DONE" from "TODO" [2009-09-16 Wed] 4568 - State "DONE" from "TODO" [2009-09-16 Wed]
4518 - State "DONE" from "TODO" [2009-09-12 Sat] 4569 - State "DONE" from "TODO" [2009-09-12 Sat]
4519 :PROPERTIES:
4520 :STYLE: habit
4521 :LAST_REPEAT: [2009-10-19 Mon 00:36]
4522 :END:
4523@end example 4570@end example
4524 4571
4525What this habit says is: I want to shave at most every 2 days (given by the 4572What this habit says is: I want to shave at most every 2 days (given by the
@@ -4570,7 +4617,7 @@ temporarily be disabled and they won't appear at all. Press @kbd{K} again to
4570bring them back. They are also subject to tag filtering, if you have habits 4617bring them back. They are also subject to tag filtering, if you have habits
4571which should only be done in certain contexts, for example. 4618which should only be done in certain contexts, for example.
4572 4619
4573@node Priorities, Breaking down tasks, Progress logging, TODO Items 4620@node Priorities
4574@section Priorities 4621@section Priorities
4575@cindex priorities 4622@cindex priorities
4576 4623
@@ -4628,7 +4675,7 @@ priority):
4628#+PRIORITIES: A C B 4675#+PRIORITIES: A C B
4629@end example 4676@end example
4630 4677
4631@node Breaking down tasks, Checkboxes, Priorities, TODO Items 4678@node Breaking down tasks
4632@section Breaking tasks down into subtasks 4679@section Breaking tasks down into subtasks
4633@cindex tasks, breaking down 4680@cindex tasks, breaking down
4634@cindex statistics, for TODO items 4681@cindex statistics, for TODO items
@@ -4689,7 +4736,7 @@ Another possibility is the use of checkboxes to identify (a hierarchy of) a
4689large number of subtasks (@pxref{Checkboxes}). 4736large number of subtasks (@pxref{Checkboxes}).
4690 4737
4691 4738
4692@node Checkboxes, , Breaking down tasks, TODO Items 4739@node Checkboxes
4693@section Checkboxes 4740@section Checkboxes
4694@cindex checkboxes 4741@cindex checkboxes
4695 4742
@@ -4698,7 +4745,7 @@ Every item in a plain list@footnote{With the exception of description
4698lists. But you can allow it by modifying @code{org-list-automatic-rules} 4745lists. But you can allow it by modifying @code{org-list-automatic-rules}
4699accordingly.} (@pxref{Plain lists}) can be made into a checkbox by starting 4746accordingly.} (@pxref{Plain lists}) can be made into a checkbox by starting
4700it with the string @samp{[ ]}. This feature is similar to TODO items 4747it with the string @samp{[ ]}. This feature is similar to TODO items
4701(@pxref{TODO Items}), but is more lightweight. Checkboxes are not included 4748(@pxref{TODO items}), but is more lightweight. Checkboxes are not included
4702in the global TODO list, so they are often great to split a task into a 4749in the global TODO list, so they are often great to split a task into a
4703number of simple steps. Or you can use them in a shopping list. To toggle a 4750number of simple steps. Or you can use them in a shopping list. To toggle a
4704checkbox, use @kbd{C-c C-c}, or use the mouse (thanks to Piotr Zielinski's 4751checkbox, use @kbd{C-c C-c}, or use the mouse (thanks to Piotr Zielinski's
@@ -4755,11 +4802,12 @@ off a box while there are unchecked boxes above it.
4755 4802
4756@table @kbd 4803@table @kbd
4757@orgcmd{C-c C-c,org-toggle-checkbox} 4804@orgcmd{C-c C-c,org-toggle-checkbox}
4758Toggle checkbox status or (with prefix arg) checkbox presence at point. 4805Toggle checkbox status or (with prefix arg) checkbox presence at point. With
4759With a single prefix argument, add an empty checkbox or remove the current 4806a single prefix argument, add an empty checkbox or remove the current
4760one@footnote{@kbd{C-u C-c C-c} on the @emph{first} item of a list with no checkbox 4807one@footnote{@kbd{C-u C-c C-c} before the @emph{first} bullet in a list with
4761will add checkboxes to the rest of the list.}. With a double prefix argument, set it to @samp{[-]}, which is 4808no checkbox will add checkboxes to the rest of the list.}. With a double
4762considered to be an intermediate state. 4809prefix argument, set it to @samp{[-]}, which is considered to be an
4810intermediate state.
4763@orgcmd{C-c C-x C-b,org-toggle-checkbox} 4811@orgcmd{C-c C-x C-b,org-toggle-checkbox}
4764Toggle checkbox status or (with prefix arg) checkbox presence at point. With 4812Toggle checkbox status or (with prefix arg) checkbox presence at point. With
4765double prefix argument, set it to @samp{[-]}, which is considered to be an 4813double prefix argument, set it to @samp{[-]}, which is considered to be an
@@ -4770,8 +4818,10 @@ If there is an active region, toggle the first checkbox in the region
4770and set all remaining boxes to the same status as the first. With a prefix 4818and set all remaining boxes to the same status as the first. With a prefix
4771arg, add or remove the checkbox for all items in the region. 4819arg, add or remove the checkbox for all items in the region.
4772@item 4820@item
4773If the cursor is in a headline, toggle checkboxes in the region between 4821If the cursor is in a headline, toggle the state of the first checkbox in the
4774this headline and the next (so @emph{not} the entire subtree). 4822region between this headline and the next---so @emph{not} the entire
4823subtree---and propagate this new state to all other checkboxes in the same
4824area.
4775@item 4825@item
4776If there is no active region, just toggle the checkbox at point. 4826If there is no active region, just toggle the checkbox at point.
4777@end itemize 4827@end itemize
@@ -4795,7 +4845,7 @@ changing TODO states. If you delete boxes/entries or add/change them by
4795hand, use this command to get things back into sync. 4845hand, use this command to get things back into sync.
4796@end table 4846@end table
4797 4847
4798@node Tags, Properties and Columns, TODO Items, Top 4848@node Tags
4799@chapter Tags 4849@chapter Tags
4800@cindex tags 4850@cindex tags
4801@cindex headline tagging 4851@cindex headline tagging
@@ -4819,11 +4869,11 @@ You may specify special faces for specific tags using the option
4819@menu 4869@menu
4820* Tag inheritance:: Tags use the tree structure of the outline 4870* Tag inheritance:: Tags use the tree structure of the outline
4821* Setting tags:: How to assign tags to a headline 4871* Setting tags:: How to assign tags to a headline
4822* Tag groups:: Use one tag to search for several tags 4872* Tag hierarchy:: Create a hierarchy of tags
4823* Tag searches:: Searching for combinations of tags 4873* Tag searches:: Searching for combinations of tags
4824@end menu 4874@end menu
4825 4875
4826@node Tag inheritance, Setting tags, Tags, Tags 4876@node Tag inheritance
4827@section Tag inheritance 4877@section Tag inheritance
4828@cindex tag inheritance 4878@cindex tag inheritance
4829@cindex inheritance, of tags 4879@cindex inheritance, of tags
@@ -4842,11 +4892,11 @@ well. For example, in the list
4842@noindent 4892@noindent
4843the final heading will have the tags @samp{:work:}, @samp{:boss:}, 4893the final heading will have the tags @samp{:work:}, @samp{:boss:},
4844@samp{:notes:}, and @samp{:action:} even though the final heading is not 4894@samp{:notes:}, and @samp{:action:} even though the final heading is not
4845explicitly marked with those tags. You can also set tags that all entries in 4895explicitly marked with all those tags. You can also set tags that all
4846a file should inherit just as if these tags were defined in a hypothetical 4896entries in a file should inherit just as if these tags were defined in
4847level zero that surrounds the entire file. Use a line like this@footnote{As 4897a hypothetical level zero that surrounds the entire file. Use a line like
4848with all these in-buffer settings, pressing @kbd{C-c C-c} activates any 4898this@footnote{As with all these in-buffer settings, pressing @kbd{C-c C-c}
4849changes in the line.}: 4899activates any changes in the line.}:
4850 4900
4851@cindex #+FILETAGS 4901@cindex #+FILETAGS
4852@example 4902@example
@@ -4877,7 +4927,7 @@ with inherited tags. Set @code{org-agenda-use-tag-inheritance} to control
4877this: the default value includes all agenda types, but setting this to @code{nil} 4927this: the default value includes all agenda types, but setting this to @code{nil}
4878can really speed up agenda generation. 4928can really speed up agenda generation.
4879 4929
4880@node Setting tags, Tag groups, Tag inheritance, Tags 4930@node Setting tags
4881@section Setting tags 4931@section Setting tags
4882@cindex setting tags 4932@cindex setting tags
4883@cindex tags, setting 4933@cindex tags, setting
@@ -4939,10 +4989,10 @@ By default Org mode uses the standard minibuffer completion facilities for
4939entering tags. However, it also implements another, quicker, tag selection 4989entering tags. However, it also implements another, quicker, tag selection
4940method called @emph{fast tag selection}. This allows you to select and 4990method called @emph{fast tag selection}. This allows you to select and
4941deselect tags with just a single key press. For this to work well you should 4991deselect tags with just a single key press. For this to work well you should
4942assign unique letters to most of your commonly used tags. You can do this 4992assign unique, case-sensitive, letters to most of your commonly used tags.
4943globally by configuring the variable @code{org-tag-alist} in your 4993You can do this globally by configuring the variable @code{org-tag-alist} in
4944@file{.emacs} file. For example, you may find the need to tag many items in 4994your Emacs init file. For example, you may find the need to tag many items
4945different files with @samp{:@@home:}. In this case you can set something 4995in different files with @samp{:@@home:}. In this case you can set something
4946like: 4996like:
4947 4997
4948@lisp 4998@lisp
@@ -5004,14 +5054,15 @@ If at least one tag has a selection key then pressing @kbd{C-c C-c} will
5004automatically present you with a special interface, listing inherited tags, 5054automatically present you with a special interface, listing inherited tags,
5005the tags of the current headline, and a list of all valid tags with 5055the tags of the current headline, and a list of all valid tags with
5006corresponding keys@footnote{Keys will automatically be assigned to tags which 5056corresponding keys@footnote{Keys will automatically be assigned to tags which
5007have no configured keys.}. In this interface, you can use the following 5057have no configured keys.}.
5008keys: 5058
5059Pressing keys assigned to tags will add or remove them from the list of tags
5060in the current line. Selecting a tag in a group of mutually exclusive tags
5061will turn off any other tags from that group.
5062
5063In this interface, you can also use the following special keys:
5009 5064
5010@table @kbd 5065@table @kbd
5011@item a-z...
5012Pressing keys assigned to tags will add or remove them from the list of
5013tags in the current line. Selecting a tag in a group of mutually
5014exclusive tags will turn off any other tags from that group.
5015@kindex @key{TAB} 5066@kindex @key{TAB}
5016@item @key{TAB} 5067@item @key{TAB}
5017Enter a tag in the minibuffer, even if the tag is not in the predefined 5068Enter a tag in the minibuffer, even if the tag is not in the predefined
@@ -5021,16 +5072,21 @@ You can also add several tags: just separate them with a comma.
5021@kindex @key{SPC} 5072@kindex @key{SPC}
5022@item @key{SPC} 5073@item @key{SPC}
5023Clear all tags for this line. 5074Clear all tags for this line.
5075
5024@kindex @key{RET} 5076@kindex @key{RET}
5025@item @key{RET} 5077@item @key{RET}
5026Accept the modified set. 5078Accept the modified set.
5079
5027@item C-g 5080@item C-g
5028Abort without installing changes. 5081Abort without installing changes.
5082
5029@item q 5083@item q
5030If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}. 5084If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}.
5085
5031@item ! 5086@item !
5032Turn off groups of mutually exclusive tags. Use this to (as an 5087Turn off groups of mutually exclusive tags. Use this to (as an
5033exception) assign several tags from such a group. 5088exception) assign several tags from such a group.
5089
5034@item C-c 5090@item C-c
5035Toggle auto-exit after the next change (see below). 5091Toggle auto-exit after the next change (see below).
5036If you are using expert mode, the first @kbd{C-c} will display the 5092If you are using expert mode, the first @kbd{C-c} will display the
@@ -5058,41 +5114,104 @@ instead of @kbd{C-c C-c}). If you set the variable to the value
5058@code{expert}, the special window is not even shown for single-key tag 5114@code{expert}, the special window is not even shown for single-key tag
5059selection, it comes up only when you press an extra @kbd{C-c}. 5115selection, it comes up only when you press an extra @kbd{C-c}.
5060 5116
5061@node Tag groups, Tag searches, Setting tags, Tags 5117@node Tag hierarchy
5062@section Tag groups 5118@section Tag hierarchy
5063 5119
5064@cindex group tags 5120@cindex group tags
5065@cindex tags, groups 5121@cindex tags, groups
5066In a set of mutually exclusive tags, the first tag can be defined as a 5122@cindex tag hierarchy
5067@emph{group tag}. When you search for a group tag, it will return matches 5123Tags can be defined in hierarchies. A tag can be defined as a @emph{group
5068for all members in the group. In an agenda view, filtering by a group tag 5124tag} for a set of other tags. The group tag can be seen as the ``broader
5069will display headlines tagged with at least one of the members of the 5125term'' for its set of tags. Defining multiple @emph{group tags} and nesting
5070group. This makes tag searches and filters even more flexible. 5126them creates a tag hierarchy.
5127
5128One use-case is to create a taxonomy of terms (tags) that can be used to
5129classify nodes in a document or set of documents.
5130
5131When you search for a group tag, it will return matches for all members in
5132the group and its subgroups. In an agenda view, filtering by a group tag
5133will display or hide headlines tagged with at least one of the members of the
5134group or any of its subgroups. This makes tag searches and filters even more
5135flexible.
5136
5137You can set group tags by using brackets and inserting a colon between the
5138group tag and its related tags---beware that all whitespaces are mandatory so
5139that Org can parse this line correctly:
5140
5141@example
5142#+TAGS: [ GTD : Control Persp ]
5143@end example
5071 5144
5072You can set group tags by inserting a colon between the group tag and other 5145In this example, @samp{GTD} is the @emph{group tag} and it is related to two
5073tags---beware that all whitespaces are mandatory so that Org can parse this 5146other tags: @samp{Control}, @samp{Persp}. Defining @samp{Control} and
5074line correctly: 5147@samp{Persp} as group tags creates an hierarchy of tags:
5075 5148
5076@example 5149@example
5077#+TAGS: @{ @@read : @@read_book @@read_ebook @} 5150#+TAGS: [ Control : Context Task ]
5151#+TAGS: [ Persp : Vision Goal AOF Project ]
5078@end example 5152@end example
5079 5153
5080In this example, @samp{@@read} is a @emph{group tag} for a set of three 5154That can conceptually be seen as a hierarchy of tags:
5081tags: @samp{@@read}, @samp{@@read_book} and @samp{@@read_ebook}. 5155
5156@example
5157- GTD
5158 - Persp
5159 - Vision
5160 - Goal
5161 - AOF
5162 - Project
5163 - Control
5164 - Context
5165 - Task
5166@end example
5082 5167
5083You can also use the @code{:grouptags} keyword directly when setting 5168You can use the @code{:startgrouptag}, @code{:grouptags} and
5084@code{org-tag-alist}: 5169@code{:endgrouptag} keyword directly when setting @code{org-tag-alist}
5170directly:
5085 5171
5086@lisp 5172@lisp
5087(setq org-tag-alist '((:startgroup . nil) 5173(setq org-tag-alist '((:startgrouptag)
5088 ("@@read" . nil) 5174 ("GTD")
5089 (:grouptags . nil) 5175 (:grouptags)
5090 ("@@read_book" . nil) 5176 ("Control")
5091 ("@@read_ebook" . nil) 5177 ("Persp")
5092 (:endgroup . nil))) 5178 (:endgrouptag)
5179 (:startgrouptag)
5180 ("Control")
5181 (:grouptags)
5182 ("Context")
5183 ("Task")
5184 (:endgrouptag)))
5093@end lisp 5185@end lisp
5094 5186
5095You cannot nest group tags or use a group tag as a tag in another group. 5187The tags in a group can be mutually exclusive if using the same group syntax
5188as is used for grouping mutually exclusive tags together; using curly
5189brackets.
5190
5191@example
5192#+TAGS: @{ Context : @@Home @@Work @@Call @}
5193@end example
5194
5195When setting @code{org-tag-alist} you can use @code{:startgroup} &
5196@code{:endgroup} instead of @code{:startgrouptag} & @code{:endgrouptag} to
5197make the tags mutually exclusive.
5198
5199Furthermore, the members of a @emph{group tag} can also be regular
5200expressions, creating the possibility of a more dynamic and rule-based
5201tag structure. The regular expressions in the group must be specified
5202within @{ @}. Here is an expanded example:
5203
5204@example
5205#+TAGS: [ Vision : @{V@@@.+@} ]
5206#+TAGS: [ Goal : @{G@@@.+@} ]
5207#+TAGS: [ AOF : @{AOF@@@.+@} ]
5208#+TAGS: [ Project : @{P@@@.+@} ]
5209@end example
5210
5211Searching for the tag @samp{Project} will now list all tags also including
5212regular expression matches for @samp{P@@@.+}, and similarly for tag searches on
5213@samp{Vision}, @samp{Goal} and @samp{AOF}. For example, this would work well
5214for a project tagged with a common project-identifier, e.g. @samp{P@@2014_OrgTags}.
5096 5215
5097@kindex C-c C-x q 5216@kindex C-c C-x q
5098@vindex org-group-tags 5217@vindex org-group-tags
@@ -5100,7 +5219,7 @@ If you want to ignore group tags temporarily, toggle group tags support
5100with @command{org-toggle-tags-groups}, bound to @kbd{C-c C-x q}. If you 5219with @command{org-toggle-tags-groups}, bound to @kbd{C-c C-x q}. If you
5101want to disable tag groups completely, set @code{org-group-tags} to @code{nil}. 5220want to disable tag groups completely, set @code{org-group-tags} to @code{nil}.
5102 5221
5103@node Tag searches, , Tag groups, Tags 5222@node Tag searches
5104@section Tag searches 5223@section Tag searches
5105@cindex tag searches 5224@cindex tag searches
5106@cindex searching for tags 5225@cindex searching for tags
@@ -5126,13 +5245,13 @@ only TODO items and force checking subitems (see the option
5126These commands all prompt for a match string which allows basic Boolean logic 5245These commands all prompt for a match string which allows basic Boolean logic
5127like @samp{+boss+urgent-project1}, to find entries with tags @samp{boss} and 5246like @samp{+boss+urgent-project1}, to find entries with tags @samp{boss} and
5128@samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find entries 5247@samp{urgent}, but not @samp{project1}, or @samp{Kathy|Sally} to find entries
5129which are tagged, like @samp{Kathy} or @samp{Sally}. The full syntax of the search 5248tagged as @samp{Kathy} or @samp{Sally}. The full syntax of the search string
5130string is rich and allows also matching against TODO keywords, entry levels 5249is rich and allows also matching against TODO keywords, entry levels and
5131and properties. For a complete description with many examples, see 5250properties. For a complete description with many examples, see @ref{Matching
5132@ref{Matching tags and properties}. 5251tags and properties}.
5133 5252
5134 5253
5135@node Properties and Columns, Dates and Times, Tags, Top 5254@node Properties and columns
5136@chapter Properties and columns 5255@chapter Properties and columns
5137@cindex properties 5256@cindex properties
5138 5257
@@ -5162,16 +5281,18 @@ Properties can be conveniently edited and viewed in column view
5162* Property API:: Properties for Lisp programmers 5281* Property API:: Properties for Lisp programmers
5163@end menu 5282@end menu
5164 5283
5165@node Property syntax, Special properties, Properties and Columns, Properties and Columns 5284@node Property syntax
5166@section Property syntax 5285@section Property syntax
5167@cindex property syntax 5286@cindex property syntax
5168@cindex drawer, for properties 5287@cindex drawer, for properties
5169 5288
5170Properties are key-value pairs. When they are associated with a single entry 5289Properties are key-value pairs. When they are associated with a single entry
5171or with a tree they need to be inserted into a special 5290or with a tree they need to be inserted into a special drawer
5172drawer (@pxref{Drawers}) with the name @code{PROPERTIES}. Each property 5291(@pxref{Drawers}) with the name @code{PROPERTIES}, which has to be located
5173is specified on a single line, with the key (surrounded by colons) 5292right below a headline, and its planning line (@pxref{Deadlines and
5174first, and the value after it. Here is an example: 5293scheduling}) when applicable. Each property is specified on a single line,
5294with the key (surrounded by colons) first, and the value after it. Keys are
5295case-insensitives. Here is an example:
5175 5296
5176@example 5297@example
5177* CD collection 5298* CD collection
@@ -5187,7 +5308,7 @@ first, and the value after it. Here is an example:
5187@end example 5308@end example
5188 5309
5189Depending on the value of @code{org-use-property-inheritance}, a property set 5310Depending on the value of @code{org-use-property-inheritance}, a property set
5190this way will either be associated with a single entry, or the sub-tree 5311this way will either be associated with a single entry, or the subtree
5191defined by the entry, see @ref{Property inheritance}. 5312defined by the entry, see @ref{Property inheritance}.
5192 5313
5193You may define the allowed values for a particular property @samp{:Xyz:} 5314You may define the allowed values for a particular property @samp{:Xyz:}
@@ -5215,7 +5336,7 @@ file, use a line like
5215@end example 5336@end example
5216 5337
5217Contrary to properties set from a special drawer, you have to refresh the 5338Contrary to properties set from a special drawer, you have to refresh the
5218buffer with @kbd{C-c C-c} to activate this changes. 5339buffer with @kbd{C-c C-c} to activate this change.
5219 5340
5220If you want to add to the value of an existing property, append a @code{+} to 5341If you want to add to the value of an existing property, append a @code{+} to
5221the property name. The following results in the property @code{var} having 5342the property name. The following results in the property @code{var} having
@@ -5284,58 +5405,52 @@ Compute the property at point, using the operator and scope from the
5284nearest column format definition. 5405nearest column format definition.
5285@end table 5406@end table
5286 5407
5287@node Special properties, Property searches, Property syntax, Properties and Columns 5408@node Special properties
5288@section Special properties 5409@section Special properties
5289@cindex properties, special 5410@cindex properties, special
5290 5411
5291Special properties provide an alternative access method to Org mode features, 5412Special properties provide an alternative access method to Org mode features,
5292like the TODO state or the priority of an entry, discussed in the previous 5413like the TODO state or the priority of an entry, discussed in the previous
5293chapters. This interface exists so that you can include these states in a 5414chapters. This interface exists so that you can include these states in
5294column view (@pxref{Column view}), or to use them in queries. The following 5415a column view (@pxref{Column view}), or to use them in queries. The
5295property names are special and (except for @code{:CATEGORY:}) should not be 5416following property names are special and should not be used as keys in the
5296used as keys in the properties drawer: 5417properties drawer:
5297 5418
5298@cindex property, special, ID
5299@cindex property, special, TODO
5300@cindex property, special, TAGS
5301@cindex property, special, ALLTAGS 5419@cindex property, special, ALLTAGS
5302@cindex property, special, CATEGORY 5420@cindex property, special, BLOCKED
5303@cindex property, special, PRIORITY 5421@cindex property, special, CLOCKSUM
5422@cindex property, special, CLOCKSUM_T
5423@cindex property, special, CLOSED
5304@cindex property, special, DEADLINE 5424@cindex property, special, DEADLINE
5425@cindex property, special, FILE
5426@cindex property, special, ITEM
5427@cindex property, special, PRIORITY
5305@cindex property, special, SCHEDULED 5428@cindex property, special, SCHEDULED
5306@cindex property, special, CLOSED 5429@cindex property, special, TAGS
5307@cindex property, special, TIMESTAMP 5430@cindex property, special, TIMESTAMP
5308@cindex property, special, TIMESTAMP_IA 5431@cindex property, special, TIMESTAMP_IA
5309@cindex property, special, CLOCKSUM 5432@cindex property, special, TODO
5310@cindex property, special, CLOCKSUM_T
5311@cindex property, special, BLOCKED
5312@c guessing that ITEM is needed in this area; also, should this list be sorted?
5313@cindex property, special, ITEM
5314@cindex property, special, FILE
5315@example 5433@example
5316ID @r{A globally unique ID used for synchronization during}
5317 @r{iCalendar or MobileOrg export.}
5318TODO @r{The TODO keyword of the entry.}
5319TAGS @r{The tags defined directly in the headline.}
5320ALLTAGS @r{All tags, including inherited ones.} 5434ALLTAGS @r{All tags, including inherited ones.}
5321CATEGORY @r{The category of an entry.} 5435BLOCKED @r{"t" if task is currently blocked by children or siblings.}
5322PRIORITY @r{The priority of the entry, a string with a single letter.}
5323DEADLINE @r{The deadline time string, without the angular brackets.}
5324SCHEDULED @r{The scheduling timestamp, without the angular brackets.}
5325CLOSED @r{When was this entry closed?}
5326TIMESTAMP @r{The first keyword-less timestamp in the entry.}
5327TIMESTAMP_IA @r{The first inactive timestamp in the entry.}
5328CLOCKSUM @r{The sum of CLOCK intervals in the subtree. @code{org-clock-sum}} 5436CLOCKSUM @r{The sum of CLOCK intervals in the subtree. @code{org-clock-sum}}
5329 @r{must be run first to compute the values in the current buffer.} 5437 @r{must be run first to compute the values in the current buffer.}
5330CLOCKSUM_T @r{The sum of CLOCK intervals in the subtree for today.} 5438CLOCKSUM_T @r{The sum of CLOCK intervals in the subtree for today.}
5331 @r{@code{org-clock-sum-today} must be run first to compute the} 5439 @r{@code{org-clock-sum-today} must be run first to compute the}
5332 @r{values in the current buffer.} 5440 @r{values in the current buffer.}
5333BLOCKED @r{"t" if task is currently blocked by children or siblings} 5441CLOSED @r{When was this entry closed?}
5334ITEM @r{The headline of the entry.} 5442DEADLINE @r{The deadline time string, without the angular brackets.}
5335FILE @r{The filename the entry is located in.} 5443FILE @r{The filename the entry is located in.}
5444ITEM @r{The headline of the entry.}
5445PRIORITY @r{The priority of the entry, a string with a single letter.}
5446SCHEDULED @r{The scheduling timestamp, without the angular brackets.}
5447TAGS @r{The tags defined directly in the headline.}
5448TIMESTAMP @r{The first keyword-less timestamp in the entry.}
5449TIMESTAMP_IA @r{The first inactive timestamp in the entry.}
5450TODO @r{The TODO keyword of the entry.}
5336@end example 5451@end example
5337 5452
5338@node Property searches, Property inheritance, Special properties, Properties and Columns 5453@node Property searches
5339@section Property searches 5454@section Property searches
5340@cindex properties, searching 5455@cindex properties, searching
5341@cindex searching, of properties 5456@cindex searching, of properties
@@ -5372,7 +5487,7 @@ value. If you enclose the value in curly braces, it is interpreted as
5372a regular expression and matched against the property values. 5487a regular expression and matched against the property values.
5373@end table 5488@end table
5374 5489
5375@node Property inheritance, Column view, Property searches, Properties and Columns 5490@node Property inheritance
5376@section Property Inheritance 5491@section Property Inheritance
5377@cindex properties, inheritance 5492@cindex properties, inheritance
5378@cindex inheritance, of properties 5493@cindex inheritance, of properties
@@ -5416,7 +5531,7 @@ The LOGGING property may define logging settings for an entry or a
5416subtree (@pxref{Tracking TODO state changes}). 5531subtree (@pxref{Tracking TODO state changes}).
5417@end table 5532@end table
5418 5533
5419@node Column view, Property API, Property inheritance, Properties and Columns 5534@node Column view
5420@section Column view 5535@section Column view
5421 5536
5422A great way to view and edit properties in an outline tree is 5537A great way to view and edit properties in an outline tree is
@@ -5430,7 +5545,7 @@ view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view
5430is active), but you can still open, read, and edit the entry below each 5545is active), but you can still open, read, and edit the entry below each
5431headline. Or, you can switch to column view after executing a sparse 5546headline. Or, you can switch to column view after executing a sparse
5432tree command and in this way get a table only for the selected items. 5547tree command and in this way get a table only for the selected items.
5433Column view also works in agenda buffers (@pxref{Agenda Views}) where 5548Column view also works in agenda buffers (@pxref{Agenda views}) where
5434queries have collected selected items, possibly from a number of files. 5549queries have collected selected items, possibly from a number of files.
5435 5550
5436@menu 5551@menu
@@ -5439,7 +5554,7 @@ queries have collected selected items, possibly from a number of files.
5439* Capturing column view:: A dynamic block for column view 5554* Capturing column view:: A dynamic block for column view
5440@end menu 5555@end menu
5441 5556
5442@node Defining columns, Using column view, Column view, Column view 5557@node Defining columns
5443@subsection Defining columns 5558@subsection Defining columns
5444@cindex column view, for properties 5559@cindex column view, for properties
5445@cindex properties, column view 5560@cindex properties, column view
@@ -5452,7 +5567,7 @@ done by defining a column format line.
5452* Column attributes:: Appearance and content of a column 5567* Column attributes:: Appearance and content of a column
5453@end menu 5568@end menu
5454 5569
5455@node Scope of column definitions, Column attributes, Defining columns, Defining columns 5570@node Scope of column definitions
5456@subsubsection Scope of column definitions 5571@subsubsection Scope of column definitions
5457 5572
5458To define a column format for an entire file, use a line like 5573To define a column format for an entire file, use a line like
@@ -5479,7 +5594,7 @@ you can define columns on level 1 that are general enough for all
5479sublevels, and more specific columns further down, when you edit a 5594sublevels, and more specific columns further down, when you edit a
5480deeper part of the tree. 5595deeper part of the tree.
5481 5596
5482@node Column attributes, , Scope of column definitions, Defining columns 5597@node Column attributes
5483@subsubsection Column attributes 5598@subsubsection Column attributes
5484A column definition sets the attributes of a column. The general 5599A column definition sets the attributes of a column. The general
5485definition looks like this: 5600definition looks like this:
@@ -5501,38 +5616,45 @@ optional. The individual parts have the following meaning:
5501@var{title} @r{The header text for the column. If omitted, the property} 5616@var{title} @r{The header text for the column. If omitted, the property}
5502 @r{name is used.} 5617 @r{name is used.}
5503@{@var{summary-type}@} @r{The summary type. If specified, the column values for} 5618@{@var{summary-type}@} @r{The summary type. If specified, the column values for}
5504 @r{parent nodes are computed from the children.} 5619 @r{parent nodes are computed from the children@footnote{If
5620 more than one summary type apply to the property, the parent
5621 values are computed according to the first of them.}.}
5505 @r{Supported summary types are:} 5622 @r{Supported summary types are:}
5506 @{+@} @r{Sum numbers in this column.} 5623 @{+@} @r{Sum numbers in this column.}
5507 @{+;%.1f@} @r{Like @samp{+}, but format result with @samp{%.1f}.} 5624 @{+;%.1f@} @r{Like @samp{+}, but format result with @samp{%.1f}.}
5508 @{$@} @r{Currency, short for @samp{+;%.2f}.} 5625 @{$@} @r{Currency, short for @samp{+;%.2f}.}
5509 @{:@} @r{Sum times, HH:MM, plain numbers are hours.}
5510 @{X@} @r{Checkbox status, @samp{[X]} if all children are @samp{[X]}.}
5511 @{X/@} @r{Checkbox status, @samp{[n/m]}.}
5512 @{X%@} @r{Checkbox status, @samp{[n%]}.}
5513 @{min@} @r{Smallest number in column.} 5626 @{min@} @r{Smallest number in column.}
5514 @{max@} @r{Largest number.} 5627 @{max@} @r{Largest number.}
5515 @{mean@} @r{Arithmetic mean of numbers.} 5628 @{mean@} @r{Arithmetic mean of numbers.}
5629 @{X@} @r{Checkbox status, @samp{[X]} if all children are @samp{[X]}.}
5630 @{X/@} @r{Checkbox status, @samp{[n/m]}.}
5631 @{X%@} @r{Checkbox status, @samp{[n%]}.}
5632 @{:@} @r{Sum times, HH:MM, plain numbers are
5633 hours@footnote{A time can also be a duration, using effort
5634 modifiers defined in @code{org-effort-durations}, e.g.,
5635 @samp{3d 1h}. If any value in the column is as such, the
5636 summary will also be an effort duration.}.}
5516 @{:min@} @r{Smallest time value in column.} 5637 @{:min@} @r{Smallest time value in column.}
5517 @{:max@} @r{Largest time value.} 5638 @{:max@} @r{Largest time value.}
5518 @{:mean@} @r{Arithmetic mean of time values.} 5639 @{:mean@} @r{Arithmetic mean of time values.}
5519 @{@@min@} @r{Minimum age (in days/hours/mins/seconds).} 5640 @{@@min@} @r{Minimum age@footnote{An age is defined as
5641 a duration since a given time-stamp (@pxref{Timestamps}). It
5642 can also be expressed as days, hours, minutes and seconds,
5643 identified by @samp{d}, @samp{h}, @samp{m} and @samp{s}
5644 suffixes, all mandatory, e.g., @samp{0d 13h 0m 10s}.} (in
5645 days/hours/mins/seconds).}
5520 @{@@max@} @r{Maximum age (in days/hours/mins/seconds).} 5646 @{@@max@} @r{Maximum age (in days/hours/mins/seconds).}
5521 @{@@mean@} @r{Arithmetic mean of ages (in days/hours/mins/seconds).} 5647 @{@@mean@} @r{Arithmetic mean of ages (in days/hours/mins/seconds).}
5522 @{est+@} @r{Add low-high estimates.} 5648 @{est+@} @r{Add @samp{low-high} estimates.}
5523@end example 5649@end example
5524 5650
5525@noindent
5526Be aware that you can only have one summary type for any property you
5527include. Subsequent columns referencing the same property will all display the
5528same summary information.
5529
5530The @code{est+} summary type requires further explanation. It is used for 5651The @code{est+} summary type requires further explanation. It is used for
5531combining estimates, expressed as low-high ranges. For example, instead 5652combining estimates, expressed as @samp{low-high} ranges or plain numbers.
5532of estimating a particular task will take 5 days, you might estimate it as 5653For example, instead of estimating a particular task will take 5 days, you
55335--6 days if you're fairly confident you know how much work is required, or 5654might estimate it as 5--6 days if you're fairly confident you know how much
55341--10 days if you don't really know what needs to be done. Both ranges 5655work is required, or 1--10 days if you don't really know what needs to be
5535average at 5.5 days, but the first represents a more predictable delivery. 5656done. Both ranges average at 5.5 days, but the first represents a more
5657predictable delivery.
5536 5658
5537When combining a set of such estimates, simply adding the lows and highs 5659When combining a set of such estimates, simply adding the lows and highs
5538produces an unrealistically wide result. Instead, @code{est+} adds the 5660produces an unrealistically wide result. Instead, @code{est+} adds the
@@ -5546,6 +5668,10 @@ full job more realistically, at 10--15 days.
5546Numbers are right-aligned when a format specifier with an explicit width like 5668Numbers are right-aligned when a format specifier with an explicit width like
5547@code{%5d} or @code{%5.1f} is used. 5669@code{%5d} or @code{%5.1f} is used.
5548 5670
5671@vindex org-columns-summary-types
5672You can also define custom summary types by setting
5673@code{org-columns-summary-types}, which see.
5674
5549Here is an example for a complete columns definition, along with allowed 5675Here is an example for a complete columns definition, along with allowed
5550values. 5676values.
5551 5677
@@ -5574,7 +5700,7 @@ an @samp{[X]} status if all children have been checked. The
5574sums of CLOCK intervals in the subtree, either for all clocks or just for 5700sums of CLOCK intervals in the subtree, either for all clocks or just for
5575today. 5701today.
5576 5702
5577@node Using column view, Capturing column view, Defining columns, Column view 5703@node Using column view
5578@subsection Using column view 5704@subsection Using column view
5579 5705
5580@table @kbd 5706@table @kbd
@@ -5582,14 +5708,15 @@ today.
5582@orgcmd{C-c C-x C-c,org-columns} 5708@orgcmd{C-c C-x C-c,org-columns}
5583@vindex org-columns-default-format 5709@vindex org-columns-default-format
5584Turn on column view. If the cursor is before the first headline in the file, 5710Turn on column view. If the cursor is before the first headline in the file,
5585column view is turned on for the entire file, using the @code{#+COLUMNS} 5711or the function called with the universal prefix argument, column view is
5586definition. If the cursor is somewhere inside the outline, this command 5712turned on for the entire file, using the @code{#+COLUMNS} definition. If the
5587searches the hierarchy, up from point, for a @code{:COLUMNS:} property that 5713cursor is somewhere inside the outline, this command searches the hierarchy,
5588defines a format. When one is found, the column view table is established 5714up from point, for a @code{:COLUMNS:} property that defines a format. When
5589for the tree starting at the entry that contains the @code{:COLUMNS:} 5715one is found, the column view table is established for the tree starting at
5590property. If no such property is found, the format is taken from the 5716the entry that contains the @code{:COLUMNS:} property. If no such property
5591@code{#+COLUMNS} line or from the variable @code{org-columns-default-format}, 5717is found, the format is taken from the @code{#+COLUMNS} line or from the
5592and column view is established for the current entry and its subtree. 5718variable @code{org-columns-default-format}, and column view is established
5719for the current entry and its subtree.
5593@orgcmd{r,org-columns-redo} 5720@orgcmd{r,org-columns-redo}
5594Recreate the column view, to include recent changes made in the buffer. 5721Recreate the column view, to include recent changes made in the buffer.
5595@orgcmd{g,org-columns-redo} 5722@orgcmd{g,org-columns-redo}
@@ -5620,7 +5747,7 @@ View the full value of this property. This is useful if the width of
5620the column is smaller than that of the value. 5747the column is smaller than that of the value.
5621@orgcmd{a,org-columns-edit-allowed} 5748@orgcmd{a,org-columns-edit-allowed}
5622Edit the list of allowed values for this property. If the list is found 5749Edit the list of allowed values for this property. If the list is found
5623in the hierarchy, the modified values is stored there. If no list is 5750in the hierarchy, the modified value is stored there. If no list is
5624found, the new value is stored in the first entry that is part of the 5751found, the new value is stored in the first entry that is part of the
5625current column view. 5752current column view.
5626@tsubheading{Modifying the table structure} 5753@tsubheading{Modifying the table structure}
@@ -5632,7 +5759,7 @@ Insert a new column, to the left of the current column.
5632Delete the current column. 5759Delete the current column.
5633@end table 5760@end table
5634 5761
5635@node Capturing column view, , Using column view, Column view 5762@node Capturing column view
5636@subsection Capturing column view 5763@subsection Capturing column view
5637 5764
5638Since column view is just an overlay over a buffer, it cannot be 5765Since column view is just an overlay over a buffer, it cannot be
@@ -5677,6 +5804,8 @@ When set to a number, don't capture entries below this level.
5677@item :skip-empty-rows 5804@item :skip-empty-rows
5678When set to @code{t}, skip rows where the only non-empty specifier of the 5805When set to @code{t}, skip rows where the only non-empty specifier of the
5679column view is @code{ITEM}. 5806column view is @code{ITEM}.
5807@item :indent
5808When non-@code{nil}, indent each @code{ITEM} field according to its level.
5680 5809
5681@end table 5810@end table
5682 5811
@@ -5709,7 +5838,7 @@ distributed with the main distribution of Org (visit
5709properties from entries in a certain scope, and arbitrary Lisp expressions to 5838properties from entries in a certain scope, and arbitrary Lisp expressions to
5710process these values before inserting them into a table or a dynamic block. 5839process these values before inserting them into a table or a dynamic block.
5711 5840
5712@node Property API, , Column view, Properties and Columns 5841@node Property API
5713@section The Property API 5842@section The Property API
5714@cindex properties, API 5843@cindex properties, API
5715@cindex API, for properties 5844@cindex API, for properties
@@ -5719,7 +5848,7 @@ be used by Emacs Lisp programs to work with properties and to implement
5719features based on them. For more information see @ref{Using the 5848features based on them. For more information see @ref{Using the
5720property API}. 5849property API}.
5721 5850
5722@node Dates and Times, Capture - Refile - Archive, Properties and Columns, Top 5851@node Dates and times
5723@chapter Dates and times 5852@chapter Dates and times
5724@cindex dates 5853@cindex dates
5725@cindex times 5854@cindex times
@@ -5729,7 +5858,7 @@ property API}.
5729To assist project planning, TODO items can be labeled with a date and/or 5858To assist project planning, TODO items can be labeled with a date and/or
5730a time. The specially formatted string carrying the date and time 5859a time. The specially formatted string carrying the date and time
5731information is called a @emph{timestamp} in Org mode. This may be a 5860information is called a @emph{timestamp} in Org mode. This may be a
5732little confusing because timestamp is often used as indicating when 5861little confusing because timestamp is often used to indicate when
5733something was created or last changed. However, in Org mode this term 5862something was created or last changed. However, in Org mode this term
5734is used in a much wider sense. 5863is used in a much wider sense.
5735 5864
@@ -5739,12 +5868,11 @@ is used in a much wider sense.
5739* Deadlines and scheduling:: Planning your work 5868* Deadlines and scheduling:: Planning your work
5740* Clocking work time:: Tracking how long you spend on a task 5869* Clocking work time:: Tracking how long you spend on a task
5741* Effort estimates:: Planning work effort in advance 5870* Effort estimates:: Planning work effort in advance
5742* Relative timer:: Notes with a running timer 5871* Timers:: Notes with a running timer
5743* Countdown timer:: Starting a countdown timer for a task
5744@end menu 5872@end menu
5745 5873
5746 5874
5747@node Timestamps, Creating timestamps, Dates and Times, Dates and Times 5875@node Timestamps
5748@section Timestamps, deadlines, and scheduling 5876@section Timestamps, deadlines, and scheduling
5749@cindex timestamps 5877@cindex timestamps
5750@cindex ranges, time 5878@cindex ranges, time
@@ -5795,10 +5923,10 @@ following will show up in the agenda every Wednesday:
5795For more complex date specifications, Org mode supports using the special 5923For more complex date specifications, Org mode supports using the special
5796sexp diary entries implemented in the Emacs calendar/diary 5924sexp diary entries implemented in the Emacs calendar/diary
5797package@footnote{When working with the standard diary sexp functions, you 5925package@footnote{When working with the standard diary sexp functions, you
5798need to be very careful with the order of the arguments. That order depend 5926need to be very careful with the order of the arguments. That order depends
5799evilly on the variable @code{calendar-date-style} (or, for older Emacs 5927evilly on the variable @code{calendar-date-style} (or, for older Emacs
5800versions, @code{european-calendar-style}). For example, to specify a date 5928versions, @code{european-calendar-style}). For example, to specify a date
5801December 12, 2005, the call might look like @code{(diary-date 12 1 2005)} or 5929December 1, 2005, the call might look like @code{(diary-date 12 1 2005)} or
5802@code{(diary-date 1 12 2005)} or @code{(diary-date 2005 12 1)}, depending on 5930@code{(diary-date 1 12 2005)} or @code{(diary-date 2005 12 1)}, depending on
5803the settings. This has been the source of much confusion. Org mode users 5931the settings. This has been the source of much confusion. Org mode users
5804can resort to special versions of these functions like @code{org-date} or 5932can resort to special versions of these functions like @code{org-date} or
@@ -5838,7 +5966,7 @@ angular ones. These timestamps are inactive in the sense that they do
5838 5966
5839@end table 5967@end table
5840 5968
5841@node Creating timestamps, Deadlines and scheduling, Timestamps, Dates and Times 5969@node Creating timestamps
5842@section Creating timestamps 5970@section Creating timestamps
5843@cindex creating timestamps 5971@cindex creating timestamps
5844@cindex timestamps, creating 5972@cindex timestamps, creating
@@ -5909,7 +6037,7 @@ the following column).
5909* Custom time format:: Making dates look different 6037* Custom time format:: Making dates look different
5910@end menu 6038@end menu
5911 6039
5912@node The date/time prompt, Custom time format, Creating timestamps, Creating timestamps 6040@node The date/time prompt
5913@subsection The date/time prompt 6041@subsection The date/time prompt
5914@cindex date, reading in minibuffer 6042@cindex date, reading in minibuffer
5915@cindex time, reading in minibuffer 6043@cindex time, reading in minibuffer
@@ -5948,7 +6076,7 @@ feb 15 @result{} @b{2007}-02-15
5948sep 12 9 @result{} 2009-09-12 6076sep 12 9 @result{} 2009-09-12
594912:45 @result{} @b{2006}-@b{06}-@b{13} 12:45 607712:45 @result{} @b{2006}-@b{06}-@b{13} 12:45
595022 sept 0:34 @result{} @b{2006}-09-22 00:34 607822 sept 0:34 @result{} @b{2006}-09-22 00:34
5951w4 @result{} ISO week for of the current year @b{2006} 6079w4 @result{} ISO week four of the current year @b{2006}
59522012 w4 fri @result{} Friday of ISO week 4 in 2012 60802012 w4 fri @result{} Friday of ISO week 4 in 2012
59532012-w04-5 @result{} Same as above 60812012-w04-5 @result{} Same as above
5954@end example 6082@end example
@@ -6017,14 +6145,18 @@ from the minibuffer:
6017@kindex M-S-@key{right} 6145@kindex M-S-@key{right}
6018@kindex M-S-@key{left} 6146@kindex M-S-@key{left}
6019@kindex @key{RET} 6147@kindex @key{RET}
6148@kindex M-S-@key{down}
6149@kindex M-S-@key{up}
6150
6020@example 6151@example
6021@key{RET} @r{Choose date at cursor in calendar.} 6152@key{RET} @r{Choose date at cursor in calendar.}
6022mouse-1 @r{Select date by clicking on it.} 6153mouse-1 @r{Select date by clicking on it.}
6023S-@key{right}/@key{left} @r{One day forward/backward.} 6154S-@key{right}/@key{left} @r{One day forward/backward.}
6024S-@key{down}/@key{up} @r{One week forward/backward.} 6155S-@key{down}/@key{up} @r{One week forward/backward.}
6025M-S-@key{right}/@key{left} @r{One month forward/backward.} 6156M-S-@key{right}/@key{left} @r{One month forward/backward.}
6026> / < @r{Scroll calendar forward/backward by one month.} 6157> / < @r{Scroll calendar forward/backward by one month.}
6027M-v / C-v @r{Scroll calendar forward/backward by 3 months.} 6158M-v / C-v @r{Scroll calendar forward/backward by 3 months.}
6159M-S-@key{down}/@key{up} @r{Scroll calendar forward/backward by one year.}
6028@end example 6160@end example
6029 6161
6030@vindex org-read-date-display-live 6162@vindex org-read-date-display-live
@@ -6035,7 +6167,7 @@ on, the current interpretation of your input will be displayed live in the
6035minibuffer@footnote{If you find this distracting, turn the display off with 6167minibuffer@footnote{If you find this distracting, turn the display off with
6036@code{org-read-date-display-live}.}. 6168@code{org-read-date-display-live}.}.
6037 6169
6038@node Custom time format, , The date/time prompt, Creating timestamps 6170@node Custom time format
6039@subsection Custom time format 6171@subsection Custom time format
6040@cindex custom date/time format 6172@cindex custom date/time format
6041@cindex time format, custom 6173@cindex time format, custom
@@ -6083,10 +6215,12 @@ format is shorter, things do work as expected.
6083@end itemize 6215@end itemize
6084 6216
6085 6217
6086@node Deadlines and scheduling, Clocking work time, Creating timestamps, Dates and Times 6218@node Deadlines and scheduling
6087@section Deadlines and scheduling 6219@section Deadlines and scheduling
6088 6220
6089A timestamp may be preceded by special keywords to facilitate planning: 6221A timestamp may be preceded by special keywords to facilitate planning. Both
6222the timestamp and the keyword have to be positioned immediatly after the task
6223they refer to.
6090 6224
6091@table @var 6225@table @var
6092@item DEADLINE 6226@item DEADLINE
@@ -6110,9 +6244,9 @@ until the entry is marked DONE@. An example:
6110@end example 6244@end example
6111 6245
6112You can specify a different lead time for warnings for a specific 6246You can specify a different lead time for warnings for a specific
6113deadlines using the following syntax. Here is an example with a warning 6247deadline using the following syntax. Here is an example with a warning
6114period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}. This warning is 6248period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}. This warning is
6115deactivated if the task get scheduled and you set 6249deactivated if the task gets scheduled and you set
6116@code{org-agenda-skip-deadline-prewarning-if-scheduled} to @code{t}. 6250@code{org-agenda-skip-deadline-prewarning-if-scheduled} to @code{t}.
6117 6251
6118@item SCHEDULED 6252@item SCHEDULED
@@ -6172,28 +6306,25 @@ sexp entry matches.
6172* Repeated tasks:: Items that show up again and again 6306* Repeated tasks:: Items that show up again and again
6173@end menu 6307@end menu
6174 6308
6175@node Inserting deadline/schedule, Repeated tasks, Deadlines and scheduling, Deadlines and scheduling 6309@node Inserting deadline/schedule
6176@subsection Inserting deadlines or schedules 6310@subsection Inserting deadlines or schedules
6177 6311
6178The following commands allow you to quickly insert@footnote{The @samp{SCHEDULED} and 6312The following commands allow you to quickly insert a deadline or to schedule
6179@samp{DEADLINE} dates are inserted on the line right below the headline. Don't put
6180any text between this line and the headline.} a deadline or to schedule
6181an item: 6313an item:
6182 6314
6183@table @kbd 6315@table @kbd
6184@c 6316@c
6185@orgcmd{C-c C-d,org-deadline} 6317@orgcmd{C-c C-d,org-deadline}
6186Insert @samp{DEADLINE} keyword along with a stamp. The insertion will happen 6318Insert @samp{DEADLINE} keyword along with a stamp. Any CLOSED timestamp will
6187in the line directly following the headline. Any CLOSED timestamp will be 6319be removed. When called with a prefix arg, an existing deadline will be
6188removed. When called with a prefix arg, an existing deadline will be removed 6320removed from the entry. Depending on the variable
6189from the entry. Depending on the variable @code{org-log-redeadline}@footnote{with corresponding 6321@code{org-log-redeadline}@footnote{with corresponding @code{#+STARTUP}
6190@code{#+STARTUP} keywords @code{logredeadline}, @code{lognoteredeadline}, 6322keywords @code{logredeadline}, @code{lognoteredeadline}, and
6191and @code{nologredeadline}}, a note will be taken when changing an existing 6323@code{nologredeadline}}, a note will be taken when changing an existing
6192deadline. 6324deadline.
6193 6325
6194@orgcmd{C-c C-s,org-schedule} 6326@orgcmd{C-c C-s,org-schedule}
6195Insert @samp{SCHEDULED} keyword along with a stamp. The insertion will 6327Insert @samp{SCHEDULED} keyword along with a stamp. Any CLOSED timestamp
6196happen in the line directly following the headline. Any CLOSED timestamp
6197will be removed. When called with a prefix argument, remove the scheduling 6328will be removed. When called with a prefix argument, remove the scheduling
6198date from the entry. Depending on the variable 6329date from the entry. Depending on the variable
6199@code{org-log-reschedule}@footnote{with corresponding @code{#+STARTUP} 6330@code{org-log-reschedule}@footnote{with corresponding @code{#+STARTUP}
@@ -6201,14 +6332,6 @@ keywords @code{logreschedule}, @code{lognotereschedule}, and
6201@code{nologreschedule}}, a note will be taken when changing an existing 6332@code{nologreschedule}}, a note will be taken when changing an existing
6202scheduling time. 6333scheduling time.
6203@c 6334@c
6204@orgcmd{C-c C-x C-k,org-mark-entry-for-agenda-action}
6205@kindex k a
6206@kindex k s
6207Mark the current entry for agenda action. After you have marked the entry
6208like this, you can open the agenda or the calendar to find an appropriate
6209date. With the cursor on the selected date, press @kbd{k s} or @kbd{k d} to
6210schedule the marked item.
6211@c
6212@orgcmd{C-c / d,org-check-deadlines} 6335@orgcmd{C-c / d,org-check-deadlines}
6213@cindex sparse tree, for deadlines 6336@cindex sparse tree, for deadlines
6214@vindex org-deadline-warning-days 6337@vindex org-deadline-warning-days
@@ -6230,7 +6353,7 @@ setting the date by indicating a relative time: e.g., +1d will set
6230the date to the next day after today, and --1w will set the date 6353the date to the next day after today, and --1w will set the date
6231to the previous week before any current timestamp. 6354to the previous week before any current timestamp.
6232 6355
6233@node Repeated tasks, , Inserting deadline/schedule, Deadlines and scheduling 6356@node Repeated tasks
6234@subsection Repeated tasks 6357@subsection Repeated tasks
6235@cindex tasks, repeated 6358@cindex tasks, repeated
6236@cindex repeated tasks 6359@cindex repeated tasks
@@ -6271,6 +6394,9 @@ switch the date like this:
6271 DEADLINE: <2005-11-01 Tue +1m> 6394 DEADLINE: <2005-11-01 Tue +1m>
6272@end example 6395@end example
6273 6396
6397To mark a task with a repeater as @code{DONE}, use @kbd{C-- 1 C-c C-t}
6398(i.e., @code{org-todo} with a numeric prefix argument of -1.)
6399
6274@vindex org-log-repeat 6400@vindex org-log-repeat
6275A timestamp@footnote{You can change this using the option 6401A timestamp@footnote{You can change this using the option
6276@code{org-log-repeat}, or the @code{#+STARTUP} options @code{logrepeat}, 6402@code{org-log-repeat}, or the @code{#+STARTUP} options @code{logrepeat},
@@ -6299,6 +6425,13 @@ special repeaters @samp{++} and @samp{.+}. For example:
6299 but also by as many weeks as it takes to get this date into 6425 but also by as many weeks as it takes to get this date into
6300 the future. However, it stays on a Sunday, even if you called 6426 the future. However, it stays on a Sunday, even if you called
6301 and marked it done on Saturday. 6427 and marked it done on Saturday.
6428** TODO Empty kitchen trash
6429 DEADLINE: <2008-02-08 Fri 20:00 ++1d>
6430 Marking this DONE will shift the date by at least one day, and
6431 also by as many days as it takes to get the timestamp into the
6432 future. Since there is a time in the timestamp, the next
6433 deadline in the future will be on today's date if you
6434 complete the task before 20:00.
6302** TODO Check the batteries in the smoke detectors 6435** TODO Check the batteries in the smoke detectors
6303 DEADLINE: <2005-11-01 Tue .+1m> 6436 DEADLINE: <2005-11-01 Tue .+1m>
6304 Marking this DONE will shift the date to one month after 6437 Marking this DONE will shift the date to one month after
@@ -6310,7 +6443,9 @@ You may have both scheduling and deadline information for a specific task.
6310If the repeater is set for the scheduling information only, you probably want 6443If the repeater is set for the scheduling information only, you probably want
6311the repeater to be ignored after the deadline. If so, set the variable 6444the repeater to be ignored after the deadline. If so, set the variable
6312@code{org-agenda-skip-scheduled-if-deadline-is-shown} to 6445@code{org-agenda-skip-scheduled-if-deadline-is-shown} to
6313@code{repeated-after-deadline}. If you want both scheduling and deadline 6446@code{repeated-after-deadline}. However, any scheduling information without
6447a repeater is no longer relevant once the task is done, and thus, removed
6448upon repeating the task. If you want both scheduling and deadline
6314information to repeat after the same interval, set the same repeater for both 6449information to repeat after the same interval, set the same repeater for both
6315timestamps. 6450timestamps.
6316 6451
@@ -6319,7 +6454,7 @@ subtree, with dates shifted in each copy. The command @kbd{C-c C-x c} was
6319created for this purpose, it is described in @ref{Structure editing}. 6454created for this purpose, it is described in @ref{Structure editing}.
6320 6455
6321 6456
6322@node Clocking work time, Effort estimates, Deadlines and scheduling, Dates and Times 6457@node Clocking work time
6323@section Clocking work time 6458@section Clocking work time
6324@cindex clocking time 6459@cindex clocking time
6325@cindex time clocking 6460@cindex time clocking
@@ -6330,10 +6465,9 @@ you stop working on that task, or when you mark the task done, the clock is
6330stopped and the corresponding time interval is recorded. It also computes 6465stopped and the corresponding time interval is recorded. It also computes
6331the total time spent on each subtree@footnote{Clocking only works if all 6466the total time spent on each subtree@footnote{Clocking only works if all
6332headings are indented with less than 30 stars. This is a hardcoded 6467headings are indented with less than 30 stars. This is a hardcoded
6333limitation of @code{lmax} in @code{org-clock-sum}.} of a project. And it 6468limitation of @code{lmax} in @code{org-clock-sum}.} of a project.
6334remembers a 6469And it remembers a history or tasks recently clocked, so that you can jump
6335history or tasks recently clocked, to that you can jump quickly between a 6470quickly between a number of tasks absorbing your time.
6336number of tasks absorbing your time.
6337 6471
6338To save the clock history across Emacs sessions, use 6472To save the clock history across Emacs sessions, use
6339@lisp 6473@lisp
@@ -6352,7 +6486,7 @@ what to do with it.
6352* Resolving idle time:: Resolving time when you've been idle 6486* Resolving idle time:: Resolving time when you've been idle
6353@end menu 6487@end menu
6354 6488
6355@node Clocking commands, The clock table, Clocking work time, Clocking work time 6489@node Clocking commands
6356@subsection Clocking commands 6490@subsection Clocking commands
6357 6491
6358@table @kbd 6492@table @kbd
@@ -6387,7 +6521,7 @@ reset of the task @footnote{as recorded by the @code{LAST_REPEAT} property}
6387will be shown. More control over what time is shown can be exercised with 6521will be shown. More control over what time is shown can be exercised with
6388the @code{CLOCK_MODELINE_TOTAL} property. It may have the values 6522the @code{CLOCK_MODELINE_TOTAL} property. It may have the values
6389@code{current} to show only the current clocking instance, @code{today} to 6523@code{current} to show only the current clocking instance, @code{today} to
6390show all time clocked on this tasks today (see also the variable 6524show all time clocked on this task today (see also the variable
6391@code{org-extend-today-until}), @code{all} to include all time, or 6525@code{org-extend-today-until}), @code{all} to include all time, or
6392@code{auto} which is the default@footnote{See also the variable 6526@code{auto} which is the default@footnote{See also the variable
6393@code{org-clock-modeline-total}.}.@* Clicking with @kbd{mouse-1} onto the 6527@code{org-clock-modeline-total}.}.@* Clicking with @kbd{mouse-1} onto the
@@ -6397,7 +6531,7 @@ mode line entry will pop up a menu with clocking options.
6397@vindex org-log-note-clock-out 6531@vindex org-log-note-clock-out
6398Stop the clock (clock-out). This inserts another timestamp at the same 6532Stop the clock (clock-out). This inserts another timestamp at the same
6399location where the clock was last started. It also directly computes 6533location where the clock was last started. It also directly computes
6400the resulting time in inserts it after the time range as @samp{=> 6534the resulting time and inserts it after the time range as @samp{=>
6401HH:MM}. See the variable @code{org-log-note-clock-out} for the 6535HH:MM}. See the variable @code{org-log-note-clock-out} for the
6402possibility to record an additional note together with the clock-out 6536possibility to record an additional note together with the clock-out
6403timestamp@footnote{The corresponding in-buffer setting is: 6537timestamp@footnote{The corresponding in-buffer setting is:
@@ -6449,10 +6583,10 @@ the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been
6449worked on or closed during a day. 6583worked on or closed during a day.
6450 6584
6451@strong{Important:} note that both @code{org-clock-out} and 6585@strong{Important:} note that both @code{org-clock-out} and
6452@code{org-clock-in-last} can have a global keybinding and will not 6586@code{org-clock-in-last} can have a global key binding and will not
6453modify the window disposition. 6587modify the window disposition.
6454 6588
6455@node The clock table, Resolving idle time, Clocking commands, Clocking work time 6589@node The clock table
6456@subsection The clock table 6590@subsection The clock table
6457@cindex clocktable, dynamic block 6591@cindex clocktable, dynamic block
6458@cindex report, of clocked time 6592@cindex report, of clocked time
@@ -6492,7 +6626,7 @@ buffer with the @kbd{C-c C-x C-r} command:
6492@end example 6626@end example
6493@noindent 6627@noindent
6494@vindex org-clocktable-defaults 6628@vindex org-clocktable-defaults
6495The @samp{BEGIN} line and specify a number of options to define the scope, 6629The @samp{BEGIN} line specifies a number of options to define the scope,
6496structure, and formatting of the report. Defaults for all these options can 6630structure, and formatting of the report. Defaults for all these options can
6497be configured in the variable @code{org-clocktable-defaults}. 6631be configured in the variable @code{org-clocktable-defaults}.
6498 6632
@@ -6512,7 +6646,7 @@ be selected:
6512 file-with-archives @r{current file and its archives} 6646 file-with-archives @r{current file and its archives}
6513 agenda-with-archives @r{all agenda files, including archives} 6647 agenda-with-archives @r{all agenda files, including archives}
6514:block @r{The time block to consider. This block is specified either} 6648:block @r{The time block to consider. This block is specified either}
6515 @r{absolute, or relative to the current time and may be any of} 6649 @r{absolutely, or relative to the current time and may be any of}
6516 @r{these formats:} 6650 @r{these formats:}
6517 2007-12-31 @r{New year eve 2007} 6651 2007-12-31 @r{New year eve 2007}
6518 2007-12 @r{December 2007} 6652 2007-12 @r{December 2007}
@@ -6523,6 +6657,7 @@ be selected:
6523 thisweek, lastweek, thisweek-@var{N} @r{a relative week} 6657 thisweek, lastweek, thisweek-@var{N} @r{a relative week}
6524 thismonth, lastmonth, thismonth-@var{N} @r{a relative month} 6658 thismonth, lastmonth, thismonth-@var{N} @r{a relative month}
6525 thisyear, lastyear, thisyear-@var{N} @r{a relative year} 6659 thisyear, lastyear, thisyear-@var{N} @r{a relative year}
6660 untilnow
6526 @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.} 6661 @r{Use @kbd{S-@key{left}/@key{right}} keys to shift the time interval.}
6527:tstart @r{A time string specifying when to start considering times.} 6662:tstart @r{A time string specifying when to start considering times.}
6528 @r{Relative times like @code{"<-2w>"} can also be used. See} 6663 @r{Relative times like @code{"<-2w>"} can also be used. See}
@@ -6541,7 +6676,7 @@ be selected:
6541 @r{@ref{Matching tags and properties} for the match syntax.} 6676 @r{@ref{Matching tags and properties} for the match syntax.}
6542@end example 6677@end example
6543 6678
6544Then there are options which determine the formatting of the table. There 6679Then there are options which determine the formatting of the table. These
6545options are interpreted by the function @code{org-clocktable-write-default}, 6680options are interpreted by the function @code{org-clocktable-write-default},
6546but you can specify your own function using the @code{:formatter} parameter. 6681but you can specify your own function using the @code{:formatter} parameter.
6547@example 6682@example
@@ -6555,6 +6690,8 @@ but you can specify your own function using the @code{:formatter} parameter.
6555:tcolumns @r{Number of columns to be used for times. If this is smaller} 6690:tcolumns @r{Number of columns to be used for times. If this is smaller}
6556 @r{than @code{:maxlevel}, lower levels will be lumped into one column.} 6691 @r{than @code{:maxlevel}, lower levels will be lumped into one column.}
6557:level @r{Should a level number column be included?} 6692:level @r{Should a level number column be included?}
6693:sort @r{A cons cell like containing the column to sort and a sorting type.}
6694 @r{E.g., @code{:sort (1 . ?a)} sorts the first column alphabetically.}
6558:compact @r{Abbreviation for @code{:level nil :indent t :narrow 40! :tcolumns 1}} 6695:compact @r{Abbreviation for @code{:level nil :indent t :narrow 40! :tcolumns 1}}
6559 @r{All are overwritten except if there is an explicit @code{:narrow}} 6696 @r{All are overwritten except if there is an explicit @code{:narrow}}
6560:timestamp @r{A timestamp for the entry, when available. Look for SCHEDULED,} 6697:timestamp @r{A timestamp for the entry, when available. Look for SCHEDULED,}
@@ -6600,7 +6737,7 @@ would be
6600#+END: clocktable 6737#+END: clocktable
6601@end example 6738@end example
6602 6739
6603@node Resolving idle time, , The clock table, Clocking work time 6740@node Resolving idle time
6604@subsection Resolving idle time and continuous clocking 6741@subsection Resolving idle time and continuous clocking
6605 6742
6606@subsubheading Resolving idle time 6743@subsubheading Resolving idle time
@@ -6616,7 +6753,7 @@ applying it to another one.
6616@vindex org-clock-idle-time 6753@vindex org-clock-idle-time
6617By customizing the variable @code{org-clock-idle-time} to some integer, such 6754By customizing the variable @code{org-clock-idle-time} to some integer, such
6618as 10 or 15, Emacs can alert you when you get back to your computer after 6755as 10 or 15, Emacs can alert you when you get back to your computer after
6619being idle for that many minutes@footnote{On computers using macOS, 6756being idle for that many minutes@footnote{On computers using Mac OS X,
6620idleness is based on actual user idleness, not just Emacs' idle time. For 6757idleness is based on actual user idleness, not just Emacs' idle time. For
6621X11, you can install a utility program @file{x11idle.c}, available in the 6758X11, you can install a utility program @file{x11idle.c}, available in the
6622@code{contrib/scripts} directory of the Org git distribution, or install the 6759@code{contrib/scripts} directory of the Org git distribution, or install the
@@ -6685,20 +6822,18 @@ last clocked entry for this session, and start the new clock from there.
6685If you only want this from time to time, use three universal prefix arguments 6822If you only want this from time to time, use three universal prefix arguments
6686with @code{org-clock-in} and two @kbd{C-u C-u} with @code{org-clock-in-last}. 6823with @code{org-clock-in} and two @kbd{C-u C-u} with @code{org-clock-in-last}.
6687 6824
6688@node Effort estimates, Relative timer, Clocking work time, Dates and Times 6825@node Effort estimates
6689@section Effort estimates 6826@section Effort estimates
6690@cindex effort estimates 6827@cindex effort estimates
6691 6828
6692@cindex property, Effort 6829@cindex property, Effort
6693@vindex org-effort-property
6694If you want to plan your work in a very detailed way, or if you need to 6830If you want to plan your work in a very detailed way, or if you need to
6695produce offers with quotations of the estimated work effort, you may want to 6831produce offers with quotations of the estimated work effort, you may want to
6696assign effort estimates to entries. If you are also clocking your work, you 6832assign effort estimates to entries. If you are also clocking your work, you
6697may later want to compare the planned effort with the actual working time, a 6833may later want to compare the planned effort with the actual working time,
6698great way to improve planning estimates. Effort estimates are stored in a 6834a great way to improve planning estimates. Effort estimates are stored in
6699special property @samp{Effort}@footnote{You may change the property being 6835a special property @code{EFFORT}. You can set the effort for an entry with
6700used with the variable @code{org-effort-property}.}. You can set the effort 6836the following commands:
6701for an entry with the following commands:
6702 6837
6703@table @kbd 6838@table @kbd
6704@orgcmd{C-c C-x e,org-set-effort} 6839@orgcmd{C-c C-x e,org-set-effort}
@@ -6748,61 +6883,57 @@ with the @kbd{/} key in the agenda (@pxref{Agenda commands}). If you have
6748these estimates defined consistently, two or three key presses will narrow 6883these estimates defined consistently, two or three key presses will narrow
6749down the list to stuff that fits into an available time slot. 6884down the list to stuff that fits into an available time slot.
6750 6885
6751@node Relative timer, Countdown timer, Effort estimates, Dates and Times 6886@node Timers
6752@section Taking notes with a relative timer 6887@section Taking notes with a timer
6753@cindex relative timer 6888@cindex relative timer
6889@cindex countdown timer
6890@kindex ;
6891
6892Org provides two types of timers. There is a relative timer that counts up,
6893which can be useful when taking notes during, for example, a meeting or
6894a video viewing. There is also a countdown timer.
6754 6895
6755When taking notes during, for example, a meeting or a video viewing, it can 6896The relative and countdown are started with separate commands.
6756be useful to have access to times relative to a starting time. Org provides 6897
6757such a relative timer and make it easy to create timed notes. 6898@table @kbd
6899@orgcmd{C-c C-x 0,org-timer-start}
6900Start or reset the relative timer. By default, the timer is set to 0. When
6901called with a @kbd{C-u} prefix, prompt the user for a starting offset. If
6902there is a timer string at point, this is taken as the default, providing a
6903convenient way to restart taking notes after a break in the process. When
6904called with a double prefix argument @kbd{C-u C-u}, change all timer strings
6905in the active region by a certain amount. This can be used to fix timer
6906strings if the timer was not started at exactly the right moment.
6907@orgcmd{C-c C-x ;,org-timer-set-timer}
6908Start a countdown timer. The user is prompted for a duration.
6909@code{org-timer-default-timer} sets the default countdown value. Giving
6910a numeric prefix argument overrides this default value. This command is
6911available as @kbd{;} in agenda buffers.
6912@end table
6913
6914Once started, relative and countdown timers are controlled with the same
6915commands.
6758 6916
6759@table @kbd 6917@table @kbd
6760@orgcmd{C-c C-x .,org-timer} 6918@orgcmd{C-c C-x .,org-timer}
6761Insert a relative time into the buffer. The first time you use this, the 6919Insert the value of the current relative or countdown timer into the buffer.
6762timer will be started. When called with a prefix argument, the timer is 6920If no timer is running, the relative timer will be started. When called with
6763restarted. 6921a prefix argument, the relative timer is restarted.
6764@orgcmd{C-c C-x -,org-timer-item} 6922@orgcmd{C-c C-x -,org-timer-item}
6765Insert a description list item with the current relative time. With a prefix 6923Insert a description list item with the value of the current relative or
6766argument, first reset the timer to 0. 6924countdown timer. With a prefix argument, first reset the relative timer to
69250.
6767@orgcmd{M-@key{RET},org-insert-heading} 6926@orgcmd{M-@key{RET},org-insert-heading}
6768Once the timer list is started, you can also use @kbd{M-@key{RET}} to insert 6927Once the timer list is started, you can also use @kbd{M-@key{RET}} to insert
6769new timer items. 6928new timer items.
6770@c for key sequences with a comma, command name macros fail :( 6929@orgcmd{C-c C-x @comma{},org-timer-pause-or-continue}
6771@kindex C-c C-x , 6930Pause the timer, or continue it if it is already paused.
6772@item C-c C-x , 6931@orgcmd{C-c C-x _,org-timer-stop}
6773Pause the timer, or continue it if it is already paused
6774(@command{org-timer-pause-or-continue}).
6775@c removed the sentence because it is redundant to the following item
6776@kindex C-u C-c C-x ,
6777@item C-u C-c C-x ,
6778Stop the timer. After this, you can only start a new timer, not continue the 6932Stop the timer. After this, you can only start a new timer, not continue the
6779old one. This command also removes the timer from the mode line. 6933old one. This command also removes the timer from the mode line.
6780@orgcmd{C-c C-x 0,org-timer-start}
6781Reset the timer without inserting anything into the buffer. By default, the
6782timer is reset to 0. When called with a @kbd{C-u} prefix, reset the timer to
6783specific starting offset. The user is prompted for the offset, with a
6784default taken from a timer string at point, if any, So this can be used to
6785restart taking notes after a break in the process. When called with a double
6786prefix argument @kbd{C-u C-u}, change all timer strings in the active region
6787by a certain amount. This can be used to fix timer strings if the timer was
6788not started at exactly the right moment.
6789@end table 6934@end table
6790 6935
6791@node Countdown timer, , Relative timer, Dates and Times 6936@node Capture - Refile - Archive
6792@section Countdown timer
6793@cindex Countdown timer
6794@kindex C-c C-x ;
6795@kindex ;
6796
6797Calling @code{org-timer-set-timer} from an Org mode buffer runs a countdown
6798timer. Use @kbd{;} from agenda buffers, @key{C-c C-x ;} everywhere else.
6799
6800@code{org-timer-set-timer} prompts the user for a duration and displays a
6801countdown timer in the modeline. @code{org-timer-default-timer} sets the
6802default countdown value. Giving a prefix numeric argument overrides this
6803default value.
6804
6805@node Capture - Refile - Archive, Agenda Views, Dates and Times, Top
6806@chapter Capture - Refile - Archive 6937@chapter Capture - Refile - Archive
6807@cindex capture 6938@cindex capture
6808 6939
@@ -6816,13 +6947,13 @@ trees to an archive file keeps the system compact and fast.
6816@menu 6947@menu
6817* Capture:: Capturing new stuff 6948* Capture:: Capturing new stuff
6818* Attachments:: Add files to tasks 6949* Attachments:: Add files to tasks
6819* RSS Feeds:: Getting input from RSS feeds 6950* RSS feeds:: Getting input from RSS feeds
6820* Protocols:: External (e.g., Browser) access to Emacs and Org 6951* Protocols:: External (e.g., Browser) access to Emacs and Org
6821* Refile and copy:: Moving/copying a tree from one place to another 6952* Refile and copy:: Moving/copying a tree from one place to another
6822* Archiving:: What to do with finished projects 6953* Archiving:: What to do with finished projects
6823@end menu 6954@end menu
6824 6955
6825@node Capture, Attachments, Capture - Refile - Archive, Capture - Refile - Archive 6956@node Capture
6826@section Capture 6957@section Capture
6827@cindex capture 6958@cindex capture
6828 6959
@@ -6849,7 +6980,7 @@ customization.
6849* Capture templates:: Define the outline of different note types 6980* Capture templates:: Define the outline of different note types
6850@end menu 6981@end menu
6851 6982
6852@node Setting up capture, Using capture, Capture, Capture 6983@node Setting up capture
6853@subsection Setting up capture 6984@subsection Setting up capture
6854 6985
6855The following customization sets a default target file for notes, and defines 6986The following customization sets a default target file for notes, and defines
@@ -6864,12 +6995,12 @@ suggestion.} for capturing new material.
6864@end group 6995@end group
6865@end smalllisp 6996@end smalllisp
6866 6997
6867@node Using capture, Capture templates, Setting up capture, Capture 6998@node Using capture
6868@subsection Using capture 6999@subsection Using capture
6869 7000
6870@table @kbd 7001@table @kbd
6871@orgcmd{C-c c,org-capture} 7002@orgcmd{C-c c,org-capture}
6872Call the command @code{org-capture}. Note that this keybinding is global and 7003Call the command @code{org-capture}. Note that this key binding is global and
6873not active by default: you need to install it. If you have templates 7004not active by default: you need to install it. If you have templates
6874@cindex date tree 7005@cindex date tree
6875defined @pxref{Capture templates}, it will offer these templates for 7006defined @pxref{Capture templates}, it will offer these templates for
@@ -6921,7 +7052,7 @@ automatically be created unless you set @code{org-capture-bookmark} to
6921To insert the capture at point in an Org buffer, call @code{org-capture} with 7052To insert the capture at point in an Org buffer, call @code{org-capture} with
6922a @code{C-0} prefix argument. 7053a @code{C-0} prefix argument.
6923 7054
6924@node Capture templates, , Using capture, Capture 7055@node Capture templates
6925@subsection Capture templates 7056@subsection Capture templates
6926@cindex templates, for Capture 7057@cindex templates, for Capture
6927 7058
@@ -6980,7 +7111,7 @@ like this:
6980* Templates in contexts:: Only show a template in a specific context 7111* Templates in contexts:: Only show a template in a specific context
6981@end menu 7112@end menu
6982 7113
6983@node Template elements, Template expansion, Capture templates, Capture templates 7114@node Template elements
6984@subsubsection Template elements 7115@subsubsection Template elements
6985 7116
6986Now lets look at the elements of a template definition. Each entry in 7117Now lets look at the elements of a template definition. Each entry in
@@ -7032,7 +7163,9 @@ files, targets usually define a node. Entries will become children of this
7032node. Other types will be added to the table or list in the body of this 7163node. Other types will be added to the table or list in the body of this
7033node. Most target specifications contain a file name. If that file name is 7164node. Most target specifications contain a file name. If that file name is
7034the empty string, it defaults to @code{org-default-notes-file}. A file can 7165the empty string, it defaults to @code{org-default-notes-file}. A file can
7035also be given as a variable, function, or Emacs Lisp form. 7166also be given as a variable or as a function called with no argument. When
7167an absolute path is not specified for a target, it is taken as relative to
7168@code{org-directory}.
7036 7169
7037Valid values are: 7170Valid values are:
7038 7171
@@ -7061,6 +7194,13 @@ one matched.}.
7061@item (file+datetree+prompt "path/to/file") 7194@item (file+datetree+prompt "path/to/file")
7062Will create a heading in a date tree, but will prompt for the date. 7195Will create a heading in a date tree, but will prompt for the date.
7063 7196
7197@item (file+weektree "path/to/file")
7198Will create a heading in a week tree for today's date. Week trees are sorted
7199by week and not by month unlike datetrees.
7200
7201@item (file+weektree+prompt "path/to/file")
7202Will create a heading in a week tree, but will prompt for the date.
7203
7064@item (file+function "path/to/file" function-finding-location) 7204@item (file+function "path/to/file" function-finding-location)
7065A function to find the right location in the file. 7205A function to find the right location in the file.
7066 7206
@@ -7068,8 +7208,8 @@ A function to find the right location in the file.
7068File to the entry that is currently being clocked. 7208File to the entry that is currently being clocked.
7069 7209
7070@item (function function-finding-location) 7210@item (function function-finding-location)
7071Most general way, write your own function to find both 7211Most general way: write your own function which both visits
7072file and location. 7212the file and moves point to the right location.
7073@end table 7213@end table
7074 7214
7075@item template 7215@item template
@@ -7117,9 +7257,10 @@ narrow it so that you only see the new material.
7117 7257
7118@item :table-line-pos 7258@item :table-line-pos
7119Specification of the location in the table where the new line should be 7259Specification of the location in the table where the new line should be
7120inserted. It should be a string like @code{"II-3"} meaning that the new 7260inserted. It can be a string, a variable holding a string or a function
7121line should become the third line before the second horizontal separator 7261returning a string. The string should look like @code{"II-3"} meaning that
7122line. 7262the new line should become the third line before the second horizontal
7263separator line.
7123 7264
7124@item :kill-buffer 7265@item :kill-buffer
7125If the target file was not yet visited when capture was invoked, kill the 7266If the target file was not yet visited when capture was invoked, kill the
@@ -7127,7 +7268,7 @@ buffer again after capture is completed.
7127@end table 7268@end table
7128@end table 7269@end table
7129 7270
7130@node Template expansion, Templates in contexts, Template elements, Capture templates 7271@node Template expansion
7131@subsubsection Template expansion 7272@subsubsection Template expansion
7132 7273
7133In the template itself, special @kbd{%}-escapes@footnote{If you need one of 7274In the template itself, special @kbd{%}-escapes@footnote{If you need one of
@@ -7169,7 +7310,7 @@ dynamic insertion of content. The templates are expanded in the order given her
7169 @r{You may specify a default value and a completion table with} 7310 @r{You may specify a default value and a completion table with}
7170 @r{%^@{prompt|default|completion2|completion3...@}.} 7311 @r{%^@{prompt|default|completion2|completion3...@}.}
7171 @r{The arrow keys access a prompt-specific history.} 7312 @r{The arrow keys access a prompt-specific history.}
7172%\n @r{Insert the text entered at the nth %^@{@var{prompt}@}, where @code{n} is} 7313%\1 @dots{} %\N @r{Insert the text entered at the Nth %^@{@var{prompt}@}, where @code{N} is}
7173 @r{a number, starting from 1.} 7314 @r{a number, starting from 1.}
7174%? @r{After completing the template, position cursor here.} 7315%? @r{After completing the template, position cursor here.}
7175@end smallexample 7316@end smallexample
@@ -7187,15 +7328,15 @@ Link type | Available keywords
7187---------------------------------+---------------------------------------------- 7328---------------------------------+----------------------------------------------
7188bbdb | %:name %:company 7329bbdb | %:name %:company
7189irc | %:server %:port %:nick 7330irc | %:server %:port %:nick
7190vm, vm-imap, wl, mh, mew, rmail | %:type %:subject %:message-id 7331vm, vm-imap, wl, mh, mew, rmail, | %:type %:subject %:message-id
7191 | %:from %:fromname %:fromaddress 7332gnus, notmuch | %:from %:fromname %:fromaddress
7192 | %:to %:toname %:toaddress 7333 | %:to %:toname %:toaddress
7193 | %:date @r{(message date header field)} 7334 | %:date @r{(message date header field)}
7194 | %:date-timestamp @r{(date as active timestamp)} 7335 | %:date-timestamp @r{(date as active timestamp)}
7195 | %:date-timestamp-inactive @r{(date as inactive timestamp)} 7336 | %:date-timestamp-inactive @r{(date as inactive timestamp)}
7196 | %:fromto @r{(either "to NAME" or "from NAME")@footnote{This will always be the other, not the user. See the variable @code{org-from-is-user-regexp}.}} 7337 | %:fromto @r{(either "to NAME" or "from NAME")@footnote{This will always be the other, not the user. See the variable @code{org-from-is-user-regexp}.}}
7197gnus | %:group, @r{for messages also all email fields} 7338gnus | %:group, @r{for messages also all email fields}
7198w3, w3m | %:url 7339eww, w3, w3m | %:url
7199info | %:file %:node 7340info | %:file %:node
7200calendar | %:date 7341calendar | %:date
7201@end smallexample 7342@end smallexample
@@ -7207,7 +7348,7 @@ To place the cursor after template expansion use:
7207%? @r{After completing the template, position cursor here.} 7348%? @r{After completing the template, position cursor here.}
7208@end smallexample 7349@end smallexample
7209 7350
7210@node Templates in contexts, , Template expansion, Capture templates 7351@node Templates in contexts
7211@subsubsection Templates in contexts 7352@subsubsection Templates in contexts
7212 7353
7213@vindex org-capture-templates-contexts 7354@vindex org-capture-templates-contexts
@@ -7231,7 +7372,7 @@ template. In that case, add this command key like this:
7231 7372
7232See the docstring of the variable for more information. 7373See the docstring of the variable for more information.
7233 7374
7234@node Attachments, RSS Feeds, Capture, Capture - Refile - Archive 7375@node Attachments
7235@section Attachments 7376@section Attachments
7236@cindex attachments 7377@cindex attachments
7237 7378
@@ -7319,7 +7460,7 @@ same directory for attachments as the parent does.
7319@end table 7460@end table
7320@end table 7461@end table
7321 7462
7322@node RSS Feeds, Protocols, Attachments, Capture - Refile - Archive 7463@node RSS feeds
7323@section RSS feeds 7464@section RSS feeds
7324@cindex RSS feeds 7465@cindex RSS feeds
7325@cindex Atom feeds 7466@cindex Atom feeds
@@ -7357,17 +7498,12 @@ Prompt for a feed name and go to the inbox configured for this feed.
7357 7498
7358Under the same headline, Org will create a drawer @samp{FEEDSTATUS} in which 7499Under the same headline, Org will create a drawer @samp{FEEDSTATUS} in which
7359it will store information about the status of items in the feed, to avoid 7500it will store information about the status of items in the feed, to avoid
7360adding the same item several times. You should add @samp{FEEDSTATUS} to the 7501adding the same item several times.
7361list of drawers in that file:
7362
7363@example
7364#+DRAWERS: LOGBOOK PROPERTIES FEEDSTATUS
7365@end example
7366 7502
7367For more information, including how to read atom feeds, see 7503For more information, including how to read atom feeds, see
7368@file{org-feed.el} and the docstring of @code{org-feed-alist}. 7504@file{org-feed.el} and the docstring of @code{org-feed-alist}.
7369 7505
7370@node Protocols, Refile and copy, RSS Feeds, Capture - Refile - Archive 7506@node Protocols
7371@section Protocols for external access 7507@section Protocols for external access
7372@cindex protocols, for external access 7508@cindex protocols, for external access
7373@cindex emacsserver 7509@cindex emacsserver
@@ -7381,7 +7517,7 @@ a remote website you are looking at with the browser. See
7381@uref{http://orgmode.org/worg/org-contrib/org-protocol.php} for detailed 7517@uref{http://orgmode.org/worg/org-contrib/org-protocol.php} for detailed
7382documentation and setup instructions. 7518documentation and setup instructions.
7383 7519
7384@node Refile and copy, Archiving, Protocols, Capture - Refile - Archive 7520@node Refile and copy
7385@section Refile and copy 7521@section Refile and copy
7386@cindex refiling notes 7522@cindex refiling notes
7387@cindex copying notes 7523@cindex copying notes
@@ -7438,7 +7574,7 @@ setting @code{org-refile-use-cache}. To make the command see new possible
7438targets, you have to clear the cache with this command. 7574targets, you have to clear the cache with this command.
7439@end table 7575@end table
7440 7576
7441@node Archiving, , Refile and copy, Capture - Refile - Archive 7577@node Archiving
7442@section Archiving 7578@section Archiving
7443@cindex archiving 7579@cindex archiving
7444 7580
@@ -7459,7 +7595,7 @@ Archive the current entry using the command specified in the variable
7459* Internal archiving:: Switch off a tree but keep it in the file 7595* Internal archiving:: Switch off a tree but keep it in the file
7460@end menu 7596@end menu
7461 7597
7462@node Moving subtrees, Internal archiving, Archiving, Archiving 7598@node Moving subtrees
7463@subsection Moving a tree to the archive file 7599@subsection Moving a tree to the archive file
7464@cindex external archiving 7600@cindex external archiving
7465 7601
@@ -7477,6 +7613,10 @@ the archive. To do this, each subtree is checked for open TODO entries.
7477If none are found, the command offers to move it to the archive 7613If none are found, the command offers to move it to the archive
7478location. If the cursor is @emph{not} on a headline when this command 7614location. If the cursor is @emph{not} on a headline when this command
7479is invoked, the level 1 trees will be checked. 7615is invoked, the level 1 trees will be checked.
7616@orgkey{C-u C-u C-c C-x C-s}
7617As above, but check subtree for timestamps instead of TODO entries. The
7618command will offer to archive the subtree if it @emph{does} contain a
7619timestamp, and that timestamp is in the past.
7480@end table 7620@end table
7481 7621
7482@cindex archive locations 7622@cindex archive locations
@@ -7488,14 +7628,7 @@ For information and examples on how to specify the file and the heading,
7488see the documentation string of the variable 7628see the documentation string of the variable
7489@code{org-archive-location}. 7629@code{org-archive-location}.
7490 7630
7491There is also an in-buffer option for setting this variable, for 7631There is also an in-buffer option for setting this variable, for example:
7492example@footnote{For backward compatibility, the following also works:
7493If there are several such lines in a file, each specifies the archive
7494location for the text below it. The first such line also applies to any
7495text before its definition. However, using this method is
7496@emph{strongly} deprecated as it is incompatible with the outline
7497structure of the document. The correct method for setting multiple
7498archive locations in a buffer is using properties.}:
7499 7632
7500@cindex #+ARCHIVE 7633@cindex #+ARCHIVE
7501@example 7634@example
@@ -7506,7 +7639,7 @@ archive locations in a buffer is using properties.}:
7506@noindent 7639@noindent
7507If you would like to have a special ARCHIVE location for a single entry 7640If you would like to have a special ARCHIVE location for a single entry
7508or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the 7641or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the
7509location as the value (@pxref{Properties and Columns}). 7642location as the value (@pxref{Properties and columns}).
7510 7643
7511@vindex org-archive-save-context-info 7644@vindex org-archive-save-context-info
7512When a subtree is moved, it receives a number of special properties that 7645When a subtree is moved, it receives a number of special properties that
@@ -7516,14 +7649,15 @@ outline path the archiving time etc. Configure the variable
7516added. 7649added.
7517 7650
7518 7651
7519@node Internal archiving, , Moving subtrees, Archiving 7652@node Internal archiving
7520@subsection Internal archiving 7653@subsection Internal archiving
7521 7654
7522If you want to just switch off (for agenda views) certain subtrees without 7655@cindex archive tag
7523moving them to a different file, you can use the @code{ARCHIVE tag}. 7656If you want to just switch off---for agenda views---certain subtrees without
7657moving them to a different file, you can use the archive tag.
7524 7658
7525A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at 7659A headline that is marked with the @samp{:ARCHIVE:} tag (@pxref{Tags}) stays
7526its location in the outline tree, but behaves in the following way: 7660at its location in the outline tree, but behaves in the following way:
7527@itemize @minus 7661@itemize @minus
7528@item 7662@item
7529@vindex org-cycle-open-archived-trees 7663@vindex org-cycle-open-archived-trees
@@ -7539,7 +7673,7 @@ archived subtrees are not exposed, unless you configure the option
7539@code{org-sparse-tree-open-archived-trees}. 7673@code{org-sparse-tree-open-archived-trees}.
7540@item 7674@item
7541@vindex org-agenda-skip-archived-trees 7675@vindex org-agenda-skip-archived-trees
7542During agenda view construction (@pxref{Agenda Views}), the content of 7676During agenda view construction (@pxref{Agenda views}), the content of
7543archived trees is ignored unless you configure the option 7677archived trees is ignored unless you configure the option
7544@code{org-agenda-skip-archived-trees}, in which case these trees will always 7678@code{org-agenda-skip-archived-trees}, in which case these trees will always
7545be included. In the agenda you can press @kbd{v a} to get archives 7679be included. In the agenda you can press @kbd{v a} to get archives
@@ -7579,7 +7713,7 @@ outline.
7579@end table 7713@end table
7580 7714
7581 7715
7582@node Agenda Views, Markup, Capture - Refile - Archive, Top 7716@node Agenda views
7583@chapter Agenda views 7717@chapter Agenda views
7584@cindex agenda views 7718@cindex agenda views
7585 7719
@@ -7622,6 +7756,15 @@ buffer}. This buffer is read-only, but provides commands to visit the
7622corresponding locations in the original Org files, and even to 7756corresponding locations in the original Org files, and even to
7623edit these files remotely. 7757edit these files remotely.
7624 7758
7759@vindex org-agenda-skip-comment-trees
7760@vindex org-agenda-skip-archived-trees
7761@cindex commented entries, in agenda views
7762@cindex archived entries, in agenda views
7763By default, the report ignores commented (@pxref{Comment lines}) and archived
7764(@pxref{Internal archiving}) entries. You can override this by setting
7765@code{org-agenda-skip-comment-trees} and
7766@code{org-agenda-skip-archived-trees} to @code{nil}.
7767
7625@vindex org-agenda-window-setup 7768@vindex org-agenda-window-setup
7626@vindex org-agenda-restore-windows-after-quit 7769@vindex org-agenda-restore-windows-after-quit
7627Two variables control how the agenda buffer is displayed and whether the 7770Two variables control how the agenda buffer is displayed and whether the
@@ -7636,11 +7779,11 @@ window configuration is restored when the agenda exits:
7636* Presentation and sorting:: How agenda items are prepared for display 7779* Presentation and sorting:: How agenda items are prepared for display
7637* Agenda commands:: Remote editing of Org trees 7780* Agenda commands:: Remote editing of Org trees
7638* Custom agenda views:: Defining special searches and views 7781* Custom agenda views:: Defining special searches and views
7639* Exporting Agenda Views:: Writing a view to a file 7782* Exporting agenda views:: Writing a view to a file
7640* Agenda column view:: Using column view for collected entries 7783* Agenda column view:: Using column view for collected entries
7641@end menu 7784@end menu
7642 7785
7643@node Agenda files, Agenda dispatcher, Agenda Views, Agenda Views 7786@node Agenda files
7644@section Agenda files 7787@section Agenda files
7645@cindex agenda files 7788@cindex agenda files
7646@cindex files for agenda 7789@cindex files for agenda
@@ -7717,7 +7860,7 @@ effect immediately.
7717Lift the restriction. 7860Lift the restriction.
7718@end table 7861@end table
7719 7862
7720@node Agenda dispatcher, Built-in agenda views, Agenda files, Agenda Views 7863@node Agenda dispatcher
7721@section The agenda dispatcher 7864@section The agenda dispatcher
7722@cindex agenda dispatcher 7865@cindex agenda dispatcher
7723@cindex dispatching agenda commands 7866@cindex dispatching agenda commands
@@ -7763,15 +7906,17 @@ current region/subtree.}. After pressing @kbd{< <}, you still need to press the
7763character selecting the command. 7906character selecting the command.
7764 7907
7765@item * 7908@item *
7909@cindex agenda, sticky
7766@vindex org-agenda-sticky 7910@vindex org-agenda-sticky
7767Toggle sticky agenda views. By default, Org maintains only a single agenda 7911Toggle sticky agenda views. By default, Org maintains only a single agenda
7768buffer and rebuilds it each time you change the view, to make sure everything 7912buffer and rebuilds it each time you change the view, to make sure everything
7769is always up to date. If you switch between views often and the build time 7913is always up to date. If you often switch between agenda views and the build
7770bothers you, you can turn on sticky agenda buffers (make this the default by 7914time bothers you, you can turn on sticky agenda buffers or make this the
7771customizing the variable @code{org-agenda-sticky}). With sticky agendas, the 7915default by customizing the variable @code{org-agenda-sticky}. With sticky
7772dispatcher only switches to the selected view, you need to update it by hand 7916agendas, the agenda dispatcher will not recreate agenda views from scratch,
7773with @kbd{r} or @kbd{g}. You can toggle sticky agenda view any time with 7917it will only switch to the selected one, and you need to update the agenda by
7774@code{org-toggle-sticky-agenda}. 7918hand with @kbd{r} or @kbd{g} when needed. You can toggle sticky agenda view
7919any time with @code{org-toggle-sticky-agenda}.
7775@end table 7920@end table
7776 7921
7777You can also define custom commands that will be accessible through the 7922You can also define custom commands that will be accessible through the
@@ -7780,7 +7925,7 @@ possibility to create extended agenda buffers that contain several
7780blocks together, for example the weekly agenda, the global TODO list and 7925blocks together, for example the weekly agenda, the global TODO list and
7781a number of special tags matches. @xref{Custom agenda views}. 7926a number of special tags matches. @xref{Custom agenda views}.
7782 7927
7783@node Built-in agenda views, Presentation and sorting, Agenda dispatcher, Agenda Views 7928@node Built-in agenda views
7784@section The built-in agenda views 7929@section The built-in agenda views
7785 7930
7786In this section we describe the built-in views. 7931In this section we describe the built-in views.
@@ -7794,7 +7939,7 @@ In this section we describe the built-in views.
7794* Stuck projects:: Find projects you need to review 7939* Stuck projects:: Find projects you need to review
7795@end menu 7940@end menu
7796 7941
7797@node Weekly/daily agenda, Global TODO list, Built-in agenda views, Built-in agenda views 7942@node Weekly/daily agenda
7798@subsection The weekly/daily agenda 7943@subsection The weekly/daily agenda
7799@cindex agenda 7944@cindex agenda
7800@cindex weekly agenda 7945@cindex weekly agenda
@@ -7872,10 +8017,16 @@ the following segment of an Org file will be processed and entries
7872will be made in the agenda: 8017will be made in the agenda:
7873 8018
7874@example 8019@example
7875* Birthdays and similar stuff 8020* Holidays
7876#+CATEGORY: Holiday 8021 :PROPERTIES:
8022 :CATEGORY: Holiday
8023 :END:
7877%%(org-calendar-holiday) ; special function for holiday names 8024%%(org-calendar-holiday) ; special function for holiday names
7878#+CATEGORY: Ann 8025
8026* Birthdays
8027 :PROPERTIES:
8028 :CATEGORY: Ann
8029 :END:
7879%%(org-anniversary 1956 5 14)@footnote{@code{org-anniversary} is just like @code{diary-anniversary}, but the argument order is always according to ISO and therefore independent of the value of @code{calendar-date-style}.} Arthur Dent is %d years old 8030%%(org-anniversary 1956 5 14)@footnote{@code{org-anniversary} is just like @code{diary-anniversary}, but the argument order is always according to ISO and therefore independent of the value of @code{calendar-date-style}.} Arthur Dent is %d years old
7880%%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old 8031%%(org-anniversary 1869 10 2) Mahatma Gandhi would be %d years old
7881@end example 8032@end example
@@ -7919,6 +8070,20 @@ hash with anniversaries. However, from then on things will be very fast---much
7919faster in fact than a long list of @samp{%%(diary-anniversary)} entries 8070faster in fact than a long list of @samp{%%(diary-anniversary)} entries
7920in an Org or Diary file. 8071in an Org or Diary file.
7921 8072
8073If you would like to see upcoming anniversaries with a bit of forewarning,
8074you can use the following instead:
8075
8076@example
8077* Anniversaries
8078 :PROPERTIES:
8079 :CATEGORY: Anniv
8080 :END:
8081%%(org-bbdb-anniversaries-future 3)
8082@end example
8083
8084That will give you three days' warning: on the anniversary date itself and the
8085two days prior. The argument is optional: if omitted, it defaults to 7.
8086
7922@subsubheading Appointment reminders 8087@subsubheading Appointment reminders
7923@cindex @file{appt.el} 8088@cindex @file{appt.el}
7924@cindex appointment reminders 8089@cindex appointment reminders
@@ -7933,7 +8098,7 @@ It also reads a @code{APPT_WARNTIME} property which will then override the
7933value of @code{appt-message-warning-time} for this appointment. See the 8098value of @code{appt-message-warning-time} for this appointment. See the
7934docstring for details. 8099docstring for details.
7935 8100
7936@node Global TODO list, Matching tags and properties, Weekly/daily agenda, Built-in agenda views 8101@node Global TODO list
7937@subsection The global TODO list 8102@subsection The global TODO list
7938@cindex global TODO list 8103@cindex global TODO list
7939@cindex TODO list, global 8104@cindex TODO list, global
@@ -7944,7 +8109,7 @@ collected into a single place.
7944@table @kbd 8109@table @kbd
7945@orgcmd{C-c a t,org-todo-list} 8110@orgcmd{C-c a t,org-todo-list}
7946Show the global TODO list. This collects the TODO items from all agenda 8111Show the global TODO list. This collects the TODO items from all agenda
7947files (@pxref{Agenda Views}) into a single buffer. By default, this lists 8112files (@pxref{Agenda views}) into a single buffer. By default, this lists
7948items with a state the is not a DONE state. The buffer is in 8113items with a state the is not a DONE state. The buffer is in
7949@code{agenda-mode}, so there are commands to examine and manipulate the TODO 8114@code{agenda-mode}, so there are commands to examine and manipulate the TODO
7950entries directly from that buffer (@pxref{Agenda commands}). 8115entries directly from that buffer (@pxref{Agenda commands}).
@@ -7994,7 +8159,7 @@ and omit the sublevels from the global list. Configure the variable
7994@code{org-agenda-todo-list-sublevels} to get this behavior. 8159@code{org-agenda-todo-list-sublevels} to get this behavior.
7995@end itemize 8160@end itemize
7996 8161
7997@node Matching tags and properties, Timeline, Global TODO list, Built-in agenda views 8162@node Matching tags and properties
7998@subsection Matching tags and properties 8163@subsection Matching tags and properties
7999@cindex matching, of tags 8164@cindex matching, of tags
8000@cindex matching, of properties 8165@cindex matching, of properties
@@ -8002,7 +8167,7 @@ and omit the sublevels from the global list. Configure the variable
8002@cindex match view 8167@cindex match view
8003 8168
8004If headlines in the agenda files are marked with @emph{tags} (@pxref{Tags}), 8169If headlines in the agenda files are marked with @emph{tags} (@pxref{Tags}),
8005or have properties (@pxref{Properties and Columns}), you can select headlines 8170or have properties (@pxref{Properties and columns}), you can select headlines
8006based on this metadata and collect them into an agenda buffer. The match 8171based on this metadata and collect them into an agenda buffer. The match
8007syntax described here also applies when creating sparse trees with @kbd{C-c / 8172syntax described here also applies when creating sparse trees with @kbd{C-c /
8008m}. 8173m}.
@@ -8063,31 +8228,29 @@ braces. For example,
8063@samp{:work:} and any tag @i{starting} with @samp{boss}. 8228@samp{:work:} and any tag @i{starting} with @samp{boss}.
8064 8229
8065@cindex group tags, as regular expressions 8230@cindex group tags, as regular expressions
8066Group tags (@pxref{Tag groups}) are expanded as regular expressions. E.g., 8231Group tags (@pxref{Tag hierarchy}) are expanded as regular expressions. E.g.,
8067if @samp{:work:} is a group tag for the group @samp{:work:lab:conf:}, then 8232if @samp{:work:} is a group tag for the group @samp{:work:lab:conf:}, then
8068searching for @samp{work} will search for @samp{@{\(?:work\|lab\|conf\)@}} 8233searching for @samp{work} will search for @samp{@{\(?:work\|lab\|conf\)@}}
8069and searching for @samp{-work} will search for all headlines but those with 8234and searching for @samp{-work} will search for all headlines but those with
8070one of the tag in the group (i.e., @samp{-@{\(?:work\|lab\|conf\)@}}). 8235one of the tags in the group (i.e., @samp{-@{\(?:work\|lab\|conf\)@}}).
8071 8236
8072@cindex TODO keyword matching, with tags search 8237@cindex TODO keyword matching, with tags search
8073@cindex level, require for tags/property match 8238@cindex level, require for tags/property match
8074@cindex category, require for tags/property match 8239@cindex category, require for tags/property match
8075@vindex org-odd-levels-only 8240@vindex org-odd-levels-only
8076You may also test for properties (@pxref{Properties and Columns}) at the same 8241You may also test for properties (@pxref{Properties and columns}) at the same
8077time as matching tags. The properties may be real properties, or special 8242time as matching tags. The properties may be real properties, or special
8078properties that represent other metadata (@pxref{Special properties}). For 8243properties that represent other metadata (@pxref{Special properties}). For
8079example, the ``property'' @code{TODO} represents the TODO keyword of the 8244example, the ``property'' @code{TODO} represents the TODO keyword of the
8080entry and the ``property'' @code{PRIORITY} represents the PRIORITY keyword of 8245entry and the ``property'' @code{PRIORITY} represents the PRIORITY keyword of
8081the entry. The ITEM special property cannot currently be used in tags/property 8246the entry.
8082searches@footnote{But @pxref{x-agenda-skip-entry-regexp,
8083,skipping entries based on regexp}.}.
8084 8247
8085Except the @pxref{Special properties}, one other ``property'' can also be 8248In addition to the properties mentioned above, @code{LEVEL} represents the
8086used. @code{LEVEL} represents the level of an entry. So a search 8249level of an entry. So a search @samp{+LEVEL=3+boss-TODO="DONE"} lists all
8087@samp{+LEVEL=3+boss-TODO="DONE"} lists all level three headlines that have 8250level three headlines that have the tag @samp{boss} and are @emph{not} marked
8088the tag @samp{boss} and are @emph{not} marked with the TODO keyword DONE@. 8251with the TODO keyword DONE@. In buffers with @code{org-odd-levels-only} set,
8089In buffers with @code{org-odd-levels-only} set, @samp{LEVEL} does not count 8252@samp{LEVEL} does not count the number of stars, but @samp{LEVEL=2} will
8090the number of stars, but @samp{LEVEL=2} will correspond to 3 stars etc. 8253correspond to 3 stars etc.
8091 8254
8092Here are more examples: 8255Here are more examples:
8093 8256
@@ -8141,11 +8304,6 @@ property that is numerically smaller than 2, a @samp{:With:} property that is
8141matched by the regular expression @samp{Sarah\|Denny}, and that are scheduled 8304matched by the regular expression @samp{Sarah\|Denny}, and that are scheduled
8142on or after October 11, 2008. 8305on or after October 11, 2008.
8143 8306
8144Accessing TODO, LEVEL, and CATEGORY during a search is fast. Accessing any
8145other properties will slow down the search. However, once you have paid the
8146price by accessing one property, testing additional properties is cheap
8147again.
8148
8149You can configure Org mode to use property inheritance during a search, but 8307You can configure Org mode to use property inheritance during a search, but
8150beware that this can slow down searches considerably. See @ref{Property 8308beware that this can slow down searches considerably. See @ref{Property
8151inheritance}, for details. 8309inheritance}, for details.
@@ -8174,7 +8332,7 @@ Select @samp{:work:}-tagged TODO lines that are either @samp{WAITING} or
8174@samp{NEXT}. 8332@samp{NEXT}.
8175@end table 8333@end table
8176 8334
8177@node Timeline, Search view, Matching tags and properties, Built-in agenda views 8335@node Timeline
8178@subsection Timeline for a single file 8336@subsection Timeline for a single file
8179@cindex timeline, single file 8337@cindex timeline, single file
8180@cindex time-sorted view 8338@cindex time-sorted view
@@ -8194,7 +8352,7 @@ When called with a @kbd{C-u} prefix, all unfinished TODO entries
8194The commands available in the timeline buffer are listed in 8352The commands available in the timeline buffer are listed in
8195@ref{Agenda commands}. 8353@ref{Agenda commands}.
8196 8354
8197@node Search view, Stuck projects, Timeline, Built-in agenda views 8355@node Search view
8198@subsection Search view 8356@subsection Search view
8199@cindex search view 8357@cindex search view
8200@cindex text search 8358@cindex text search
@@ -8224,7 +8382,7 @@ the docstring of the command @code{org-search-view}.
8224Note that in addition to the agenda files, this command will also search 8382Note that in addition to the agenda files, this command will also search
8225the files listed in @code{org-agenda-text-search-extra-files}. 8383the files listed in @code{org-agenda-text-search-extra-files}.
8226 8384
8227@node Stuck projects, , Search view, Built-in agenda views 8385@node Stuck projects
8228@subsection Stuck projects 8386@subsection Stuck projects
8229@pindex GTD, Getting Things Done 8387@pindex GTD, Getting Things Done
8230 8388
@@ -8272,7 +8430,7 @@ correct customization for this is
8272Note that if a project is identified as non-stuck, the subtree of this entry 8430Note that if a project is identified as non-stuck, the subtree of this entry
8273will still be searched for stuck projects. 8431will still be searched for stuck projects.
8274 8432
8275@node Presentation and sorting, Agenda commands, Built-in agenda views, Agenda Views 8433@node Presentation and sorting
8276@section Presentation and sorting 8434@section Presentation and sorting
8277@cindex presentation, of agenda items 8435@cindex presentation, of agenda items
8278 8436
@@ -8294,21 +8452,14 @@ associated with the item.
8294* Filtering/limiting agenda items:: Dynamically narrow the agenda 8452* Filtering/limiting agenda items:: Dynamically narrow the agenda
8295@end menu 8453@end menu
8296 8454
8297@node Categories, Time-of-day specifications, Presentation and sorting, Presentation and sorting 8455@node Categories
8298@subsection Categories 8456@subsection Categories
8299 8457
8300@cindex category 8458@cindex category
8301@cindex #+CATEGORY 8459@cindex #+CATEGORY
8302The category is a broad label assigned to each agenda item. By default, 8460The category is a broad label assigned to each agenda item. By default, the
8303the category is simply derived from the file name, but you can also 8461category is simply derived from the file name, but you can also specify it
8304specify it with a special line in the buffer, like this@footnote{For 8462with a special line in the buffer, like this:
8305backward compatibility, the following also works: if there are several
8306such lines in a file, each specifies the category for the text below it.
8307The first category also applies to any text before the first CATEGORY
8308line. However, using this method is @emph{strongly} deprecated as it is
8309incompatible with the outline structure of the document. The correct
8310method for setting multiple categories in a buffer is using a
8311property.}:
8312 8463
8313@example 8464@example
8314#+CATEGORY: Thesis 8465#+CATEGORY: Thesis
@@ -8328,7 +8479,7 @@ longer than 10 characters.
8328You can set up icons for category by customizing the 8479You can set up icons for category by customizing the
8329@code{org-agenda-category-icon-alist} variable. 8480@code{org-agenda-category-icon-alist} variable.
8330 8481
8331@node Time-of-day specifications, Sorting agenda items, Categories, Presentation and sorting 8482@node Time-of-day specifications
8332@subsection Time-of-day specifications 8483@subsection Time-of-day specifications
8333@cindex time-of-day specification 8484@cindex time-of-day specification
8334 8485
@@ -8379,7 +8530,7 @@ The time grid can be turned on and off with the variable
8379@code{org-agenda-use-time-grid}, and can be configured with 8530@code{org-agenda-use-time-grid}, and can be configured with
8380@code{org-agenda-time-grid}. 8531@code{org-agenda-time-grid}.
8381 8532
8382@node Sorting agenda items, Filtering/limiting agenda items, Time-of-day specifications, Presentation and sorting 8533@node Sorting agenda items
8383@subsection Sorting agenda items 8534@subsection Sorting agenda items
8384@cindex sorting, of agenda items 8535@cindex sorting, of agenda items
8385@cindex priorities, of agenda items 8536@cindex priorities, of agenda items
@@ -8413,14 +8564,14 @@ Sorting can be customized using the variable
8413@code{org-agenda-sorting-strategy}, and may also include criteria based on 8564@code{org-agenda-sorting-strategy}, and may also include criteria based on
8414the estimated effort of an entry (@pxref{Effort estimates}). 8565the estimated effort of an entry (@pxref{Effort estimates}).
8415 8566
8416@node Filtering/limiting agenda items, , Sorting agenda items, Presentation and sorting 8567@node Filtering/limiting agenda items
8417@subsection Filtering/limiting agenda items 8568@subsection Filtering/limiting agenda items
8418 8569
8419Agenda built-in or customized commands are statically defined. Agenda 8570Agenda built-in or customized commands are statically defined. Agenda
8420filters and limits provide two ways of dynamically narrowing down the list of 8571filters and limits provide two ways of dynamically narrowing down the list of
8421agenda entries: @emph{fitlers} and @emph{limits}. Filters only act on the 8572agenda entries: @emph{filters} and @emph{limits}. Filters only act on the
8422display of the items, while limits take effect before the list of agenda 8573display of the items, while limits take effect before the list of agenda
8423entries is built. Filter are more often used interactively, while limits are 8574entries is built. Filters are more often used interactively, while limits are
8424mostly useful when defined as local variables within custom agenda commands. 8575mostly useful when defined as local variables within custom agenda commands.
8425 8576
8426@subsubheading Filtering in the agenda 8577@subsubheading Filtering in the agenda
@@ -8444,34 +8595,14 @@ refreshes and more secondary filtering. The filter is a global property of
8444the entire agenda view---in a block agenda, you should only set this in the 8595the entire agenda view---in a block agenda, you should only set this in the
8445global options section, not in the section of an individual block.} 8596global options section, not in the section of an individual block.}
8446 8597
8447You will be prompted for a tag selection letter; @key{SPC} will mean any tag at 8598You will be prompted for a tag selection letter; @key{SPC} will mean any tag
8448all. Pressing @key{TAB} at that prompt will offer use completion to select a 8599at all. Pressing @key{TAB} at that prompt will offer use completion to
8449tag (including any tags that do not have a selection character). The command 8600select a tag (including any tags that do not have a selection character).
8450then hides all entries that do not contain or inherit this tag. When called 8601The command then hides all entries that do not contain or inherit this tag.
8451with prefix arg, remove the entries that @emph{do} have the tag. A second 8602When called with prefix arg, remove the entries that @emph{do} have the tag.
8452@kbd{/} at the prompt will turn off the filter and unhide any hidden entries. 8603A second @kbd{/} at the prompt will turn off the filter and unhide any hidden
8453If the first key you press is either @kbd{+} or @kbd{-}, the previous filter 8604entries. Pressing @kbd{+} or @kbd{-} switches between filtering and
8454will be narrowed by requiring or forbidding the selected additional tag. 8605excluding the next tag.
8455Instead of pressing @kbd{+} or @kbd{-} after @kbd{/}, you can also
8456immediately use the @kbd{\} command.
8457
8458@vindex org-sort-agenda-noeffort-is-high
8459In order to filter for effort estimates, you should set up allowed
8460efforts globally, for example
8461@lisp
8462(setq org-global-properties
8463 '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
8464@end lisp
8465You can then filter for an effort by first typing an operator, one of
8466@kbd{<}, @kbd{>}, and @kbd{=}, and then the one-digit index of an effort
8467estimate in your array of allowed values, where @kbd{0} means the 10th value.
8468The filter will then restrict to entries with effort smaller-or-equal, equal,
8469or larger-or-equal than the selected value. If the digits 0--9 are not used
8470as fast access keys to tags, you can also simply press the index digit
8471directly without an operator. In this case, @kbd{<} will be assumed. For
8472application of the operator, entries without a defined effort will be treated
8473according to the value of @code{org-sort-agenda-noeffort-is-high}. To filter
8474for tasks without effort definition, press @kbd{?} as the operator.
8475 8606
8476Org also supports automatic, context-aware tag filtering. If the variable 8607Org also supports automatic, context-aware tag filtering. If the variable
8477@code{org-agenda-auto-exclude-function} is set to a user-defined function, 8608@code{org-agenda-auto-exclude-function} is set to a user-defined function,
@@ -8499,12 +8630,6 @@ Internet, and outside of business hours, with something like this:
8499@end group 8630@end group
8500@end smalllisp 8631@end smalllisp
8501 8632
8502@orgcmd{\\,org-agenda-filter-by-tag-refine}
8503Narrow the current agenda filter by an additional condition. When called with
8504prefix arg, remove the entries that @emph{do} have the tag, or that do match
8505the effort criterion. You can achieve the same effect by pressing @kbd{+} or
8506@kbd{-} as the first key after the @kbd{/} command.
8507
8508@c 8633@c
8509@kindex [ 8634@kindex [
8510@kindex ] 8635@kindex ]
@@ -8525,9 +8650,12 @@ selected.
8525@vindex org-agenda-category-filter-preset 8650@vindex org-agenda-category-filter-preset
8526 8651
8527Filter the current agenda view with respect to the category of the item at 8652Filter the current agenda view with respect to the category of the item at
8528point. Pressing @code{<} another time will remove this filter. You can add 8653point. Pressing @code{<} another time will remove this filter. When called
8529a filter preset through the option @code{org-agenda-category-filter-preset} 8654with a prefix argument exclude the category of the item at point from the
8530(see below.) 8655agenda.
8656
8657You can add a filter preset in custom agenda commands through the option
8658@code{org-agenda-category-filter-preset}. @xref{Setting options}.
8531 8659
8532@orgcmd{^,org-agenda-filter-by-top-headline} 8660@orgcmd{^,org-agenda-filter-by-top-headline}
8533Filter the current agenda view and only display the siblings and the parent 8661Filter the current agenda view and only display the siblings and the parent
@@ -8540,8 +8668,34 @@ Filter the agenda view by a regular expression: only show agenda entries
8540matching the regular expression the user entered. When called with a prefix 8668matching the regular expression the user entered. When called with a prefix
8541argument, it will filter @emph{out} entries matching the regexp. With two 8669argument, it will filter @emph{out} entries matching the regexp. With two
8542universal prefix arguments, it will remove all the regexp filters, which can 8670universal prefix arguments, it will remove all the regexp filters, which can
8543be accumulated. You can add a filter preset through the option 8671be accumulated.
8544@code{org-agenda-category-filter-preset} (see below.) 8672
8673You can add a filter preset in custom agenda commands through the option
8674@code{org-agenda-regexp-filter-preset}. @xref{Setting options}.
8675
8676@orgcmd{_,org-agenda-filter-by-effort}
8677@vindex org-agenda-effort-filter-preset
8678@vindex org-sort-agenda-noeffort-is-high
8679Filter the agenda view with respect to effort estimates.
8680You first need to set up allowed efforts globally, for example
8681@lisp
8682(setq org-global-properties
8683 '(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
8684@end lisp
8685You can then filter for an effort by first typing an operator, one of
8686@kbd{<}, @kbd{>}, and @kbd{=}, and then the one-digit index of an effort
8687estimate in your array of allowed values, where @kbd{0} means the 10th value.
8688The filter will then restrict to entries with effort smaller-or-equal, equal,
8689or larger-or-equal than the selected value. For application of the operator,
8690entries without a defined effort will be treated according to the value of
8691@code{org-sort-agenda-noeffort-is-high}.
8692
8693When called with a prefix argument, it will remove entries matching the
8694condition. With two universal prefix arguments, it will clear effort
8695filters, which can be accumulated.
8696
8697You can add a filter preset in custom agenda commands through the option
8698@code{org-agenda-effort-filter-preset}. @xref{Setting options}.
8545 8699
8546@orgcmd{|,org-agenda-filter-remove-all} 8700@orgcmd{|,org-agenda-filter-remove-all}
8547Remove all filters in the current agenda view. 8701Remove all filters in the current agenda view.
@@ -8555,9 +8709,9 @@ Remove all filters in the current agenda view.
8555@vindex org-agenda-max-tags 8709@vindex org-agenda-max-tags
8556 8710
8557Here is a list of options that you can set, either globally, or locally in 8711Here is a list of options that you can set, either globally, or locally in
8558your custom agenda views@pxref{Custom agenda views}. 8712your custom agenda views (@pxref{Custom agenda views}).
8559 8713
8560@table @var 8714@table @code
8561@item org-agenda-max-entries 8715@item org-agenda-max-entries
8562Limit the number of entries. 8716Limit the number of entries.
8563@item org-agenda-max-effort 8717@item org-agenda-max-effort
@@ -8570,7 +8724,7 @@ Limit the number of tagged entries.
8570 8724
8571When set to a positive integer, each option will exclude entries from other 8725When set to a positive integer, each option will exclude entries from other
8572categories: for example, @code{(setq org-agenda-max-effort 100)} will limit 8726categories: for example, @code{(setq org-agenda-max-effort 100)} will limit
8573the agenda to 100 minutes of effort and exclude any entry that as no effort 8727the agenda to 100 minutes of effort and exclude any entry that has no effort
8574property. If you want to include entries with no effort property, use a 8728property. If you want to include entries with no effort property, use a
8575negative value for @code{org-agenda-max-effort}. 8729negative value for @code{org-agenda-max-effort}.
8576 8730
@@ -8588,15 +8742,15 @@ Once you mark one of these five entry as @code{DONE}, rebuilding the agenda
8588will again the next five entries again, including the first entry that was 8742will again the next five entries again, including the first entry that was
8589excluded so far. 8743excluded so far.
8590 8744
8591You can also dynamically set temporary limits@footnote{Those temporary limits 8745You can also dynamically set temporary limits, which will be lost when
8592are lost when rebuilding the agenda.}: 8746rebuilding the agenda:
8593 8747
8594@table @kbd 8748@table @kbd
8595@orgcmd{~,org-agenda-limit-interactively} 8749@orgcmd{~,org-agenda-limit-interactively}
8596This prompts for the type of limit to apply and its value. 8750This prompts for the type of limit to apply and its value.
8597@end table 8751@end table
8598 8752
8599@node Agenda commands, Custom agenda views, Presentation and sorting, Agenda Views 8753@node Agenda commands
8600@section Commands in the agenda buffer 8754@section Commands in the agenda buffer
8601@cindex commands, in agenda buffer 8755@cindex commands, in agenda buffer
8602 8756
@@ -8617,11 +8771,14 @@ the other commands, the cursor needs to be in the desired line.
8617Next line (same as @key{down} and @kbd{C-n}). 8771Next line (same as @key{down} and @kbd{C-n}).
8618@orgcmd{p,org-agenda-previous-line} 8772@orgcmd{p,org-agenda-previous-line}
8619Previous line (same as @key{up} and @kbd{C-p}). 8773Previous line (same as @key{up} and @kbd{C-p}).
8774@orgcmd{N,org-agenda-next-item}
8775Next item: same as next line, but only consider items.
8776@orgcmd{P,org-agenda-previous-item}
8777Previous item: same as previous line, but only consider items.
8620@tsubheading{View/Go to Org file} 8778@tsubheading{View/Go to Org file}
8621@orgcmdkkc{@key{SPC},mouse-3,org-agenda-show-and-scroll-up} 8779@orgcmdkkc{@key{SPC},mouse-3,org-agenda-show-and-scroll-up}
8622Display the original location of the item in another window. 8780Display the original location of the item in another window. With prefix
8623With prefix arg, make sure that the entire entry is made visible in the 8781arg, make sure that drawers stay folded.
8624outline, not only the heading.
8625@c 8782@c
8626@orgcmd{L,org-agenda-recenter} 8783@orgcmd{L,org-agenda-recenter}
8627Display original location and recenter that window. 8784Display original location and recenter that window.
@@ -8719,6 +8876,7 @@ agenda and timeline views.
8719@c 8876@c
8720@orgcmd{v a,org-agenda-archives-mode} 8877@orgcmd{v a,org-agenda-archives-mode}
8721@xorgcmd{v A,org-agenda-archives-mode 'files} 8878@xorgcmd{v A,org-agenda-archives-mode 'files}
8879@cindex Archives mode
8722Toggle Archives mode. In Archives mode, trees that are marked 8880Toggle Archives mode. In Archives mode, trees that are marked
8723@code{ARCHIVED} are also scanned when producing the agenda. When you use the 8881@code{ARCHIVED} are also scanned when producing the agenda. When you use the
8724capital @kbd{A}, even all archive files are included. To exit archives mode, 8882capital @kbd{A}, even all archive files are included. To exit archives mode,
@@ -8789,35 +8947,25 @@ file or subtree (@pxref{Agenda files}).
8789 8947
8790@tsubheading{Secondary filtering and query editing} 8948@tsubheading{Secondary filtering and query editing}
8791 8949
8792For a detailed description of these commands, see @pxref{Filtering/limiting 8950For a detailed description of these commands, @pxref{Filtering/limiting
8793agenda items}. 8951agenda items}.
8794 8952
8795@orgcmd{/,org-agenda-filter-by-tag} 8953@orgcmd{/,org-agenda-filter-by-tag}
8796@vindex org-agenda-tag-filter-preset
8797Filter the agenda view with respect to a tag and/or effort estimates. 8954Filter the agenda view with respect to a tag and/or effort estimates.
8798 8955
8799@orgcmd{\\,org-agenda-filter-by-tag-refine}
8800Narrow the current agenda filter by an additional condition.
8801
8802@orgcmd{<,org-agenda-filter-by-category} 8956@orgcmd{<,org-agenda-filter-by-category}
8803@vindex org-agenda-category-filter-preset
8804
8805Filter the current agenda view with respect to the category of the item at 8957Filter the current agenda view with respect to the category of the item at
8806point. Pressing @code{<} another time will remove this filter. 8958point.
8807 8959
8808@orgcmd{^,org-agenda-filter-by-top-headline} 8960@orgcmd{^,org-agenda-filter-by-top-headline}
8809Filter the current agenda view and only display the siblings and the parent 8961Filter the current agenda view and only display the siblings and the parent
8810headline of the one at point. 8962headline of the one at point.
8811 8963
8812@orgcmd{=,org-agenda-filter-by-regexp} 8964@orgcmd{=,org-agenda-filter-by-regexp}
8813@vindex org-agenda-regexp-filter-preset 8965Filter the agenda view by a regular expression.
8814 8966
8815Filter the agenda view by a regular expression: only show agenda entries 8967@orgcmd{_,org-agenda-filter-by-effort}
8816matching the regular expression the user entered. When called with a prefix 8968Filter the agenda view with respect to effort estimates.
8817argument, it will filter @emph{out} entries matching the regexp. With two
8818universal prefix arguments, it will remove all the regexp filters, which can
8819be accumulated. You can add a filter preset through the option
8820@code{org-agenda-category-filter-preset} (see below.)
8821 8969
8822@orgcmd{|,org-agenda-filter-remove-all} 8970@orgcmd{|,org-agenda-filter-remove-all}
8823Remove all filters in the current agenda view. 8971Remove all filters in the current agenda view.
@@ -8996,8 +9144,8 @@ Bulk action: act on all marked entries in the agenda. This will prompt for
8996another key to select the action to be applied. The prefix arg to @kbd{B} 9144another key to select the action to be applied. The prefix arg to @kbd{B}
8997will be passed through to the @kbd{s} and @kbd{d} commands, to bulk-remove 9145will be passed through to the @kbd{s} and @kbd{d} commands, to bulk-remove
8998these special timestamps. By default, marks are removed after the bulk. If 9146these special timestamps. By default, marks are removed after the bulk. If
8999you want them to persist, set @code{org-agenda-bulk-persistent-marks} to 9147you want them to persist, set @code{org-agenda-persistent-marks} to @code{t}
9000@code{t} or hit @kbd{p} at the prompt. 9148or hit @kbd{p} at the prompt.
9001 9149
9002@table @kbd 9150@table @kbd
9003@item * 9151@item *
@@ -9124,7 +9272,7 @@ visit Org files will not be removed.
9124@end table 9272@end table
9125 9273
9126 9274
9127@node Custom agenda views, Exporting Agenda Views, Agenda commands, Agenda Views 9275@node Custom agenda views
9128@section Custom agenda views 9276@section Custom agenda views
9129@cindex custom agenda views 9277@cindex custom agenda views
9130@cindex agenda views, custom 9278@cindex agenda views, custom
@@ -9137,10 +9285,10 @@ dispatcher (@pxref{Agenda dispatcher}), just like the default commands.
9137@menu 9285@menu
9138* Storing searches:: Type once, use often 9286* Storing searches:: Type once, use often
9139* Block agenda:: All the stuff you need in a single buffer 9287* Block agenda:: All the stuff you need in a single buffer
9140* Setting Options:: Changing the rules 9288* Setting options:: Changing the rules
9141@end menu 9289@end menu
9142 9290
9143@node Storing searches, Block agenda, Custom agenda views, Custom agenda views 9291@node Storing searches
9144@subsection Storing searches 9292@subsection Storing searches
9145 9293
9146The first application of custom searches is the definition of keyboard 9294The first application of custom searches is the definition of keyboard
@@ -9162,7 +9310,7 @@ buffer).
9162Custom commands are configured in the variable 9310Custom commands are configured in the variable
9163@code{org-agenda-custom-commands}. You can customize this variable, for 9311@code{org-agenda-custom-commands}. You can customize this variable, for
9164example by pressing @kbd{C-c a C}. You can also directly set it with Emacs 9312example by pressing @kbd{C-c a C}. You can also directly set it with Emacs
9165Lisp in @file{.emacs}. The following example contains all valid agenda 9313Lisp in the Emacs init file. The following example contains all valid agenda
9166views: 9314views:
9167 9315
9168@lisp 9316@lisp
@@ -9232,7 +9380,7 @@ Peter, or Kim) as additional tag to match.
9232Note that the @code{*-tree} agenda views need to be called from an 9380Note that the @code{*-tree} agenda views need to be called from an
9233Org buffer as they operate on the current buffer only. 9381Org buffer as they operate on the current buffer only.
9234 9382
9235@node Block agenda, Setting Options, Storing searches, Custom agenda views 9383@node Block agenda
9236@subsection Block agenda 9384@subsection Block agenda
9237@cindex block agenda 9385@cindex block agenda
9238@cindex agenda, with block views 9386@cindex agenda, with block views
@@ -9266,7 +9414,7 @@ your agenda for the current week, all TODO items that carry the tag
9266@samp{home}, and also all lines tagged with @samp{garden}. Finally the 9414@samp{home}, and also all lines tagged with @samp{garden}. Finally the
9267command @kbd{C-c a o} provides a similar view for office tasks. 9415command @kbd{C-c a o} provides a similar view for office tasks.
9268 9416
9269@node Setting Options, , Block agenda, Custom agenda views 9417@node Setting options
9270@subsection Setting options for custom commands 9418@subsection Setting options for custom commands
9271@cindex options, for custom agenda views 9419@cindex options, for custom agenda views
9272 9420
@@ -9285,8 +9433,7 @@ right spot in @code{org-agenda-custom-commands}. For example:
9285 ((org-agenda-sorting-strategy '(priority-down)) 9433 ((org-agenda-sorting-strategy '(priority-down))
9286 (org-agenda-prefix-format " Mixed: "))) 9434 (org-agenda-prefix-format " Mixed: ")))
9287 ("U" tags-tree "+boss-urgent" 9435 ("U" tags-tree "+boss-urgent"
9288 ((org-show-following-heading nil) 9436 ((org-show-context-detail 'minimal)))
9289 (org-show-hierarchy-above nil)))
9290 ("N" search "" 9437 ("N" search ""
9291 ((org-agenda-files '("~org/notes.org")) 9438 ((org-agenda-files '("~org/notes.org"))
9292 (org-agenda-text-search-extra-files nil))))) 9439 (org-agenda-text-search-extra-files nil)))))
@@ -9340,7 +9487,7 @@ yourself.
9340@vindex org-agenda-custom-commands-contexts 9487@vindex org-agenda-custom-commands-contexts
9341To control whether an agenda command should be accessible from a specific 9488To control whether an agenda command should be accessible from a specific
9342context, you can customize @code{org-agenda-custom-commands-contexts}. Let's 9489context, you can customize @code{org-agenda-custom-commands-contexts}. Let's
9343say for example that you have an agenda commands @code{"o"} displaying a view 9490say for example that you have an agenda command @code{"o"} displaying a view
9344that you only need when reading emails. Then you would configure this option 9491that you only need when reading emails. Then you would configure this option
9345like this: 9492like this:
9346 9493
@@ -9359,8 +9506,8 @@ command key @code{"r"}. In that case, add this command key like this:
9359 9506
9360See the docstring of the variable for more information. 9507See the docstring of the variable for more information.
9361 9508
9362@node Exporting Agenda Views, Agenda column view, Custom agenda views, Agenda Views 9509@node Exporting agenda views
9363@section Exporting Agenda Views 9510@section Exporting agenda views
9364@cindex agenda views, exporting 9511@cindex agenda views, exporting
9365 9512
9366If you are away from your computer, it can be very useful to have a printed 9513If you are away from your computer, it can be very useful to have a printed
@@ -9498,7 +9645,7 @@ processing by other programs. See @ref{Extracting agenda information}, for
9498more information. 9645more information.
9499 9646
9500 9647
9501@node Agenda column view, , Exporting Agenda Views, Agenda Views 9648@node Agenda column view
9502@section Using column view in the agenda 9649@section Using column view in the agenda
9503@cindex column view, in agenda 9650@cindex column view, in agenda
9504@cindex agenda, column view 9651@cindex agenda, column view
@@ -9524,11 +9671,12 @@ This causes the following issues:
9524Org needs to make a decision which @code{COLUMNS} format to use. Since the 9671Org needs to make a decision which @code{COLUMNS} format to use. Since the
9525entries in the agenda are collected from different files, and different files 9672entries in the agenda are collected from different files, and different files
9526may have different @code{COLUMNS} formats, this is a non-trivial problem. 9673may have different @code{COLUMNS} formats, this is a non-trivial problem.
9527Org first checks if the variable @code{org-agenda-overriding-columns-format} is 9674Org first checks if the variable @code{org-agenda-overriding-columns-format}
9528currently set, and if so, takes the format from there. Otherwise it takes 9675is currently set, and if so, takes the format from there. Otherwise it takes
9529the format associated with the first item in the agenda, or, if that item 9676the format associated with the first item in the agenda, or, if that item
9530does not have a specific format (defined in a property, or in its file), it 9677does not have a specific format---defined in a property, or in its file---it
9531uses @code{org-columns-default-format}. 9678uses @code{org-columns-default-format}.
9679
9532@item 9680@item
9533@cindex property, special, CLOCKSUM 9681@cindex property, special, CLOCKSUM
9534If any of the columns has a summary type defined (@pxref{Column attributes}), 9682If any of the columns has a summary type defined (@pxref{Column attributes}),
@@ -9537,11 +9685,12 @@ make sure that the computations of this property are up to date. This is
9537also true for the special @code{CLOCKSUM} property. Org will then sum the 9685also true for the special @code{CLOCKSUM} property. Org will then sum the
9538values displayed in the agenda. In the daily/weekly agenda, the sums will 9686values displayed in the agenda. In the daily/weekly agenda, the sums will
9539cover a single day; in all other views they cover the entire block. It is 9687cover a single day; in all other views they cover the entire block. It is
9540vital to realize that the agenda may show the same entry @emph{twice} (for 9688vital to realize that the agenda may show the same entry @emph{twice}---for
9541example as scheduled and as a deadline), and it may show two entries from the 9689example as scheduled and as a deadline---and it may show two entries from the
9542same hierarchy (for example a @emph{parent} and its @emph{child}). In these 9690same hierarchy---for example a @emph{parent} and its @emph{child}. In these
9543cases, the summation in the agenda will lead to incorrect results because 9691cases, the summation in the agenda will lead to incorrect results because
9544some values will count double. 9692some values will count double.
9693
9545@item 9694@item
9546When the column view in the agenda shows the @code{CLOCKSUM}, that is always 9695When the column view in the agenda shows the @code{CLOCKSUM}, that is always
9547the entire clocked time for this item. So even in the daily/weekly agenda, 9696the entire clocked time for this item. So even in the daily/weekly agenda,
@@ -9555,149 +9704,46 @@ the agenda).
9555@item 9704@item
9556@cindex property, special, CLOCKSUM_T 9705@cindex property, special, CLOCKSUM_T
9557When the column view in the agenda shows the @code{CLOCKSUM_T}, that is 9706When the column view in the agenda shows the @code{CLOCKSUM_T}, that is
9558always today's clocked time for this item. So even in the weekly agenda, 9707always today's clocked time for this item. So even in the weekly agenda, the
9559the clocksum listed in column view only originates from today. This lets 9708clocksum listed in column view only originates from today. This lets you
9560you compare the time you spent on a task for today, with the time already 9709compare the time you spent on a task for today, with the time already
9561spent (via @code{CLOCKSUM}) and with the planned total effort for it. 9710spent ---via @code{CLOCKSUM}---and with the planned total effort for it.
9562@end enumerate 9711@end enumerate
9563 9712
9564 9713
9565@node Markup, Exporting, Agenda Views, Top 9714@node Markup
9566@chapter Markup for rich export 9715@chapter Markup for rich export
9567 9716
9568When exporting Org mode documents, the exporter tries to reflect the 9717When exporting Org mode documents, the exporter tries to reflect the
9569structure of the document as accurately as possible in the back-end. Since 9718structure of the document as accurately as possible in the back-end. Since
9570export targets like HTML, @LaTeX{} allow much richer formatting, Org mode has 9719export targets like HTML and @LaTeX{} allow much richer formatting, Org mode has
9571rules on how to prepare text for rich export. This section summarizes the 9720rules on how to prepare text for rich export. This section summarizes the
9572markup rules used in an Org mode buffer. 9721markup rules used in an Org mode buffer.
9573 9722
9574@menu 9723@menu
9575* Structural markup elements:: The basic structure as seen by the exporter 9724* Paragraphs:: The basic unit of text
9725* Emphasis and monospace:: Bold, italic, etc.
9726* Horizontal rules:: Make a line
9576* Images and tables:: Images, tables and caption mechanism 9727* Images and tables:: Images, tables and caption mechanism
9577* Literal examples:: Source code examples with special formatting 9728* Literal examples:: Source code examples with special formatting
9578* Include files:: Include additional files into a document 9729* Special symbols:: Greek letters and other symbols
9579* Index entries:: Making an index 9730* Subscripts and superscripts:: Simple syntax for raising/lowering text
9580* Macro replacement:: Use macros to create templates
9581* Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents 9731* Embedded @LaTeX{}:: LaTeX can be freely used inside Org documents
9582* Special blocks:: Containers targeted at export back-ends
9583@end menu
9584
9585@node Structural markup elements, Images and tables, Markup, Markup
9586@section Structural markup elements
9587
9588@menu
9589* Document title:: Where the title is taken from
9590* Headings and sections:: The document structure as seen by the exporter
9591* Table of contents:: The if and where of the table of contents
9592* Lists:: Lists
9593* Paragraphs:: Paragraphs
9594* Footnote markup:: Footnotes
9595* Emphasis and monospace:: Bold, italic, etc.
9596* Horizontal rules:: Make a line
9597* Comment lines:: What will *not* be exported
9598@end menu 9732@end menu
9599 9733
9600@node Document title, Headings and sections, Structural markup elements, Structural markup elements 9734@node Paragraphs
9601@subheading Document title 9735@section Paragraphs, line breaks, and quoting
9602@cindex document title, markup rules
9603
9604@noindent
9605The title of the exported document is taken from the special line
9606
9607@cindex #+TITLE
9608@example
9609#+TITLE: This is the title of the document
9610@end example
9611
9612@noindent
9613If this line does not exist, the title will be the name of the file
9614associated to buffer, without extension, or the buffer name.
9615
9616@cindex property, EXPORT_TITLE
9617If you are exporting only a subtree, its heading will become the title of the
9618document. If the subtree has a property @code{EXPORT_TITLE}, that will take
9619precedence.
9620
9621@node Headings and sections, Table of contents, Document title, Structural markup elements
9622@subheading Headings and sections
9623@cindex headings and sections, markup rules
9624
9625@vindex org-export-headline-levels
9626The outline structure of the document as described in @ref{Document
9627Structure}, forms the basis for defining sections of the exported document.
9628However, since the outline structure is also used for (for example) lists of
9629tasks, only the first three outline levels will be used as headings. Deeper
9630levels will become itemized lists. You can change the location of this
9631switch globally by setting the variable @code{org-export-headline-levels}, or on a
9632per-file basis with a line
9633
9634@cindex #+OPTIONS
9635@example
9636#+OPTIONS: H:4
9637@end example
9638
9639@node Table of contents, Lists, Headings and sections, Structural markup elements
9640@subheading Table of contents
9641@cindex table of contents, markup rules
9642
9643@cindex #+TOC
9644@vindex org-export-with-toc
9645The table of contents is normally inserted directly before the first headline
9646of the file. The depth of the table is by default the same as the number of
9647headline levels, but you can choose a smaller number, or turn off the table
9648of contents entirely, by configuring the variable @code{org-export-with-toc},
9649or on a per-file basis with a line like
9650
9651@example
9652#+OPTIONS: toc:2 (only to two levels in TOC)
9653#+OPTIONS: toc:nil (no default TOC at all)
9654@end example
9655
9656If you would like to move the table of contents to a different location, you
9657should turn off the default table using @code{org-export-with-toc} or
9658@code{#+OPTIONS} and insert @code{#+TOC: headlines N} at the desired
9659location(s).
9660
9661@example
9662#+OPTIONS: toc:nil (no default TOC)
9663...
9664#+TOC: headlines 2 (insert TOC here, with two headline levels)
9665@end example
9666
9667Multiple @code{#+TOC: headline} lines are allowed. The same @code{TOC}
9668keyword can also generate a list of all tables (resp.@: all listings) with a
9669caption in the buffer.
9670
9671@example
9672#+TOC: listings (build a list of listings)
9673#+TOC: tables (build a list of tables)
9674@end example
9675
9676@cindex property, ALT_TITLE
9677The headline's title usually determines its corresponding entry in a table of
9678contents. However, it is possible to specify an alternative title by
9679setting @code{ALT_TITLE} property accordingly. It will then be used when
9680building the table.
9681
9682@node Lists, Paragraphs, Table of contents, Structural markup elements
9683@subheading Lists
9684@cindex lists, markup rules
9685
9686Plain lists as described in @ref{Plain lists}, are translated to the back-end's
9687syntax for such lists. Most back-ends support unordered, ordered, and
9688description lists.
9689
9690@node Paragraphs, Footnote markup, Lists, Structural markup elements
9691@subheading Paragraphs, line breaks, and quoting
9692@cindex paragraphs, markup rules 9736@cindex paragraphs, markup rules
9693 9737
9694Paragraphs are separated by at least one empty line. If you need to enforce 9738Paragraphs are separated by at least one empty line. If you need to enforce
9695a line break within a paragraph, use @samp{\\} at the end of a line. 9739a line break within a paragraph, use @samp{\\} at the end of a line.
9696 9740
9697To keep the line breaks in a region, but otherwise use normal formatting, you 9741To preserve the line breaks, indentation and blank lines in a region, but
9698can use this construct, which can also be used to format poetry. 9742otherwise use normal formatting, you can use this construct, which can also
9743be used to format poetry.
9699 9744
9700@cindex #+BEGIN_VERSE 9745@cindex #+BEGIN_VERSE
9746@cindex verse blocks
9701@example 9747@example
9702#+BEGIN_VERSE 9748#+BEGIN_VERSE
9703 Great clouds overhead 9749 Great clouds overhead
@@ -9713,6 +9759,7 @@ as a paragraph that is indented on both the left and the right margin. You
9713can include quotations in Org mode documents like this: 9759can include quotations in Org mode documents like this:
9714 9760
9715@cindex #+BEGIN_QUOTE 9761@cindex #+BEGIN_QUOTE
9762@cindex quote blocks
9716@example 9763@example
9717#+BEGIN_QUOTE 9764#+BEGIN_QUOTE
9718Everything should be made as simple as possible, 9765Everything should be made as simple as possible,
@@ -9722,6 +9769,7 @@ but not any simpler -- Albert Einstein
9722 9769
9723If you would like to center some text, do it like this: 9770If you would like to center some text, do it like this:
9724@cindex #+BEGIN_CENTER 9771@cindex #+BEGIN_CENTER
9772@cindex center blocks
9725@example 9773@example
9726#+BEGIN_CENTER 9774#+BEGIN_CENTER
9727Everything should be made as simple as possible, \\ 9775Everything should be made as simple as possible, \\
@@ -9729,18 +9777,8 @@ but not any simpler
9729#+END_CENTER 9777#+END_CENTER
9730@end example 9778@end example
9731 9779
9732 9780@node Emphasis and monospace
9733@node Footnote markup, Emphasis and monospace, Paragraphs, Structural markup elements 9781@section Emphasis and monospace
9734@subheading Footnote markup
9735@cindex footnotes, markup rules
9736@cindex @file{footnote.el}
9737
9738Footnotes defined in the way described in @ref{Footnotes}, will be exported
9739by all back-ends. Org allows multiple references to the same note, and
9740multiple footnotes side by side.
9741
9742@node Emphasis and monospace, Horizontal rules, Footnote markup, Structural markup elements
9743@subheading Emphasis and monospace
9744 9782
9745@cindex underlined text, markup rules 9783@cindex underlined text, markup rules
9746@cindex bold text, markup rules 9784@cindex bold text, markup rules
@@ -9764,32 +9802,13 @@ can tweak @code{org-emphasis-regexp-components}. Beware that changing one of
9764the above variables will no take effect until you reload Org, for which you 9802the above variables will no take effect until you reload Org, for which you
9765may need to restart Emacs. 9803may need to restart Emacs.
9766 9804
9767@node Horizontal rules, Comment lines, Emphasis and monospace, Structural markup elements 9805@node Horizontal rules
9768@subheading Horizontal rules 9806@section Horizontal rules
9769@cindex horizontal rules, markup rules 9807@cindex horizontal rules, markup rules
9770A line consisting of only dashes, and at least 5 of them, will be exported as 9808A line consisting of only dashes, and at least 5 of them, will be exported as
9771a horizontal line. 9809a horizontal line.
9772 9810
9773@node Comment lines, , Horizontal rules, Structural markup elements 9811@node Images and tables
9774@subheading Comment lines
9775@cindex comment lines
9776@cindex exporting, not
9777@cindex #+BEGIN_COMMENT
9778
9779Lines starting with zero or more whitespace characters followed by one
9780@samp{#} and a whitespace are treated as comments and will never be exported.
9781Also entire subtrees starting with the word @samp{COMMENT} will never be
9782exported. Finally, regions surrounded by @samp{#+BEGIN_COMMENT}
9783... @samp{#+END_COMMENT} will not be exported.
9784
9785@table @kbd
9786@kindex C-c ;
9787@item C-c ;
9788Toggle the COMMENT keyword at the beginning of an entry.
9789@end table
9790
9791
9792@node Images and tables, Literal examples, Structural markup elements, Markup
9793@section Images and Tables 9812@section Images and Tables
9794 9813
9795@cindex tables, markup rules 9814@cindex tables, markup rules
@@ -9837,7 +9856,7 @@ the same caption mechanism can apply to many others (e.g., @LaTeX{}
9837equations, source code blocks). Depending on the export back-end, those may 9856equations, source code blocks). Depending on the export back-end, those may
9838or may not be handled. 9857or may not be handled.
9839 9858
9840@node Literal examples, Include files, Images and tables, Markup 9859@node Literal examples
9841@section Literal examples 9860@section Literal examples
9842@cindex literal examples, markup rules 9861@cindex literal examples, markup rules
9843@cindex code line references, markup rules 9862@cindex code line references, markup rules
@@ -9865,20 +9884,25 @@ Here is an example
9865@end example 9884@end example
9866 9885
9867@cindex formatting source code, markup rules 9886@cindex formatting source code, markup rules
9887@vindex org-latex-listings
9868If the example is source code from a programming language, or any other text 9888If the example is source code from a programming language, or any other text
9869that can be marked up by font-lock in Emacs, you can ask for the example to 9889that can be marked up by font-lock in Emacs, you can ask for the example to
9870look like the fontified Emacs buffer@footnote{This works automatically for 9890look like the fontified Emacs buffer@footnote{This works automatically for
9871the HTML back-end (it requires version 1.34 of the @file{htmlize.el} package, 9891the HTML back-end (it requires version 1.34 of the @file{htmlize.el} package,
9872which is distributed with Org). Fontified code chunks in @LaTeX{} can be 9892which is distributed with Org). Fontified code chunks in @LaTeX{} can be
9873achieved using either the listings or the 9893achieved using either the
9874@url{http://code.google.com/p/minted, minted,} package. Refer to 9894@url{https://www.ctan.org/tex-archive/macros/latex/contrib/listings/?lang=en, listings,}
9875@code{org-latex-listings} documentation for details.}. This is done 9895or the
9876with the @samp{src} block, where you also need to specify the name of the 9896@url{https://github.com/gpoore/minted, minted,} package.
9877major mode that should be used to fontify the example@footnote{Code in 9897If you use minted or listing, you must load the packages manually, for
9878@samp{src} blocks may also be evaluated either interactively or on export. 9898example by adding the desired package to
9879See @pxref{Working With Source Code} for more information on evaluating code 9899@code{org-latex-packages-alist}. Refer to @code{org-latex-listings}
9880blocks.}, see @ref{Easy Templates} for shortcuts to easily insert code 9900for details.}. This is done with the @samp{src} block, where you also need
9881blocks. 9901to specify the name of the major mode that should be used to fontify the
9902example@footnote{Code in @samp{src} blocks may also be evaluated either
9903interactively or on export. @xref{Working with source code}, for more
9904information on evaluating code blocks.}, see @ref{Easy templates} for
9905shortcuts to easily insert code blocks.
9882@cindex #+BEGIN_SRC 9906@cindex #+BEGIN_SRC
9883 9907
9884@example 9908@example
@@ -9891,13 +9915,29 @@ blocks.
9891 9915
9892Both in @code{example} and in @code{src} snippets, you can add a @code{-n} 9916Both in @code{example} and in @code{src} snippets, you can add a @code{-n}
9893switch to the end of the @code{BEGIN} line, to get the lines of the example 9917switch to the end of the @code{BEGIN} line, to get the lines of the example
9894numbered. If you use a @code{+n} switch, the numbering from the previous 9918numbered. The @code{-n} takes an optional numeric argument specifying the
9895numbered snippet will be continued in the current one. In literal examples, 9919starting line number of the block. If you use a @code{+n} switch, the
9896Org will interpret strings like @samp{(ref:name)} as labels, and use them as 9920numbering from the previous numbered snippet will be continued in the current
9897targets for special hyperlinks like @code{[[(name)]]} (i.e., the reference name 9921one. The @code{+n} can also take a numeric argument. The value of the
9898enclosed in single parenthesis). In HTML, hovering the mouse over such a 9922argument will be added to the last line of the previous block to determine
9899link will remote-highlight the corresponding code line, which is kind of 9923the starting line number.
9900cool. 9924
9925@example
9926#+BEGIN_SRC emacs-lisp -n 20
9927 ;; this will export with line number 20
9928 (message "This is line 21")
9929#+END_SRC
9930#+BEGIN_SRC emacs-lisp +n 10
9931 ;; This will be listed as line 31
9932 (message "This is line 32")
9933#+END_SRC
9934@end example
9935
9936In literal examples, Org will interpret strings like @samp{(ref:name)} as
9937labels, and use them as targets for special hyperlinks like @code{[[(name)]]}
9938(i.e., the reference name enclosed in single parenthesis). In HTML, hovering
9939the mouse over such a link will remote-highlight the corresponding code line,
9940which is kind of cool.
9901 9941
9902You can also add a @code{-r} switch which @i{removes} the labels from the 9942You can also add a @code{-r} switch which @i{removes} the labels from the
9903source code@footnote{Adding @code{-k} to @code{-n -r} will @i{keep} the 9943source code@footnote{Adding @code{-k} to @code{-n -r} will @i{keep} the
@@ -9916,6 +9956,10 @@ In line [[(sc)]] we remember the current position. [[(jump)][Line (jump)]]
9916jumps to point-min. 9956jumps to point-min.
9917@end example 9957@end example
9918 9958
9959@cindex indentation, in source blocks
9960Finally, you can use @code{-i} to preserve the indentation of a specific code
9961block (@pxref{Editing source code}).
9962
9919@vindex org-coderef-label-format 9963@vindex org-coderef-label-format
9920If the syntax for the label format conflicts with the language syntax, use a 9964If the syntax for the label format conflicts with the language syntax, use a
9921@code{-l} switch to change the format, for example @samp{#+BEGIN_SRC pascal 9965@code{-l} switch to change the format, for example @samp{#+BEGIN_SRC pascal
@@ -9925,8 +9969,8 @@ HTML export also allows examples to be published as text areas (@pxref{Text
9925areas in HTML export}). 9969areas in HTML export}).
9926 9970
9927Because the @code{#+BEGIN_...} and @code{#+END_...} patterns need to be added 9971Because the @code{#+BEGIN_...} and @code{#+END_...} patterns need to be added
9928so often, shortcuts are provided using the Easy Templates facility 9972so often, shortcuts are provided using the Easy templates facility
9929(@pxref{Easy Templates}). 9973(@pxref{Easy templates}).
9930 9974
9931@table @kbd 9975@table @kbd
9932@kindex C-c ' 9976@kindex C-c '
@@ -9952,157 +9996,44 @@ formatting like @samp{(ref:label)} at the end of the current line. Then the
9952label is stored as a link @samp{(label)}, for retrieval with @kbd{C-c C-l}. 9996label is stored as a link @samp{(label)}, for retrieval with @kbd{C-c C-l}.
9953@end table 9997@end table
9954 9998
9955 9999@node Special symbols
9956@node Include files, Index entries, Literal examples, Markup 10000@section Special symbols
9957@section Include files 10001@cindex Org entities
9958@cindex include files, markup rules
9959
9960During export, you can include the content of another file. For example, to
9961include your @file{.emacs} file, you could use:
9962@cindex #+INCLUDE
9963
9964@example
9965#+INCLUDE: "~/.emacs" src emacs-lisp
9966@end example
9967
9968@noindent
9969The optional second and third parameter are the markup (i.e., @samp{example}
9970or @samp{src}), and, if the markup is @samp{src}, the language for formatting
9971the contents. The markup is optional; if it is not given, the text will be
9972assumed to be in Org mode format and will be processed normally.
9973
9974Contents of the included file will belong to the same structure (headline,
9975item) containing the @code{INCLUDE} keyword. In particular, headlines within
9976the file will become children of the current section. That behavior can be
9977changed by providing an additional keyword parameter, @code{:minlevel}. In
9978that case, all headlines in the included file will be shifted so the one with
9979the lowest level reaches that specified level. For example, to make a file
9980become a sibling of the current top-level headline, use
9981
9982@example
9983#+INCLUDE: "~/my-book/chapter2.org" :minlevel 1
9984@end example
9985
9986You can also include a portion of a file by specifying a lines range using
9987the @code{:lines} parameter. The line at the upper end of the range will not
9988be included. The start and/or the end of the range may be omitted to use the
9989obvious defaults.
9990
9991@example
9992#+INCLUDE: "~/.emacs" :lines "5-10" @r{Include lines 5 to 10, 10 excluded}
9993#+INCLUDE: "~/.emacs" :lines "-10" @r{Include lines 1 to 10, 10 excluded}
9994#+INCLUDE: "~/.emacs" :lines "10-" @r{Include lines from 10 to EOF}
9995@end example
9996
9997@table @kbd
9998@kindex C-c '
9999@item C-c '
10000Visit the include file at point.
10001@end table
10002
10003@node Index entries, Macro replacement, Include files, Markup
10004@section Index entries
10005@cindex index entries, for publishing
10006
10007You can specify entries that will be used for generating an index during
10008publishing. This is done by lines starting with @code{#+INDEX}. An entry
10009the contains an exclamation mark will create a sub item. See @ref{Generating
10010an index} for more information.
10011
10012@example
10013* Curriculum Vitae
10014#+INDEX: CV
10015#+INDEX: Application!CV
10016@end example
10017
10018
10019
10020
10021@node Macro replacement, Embedded @LaTeX{}, Index entries, Markup
10022@section Macro replacement
10023@cindex macro replacement, during export
10024@cindex #+MACRO
10025
10026You can define text snippets with
10027
10028@example
10029#+MACRO: name replacement text $1, $2 are arguments
10030@end example
10031
10032@noindent which can be referenced in
10033paragraphs, verse blocks, table cells and some keywords with
10034@code{@{@{@{name(arg1,arg2)@}@}@}}@footnote{Since commas separate arguments,
10035commas within arguments have to be escaped with a backslash character.
10036Conversely, backslash characters before a comma, and only them, need to be
10037escaped with another backslash character.}. In addition to defined macros,
10038@code{@{@{@{title@}@}@}}, @code{@{@{@{author@}@}@}}, etc., will reference
10039information set by the @code{#+TITLE:}, @code{#+AUTHOR:}, and similar lines.
10040Also, @code{@{@{@{time(@var{FORMAT})@}@}@}} and
10041@code{@{@{@{modification-time(@var{FORMAT})@}@}@}} refer to current date time
10042and to the modification time of the file being exported, respectively.
10043@var{FORMAT} should be a format string understood by
10044@code{format-time-string}.
10045
10046Macro expansion takes place during export.
10047
10048
10049@node Embedded @LaTeX{}, Special blocks, Macro replacement, Markup
10050@section Embedded @LaTeX{}
10051@cindex @TeX{} interpretation
10052@cindex @LaTeX{} interpretation
10053
10054Plain ASCII is normally sufficient for almost all note taking. Exceptions
10055include scientific notes, which often require mathematical symbols and the
10056occasional formula. @LaTeX{}@footnote{@LaTeX{} is a macro system based on
10057Donald E. Knuth's @TeX{} system. Many of the features described here as
10058``@LaTeX{}'' are really from @TeX{}, but for simplicity I am blurring this
10059distinction.} is widely used to typeset scientific documents. Org mode
10060supports embedding @LaTeX{} code into its files, because many academics are
10061used to writing and reading @LaTeX{} source code, and because it can be
10062readily processed to produce pretty output for a number of export back-ends.
10063
10064@menu
10065* Special symbols:: Greek letters and other symbols
10066* Subscripts and superscripts:: Simple syntax for raising/lowering text
10067* @LaTeX{} fragments:: Complex formulas made easy
10068* Previewing @LaTeX{} fragments:: What will this snippet look like?
10069* CDLaTeX mode:: Speed up entering of formulas
10070@end menu
10071
10072@node Special symbols, Subscripts and superscripts, Embedded @LaTeX{}, Embedded @LaTeX{}
10073@subsection Special symbols
10074@cindex math symbols 10002@cindex math symbols
10075@cindex special symbols 10003@cindex special symbols
10076@cindex @TeX{} macros
10077@cindex @LaTeX{} fragments, markup rules
10078@cindex HTML entities 10004@cindex HTML entities
10079@cindex @LaTeX{} entities 10005@cindex @LaTeX{} entities
10080 10006
10081You can use @LaTeX{}-like syntax to insert special symbols like @samp{\alpha} 10007You can use @LaTeX{}-like syntax to insert special symbols---named
10082to indicate the Greek letter, or @samp{\to} to indicate an arrow. Completion 10008entities---like @samp{\alpha} to indicate the Greek letter, or @samp{\to} to
10083for these symbols is available, just type @samp{\} and maybe a few letters, 10009indicate an arrow. Completion for these symbols is available, just type
10084and press @kbd{M-@key{TAB}} to see possible completions. Unlike @LaTeX{} 10010@samp{\} and maybe a few letters, and press @kbd{M-@key{TAB}} to see possible
10085code, Org mode allows these symbols to be present without surrounding math 10011completions. If you need such a symbol inside a word, terminate it with
10086delimiters, for example: 10012a pair of curly brackets. For example
10087 10013
10088@example 10014@example
10089Angles are written as Greek letters \alpha, \beta and \gamma. 10015Protip: Given a circle \Gamma of diameter d, the length of its circumference
10016is \pi@{@}d.
10090@end example 10017@end example
10091 10018
10092@vindex org-entities 10019@findex org-entities-help
10093During export, these symbols will be transformed into the native format of 10020@vindex org-entities-user
10094the exporter back-end. Strings like @code{\alpha} will be exported as
10095@code{&alpha;} in the HTML output, and as @code{$\alpha$} in the @LaTeX{}
10096output. Similarly, @code{\nbsp} will become @code{&nbsp;} in HTML and
10097@code{~} in @LaTeX{}. If you need such a symbol inside a word, terminate it
10098like this: @samp{\Aacute@{@}stor}.
10099
10100A large number of entities is provided, with names taken from both HTML and 10021A large number of entities is provided, with names taken from both HTML and
10101@LaTeX{}; see the variable @code{org-entities} for the complete list. 10022@LaTeX{}; you can comfortably browse the complete list from a dedicated
10102@samp{\-} is treated as a shy hyphen, and @samp{--}, @samp{---}, and 10023buffer using the command @code{org-entities-help}. It is also possible to
10103@samp{...} are all converted into special commands creating hyphens of 10024provide your own special symbols in the variable @code{org-entities-user}.
10104different lengths or a compact set of dots. 10025
10026During export, these symbols are transformed into the native format of the
10027exporter back-end. Strings like @code{\alpha} are exported as @code{&alpha;}
10028in the HTML output, and as @code{\(\alpha\)} in the @LaTeX{} output.
10029Similarly, @code{\nbsp} becomes @code{&nbsp;} in HTML and @code{~} in
10030@LaTeX{}.
10031
10032@cindex escaping characters
10033Entities may also be used as a may to escape markup in an Org document, e.g.,
10034@samp{\under@{@}not underlined\under} exports as @samp{_not underlined_}.
10105 10035
10036@cindex special symbols, in-buffer display
10106If you would like to see entities displayed as UTF-8 characters, use the 10037If you would like to see entities displayed as UTF-8 characters, use the
10107following command@footnote{You can turn this on by default by setting the 10038following command@footnote{You can turn this on by default by setting the
10108variable @code{org-pretty-entities}, or on a per-file base with the 10039variable @code{org-pretty-entities}, or on a per-file base with the
@@ -10117,20 +10048,28 @@ buffer content which remains plain ASCII, but it overlays the UTF-8 character
10117for display purposes only. 10048for display purposes only.
10118@end table 10049@end table
10119 10050
10120@node Subscripts and superscripts, @LaTeX{} fragments, Special symbols, Embedded @LaTeX{} 10051@cindex shy hyphen, special symbol
10121@subsection Subscripts and superscripts 10052@cindex dash, special symbol
10053@cindex ellipsis, special symbol
10054In addition to regular entities defined above, Org exports in a special
10055way@footnote{This behaviour can be disabled with @code{-} export setting
10056(@pxref{Export settings}).} the following commonly used character
10057combinations: @samp{\-} is treated as a shy hyphen, @samp{--} and @samp{---}
10058are converted into dashes, and @samp{...} becomes a compact set of dots.
10059
10060@node Subscripts and superscripts
10061@section Subscripts and superscripts
10122@cindex subscript 10062@cindex subscript
10123@cindex superscript 10063@cindex superscript
10124 10064
10125Just like in @LaTeX{}, @samp{^} and @samp{_} are used to indicate super- and 10065@samp{^} and @samp{_} are used to indicate super- and subscripts. To
10126subscripts. Again, these can be used without embedding them in math-mode 10066increase the readability of ASCII text, it is not necessary---but OK---to
10127delimiters. To increase the readability of ASCII text, it is not necessary 10067surround multi-character sub- and superscripts with curly braces. Those are,
10128(but OK) to surround multi-character sub- and superscripts with curly braces. 10068however, mandatory, when more than one word is involved. For example
10129For example
10130 10069
10131@example 10070@example
10132The mass of the sun is M_sun = 1.989 x 10^30 kg. The radius of 10071The radius of the sun is R_sun = 6.96 x 10^8 m. On the other hand, the
10133the sun is R_@{sun@} = 6.96 x 10^8 m. 10072radius of Alpha Centauri is R_@{Alpha Centauri@} = 1.28 x R_@{sun@}.
10134@end example 10073@end example
10135 10074
10136@vindex org-use-sub-superscripts 10075@vindex org-use-sub-superscripts
@@ -10147,46 +10086,58 @@ In addition to showing entities as UTF-8 characters, this command will also
10147format sub- and superscripts in a WYSIWYM way. 10086format sub- and superscripts in a WYSIWYM way.
10148@end table 10087@end table
10149 10088
10150@node @LaTeX{} fragments, Previewing @LaTeX{} fragments, Subscripts and superscripts, Embedded @LaTeX{} 10089@node Embedded @LaTeX{}
10090@section Embedded @LaTeX{}
10091@cindex @TeX{} interpretation
10092@cindex @LaTeX{} interpretation
10093
10094Plain ASCII is normally sufficient for almost all note taking. Exceptions
10095include scientific notes, which often require mathematical symbols and the
10096occasional formula. @LaTeX{}@footnote{@LaTeX{} is a macro system based on
10097Donald E. Knuth's @TeX{} system. Many of the features described here as
10098``@LaTeX{}'' are really from @TeX{}, but for simplicity I am blurring this
10099distinction.} is widely used to typeset scientific documents. Org mode
10100supports embedding @LaTeX{} code into its files, because many academics are
10101used to writing and reading @LaTeX{} source code, and because it can be
10102readily processed to produce pretty output for a number of export back-ends.
10103
10104@menu
10105* @LaTeX{} fragments:: Complex formulas made easy
10106* Previewing @LaTeX{} fragments:: What will this snippet look like?
10107* CDLaTeX mode:: Speed up entering of formulas
10108@end menu
10109
10110@node @LaTeX{} fragments
10151@subsection @LaTeX{} fragments 10111@subsection @LaTeX{} fragments
10152@cindex @LaTeX{} fragments 10112@cindex @LaTeX{} fragments
10153 10113
10154@vindex org-format-latex-header 10114@vindex org-format-latex-header
10155Going beyond symbols and sub- and superscripts, a full formula language is 10115Org mode can contain @LaTeX{} math fragments, and it supports ways to process
10156needed. Org mode can contain @LaTeX{} math fragments, and it supports ways 10116these for several export back-ends. When exporting to @LaTeX{}, the code is
10157to process these for several export back-ends. When exporting to @LaTeX{}, 10117left as it is. When exporting to HTML, Org can use either
10158the code is obviously left as it is. When exporting to HTML, Org invokes the 10118@uref{http://www.mathjax.org, MathJax} (@pxref{Math formatting in HTML
10159@uref{http://www.mathjax.org, MathJax library} (@pxref{Math formatting in 10119export}) or transcode the math into images (see @pxref{Previewing @LaTeX{}
10160HTML export}) to process and display the math@footnote{If you plan to use 10120fragments}).
10161this regularly or on pages with significant page views, you should install
10162@file{MathJax} on your own server in order to limit the load of our server.}.
10163Finally, it can also process the mathematical expressions into
10164images@footnote{For this to work you need to be on a system with a working
10165@LaTeX{} installation. You also need the @file{dvipng} program or the
10166@file{convert}, respectively available at
10167@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
10168suite. The @LaTeX{} header that will be used when processing a fragment can
10169be configured with the variable @code{org-format-latex-header}.} that can be
10170displayed in a browser.
10171 10121
10172@LaTeX{} fragments don't need any special marking at all. The following 10122@LaTeX{} fragments don't need any special marking at all. The following
10173snippets will be identified as @LaTeX{} source code: 10123snippets will be identified as @LaTeX{} source code:
10174@itemize @bullet 10124@itemize @bullet
10175@item 10125@item
10176Environments of any kind@footnote{When @file{MathJax} is used, only the 10126Environments of any kind@footnote{When MathJax is used, only the
10177environments recognized by @file{MathJax} will be processed. When 10127environments recognized by MathJax will be processed. When
10178@file{dvipng} program or @file{imagemagick} suite is used to create images, 10128@file{dvipng} program, @file{dvisvgm} program or @file{imagemagick} suite is
10179any @LaTeX{} environment will be handled.}. The only requirement is that the 10129used to create images, any @LaTeX{} environment will be handled.}. The only
10180@code{\begin} and @code{\end} statements appear on a new line, at the 10130requirement is that the @code{\begin} statement appears on a new line, at the
10181beginning of the line or after whitespaces only. 10131beginning of the line or after whitespaces only.
10182@item 10132@item
10183Text within the usual @LaTeX{} math delimiters. To avoid conflicts with 10133Text within the usual @LaTeX{} math delimiters. To avoid conflicts with
10184currency specifications, single @samp{$} characters are only recognized as 10134currency specifications, single @samp{$} characters are only recognized as
10185math delimiters if the enclosed text contains at most two line breaks, is 10135math delimiters if the enclosed text contains at most two line breaks, is
10186directly attached to the @samp{$} characters with no whitespace in between, 10136directly attached to the @samp{$} characters with no whitespace in between,
10187and if the closing @samp{$} is followed by whitespace, punctuation or a dash. 10137and if the closing @samp{$} is followed by whitespace or punctuation
10188For the other delimiters, there is no such restriction, so when in doubt, use 10138(parentheses and quotes are considered to be punctuation in this
10189@samp{\(...\)} as inline math delimiters. 10139context). For the other delimiters, there is no such restriction, so when in
10140doubt, use @samp{\(...\)} as inline math delimiters.
10190@end itemize 10141@end itemize
10191 10142
10192@noindent For example: 10143@noindent For example:
@@ -10210,7 +10161,7 @@ either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \].
10210@vindex org-export-with-latex 10161@vindex org-export-with-latex
10211@LaTeX{} processing can be configured with the variable 10162@LaTeX{} processing can be configured with the variable
10212@code{org-export-with-latex}. The default setting is @code{t} which means 10163@code{org-export-with-latex}. The default setting is @code{t} which means
10213@file{MathJax} for HTML, and no processing for ASCII and @LaTeX{} back-ends. 10164MathJax for HTML, and no processing for ASCII and @LaTeX{} back-ends.
10214You can also set this variable on a per-file basis using one of these 10165You can also set this variable on a per-file basis using one of these
10215lines: 10166lines:
10216 10167
@@ -10220,16 +10171,26 @@ lines:
10220#+OPTIONS: tex:verbatim @r{Verbatim export, for jsMath or so} 10171#+OPTIONS: tex:verbatim @r{Verbatim export, for jsMath or so}
10221@end example 10172@end example
10222 10173
10223@node Previewing @LaTeX{} fragments, CDLaTeX mode, @LaTeX{} fragments, Embedded @LaTeX{} 10174@node Previewing @LaTeX{} fragments
10224@subsection Previewing @LaTeX{} fragments 10175@subsection Previewing @LaTeX{} fragments
10225@cindex @LaTeX{} fragments, preview 10176@cindex @LaTeX{} fragments, preview
10226 10177
10227@vindex org-latex-create-formula-image-program 10178@vindex org-preview-latex-default-process
10228If you have @file{dvipng} or @file{imagemagick} installed@footnote{Choose the 10179If you have a working @LaTeX{} installation and @file{dvipng}, @file{dvisvgm}
10229converter by setting the variable 10180or @file{convert} installed@footnote{These are respectively available at
10230@code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{} 10181@url{http://sourceforge.net/projects/dvipng/}, @url{http://dvisvgm.bplaced.net/}
10231fragments can be processed to produce preview images of the typeset 10182and from the @file{imagemagick} suite. Choose the converter by setting the
10232expressions: 10183variable @code{org-preview-latex-default-process} accordingly.}, @LaTeX{}
10184fragments can be processed to produce images of the typeset expressions to be
10185used for inclusion while exporting to HTML (see @pxref{@LaTeX{} fragments}),
10186or for inline previewing within Org mode.
10187
10188@vindex org-format-latex-options
10189@vindex org-format-latex-header
10190You can customize the variables @code{org-format-latex-options} and
10191@code{org-format-latex-header} to influence some aspects of the preview. In
10192particular, the @code{:scale} (and for HTML export, @code{:html-scale})
10193property of the former can be used to adjust the size of the preview images.
10233 10194
10234@table @kbd 10195@table @kbd
10235@kindex C-c C-x C-l 10196@kindex C-c C-x C-l
@@ -10245,12 +10206,6 @@ process the entire buffer.
10245Remove the overlay preview images. 10206Remove the overlay preview images.
10246@end table 10207@end table
10247 10208
10248@vindex org-format-latex-options
10249You can customize the variable @code{org-format-latex-options} to influence
10250some aspects of the preview. In particular, the @code{:scale} (and for HTML
10251export, @code{:html-scale}) property can be used to adjust the size of the
10252preview images.
10253
10254@vindex org-startup-with-latex-preview 10209@vindex org-startup-with-latex-preview
10255You can turn on the previewing of all @LaTeX{} fragments in a file with 10210You can turn on the previewing of all @LaTeX{} fragments in a file with
10256 10211
@@ -10264,7 +10219,7 @@ To disable it, simply use
10264#+STARTUP: nolatexpreview 10219#+STARTUP: nolatexpreview
10265@end example 10220@end example
10266 10221
10267@node CDLaTeX mode, , Previewing @LaTeX{} fragments, Embedded @LaTeX{} 10222@node CDLaTeX mode
10268@subsection Using CD@LaTeX{} to enter math 10223@subsection Using CD@LaTeX{} to enter math
10269@cindex CD@LaTeX{} 10224@cindex CD@LaTeX{}
10270 10225
@@ -10325,252 +10280,233 @@ modification will work only inside @LaTeX{} fragments; outside the quote
10325is normal. 10280is normal.
10326@end itemize 10281@end itemize
10327 10282
10328@node Special blocks, , Embedded @LaTeX{}, Markup 10283@node Exporting
10329@section Special blocks 10284@chapter Exporting
10330@cindex Special blocks 10285@cindex exporting
10331 10286
10332Org syntax includes pre-defined blocks (@pxref{Paragraphs} and @ref{Literal 10287Sometimes, you may want to pretty print your notes, publish them on the web
10333examples}). It is also possible to create blocks containing raw code 10288or even share them with people not using Org. In these cases, the Org export
10334targeted at a specific back-ends (e.g., @samp{#+BEGIN_LATEX}). 10289facilities can be used to convert your documents to a variety of other
10290formats, while retaining as much structure (@pxref{Document structure}) and
10291markup (@pxref{Markup}) as possible.
10335 10292
10336Any other block is a @emph{special block}. 10293@cindex export back-end
10294Libraries responsible for such translation are called back-ends. Org ships
10295with the following ones
10337 10296
10338For example, @samp{#+BEGIN_ABSTRACT} and @samp{#+BEGIN_VIDEO} are special 10297@itemize
10339blocks. The first one is useful when exporting to @LaTeX{}, the second one 10298@item ascii (ASCII format)
10340when exporting to HTML5. 10299@item beamer (@LaTeX{} Beamer format)
10300@item html (HTML format)
10301@item icalendar (iCalendar format)
10302@item latex (@LaTeX{} format)
10303@item md (Markdown format)
10304@item odt (OpenDocument Text format)
10305@item org (Org format)
10306@item texinfo (Texinfo format)
10307@item man (Man page format)
10308@end itemize
10341 10309
10342Each export back-end decides if they should be exported, and how. When the 10310@noindent Org also uses additional libraries located in @code{contrib/}
10343block is ignored, its contents are still exported, as if the opening and 10311directory (@pxref{Installation}). Users can install additional export
10344closing block lines were not there. For example, when exporting a 10312libraries for additional formats from the Emacs packaging system. For easy
10345@samp{#+BEGIN_TEST} block, HTML back-end wraps its contents within a 10313discovery, these packages have a common naming scheme: @file{ox-NAME}, where
10346@samp{<div name="test">} tag. 10314NAME is one of the formats. For example, @file{ox-koma-letter} for
10315@code{koma-letter} back-end.
10347 10316
10348Refer to back-end specific documentation for more information. 10317@vindex org-export-backends
10318Org loads back-ends for the following formats by default: @code{ascii},
10319@code{html}, @code{icalendar}, @code{latex} and @code{odt}.
10349 10320
10350@node Exporting, Publishing, Markup, Top 10321Org can load additional back-ends either of two ways: through the
10351@chapter Exporting 10322@code{org-export-backends} variable configuration; or, by requiring the
10352@cindex exporting 10323library in the Emacs init file like this:
10353 10324
10354The Org mode export facilities can be used to export Org documents or parts 10325@lisp
10355of Org documents to a variety of other formats. In addition, these 10326(require 'ox-md)
10356facilities can be used with @code{orgtbl-mode} and/or @code{orgstruct-mode} 10327@end lisp
10357in foreign buffers so you can author tables and lists in Org syntax and
10358convert them in place to the target language.
10359
10360ASCII export produces a readable and simple version of an Org file for
10361printing and sharing notes. HTML export allows you to easily publish notes
10362on the web, or to build full-fledged websites. @LaTeX{} export lets you use
10363Org mode and its structured editing functions to create arbitrarily complex
10364@LaTeX{} files for any kind of document. OpenDocument Text (ODT) export
10365allows seamless collaboration across organizational boundaries. Markdown
10366export lets you seamlessly collaborate with other developers. Finally, iCal
10367export can extract entries with deadlines or appointments to produce a file
10368in the iCalendar format.
10369 10328
10370@menu 10329@menu
10371* The Export Dispatcher:: The main exporter interface 10330* The export dispatcher:: The main interface
10372* Export back-ends:: Built-in export formats 10331* Export settings:: Common export settings
10373* Export settings:: Generic export settings 10332* Table of contents:: The if and where of the table of contents
10333* Include files:: Include additional files into a document
10334* Macro replacement:: Use macros to create templates
10335* Comment lines:: What will not be exported
10374* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding 10336* ASCII/Latin-1/UTF-8 export:: Exporting to flat files with encoding
10375* Beamer export:: Exporting as a Beamer presentation 10337* Beamer export:: Exporting as a Beamer presentation
10376* HTML export:: Exporting to HTML 10338* HTML export:: Exporting to HTML
10377* @LaTeX{} and PDF export:: Exporting to @LaTeX{}, and processing to PDF 10339* @LaTeX{} export:: Exporting to @LaTeX{}, and processing to PDF
10378* Markdown export:: Exporting to Markdown 10340* Markdown export:: Exporting to Markdown
10379* OpenDocument Text export:: Exporting to OpenDocument Text 10341* OpenDocument Text export:: Exporting to OpenDocument Text
10380* Org export:: Exporting to Org 10342* Org export:: Exporting to Org
10381* Texinfo export:: Exporting to Texinfo 10343* Texinfo export:: Exporting to Texinfo
10382* iCalendar export:: Exporting to iCalendar 10344* iCalendar export:: Exporting to iCalendar
10383* Other built-in back-ends:: Exporting to a man page 10345* Other built-in back-ends:: Exporting to a man page
10384* Export in foreign buffers:: Author tables and lists in Org syntax
10385* Advanced configuration:: Fine-tuning the export output 10346* Advanced configuration:: Fine-tuning the export output
10347* Export in foreign buffers:: Author tables and lists in Org syntax
10386@end menu 10348@end menu
10387 10349
10388@node The Export Dispatcher, Export back-ends, Exporting, Exporting 10350@node The export dispatcher
10389@section The Export Dispatcher 10351@section The export dispatcher
10390@vindex org-export-dispatch-use-expert-ui 10352@vindex org-export-dispatch-use-expert-ui
10391@cindex Export, dispatcher 10353@cindex Export, dispatcher
10392 10354
10393The main entry point for export related tasks is the dispatcher, a 10355The export dispatcher is the main interface for Org's exports. A
10394hierarchical menu from which it is possible to select an export format and 10356hierarchical menu presents the currently configured export formats. Options
10395toggle export options@footnote{It is also possible to use a less intrusive 10357are shown as easy toggle switches on the same screen.
10396interface by setting @code{org-export-dispatch-use-expert-ui} to a 10358
10397non-@code{nil} value. In that case, only a prompt is visible from the 10359Org also has a minimal prompt interface for the export dispatcher. When the
10398minibuffer. From there one can still switch back to regular menu by pressing 10360variable @code{org-export-dispatch-use-expert-ui} is set to a non-@code{nil}
10399@key{?}.} from which it is possible to select an export format and to toggle 10361value, Org prompts in the minibuffer. To switch back to the hierarchical
10400export options. 10362menu, press @key{?}.
10401 10363
10402@c @quotation
10403@table @asis 10364@table @asis
10404@orgcmd{C-c C-e,org-export-dispatch} 10365@orgcmd{C-c C-e,org-export-dispatch}
10405 10366
10406Dispatch for export and publishing commands. When called with a @kbd{C-u} 10367Invokes the export dispatcher interface. The options show default settings.
10407prefix argument, repeat the last export command on the current buffer while 10368The @kbd{C-u} prefix argument preserves options from the previous export,
10408preserving toggled options. If the current buffer hasn't changed and subtree 10369including any sub-tree selections.
10409export was activated, the command will affect that same subtree. 10370
10410@end table 10371@end table
10411@c @end quotation
10412 10372
10413Normally the entire buffer is exported, but if there is an active region 10373Org exports the entire buffer by default. If the Org buffer has an active
10414only that part of the buffer will be exported. 10374region, then Org exports just that region.
10415 10375
10416Several export options (@pxref{Export settings}) can be toggled from the 10376These are the export options, the key combinations that toggle them
10417export dispatcher with the following key combinations: 10377(@pxref{Export settings}):
10418 10378
10419@table @kbd 10379@table @kbd
10420@item C-a 10380@item C-a
10421@vindex org-export-async-init-file 10381@vindex org-export-async-init-file
10422Toggle asynchronous export. Asynchronous export uses an external Emacs 10382Toggles asynchronous export. Asynchronous export uses an external Emacs
10423process that is configured with a specified initialization file. 10383process with a specially configured initialization file to complete the
10384exporting process in the background thereby releasing the current interface.
10385This is particularly useful when exporting long documents.
10424 10386
10425While exporting asynchronously, the output is not displayed, but stored in 10387Output from an asynchronous export is saved on the ``the export stack''. To
10426a place called ``the export stack''. This stack can be displayed by calling 10388view this stack, call the export dispatcher with a double @kbd{C-u} prefix
10427the dispatcher with a double @kbd{C-u} prefix argument, or with @kbd{&} key 10389argument. If already in the export dispatcher menu, @kbd{&} displays the
10428from the dispatcher menu. 10390stack.
10429 10391
10430@vindex org-export-in-background 10392@vindex org-export-in-background
10431To make this behavior the default, customize the variable 10393To make the background export process the default, customize the variable,
10432@code{org-export-in-background}. 10394@code{org-export-in-background}.
10433 10395
10434@item C-b 10396@item C-b
10435Toggle body-only export. Its effect depends on the back-end used. 10397Toggle body-only export. Useful for excluding headers and footers in the
10436Typically, if the back-end has a header section (like @code{<head>...</head>} 10398export. Affects only those back-end formats that have such sections---like
10437in the HTML back-end), a body-only export will not include this header. 10399@code{<head>...</head>} in HTML.
10438 10400
10439@item C-s 10401@item C-s
10440@vindex org-export-initial-scope 10402@vindex org-export-initial-scope
10441Toggle subtree export. The top heading becomes the document title. 10403Toggle sub-tree export. When turned on, Org exports only the sub-tree starting
10404from the cursor position at the time the export dispatcher was invoked. Org
10405uses the top heading of this sub-tree as the document's title. If the cursor
10406is not on a heading, Org uses the nearest enclosing header. If the cursor is
10407in the document preamble, Org signals an error and aborts export.
10442 10408
10443You can change the default state of this option by setting 10409To make the sub-tree export the default, customize the variable,
10444@code{org-export-initial-scope}. 10410@code{org-export-initial-scope}.
10445 10411
10446@item C-v 10412@item C-v
10447Toggle visible-only export. Only export the text that is currently 10413Toggle visible-only export. Useful for exporting only visible parts of an
10448visible, i.e., not hidden by outline visibility in the buffer. 10414Org document by adjusting outline visibility settings.
10449
10450@end table 10415@end table
10451 10416
10452@vindex org-export-copy-to-kill-ring 10417@node Export settings
10453With the exception of asynchronous export, a successful export process writes
10454its output to the kill-ring. You can configure this behavior by altering the
10455option @code{org-export-copy-to-kill-ring}.
10456
10457@node Export back-ends, Export settings, The Export Dispatcher, Exporting
10458@section Export back-ends
10459@cindex Export, back-ends
10460
10461An export back-end is a library that translates Org syntax into a foreign
10462format. An export format is not available until the proper back-end has been
10463loaded.
10464
10465@vindex org-export-backends
10466By default, the following four back-ends are loaded: @code{ascii},
10467@code{html}, @code{icalendar} and @code{latex}. It is possible to add more
10468(or remove some) by customizing @code{org-export-backends}.
10469
10470Built-in back-ends include:
10471
10472@itemize
10473@item ascii (ASCII format)
10474@item beamer (@LaTeX{} Beamer format)
10475@item html (HTML format)
10476@item icalendar (iCalendar format)
10477@item latex (@LaTeX{} format)
10478@item man (Man page format)
10479@item md (Markdown format)
10480@item odt (OpenDocument Text format)
10481@item org (Org format)
10482@item texinfo (Texinfo format)
10483@end itemize
10484
10485Other back-ends might be found in the @code{contrib/} directory
10486(@pxref{Installation}).
10487
10488@node Export settings, ASCII/Latin-1/UTF-8 export, Export back-ends, Exporting
10489@section Export settings 10418@section Export settings
10490@cindex Export, settings 10419@cindex Export, settings
10491 10420
10421@cindex #+OPTIONS
10492Export options can be set: globally with variables; for an individual file by 10422Export options can be set: globally with variables; for an individual file by
10493making variables buffer-local with in-buffer settings (@pxref{In-buffer 10423making variables buffer-local with in-buffer settings (@pxref{In-buffer
10494settings}), by setting individual keywords, or by specifying them in a 10424settings}), by setting individual keywords, or by specifying them in a
10495compact form with the @code{#+OPTIONS} keyword; or for a tree by setting 10425compact form with the @code{#+OPTIONS} keyword; or for a tree by setting
10496properties (@pxref{Properties and Columns}). Options set at a specific level 10426properties (@pxref{Properties and columns}). Options set at a specific level
10497override options set at a more general level. 10427override options set at a more general level.
10498 10428
10499@cindex #+SETUPFILE 10429@cindex #+SETUPFILE
10500In-buffer settings may appear anywhere in the file, either directly or 10430In-buffer settings may appear anywhere in the file, either directly or
10501indirectly through a file included using @samp{#+SETUPFILE: filename} syntax. 10431indirectly through a file included using @samp{#+SETUPFILE: filename} syntax.
10502Option keyword sets tailored to a particular back-end can be inserted from 10432Option keyword sets tailored to a particular back-end can be inserted from
10503the export dispatcher (@pxref{The Export Dispatcher}) using the @code{Insert 10433the export dispatcher (@pxref{The export dispatcher}) using the @code{Insert
10504template} command by pressing @key{#}. To insert keywords individually, 10434template} command by pressing @key{#}. To insert keywords individually,
10505a good way to make sure the keyword is correct is to type @code{#+} and then 10435a good way to make sure the keyword is correct is to type @code{#+} and then
10506to use @kbd{M-<TAB>} for completion. 10436to use @kbd{M-@key{TAB}}@footnote{Many desktops intercept @kbd{M-TAB} to
10437switch windows. Use @kbd{C-M-i} or @kbd{@key{ESC} @key{TAB}} instead.} for
10438completion.
10507 10439
10508The export keywords available for every back-end, and their equivalent global 10440The export keywords available for every back-end, and their equivalent global
10509variables, include: 10441variables, include:
10510 10442
10511@table @samp 10443@table @samp
10512@item AUTHOR 10444@item AUTHOR
10445@cindex #+AUTHOR
10513@vindex user-full-name 10446@vindex user-full-name
10514The document author (@code{user-full-name}). 10447The document author (@code{user-full-name}).
10515 10448
10516@item CREATOR 10449@item CREATOR
10450@cindex #+CREATOR
10517@vindex org-export-creator-string 10451@vindex org-export-creator-string
10518Entity responsible for output generation (@code{org-export-creator-string}). 10452Entity responsible for output generation (@code{org-export-creator-string}).
10519 10453
10520@item DATE 10454@item DATE
10455@cindex #+DATE
10521@vindex org-export-date-timestamp-format 10456@vindex org-export-date-timestamp-format
10522A date or a time-stamp@footnote{The variable 10457A date or a time-stamp@footnote{The variable
10523@code{org-export-date-timestamp-format} defines how this time-stamp will be 10458@code{org-export-date-timestamp-format} defines how this time-stamp will be
10524exported.}. 10459exported.}.
10525 10460
10526@item DESCRIPTION
10527The document description. Back-ends handle it as they see fit (e.g., for the
10528XHTML meta tag), if at all. You can use several such keywords for long
10529descriptions.
10530
10531@item EMAIL 10461@item EMAIL
10462@cindex #+EMAIL
10532@vindex user-mail-address 10463@vindex user-mail-address
10533The email address (@code{user-mail-address}). 10464The email address (@code{user-mail-address}).
10534 10465
10535@item KEYWORDS
10536The keywords defining the contents of the document. Back-ends handle it as
10537they see fit (e.g., for the XHTML meta tag), if at all. You can use several
10538such keywords if the list is long.
10539
10540@item LANGUAGE 10466@item LANGUAGE
10467@cindex #+LANGUAGE
10541@vindex org-export-default-language 10468@vindex org-export-default-language
10542The language used for translating some strings 10469Language to use for translating certain strings
10543(@code{org-export-default-language}). E.g., @samp{#+LANGUAGE: fr} will tell 10470(@code{org-export-default-language}). With @samp{#+LANGUAGE: fr}, for
10544Org to translate @emph{File} (english) into @emph{Fichier} (french) in the 10471example, Org translates @emph{Table of contents} to the French @emph{Table
10545clocktable. 10472des matières}.
10546 10473
10547@item SELECT_TAGS 10474@item SELECT_TAGS
10475@cindex #+SELECT_TAGS
10548@vindex org-export-select-tags 10476@vindex org-export-select-tags
10549The tags that select a tree for export (@code{org-export-select-tags}). The 10477The default value is @code{:export:}. When a tree is tagged with
10550default value is @code{:export:}. Within a subtree tagged with 10478@code{:export:} (@code{org-export-select-tags}), Org selects that tree and
10551@code{:export:}, you can still exclude entries with @code{:noexport:} (see 10479its sub-trees for export. Org excludes trees with @code{:noexport:} tags,
10552below). When headlines are selectively exported with @code{:export:} 10480see below. When selectively exporting files with @code{:export:} tags set,
10553anywhere in a file, text before the first headline is ignored. 10481Org does not export any text that appears before the first headline.
10554 10482
10555@item EXCLUDE_TAGS 10483@item EXCLUDE_TAGS
10556The tags that exclude a tree from export (@code{org-export-exclude-tags}). 10484@cindex #+EXCLUDE_TAGS
10557The default value is @code{:noexport:}. Entries with the @code{:noexport:} 10485@vindex org-export-exclude-tags
10558tag will be unconditionally excluded from the export, even if they have an 10486The default value is @code{:noexport:}. When a tree is tagged with
10559@code{:export:} tag. 10487@code{:noexport:} (@code{org-export-exclude-tags}), Org excludes that tree
10488and its sub-trees from export. Entries tagged with @code{:noexport:} will be
10489unconditionally excluded from the export, even if they have an
10490@code{:export:} tag. Even if a sub-tree is not exported, Org will execute any
10491code blocks contained in them.
10560 10492
10561@item TITLE 10493@item TITLE
10562The title to be shown (otherwise derived from buffer's name). You can use 10494@cindex #+TITLE
10563several such keywords for long titles. 10495@cindex document title
10496Org displays this title. For long titles, use multiple @code{#+TITLE} lines.
10564@end table 10497@end table
10565 10498
10566The @code{#+OPTIONS} keyword is a compact@footnote{If you want to configure 10499The @code{#+OPTIONS} keyword is a compact form. To configure multiple
10567many options this way, you can use several @code{#+OPTIONS} lines.} form that 10500options, use several @code{#+OPTIONS} lines. @code{#+OPTIONS} recognizes the
10568recognizes the following arguments: 10501following arguments.
10569 10502
10570@table @code 10503@table @code
10571@item ': 10504@item ':
10572@vindex org-export-with-smart-quotes 10505@vindex org-export-with-smart-quotes
10573Toggle smart quotes (@code{org-export-with-smart-quotes}). 10506Toggle smart quotes (@code{org-export-with-smart-quotes}). Depending on the
10507language used, when activated, Org treats pairs of double quotes as primary
10508quotes, pairs of single quotes as secondary quotes, and single quote marks as
10509apostrophes.
10574 10510
10575@item *: 10511@item *:
10576Toggle emphasized text (@code{org-export-with-emphasize}). 10512Toggle emphasized text (@code{org-export-with-emphasize}).
@@ -10587,12 +10523,12 @@ Toggle fixed-width sections
10587 10523
10588@item <: 10524@item <:
10589@vindex org-export-with-timestamps 10525@vindex org-export-with-timestamps
10590Toggle inclusion of any time/date active/inactive stamps 10526Toggle inclusion of time/date active/inactive stamps
10591(@code{org-export-with-timestamps}). 10527(@code{org-export-with-timestamps}).
10592 10528
10593@item : 10529@item \n:
10594@vindex org-export-preserve-breaks 10530@vindex org-export-preserve-breaks
10595Toggle line-break-preservation (@code{org-export-preserve-breaks}). 10531Toggles whether to preserve line breaks (@code{org-export-preserve-breaks}).
10596 10532
10597@item ^: 10533@item ^:
10598@vindex org-export-with-sub-superscripts 10534@vindex org-export-with-sub-superscripts
@@ -10602,8 +10538,8 @@ it is (@code{org-export-with-sub-superscripts}).
10602 10538
10603@item arch: 10539@item arch:
10604@vindex org-export-with-archived-trees 10540@vindex org-export-with-archived-trees
10605Configure export of archived trees. Can be set to @code{headline} to only 10541Configure how archived trees are exported. When set to @code{headline}, the
10606process the headline, skipping its contents 10542export process skips the contents and processes only the headlines
10607(@code{org-export-with-archived-trees}). 10543(@code{org-export-with-archived-trees}).
10608 10544
10609@item author: 10545@item author:
@@ -10611,19 +10547,29 @@ process the headline, skipping its contents
10611Toggle inclusion of author name into exported file 10547Toggle inclusion of author name into exported file
10612(@code{org-export-with-author}). 10548(@code{org-export-with-author}).
10613 10549
10550@item broken-links:
10551@vindex org-export-with-broken-links
10552Toggles if Org should continue exporting upon finding a broken internal link.
10553When set to @code{mark}, Org clearly marks the problem link in the output
10554(@code{org-export-with-broken-links}).
10555
10614@item c: 10556@item c:
10615@vindex org-export-with-clocks 10557@vindex org-export-with-clocks
10616Toggle inclusion of CLOCK keywords (@code{org-export-with-clocks}). 10558Toggle inclusion of CLOCK keywords (@code{org-export-with-clocks}).
10617 10559
10618@item creator: 10560@item creator:
10619@vindex org-export-with-creator 10561@vindex org-export-with-creator
10620Configure inclusion of creator info into exported file. It may be set to 10562Toggle inclusion of creator information in the exported file
10621@code{comment} (@code{org-export-with-creator}). 10563(@code{org-export-with-creator}).
10622 10564
10623@item d: 10565@item d:
10624@vindex org-export-with-drawers 10566@vindex org-export-with-drawers
10625Toggle inclusion of drawers, or list drawers to include 10567Toggles inclusion of drawers, or list of drawers to include, or list of
10626(@code{org-export-with-drawers}). 10568drawers to exclude (@code{org-export-with-drawers}).
10569
10570@item date:
10571@vindex org-export-with-date
10572Toggle inclusion of a date into exported file (@code{org-export-with-date}).
10627 10573
10628@item e: 10574@item e:
10629@vindex org-export-with-entities 10575@vindex org-export-with-entities
@@ -10650,20 +10596,28 @@ Toggle inclusion of inlinetasks (@code{org-export-with-inlinetasks}).
10650 10596
10651@item num: 10597@item num:
10652@vindex org-export-with-section-numbers 10598@vindex org-export-with-section-numbers
10653Toggle section-numbers (@code{org-export-with-section-numbers}). It can also 10599@cindex property, UNNUMBERED
10654be set to a number @samp{n}, so only headlines at that level or above will be 10600Toggle section-numbers (@code{org-export-with-section-numbers}). When set to
10655numbered. 10601number @samp{n}, Org numbers only those headlines at level @samp{n} or above.
10602Set @code{UNNUMBERED} property to non-@code{nil} to disable numbering of
10603heading and subheadings entirely.
10656 10604
10657@item p: 10605@item p:
10658@vindex org-export-with-planning 10606@vindex org-export-with-planning
10659Toggle export of planning information (@code{org-export-with-planning}). 10607Toggle export of planning information (@code{org-export-with-planning}).
10660``Planning information'' is the line containing the @code{SCHEDULED:}, the 10608``Planning information'' comes from lines located right after the headline
10661@code{DEADLINE:} or the @code{CLOSED:} cookies or a combination of them. 10609and contain any combination of these cookies: @code{SCHEDULED:},
10610@code{DEADLINE:}, or @code{CLOSED:}.
10662 10611
10663@item pri: 10612@item pri:
10664@vindex org-export-with-priority 10613@vindex org-export-with-priority
10665Toggle inclusion of priority cookies (@code{org-export-with-priority}). 10614Toggle inclusion of priority cookies (@code{org-export-with-priority}).
10666 10615
10616@item prop:
10617@vindex org-export-with-properties
10618Toggle inclusion of property drawers, or list the properties to include
10619(@code{org-export-with-properties}).
10620
10667@item stat: 10621@item stat:
10668@vindex org-export-with-statistics-cookies 10622@vindex org-export-with-statistics-cookies
10669Toggle inclusion of statistics cookies 10623Toggle inclusion of statistics cookies
@@ -10676,20 +10630,24 @@ Toggle inclusion of tags, may also be @code{not-in-toc}
10676 10630
10677@item tasks: 10631@item tasks:
10678@vindex org-export-with-tasks 10632@vindex org-export-with-tasks
10679Toggle inclusion of tasks (TODO items), can be @code{nil} to remove all 10633Toggle inclusion of tasks (TODO items); or @code{nil} to remove all tasks; or
10680tasks, @code{todo} to remove DONE tasks, or a list of keywords to keep 10634@code{todo} to remove DONE tasks; or list the keywords to keep
10681(@code{org-export-with-tasks}). 10635(@code{org-export-with-tasks}).
10682 10636
10683@item tex: 10637@item tex:
10684@vindex org-export-with-latex 10638@vindex org-export-with-latex
10685Configure export of @LaTeX{} fragments and environments. It may be set to 10639@code{nil} does not export; @code{t} exports; @code{verbatim} keeps
10686@code{verbatim} (@code{org-export-with-latex}). 10640everything in verbatim (@code{org-export-with-latex}).
10687 10641
10688@item timestamp: 10642@item timestamp:
10689@vindex org-export-time-stamp-file 10643@vindex org-export-time-stamp-file
10690Toggle inclusion of the creation time into exported file 10644Toggle inclusion of the creation time in the exported file
10691(@code{org-export-time-stamp-file}). 10645(@code{org-export-time-stamp-file}).
10692 10646
10647@item title:
10648@vindex org-export-with-title
10649Toggle inclusion of title (@code{org-export-with-title}).
10650
10693@item toc: 10651@item toc:
10694@vindex org-export-with-toc 10652@vindex org-export-with-toc
10695Toggle inclusion of the table of contents, or set the level limit 10653Toggle inclusion of the table of contents, or set the level limit
@@ -10703,255 +10661,589 @@ Toggle inclusion of TODO keywords into exported text
10703@item |: 10661@item |:
10704@vindex org-export-with-tables 10662@vindex org-export-with-tables
10705Toggle inclusion of tables (@code{org-export-with-tables}). 10663Toggle inclusion of tables (@code{org-export-with-tables}).
10664
10706@end table 10665@end table
10707 10666
10708When exporting only a subtree, each of the previous keywords@footnote{With 10667When exporting sub-trees, special node properties in them can override the
10709the exception of @samp{SETUPFILE}.} can be overridden locally by special node 10668above keywords. They are special because they have an @samp{EXPORT_} prefix.
10710properties. These begin with @samp{EXPORT_}, followed by the name of the 10669For example, @samp{DATE} and @samp{OPTIONS} keywords become, respectively,
10711keyword they supplant. For example, @samp{DATE} and @samp{OPTIONS} keywords 10670@samp{EXPORT_DATE} and @samp{EXPORT_OPTIONS}. Except for @samp{SETUPFILE},
10712become, respectively, @samp{EXPORT_DATE} and @samp{EXPORT_OPTIONS} 10671all other keywords listed above have an @samp{EXPORT_} equivalent.
10713properties.
10714 10672
10715@cindex #+BIND 10673@cindex #+BIND
10716@vindex org-export-allow-bind-keywords 10674@vindex org-export-allow-bind-keywords
10717If @code{org-export-allow-bind-keywords} is non-@code{nil}, Emacs variables 10675If @code{org-export-allow-bind-keywords} is non-@code{nil}, Emacs variables
10718can become buffer-local during export by using the BIND keyword. Its syntax 10676can become buffer-local during export by using the BIND keyword. Its syntax
10719is @samp{#+BIND: variable value}. This is particularly useful for in-buffer 10677is @samp{#+BIND: variable value}. This is particularly useful for in-buffer
10720settings that cannot be changed using specific keywords. 10678settings that cannot be changed using keywords.
10721 10679
10722@cindex property, EXPORT_FILE_NAME 10680@cindex property, EXPORT_FILE_NAME
10723The name of the output file to be generated is taken from the file associated 10681Normally Org generates the file name based on the buffer name and the
10724to the buffer, when possible, or asked to you otherwise. For subtree export, 10682extension based on the back-end format. For sub-trees, Org can export to a
10725you can also set @samp{EXPORT_FILE_NAME} property. In all cases, only the 10683file name as specified in the @code{EXPORT_FILE_NAME} property.
10726base name of the file is retained, and a back-end specific extension is 10684
10727added. 10685@node Table of contents
10686@section Table of contents
10687@cindex table of contents
10688@cindex list of tables
10689@cindex list of listings
10690
10691@cindex #+TOC
10692@vindex org-export-with-toc
10693Org normally inserts the table of contents directly before the first headline
10694of the file. Org sets the TOC depth the same as the headline levels in the
10695file. Use a lower number for lower TOC depth. To turn off TOC entirely, use
10696@code{nil}. This is configured in the @code{org-export-with-toc} variable or
10697as keywords in an Org file as:
10698
10699@example
10700#+OPTIONS: toc:2 @r{only include two levels in TOC}
10701#+OPTIONS: toc:nil @r{no default TOC at all}
10702@end example
10703
10704To move the table of contents to a different location, first turn off the
10705default with @code{org-export-with-toc} variable or with @code{#+OPTIONS:
10706toc:nil}. Then insert @code{#+TOC: headlines N} at the desired location(s).
10707
10708@example
10709#+OPTIONS: toc:nil @r{no default TOC}
10710...
10711#+TOC: headlines 2 @r{insert TOC here, with two headline levels}
10712@end example
10713
10714To adjust the TOC depth for a specific section of the Org document, append an
10715additional @samp{local} parameter. This parameter becomes a relative depth
10716for the current level.
10728 10717
10729@node ASCII/Latin-1/UTF-8 export, Beamer export, Export settings, Exporting 10718Note that for this feature to work properly in @LaTeX{} export, the Org file
10719requires the inclusion of the @code{titletoc} package. Because of
10720compatibility issues, @code{titletoc} has to be loaded @emph{before}
10721@code{hyperref}. Customize the @code{org-latex-default-packages-alist}
10722variable.
10723
10724@example
10725* Section #+TOC: headlines 1 local @r{insert local TOC, with direct children
10726only}
10727@end example
10728
10729Use the @code{TOC} keyword to generate list of tables (resp.@: all listings)
10730with captions.
10731
10732@example
10733#+TOC: listings @r{build a list of listings}
10734#+TOC: tables @r{build a list of tables}
10735@end example
10736
10737@cindex property, ALT_TITLE
10738Normally Org uses the headline for its entry in the table of contents. But
10739with @code{ALT_TITLE} property, a different entry can be specified for the
10740table of contents.
10741
10742@node Include files
10743@section Include files
10744@cindex include files, during export
10745Include other files during export. For example, to include your @file{.emacs}
10746file, you could use:
10747@cindex #+INCLUDE
10748
10749@example
10750#+INCLUDE: "~/.emacs" src emacs-lisp
10751@end example
10752
10753@noindent
10754The first parameter is the file name to include. The optional second
10755parameter specifies the block type: @samp{example}, @samp{export} or
10756@samp{src}. The optional third parameter specifies the source code language
10757to use for formatting the contents. This is relevant to both @samp{export}
10758and @samp{src} block types.
10759
10760If an include file is specified as having a markup language, Org neither
10761checks for valid syntax nor changes the contents in any way. For
10762@samp{example} and @samp{src} blocks, Org code-escapes the contents before
10763inclusion.
10764
10765If an include file is not specified as having any markup language, Org
10766assumes it be in Org format and proceeds as usual with a few exceptions. Org
10767makes the footnote labels (@pxref{Footnotes}) in the included file local to
10768that file. The contents of the included file will belong to the same
10769structure---headline, item---containing the @code{INCLUDE} keyword. In
10770particular, headlines within the file will become children of the current
10771section. That behavior can be changed by providing an additional keyword
10772parameter, @code{:minlevel}. It shifts the headlines in the included file to
10773become the lowest level. For example, this syntax makes the included file
10774a sibling of the current top-level headline:
10775
10776@example
10777#+INCLUDE: "~/my-book/chapter2.org" :minlevel 1
10778@end example
10779
10780Inclusion of only portions of files are specified using ranges parameter with
10781@code{:lines} keyword. The line at the upper end of the range will not be
10782included. The start and/or the end of the range may be omitted to use the
10783obvious defaults.
10784
10785@example
10786#+INCLUDE: "~/.emacs" :lines "5-10" @r{Include lines 5 to 10, 10 excluded}
10787#+INCLUDE: "~/.emacs" :lines "-10" @r{Include lines 1 to 10, 10 excluded}
10788#+INCLUDE: "~/.emacs" :lines "10-" @r{Include lines from 10 to EOF}
10789@end example
10790
10791Inclusions may specify a file-link to extract an object matched by
10792@code{org-link-search}@footnote{Note that
10793@code{org-link-search-must-match-exact-headline} is locally bound to
10794non-@code{nil}. Therefore, @code{org-link-search} only matches headlines and
10795named elements.} (@pxref{Search options}).
10796
10797To extract only the contents of the matched object, set @code{:only-contents}
10798property to non-@code{nil}. This will omit any planning lines or property
10799drawers. The ranges for @code{:lines} keyword are relative to the requested
10800element. Some examples:
10801
10802@example
10803#+INCLUDE: "./paper.org::#theory" :only-contents t
10804 @r{Include the body of the heading with the custom id @samp{theory}}
10805#+INCLUDE: "./paper.org::mytable" @r{Include named element.}
10806#+INCLUDE: "./paper.org::*conclusion" :lines 1-20
10807 @r{Include the first 20 lines of the headline named @samp{conclusion}.}
10808@end example
10809
10810@table @kbd
10811@kindex C-c '
10812@item C-c '
10813Visit the include file at point.
10814@end table
10815
10816@node Macro replacement
10817@section Macro replacement
10818@cindex macro replacement, during export
10819@cindex #+MACRO
10820
10821Macros replace text snippets during export. This is a macro definition in
10822Org:
10823
10824@example
10825#+MACRO: name replacement text $1, $2 are arguments
10826@end example
10827
10828@noindent which can be referenced using
10829@code{@{@{@{name(arg1, arg2)@}@}@}}@footnote{Since commas separate the
10830arguments, commas within arguments have to be escaped with the backslash
10831character. So only those backslash characters before a comma need escaping
10832with another backslash character.}.
10833
10834Org recognizes macro references in following Org markup areas: paragraphs,
10835headlines, verse blocks, tables cells and lists. Org also recognizes macro
10836references in keywords, such as @code{#+CAPTION}, @code{#+TITLE},
10837@code{#+AUTHOR}, @code{#+DATE}, and for some back-end specific export
10838options.
10839
10840Org comes with following pre-defined macros:
10841
10842@table @code
10843@item @{@{@{title@}@}@}
10844@itemx @{@{@{author@}@}@}
10845@itemx @{@{@{email@}@}@}
10846@cindex title, macro
10847@cindex author, macro
10848@cindex email, macro
10849Org replaces these macro references with available information at the time of
10850export.
10851
10852@item @{@{@{date@}@}@}
10853@itemx @{@{@{date(@var{FORMAT})@}@}@}
10854@cindex date, macro
10855This macro refers to the @code{#+DATE} keyword. @var{FORMAT} is an optional
10856argument to the @code{@{@{@{date@}@}@}} macro that will be used only if
10857@code{#+DATE} is a single timestamp. @var{FORMAT} should be a format string
10858understood by @code{format-time-string}.
10859
10860@item @{@{@{time(@var{FORMAT})@}@}@}
10861@itemx @{@{@{modification-time(@var{FORMAT}, @var{VC})@}@}@}
10862@cindex time, macro
10863@cindex modification time, macro
10864These macros refer to the document's date and time of export and date and
10865time of modification. @var{FORMAT} is a string understood by
10866@code{format-time-string}. If the second argument to the
10867@code{modification-time} macro is non-@code{nil}, Org uses @file{vc.el} to
10868retrieve the document's modification time from the version control
10869system. Otherwise Org reads the file attributes.
10870
10871@item @{@{@{input-file@}@}@}
10872@cindex input file, macro
10873This macro refers to the filename of the exported file.
10874
10875@item @{@{@{property(@var{PROPERTY-NAME})@}@}@}
10876@itemx @{@{@{property(@var{PROPERTY-NAME},@var{SEARCH-OPTION})@}@}@}
10877@cindex property, macro
10878This macro returns the value of property @var{PROPERTY-NAME} in the current
10879entry. If @var{SEARCH-OPTION} (@pxref{Search options}) refers to a remote
10880entry, that will be used instead.
10881@end table
10882
10883The surrounding brackets can be made invisible by setting
10884@code{org-hide-macro-markers} non-@code{nil}.
10885
10886Org expands macros at the very beginning of the export process.
10887
10888@node Comment lines
10889@section Comment lines
10890@cindex exporting, not
10891
10892@cindex comment lines
10893Lines starting with zero or more whitespace characters followed by one
10894@samp{#} and a whitespace are treated as comments and, as such, are not
10895exported.
10896
10897@cindex #+BEGIN_COMMENT
10898Likewise, regions surrounded by @samp{#+BEGIN_COMMENT}
10899... @samp{#+END_COMMENT} are not exported.
10900
10901@cindex comment trees
10902Finally, a @samp{COMMENT} keyword at the beginning of an entry, but after any
10903other keyword or priority cookie, comments out the entire subtree. In this
10904case, the subtree is not exported and no code block within it is executed
10905either@footnote{For a less drastic behavior, consider using a select tag
10906(@pxref{Export settings}) instead.}. The command below helps changing the
10907comment status of a headline.
10908
10909@table @kbd
10910@kindex C-c ;
10911@item C-c ;
10912Toggle the @samp{COMMENT} keyword at the beginning of an entry.
10913@end table
10914
10915@node ASCII/Latin-1/UTF-8 export
10730@section ASCII/Latin-1/UTF-8 export 10916@section ASCII/Latin-1/UTF-8 export
10731@cindex ASCII export 10917@cindex ASCII export
10732@cindex Latin-1 export 10918@cindex Latin-1 export
10733@cindex UTF-8 export 10919@cindex UTF-8 export
10734 10920
10735ASCII export produces a simple and very readable version of an Org mode 10921ASCII export produces an output file containing only plain ASCII characters.
10736file, containing only plain ASCII@. Latin-1 and UTF-8 export augment the file 10922This is the most simplest and direct text output. It does not contain any
10737with special characters and symbols available in these encodings. 10923Org markup either. Latin-1 and UTF-8 export use additional characters and
10924symbols available in these encoding standards. All three of these export
10925formats offer the most basic of text output for maximum portability.
10926
10927@vindex org-ascii-text-width
10928On export, Org fills and justifies text according to the text width set in
10929@code{org-ascii-text-width}.
10738 10930
10739@vindex org-ascii-links-to-notes 10931@vindex org-ascii-links-to-notes
10740Links are exported in a footnote-like style, with the descriptive part in the 10932Org exports links using a footnote-like style where the descriptive part is
10741text and the link in a note before the next heading. See the variable 10933in the text and the link is in a note before the next heading. See the
10742@code{org-ascii-links-to-notes} for details and other options. 10934variable @code{org-ascii-links-to-notes} for details.
10743 10935
10744@subheading ASCII export commands 10936@subheading ASCII export commands
10745 10937
10746@table @kbd 10938@table @kbd
10747@orgcmd{C-c C-e t a/l/u,org-ascii-export-to-ascii} 10939@orgcmd{C-c C-e t a/l/u,org-ascii-export-to-ascii}
10748Export as an ASCII file. For an Org file, @file{myfile.org}, the ASCII file 10940Export as an ASCII file with a @file{.txt} extension. For @file{myfile.org},
10749will be @file{myfile.txt}. The file will be overwritten without warning. 10941Org exports to @file{myfile.txt}, overwriting without warning. For
10750When the original file is @file{myfile.txt}, the resulting file becomes 10942@file{myfile.txt}, Org exports to @file{myfile.txt.txt} in order to prevent
10751@file{myfile.txt.txt} in order to prevent data loss. 10943data loss.
10752@orgcmd{C-c C-e t A/L/U,org-ascii-export-as-ascii} 10944@orgcmd{C-c C-e t A/L/U,org-ascii-export-as-ascii}
10753Export to a temporary buffer. Do not create a file. 10945Export to a temporary buffer. Does not create a file.
10946@end table
10947
10948@subheading ASCII specific export settings
10949The ASCII export back-end has one extra keyword for customizing ASCII output.
10950Setting this keyword works similar to the general options (@pxref{Export
10951settings}).
10952
10953@table @samp
10954@item SUBTITLE
10955@cindex #+SUBTITLE (ASCII)
10956The document subtitle. For long subtitles, use multiple @code{#+SUBTITLE}
10957lines in the Org file. Org prints them on one continuous line, wrapping into
10958multiple lines if necessary.
10754@end table 10959@end table
10755 10960
10756@subheading Header and sectioning structure 10961@subheading Header and sectioning structure
10757 10962
10758In the exported version, the first three outline levels become headlines, 10963Org converts the first three outline levels into headlines for ASCII export.
10759defining a general document structure. Additional levels are exported as 10964The remaining levels are turned into lists. To change this cut-off point
10760lists. The transition can also occur at a different level (@pxref{Export 10965where levels become lists, @pxref{Export settings}.
10761settings}).
10762 10966
10763@subheading Quoting ASCII text 10967@subheading Quoting ASCII text
10764 10968
10765You can insert text that will only appear when using @code{ASCII} back-end 10969To insert text within the Org file by the ASCII back-end, use one the
10766with the following constructs: 10970following constructs, inline, keyword, or export block:
10767 10971
10768@cindex #+ASCII 10972@cindex #+ASCII
10769@cindex #+BEGIN_ASCII 10973@cindex #+BEGIN_EXPORT ascii
10770@example 10974@example
10771Text @@@@ascii:and additional text@@@@ within a paragraph. 10975Inline text @@@@ascii:and additional text@@@@ within a paragraph.
10772 10976
10773#+ASCII: Some text 10977#+ASCII: Some text
10774 10978
10775#+BEGIN_ASCII 10979#+BEGIN_EXPORT ascii
10776All lines in this block will appear only when using this back-end. 10980Org exports text in this block only when using ASCII back-end.
10777#+END_ASCII 10981#+END_EXPORT
10778@end example 10982@end example
10779 10983
10780@subheading ASCII specific attributes 10984@subheading ASCII specific attributes
10781@cindex #+ATTR_ASCII 10985@cindex #+ATTR_ASCII
10782@cindex horizontal rules, in ASCII export 10986@cindex horizontal rules, in ASCII export
10783 10987
10784@code{ASCII} back-end only understands one attribute, @code{:width}, which 10988ASCII back-end recognizes only one attribute, @code{:width}, which specifies
10785specifies the length, in characters, of a given horizontal rule. It must be 10989the width of an horizontal rule in number of characters. The keyword and
10786specified using an @code{ATTR_ASCII} line, directly preceding the rule. 10990syntax for specifying widths is:
10787 10991
10788@example 10992@example
10789#+ATTR_ASCII: :width 10 10993#+ATTR_ASCII: :width 10
10790----- 10994-----
10791@end example 10995@end example
10792 10996
10793@node Beamer export, HTML export, ASCII/Latin-1/UTF-8 export, Exporting 10997@subheading ASCII special blocks
10998@cindex special blocks, in ASCII export
10999@cindex #+BEGIN_JUSTIFYLEFT
11000@cindex #+BEGIN_JUSTIFYRIGHT
11001
11002Besides @code{#+BEGIN_CENTER} blocks (@pxref{Paragraphs}), ASCII back-end has
11003these two left and right justification blocks:
11004
11005@example
11006#+BEGIN_JUSTIFYLEFT
11007It's just a jump to the left...
11008#+END_JUSTIFYLEFT
11009
11010#+BEGIN_JUSTIFYRIGHT
11011...and then a step to the right.
11012#+END_JUSTIFYRIGHT
11013@end example
11014
11015@node Beamer export
10794@section Beamer export 11016@section Beamer export
10795@cindex Beamer export 11017@cindex Beamer export
10796 11018
10797The @LaTeX{} class @emph{Beamer} allows production of high quality 11019Org uses @emph{Beamer} export to convert an Org file tree structure into a
10798presentations using @LaTeX{} and pdf processing. Org mode has special 11020high-quality interactive slides for presentations. @emph{Beamer} is a
10799support for turning an Org mode file or tree into a Beamer presentation. 11021@LaTeX{} document class for creating presentations in PDF, HTML, and other
11022popular display formats.
10800 11023
10801@subheading Beamer export commands 11024@menu
11025* Beamer export commands:: For creating Beamer documents.
11026* Beamer specific export settings:: For customizing Beamer export.
11027* Sectioning Frames and Blocks in Beamer:: For composing Beamer slides.
11028* Beamer specific syntax:: For using in Org documents.
11029* Editing support:: For using helper functions.
11030* A Beamer example:: A complete presentation.
11031@end menu
11032
11033@node Beamer export commands
11034@subsection Beamer export commands
10802 11035
10803@table @kbd 11036@table @kbd
10804@orgcmd{C-c C-e l b,org-beamer-export-to-latex} 11037@orgcmd{C-c C-e l b,org-beamer-export-to-latex}
10805Export as a @LaTeX{} file. For an Org file @file{myfile.org}, the @LaTeX{} 11038Export as @LaTeX{} file with a @file{.tex} extension. For @file{myfile.org},
10806file will be @file{myfile.tex}. The file will be overwritten without 11039Org exports to @file{myfile.tex}, overwriting without warning.
10807warning.
10808@orgcmd{C-c C-e l B,org-beamer-export-as-latex} 11040@orgcmd{C-c C-e l B,org-beamer-export-as-latex}
10809Export to a temporary buffer. Do not create a file. 11041Export to a temporary buffer. Does not create a file.
10810@orgcmd{C-c C-e l P,org-beamer-export-to-pdf} 11042@orgcmd{C-c C-e l P,org-beamer-export-to-pdf}
10811Export as @LaTeX{} and then process to PDF. 11043Export as @LaTeX{} file and then convert it to PDF format.
10812@item C-c C-e l O 11044@item C-c C-e l O
10813Export as @LaTeX{} and then process to PDF, then open the resulting PDF file. 11045Export as @LaTeX{} file, convert it to PDF format, and then open the PDF
11046file.
11047@end table
11048
11049@node Beamer specific export settings
11050@subsection Beamer specific export settings
11051
11052Beamer export back-end has several additional keywords for customizing Beamer
11053output. These keywords work similar to the general options settings
11054(@pxref{Export settings}).
11055
11056@table @samp
11057@item BEAMER_THEME
11058@cindex #+BEAMER_THEME
11059@vindex org-beamer-theme
11060The Beamer layout theme (@code{org-beamer-theme}). Use square brackets for
11061options. For example:
11062@smallexample
11063#+BEAMER_THEME: Rochester [height=20pt]
11064@end smallexample
11065
11066@item BEAMER_FONT_THEME
11067@cindex #+BEAMER_FONT_THEME
11068The Beamer font theme.
11069
11070@item BEAMER_INNER_THEME
11071@cindex #+BEAMER_INNER_THEME
11072The Beamer inner theme.
11073
11074@item BEAMER_OUTER_THEME
11075@cindex #+BEAMER_OUTER_THEME
11076The Beamer outer theme.
11077
11078@item BEAMER_HEADER
11079@cindex #+BEAMER_HEADER
11080Arbitrary lines inserted in the preamble, just before the @samp{hyperref}
11081settings.
11082
11083@item DESCRIPTION
11084@cindex #+DESCRIPTION (Beamer)
11085The document description. For long descriptions, use multiple
11086@code{#+DESCRIPTION} keywords. By default, @samp{hyperref} inserts
11087@code{#+DESCRIPTION} as metadata. Use @code{org-latex-hyperref-template} to
11088configure document metadata. Use @code{org-latex-title-command} to configure
11089typesetting of description as part of front matter.
11090
11091@item KEYWORDS
11092@cindex #+KEYWORDS (Beamer)
11093The keywords for defining the contents of the document. Use multiple
11094@code{#+KEYWORDS} lines if necessary. By default, @samp{hyperref} inserts
11095@code{#+KEYWORDS} as metadata. Use @code{org-latex-hyperref-template} to
11096configure document metadata. Use @code{org-latex-title-command} to configure
11097typesetting of keywords as part of front matter.
11098
11099@item SUBTITLE
11100@cindex #+SUBTITLE (Beamer)
11101@vindex org-beamer-subtitle-format
11102Document's subtitle. For typesetting, use @code{org-beamer-subtitle-format}
11103string. Use @code{org-latex-hyperref-template} to configure document
11104metadata. Use @code{org-latex-title-command} to configure typesetting of
11105subtitle as part of front matter.
10814@end table 11106@end table
10815 11107
10816@subheading Sectioning, Frames and Blocks 11108@node Sectioning Frames and Blocks in Beamer
11109@subsection Sectioning, Frames and Blocks in Beamer
10817 11110
10818Any tree with not-too-deep level nesting should in principle be exportable as 11111Org transforms heading levels into Beamer's sectioning elements, frames and
10819a Beamer presentation. Headlines fall into three categories: sectioning 11112blocks. Any Org tree with a not-too-deep-level nesting should in principle
10820elements, frames and blocks. 11113be exportable as a Beamer presentation.
10821 11114
10822@itemize @minus 11115@itemize @minus
10823@item 11116@item
10824@vindex org-beamer-frame-level 11117@vindex org-beamer-frame-level
10825Headlines become frames when their level is equal to 11118Org headlines become Beamer frames when the heading level in Org is equal to
10826@code{org-beamer-frame-level} or @code{H} value in an @code{OPTIONS} line 11119@code{org-beamer-frame-level} or @code{H} value in an @code{OPTIONS} line
10827(@pxref{Export settings}). 11120(@pxref{Export settings}).
10828 11121
10829@cindex property, BEAMER_ENV 11122@cindex property, BEAMER_ENV
10830Though, if a headline in the current tree has a @code{BEAMER_ENV} property 11123Org overrides headlines to frames conversion for the current tree of an Org
10831set to either to @code{frame} or @code{fullframe}, its level overrides the 11124file if it encounters the @code{BEAMER_ENV} property set to @code{frame} or
10832variable. A @code{fullframe} is a frame with an empty (ignored) title. 11125@code{fullframe}. Org ignores whatever @code{org-beamer-frame-level} happens
11126to be for that headline level in the Org tree. In Beamer terminology, a
11127@code{fullframe} is a frame without its title.
10833 11128
10834@item 11129@item
10835@vindex org-beamer-environments-default 11130@vindex org-beamer-environments-default
10836@vindex org-beamer-environments-extra 11131@vindex org-beamer-environments-extra
10837All frame's children become @code{block} environments. Special block types 11132Org exports a Beamer frame's objects as @code{block} environments. Org can
10838can be enforced by setting headline's @code{BEAMER_ENV} property@footnote{If 11133enforce wrapping in special block types when @code{BEAMER_ENV} property is
10839this property is set, the entry will also get a @code{:B_environment:} tag to 11134set@footnote{If @code{BEAMER_ENV} is set, Org export adds
10840make this visible. This tag has no semantic meaning, it is only a visual 11135@code{:B_environment:} tag to make it visible. The tag serves as a visual
10841aid.} to an appropriate value (see @code{org-beamer-environments-default} for 11136aid and has no semantic relevance.}. For valid values see
10842supported values and @code{org-beamer-environments-extra} for adding more). 11137@code{org-beamer-environments-default}. To add more values, see
11138@code{org-beamer-environments-extra}.
10843 11139
10844@item 11140@item
10845@cindex property, BEAMER_REF 11141@cindex property, BEAMER_REF
10846As a special case, if the @code{BEAMER_ENV} property is set to either 11142If @code{BEAMER_ENV} is set to @code{appendix}, Org exports the entry as an
10847@code{appendix}, @code{note}, @code{noteNH} or @code{againframe}, the 11143appendix. When set to @code{note}, Org exports the entry as a note within
10848headline will become, respectively, an appendix, a note (within frame or 11144the frame or between frames, depending on the entry's heading level. When
10849between frame, depending on its level), a note with its title ignored or an 11145set to @code{noteNH}, Org exports the entry as a note without its title.
10850@code{\againframe} command. In the latter case, a @code{BEAMER_REF} property 11146When set to @code{againframe}, Org exports the entry with @code{\againframe}
10851is mandatory in order to refer to the frame being resumed, and contents are 11147command, which makes setting the @code{BEAMER_REF} property mandatory because
10852ignored. 11148@code{\againframe} needs frame to resume.
10853 11149
10854Also, a headline with an @code{ignoreheading} environment will have its 11150When @code{ignoreheading} is set, Org export ignores the entry's headline but
10855contents only inserted in the output. This special value is useful to have 11151not its content. This is useful for inserting content between frames. It is
10856data between frames, or to properly close a @code{column} environment. 11152also useful for properly closing a @code{column} environment.
10857@end itemize 11153@end itemize
10858 11154
10859@cindex property, BEAMER_ACT 11155@cindex property, BEAMER_ACT
10860@cindex property, BEAMER_OPT 11156@cindex property, BEAMER_OPT
10861Headlines also support @code{BEAMER_ACT} and @code{BEAMER_OPT} properties. 11157When @code{BEAMER_ACT} is set for a headline, Org export translates that
10862The former is translated as an overlay/action specification, or a default 11158headline as an overlay or action specification. When enclosed in square
10863overlay specification when enclosed within square brackets. The latter 11159brackets, Org export makes the overlay specification a default. Use
10864specifies options@footnote{The @code{fragile} option is added automatically 11160@code{BEAMER_OPT} to set any options applicable to the current Beamer frame
10865if it contains code that requires a verbatim environment, though.} for the 11161or block. The Beamer export back-end wraps with appropriate angular or
10866current frame or block. The export back-end will automatically wrap 11162square brackets. It also adds the @code{fragile} option for any code that may
10867properties within angular or square brackets when appropriate. 11163require a verbatim block.
10868 11164
10869@cindex property, BEAMER_COL 11165@cindex property, BEAMER_COL
10870Moreover, headlines handle the @code{BEAMER_COL} property. Its value should 11166To create a column on the Beamer slide, use the @code{BEAMER_COL} property
10871be a decimal number representing the width of the column as a fraction of the 11167for its headline in the Org file. Set the value of @code{BEAMER_COL} to a
10872total text width. If the headline has no specific environment, its title 11168decimal number representing the fraction of the total text width. Beamer
10873will be ignored and its contents will fill the column created. Otherwise, 11169export uses this value to set the column's width and fills the column with
10874the block will fill the whole column and the title will be preserved. Two 11170the contents of the Org entry. If the Org entry has no specific environment
10875contiguous headlines with a non-@code{nil} @code{BEAMER_COL} value share the same 11171defined, Beamer export ignores the heading. If the Org entry has a defined
10876@code{columns} @LaTeX{} environment. It will end before the next headline 11172environment, Beamer export uses the heading as title. Behind the scenes,
10877without such a property. This environment is generated automatically. 11173Beamer export automatically handles @LaTeX{} column separations for
10878Although, it can also be explicitly created, with a special @code{columns} 11174contiguous headlines. To manually adjust them for any unique configurations
10879value for @code{BEAMER_ENV} property (if it needs to be set up with some 11175needs, use the @code{BEAMER_ENV} property.
10880specific options, for example). 11176
10881 11177@node Beamer specific syntax
10882@subheading Beamer specific syntax 11178@subsection Beamer specific syntax
10883 11179Since Org's Beamer export back-end is an extension of the @LaTeX{} back-end,
10884Beamer back-end is an extension of @LaTeX{} back-end. As such, all @LaTeX{} 11180it recognizes other @LaTeX{} specific syntax---for example, @samp{#+LATEX:}
10885specific syntax (e.g., @samp{#+LATEX:} or @samp{#+ATTR_LATEX:}) is 11181or @samp{#+ATTR_LATEX:}. @xref{@LaTeX{} export}, for details.
10886recognized. See @ref{@LaTeX{} and PDF export} for more information. 11182
10887 11183Beamer export wraps the table of contents generated with @code{toc:t}
10888@cindex #+BEAMER_THEME 11184@code{OPTION} keyword in a @code{frame} environment. Beamer export does not
10889@cindex #+BEAMER_COLOR_THEME 11185wrap the table of contents generated with @code{TOC} keyword (@pxref{Table of
10890@cindex #+BEAMER_FONT_THEME 11186contents}). Use square brackets for specifying options.
10891@cindex #+BEAMER_INNER_THEME
10892@cindex #+BEAMER_OUTER_THEME
10893Beamer export introduces a number of keywords to insert code in the
10894document's header. Four control appearance of the presentation:
10895@code{#+BEAMER_THEME}, @code{#+BEAMER_COLOR_THEME},
10896@code{#+BEAMER_FONT_THEME}, @code{#+BEAMER_INNER_THEME} and
10897@code{#+BEAMER_OUTER_THEME}. All of them accept optional arguments
10898within square brackets. The last one, @code{#+BEAMER_HEADER}, is more
10899generic and allows you to append any line of code in the header.
10900
10901@example
10902#+BEAMER_THEME: Rochester [height=20pt]
10903#+BEAMER_COLOR_THEME: spruce
10904@end example
10905
10906Table of contents generated from @code{toc:t} @code{OPTION} keyword are
10907wrapped within a @code{frame} environment. Those generated from a @code{TOC}
10908keyword (@pxref{Table of contents}) are not. In that case, it is also
10909possible to specify options, enclosed within square brackets.
10910 11187
10911@example 11188@example
10912#+TOC: headlines [currentsection] 11189#+TOC: headlines [currentsection]
10913@end example 11190@end example
10914 11191
10915Beamer specific code can be inserted with the following constructs: 11192Insert Beamer-specific code using the following constructs:
10916 11193
10917@cindex #+BEAMER 11194@cindex #+BEAMER
10918@cindex #+BEGIN_BEAMER 11195@cindex #+BEGIN_EXPORT beamer
10919@example 11196@example
10920#+BEAMER: \pause 11197#+BEAMER: \pause
10921 11198
10922#+BEGIN_BEAMER 11199#+BEGIN_EXPORT beamer
10923All lines in this block will appear only when using this back-end. 11200Only Beamer export back-end will export this line.
10924#+END_BEAMER 11201#+END_BEAMER
10925 11202
10926Text @@@@beamer:some code@@@@ within a paragraph. 11203Text @@@@beamer:some code@@@@ within a paragraph.
10927@end example 11204@end example
10928 11205
10929In particular, this last example can be used to add overlay specifications to 11206Inline constructs, such as the last one above, are useful for adding overlay
10930objects whose type is among @code{bold}, @code{item}, @code{link}, 11207specifications to objects with @code{bold}, @code{item}, @code{link},
10931@code{radio-target} and @code{target}, when the value is enclosed within 11208@code{radio-target} and @code{target} types. Enclose the value in angular
10932angular brackets and put at the beginning the object. 11209brackets and place the specification at the beginning the object as shown in
11210this example:
10933 11211
10934@example 11212@example
10935A *@@@@beamer:<2->@@@@useful* feature 11213A *@@@@beamer:<2->@@@@useful* feature
10936@end example 11214@end example
10937 11215
10938@cindex #+ATTR_BEAMER 11216@cindex #+ATTR_BEAMER
10939Eventually, every plain list has support for @code{:environment}, 11217Beamer export recognizes the @code{ATTR_BEAMER} keyword with the following
10940@code{:overlay} and @code{:options} attributes through 11218attributes from Beamer configurations: @code{:environment} for changing local
10941@code{ATTR_BEAMER} affiliated keyword. The first one allows the use 11219Beamer environment, @code{:overlay} for specifying Beamer overlays in angular
10942of a different environment, the second sets overlay specifications and 11220or square brackets, and @code{:options} for inserting optional arguments.
10943the last one inserts optional arguments in current list environment.
10944 11221
10945@example 11222@example
10946#+ATTR_BEAMER: :overlay +- 11223#+ATTR_BEAMER: :environment nonindentlist
11224- item 1, not indented
11225- item 2, not indented
11226- item 3, not indented
11227@end example
11228
11229@example
11230#+ATTR_BEAMER: :overlay <+->
10947- item 1 11231- item 1
10948- item 2 11232- item 2
10949@end example 11233@end example
10950 11234
10951@subheading Editing support 11235@example
11236#+ATTR_BEAMER: :options [Lagrange]
11237Let $G$ be a finite group, and let $H$ be
11238a subgroup of $G$. Then the order of $H$ divides the order of $G$.
11239@end example
10952 11240
10953You can turn on a special minor mode @code{org-beamer-mode} for faster 11241@node Editing support
10954editing with: 11242@subsection Editing support
11243
11244
11245The @code{org-beamer-mode} is a special minor mode for faster editing of
11246Beamer documents.
10955 11247
10956@example 11248@example
10957#+STARTUP: beamer 11249#+STARTUP: beamer
@@ -10959,23 +11251,19 @@ editing with:
10959 11251
10960@table @kbd 11252@table @kbd
10961@orgcmd{C-c C-b,org-beamer-select-environment} 11253@orgcmd{C-c C-b,org-beamer-select-environment}
10962In @code{org-beamer-mode}, this key offers fast selection of a Beamer 11254The @code{org-beamer-mode} provides this key for quicker selections in Beamer
10963environment or the @code{BEAMER_COL} property. 11255normal environments, and for selecting the @code{BEAMER_COL} property.
10964@end table 11256@end table
10965 11257
10966Also, a template for useful in-buffer settings or properties can be inserted 11258@node A Beamer example
10967into the buffer with @kbd{M-x org-beamer-insert-options-template}. Among 11259@subsection A Beamer example
10968other things, this will install a column view format which is very handy for
10969editing special properties used by Beamer.
10970 11260
10971@subheading An example 11261Here is an example of an Org document ready for Beamer export.
10972 11262
10973Here is a simple example Org document that is intended for Beamer export. 11263@example
10974
10975@smallexample
10976#+TITLE: Example Presentation 11264#+TITLE: Example Presentation
10977#+AUTHOR: Carsten Dominik 11265#+AUTHOR: Carsten Dominik
10978#+OPTIONS: H:2 11266#+OPTIONS: H:2 toc:t num:t
10979#+LATEX_CLASS: beamer 11267#+LATEX_CLASS: beamer
10980#+LATEX_CLASS_OPTIONS: [presentation] 11268#+LATEX_CLASS_OPTIONS: [presentation]
10981#+BEAMER_THEME: Madrid 11269#+BEAMER_THEME: Madrid
@@ -10984,91 +11272,148 @@ Here is a simple example Org document that is intended for Beamer export.
10984* This is the first structural section 11272* This is the first structural section
10985 11273
10986** Frame 1 11274** Frame 1
10987*** Thanks to Eric Fraga :B_block:BMCOL: 11275*** Thanks to Eric Fraga :B_block:
10988 :PROPERTIES: 11276 :PROPERTIES:
10989 :BEAMER_COL: 0.48 11277 :BEAMER_COL: 0.48
10990 :BEAMER_ENV: block 11278 :BEAMER_ENV: block
10991 :END: 11279 :END:
10992 for the first viable Beamer setup in Org 11280 for the first viable Beamer setup in Org
10993*** Thanks to everyone else :B_block:BMCOL: 11281*** Thanks to everyone else :B_block:
10994 :PROPERTIES: 11282 :PROPERTIES:
10995 :BEAMER_COL: 0.48 11283 :BEAMER_COL: 0.48
10996 :BEAMER_ACT: <2-> 11284 :BEAMER_ACT: <2->
10997 :BEAMER_ENV: block 11285 :BEAMER_ENV: block
10998 :END: 11286 :END:
10999 for contributing to the discussion 11287 for contributing to the discussion
11000**** This will be formatted as a beamer note :B_note: 11288**** This will be formatted as a beamer note :B_note:
11001 :PROPERTIES: 11289 :PROPERTIES:
11002 :BEAMER_env: note 11290 :BEAMER_env: note
11003 :END: 11291 :END:
11004** Frame 2 (where we will not use columns) 11292** Frame 2 (where we will not use columns)
11005*** Request 11293*** Request
11006 Please test this stuff! 11294 Please test this stuff!
11007@end smallexample 11295@end example
11008 11296
11009@node HTML export, @LaTeX{} and PDF export, Beamer export, Exporting 11297@node HTML export
11010@section HTML export 11298@section HTML export
11011@cindex HTML export 11299@cindex HTML export
11012 11300
11013Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive 11301Org mode contains an HTML exporter with extensive HTML formatting compatible
11014HTML formatting, in ways similar to John Gruber's @emph{markdown} 11302with XHTML 1.0 strict standard.
11015language, but with additional support for tables.
11016 11303
11017@menu 11304@menu
11018* HTML Export commands:: How to invoke HTML export 11305* HTML Export commands:: Invoking HTML export
11019* HTML doctypes:: Org can export to various (X)HTML flavors 11306* HTML Specific export settings:: Settings for HTML export
11020* HTML preamble and postamble:: How to insert a preamble and a postamble 11307* HTML doctypes:: Exporting various (X)HTML flavors
11021* Quoting HTML tags:: Using direct HTML in Org mode 11308* HTML preamble and postamble:: Inserting preamble and postamble
11022* Links in HTML export:: How links will be interpreted and formatted 11309* Quoting HTML tags:: Using direct HTML in Org files
11023* Tables in HTML export:: How to modify the formatting of tables 11310* Links in HTML export:: Interpreting and formatting links
11024* Images in HTML export:: How to insert figures into HTML output 11311* Tables in HTML export:: Formatting and modifying tables
11025* Math formatting in HTML export:: Beautiful math also on the web 11312* Images in HTML export:: Inserting figures with HTML output
11026* Text areas in HTML export:: An alternative way to show an example 11313* Math formatting in HTML export:: Handling math equations
11027* CSS support:: Changing the appearance of the output 11314* Text areas in HTML export:: Showing an alternate approach, an example
11028* JavaScript support:: Info and Folding in a web browser 11315* CSS support:: Styling HTML output
11316* JavaScript support:: Folding scripting in the web browser
11029@end menu 11317@end menu
11030 11318
11031@node HTML Export commands, HTML doctypes, HTML export, HTML export 11319
11320@node HTML Export commands
11032@subsection HTML export commands 11321@subsection HTML export commands
11033 11322
11034@table @kbd 11323@table @kbd
11035@orgcmd{C-c C-e h h,org-html-export-to-html} 11324@orgcmd{C-c C-e h h,org-html-export-to-html}
11036Export as an HTML file. For an Org file @file{myfile.org}, 11325Export as HTML file with a @file{.html} extension. For @file{myfile.org},
11037the HTML file will be @file{myfile.html}. The file will be overwritten 11326Org exports to @file{myfile.html}, overwriting without warning. @kbd{C-c C-e
11038without warning. 11327h o} Exports to HTML and opens it in a web browser.
11039@kbd{C-c C-e h o} 11328
11040Export as an HTML file and immediately open it with a browser.
11041@orgcmd{C-c C-e h H,org-html-export-as-html} 11329@orgcmd{C-c C-e h H,org-html-export-as-html}
11042Export to a temporary buffer. Do not create a file. 11330Exports to a temporary buffer. Does not create a file.
11043@end table 11331@end table
11044 11332
11045@c FIXME Exporting sublevels 11333@node HTML Specific export settings
11046@c @cindex headline levels, for exporting 11334@subsection HTML Specific export settings
11047@c In the exported version, the first 3 outline levels will become headlines, 11335HTML export has a number of keywords, similar to the general options settings
11048@c defining a general document structure. Additional levels will be exported as 11336described in @ref{Export settings}.
11049@c itemized lists. If you want that transition to occur at a different level,
11050@c specify it with a numeric prefix argument. For example,
11051 11337
11052@c @example 11338@table @samp
11053@c @kbd{C-2 C-c C-e b} 11339@item DESCRIPTION
11054@c @end example 11340@cindex #+DESCRIPTION (HTML)
11341This is the document's description, which the HTML exporter inserts it as a
11342HTML meta tag in the HTML file. For long descriptions, use multiple
11343@code{#+DESCRIPTION} lines. The exporter takes care of wrapping the lines
11344properly.
11345
11346@item HTML_DOCTYPE
11347@cindex #+HTML_DOCTYPE
11348@vindex org-html-doctype
11349Specify the document type, for example: HTML5 (@code{org-html-doctype}).
11055 11350
11056@c @noindent 11351@item HTML_CONTAINER
11057@c creates two levels of headings and does the rest as items. 11352@cindex #+HTML_CONTAINER
11353@vindex org-html-container-element
11354Specify the HTML container, such as @samp{div}, for wrapping sections and
11355elements (@code{org-html-container-element}).
11356
11357@item HTML_LINK_HOME
11358@cindex #+HTML_LINK_HOME
11359@vindex org-html-link-home
11360The URL for home link (@code{org-html-link-home}).
11361
11362@item HTML_LINK_UP
11363@cindex #+HTML_LINK_UP
11364@vindex org-html-link-up
11365The URL for the up link of exported HTML pages (@code{org-html-link-up}).
11366
11367@item HTML_MATHJAX
11368@cindex #+HTML_MATHJAX
11369@vindex org-html-mathjax-options
11370Options for MathJax (@code{org-html-mathjax-options}). MathJax is used to
11371typeset @LaTeX{} math in HTML documents. @xref{Math formatting in HTML
11372export}, for an example.
11373
11374@item HTML_HEAD
11375@cindex #+HTML_HEAD
11376@vindex org-html-head
11377Arbitrary lines for appending to the HTML document's head
11378(@code{org-html-head}).
11058 11379
11059@node HTML doctypes, HTML preamble and postamble, HTML Export commands, HTML export 11380@item HTML_HEAD_EXTRA
11381@cindex #+HTML_HEAD_EXTRA
11382@vindex org-html-head-extra
11383More arbitrary lines for appending to the HTML document's head
11384(@code{org-html-head-extra}).
11385
11386@item KEYWORDS
11387@cindex #+KEYWORDS (HTML)
11388Keywords to describe the document's content. HTML exporter inserts these
11389keywords as HTML meta tags. For long keywords, use multiple
11390@code{#+KEYWORDS} lines.
11391
11392@item LATEX_HEADER
11393@cindex #+LATEX_HEADER (HTML)
11394Arbitrary lines for appending to the preamble; HTML exporter appends when
11395transcoding @LaTeX{} fragments to images (@pxref{Math formatting in HTML
11396export}).
11397
11398@item SUBTITLE
11399@cindex #+SUBTILE (HTML)
11400The document's subtitle. HTML exporter formats subtitle if document type is
11401@samp{HTML5} and the CSS has a @samp{subtitle} class.
11402@end table
11403
11404Some of these keywords are explained in more detail in the following sections
11405of the manual.
11406
11407@node HTML doctypes
11060@subsection HTML doctypes 11408@subsection HTML doctypes
11061@vindex org-html-doctype
11062@vindex org-html-doctype-alist
11063 11409
11064Org can export to various (X)HTML flavors. 11410Org can export to various (X)HTML flavors.
11065 11411
11066Setting the variable @code{org-html-doctype} allows you to export to different 11412@vindex org-html-doctype
11067(X)HTML variants. The exported HTML will be adjusted according to the syntax 11413@vindex org-html-doctype-alist
11068requirements of that variant. You can either set this variable to a doctype 11414Set the @code{org-html-doctype} variable for different (X)HTML variants.
11069string directly, in which case the exporter will try to adjust the syntax 11415Depending on the variant, the HTML exporter adjusts the syntax of HTML
11070automatically, or you can use a ready-made doctype. The ready-made options 11416conversion accordingly. Org includes the following ready-made variants:
11071are:
11072 11417
11073@itemize 11418@itemize
11074@item 11419@item
@@ -11091,23 +11436,21 @@ are:
11091``xhtml5'' 11436``xhtml5''
11092@end itemize 11437@end itemize
11093 11438
11094See the variable @code{org-html-doctype-alist} for details. The default is 11439@noindent See the variable @code{org-html-doctype-alist} for details.
11095``xhtml-strict''. 11440The default is ``xhtml-strict''.
11096 11441
11097@subsubheading Fancy HTML5 export
11098@vindex org-html-html5-fancy 11442@vindex org-html-html5-fancy
11099@vindex org-html-html5-elements 11443@cindex HTML5, export new elements
11100 11444Org's HTML exporter does not by default enable new block elements introduced
11101HTML5 introduces several new element types. By default, Org will not make 11445with the HTML5 standard. To enable them, set @code{org-html-html5-fancy} to
11102use of these element types, but you can set @code{org-html-html5-fancy} to 11446non-@code{nil}. Or use an @code{OPTIONS} line in the file to set
11103@code{t} (or set @code{html5-fancy} item in an @code{OPTIONS} line), to 11447@code{html5-fancy}. HTML5 documents can now have arbitrary #+BEGIN and #+END
11104enable a few new block-level elements. These are created using arbitrary 11448blocks. For example:
11105#+BEGIN and #+END blocks. For instance:
11106 11449
11107@example 11450@example
11108#+BEGIN_ASIDE 11451#+BEGIN_aside
11109Lorem ipsum 11452Lorem ipsum
11110#+END_ASIDE 11453#+END_aside
11111@end example 11454@end example
11112 11455
11113Will export to: 11456Will export to:
@@ -11122,14 +11465,14 @@ While this:
11122 11465
11123@example 11466@example
11124#+ATTR_HTML: :controls controls :width 350 11467#+ATTR_HTML: :controls controls :width 350
11125#+BEGIN_VIDEO 11468#+BEGIN_video
11126#+HTML: <source src="movie.mp4" type="video/mp4"> 11469#+HTML: <source src="movie.mp4" type="video/mp4">
11127#+HTML: <source src="movie.ogg" type="video/ogg"> 11470#+HTML: <source src="movie.ogg" type="video/ogg">
11128Your browser does not support the video tag. 11471Your browser does not support the video tag.
11129#+END_VIDEO 11472#+END_video
11130@end example 11473@end example
11131 11474
11132Becomes: 11475Exports to:
11133 11476
11134@example 11477@example
11135<video controls="controls" width="350"> 11478<video controls="controls" width="350">
@@ -11139,15 +11482,17 @@ Becomes:
11139</video> 11482</video>
11140@end example 11483@end example
11141 11484
11142Special blocks that do not correspond to HTML5 elements (see 11485@vindex org-html-html5-elements
11143@code{org-html-html5-elements}) will revert to the usual behavior, i.e., 11486When special blocks do not have a corresponding HTML5 element, the HTML
11144@code{#+BEGIN_LEDERHOSEN} will still export to @samp{<div class="lederhosen">}. 11487exporter reverts to standard translation (see
11488@code{org-html-html5-elements}). For example, @code{#+BEGIN_lederhosen}
11489exports to @samp{<div class="lederhosen">}.
11145 11490
11146Headlines cannot appear within special blocks. To wrap a headline and its 11491Special blocks cannot have headlines. For the HTML exporter to wrap the
11147contents in e.g., @samp{<section>} or @samp{<article>} tags, set the 11492headline and its contents in @samp{<section>} or @samp{<article>} tags, set
11148@code{HTML_CONTAINER} property on the headline itself. 11493the @code{HTML_CONTAINER} property for the headline.
11149 11494
11150@node HTML preamble and postamble, Quoting HTML tags, HTML doctypes, HTML export 11495@node HTML preamble and postamble
11151@subsection HTML preamble and postamble 11496@subsection HTML preamble and postamble
11152@vindex org-html-preamble 11497@vindex org-html-preamble
11153@vindex org-html-postamble 11498@vindex org-html-postamble
@@ -11157,69 +11502,77 @@ contents in e.g., @samp{<section>} or @samp{<article>} tags, set the
11157@vindex org-export-creator-string 11502@vindex org-export-creator-string
11158@vindex org-export-time-stamp-file 11503@vindex org-export-time-stamp-file
11159 11504
11160The HTML exporter lets you define a preamble and a postamble. 11505The HTML exporter has delineations for preamble and postamble. The default
11161 11506value for @code{org-html-preamble} is @code{t}, which makes the HTML exporter
11162The default value for @code{org-html-preamble} is @code{t}, which means 11507insert the preamble. See the variable @code{org-html-preamble-format} for
11163that the preamble is inserted depending on the relevant format string in 11508the format string.
11164@code{org-html-preamble-format}. 11509
11165 11510Set @code{org-html-preamble} to a string to override the default format
11166Setting @code{org-html-preamble} to a string will override the default format 11511string. If the string is a function, the HTML exporter expects the function
11167string. If you set it to a function, it will insert the output of the 11512to return a string upon execution. The HTML exporter inserts this string in
11168function, which must be a string. Setting to @code{nil} will not insert any 11513the preamble. The HTML exporter will not insert a preamble if
11169preamble. 11514@code{org-html-preamble} is set @code{nil}.
11170 11515
11171The default value for @code{org-html-postamble} is @code{'auto}, which means 11516The default value for @code{org-html-postamble} is @code{auto}, which makes
11172that the HTML exporter will look for information about the author, the email, 11517the HTML exporter build a postamble from looking up author's name, email
11173the creator and the date, and build the postamble from these values. Setting 11518address, creator's name, and date. Set @code{org-html-postamble} to @code{t}
11174@code{org-html-postamble} to @code{t} will insert the postamble from the 11519to insert the postamble in the format specified in the
11175relevant format string found in @code{org-html-postamble-format}. Setting it 11520@code{org-html-postamble-format} variable. The HTML exporter will not insert
11176to @code{nil} will not insert any postamble. 11521a postamble if @code{org-html-postamble} is set to @code{nil}.
11177 11522
11178@node Quoting HTML tags, Links in HTML export, HTML preamble and postamble, HTML export 11523@node Quoting HTML tags
11179@subsection Quoting HTML tags 11524@subsection Quoting HTML tags
11180 11525
11181Plain @samp{<} and @samp{>} are always transformed to @samp{&lt;} and 11526The HTML export back-end transforms @samp{<} and @samp{>} to @samp{&lt;} and
11182@samp{&gt;} in HTML export. If you want to include raw HTML code, which 11527@samp{&gt;}. To include raw HTML code in the Org file so the HTML export
11183should only appear in HTML export, mark it with @samp{@@@@html:} as in 11528back-end can insert that HTML code in the output, use this inline syntax:
11184@samp{@@@@html:<b>@@@@bold text@@@@html:</b>@@@@}. For more extensive HTML 11529@samp{@@@@html:}. For example: @samp{@@@@html:<b>@@@@bold
11185that should be copied verbatim to the exported file use either 11530text@@@@html:</b>@@@@}. For larger raw HTML code blocks, use these HTML
11531export code blocks:
11186 11532
11187@cindex #+HTML 11533@cindex #+HTML
11188@cindex #+BEGIN_HTML 11534@cindex #+BEGIN_EXPORT html
11189@example 11535@example
11190#+HTML: Literal HTML code for export 11536#+HTML: Literal HTML code for export
11191@end example 11537@end example
11192 11538
11193@noindent or 11539@noindent or
11194@cindex #+BEGIN_HTML 11540@cindex #+BEGIN_EXPORT html
11195 11541
11196@example 11542@example
11197#+BEGIN_HTML 11543#+BEGIN_EXPORT html
11198All lines between these markers are exported literally 11544All lines between these markers are exported literally
11199#+END_HTML 11545#+END_EXPORT
11200@end example 11546@end example
11201 11547
11202 11548
11203@node Links in HTML export, Tables in HTML export, Quoting HTML tags, HTML export 11549@node Links in HTML export
11204@subsection Links in HTML export 11550@subsection Links in HTML export
11205 11551
11206@cindex links, in HTML export 11552@cindex links, in HTML export
11207@cindex internal links, in HTML export 11553@cindex internal links, in HTML export
11208@cindex external links, in HTML export 11554@cindex external links, in HTML export
11209Internal links (@pxref{Internal links}) will continue to work in HTML@. This 11555@vindex org-html-link-org-files-as-html
11210includes automatic links created by radio targets (@pxref{Radio 11556The HTML export back-end transforms Org's internal links (@pxref{Internal
11211targets}). Links to external files will still work if the target file is on 11557links}) to equivalent HTML links in the output. The back-end similarly
11212the same @i{relative} path as the published Org file. Links to other 11558handles Org's automatic links created by radio targets (@pxref{Radio
11213@file{.org} files will be translated into HTML links under the assumption 11559targets}) similarly. For Org links to external files, the back-end
11214that an HTML version also exists of the linked file, at the same relative 11560transforms the links to @emph{relative} paths.
11215path. @samp{id:} links can then be used to jump to specific entries across 11561
11216files. For information related to linking files while publishing them to a 11562For Org links to other @file{.org} files, the back-end automatically changes
11217publishing directory see @ref{Publishing links}. 11563the file extension to @file{.html} and makes file paths relative. If the
11218 11564@file{.org} files have an equivalent @file{.html} version at the same
11219If you want to specify attributes for links, you can do so using a special 11565location, then the converted links should work without any further manual
11220@code{#+ATTR_HTML} line to define attributes that will be added to the 11566intervention. However, to disable this automatic path translation, set
11221@code{<a>} or @code{<img>} tags. Here is an example that sets @code{title} 11567@code{org-html-link-org-files-as-html} to @code{nil}. When disabled, the
11222and @code{style} attributes for a link: 11568HTML export back-end substitutes the @samp{id:}-based links in the HTML
11569output. For more about linking files when publishing to a directory,
11570@pxref{Publishing links}.
11571
11572Org files can also have special directives to the HTML export back-end. For
11573example, by using @code{#+ATTR_HTML} lines to specify new format attributes
11574to @code{<a>} or @code{<img>} tags. This example shows changing the link's
11575@code{title} and @code{style}:
11223 11576
11224@cindex #+ATTR_HTML 11577@cindex #+ATTR_HTML
11225@example 11578@example
@@ -11227,15 +11580,15 @@ and @code{style} attributes for a link:
11227[[http://orgmode.org]] 11580[[http://orgmode.org]]
11228@end example 11581@end example
11229 11582
11230@node Tables in HTML export, Images in HTML export, Links in HTML export, HTML export 11583@node Tables in HTML export
11231@subsection Tables 11584@subsection Tables in HTML export
11232@cindex tables, in HTML 11585@cindex tables, in HTML
11233@vindex org-html-table-default-attributes 11586@vindex org-html-table-default-attributes
11234 11587
11235Org mode tables are exported to HTML using the table attributes defined in 11588The HTML export back-end uses @code{org-html-table-default-attributes} when
11236@code{org-html-table-default-attributes}. The default setting makes tables 11589exporting Org tables to HTML. By default, the exporter does not draw frames
11237without cell borders and frame. If you would like to change this for 11590and cell borders. To change for this for a table, use the following lines
11238individual tables, place something like the following before the table: 11591before the table in the Org file:
11239 11592
11240@cindex #+CAPTION 11593@cindex #+CAPTION
11241@cindex #+ATTR_HTML 11594@cindex #+ATTR_HTML
@@ -11244,36 +11597,72 @@ individual tables, place something like the following before the table:
11244#+ATTR_HTML: :border 2 :rules all :frame border 11597#+ATTR_HTML: :border 2 :rules all :frame border
11245@end example 11598@end example
11246 11599
11600The HTML export back-end preserves column groupings in Org tables
11601(@pxref{Column groups}) when exporting to HTML.
11602
11603Additional options for customizing tables for HTML export.
11604
11605@table @code
11606@vindex org-html-table-align-individual-fields
11607@item org-html-table-align-individual-fields
11608Non-@code{nil} attaches style attributes for alignment to each table field.
11609
11610@vindex org-html-table-caption-above
11611@item org-html-table-caption-above
11612Non-@code{nil} places caption string at the beginning of the table.
11613
11614@vindex org-html-table-data-tags
11615@item org-html-table-data-tags
11616Opening and ending tags for table data fields.
11617
11618@vindex org-html-table-default-attributes
11619@item org-html-table-default-attributes
11620Default attributes and values for table tags.
11621
11622@vindex org-html-table-header-tags
11623@item org-html-table-header-tags
11624Opening and ending tags for table's header fields.
11625
11247@vindex org-html-table-row-tags 11626@vindex org-html-table-row-tags
11248You can also modify the default tags used for each row by setting 11627@item org-html-table-row-tags
11249@code{org-html-table-row-tags}. See the docstring for an example on 11628Opening and ending tags for table rows.
11250how to use this option. 11629
11630@vindex org-html-table-use-header-tags-for-first-column
11631@item org-html-table-use-header-tags-for-first-column
11632Non-@code{nil} formats column one in tables with header tags.
11633@end table
11251 11634
11252@node Images in HTML export, Math formatting in HTML export, Tables in HTML export, HTML export 11635@node Images in HTML export
11253@subsection Images in HTML export 11636@subsection Images in HTML export
11254 11637
11255@cindex images, inline in HTML 11638@cindex images, inline in HTML
11256@cindex inlining images in HTML 11639@cindex inlining images in HTML
11257@vindex org-html-inline-images 11640@vindex org-html-inline-images
11258HTML export can inline images given as links in the Org file, and 11641
11259it can make an image the clickable part of a link. By 11642The HTML export back-end has features to convert Org image links to HTML
11260default@footnote{But see the variable 11643inline images and HTML clickable image links.
11261@code{org-html-inline-images}.}, images are inlined if a link does 11644
11262not have a description. So @samp{[[file:myimg.jpg]]} will be inlined, 11645When the link in the Org file has no description, the HTML export back-end by
11263while @samp{[[file:myimg.jpg][the image]]} will just produce a link 11646default in-lines that image. For example: @samp{[[file:myimg.jpg]]} is
11264@samp{the image} that points to the image. If the description part 11647in-lined, while @samp{[[file:myimg.jpg][the image]]} links to the text,
11265itself is a @code{file:} link or a @code{http:} URL pointing to an 11648@samp{the image}.
11266image, this image will be inlined and activated so that clicking on the 11649
11267image will activate the link. For example, to include a thumbnail that 11650For more details, see the variable @code{org-html-inline-images}.
11268will link to a high resolution version of the image, you could use: 11651
11652On the other hand, if the description part of the Org link is itself another
11653link, such as @code{file:} or @code{http:} URL pointing to an image, the HTML
11654export back-end in-lines this image and links to the main image. This Org
11655syntax enables the back-end to link low-resolution thumbnail to the
11656high-resolution version of the image, as shown in this example:
11269 11657
11270@example 11658@example
11271[[file:highres.jpg][file:thumb.jpg]] 11659[[file:highres.jpg][file:thumb.jpg]]
11272@end example 11660@end example
11273 11661
11274If you need to add attributes to an inlined image, use a @code{#+ATTR_HTML}. 11662To change attributes of in-lined images, use @code{#+ATTR_HTML} lines in the
11275In the example below we specify the @code{alt} and @code{title} attributes to 11663Org file. This example shows realignment to right, and adds @code{alt} and
11276support text viewers and accessibility, and align it to the right. 11664@code{title} attributes in support of text viewers and modern web accessibility
11665standards.
11277 11666
11278@cindex #+CAPTION 11667@cindex #+CAPTION
11279@cindex #+ATTR_HTML 11668@cindex #+ATTR_HTML
@@ -11284,63 +11673,72 @@ support text viewers and accessibility, and align it to the right.
11284@end example 11673@end example
11285 11674
11286@noindent 11675@noindent
11287You could use @code{http} addresses just as well. 11676The HTML export back-end copies the @code{http} links from the Org file as
11677is.
11288 11678
11289@node Math formatting in HTML export, Text areas in HTML export, Images in HTML export, HTML export 11679@node Math formatting in HTML export
11290@subsection Math formatting in HTML export 11680@subsection Math formatting in HTML export
11291@cindex MathJax 11681@cindex MathJax
11292@cindex dvipng 11682@cindex dvipng
11683@cindex dvisvgm
11293@cindex imagemagick 11684@cindex imagemagick
11294 11685
11295@LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two 11686@LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two
11296different ways on HTML pages. The default is to use the 11687different ways on HTML pages. The default is to use
11297@uref{http://www.mathjax.org, MathJax system} which should work out of the 11688@uref{http://www.mathjax.org, MathJax} which should work out of the box with
11298box with Org mode installation because @uref{http://orgmode.org} serves 11689Org@footnote{By default Org loads MathJax from @uref{https://cdnjs.com, cdnjs.com} as
11299@file{MathJax} for Org mode users for small applications and for testing 11690recommended by @uref{http://www.mathjax.org, MathJax}.}. Some MathJax display
11300purposes. @b{If you plan to use this regularly or on pages with significant 11691options can be configured via @code{org-html-mathjax-options}, or in the
11301page views, you should install@footnote{Installation instructions can be 11692buffer. For example, with the following settings,
11302found on the MathJax website, see 11693@smallexample
11303@uref{http://www.mathjax.org/resources/docs/?installation.html}.} MathJax on 11694#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
11304your own server in order to limit the load of our server.} To configure 11695@end smallexample
11305@file{MathJax}, use the variable @code{org-html-mathjax-options} or 11696equation labels will be displayed on the left marign and equations will be
11306insert something like the following into the buffer: 11697five ems from the left margin.
11307
11308@example
11309#+HTML_MATHJAX: align:"left" mathml:t path:"/MathJax/MathJax.js"
11310@end example
11311 11698
11312@noindent See the docstring of the variable 11699@noindent See the docstring of
11313@code{org-html-mathjax-options} for the meaning of the parameters in 11700@code{org-html-mathjax-options} for all supported variables. The MathJax
11314this line. 11701template can be configure via @code{org-html-mathjax-template}.
11315 11702
11316If you prefer, you can also request that @LaTeX{} fragments are processed 11703If you prefer, you can also request that @LaTeX{} fragments are processed
11317into small images that will be inserted into the browser page. Before the 11704into small images that will be inserted into the browser page. Before the
11318availability of MathJax, this was the default method for Org files. This 11705availability of MathJax, this was the default method for Org files. This
11319method requires that the @file{dvipng} program or @file{imagemagick} suite is 11706method requires that the @file{dvipng} program, @file{dvisvgm} or
11320available on your system. You can still get this processing with 11707@file{imagemagick} suite is available on your system. You can still get
11708this processing with
11321 11709
11322@example 11710@example
11323#+OPTIONS: tex:dvipng 11711#+OPTIONS: tex:dvipng
11324@end example 11712@end example
11325 11713
11714@example
11715#+OPTIONS: tex:dvisvgm
11716@end example
11717
11326or: 11718or:
11327 11719
11328@example 11720@example
11329#+OPTIONS: tex:imagemagick 11721#+OPTIONS: tex:imagemagick
11330@end example 11722@end example
11331 11723
11332@node Text areas in HTML export, CSS support, Math formatting in HTML export, HTML export 11724@node Text areas in HTML export
11333@subsection Text areas in HTML export 11725@subsection Text areas in HTML export
11334 11726
11335@cindex text areas, in HTML 11727@cindex text areas, in HTML
11336An alternative way to publish literal code examples in HTML is to use text 11728Before Org mode's Babel, one popular approach to publishing code in HTML was
11337areas, where the example can even be edited before pasting it into an 11729by using @code{:textarea}. The advantage of this approach was that copying
11338application. It is triggered by @code{:textarea} attribute at an 11730and pasting was built into browsers with simple JavaScript commands. Even
11339@code{example} or @code{src} block. 11731editing before pasting was made simple.
11732
11733The HTML export back-end can create such text areas. It requires an
11734@code{#+ATTR_HTML:} line as shown in the example below with the
11735@code{:textarea} option. This must be followed by either an
11736@code{example} or a @code{src} code block. Other Org block types will not
11737honor the @code{:textarea} option.
11340 11738
11341You may also use @code{:height} and @code{:width} attributes to specify the 11739By default, the HTML export back-end creates a text area 80 characters wide
11342height and width of the text area, which default to the number of lines in 11740and height just enough to fit the content. Override these defaults with
11343the example, and 80, respectively. For example 11741@code{:width} and @code{:height} options on the @code{#+ATTR_HTML:} line.
11344 11742
11345@example 11743@example
11346#+ATTR_HTML: :textarea t :width 40 11744#+ATTR_HTML: :textarea t :width 40
@@ -11352,7 +11750,7 @@ the example, and 80, respectively. For example
11352@end example 11750@end example
11353 11751
11354 11752
11355@node CSS support, JavaScript support, Text areas in HTML export, HTML export 11753@node CSS support
11356@subsection CSS support 11754@subsection CSS support
11357@cindex CSS, for HTML export 11755@cindex CSS, for HTML export
11358@cindex HTML export, CSS 11756@cindex HTML export, CSS
@@ -11371,6 +11769,7 @@ p.author @r{author information, including email}
11371p.date @r{publishing date} 11769p.date @r{publishing date}
11372p.creator @r{creator info, about org mode version} 11770p.creator @r{creator info, about org mode version}
11373.title @r{document title} 11771.title @r{document title}
11772.subtitle @r{document subtitle}
11374.todo @r{TODO keywords, all not-done states} 11773.todo @r{TODO keywords, all not-done states}
11375.done @r{the DONE keywords, all states that count as done} 11774.done @r{the DONE keywords, all states that count as done}
11376.WAITING @r{each TODO keyword also uses a class named after itself} 11775.WAITING @r{each TODO keyword also uses a class named after itself}
@@ -11388,7 +11787,7 @@ div.outline-text-N @r{extra div for text at outline level N}
11388.figure-number @r{label like "Figure 1:"} 11787.figure-number @r{label like "Figure 1:"}
11389.table-number @r{label like "Table 1:"} 11788.table-number @r{label like "Table 1:"}
11390.listing-number @r{label like "Listing 1:"} 11789.listing-number @r{label like "Listing 1:"}
11391div.figure @r{how to format an inlined image} 11790div.figure @r{how to format an in-lined image}
11392pre.src @r{formatted source code} 11791pre.src @r{formatted source code}
11393pre.example @r{normal example} 11792pre.example @r{normal example}
11394p.verse @r{verse paragraph} 11793p.verse @r{verse paragraph}
@@ -11396,6 +11795,7 @@ div.footnotes @r{footnote section headline}
11396p.footnote @r{footnote definition paragraph, containing a footnote} 11795p.footnote @r{footnote definition paragraph, containing a footnote}
11397.footref @r{a footnote reference number (always a <sup>)} 11796.footref @r{a footnote reference number (always a <sup>)}
11398.footnum @r{footnote number in footnote definition (always <sup>)} 11797.footnum @r{footnote number in footnote definition (always <sup>)}
11798.org-svg @r{default class for a linked @file{.svg} image}
11399@end example 11799@end example
11400 11800
11401@vindex org-html-style-default 11801@vindex org-html-style-default
@@ -11403,15 +11803,10 @@ p.footnote @r{footnote definition paragraph, containing a footnote}
11403@vindex org-html-head 11803@vindex org-html-head
11404@vindex org-html-head-extra 11804@vindex org-html-head-extra
11405@cindex #+HTML_INCLUDE_STYLE 11805@cindex #+HTML_INCLUDE_STYLE
11406Each exported file contains a compact default style that defines these 11806The HTML export back-end includes a compact default style in each exported
11407classes in a basic way@footnote{This style is defined in the constant 11807HTML file. To override the default style with another style, use these
11408@code{org-html-style-default}, which you should not modify. To turn 11808keywords in the Org file. They will replace the global defaults the HTML
11409inclusion of these defaults off, customize 11809exporter uses.
11410@code{org-html-head-include-default-style} or set @code{html-style} to
11411@code{nil} in an @code{OPTIONS} line.}. You may overwrite these settings, or
11412add to them by using the variables @code{org-html-head} and
11413@code{org-html-head-extra}. You can override the global values of these
11414variables for each file by using these keywords:
11415 11810
11416@cindex #+HTML_HEAD 11811@cindex #+HTML_HEAD
11417@cindex #+HTML_HEAD_EXTRA 11812@cindex #+HTML_HEAD_EXTRA
@@ -11420,38 +11815,49 @@ variables for each file by using these keywords:
11420#+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" /> 11815#+HTML_HEAD_EXTRA: <link rel="alternate stylesheet" type="text/css" href="style2.css" />
11421@end example 11816@end example
11422 11817
11818To just turn off the default style, customize
11819@code{org-html-head-include-default-style} variable, or use this option line in
11820the Org file.
11821
11822@example
11823#+OPTIONS: html-style:nil
11824@end example
11825
11423@noindent 11826@noindent
11424For longer style definitions, you can use several such lines. You could also 11827For longer style definitions, either use several @code{#+HTML_HEAD} and
11425directly write a @code{<style>} @code{</style>} section in this way, without 11828@code{#+HTML_HEAD_EXTRA} lines, or use @code{<style>} @code{</style>} blocks
11426referring to an external file. 11829around them. Both of these approaches can avoid referring to an external
11830file.
11427 11831
11428In order to add styles to a subtree, use the @code{:HTML_CONTAINER_CLASS:} 11832In order to add styles to a sub-tree, use the @code{:HTML_CONTAINER_CLASS:}
11429property to assign a class to the tree. In order to specify CSS styles for a 11833property to assign a class to the tree. In order to specify CSS styles for a
11430particular headline, you can use the id specified in a @code{:CUSTOM_ID:} 11834particular headline, you can use the id specified in a @code{:CUSTOM_ID:}
11431property. 11835property.
11432 11836
11837Never change the @code{org-html-style-default} constant. Instead use other
11838simpler ways of customizing as described above.
11839
11840
11433@c FIXME: More about header and footer styles 11841@c FIXME: More about header and footer styles
11434@c FIXME: Talk about links and targets. 11842@c FIXME: Talk about links and targets.
11435 11843
11436@node JavaScript support, , CSS support, HTML export 11844@node JavaScript support
11437@subsection JavaScript supported display of web pages 11845@subsection JavaScript supported display of web pages
11438 11846
11439@cindex Rose, Sebastian 11847@cindex Rose, Sebastian
11440Sebastian Rose has written a JavaScript program especially designed to 11848Sebastian Rose has written a JavaScript program especially designed to
11441enhance the web viewing experience of HTML files created with Org. This 11849enhance the web viewing experience of HTML files created with Org. This
11442program allows you to view large files in two different ways. The first one 11850program enhances large files in two different ways of viewing. One is an
11443is an @emph{Info}-like mode where each section is displayed separately and 11851@emph{Info}-like mode where each section is displayed separately and
11444navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys 11852navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys
11445as well, press @kbd{?} for an overview of the available keys). The second 11853as well, press @kbd{?} for an overview of the available keys). The second
11446view type is a @emph{folding} view much like Org provides inside Emacs. The 11854one has a @emph{folding} view, much like Org provides inside Emacs. The
11447script is available at @url{http://orgmode.org/org-info.js} and you can find 11855script is available at @url{http://orgmode.org/org-info.js} and the
11448the documentation for it at @url{http://orgmode.org/worg/code/org-info-js/}. 11856documentation at @url{http://orgmode.org/worg/code/org-info-js/}. The script
11449We host the script at our site, but if you use it a lot, you might not want 11857is hosted on @url{http://orgmode.org}, but for reliability, prefer installing
11450to be dependent on @url{http://orgmode.org} and prefer to install a local 11858it on your own web server.
11451copy on your own web server.
11452 11859
11453All it then takes to use this program is adding a single line to the Org 11860To use this program, just add this line to the Org file:
11454file:
11455 11861
11456@cindex #+INFOJS_OPT 11862@cindex #+INFOJS_OPT
11457@example 11863@example
@@ -11459,12 +11865,12 @@ file:
11459@end example 11865@end example
11460 11866
11461@noindent 11867@noindent
11462If this line is found, the HTML header will automatically contain the code 11868The HTML header now has the code needed to automatically invoke the script.
11463needed to invoke the script. Using the line above, you can set the following 11869For setting options, use the syntax from the above line for options described
11464viewing options: 11870below:
11465 11871
11466@example 11872@example
11467path: @r{The path to the script. The default is to grab the script from} 11873path: @r{The path to the script. The default grabs the script from}
11468 @r{@url{http://orgmode.org/org-info.js}, but you might want to have} 11874 @r{@url{http://orgmode.org/org-info.js}, but you might want to have}
11469 @r{a local copy and use a path like @samp{../scripts/org-info.js}.} 11875 @r{a local copy and use a path like @samp{../scripts/org-info.js}.}
11470view: @r{Initial view when the website is first shown. Possible values are:} 11876view: @r{Initial view when the website is first shown. Possible values are:}
@@ -11494,105 +11900,204 @@ buttons: @r{Should view-toggle buttons be everywhere? When @code{nil} (the}
11494@vindex org-html-infojs-options 11900@vindex org-html-infojs-options
11495@vindex org-html-use-infojs 11901@vindex org-html-use-infojs
11496You can choose default values for these options by customizing the variable 11902You can choose default values for these options by customizing the variable
11497@code{org-html-infojs-options}. If you always want to apply the script to your 11903@code{org-html-infojs-options}. If you want the script to always apply to
11498pages, configure the variable @code{org-html-use-infojs}. 11904your pages, configure the variable @code{org-html-use-infojs}.
11499 11905
11500@node @LaTeX{} and PDF export, Markdown export, HTML export, Exporting 11906@node @LaTeX{} export
11501@section @LaTeX{} and PDF export 11907@section @LaTeX{} export
11502@cindex @LaTeX{} export 11908@cindex @LaTeX{} export
11503@cindex PDF export 11909@cindex PDF export
11504 11910
11505@LaTeX{} export can produce an arbitrarily complex LaTeX document of any 11911The @LaTeX{} export back-end can handle complex documents, incorporate
11506standard or custom document class. With further processing@footnote{The 11912standard or custom @LaTeX{} document classes, generate documents using
11507default @LaTeX{} output is designed for processing with @code{pdftex} or 11913alternate @LaTeX{} engines, and produce fully linked PDF files with indexes,
11508@LaTeX{}. It includes packages that are not compatible with @code{xetex} and 11914bibliographies, and tables of contents, destined for interactive online
11509possibly @code{luatex}. The @LaTeX{} exporter can be configured to support 11915viewing or high-quality print publication.
11510alternative TeX engines, see the options 11916
11511@code{org-latex-default-packages-alist} and @code{org-latex-packages-alist}.}, 11917While the details are covered in-depth in this section, here are some quick
11512which the @LaTeX{} exporter is able to control, this back-end is able to 11918references to variables for the impatient: for engines, see
11513produce PDF output. Because the @LaTeX{} exporter can be configured to use 11919@code{org-latex-compiler}; for build sequences, see
11514the @code{hyperref} package, the default setup produces fully-linked PDF 11920@code{org-latex-pdf-process}; for packages, see
11515output. 11921@code{org-latex-default-packages-alist} and @code{org-latex-packages-alist}.
11516 11922
11517As in @LaTeX{}, blank lines are meaningful for this back-end: a paragraph 11923An important note about the @LaTeX{} export back-end: it is sensitive to
11518will not be started if two contiguous syntactical elements are not separated 11924blank lines in the Org document. That's because @LaTeX{} itself depends on
11519by an empty line. 11925blank lines to tell apart syntactical elements, such as paragraphs.
11520
11521This back-end also offers enhanced support for footnotes. Thus, it handles
11522nested footnotes, footnotes in tables and footnotes in a list item's
11523description.
11524 11926
11525@menu 11927@menu
11526* @LaTeX{} export commands:: How to export to LaTeX and PDF 11928* @LaTeX{} export commands:: For producing @LaTeX{} and PDF documents.
11527* Header and sectioning:: Setting up the export file structure 11929* @LaTeX{} specific export settings:: Unique to this @LaTeX{} back-end.
11528* Quoting @LaTeX{} code:: Incorporating literal @LaTeX{} code 11930* @LaTeX{} header and sectioning:: For file structure.
11529* @LaTeX{} specific attributes:: Controlling @LaTeX{} output 11931* Quoting @LaTeX{} code:: Directly in the Org document.
11932* Tables in @LaTeX{} export:: Attributes specific to tables.
11933* Images in @LaTeX{} export:: Attributes specific to images.
11934* Plain lists in @LaTeX{} export:: Attributes specific to lists.
11935* Source blocks in @LaTeX{} export:: Attributes specific to source code blocks.
11936* Example blocks in @LaTeX{} export:: Attributes specific to example blocks.
11937* Special blocks in @LaTeX{} export:: Attributes specific to special blocks.
11938* Horizontal rules in @LaTeX{} export:: Attributes specific to horizontal rules.
11530@end menu 11939@end menu
11531 11940
11532@node @LaTeX{} export commands, Header and sectioning, @LaTeX{} and PDF export, @LaTeX{} and PDF export 11941@node @LaTeX{} export commands
11533@subsection @LaTeX{} export commands 11942@subsection @LaTeX{} export commands
11534 11943
11535@table @kbd 11944@table @kbd
11536@orgcmd{C-c C-e l l,org-latex-export-to-latex} 11945@orgcmd{C-c C-e l l,org-latex-export-to-latex}
11537Export as a @LaTeX{} file. For an Org file @file{myfile.org}, the @LaTeX{} 11946Export as @LaTeX{} file with a @file{.tex} extension. For @file{myfile.org},
11538file will be @file{myfile.tex}. The file will be overwritten without 11947Org exports to @file{myfile.tex}, overwriting without warning. @kbd{C-c C-e
11539warning. 11948l l} Exports to @LaTeX{} file.
11949
11540@orgcmd{C-c C-e l L,org-latex-export-as-latex} 11950@orgcmd{C-c C-e l L,org-latex-export-as-latex}
11541Export to a temporary buffer. Do not create a file. 11951Export to a temporary buffer. Do not create a file.
11542@orgcmd{C-c C-e l p,org-latex-export-to-pdf} 11952@orgcmd{C-c C-e l p,org-latex-export-to-pdf}
11543Export as @LaTeX{} and then process to PDF. 11953Export as @LaTeX{} file and convert it to PDF file.
11544@item C-c C-e l o 11954@item C-c C-e l o
11545Export as @LaTeX{} and then process to PDF, then open the resulting PDF file. 11955Export as @LaTeX{} file and convert it to PDF, then open the PDF using the default viewer.
11956@end table
11957
11958@vindex org-latex-compiler
11959@vindex org-latex-bibtex-compiler
11960@vindex org-latex-default-packages-alist
11961The @LaTeX{} export back-end can use any of these @LaTeX{} engines:
11962@samp{pdflatex}, @samp{xelatex}, and @samp{lualatex}. These engines compile
11963@LaTeX{} files with different compilers, packages, and output options. The
11964@LaTeX{} export back-end finds the compiler version to use from
11965@code{org-latex-compiler} variable or the @code{#+LATEX_COMPILER} keyword in
11966the Org file. See the docstring for the
11967@code{org-latex-default-packages-alist} for loading packages with certain
11968compilers. Also see @code{org-latex-bibtex-compiler} to set the bibliography
11969compiler@footnote{This does not allow setting different bibliography
11970compilers for different files. However, ``smart'' @LaTeX{} compilation
11971systems, such as @samp{latexmk}, can select the correct bibliography
11972compiler.}.
11973
11974@node @LaTeX{} specific export settings
11975@subsection @LaTeX{} specific export settings
11976
11977The @LaTeX{} export back-end has several additional keywords for customizing
11978@LaTeX{} output. Setting these keywords works similar to the general options
11979(@pxref{Export settings}).
11980
11981@table @samp
11982@item DESCRIPTION
11983@cindex #+DESCRIPTION (@LaTeX{})
11984The document's description. The description along with author name,
11985keywords, and related file metadata are inserted in the output file by the
11986@samp{hyperref} package. See @code{org-latex-hyperref-template} for
11987customizing metadata items. See @code{org-latex-title-command} for
11988typesetting description into the document's front matter. Use multiple
11989@code{#+DESCRIPTION} lines for long descriptions.
11990
11991@item LATEX_CLASS
11992@cindex #+LATEX_CLASS
11993@vindex org-latex-default-class
11994@vindex org-latex-classes
11995This is @LaTeX{} document class, such as @code{article}, @code{report},
11996@code{book}, and so on, which contain predefined preamble and headline level
11997mapping that the @LaTeX{} export back-end needs. The back-end reads the
11998default class name from the @code{org-latex-default-class} variable. Org has
11999@code{article} as the default class. A valid default class must be an
12000element of @code{org-latex-classes}.
12001
12002@item LATEX_CLASS_OPTIONS
12003@cindex #+LATEX_CLASS_OPTIONS
12004Options the @LaTeX{} export back-end uses when calling the @LaTeX{} document
12005class.
12006
12007@item LATEX_COMPILER
12008@cindex #+LATEX_COMPILER
12009@vindex org-latex-compiler
12010The compiler, such as @samp{pdflatex}, @samp{xelatex}, @samp{lualatex}, for
12011producing the PDF (@code{org-latex-compiler}).
12012
12013@item LATEX_HEADER
12014@cindex #+LATEX_HEADER
12015@vindex org-latex-classes
12016Arbitrary lines to add to the document's preamble, before the @samp{hyperref}
12017settings. See @code{org-latex-classes} for adjusting the structure and order
12018of the @LaTeX{} headers.
12019
12020@item LATEX_HEADER_EXTRA
12021@cindex #+LATEX_HEADER_EXTRA
12022@vindex org-latex-classes
12023Arbitrary lines to add to the document's preamble, before the @samp{hyperref}
12024settings. See @code{org-latex-classes} for adjusting the structure and order
12025of the @LaTeX{} headers.
12026
12027@item KEYWORDS
12028@cindex #+KEYWORDS (@LaTeX{})
12029The keywords for the document. The description along with author name,
12030keywords, and related file metadata are inserted in the output file by the
12031@samp{hyperref} package. See @code{org-latex-hyperref-template} for
12032customizing metadata items. See @code{org-latex-title-command} for
12033typesetting description into the document's front matter. Use multiple
12034@code{#+KEYWORDS} lines if necessary.
12035
12036@item SUBTITLE
12037@cindex #+SUBTITLE (@LaTeX{})
12038@vindex org-latex-subtitle-separate
12039@vindex org-latex-subtitle-format
12040The document's subtitle. It is typeset as per
12041@code{org-latex-subtitle-format}. If @code{org-latex-subtitle-separate} is
12042non-@code{nil}, it is typed as part of the @samp{\title}-macro. See
12043@code{org-latex-hyperref-template} for customizing metadata items. See
12044@code{org-latex-title-command} for typesetting description into the
12045document's front matter.
11546@end table 12046@end table
11547 12047
11548@node Header and sectioning, Quoting @LaTeX{} code, @LaTeX{} export commands, @LaTeX{} and PDF export 12048The following sections have further details.
11549@subsection Header and sectioning structure 12049
12050@node @LaTeX{} header and sectioning
12051@subsection @LaTeX{} header and sectioning structure
11550@cindex @LaTeX{} class 12052@cindex @LaTeX{} class
11551@cindex @LaTeX{} sectioning structure 12053@cindex @LaTeX{} sectioning structure
11552@cindex @LaTeX{} header 12054@cindex @LaTeX{} header
11553@cindex header, for @LaTeX{} files 12055@cindex header, for @LaTeX{} files
11554@cindex sectioning structure, for @LaTeX{} export 12056@cindex sectioning structure, for @LaTeX{} export
11555 12057
11556By default, the first three outline levels become headlines, defining a 12058The @LaTeX{} export back-end converts the first three of Org's outline levels
11557general document structure. Additional levels are exported as @code{itemize} 12059into @LaTeX{} headlines. The remaining Org levels are exported as
11558or @code{enumerate} lists. The transition can also occur at a different 12060@code{itemize} or @code{enumerate} lists. To change this globally for the
11559level (@pxref{Export settings}). 12061cut-off point between levels and lists, (@pxref{Export settings}).
11560 12062
11561By default, the @LaTeX{} output uses the class @code{article}. 12063By default, the @LaTeX{} export back-end uses the @code{article} class.
11562 12064
11563@vindex org-latex-default-class 12065@vindex org-latex-default-class
11564@vindex org-latex-classes 12066@vindex org-latex-classes
11565@vindex org-latex-default-packages-alist 12067@vindex org-latex-default-packages-alist
11566@vindex org-latex-packages-alist 12068@vindex org-latex-packages-alist
11567You can change this globally by setting a different value for 12069To change the default class globally, edit @code{org-latex-default-class}.
11568@code{org-latex-default-class} or locally by adding an option like 12070To change the default class locally in an Org file, add option lines
11569@code{#+LATEX_CLASS: myclass} in your file, or with 12071@code{#+LATEX_CLASS: myclass}. To change the default class for just a part
11570a @code{EXPORT_LATEX_CLASS} property that applies when exporting a region 12072of the Org file, set a sub-tree property, @code{EXPORT_LATEX_CLASS}. The
11571containing only this (sub)tree. The class must be listed in 12073class name entered here must be valid member of @code{org-latex-classes}.
11572@code{org-latex-classes}. This variable defines a header template for each 12074This variable defines a header template for each class into which the
11573class@footnote{Into which the values of 12075exporter splices the values of @code{org-latex-default-packages-alist} and
11574@code{org-latex-default-packages-alist} and @code{org-latex-packages-alist} 12076@code{org-latex-packages-alist}. Use the same three variables to define
11575are spliced.}, and allows you to define the sectioning structure for each 12077custom sectioning or custom classes.
11576class. You can also define your own classes there.
11577 12078
11578@cindex #+LATEX_CLASS 12079@cindex #+LATEX_CLASS
11579@cindex #+LATEX_CLASS_OPTIONS 12080@cindex #+LATEX_CLASS_OPTIONS
11580@cindex property, EXPORT_LATEX_CLASS 12081@cindex property, EXPORT_LATEX_CLASS
11581@cindex property, EXPORT_LATEX_CLASS_OPTIONS 12082@cindex property, EXPORT_LATEX_CLASS_OPTIONS
11582The @code{LATEX_CLASS_OPTIONS} keyword or @code{EXPORT_LATEX_CLASS_OPTIONS} 12083The @LaTeX{} export back-end sends the @code{LATEX_CLASS_OPTIONS} keyword and
11583property can specify the options for the @code{\documentclass} macro. These 12084@code{EXPORT_LATEX_CLASS_OPTIONS} property as options to the @LaTeX{}
11584options have to be provided, as expected by @LaTeX{}, within square brackets. 12085@code{\documentclass} macro. The options and the syntax for specifying them,
12086including enclosing them in square brackets, follow @LaTeX{} conventions.
12087
12088@example
12089#+LATEX_CLASS_OPTIONS: [a4paper,11pt,twoside,twocolumn]
12090@end example
11585 12091
11586@cindex #+LATEX_HEADER 12092@cindex #+LATEX_HEADER
11587@cindex #+LATEX_HEADER_EXTRA 12093@cindex #+LATEX_HEADER_EXTRA
11588You can also use the @code{LATEX_HEADER} and 12094The @LaTeX{} export back-end appends values from @code{LATEX_HEADER} and
11589@code{LATEX_HEADER_EXTRA}@footnote{Unlike @code{LATEX_HEADER}, contents 12095@code{LATEX_HEADER_EXTRA} keywords to the @LaTeX{} header. The docstring for
11590from @code{LATEX_HEADER_EXTRA} keywords will not be loaded when previewing 12096@code{org-latex-classes} explains in more detail. Also note that @LaTeX{}
11591@LaTeX{} snippets (@pxref{Previewing @LaTeX{} fragments}).} keywords in order 12097export back-end does not append @code{LATEX_HEADER_EXTRA} to the header when
11592to add lines to the header. See the docstring of @code{org-latex-classes} for 12098previewing @LaTeX{} snippets (@pxref{Previewing @LaTeX{} fragments}).
11593more information.
11594 12099
11595An example is shown below. 12100A sample Org file with the above headers:
11596 12101
11597@example 12102@example
11598#+LATEX_CLASS: article 12103#+LATEX_CLASS: article
@@ -11601,103 +12106,117 @@ An example is shown below.
11601 12106
11602* Headline 1 12107* Headline 1
11603 some text 12108 some text
12109* Headline 2
12110 some more text
11604@end example 12111@end example
11605 12112
11606@node Quoting @LaTeX{} code, @LaTeX{} specific attributes, Header and sectioning, @LaTeX{} and PDF export 12113@node Quoting @LaTeX{} code
11607@subsection Quoting @LaTeX{} code 12114@subsection Quoting @LaTeX{} code
11608 12115
11609Embedded @LaTeX{} as described in @ref{Embedded @LaTeX{}}, will be correctly 12116The @LaTeX{} export back-end can insert any arbitrary @LaTeX{} code,
11610inserted into the @LaTeX{} file. Furthermore, you can add special code that 12117@pxref{Embedded @LaTeX{}}. There are three ways to embed such code in the
11611should only be present in @LaTeX{} export with the following constructs: 12118Org file and they all use different quoting syntax.
11612 12119
11613@cindex #+LATEX 12120Inserting in-line quoted with @ symbols:
11614@cindex #+BEGIN_LATEX 12121@cindex inline, in @LaTeX{} export
11615@example 12122@example
11616Code within @@@@latex:some code@@@@ a paragraph. 12123Code embedded in-line @@@@latex:any arbitrary LaTeX code@@@@ in a paragraph.
11617
11618#+LATEX: Literal @LaTeX{} code for export
11619
11620#+BEGIN_LATEX
11621All lines between these markers are exported literally
11622#+END_LATEX
11623@end example 12124@end example
11624 12125
11625@node @LaTeX{} specific attributes, , Quoting @LaTeX{} code, @LaTeX{} and PDF export 12126Inserting as one or more keyword lines in the Org file:
11626@subsection @LaTeX{} specific attributes 12127@cindex #+LATEX
11627@cindex #+ATTR_LATEX 12128@example
12129#+LATEX: any arbitrary LaTeX code
12130@end example
11628 12131
11629@LaTeX{} understands attributes specified in an @code{ATTR_LATEX} line. They 12132Inserting as an export block in the Org file, where the back-end exports any
11630affect tables, images, plain lists, special blocks and source blocks. 12133code between begin and end markers:
12134@cindex #+BEGIN_EXPORT latex
12135@example
12136#+BEGIN_EXPORT latex
12137any arbitrary LaTeX code
12138#+END_EXPORT
12139@end example
11631 12140
11632@subsubheading Tables in @LaTeX{} export 12141@node Tables in @LaTeX{} export
12142@subsection Tables in @LaTeX{} export
11633@cindex tables, in @LaTeX{} export 12143@cindex tables, in @LaTeX{} export
12144@cindex #+ATTR_LATEX, in tables
11634 12145
11635For @LaTeX{} export of a table, you can specify a label and a caption 12146The @LaTeX{} export back-end can pass several @LaTeX{} attributes for table
11636(@pxref{Images and tables}). You can also use attributes to control table 12147contents and layout. Besides specifying label and caption (@pxref{Images and
11637layout and contents. Valid @LaTeX{} attributes include: 12148tables}), the other valid @LaTeX{} attributes include:
11638 12149
11639@table @code 12150@table @code
11640@item :mode 12151@item :mode
11641@vindex org-latex-default-table-mode 12152@vindex org-latex-default-table-mode
11642Nature of table's contents. It can be set to @code{table}, @code{math}, 12153The @LaTeX{} export back-end wraps the table differently depending on the
11643@code{inline-math} or @code{verbatim}. In particular, when in @code{math} or 12154mode for accurate rendering of math symbols. Mode is either @code{table},
11644@code{inline-math} mode, every cell is exported as-is, horizontal rules are 12155@code{math}, @code{inline-math} or @code{verbatim}. For @code{math} or
11645ignored and the table will be wrapped in a math environment. Also, 12156@code{inline-math} mode, @LaTeX{} export back-end wraps the table in a math
11646contiguous tables sharing the same math mode will be wrapped within the same 12157environment, but every cell in it is exported as-is. The @LaTeX{} export
11647environment. Default mode is determined in 12158back-end determines the default mode from
11648@code{org-latex-default-table-mode}. 12159@code{org-latex-default-table-mode}. For , The @LaTeX{} export back-end
12160merges contiguous tables in the same mode into a single environment.
11649@item :environment 12161@item :environment
11650@vindex org-latex-default-table-environment 12162@vindex org-latex-default-table-environment
11651Environment used for the table. It can be set to any @LaTeX{} table 12163Set the default @LaTeX{} table environment for the @LaTeX{} export back-end
11652environment, like @code{tabularx}@footnote{Requires adding the 12164to use when exporting Org tables. Common @LaTeX{} table environments are
11653@code{tabularx} package to @code{org-latex-packages-alist}.}, 12165provided by these packages: @code{tabularx}, @code{longtable}, @code{array},
11654@code{longtable}, @code{array}, @code{tabu}@footnote{Requires adding the 12166@code{tabu}, and @code{bmatrix}. For packages, such as @code{tabularx} and
11655@code{tabu} package to @code{org-latex-packages-alist}.}, 12167@code{tabu}, or any newer replacements, include them in the
11656@code{bmatrix}@enddots{} It defaults to 12168@code{org-latex-packages-alist} variable so the @LaTeX{} export back-end can
11657@code{org-latex-default-table-environment} value. 12169insert the appropriate load package headers in the converted @LaTeX{} file.
12170Look in the docstring for the @code{org-latex-packages-alist} variable for
12171configuring these packages for @LaTeX{} snippet previews, if any.
11658@item :caption 12172@item :caption
11659@code{#+CAPTION} keyword is the simplest way to set a caption for a table 12173Use @code{#+CAPTION} keyword to set a simple caption for a table
11660(@pxref{Images and tables}). If you need more advanced commands for that 12174(@pxref{Images and tables}). For custom captions, use @code{:caption}
11661task, you can use @code{:caption} attribute instead. Its value should be raw 12175attribute, which accepts raw @LaTeX{} code. @code{:caption} value overrides
11662@LaTeX{} code. It has precedence over @code{#+CAPTION}. 12176@code{#+CAPTION} value.
11663@item :float 12177@item :float
11664@itemx :placement 12178@itemx :placement
11665Float environment for the table. Possible values are @code{sidewaystable}, 12179The table environments by default are not floats in @LaTeX{}. To make them
11666@code{multicolumn}, @code{t} and @code{nil}. When unspecified, a table with 12180floating objects use @code{:float} with one of the following options:
11667a caption will have a @code{table} environment. Moreover, @code{:placement} 12181@code{sideways}, @code{multicolumn}, @code{t}, and @code{nil}. Note that
11668attribute can specify the positioning of the float. 12182@code{sidewaystable} has been deprecated since Org 8.3. @LaTeX{} floats can
12183also have additional layout @code{:placement} attributes. These are the
12184usual @code{[h t b p ! H]} permissions specified in square brackets. Note
12185that for @code{:float sideways} tables, the @LaTeX{} export back-end ignores
12186@code{:placement} attributes.
11669@item :align 12187@item :align
11670@itemx :font 12188@itemx :font
11671@itemx :width 12189@itemx :width
11672Set, respectively, the alignment string of the table, its font size and its 12190The @LaTeX{} export back-end uses these attributes for regular tables to set
11673width. They only apply on regular tables. 12191their alignments, fonts, and widths.
11674@item :spread 12192@item :spread
11675Boolean specific to the @code{tabu} and @code{longtabu} environments, and 12193When @code{:spread} is non-@code{nil}, the @LaTeX{} export back-end spreads
11676only takes effect when used in conjunction with the @code{:width} attribute. 12194or shrinks the table by the @code{:width} for @code{tabu} and @code{longtabu}
11677When @code{:spread} is non-@code{nil}, the table will be spread or shrunk by the 12195environments. @code{:spread} has no effect if @code{:width} is not set.
11678value of @code{:width}.
11679@item :booktabs 12196@item :booktabs
11680@itemx :center 12197@itemx :center
11681@itemx :rmlines 12198@itemx :rmlines
11682@vindex org-latex-tables-booktabs 12199@vindex org-latex-tables-booktabs
11683@vindex org-latex-tables-centered 12200@vindex org-latex-tables-centered
11684They toggle, respectively, @code{booktabs} usage (assuming the package is 12201All three commands are toggles. @code{:booktabs} brings in modern
11685properly loaded), table centering and removal of every horizontal rule but 12202typesetting enhancements to regular tables. The @code{booktabs} package has
11686the first one (in a "table.el" table only). In particular, 12203to be loaded through @code{org-latex-packages-alist}. @code{:center} is for
11687@code{org-latex-tables-booktabs} (respectively @code{org-latex-tables-centered}) 12204centering the table. @code{:rmlines} removes all but the very first
11688activates the first (respectively second) attribute globally. 12205horizontal line made of ASCII characters from "table.el" tables only.
11689@item :math-prefix 12206@item :math-prefix
11690@itemx :math-suffix 12207@itemx :math-suffix
11691@itemx :math-arguments 12208@itemx :math-arguments
11692A string that will be inserted, respectively, before the table within the 12209The @LaTeX{} export back-end inserts @code{:math-prefix} string value in a
11693math environment, after the table within the math environment, and between 12210math environment before the table. The @LaTeX{} export back-end inserts
11694the macro name and the contents of the table. The @code{:math-arguments} 12211@code{:math-suffix} string value in a math environment after the table. The
11695attribute is used for matrix macros that require more than one argument 12212@LaTeX{} export back-end inserts @code{:math-arguments} string value between
11696(e.g., @code{qbordermatrix}). 12213the macro name and the table's contents. @code{:math-arguments} comes in use
12214for matrix macros that require more than one argument, such as
12215@code{qbordermatrix}.
11697@end table 12216@end table
11698 12217
11699Thus, attributes can be used in a wide array of situations, like writing 12218@LaTeX{} table attributes help formatting tables for a wide range of
11700a table that will span over multiple pages, or a matrix product: 12219situations, such as matrix product or spanning multiple pages:
11701 12220
11702@example 12221@example
11703#+ATTR_LATEX: :environment longtable :align l|lp@{3cm@}r|l 12222#+ATTR_LATEX: :environment longtable :align l|lp@{3cm@}r|l
@@ -11712,8 +12231,8 @@ a table that will span over multiple pages, or a matrix product:
11712| 3 | 4 | 12231| 3 | 4 |
11713@end example 12232@end example
11714 12233
11715In the example below, @LaTeX{} command 12234Set the caption with the @LaTeX{} command
11716@code{\bicaption@{HeadingA@}@{HeadingB@}} will set the caption. 12235@code{\bicaption@{HeadingA@}@{HeadingB@}}:
11717 12236
11718@example 12237@example
11719#+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@} 12238#+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@}
@@ -11722,128 +12241,203 @@ In the example below, @LaTeX{} command
11722@end example 12241@end example
11723 12242
11724 12243
11725@subsubheading Images in @LaTeX{} export 12244@node Images in @LaTeX{} export
12245@subsection Images in @LaTeX{} export
11726@cindex images, inline in @LaTeX{} 12246@cindex images, inline in @LaTeX{}
11727@cindex inlining images in @LaTeX{} 12247@cindex inlining images in @LaTeX{}
12248@cindex #+ATTR_LATEX, in images
11728 12249
11729Images that are linked to without a description part in the link, like 12250The @LaTeX{} export back-end processes image links in Org files that do not
11730@samp{[[file:img.jpg]]} or @samp{[[./img.jpg]]} will be inserted into the PDF 12251have descriptions, such as these links @samp{[[file:img.jpg]]} or
11731output file resulting from @LaTeX{} processing. Org will use an 12252@samp{[[./img.jpg]]}, as direct image insertions in the final PDF output. In
11732@code{\includegraphics} macro to insert the image@footnote{In the case of 12253the PDF, they are no longer links but actual images embedded on the page.
11733TikZ (@url{http://sourceforge.net/projects/pgf/}) images, it will become an 12254The @LaTeX{} export back-end uses @code{\includegraphics} macro to insert the
11734@code{\input} macro wrapped within a @code{tikzpicture} environment.}. 12255image. But for TikZ@footnote{@url{http://sourceforge.net/projects/pgf/}}
12256images, the back-end uses an @code{\input} macro wrapped within
12257a @code{tikzpicture} environment.
11735 12258
11736You can specify specify image width or height with, respectively, 12259For specifying image @code{:width}, @code{:height}, and other
11737@code{:width} and @code{:height} attributes. It is also possible to add any 12260@code{:options}, use this syntax:
11738other option with the @code{:options} attribute, as shown in the following
11739example:
11740 12261
11741@example 12262@example
11742#+ATTR_LATEX: :width 5cm :options angle=90 12263#+ATTR_LATEX: :width 5cm :options angle=90
11743[[./img/sed-hr4049.pdf]] 12264[[./img/sed-hr4049.pdf]]
11744@end example 12265@end example
11745 12266
11746If you need a specific command for the caption, use @code{:caption} 12267For custom commands for captions, use the @code{:caption} attribute. It will
11747attribute. It will override standard @code{#+CAPTION} value, if any. 12268override the default @code{#+CAPTION} value:
11748 12269
11749@example 12270@example
11750#+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@} 12271#+ATTR_LATEX: :caption \bicaption@{HeadingA@}@{HeadingB@}
11751[[./img/sed-hr4049.pdf]] 12272[[./img/sed-hr4049.pdf]]
11752@end example 12273@end example
11753 12274
11754If you have specified a caption as described in @ref{Images and tables}, the 12275When captions follow the method as described in @ref{Images and tables}, the
11755picture will be wrapped into a @code{figure} environment and thus become 12276@LaTeX{} export back-end wraps the picture in a floating @code{figure}
11756a floating element. You can also ask Org to export an image as a float 12277environment. To float an image without specifying a caption, set the
11757without specifying caption by setting the @code{:float} attribute. You may 12278@code{:float} attribute to one of the following:
11758also set it to:
11759@itemize @minus 12279@itemize @minus
11760@item 12280@item
11761@code{t}: if you want to use the standard @samp{figure} environment. It is 12281@code{t}: for a standard @samp{figure} environment; used by default whenever
11762used by default if you provide a caption to the image. 12282an image has a caption.
11763@item 12283@item
11764@code{multicolumn}: if you wish to include an image which spans multiple 12284@code{multicolumn}: to span the image across multiple columns of a page; the
11765columns in a page. This will export the image wrapped in a @code{figure*} 12285back-end wraps the image in a @code{figure*} environment.
11766environment.
11767@item 12286@item
11768@code{wrap}: if you would like to let text flow around the image. It will 12287@code{wrap}: for text to flow around the image on the right; the figure
11769make the figure occupy the left half of the page. 12288occupies the left half of the page.
11770@item 12289@item
11771@code{nil}: if you need to avoid any floating environment, even when 12290@code{sideways}: for a new page with the image sideways, rotated ninety
11772a caption is provided. 12291degrees, in a @code{sidewaysfigure} environment; overrides @code{:placement}
12292setting.
12293@item
12294@code{nil}: to avoid a @code{:float} even if using a caption.
11773@end itemize 12295@end itemize
11774@noindent 12296@noindent
11775To modify the placement option of any floating environment, set the 12297Use the @code{placement} attribute to modify a floating environment's placement.
11776@code{placement} attribute.
11777 12298
11778@example 12299@example
11779#+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement @{r@}@{0.4\textwidth@} 12300#+ATTR_LATEX: :float wrap :width 0.38\textwidth :placement
11780[[./img/hst.png]] 12301@{r@}@{0.4\textwidth@} [[./img/hst.png]]
11781@end example 12302@end example
11782 12303
11783If the @code{:comment-include} attribute is set to a non-@code{nil} value, 12304@vindex org-latex-images-centered
11784the @LaTeX{} @code{\includegraphics} macro will be commented out. 12305@cindex center image (@LaTeX{} export)
12306@cindex image, centering (@LaTeX{} export)
12307
12308The @LaTeX{} export back-end centers all images by default. Setting
12309@code{:center} attribute to @code{nil} disables centering. To disable
12310centering globally, set @code{org-latex-images-centered} to @code{t}.
11785 12311
11786@subsubheading Plain lists in @LaTeX{} export 12312Set the @code{:comment-include} attribute to non-@code{nil} value for the
12313@LaTeX{} export back-end to comment out the @code{\includegraphics} macro.
12314
12315@node Plain lists in @LaTeX{} export
12316@subsection Plain lists in @LaTeX{} export
11787@cindex plain lists, in @LaTeX{} export 12317@cindex plain lists, in @LaTeX{} export
12318@cindex #+ATTR_LATEX, in plain lists
12319
12320The @LaTeX{} export back-end accepts the @code{:environment} and
12321@code{:options} attributes for plain lists. Both attributes work together
12322for customizing lists, as shown in the examples:
12323
12324@example
12325#+LATEX_HEADER: \usepackage[inline]@{enumitem@}
12326Some ways to say "Hello":
12327#+ATTR_LATEX: :environment itemize*
12328#+ATTR_LATEX: :options [label=@{@}, itemjoin=@{,@}, itemjoin*=@{, and@}]
12329- Hola
12330- Bonjour
12331- Guten Tag.
12332@end example
11788 12333
11789Plain lists accept two optional attributes: @code{:environment} and 12334Since @LaTeX{} supports only four levels of nesting for lists, use an
11790@code{:options}. The first one allows the use of a non-standard environment 12335external package, such as @samp{enumitem} in @LaTeX{}, for levels deeper than
11791(e.g., @samp{inparaenum}). The second one specifies additional arguments for 12336four:
11792that environment.
11793 12337
11794@example 12338@example
11795#+ATTR_LATEX: :environment compactitem :options [$\circ$] 12339#+LATEX_HEADER: \usepackage@{enumitem@}
11796- you need ``paralist'' package to reproduce this example. 12340#+LATEX_HEADER: \renewlist@{itemize@}@{itemize@}@{9@}
12341#+LATEX_HEADER: \setlist[itemize]@{label=$\circ$@}
12342- One
12343 - Two
12344 - Three
12345 - Four
12346 - Five
11797@end example 12347@end example
11798 12348
11799@subsubheading Source blocks in @LaTeX{} export 12349@node Source blocks in @LaTeX{} export
12350@subsection Source blocks in @LaTeX{} export
11800@cindex source blocks, in @LaTeX{} export 12351@cindex source blocks, in @LaTeX{} export
12352@cindex #+ATTR_LATEX, in source blocks
12353
12354The @LaTeX{} export back-end can make source code blocks into floating
12355objects through the attributes @code{:float} and @code{:options}. For
12356@code{:float}:
11801 12357
11802In addition to syntax defined in @ref{Literal examples}, names and captions
11803(@pxref{Images and tables}), source blocks also accept a @code{:float}
11804attribute. You may set it to:
11805@itemize @minus 12358@itemize @minus
11806@item 12359@item
11807@code{t}: if you want to make the source block a float. It is the default 12360@code{t}: makes a source block float; by default floats any source block with
11808value when a caption is provided. 12361a caption.
11809@item 12362@item
11810@code{multicolumn}: if you wish to include a source block which spans multiple 12363@code{multicolumn}: spans the source block across multiple columns of a page.
11811columns in a page.
11812@item 12364@item
11813@code{nil}: if you need to avoid any floating environment, even when a caption 12365@code{nil}: avoids a @code{:float} even if using a caption; useful for
11814is provided. It is useful for source code that may not fit in a single page. 12366source code blocks that may not fit on a page.
11815@end itemize 12367@end itemize
11816 12368
11817@example 12369@example
11818#+ATTR_LATEX: :float nil 12370#+ATTR_LATEX: :float nil
11819#+BEGIN_SRC emacs-lisp 12371#+BEGIN_SRC emacs-lisp
11820Code that may not fit in a single page. 12372Lisp code that may not fit in a single page.
11821#+END_SRC 12373#+END_SRC
11822@end example 12374@end example
11823 12375
11824@subsubheading Special blocks in @LaTeX{} export 12376@vindex org-latex-listings-options
12377@vindex org-latex-minted-options
12378The @LaTeX{} export back-end passes string values in @code{:options} to
12379@LaTeX{} packages for customization of that specific source block. In the
12380example below, the @code{:options} are set for Minted. Minted is a source
12381code highlighting @LaTeX{}package with many configurable options.
12382
12383@example
12384#+ATTR_LATEX: :options commentstyle=\bfseries
12385#+BEGIN_SRC emacs-lisp
12386 (defun Fib (n)
12387 (if (< n 2) n (+ (Fib (- n 1)) (Fib (- n 2)))))
12388#+END_SRC
12389@end example
12390
12391To apply similar configuration options for all source blocks in a file, use
12392the @code{org-latex-listings-options} and @code{org-latex-minted-options}
12393variables.
12394
12395@node Example blocks in @LaTeX{} export
12396@subsection Example blocks in @LaTeX{} export
12397@cindex example blocks, in @LaTeX{} export
12398@cindex verbatim blocks, in @LaTeX{} export
12399@cindex #+ATTR_LATEX, in example blocks
12400
12401The @LaTeX{} export back-end wraps the contents of example blocks in a
12402@samp{verbatim} environment. To change this behavior to use another
12403environment globally, specify an appropriate export filter (@pxref{Advanced
12404configuration}). To change this behavior to use another environment for each
12405block, use the @code{:environment} parameter to specify a custom environment.
12406
12407@example
12408#+ATTR_LATEX: :environment myverbatim
12409#+BEGIN_EXAMPLE
12410This sentence is false.
12411#+END_EXAMPLE
12412@end example
12413
12414@node Special blocks in @LaTeX{} export
12415@subsection Special blocks in @LaTeX{} export
11825@cindex special blocks, in @LaTeX{} export 12416@cindex special blocks, in @LaTeX{} export
11826@cindex abstract, in @LaTeX{} export 12417@cindex abstract, in @LaTeX{} export
11827@cindex proof, in @LaTeX{} export 12418@cindex proof, in @LaTeX{} export
12419@cindex #+ATTR_LATEX, in special blocks
11828 12420
11829In @LaTeX{} back-end, special blocks become environments of the same name. 12421
11830Value of @code{:options} attribute will be appended as-is to that 12422For other special blocks in the Org file, the @LaTeX{} export back-end makes
11831environment's opening string. For example: 12423a special environment of the same name. The back-end also takes
12424@code{:options}, if any, and appends as-is to that environment's opening
12425string. For example:
11832 12426
11833@example 12427@example
11834#+BEGIN_ABSTRACT 12428#+BEGIN_abstract
11835We demonstrate how to solve the Syracuse problem. 12429We demonstrate how to solve the Syracuse problem.
11836#+END_ABSTRACT 12430#+END_abstract
11837 12431
11838#+ATTR_LATEX: :options [Proof of important theorem] 12432#+ATTR_LATEX: :options [Proof of important theorem]
11839#+BEGIN_PROOF 12433#+BEGIN_proof
11840... 12434...
11841Therefore, any even number greater than 2 is the sum of two primes. 12435Therefore, any even number greater than 2 is the sum of two primes.
11842#+END_PROOF 12436#+END_proof
11843@end example 12437@end example
11844 12438
11845@noindent 12439@noindent
11846becomes 12440exports to
11847 12441
11848@example 12442@example
11849\begin@{abstract@} 12443\begin@{abstract@}
@@ -11862,43 +12456,43 @@ example:
11862 12456
11863@example 12457@example
11864#+ATTR_LATEX: :caption \MyCaption@{HeadingA@} 12458#+ATTR_LATEX: :caption \MyCaption@{HeadingA@}
11865#+BEGIN_PROOF 12459#+BEGIN_proof
11866... 12460...
11867#+END_PROOF 12461#+END_proof
11868@end example 12462@end example
11869 12463
11870@subsubheading Horizontal rules 12464@node Horizontal rules in @LaTeX{} export
12465@subsection Horizontal rules in @LaTeX{} export
11871@cindex horizontal rules, in @LaTeX{} export 12466@cindex horizontal rules, in @LaTeX{} export
12467@cindex #+ATTR_LATEX, in horizontal rules
11872 12468
11873Width and thickness of a given horizontal rule can be controlled with, 12469The @LaTeX{} export back-end converts horizontal rules by the specified
11874respectively, @code{:width} and @code{:thickness} attributes: 12470@code{:width} and @code{:thickness} attributes. For example:
11875 12471
11876@example 12472@example
11877#+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt 12473#+ATTR_LATEX: :width .6\textwidth :thickness 0.8pt
11878----- 12474-----
11879@end example 12475@end example
11880 12476
11881@node Markdown export, OpenDocument Text export, @LaTeX{} and PDF export, Exporting 12477@node Markdown export
11882@section Markdown export 12478@section Markdown export
11883@cindex Markdown export 12479@cindex Markdown export
11884 12480
11885@code{md} export back-end generates Markdown syntax@footnote{Vanilla flavor, 12481The Markdown export back-end, @code{md}, converts an Org file to a Markdown
11886as defined at @url{http://daringfireball.net/projects/markdown/}.} for an Org 12482format, as defined at @url{http://daringfireball.net/projects/markdown/}.
11887mode buffer.
11888 12483
11889It is built over HTML back-end: any construct not supported by Markdown 12484Since @code{md} is built on top of the HTML back-end, any Org constructs not
11890syntax (e.g., tables) will be controlled and translated by @code{html} 12485supported by Markdown, such as tables, the underlying @code{html} back-end
11891back-end (@pxref{HTML export}). 12486(@pxref{HTML export}) converts them.
11892 12487
11893@subheading Markdown export commands 12488@subheading Markdown export commands
11894 12489
11895@table @kbd 12490@table @kbd
11896@orgcmd{C-c C-e m m,org-md-export-to-markdown} 12491@orgcmd{C-c C-e m m,org-md-export-to-markdown}
11897Export as a text file written in Markdown syntax. For an Org file, 12492Export to a text file with Markdown syntax. For @file{myfile.org}, Org
11898@file{myfile.org}, the resulting file will be @file{myfile.md}. The file 12493exports to @file{myfile.md}, overwritten without warning.
11899will be overwritten without warning.
11900@orgcmd{C-c C-e m M,org-md-export-as-markdown} 12494@orgcmd{C-c C-e m M,org-md-export-as-markdown}
11901Export to a temporary buffer. Do not create a file. 12495Export to a temporary buffer. Does not create a file.
11902@item C-c C-e m o 12496@item C-c C-e m o
11903Export as a text file with Markdown syntax, then open it. 12497Export as a text file with Markdown syntax, then open it.
11904@end table 12498@end table
@@ -11906,54 +12500,52 @@ Export as a text file with Markdown syntax, then open it.
11906@subheading Header and sectioning structure 12500@subheading Header and sectioning structure
11907 12501
11908@vindex org-md-headline-style 12502@vindex org-md-headline-style
11909Markdown export can generate both @code{atx} and @code{setext} types for 12503Based on @code{org-md-headline-style}, markdown export can generate headlines
11910headlines, according to @code{org-md-headline-style}. The former introduces 12504of both @code{atx} and @code{setext} types. @code{atx} limits headline
11911a hard limit of two levels, whereas the latter pushes it to six. Headlines 12505levels to two. @code{setext} limits headline levels to six. Beyond these
11912below that limit are exported as lists. You can also set a soft limit before 12506limits, the export back-end converts headlines to lists. To set a limit to a
11913that one (@pxref{Export settings}). 12507level before the absolute limit (@pxref{Export settings}).
11914 12508
11915@c begin opendocument 12509@c begin opendocument
11916 12510
11917@node OpenDocument Text export, Org export, Markdown export, Exporting 12511@node OpenDocument Text export
11918@section OpenDocument Text export 12512@section OpenDocument Text export
11919@cindex ODT 12513@cindex ODT
11920@cindex OpenDocument 12514@cindex OpenDocument
11921@cindex export, OpenDocument 12515@cindex export, OpenDocument
11922@cindex LibreOffice 12516@cindex LibreOffice
11923 12517
11924Org mode@footnote{Versions 7.8 or later} supports export to OpenDocument Text 12518The ODT export back-end handles creating of OpenDocument Text (ODT) format
11925(ODT) format. Documents created by this exporter use the 12519files. The format complies with @cite{OpenDocument-v1.2
11926@cite{OpenDocument-v1.2
11927specification}@footnote{@url{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, 12520specification}@footnote{@url{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html,
11928Open Document Format for Office Applications (OpenDocument) Version 1.2}} and 12521Open Document Format for Office Applications (OpenDocument) Version 1.2}} and
11929are compatible with LibreOffice 3.4. 12522is compatible with LibreOffice 3.4.
11930 12523
11931@menu 12524@menu
11932* Pre-requisites for ODT export:: What packages ODT exporter relies on 12525* Pre-requisites for ODT export:: Required packages.
11933* ODT export commands:: How to invoke ODT export 12526* ODT export commands:: Invoking export.
11934* Extending ODT export:: How to produce @samp{doc}, @samp{pdf} files 12527* ODT specific export settings:: Configuration options.
11935* Applying custom styles:: How to apply custom styles to the output 12528* Extending ODT export:: Producing @file{.doc}, @file{.pdf} files.
11936* Links in ODT export:: How links will be interpreted and formatted 12529* Applying custom styles:: Styling the output.
11937* Tables in ODT export:: How Tables are exported 12530* Links in ODT export:: Handling and formatting links.
11938* Images in ODT export:: How to insert images 12531* Tables in ODT export:: Org table conversions.
11939* Math formatting in ODT export:: How @LaTeX{} fragments are formatted 12532* Images in ODT export:: Inserting images.
11940* Labels and captions in ODT export:: How captions are rendered 12533* Math formatting in ODT export:: Formatting @LaTeX{} fragments.
11941* Literal examples in ODT export:: How source and example blocks are formatted 12534* Labels and captions in ODT export:: Rendering objects.
11942* Advanced topics in ODT export:: Read this if you are a power user 12535* Literal examples in ODT export:: For source code and example blocks.
12536* Advanced topics in ODT export:: For power users.
11943@end menu 12537@end menu
11944 12538
11945@node Pre-requisites for ODT export, ODT export commands, OpenDocument Text export, OpenDocument Text export 12539@node Pre-requisites for ODT export
11946@subsection Pre-requisites for ODT export 12540@subsection Pre-requisites for ODT export
11947@cindex zip 12541@cindex zip
11948The ODT exporter relies on the @file{zip} program to create the final 12542The ODT export back-end relies on the @file{zip} program to create the final
11949output. Check the availability of this program before proceeding further. 12543compressed ODT output. Check if @file{zip} is locally available and
12544executable. Without @file{zip}, export cannot finish.
11950 12545
11951@node ODT export commands, Extending ODT export, Pre-requisites for ODT export, OpenDocument Text export 12546@node ODT export commands
11952@subsection ODT export commands 12547@subsection ODT export commands
11953
11954@subsubheading Exporting to ODT
11955@anchor{x-export-to-odt} 12548@anchor{x-export-to-odt}
11956
11957@cindex region, active 12549@cindex region, active
11958@cindex active region 12550@cindex active region
11959@cindex transient-mark-mode 12551@cindex transient-mark-mode
@@ -11964,94 +12556,121 @@ output. Check the availability of this program before proceeding further.
11964Export as OpenDocument Text file. 12556Export as OpenDocument Text file.
11965 12557
11966@vindex org-odt-preferred-output-format 12558@vindex org-odt-preferred-output-format
11967If @code{org-odt-preferred-output-format} is specified, automatically convert 12559If @code{org-odt-preferred-output-format} is specified, the ODT export
11968the exported file to that format. @xref{x-export-to-other-formats, , 12560back-end automatically converts the exported file to that format.
11969Automatically exporting to other formats}. 12561@xref{x-export-to-other-formats, , Automatically exporting to other formats}.
11970 12562
11971For an Org file @file{myfile.org}, the ODT file will be 12563For @file{myfile.org}, Org exports to @file{myfile.odt}, overwriting without
11972@file{myfile.odt}. The file will be overwritten without warning. If there 12564warning. The ODT export back-end exports a region only if a region was
11973is an active region,@footnote{This requires @code{transient-mark-mode} to be 12565active. Note for exporting active regions, the @code{transient-mark-mode}
11974turned on} only the region will be exported. If the selected region is a 12566has to be turned on.
11975single tree,@footnote{To select the current subtree, use @kbd{C-c @@}} the 12567
11976tree head will become the document title. If the tree head entry has, or 12568If the selected region is a single tree, the ODT export back-end makes the
11977inherits, an @code{EXPORT_FILE_NAME} property, that name will be used for the 12569tree head the document title. Incidentally, @kbd{C-c @@} selects the current
11978export. 12570sub-tree. If the tree head entry has, or inherits, an
12571@code{EXPORT_FILE_NAME} property, the ODT export back-end uses that for file
12572name.
11979 12573
11980@kbd{C-c C-e o O} 12574@kbd{C-c C-e o O}
11981Export as an OpenDocument Text file and open the resulting file. 12575Export to an OpenDocument Text file format and open it.
11982 12576
11983@vindex org-odt-preferred-output-format 12577@vindex org-odt-preferred-output-format
11984If @code{org-odt-preferred-output-format} is specified, open the converted 12578When @code{org-odt-preferred-output-format} is specified, open the converted
11985file instead. @xref{x-export-to-other-formats, , Automatically exporting to 12579file instead. @xref{x-export-to-other-formats, , Automatically exporting to
11986other formats}. 12580other formats}.
11987@end table 12581@end table
11988 12582
11989@node Extending ODT export, Applying custom styles, ODT export commands, OpenDocument Text export 12583@node ODT specific export settings
12584@subsection ODT specific export settings
12585The ODT export back-end has several additional keywords for customizing ODT
12586output. Setting these keywords works similar to the general options
12587(@pxref{Export settings}).
12588
12589@table @samp
12590@item DESCRIPTION
12591@cindex #+DESCRIPTION (ODT)
12592This is the document's description, which the ODT export back-end inserts as
12593document metadata. For long descriptions, use multiple @code{#+DESCRIPTION}
12594lines.
12595
12596@item KEYWORDS
12597@cindex #+KEYWORDS (ODT)
12598The keywords for the document. The ODT export back-end inserts the
12599description along with author name, keywords, and related file metadata as
12600metadata in the output file. Use multiple @code{#+KEYWORDS} lines if
12601necessary.
12602
12603@item ODT_STYLES_FILE
12604@cindex ODT_STYLES_FILE
12605@vindex org-odt-styles-file
12606The ODT export back-end uses the @code{org-odt-styles-file} by default. See
12607@ref{Applying custom styles} for details.
12608
12609@item SUBTITLE
12610@cindex SUBTITLE (ODT)
12611The document subtitle.
12612@end table
12613
12614@node Extending ODT export
11990@subsection Extending ODT export 12615@subsection Extending ODT export
11991 12616
11992The ODT exporter can interface with a variety of document 12617The ODT export back-end can produce documents in other formats besides ODT
11993converters and supports popular converters out of the box. As a result, you 12618using a specialized ODT converter process. Its common interface works with
11994can use it to export to formats like @samp{doc} or convert a document from 12619popular converters to produce formats such as @samp{doc}, or convert a
11995one format (say @samp{csv}) to another format (say @samp{ods} or @samp{xls}). 12620document from one format, say @samp{csv}, to another format, say @samp{xls}.
11996 12621
11997@cindex @file{unoconv} 12622@cindex @file{unoconv}
11998@cindex LibreOffice 12623@cindex LibreOffice
11999If you have a working installation of LibreOffice, a document converter is 12624
12000pre-configured for you and you can use it right away. If you would like to 12625Customize @code{org-odt-convert-process} variable to point to @code{unoconv},
12001use @file{unoconv} as your preferred converter, customize the variable 12626which is the ODT's preferred converter. Working installations of LibreOffice
12002@code{org-odt-convert-process} to point to @code{unoconv}. You can 12627would already have @code{unoconv} installed. Alternatively, other converters
12003also use your own favorite converter or tweak the default settings of the 12628may be substituted here. @xref{Configuring a document converter}.
12004@file{LibreOffice} and @samp{unoconv} converters. @xref{Configuring a 12629
12005document converter}. 12630@subsubheading Automatically exporting to other formats
12006
12007@subsubsection Automatically exporting to other formats
12008@anchor{x-export-to-other-formats} 12631@anchor{x-export-to-other-formats}
12009 12632
12010@vindex org-odt-preferred-output-format 12633@vindex org-odt-preferred-output-format
12011Very often, you will find yourself exporting to ODT format, only to 12634If ODT format is just an intermediate step to get to other formats, such as
12012immediately save the exported document to other formats like @samp{doc}, 12635@samp{doc}, @samp{docx}, @samp{rtf}, or @samp{pdf}, etc., then extend the ODT
12013@samp{docx}, @samp{rtf}, @samp{pdf} etc. In such cases, you can specify your 12636export back-end to directly produce that format. Specify the final format in
12014preferred output format by customizing the variable 12637the @code{org-odt-preferred-output-format} variable. This is one way to
12015@code{org-odt-preferred-output-format}. This way, the export commands 12638extend (@pxref{x-export-to-odt,,Exporting to ODT}).
12016(@pxref{x-export-to-odt,,Exporting to ODT}) can be extended to export to a 12639
12017format that is of immediate interest to you. 12640@subsubheading Converting between document formats
12018
12019@subsubsection Converting between document formats
12020@anchor{x-convert-to-other-formats} 12641@anchor{x-convert-to-other-formats}
12021 12642
12022There are many document converters in the wild which support conversion to 12643The Org export back-end is made to be inter-operable with a wide range of text
12023and from various file formats, including, but not limited to the 12644document format converters. Newer generation converters, such as LibreOffice
12024ODT format. LibreOffice converter, mentioned above, is one such 12645and Pandoc, can handle hundreds of formats at once. Org provides a
12025converter. Once a converter is configured, you can interact with it using 12646consistent interaction with whatever converter is installed. Here are some
12026the following command. 12647generic commands:
12027 12648
12028@vindex org-odt-convert 12649@vindex org-odt-convert
12029@table @kbd 12650@table @kbd
12030 12651
12031@item M-x org-odt-convert RET 12652@item M-x org-odt-convert RET
12032Convert an existing document from one format to another. With a prefix 12653Convert an existing document from one format to another. With a prefix
12033argument, also open the newly produced file. 12654argument, opens the newly produced file.
12034@end table 12655@end table
12035 12656
12036@node Applying custom styles, Links in ODT export, Extending ODT export, OpenDocument Text export 12657@node Applying custom styles
12037@subsection Applying custom styles 12658@subsection Applying custom styles
12038@cindex styles, custom 12659@cindex styles, custom
12039@cindex template, custom 12660@cindex template, custom
12040 12661
12041The ODT exporter ships with a set of OpenDocument styles 12662The ODT export back-end comes with many OpenDocument styles (@pxref{Working
12042(@pxref{Working with OpenDocument style files}) that ensure a well-formatted 12663with OpenDocument style files}). To expand or further customize these
12043output. These factory styles, however, may not cater to your specific 12664built-in style sheets, either edit the style sheets directly or generate them
12044tastes. To customize the output, you can either modify the above styles 12665using an application such as LibreOffice. The example here shows creating a
12045files directly, or generate the required styles using an application like 12666style using LibreOffice.
12046LibreOffice. The latter method is suitable for expert and non-expert
12047users alike, and is described here.
12048 12667
12049@subsubsection Applying custom styles: the easy way 12668@subsubheading Applying custom styles: the easy way
12050 12669
12051@enumerate 12670@enumerate
12052@item 12671@item
12053Create a sample @file{example.org} file with the below settings and export it 12672Create a sample @file{example.org} file with settings as shown below, and
12054to ODT format. 12673export it to ODT format.
12055 12674
12056@example 12675@example
12057#+OPTIONS: H:10 num:t 12676#+OPTIONS: H:10 num:t
@@ -12059,9 +12678,9 @@ to ODT format.
12059 12678
12060@item 12679@item
12061Open the above @file{example.odt} using LibreOffice. Use the @file{Stylist} 12680Open the above @file{example.odt} using LibreOffice. Use the @file{Stylist}
12062to locate the target styles---these typically have the @samp{Org} prefix---and 12681to locate the target styles, which typically have the @samp{Org} prefix.
12063modify those to your taste. Save the modified file either as an 12682Open one, modify, and save as either OpenDocument Text (@file{.odt}) or
12064OpenDocument Text (@file{.odt}) or OpenDocument Template (@file{.ott}) file. 12683OpenDocument Template (@file{.ott}) file.
12065 12684
12066@item 12685@item
12067@cindex #+ODT_STYLES_FILE 12686@cindex #+ODT_STYLES_FILE
@@ -12070,8 +12689,8 @@ Customize the variable @code{org-odt-styles-file} and point it to the
12070newly created file. For additional configuration options 12689newly created file. For additional configuration options
12071@pxref{x-overriding-factory-styles,,Overriding factory styles}. 12690@pxref{x-overriding-factory-styles,,Overriding factory styles}.
12072 12691
12073If you would like to choose a style on a per-file basis, you can use the 12692To apply and ODT style to a particular file, use the @code{#+ODT_STYLES_FILE}
12074@code{#+ODT_STYLES_FILE} option. A typical setting will look like 12693option as shown in the example below:
12075 12694
12076@example 12695@example
12077#+ODT_STYLES_FILE: "/path/to/example.ott" 12696#+ODT_STYLES_FILE: "/path/to/example.ott"
@@ -12085,51 +12704,48 @@ or
12085 12704
12086@end enumerate 12705@end enumerate
12087 12706
12088@subsubsection Using third-party styles and templates 12707@subsubheading Using third-party styles and templates
12089 12708
12090You can use third-party styles and templates for customizing your output. 12709The ODT export back-end relies on many templates and style names. Using
12091This will produce the desired output only if the template provides all 12710third-party styles and templates can lead to mismatches. Templates derived
12092style names that the @samp{ODT} exporter relies on. Unless this condition is 12711from built in ODT templates and styles seem to have fewer problems.
12093met, the output is going to be less than satisfactory. So it is highly
12094recommended that you only work with templates that are directly derived from
12095the factory settings.
12096 12712
12097@node Links in ODT export, Tables in ODT export, Applying custom styles, OpenDocument Text export 12713@node Links in ODT export
12098@subsection Links in ODT export 12714@subsection Links in ODT export
12099@cindex links, in ODT export 12715@cindex links, in ODT export
12100 12716
12101ODT exporter creates native cross-references for internal links. It creates 12717ODT export back-end creates native cross-references for internal links and
12102Internet-style links for all other links. 12718Internet-style links for all other link types.
12103 12719
12104A link with no description and destined to a regular (un-itemized) outline 12720A link with no description and pointing to a regular---un-itemized---outline
12105heading is replaced with a cross-reference and section number of the heading. 12721heading is replaced with a cross-reference and section number of the heading.
12106 12722
12107A @samp{\ref@{label@}}-style reference to an image, table etc.@: is replaced 12723A @samp{\ref@{label@}}-style reference to an image, table etc.@: is replaced
12108with a cross-reference and sequence number of the labeled entity. 12724with a cross-reference and sequence number of the labeled entity.
12109@xref{Labels and captions in ODT export}. 12725@xref{Labels and captions in ODT export}.
12110 12726
12111@node Tables in ODT export, Images in ODT export, Links in ODT export, OpenDocument Text export 12727@node Tables in ODT export
12112@subsection Tables in ODT export 12728@subsection Tables in ODT export
12113@cindex tables, in ODT export 12729@cindex tables, in ODT export
12114 12730
12115Export of native Org mode tables (@pxref{Tables}) and simple @file{table.el} 12731The ODT export back-end handles native Org mode tables (@pxref{Tables}) and
12116tables is supported. However, export of complex @file{table.el} tables---tables 12732simple @file{table.el} tables. Complex @file{table.el} tables having column
12117that have column or row spans---is not supported. Such tables are 12733or row spans are not supported. Such tables are stripped from the exported
12118stripped from the exported document. 12734document.
12119 12735
12120By default, a table is exported with top and bottom frames and with rules 12736By default, the ODT export back-end exports a table with top and bottom
12121separating row and column groups (@pxref{Column groups}). Furthermore, all 12737frames and with ruled lines separating row and column groups (@pxref{Column
12122tables are typeset to occupy the same width. If the table specifies 12738groups}). All tables are typeset to occupy the same width. The ODT export
12123alignment and relative width for its columns (@pxref{Column width and 12739back-end honors any table alignments and relative widths for columns
12124alignment}) then these are honored on export.@footnote{The column widths are 12740(@pxref{Column width and alignment}).
12125interpreted as weighted ratios with the default weight being 1} 12741
12742Note that the ODT export back-end interprets column widths as weighted
12743ratios, the default weight being 1.
12126 12744
12127@cindex #+ATTR_ODT 12745@cindex #+ATTR_ODT
12128You can control the width of the table by specifying @code{:rel-width}
12129property using an @code{#+ATTR_ODT} line.
12130 12746
12131For example, consider the following table which makes use of all the rules 12747Specifying @code{:rel-width} property on an @code{#+ATTR_ODT} line controls
12132mentioned above. 12748the width of the table. For example:
12133 12749
12134@example 12750@example
12135#+ATTR_ODT: :rel-width 50 12751#+ATTR_ODT: :rel-width 50
@@ -12144,25 +12760,25 @@ mentioned above.
12144| Sum | 16 | 123 | 2560 | 2699 | 12760| Sum | 16 | 123 | 2560 | 2699 |
12145@end example 12761@end example
12146 12762
12147On export, the table will occupy 50% of text area. The columns will be sized 12763On export, the above table takes 50% of text width area. The exporter sizes
12148(roughly) in the ratio of 13:5:5:5:6. The first column will be left-aligned 12764the columns in the ratio: 13:5:5:5:6. The first column is left-aligned and
12149and rest of the columns will be right-aligned. There will be vertical rules 12765rest of the columns, right-aligned. Vertical rules separate the header and
12150after separating the header and last columns from other columns. There will 12766the last column. Horizontal rules separate the header and the last row.
12151be horizontal rules separating the header and last rows from other rows.
12152 12767
12153If you are not satisfied with the above formatting options, you can create 12768For even more customization, create custom table styles and associate them
12154custom table styles and associate them with a table using the 12769with a table using the @code{#+ATTR_ODT} line. @xref{Customizing tables in
12155@code{#+ATTR_ODT} line. @xref{Customizing tables in ODT export}. 12770ODT export}.
12156 12771
12157@node Images in ODT export, Math formatting in ODT export, Tables in ODT export, OpenDocument Text export 12772@node Images in ODT export
12158@subsection Images in ODT export 12773@subsection Images in ODT export
12159@cindex images, embedding in ODT 12774@cindex images, embedding in ODT
12160@cindex embedding images in ODT 12775@cindex embedding images in ODT
12161 12776
12162@subsubheading Embedding images 12777@subsubheading Embedding images
12163You can embed images within the exported document by providing a link to the 12778The ODT export back-end processes image links in Org files that do not have
12164desired image file with no link description. For example, to embed 12779descriptions, such as these links @samp{[[file:img.jpg]]} or
12165@samp{img.png} do either of the following: 12780@samp{[[./img.jpg]]}, as direct image insertions in the final output. Either
12781of these examples works:
12166 12782
12167@example 12783@example
12168[[file:img.png]] 12784[[file:img.png]]
@@ -12173,10 +12789,9 @@ desired image file with no link description. For example, to embed
12173@end example 12789@end example
12174 12790
12175@subsubheading Embedding clickable images 12791@subsubheading Embedding clickable images
12176You can create clickable images by providing a link whose description is a 12792For clickable images, provide a link whose description is another link to an
12177link to an image file. For example, to embed a image 12793image file. For example, to embed a image @file{org-mode-unicorn.png} which
12178@file{org-mode-unicorn.png} which when clicked jumps to 12794when clicked jumps to @uref{http://Orgmode.org} website, do the following
12179@uref{http://Orgmode.org} website, do the following
12180 12795
12181@example 12796@example
12182[[http://orgmode.org][./org-mode-unicorn.png]] 12797[[http://orgmode.org][./org-mode-unicorn.png]]
@@ -12185,25 +12800,22 @@ link to an image file. For example, to embed a image
12185@subsubheading Sizing and scaling of embedded images 12800@subsubheading Sizing and scaling of embedded images
12186 12801
12187@cindex #+ATTR_ODT 12802@cindex #+ATTR_ODT
12188You can control the size and scale of the embedded images using the 12803Control the size and scale of the embedded images with the @code{#+ATTR_ODT}
12189@code{#+ATTR_ODT} attribute. 12804attribute.
12190 12805
12191@cindex identify, ImageMagick 12806@cindex identify, ImageMagick
12192@vindex org-odt-pixels-per-inch 12807@vindex org-odt-pixels-per-inch
12193The exporter specifies the desired size of the image in the final document in 12808The ODT export back-end starts with establishing the size of the image in the
12194units of centimeters. In order to scale the embedded images, the exporter 12809final document. The dimensions of this size is measured in centimeters. The
12195queries for pixel dimensions of the images using one of a) ImageMagick's 12810back-end then queries the image file for its dimensions measured in pixels.
12196@file{identify} program or b) Emacs @code{create-image} and @code{image-size} 12811For this measurement, the back-end relies on ImageMagick's @file{identify}
12197APIs@footnote{Use of @file{ImageMagick} is only desirable. However, if you 12812program or Emacs @code{create-image} and @code{image-size} API. ImageMagick
12198routinely produce documents that have large images or you export your Org 12813is the preferred choice for large file sizes or frequent batch operations.
12199files that has images using a Emacs batch script, then the use of 12814The back-end then converts the pixel dimensions using
12200@file{ImageMagick} is mandatory.}. The pixel dimensions are subsequently 12815@code{org-odt-pixels-per-inch} into the familiar 72 dpi or 96 dpi. The
12201converted in to units of centimeters using 12816default value for this is in @code{display-pixels-per-inch}, which can be
12202@code{org-odt-pixels-per-inch}. The default value of this variable is 12817tweaked for better results based on the capabilities of the output device.
12203set to @code{display-pixels-per-inch}. You can tweak this variable to 12818Here are some common image scaling operations:
12204achieve the best results.
12205
12206The examples below illustrate the various possibilities.
12207 12819
12208@table @asis 12820@table @asis
12209@item Explicitly size the image 12821@item Explicitly size the image
@@ -12244,38 +12856,37 @@ height:width ratio, do the following
12244@subsubheading Anchoring of images 12856@subsubheading Anchoring of images
12245 12857
12246@cindex #+ATTR_ODT 12858@cindex #+ATTR_ODT
12247You can control the manner in which an image is anchored by setting the 12859The ODT export back-end can anchor images to @samp{"as-char"},
12248@code{:anchor} property of it's @code{#+ATTR_ODT} line. You can specify one 12860@samp{"paragraph"}, or @samp{"page"}. Set the preferred anchor using the
12249of the following three values for the @code{:anchor} property: 12861@code{:anchor} property of the @code{#+ATTR_ODT} line.
12250@samp{"as-char"}, @samp{"paragraph"} and @samp{"page"}.
12251 12862
12252To create an image that is anchored to a page, do the following: 12863To create an image that is anchored to a page:
12253@example 12864@example
12254#+ATTR_ODT: :anchor "page" 12865#+ATTR_ODT: :anchor "page"
12255[[./img.png]] 12866[[./img.png]]
12256@end example 12867@end example
12257 12868
12258@node Math formatting in ODT export, Labels and captions in ODT export, Images in ODT export, OpenDocument Text export 12869@node Math formatting in ODT export
12259@subsection Math formatting in ODT export 12870@subsection Math formatting in ODT export
12260 12871
12261The ODT exporter has special support for handling math. 12872The ODT export back-end has special support built-in for handling math.
12262 12873
12263@menu 12874@menu
12264* Working with @LaTeX{} math snippets:: How to embed @LaTeX{} math fragments 12875* Working with @LaTeX{} math snippets:: Embedding in @LaTeX{} format.
12265* Working with MathML or OpenDocument formula files:: How to embed equations in native format 12876* Working with MathML or OpenDocument formula files:: Embedding in native format.
12266@end menu 12877@end menu
12267 12878
12268@node Working with @LaTeX{} math snippets, Working with MathML or OpenDocument formula files, Math formatting in ODT export, Math formatting in ODT export 12879@node Working with @LaTeX{} math snippets
12269@subsubsection Working with @LaTeX{} math snippets 12880@subsubheading Working with @LaTeX{} math snippets
12270 12881
12271@LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be embedded in the ODT 12882@LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be embedded in an ODT
12272document in one of the following ways: 12883document in one of the following ways:
12273 12884
12274@cindex MathML 12885@cindex MathML
12275@enumerate 12886@enumerate
12276@item MathML 12887@item MathML
12277 12888
12278This option is activated on a per-file basis with 12889Add this line to the Org file. This option is activated on a per-file basis.
12279 12890
12280@example 12891@example
12281#+OPTIONS: LaTeX:t 12892#+OPTIONS: LaTeX:t
@@ -12289,13 +12900,13 @@ the exported document.
12289@vindex org-latex-to-mathml-convert-command 12900@vindex org-latex-to-mathml-convert-command
12290@vindex org-latex-to-mathml-jar-file 12901@vindex org-latex-to-mathml-jar-file
12291 12902
12292You can specify the @LaTeX{}-to-MathML converter by customizing the variables 12903To specify the @LaTeX{}-to-MathML converter, customize the variables
12293@code{org-latex-to-mathml-convert-command} and 12904@code{org-latex-to-mathml-convert-command} and
12294@code{org-latex-to-mathml-jar-file}. 12905@code{org-latex-to-mathml-jar-file}.
12295 12906
12296If you prefer to use @file{MathToWeb}@footnote{See 12907To use MathToWeb@footnote{See
12297@uref{http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl, MathToWeb}} as your 12908@uref{http://www.mathtoweb.com/cgi-bin/mathtoweb_home.pl, MathToWeb}.} as the
12298converter, you can configure the above variables as shown below. 12909preferred converter, configure the above variables as
12299 12910
12300@lisp 12911@lisp
12301(setq org-latex-to-mathml-convert-command 12912(setq org-latex-to-mathml-convert-command
@@ -12303,9 +12914,14 @@ converter, you can configure the above variables as shown below.
12303 org-latex-to-mathml-jar-file 12914 org-latex-to-mathml-jar-file
12304 "/path/to/mathtoweb.jar") 12915 "/path/to/mathtoweb.jar")
12305@end lisp 12916@end lisp
12917To use @LaTeX{}ML@footnote{See @uref{http://dlmf.nist.gov/LaTeXML/}.} use
12918@lisp
12919(setq org-latex-to-mathml-convert-command
12920 "latexmlmath \"%i\" --presentationmathml=%o")
12921@end lisp
12306 12922
12307You can use the following commands to quickly verify the reliability of 12923To quickly verify the reliability of the @LaTeX{}-to-MathML converter, use
12308the @LaTeX{}-to-MathML converter. 12924the following commands:
12309 12925
12310@table @kbd 12926@table @kbd
12311@item M-x org-odt-export-as-odf RET 12927@item M-x org-odt-export-as-odf RET
@@ -12317,34 +12933,39 @@ and open the formula file with the system-registered application.
12317@end table 12933@end table
12318 12934
12319@cindex dvipng 12935@cindex dvipng
12936@cindex dvisvgm
12320@cindex imagemagick 12937@cindex imagemagick
12321@item PNG images 12938@item PNG images
12322 12939
12323This option is activated on a per-file basis with 12940Add this line to the Org file. This option is activated on a per-file basis.
12324 12941
12325@example 12942@example
12326#+OPTIONS: tex:dvipng 12943#+OPTIONS: tex:dvipng
12327@end example 12944@end example
12328 12945
12946@example
12947#+OPTIONS: tex:dvisvgm
12948@end example
12949
12329or: 12950or:
12330 12951
12331@example 12952@example
12332#+OPTIONS: tex:imagemagick 12953#+OPTIONS: tex:imagemagick
12333@end example 12954@end example
12334 12955
12335With this option, @LaTeX{} fragments are processed into PNG images and the 12956Under this option, @LaTeX{} fragments are processed into PNG or SVG images
12336resulting images are embedded in the exported document. This method requires 12957and the resulting images are embedded in the exported document. This method
12337that the @file{dvipng} program or @file{imagemagick} suite be available on 12958requires @file{dvipng} program, @file{dvisvgm} or @file{imagemagick}
12338your system. 12959programs.
12339@end enumerate 12960@end enumerate
12340 12961
12341@node Working with MathML or OpenDocument formula files, , Working with @LaTeX{} math snippets, Math formatting in ODT export 12962@node Working with MathML or OpenDocument formula files
12342@subsubsection Working with MathML or OpenDocument formula files 12963@subsubheading Working with MathML or OpenDocument formula files
12343 12964
12344For various reasons, you may find embedding @LaTeX{} math snippets in an 12965When embedding @LaTeX{} math snippets in ODT documents is not reliable, there
12345ODT document less than reliable. In that case, you can embed a 12966is one more option to try. Embed an equation by linking to its MathML
12346math equation by linking to its MathML (@file{.mml}) source or its 12967(@file{.mml}) source or its OpenDocument formula (@file{.odf}) file as shown
12347OpenDocument formula (@file{.odf}) file as shown below: 12968below:
12348 12969
12349@example 12970@example
12350[[./equation.mml]] 12971[[./equation.mml]]
@@ -12356,19 +12977,14 @@ or
12356[[./equation.odf]] 12977[[./equation.odf]]
12357@end example 12978@end example
12358 12979
12359@node Labels and captions in ODT export, Literal examples in ODT export, Math formatting in ODT export, OpenDocument Text export 12980@node Labels and captions in ODT export
12360@subsection Labels and captions in ODT export 12981@subsection Labels and captions in ODT export
12361 12982
12362You can label and caption various category of objects---an inline image, a 12983ODT format handles labeling and captioning of objects based on their
12363table, a @LaTeX{} fragment or a Math formula---using @code{#+LABEL} and 12984types. Inline images, tables, @LaTeX{} fragments, and Math formulas are
12364@code{#+CAPTION} lines. @xref{Images and tables}. ODT exporter enumerates 12985numbered and captioned separately. Each object also gets a unique sequence
12365each labeled or captioned object of a given category separately. As a 12986number based on its order of first appearance in the Org file. Each category
12366result, each such object is assigned a sequence number based on order of it's 12987has its own sequence. A caption is just a label applied to these objects.
12367appearance in the Org file.
12368
12369In the exported document, a user-provided caption is augmented with the
12370category and sequence number. Consider the following inline image in an Org
12371file.
12372 12988
12373@example 12989@example
12374#+CAPTION: Bell curve 12990#+CAPTION: Bell curve
@@ -12376,94 +12992,86 @@ file.
12376[[./img/a.png]] 12992[[./img/a.png]]
12377@end example 12993@end example
12378 12994
12379It could be rendered as shown below in the exported document. 12995When rendered, it may show as follows in the exported document:
12380 12996
12381@example 12997@example
12382Figure 2: Bell curve 12998Figure 2: Bell curve
12383@end example 12999@end example
12384 13000
12385@vindex org-odt-category-map-alist 13001@vindex org-odt-category-map-alist
12386You can modify the category component of the caption by customizing the 13002To modify the category component of the caption, customize the option
12387option @code{org-odt-category-map-alist}. For example, to tag all embedded 13003@code{org-odt-category-map-alist}. For example, to tag embedded images with
12388images with the string @samp{Illustration} (instead of the default 13004the string @samp{Illustration} instead of the default string @samp{Figure},
12389@samp{Figure}) use the following setting: 13005use the following setting:
12390 13006
12391@lisp 13007@lisp
12392(setq org-odt-category-map-alist 13008(setq org-odt-category-map-alist
12393 (("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p))) 13009 '(("__Figure__" "Illustration" "value" "Figure" org-odt--enumerable-image-p)))
12394@end lisp 13010@end lisp
12395 13011
12396With this, previous image will be captioned as below in the exported 13012With the above modification, the previous example changes to:
12397document.
12398 13013
12399@example 13014@example
12400Illustration 2: Bell curve 13015Illustration 2: Bell curve
12401@end example 13016@end example
12402 13017
12403@node Literal examples in ODT export, Advanced topics in ODT export, Labels and captions in ODT export, OpenDocument Text export 13018@node Literal examples in ODT export
12404@subsection Literal examples in ODT export 13019@subsection Literal examples in ODT export
12405 13020
12406Export of literal examples (@pxref{Literal examples}) with full fontification 13021The ODT export back-end supports literal examples (@pxref{Literal examples})
12407is supported. Internally, the exporter relies on @file{htmlfontify.el} to 13022with full fontification. Internally, the ODT export back-end relies on
12408generate all style definitions needed for a fancy listing.@footnote{Your 13023@file{htmlfontify.el} to generate the style definitions needed for fancy
12409@file{htmlfontify.el} library must at least be at Emacs 24.1 levels for 13024listings. The auto-generated styles get @samp{OrgSrc} prefix and inherit
12410fontification to be turned on.} The auto-generated styles have @samp{OrgSrc} 13025colors from the faces used by Emacs @code{font-lock} library for that source
12411as prefix and inherit their color from the faces used by Emacs 13026language.
12412@code{font-lock} library for the source language.
12413 13027
12414@vindex org-odt-fontify-srcblocks 13028@vindex org-odt-fontify-srcblocks
12415If you prefer to use your own custom styles for fontification, you can do 13029For custom fontification styles, customize the
12416so by customizing the option 13030@code{org-odt-create-custom-styles-for-srcblocks} option.
12417@code{org-odt-create-custom-styles-for-srcblocks}.
12418 13031
12419@vindex org-odt-create-custom-styles-for-srcblocks 13032@vindex org-odt-create-custom-styles-for-srcblocks
12420You can turn off fontification of literal examples by customizing the 13033To turn off fontification of literal examples, customize the
12421option @code{org-odt-fontify-srcblocks}. 13034@code{org-odt-fontify-srcblocks} option.
12422 13035
12423@node Advanced topics in ODT export, , Literal examples in ODT export, OpenDocument Text export 13036@node Advanced topics in ODT export
12424@subsection Advanced topics in ODT export 13037@subsection Advanced topics in ODT export
12425 13038
12426If you rely heavily on ODT export, you may want to exploit the full 13039The ODT export back-end has extensive features useful for power users and
12427set of features that the exporter offers. This section describes features 13040frequent uses of ODT formats.
12428that would be of interest to power users.
12429 13041
12430@menu 13042@menu
12431* Configuring a document converter:: How to register a document converter 13043* Configuring a document converter:: Registering a document converter.
12432* Working with OpenDocument style files:: Explore the internals 13044* Working with OpenDocument style files:: Exploring internals.
12433* Creating one-off styles:: How to produce custom highlighting etc 13045* Creating one-off styles:: Customizing styles, highlighting.
12434* Customizing tables in ODT export:: How to define and use Table templates 13046* Customizing tables in ODT export:: Defining table templates.
12435* Validating OpenDocument XML:: How to debug corrupt OpenDocument files 13047* Validating OpenDocument XML:: Debugging corrupted OpenDocument files.
12436@end menu 13048@end menu
12437 13049
12438@node Configuring a document converter, Working with OpenDocument style files, Advanced topics in ODT export, Advanced topics in ODT export 13050@node Configuring a document converter
12439@subsubsection Configuring a document converter 13051@subsubheading Configuring a document converter
12440@cindex convert 13052@cindex convert
12441@cindex doc, docx, rtf 13053@cindex doc, docx, rtf
12442@cindex converter 13054@cindex converter
12443 13055
12444The ODT exporter can work with popular converters with little or no 13056The ODT export back-end works with popular converters with little or no extra
12445extra configuration from your side. @xref{Extending ODT export}. 13057configuration. @xref{Extending ODT export}. The following is for unsupported
12446If you are using a converter that is not supported by default or if you would 13058converters or tweaking existing defaults.
12447like to tweak the default converter settings, proceed as below.
12448 13059
12449@enumerate 13060@enumerate
12450@item Register the converter 13061@item Register the converter
12451 13062
12452@vindex org-odt-convert-processes 13063@vindex org-odt-convert-processes
12453Name your converter and add it to the list of known converters by 13064Add the name of the converter to the @code{org-odt-convert-processes}
12454customizing the option @code{org-odt-convert-processes}. Also specify how 13065variable. Note that it also requires how the converter is invoked on the
12455the converter can be invoked via command-line to effect the conversion. 13066command line. See the variable's docstring for details.
12456 13067
12457@item Configure its capabilities 13068@item Configure its capabilities
12458 13069
12459@vindex org-odt-convert-capabilities 13070@vindex org-odt-convert-capabilities
12460@anchor{x-odt-converter-capabilities} Specify the set of formats the 13071@anchor{x-odt-converter-capabilities} Specify which formats the converter can
12461converter can handle by customizing the variable 13072handle by customizing the variable @code{org-odt-convert-capabilities}. Use
12462@code{org-odt-convert-capabilities}. Use the default value for this 13073the entry for the default values in this variable for configuring the new
12463variable as a guide for configuring your converter. As suggested by the 13074converter. Also see its docstring for details.
12464default setting, you can specify the full set of formats supported by the
12465converter and not limit yourself to specifying formats that are related to
12466just the OpenDocument Text format.
12467 13075
12468@item Choose the converter 13076@item Choose the converter
12469 13077
@@ -12472,18 +13080,17 @@ Select the newly added converter as the preferred one by customizing the
12472option @code{org-odt-convert-process}. 13080option @code{org-odt-convert-process}.
12473@end enumerate 13081@end enumerate
12474 13082
12475@node Working with OpenDocument style files, Creating one-off styles, Configuring a document converter, Advanced topics in ODT export 13083@node Working with OpenDocument style files
12476@subsubsection Working with OpenDocument style files 13084@subsubheading Working with OpenDocument style files
12477@cindex styles, custom 13085@cindex styles, custom
12478@cindex template, custom 13086@cindex template, custom
12479 13087
12480This section explores the internals of the ODT exporter and the 13088This section explores the internals of the ODT exporter; the means by which
12481means by which it produces styled documents. Read this section if you are 13089it produces styled documents; the use of automatic and custom OpenDocument
12482interested in exploring the automatic and custom OpenDocument styles used by 13090styles.
12483the exporter.
12484 13091
12485@anchor{x-factory-styles} 13092@anchor{x-factory-styles}
12486@subsubheading Factory styles 13093@subsubheading a) Factory styles
12487 13094
12488The ODT exporter relies on two files for generating its output. 13095The ODT exporter relies on two files for generating its output.
12489These files are bundled with the distribution under the directory pointed to 13096These files are bundled with the distribution under the directory pointed to
@@ -12524,25 +13131,25 @@ the exporter.
12524 13131
12525@item 13132@item
12526It contains @samp{<text:sequence-decl>}@dots{}@samp{</text:sequence-decl>} 13133It contains @samp{<text:sequence-decl>}@dots{}@samp{</text:sequence-decl>}
12527elements that control how various entities---tables, images, equations, 13134elements that control numbering of tables, images, equations, and similar
12528etc.---are numbered. 13135entities.
12529@end enumerate 13136@end enumerate
12530@end itemize 13137@end itemize
12531 13138
12532@anchor{x-overriding-factory-styles} 13139@anchor{x-overriding-factory-styles}
12533@subsubheading Overriding factory styles 13140@subsubheading b) Overriding factory styles
12534The following two variables control the location from which the ODT 13141The following two variables control the location from where the ODT exporter
12535exporter picks up the custom styles and content template files. You can 13142picks up the custom styles and content template files. Customize these
12536customize these variables to override the factory styles used by the 13143variables to override the factory styles used by the exporter.
12537exporter.
12538 13144
12539@itemize 13145@itemize
12540@anchor{x-org-odt-styles-file} 13146@anchor{x-org-odt-styles-file}
12541@item 13147@item
12542@code{org-odt-styles-file} 13148@code{org-odt-styles-file}
12543 13149
12544Use this variable to specify the @file{styles.xml} that will be used in the 13150The ODT export back-end uses the file pointed to by this variable, such as
12545final output. You can specify one of the following values: 13151@file{styles.xml}, for the final output. It can take one of the following
13152values:
12546 13153
12547@enumerate 13154@enumerate
12548@item A @file{styles.xml} file 13155@item A @file{styles.xml} file
@@ -12576,28 +13183,26 @@ Use this variable to specify the blank @file{content.xml} that will be used
12576in the final output. 13183in the final output.
12577@end itemize 13184@end itemize
12578 13185
12579@node Creating one-off styles, Customizing tables in ODT export, Working with OpenDocument style files, Advanced topics in ODT export 13186@node Creating one-off styles
12580@subsubsection Creating one-off styles 13187@subsubheading Creating one-off styles
12581 13188
12582There are times when you would want one-off formatting in the exported 13189The ODT export back-end can read embedded raw OpenDocument XML from the Org
12583document. You can achieve this by embedding raw OpenDocument XML in the Org 13190file. Such direct formatting are useful for one-off instances.
12584file. The use of this feature is better illustrated with couple of examples.
12585 13191
12586@enumerate 13192@enumerate
12587@item Embedding ODT tags as part of regular text 13193@item Embedding ODT tags as part of regular text
12588 13194
12589You can inline OpenDocument syntax by enclosing it within 13195Enclose OpenDocument syntax in @samp{@@@@odt:...@@@@} for inline markup. For
12590@samp{@@@@odt:...@@@@} markup. For example, to highlight a region of text do 13196example, to highlight a region of text do the following:
12591the following:
12592 13197
12593@example 13198@example
12594@@@@odt:<text:span text:style-name="Highlight">This is a highlighted 13199@@@@odt:<text:span text:style-name="Highlight">This is highlighted
12595text</text:span>@@@@. But this is a regular text. 13200text</text:span>@@@@. But this is regular text.
12596@end example 13201@end example
12597 13202
12598@strong{Hint:} To see the above example in action, edit your 13203@strong{Hint:} To see the above example in action, edit the @file{styles.xml}
12599@file{styles.xml} (@pxref{x-orgodtstyles-xml,,Factory styles}) and add a 13204(@pxref{x-orgodtstyles-xml,,Factory styles}) and add a custom
12600custom @samp{Highlight} style as shown below. 13205@samp{Highlight} style as shown below:
12601 13206
12602@example 13207@example
12603<style:style style:name="Highlight" style:family="text"> 13208<style:style style:name="Highlight" style:family="text">
@@ -12607,8 +13212,8 @@ custom @samp{Highlight} style as shown below.
12607 13212
12608@item Embedding a one-line OpenDocument XML 13213@item Embedding a one-line OpenDocument XML
12609 13214
12610You can add a simple OpenDocument one-liner using the @code{#+ODT:} 13215The ODT export back-end can read one-liner options with @code{#+ODT:}
12611directive. For example, to force a page break do the following: 13216in the Org file. For example, to force a page break:
12612 13217
12613@example 13218@example
12614#+ODT: <text:p text:style-name="PageBreak"/> 13219#+ODT: <text:p text:style-name="PageBreak"/>
@@ -12627,41 +13232,40 @@ custom @samp{PageBreak} style as shown below.
12627 13232
12628@item Embedding a block of OpenDocument XML 13233@item Embedding a block of OpenDocument XML
12629 13234
12630You can add a large block of OpenDocument XML using the 13235The ODT export back-end can also read ODT export blocks for OpenDocument XML.
12631@code{#+BEGIN_ODT}@dots{}@code{#+END_ODT} construct. 13236Such blocks use the @code{#+BEGIN_EXPORT odt}@dots{}@code{#+END_EXPORT}
13237constructs.
12632 13238
12633For example, to create a one-off paragraph that uses bold text, do the 13239For example, to create a one-off paragraph that uses bold text, do the
12634following: 13240following:
12635 13241
12636@example 13242@example
12637#+BEGIN_ODT 13243#+BEGIN_EXPORT odt
12638<text:p text:style-name="Text_20_body_20_bold"> 13244<text:p text:style-name="Text_20_body_20_bold">
12639This paragraph is specially formatted and uses bold text. 13245This paragraph is specially formatted and uses bold text.
12640</text:p> 13246</text:p>
12641#+END_ODT 13247#+END_EXPORT
12642@end example 13248@end example
12643 13249
12644@end enumerate 13250@end enumerate
12645 13251
12646@node Customizing tables in ODT export, Validating OpenDocument XML, Creating one-off styles, Advanced topics in ODT export 13252@node Customizing tables in ODT export
12647@subsubsection Customizing tables in ODT export 13253@subsubheading Customizing tables in ODT export
12648@cindex tables, in ODT export 13254@cindex tables, in ODT export
12649 13255
12650@cindex #+ATTR_ODT 13256@cindex #+ATTR_ODT
12651You can override the default formatting of the table by specifying a custom 13257Override the default table format by specifying a custom table style with the
12652table style with the @code{#+ATTR_ODT} line. For a discussion on default 13258@code{#+ATTR_ODT} line. For a discussion on default formatting of tables
12653formatting of tables @pxref{Tables in ODT export}. 13259@pxref{Tables in ODT export}.
12654 13260
12655This feature closely mimics the way table templates are defined in the 13261This feature closely mimics the way table templates are defined in the
12656OpenDocument-v1.2 13262OpenDocument-v1.2
12657specification.@footnote{@url{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html, 13263specification.@footnote{@url{http://docs.oasis-open.org/office/v1.2/OpenDocument-v1.2.html,
12658OpenDocument-v1.2 Specification}} 13264OpenDocument-v1.2 Specification}}
12659 13265
12660@subsubheading Custom table styles: an illustration
12661
12662@vindex org-odt-table-styles 13266@vindex org-odt-table-styles
12663To have a quick preview of this feature, install the below setting and 13267For quick preview of this feature, install the settings below and export the
12664export the table that follows: 13268table that follows:
12665 13269
12666@lisp 13270@lisp
12667(setq org-odt-table-styles 13271(setq org-odt-table-styles
@@ -12675,22 +13279,20 @@ export the table that follows:
12675@end lisp 13279@end lisp
12676 13280
12677@example 13281@example
12678#+ATTR_ODT: :style "TableWithHeaderRowAndColumn" 13282#+ATTR_ODT: :style TableWithHeaderRowAndColumn
12679| Name | Phone | Age | 13283| Name | Phone | Age |
12680| Peter | 1234 | 17 | 13284| Peter | 1234 | 17 |
12681| Anna | 4321 | 25 | 13285| Anna | 4321 | 25 |
12682@end example 13286@end example
12683 13287
12684In the above example, you used a template named @samp{Custom} and installed 13288The example above used @samp{Custom} template and installed two table styles
12685two table styles with the names @samp{TableWithHeaderRowAndColumn} and 13289@samp{TableWithHeaderRowAndColumn} and @samp{TableWithFirstRowandLastRow}.
12686@samp{TableWithFirstRowandLastRow}. (@strong{Important:} The OpenDocument 13290@strong{Important:} The OpenDocument styles needed for producing the above
12687styles needed for producing the above template have been pre-defined for 13291template were pre-defined. They are available in the section marked
12688you. These styles are available under the section marked @samp{Custom 13292@samp{Custom Table Template} in @file{OrgOdtContentTemplate.xml}
12689Table Template} in @file{OrgOdtContentTemplate.xml} 13293(@pxref{x-orgodtcontenttemplate-xml,,Factory styles}. For adding new
12690(@pxref{x-orgodtcontenttemplate-xml,,Factory styles}). If you need 13294templates, define new styles here.
12691additional templates you have to define these styles yourselves.
12692 13295
12693@subsubheading Custom table styles: the nitty-gritty
12694To use this feature proceed as follows: 13296To use this feature proceed as follows:
12695 13297
12696@enumerate 13298@enumerate
@@ -12698,8 +13300,8 @@ To use this feature proceed as follows:
12698Create a table template@footnote{See the @code{<table:table-template>} 13300Create a table template@footnote{See the @code{<table:table-template>}
12699element of the OpenDocument-v1.2 specification} 13301element of the OpenDocument-v1.2 specification}
12700 13302
12701A table template is nothing but a set of @samp{table-cell} and 13303A table template is set of @samp{table-cell} and @samp{paragraph} styles for
12702@samp{paragraph} styles for each of the following table cell categories: 13304each of the following table cell categories:
12703 13305
12704@itemize @minus 13306@itemize @minus
12705@item Body 13307@item Body
@@ -12809,25 +13411,22 @@ the @code{ATTR_ODT} line as shown below.
12809@end example 13411@end example
12810@end enumerate 13412@end enumerate
12811 13413
12812@node Validating OpenDocument XML, , Customizing tables in ODT export, Advanced topics in ODT export 13414@node Validating OpenDocument XML
12813@subsubsection Validating OpenDocument XML 13415@subsubheading Validating OpenDocument XML
12814
12815Occasionally, you will discover that the document created by the
12816ODT exporter cannot be opened by your favorite application. One of
12817the common reasons for this is that the @file{.odt} file is corrupt. In such
12818cases, you may want to validate the document against the OpenDocument RELAX
12819NG Compact Syntax (RNC) schema.
12820 13416
12821For de-compressing the @file{.odt} file@footnote{@file{.odt} files are 13417Sometimes ODT format files may not open due to @file{.odt} file corruption.
12822nothing but @samp{zip} archives}: @inforef{File Archives,,emacs}. For 13418To verify if the @file{.odt} file is corrupt, validate it against the
12823general help with validation (and schema-sensitive editing) of XML files: 13419OpenDocument RELAX NG Compact Syntax---RNC---schema. But first the
13420@file{.odt} files have to be decompressed using @samp{zip}. Note that
13421@file{.odt} files are @samp{zip} archives: @inforef{File Archives,,emacs}.
13422The contents of @file{.odt} files are in @file{.xml}. For general help with
13423validation---and schema-sensitive editing---of XML files:
12824@inforef{Introduction,,nxml-mode}. 13424@inforef{Introduction,,nxml-mode}.
12825 13425
12826@vindex org-odt-schema-dir 13426@vindex org-odt-schema-dir
12827If you have ready access to OpenDocument @file{.rnc} files and the needed 13427Customize @code{org-odt-schema-dir} to point to a directory with OpenDocument
12828schema-locating rules in a single folder, you can customize the variable 13428@file{.rnc} files and the needed schema-locating rules. The ODT export
12829@code{org-odt-schema-dir} to point to that directory. The ODT exporter 13429back-end takes care of updating the @code{rng-schema-locating-files}.
12830will take care of updating the @code{rng-schema-locating-files} for you.
12831 13430
12832@c end opendocument 13431@c end opendocument
12833 13432
@@ -12836,102 +13435,146 @@ will take care of updating the @code{rng-schema-locating-files} for you.
12836@cindex Org export 13435@cindex Org export
12837 13436
12838@code{org} export back-end creates a normalized version of the Org document 13437@code{org} export back-end creates a normalized version of the Org document
12839in current buffer. In particular, it evaluates Babel code (@pxref{Evaluating 13438in current buffer. The exporter evaluates Babel code (@pxref{Evaluating code
12840code blocks}) and removes other back-ends specific contents. 13439blocks}) and removes content specific to other back-ends.
12841 13440
12842@subheading Org export commands 13441@subheading Org export commands
12843 13442
12844@table @kbd 13443@table @kbd
12845@orgcmd{C-c C-e O o,org-org-export-to-org} 13444@orgcmd{C-c C-e O o,org-org-export-to-org}
12846Export as an Org document. For an Org file, @file{myfile.org}, the resulting 13445Export as an Org file with a @file{.org} extension. For @file{myfile.org},
12847file will be @file{myfile.org.org}. The file will be overwritten without 13446Org exports to @file{myfile.org.org}, overwriting without warning.
12848warning. 13447
12849@orgcmd{C-c C-e O O,org-org-export-as-org} 13448@orgcmd{C-c C-e O O,org-org-export-as-org}
12850Export to a temporary buffer. Do not create a file. 13449Export to a temporary buffer. Does not create a file.
12851@item C-c C-e O v 13450@item C-c C-e O v
12852Export to an Org file, then open it. 13451Export to an Org file, then open it.
12853@end table 13452@end table
12854 13453
12855@node Texinfo export, iCalendar export, Org export, Exporting 13454@node Texinfo export
12856@section Texinfo export 13455@section Texinfo export
12857@cindex Texinfo export 13456@cindex Texinfo export
12858 13457
12859@samp{texinfo} export back-end generates Texinfo code and can compile it into 13458The @samp{texinfo} export back-end generates documents with Texinfo code that
12860an Info file. 13459can compile to Info format.
12861 13460
12862@menu 13461@menu
12863* Texinfo export commands:: How to invoke Texinfo export 13462* Texinfo export commands:: Invoking commands.
12864* Document preamble:: File header, title and copyright page 13463* Texinfo specific export settings:: Setting the environment.
12865* Headings and sectioning structure:: Building document structure 13464* Texinfo file header:: Generating the header.
12866* Indices:: Creating indices 13465* Texinfo title and copyright page:: Creating preamble pages.
12867* Quoting Texinfo code:: Incorporating literal Texinfo code 13466* Info directory file:: Installing a manual in Info file hierarchy.
12868* Texinfo specific attributes:: Controlling Texinfo output 13467* Headings and sectioning structure:: Building document structure.
12869* An example:: 13468* Indices:: Creating indices.
13469* Quoting Texinfo code:: Incorporating literal Texinfo code.
13470* Plain lists in Texinfo export:: List attributes.
13471* Tables in Texinfo export:: Table attributes.
13472* Images in Texinfo export:: Image attributes.
13473* Special blocks in Texinfo export:: Special block attributes.
13474* A Texinfo example:: Processing Org to Texinfo.
12870@end menu 13475@end menu
12871 13476
12872@node Texinfo export commands, Document preamble, Texinfo export, Texinfo export 13477@node Texinfo export commands
12873@subsection Texinfo export commands 13478@subsection Texinfo export commands
12874 13479
12875@vindex org-texinfo-info-process 13480@vindex org-texinfo-info-process
12876@table @kbd 13481@table @kbd
12877@orgcmd{C-c C-e i t,org-texinfo-export-to-texinfo} 13482@orgcmd{C-c C-e i t,org-texinfo-export-to-texinfo}
12878Export as a Texinfo file. For an Org file, @file{myfile.org}, the resulting 13483Export as a Texinfo file with @file{.texi} extension. For @file{myfile.org},
12879file will be @file{myfile.texi}. The file will be overwritten without 13484Org exports to @file{myfile.texi}, overwriting without warning.
12880warning.
12881@orgcmd{C-c C-e i i,org-texinfo-export-to-info} 13485@orgcmd{C-c C-e i i,org-texinfo-export-to-info}
12882Export to Texinfo and then process to an Info file@footnote{By setting 13486Export to Texinfo format first and then process it to make an Info file. To
12883@code{org-texinfo-info-process}, it is possible to generate other formats, 13487generate other formats, such as DocBook, customize the
12884including DocBook.}. 13488@code{org-texinfo-info-process} variable.
12885@end table 13489@end table
12886 13490
12887@node Document preamble, Headings and sectioning structure, Texinfo export commands, Texinfo export 13491@node Texinfo specific export settings
12888@subsection Document preamble 13492@subsection Texinfo specific export settings
13493The Texinfo export back-end has several additional keywords for customizing
13494Texinfo output. Setting these keywords works similar to the general options
13495(@pxref{Export settings}).
13496
13497@table @samp
12889 13498
12890When processing a document, @samp{texinfo} back-end generates a minimal file 13499@item SUBTITLE
12891header along with a title page, a copyright page, and a menu. You control 13500@cindex #+SUBTITLE (Texinfo)
12892the latter through the structure of the document (@pxref{Headings and 13501The document subtitle.
12893sectioning structure}). Various keywords allow you to tweak the other parts.
12894It is also possible to give directions to install the document in the
12895@samp{Top} node.
12896 13502
12897@subsubheading File header 13503@item SUBAUTHOR
13504@cindex #+SUBAUTHOR
13505The document subauthor.
12898 13506
13507@item TEXINFO_FILENAME
12899@cindex #+TEXINFO_FILENAME 13508@cindex #+TEXINFO_FILENAME
12900Upon creating the header of a Texinfo file, the back-end guesses a name for 13509The Texinfo filename.
12901the Info file to be compiled. This may not be a sensible choice, e.g., if 13510
12902you want to produce the final document in a different directory. Specify an 13511@item TEXINFO_CLASS
12903alternate path with @code{#+TEXINFO_FILENAME} keyword to override the default 13512@cindex #+TEXINFO_CLASS
12904destination. 13513@vindex org-texinfo-default-class
13514The default document class (@code{org-texinfo-default-class}), which must be
13515a member of @code{org-texinfo-classes}.
13516
13517@item TEXINFO_HEADER
13518@cindex #+TEXINFO_HEADER
13519Arbitrary lines inserted at the end of the header.
13520
13521@item TEXINFO_POST_HEADER
13522@cindex #+TEXINFO_POST_HEADER
13523Arbitrary lines inserted after the end of the header.
13524
13525@item TEXINFO_DIR_CATEGORY
13526@cindex #+TEXINFO_DIR_CATEGORY
13527The directory category of the document.
13528
13529@item TEXINFO_DIR_TITLE
13530@cindex #+TEXINFO_DIR_TITLE
13531The directory title of the document.
13532
13533@item TEXINFO_DIR_DESC
13534@cindex #+TEXINFO_DIR_DESC
13535The directory description of the document.
13536
13537@item TEXINFO_PRINTED_TITLE
13538@cindex #+TEXINFO_PRINTED_TITLE
13539The printed title of the document.
13540@end table
13541
13542@node Texinfo file header
13543@subsection Texinfo file header
13544
13545@cindex #+TEXINFO_FILENAME
13546After creating the header for a Texinfo file, the Texinfo back-end
13547automatically generates a name and destination path for the Info file. To
13548override this default with a more sensible path and name, specify the
13549@code{#+TEXINFO_FILENAME} keyword.
12905 13550
12906@vindex org-texinfo-coding-system 13551@vindex org-texinfo-coding-system
12907@vindex org-texinfo-classes 13552@vindex org-texinfo-classes
12908@cindex #+TEXINFO_HEADER 13553@cindex #+TEXINFO_HEADER
12909@cindex #+TEXINFO_CLASS 13554@cindex #+TEXINFO_CLASS
12910Along with the output file name, the header contains information about the 13555Along with the output's file name, the Texinfo header also contains language
12911language (@pxref{Export settings}) and current encoding used@footnote{See 13556details (@pxref{Export settings}) and encoding system as set in the
12912@code{org-texinfo-coding-system} for more information.}. Insert 13557@code{org-texinfo-coding-system} variable. Insert @code{#+TEXINFO_HEADER}
12913a @code{#+TEXINFO_HEADER} keyword for each additional command needed, e.g., 13558keywords for each additional command in the header, for example:
12914@@code@{@@synindex@}. 13559@@code@{@@synindex@}.
12915 13560
12916If you happen to regularly install the same set of commands, it may be easier 13561Instead of repeatedly installing the same set of commands, define a class in
12917to define your own class in @code{org-texinfo-classes}, which see. Set 13562@code{org-texinfo-classes} once, and then activate it in the document by
12918@code{#+TEXINFO_CLASS} keyword accordingly in your document to activate it. 13563setting the @code{#+TEXINFO_CLASS} keyword to that class.
12919 13564
12920@subsubheading Title and copyright page 13565@node Texinfo title and copyright page
13566@subsection Texinfo title and copyright page
12921 13567
12922@cindex #+TEXINFO_PRINTED_TITLE 13568@cindex #+TEXINFO_PRINTED_TITLE
12923@cindex #+SUBTITLE 13569The default template for hard copy output has a title page with
12924The default template includes a title page for hard copy output. The title 13570@code{#+TITLE} and @code{#+AUTHOR} (@pxref{Export settings}). To replace the
12925and author displayed on this page are extracted from, respectively, 13571regular @code{#+TITLE} with something different for the printed version, use
12926@code{#+TITLE} and @code{#+AUTHOR} keywords (@pxref{Export settings}). It is 13572the @code{#+TEXINFO_PRINTED_TITLE} and @code{#+SUBTITLE} keywords. Both
12927also possible to print a different, more specific, title with 13573expect raw Texinfo code for setting their values.
12928@code{#+TEXINFO_PRINTED_TITLE} keyword, and add subtitles with
12929@code{#+SUBTITLE} keyword. Both expect raw Texinfo code in their value.
12930 13574
12931@cindex #+SUBAUTHOR 13575@cindex #+SUBAUTHOR
12932Likewise, information brought by @code{#+AUTHOR} may not be enough. You can 13576If one @code{#+AUTHOR} is not sufficient, add multiple @code{#+SUBAUTHOR}
12933include other authors with several @code{#+SUBAUTHOR} keywords. Values are 13577keywords. They have to be set in raw Texinfo code.
12934also expected to be written in Texinfo code.
12935 13578
12936@example 13579@example
12937#+AUTHOR: Jane Smith 13580#+AUTHOR: Jane Smith
@@ -12940,10 +13583,10 @@ also expected to be written in Texinfo code.
12940@end example 13583@end example
12941 13584
12942@cindex property, COPYING 13585@cindex property, COPYING
12943Copying material is defined in a dedicated headline with a non-nil 13586Copying material is defined in a dedicated headline with a non-@code{nil}
12944@code{:COPYING:} property. The contents are inserted within 13587@code{:COPYING:} property. The back-end inserts the contents within a
12945a @code{@@copying} command at the beginning of the document whereas the 13588@code{@@copying} command at the beginning of the document. The heading
12946heading itself does not appear in the structure of the document. 13589itself does not appear in the structure of the document.
12947 13590
12948Copyright information is printed on the back of the title page. 13591Copyright information is printed on the back of the title page.
12949 13592
@@ -12955,20 +13598,28 @@ Copyright information is printed on the back of the title page.
12955 13598
12956 This is a short example of a complete Texinfo file, version 1.0. 13599 This is a short example of a complete Texinfo file, version 1.0.
12957 13600
12958 Copyright \copy 2017 Free Software Foundation, Inc. 13601 Copyright \copy 2016 Free Software Foundation, Inc.
12959@end example 13602@end example
12960 13603
12961@subsubheading The Top node 13604@node Info directory file
13605@subsection Info directory file
13606@cindex @samp{dir} file, in Texinfo export
13607@cindex Texinfo export, @samp{dir} file
13608@cindex Info directory file, in Texinfo export
13609@cindex Texinfo export, Info directory file
13610@cindex @code{install-info} parameters, in Texinfo export
13611@cindex Texinfo export, @code{install-info} parameters
12962 13612
12963@cindex #+TEXINFO_DIR_CATEGORY 13613@cindex #+TEXINFO_DIR_CATEGORY
12964@cindex #+TEXINFO_DIR_TITLE 13614@cindex #+TEXINFO_DIR_TITLE
12965@cindex #+TEXINFO_DIR_DESC 13615@cindex #+TEXINFO_DIR_DESC
12966You may ultimately want to install your new Info file to your system. You 13616The end result of the Texinfo export process is the creation of an Info file.
12967can write an appropriate entry in the top level directory specifying its 13617This Info file's metadata has variables for category, title, and description:
12968category and title with, respectively, @code{#+TEXINFO_DIR_CATEGORY} and 13618@code{#+TEXINFO_DIR_CATEGORY}, @code{#+TEXINFO_DIR_TITLE}, and
12969@code{#+TEXINFO_DIR_TITLE}. Optionally, you can add a short description 13619@code{#+TEXINFO_DIR_DESC} that establish where in the Info hierarchy the file
12970using @code{#+TEXINFO_DIR_DESC}. The following example would write an entry 13620fits.
12971similar to Org's in the @samp{Top} node. 13621
13622Here is an example that writes to the Info directory file:
12972 13623
12973@example 13624@example
12974#+TEXINFO_DIR_CATEGORY: Emacs 13625#+TEXINFO_DIR_CATEGORY: Emacs
@@ -12976,34 +13627,38 @@ similar to Org's in the @samp{Top} node.
12976#+TEXINFO_DIR_DESC: Outline-based notes management and organizer 13627#+TEXINFO_DIR_DESC: Outline-based notes management and organizer
12977@end example 13628@end example
12978 13629
12979@node Headings and sectioning structure, Indices, Document preamble, Texinfo export 13630@node Headings and sectioning structure
12980@subsection Headings and sectioning structure 13631@subsection Headings and sectioning structure
12981 13632
12982@vindex org-texinfo-classes 13633@vindex org-texinfo-classes
12983@vindex org-texinfo-default-class 13634@vindex org-texinfo-default-class
12984@cindex #+TEXINFO_CLASS 13635@cindex #+TEXINFO_CLASS
12985@samp{texinfo} uses a pre-defined scheme, or class, to convert headlines into 13636The Texinfo export back-end uses a pre-defined scheme to convert Org
12986Texinfo structuring commands. For example, a top level headline appears as 13637headlines to an equivalent Texinfo structuring commands. A scheme like this
12987@code{@@chapter} if it should be numbered or as @code{@@unnumbered} 13638maps top-level headlines to numbered chapters tagged as @code{@@chapter} and
12988otherwise. If you need to use a different set of commands, e.g., to start 13639lower-level headlines to unnumbered chapters tagged as @code{@@unnumbered}.
12989with @code{@@part} instead of @code{@@chapter}, install a new class in 13640To override such mappings to introduce @code{@@part} or other Texinfo
12990@code{org-texinfo-classes}, then activate it with @code{#+TEXINFO_CLASS} 13641structuring commands, define a new class in @code{org-texinfo-classes}.
12991keyword. Export process defaults to @code{org-texinfo-default-class} when 13642Activate the new class with the @code{#+TEXINFO_CLASS} keyword. When no new
12992there is no such keyword in the document. 13643class is defined and activated, the Texinfo export back-end defaults to the
12993 13644@code{org-texinfo-default-class}.
12994If a headline's level has no associated structuring command, or is below 13645
12995a certain threshold @pxref{Export settings}, that headline becomes a list in 13646If an Org headline's level has no associated Texinfo structuring command, or
12996Texinfo output. 13647is below a certain threshold (@pxref{Export settings}), then the Texinfo
13648export back-end makes it into a list item.
12997 13649
12998@cindex property, APPENDIX 13650@cindex property, APPENDIX
12999As an exception, a headline with a non-nil @code{:APPENDIX:} property becomes 13651The Texinfo export back-end makes any headline with a non-@code{nil}
13000an appendix, independently on its level and the class used. 13652@code{:APPENDIX:} property into an appendix. This happens independent of the
13653Org headline level or the @code{#+TEXINFO_CLASS}.
13001 13654
13002@cindex property, DESCRIPTION 13655@cindex property, DESCRIPTION
13003Each regular sectioning structure creates a menu entry, named after the 13656The Texinfo export back-end creates a menu entry after the Org headline for
13004heading. You can provide a different, e.g., shorter, title in 13657each regular sectioning structure. To override this with a shorter menu
13005@code{:ALT_TITLE:} property (@pxref{Table of contents}). Optionally, you can 13658entry, use the @code{:ALT_TITLE:} property (@pxref{Table of contents}).
13006specify a description for the item in @code{:DESCRIPTION:} property. E.g., 13659Texinfo menu entries also have an option for a longer @code{:DESCRIPTION:}
13660property. Here's an example that uses both to override the default menu
13661entry:
13007 13662
13008@example 13663@example
13009* Controlling Screen Display 13664* Controlling Screen Display
@@ -13013,30 +13668,51 @@ specify a description for the item in @code{:DESCRIPTION:} property. E.g.,
13013 :END: 13668 :END:
13014@end example 13669@end example
13015 13670
13016@node Indices, Quoting Texinfo code, Headings and sectioning structure, Texinfo export 13671@cindex The Top node, in Texinfo export
13672@cindex Texinfo export, Top node
13673The text before the first headline belongs to the @samp{Top} node, i.e., the
13674node in which a reader enters an Info manual. As such, it is expected not to
13675appear in printed output generated from the @file{.texi} file. @inforef{The
13676Top Node,,texinfo}, for more information.
13677
13678@node Indices
13017@subsection Indices 13679@subsection Indices
13018 13680
13019@cindex #+CINDEX 13681@cindex #+CINDEX
13682@cindex concept index, in Texinfo export
13683@cindex Texinfo export, index, concept
13020@cindex #+FINDEX 13684@cindex #+FINDEX
13685@cindex function index, in Texinfo export
13686@cindex Texinfo export, index, function
13021@cindex #+KINDEX 13687@cindex #+KINDEX
13688@cindex keystroke index, in Texinfo export
13689@cindex Texinfo export, keystroke index
13022@cindex #+PINDEX 13690@cindex #+PINDEX
13691@cindex program index, in Texinfo export
13692@cindex Texinfo export, program index
13023@cindex #+TINDEX 13693@cindex #+TINDEX
13694@cindex data type index, in Texinfo export
13695@cindex Texinfo export, data type index
13024@cindex #+VINDEX 13696@cindex #+VINDEX
13025Index entries are created using dedicated keywords. @samp{texinfo} back-end 13697@cindex variable index, in Texinfo export
13026provides one for each predefined type: @code{#+CINDEX}, @code{#+FINDEX}, 13698@cindex Texinfo export, variable index
13027@code{#+KINDEX}, @code{#+PINDEX}, @code{#+TINDEX} and @code{#+VINDEX}. For 13699The Texinfo export back-end recognizes these indexing keywords if used in the
13028custom indices, you can write raw Texinfo code (@pxref{Quoting Texinfo 13700Org file: @code{#+CINDEX}, @code{#+FINDEX}, @code{#+KINDEX}, @code{#+PINDEX},
13029code}). 13701@code{#+TINDEX}, and @code{#+VINDEX}. Write their value as verbatim Texinfo
13702code; in particular, @samp{@{}, @samp{@}} and @samp{@@} characters need to be
13703escaped with @samp{@@} if they not belong to a Texinfo command.
13030 13704
13031@example 13705@example
13032#+CINDEX: Defining indexing entries 13706#+CINDEX: Defining indexing entries
13033@end example 13707@end example
13034 13708
13035@cindex property, INDEX 13709@cindex property, INDEX
13036To generate an index, you need to set the @code{:INDEX:} property of 13710For the back-end to generate an index entry for a headline, set the
13037a headline to an appropriate abbreviation (e.g., @samp{cp} or @samp{vr}). 13711@code{:INDEX:} property to @samp{cp} or @samp{vr}. These abbreviations come
13038The headline is then exported as an unnumbered chapter or section command and 13712from Texinfo that stand for concept index and variable index. The Texinfo
13039the index is inserted after its contents. 13713manual has abbreviations for all other kinds of indexes. The back-end
13714exports the headline as an unnumbered chapter or section command, and then
13715inserts the index after its contents.
13040 13716
13041@example 13717@example
13042* Concept Index 13718* Concept Index
@@ -13045,78 +13721,115 @@ the index is inserted after its contents.
13045 :END: 13721 :END:
13046@end example 13722@end example
13047 13723
13048@node Quoting Texinfo code, Texinfo specific attributes, Indices, Texinfo export 13724@node Quoting Texinfo code
13049@subsection Quoting Texinfo code 13725@subsection Quoting Texinfo code
13050 13726
13051It is possible to insert raw Texinfo code using any of the following 13727Use any of the following three methods to insert or escape raw Texinfo code:
13052constructs
13053 13728
13054@cindex #+TEXINFO 13729@cindex #+TEXINFO
13055@cindex #+BEGIN_TEXINFO 13730@cindex #+BEGIN_EXPORT texinfo
13056@example 13731@example
13057Richard @@@@texinfo:@@sc@{@@@@Stallman@@@@texinfo:@}@@@@ commence' GNU. 13732Richard @@@@texinfo:@@sc@{@@@@Stallman@@@@texinfo:@}@@@@ commence' GNU.
13058 13733
13059#+TEXINFO: @@need800 13734#+TEXINFO: @@need800
13060This paragraph is preceded by... 13735This paragraph is preceded by...
13061 13736
13062#+BEGIN_TEXINFO 13737#+BEGIN_EXPORT texinfo
13063@@auindex Johnson, Mark 13738@@auindex Johnson, Mark
13064@@auindex Lakoff, George 13739@@auindex Lakoff, George
13065#+END_TEXINFO 13740#+END_EXPORT
13066@end example 13741@end example
13067 13742
13068@node Texinfo specific attributes, An example, Quoting Texinfo code, Texinfo export 13743@node Plain lists in Texinfo export
13069@subsection Texinfo specific attributes 13744@subsection Plain lists in Texinfo export
13070 13745@cindex #+ATTR_TEXINFO, in plain lists
13071@cindex #+ATTR_TEXINFO 13746The Texinfo export back-end by default converts description lists in the Org
13072@samp{texinfo} back-end understands several attributes in plain lists and 13747file using the default command @code{@@table}, which results in a table with
13073tables. They must be specified using an @code{#+ATTR_TEXINFO} keyword, 13748two columns. To change this behavior, specify @code{:table-type} with
13074written just above the list or table. 13749@code{@@ftable} or @code{@@vtable} attributes. For more information,
13075 13750@inforef{Two-column Tables,,texinfo}.
13076@subsubheading Plain lists
13077
13078In Texinfo output, description lists appear as two-column tables, using the
13079default command @code{@@table}. You can use @code{@@ftable} or
13080@code{@@vtable}@footnote{For more information, @inforef{Two-column
13081Tables,,texinfo}.} instead with @code{:table-type} attribute.
13082 13751
13083@vindex org-texinfo-def-table-markup 13752@vindex org-texinfo-def-table-markup
13084In any case, these constructs require a highlighting command for entries in 13753The Texinfo export back-end by default also applies a text highlight based on
13085the list. You can provide one with @code{:indic} attribute. If you do not, 13754the defaults stored in @code{org-texinfo-def-table-markup}. To override the
13086it defaults to the value stored in @code{org-texinfo-def-table-markup}, which 13755default highlight command, specify another one with the @code{:indic}
13087see. 13756attribute as shown in this example:
13088 13757
13089@example 13758@example
13090#+ATTR_TEXINFO: :indic @@asis 13759#+ATTR_TEXINFO: :indic @@asis
13091- foo :: This is the text for /foo/, with no highlighting. 13760- foo :: This is the text for /foo/, with no highlighting.
13092@end example 13761@end example
13093 13762
13094@subsubheading Tables 13763@node Tables in Texinfo export
13764@subsection Tables in Texinfo export
13765@cindex #+ATTR_TEXINFO, in tables
13095 13766
13096When exporting a table, column widths are deduced from the longest cell in 13767When exporting tables, the Texinfo export back-end uses the widest cell width
13097each column. You can also define them explicitly as fractions of the line 13768in each column. To override this and instead specify as fractions of line
13098length, using @code{:columns} attribute. 13769length, use the @code{:columns} attribute. See example below.
13099 13770
13100@example 13771@example
13101#+ATTR_TEXINFO: :columns .5 .5 13772#+ATTR_TEXINFO: :columns .5 .5
13102| a cell | another cell | 13773| a cell | another cell |
13103@end example 13774@end example
13104 13775
13105@node An example, , Texinfo specific attributes, Texinfo export 13776@node Images in Texinfo export
13106@subsection An example 13777@subsection Images in Texinfo export
13778@cindex #+ATTR_TEXINFO, in images
13107 13779
13108Here is a thorough example, taken from @inforef{GNU Sample Texts,,texinfo}. 13780Insert a file link to the image in the Org file, and the Texinfo export
13781back-end inserts the image. These links must have the usual supported image
13782extensions and no descriptions. To scale the image, use @code{:width} and
13783@code{:height} attributes. For alternate text, use @code{:alt} and specify
13784the text using Texinfo code, as shown in the example:
13109 13785
13110@smallexample 13786@example
13111#+MACRO: version 2.0 13787#+ATTR_TEXINFO: :width 1in :alt Alternate @@i@{text@}
13112#+MACRO: updated last updated 4 March 2014 13788[[ridt.pdf]]
13789@end example
13113 13790
13114#+OPTIONS: ':t toc:t author:t email:t 13791@node Special blocks in Texinfo export
13792@subsection Special blocks
13793@cindex #+ATTR_TEXINFO, in special blocks
13794
13795The Texinfo export back-end converts special blocks to commands with the same
13796name. It also adds any @code{:options} attributes to the end of the command,
13797as shown in this example:
13798
13799@example
13800#+ATTR_TEXINFO: :options org-org-export-to-org ...
13801#+begin_defun
13802A somewhat obsessive function.
13803#+end_defun
13804@end example
13805
13806@noindent
13807becomes
13808
13809@example
13810@@defun org-org-export-to-org ...
13811A somewhat obsessive function.
13812@@end defun
13813@end example
13814
13815@node A Texinfo example
13816@subsection A Texinfo example
13817
13818Here is a more detailed example Org file. @inforef{GNU Sample
13819Texts,,texinfo} for an equivalent example using Texinfo code.
13820
13821@example
13115#+TITLE: GNU Sample @{@{@{version@}@}@} 13822#+TITLE: GNU Sample @{@{@{version@}@}@}
13823#+SUBTITLE: for version @{@{@{version@}@}@}, @{@{@{updated@}@}@}
13116#+AUTHOR: A.U. Thor 13824#+AUTHOR: A.U. Thor
13117#+EMAIL: bug-sample@@gnu.org 13825#+EMAIL: bug-sample@@gnu.org
13826
13827#+OPTIONS: ':t toc:t author:t email:t
13118#+LANGUAGE: en 13828#+LANGUAGE: en
13119 13829
13830#+MACRO: version 2.0
13831#+MACRO: updated last updated 4 March 2014
13832
13120#+TEXINFO_FILENAME: sample.info 13833#+TEXINFO_FILENAME: sample.info
13121#+TEXINFO_HEADER: @@syncodeindex pg cp 13834#+TEXINFO_HEADER: @@syncodeindex pg cp
13122 13835
@@ -13125,7 +13838,9 @@ Here is a thorough example, taken from @inforef{GNU Sample Texts,,texinfo}.
13125#+TEXINFO_DIR_DESC: Invoking sample 13838#+TEXINFO_DIR_DESC: Invoking sample
13126 13839
13127#+TEXINFO_PRINTED_TITLE: GNU Sample 13840#+TEXINFO_PRINTED_TITLE: GNU Sample
13128#+SUBTITLE: for version 2.0, last updated 4 March 2014 13841
13842This manual is for GNU Sample (version @{@{@{version@}@}@},
13843@{@{@{updated@}@}@}).
13129 13844
13130* Copying 13845* Copying
13131 :PROPERTIES: 13846 :PROPERTIES:
@@ -13135,8 +13850,7 @@ Here is a thorough example, taken from @inforef{GNU Sample Texts,,texinfo}.
13135 This manual is for GNU Sample (version @{@{@{version@}@}@}, 13850 This manual is for GNU Sample (version @{@{@{version@}@}@},
13136 @{@{@{updated@}@}@}), which is an example in the Texinfo documentation. 13851 @{@{@{updated@}@}@}), which is an example in the Texinfo documentation.
13137 13852
13138 Copyright @@@@texinfo:@@copyright@{@}@@@@ 2013 Free Software Foundation, 13853 Copyright \copy 2016 Free Software Foundation, Inc.
13139 Inc.
13140 13854
13141 #+BEGIN_QUOTE 13855 #+BEGIN_QUOTE
13142 Permission is granted to copy, distribute and/or modify this 13856 Permission is granted to copy, distribute and/or modify this
@@ -13167,9 +13881,9 @@ Here is a thorough example, taken from @inforef{GNU Sample Texts,,texinfo}.
13167 :PROPERTIES: 13881 :PROPERTIES:
13168 :INDEX: cp 13882 :INDEX: cp
13169 :END: 13883 :END:
13170@end smallexample 13884@end example
13171 13885
13172@node iCalendar export, Other built-in back-ends, Texinfo export, Exporting 13886@node iCalendar export
13173@section iCalendar export 13887@section iCalendar export
13174@cindex iCalendar export 13888@cindex iCalendar export
13175 13889
@@ -13178,49 +13892,51 @@ Here is a thorough example, taken from @inforef{GNU Sample Texts,,texinfo}.
13178@vindex org-icalendar-use-scheduled 13892@vindex org-icalendar-use-scheduled
13179@vindex org-icalendar-categories 13893@vindex org-icalendar-categories
13180@vindex org-icalendar-alarm-time 13894@vindex org-icalendar-alarm-time
13181Some people use Org mode for keeping track of projects, but still prefer a 13895A large part of Org mode's inter-operability success is its ability to easily
13182standard calendar application for anniversaries and appointments. In this 13896export to or import from external applications. The iCalendar export
13183case it can be useful to show deadlines and other time-stamped items in Org 13897back-end takes calendar data from Org files and exports to the standard
13184files in the calendar application. Org mode can export calendar information 13898iCalendar format.
13185in the standard iCalendar format. If you also want to have TODO entries 13899
13186included in the export, configure the variable 13900The iCalendar export back-end can also incorporate TODO entries based on the
13187@code{org-icalendar-include-todo}. Plain timestamps are exported as VEVENT, 13901configuration of the @code{org-icalendar-include-todo} variable. The
13188and TODO items as VTODO@. It will also create events from deadlines that are 13902back-end exports plain timestamps as VEVENT, TODO items as VTODO, and also
13189in non-TODO items. Deadlines and scheduling dates in TODO items will be used 13903create events from deadlines that are in non-TODO items. The back-end uses
13190to set the start and due dates for the TODO entry@footnote{See the variables 13904the deadlines and scheduling dates in Org TODO items for setting the start
13191@code{org-icalendar-use-deadline} and @code{org-icalendar-use-scheduled}.}. 13905and due dates for the iCalendar TODO entry. Consult the
13192As categories, it will use the tags locally defined in the heading, and the 13906@code{org-icalendar-use-deadline} and @code{org-icalendar-use-scheduled}
13193file/tree category@footnote{To add inherited tags or the TODO state, 13907variables for more details.
13194configure the variable @code{org-icalendar-categories}.}. See the variable 13908
13195@code{org-icalendar-alarm-time} for a way to assign alarms to entries with a 13909For tags on the headline, the iCalendar export back-end makes them into
13196time. 13910iCalendar categories. To tweak the inheritance of tags and TODO states,
13911configure the variable @code{org-icalendar-categories}. To assign clock
13912alarms based on time, configure the @code{org-icalendar-alarm-time} variable.
13197 13913
13198@vindex org-icalendar-store-UID 13914@vindex org-icalendar-store-UID
13199@cindex property, ID 13915@cindex property, ID
13200The iCalendar standard requires each entry to have a globally unique 13916The iCalendar format standard requires globally unique identifier---UID---for
13201identifier (UID). Org creates these identifiers during export. If you set 13917each entry. The iCalendar export back-end creates UIDs during export. To
13202the variable @code{org-icalendar-store-UID}, the UID will be stored in the 13918save a copy of the UID in the Org file set the variable
13203@code{:ID:} property of the entry and re-used next time you report this 13919@code{org-icalendar-store-UID}. The back-end looks for the @code{:ID:}
13204entry. Since a single entry can give rise to multiple iCalendar entries (as 13920property of the entry for re-using the same UID for subsequent exports.
13205a timestamp, a deadline, a scheduled item, and as a TODO item), Org adds 13921
13206prefixes to the UID, depending on what triggered the inclusion of the entry. 13922Since a single Org entry can result in multiple iCalendar entries---as
13207In this way the UID remains unique, but a synchronization program can still 13923timestamp, deadline, scheduled item, or TODO item---Org adds prefixes to the
13208figure out from which entry all the different instances originate. 13924UID, depending on which part of the Org entry triggered the creation of the
13925iCalendar entry. Prefixing ensures UIDs remains unique, yet enable
13926synchronization programs trace the connections.
13209 13927
13210@table @kbd 13928@table @kbd
13211@orgcmd{C-c C-e c f,org-icalendar-export-to-ics} 13929@orgcmd{C-c C-e c f,org-icalendar-export-to-ics}
13212Create iCalendar entries for the current buffer and store them in the same 13930Create iCalendar entries from the current Org buffer and store them in the
13213directory, using a file extension @file{.ics}. 13931same directory, using a file extension @file{.ics}.
13214@orgcmd{C-c C-e c a, org-icalendar-export-agenda-files} 13932@orgcmd{C-c C-e c a, org-icalendar-export-agenda-files}
13215@vindex org-agenda-files 13933@vindex org-agenda-files
13216Like @kbd{C-c C-e c f}, but do this for all files in 13934Create iCalendar entries from Org files in @code{org-agenda-files} and store
13217@code{org-agenda-files}. For each of these files, a separate iCalendar 13935in a separate iCalendar file for each Org file.
13218file will be written.
13219@orgcmd{C-c C-e c c,org-icalendar-combine-agenda-files} 13936@orgcmd{C-c C-e c c,org-icalendar-combine-agenda-files}
13220@vindex org-icalendar-combined-agenda-file 13937@vindex org-icalendar-combined-agenda-file
13221Create a single large iCalendar file from all files in 13938Create a combined iCalendar file from Org files in @code{org-agenda-files}
13222@code{org-agenda-files} and write it to the file given by 13939and write it to @code{org-icalendar-combined-agenda-file} file name.
13223@code{org-icalendar-combined-agenda-file}.
13224@end table 13940@end table
13225 13941
13226@vindex org-use-property-inheritance 13942@vindex org-use-property-inheritance
@@ -13228,72 +13944,54 @@ Create a single large iCalendar file from all files in
13228@cindex property, SUMMARY 13944@cindex property, SUMMARY
13229@cindex property, DESCRIPTION 13945@cindex property, DESCRIPTION
13230@cindex property, LOCATION 13946@cindex property, LOCATION
13231The export will honor SUMMARY, DESCRIPTION and LOCATION@footnote{The LOCATION 13947The iCalendar export back-end includes SUMMARY, DESCRIPTION and LOCATION
13232property can be inherited from higher in the hierarchy if you configure 13948properties from the Org entries when exporting. To force the back-end to
13233@code{org-use-property-inheritance} accordingly.} properties if the selected 13949inherit the LOCATION property, configure the
13234entries have them. If not, the summary will be derived from the headline, 13950@code{org-use-property-inheritance} variable.
13235and the description from the body (limited to 13951
13236@code{org-icalendar-include-body} characters). 13952When Org entries do not have SUMMARY, DESCRIPTION and LOCATION properties,
13237 13953the iCalendar export back-end derives the summary from the headline, and
13238How this calendar is best read and updated, depends on the application 13954derives the description from the body of the Org item. The
13239you are using. The FAQ covers this issue. 13955@code{org-icalendar-include-body} variable limits the maximum number of
13240 13956characters of the content are turned into its description.
13241@node Other built-in back-ends, Export in foreign buffers, iCalendar export, Exporting 13957
13958Exporting to iCalendar format depends in large part on the capabilities of
13959the destination application. Some are more lenient than others. Consult the
13960Org mode FAQ for advice on specific applications.
13961
13962@node Other built-in back-ends
13242@section Other built-in back-ends 13963@section Other built-in back-ends
13243@cindex export back-ends, built-in 13964@cindex export back-ends, built-in
13244@vindex org-export-backends 13965@vindex org-export-backends
13245 13966
13246On top of the aforementioned back-ends, Org comes with other built-in ones: 13967Other export back-ends included with Org are:
13247 13968
13248@itemize 13969@itemize
13249@item @file{ox-man.el}: export to a man page. 13970@item @file{ox-man.el}: export to a man page.
13250@end itemize 13971@end itemize
13251 13972
13252To activate these export back-end, customize @code{org-export-backends} or 13973To activate such back-ends, either customize @code{org-export-backends} or
13253load them directly with e.g., @code{(require 'ox-man)}. This will add new 13974load directly with @code{(require 'ox-man)}. On successful load, the
13254keys in the export dispatcher (@pxref{The Export Dispatcher}). 13975back-end adds new keys in the export dispatcher (@pxref{The export
13255 13976dispatcher}).
13256See the comment section of these files for more information on how to use
13257them.
13258
13259@node Export in foreign buffers, Advanced configuration, Other built-in back-ends, Exporting
13260@section Export in foreign buffers
13261
13262Most built-in back-ends come with a command to convert the selected region
13263into a selected format and replace this region by the exported output. Here
13264is a list of such conversion commands:
13265
13266@table @code
13267@item org-html-convert-region-to-html
13268Convert the selected region into HTML.
13269@item org-latex-convert-region-to-latex
13270Convert the selected region into @LaTeX{}.
13271@item org-texinfo-convert-region-to-texinfo
13272Convert the selected region into @code{Texinfo}.
13273@item org-md-convert-region-to-md
13274Convert the selected region into @code{MarkDown}.
13275@end table
13276 13977
13277This is particularly useful for converting tables and lists in foreign 13978Follow the comment section of such files, for example, @file{ox-man.el}, for
13278buffers. E.g., in an HTML buffer, you can turn on @code{orgstruct-mode}, then 13979usage and configuration details.
13279use Org commands for editing a list, and finally select and convert the list
13280with @code{M-x org-html-convert-region-to-html RET}.
13281 13980
13282@node Advanced configuration, , Export in foreign buffers, Exporting 13981@node Advanced configuration
13283@section Advanced configuration 13982@section Advanced configuration
13284 13983
13285@subheading Hooks 13984@subheading Hooks
13286 13985
13287@vindex org-export-before-processing-hook 13986@vindex org-export-before-processing-hook
13288@vindex org-export-before-parsing-hook 13987@vindex org-export-before-parsing-hook
13289Two hooks are run during the first steps of the export process. The first 13988The export process executes two hooks before the actual exporting begins.
13290one, @code{org-export-before-processing-hook} is called before expanding 13989The first hook, @code{org-export-before-processing-hook}, runs before any
13291macros, Babel code and include keywords in the buffer. The second one, 13990expansions of macros, Babel code, and include keywords in the buffer. The
13292@code{org-export-before-parsing-hook}, as its name suggests, happens just 13991second hook, @code{org-export-before-parsing-hook}, runs before the buffer is
13293before parsing the buffer. Their main use is for heavy duties, that is 13992parsed. Both hooks are specified as functions, see example below. Their main
13294duties involving structural modifications of the document. For example, one 13993use is for heavy duty structural modifications of the Org content. For
13295may want to remove every headline in the buffer during export. The following 13994example, removing every headline in the buffer during export:
13296code can achieve this:
13297 13995
13298@lisp 13996@lisp
13299@group 13997@group
@@ -13307,86 +14005,83 @@ BACKEND is the export back-end being used, as a symbol."
13307@end group 14005@end group
13308@end lisp 14006@end lisp
13309 14007
13310Note that functions used in these hooks require a mandatory argument, 14008Note that the hook function must have a mandatory argument that is a symbol
13311a symbol representing the back-end used. 14009for the back-end.
13312 14010
13313@subheading Filters 14011@subheading Filters
13314 14012
13315@cindex Filters, exporting 14013@cindex Filters, exporting
13316Filters are lists of functions applied on a specific part of the output from 14014The Org export process relies on filters to process specific parts of
13317a given back-end. More explicitly, each time a back-end transforms an Org 14015conversion process. Filters are just lists of functions to be applied to
13318object or element into another language, all functions within a given filter 14016certain parts for a given back-end. The output from the first function in
13319type are called in turn on the string produced. The string returned by the 14017the filter is passed on to the next function in the filter. The final output
13320last function will be the one used in the final output. 14018is the output from the final function in the filter.
13321 14019
13322There are filters sets for each type of element or object, for plain text, 14020The Org export process has many filter sets applicable to different types of
13323for the parse tree, for the export options and for the final output. They 14021objects, plain text, parse trees, export options, and final output formats.
13324are all named after the same scheme: @code{org-export-filter-TYPE-functions}, 14022The filters are named after the element type or object type:
13325where @code{TYPE} is the type targeted by the filter. Valid types are: 14023@code{org-export-filter-TYPE-functions}, where @code{TYPE} is the type
14024targeted by the filter. Valid types are:
13326 14025
13327@multitable @columnfractions .33 .33 .33 14026@multitable @columnfractions .33 .33 .33
13328@item bold 14027@item body
14028@tab bold
13329@tab babel-call 14029@tab babel-call
13330@tab center-block 14030@item center-block
13331@item clock 14031@tab clock
13332@tab code 14032@tab code
13333@tab comment 14033@item diary-sexp
13334@item comment-block
13335@tab diary-sexp
13336@tab drawer 14034@tab drawer
13337@item dynamic-block 14035@tab dynamic-block
13338@tab entity 14036@item entity
13339@tab example-block 14037@tab example-block
13340@item export-block 14038@tab export-block
13341@tab export-snippet 14039@item export-snippet
13342@tab final-output 14040@tab final-output
13343@item fixed-width 14041@tab fixed-width
13344@tab footnote-definition 14042@item footnote-definition
13345@tab footnote-reference 14043@tab footnote-reference
13346@item headline 14044@tab headline
13347@tab horizontal-rule 14045@item horizontal-rule
13348@tab inline-babel-call 14046@tab inline-babel-call
13349@item inline-src-block 14047@tab inline-src-block
13350@tab inlinetask 14048@item inlinetask
13351@tab italic 14049@tab italic
13352@item item 14050@tab item
13353@tab keyword 14051@item keyword
13354@tab latex-environment 14052@tab latex-environment
13355@item latex-fragment 14053@tab latex-fragment
13356@tab line-break 14054@item line-break
13357@tab link 14055@tab link
13358@item node-property 14056@tab node-property
13359@tab options 14057@item options
13360@tab paragraph 14058@tab paragraph
13361@item parse-tree 14059@tab parse-tree
13362@tab plain-list 14060@item plain-list
13363@tab plain-text 14061@tab plain-text
13364@item planning 14062@tab planning
13365@tab property-drawer 14063@item property-drawer
13366@tab quote-block 14064@tab quote-block
13367@item quote-section
13368@tab radio-target 14065@tab radio-target
13369@tab section 14066@item section
13370@item special-block 14067@tab special-block
13371@tab src-block 14068@tab src-block
13372@tab statistics-cookie 14069@item statistics-cookie
13373@item strike-through 14070@tab strike-through
13374@tab subscript 14071@tab subscript
13375@tab superscript 14072@item superscript
13376@item table 14073@tab table
13377@tab table-cell 14074@tab table-cell
13378@tab table-row 14075@item table-row
13379@item target 14076@tab target
13380@tab timestamp 14077@tab timestamp
13381@tab underline 14078@item underline
13382@item verbatim 14079@tab verbatim
13383@tab verse-block 14080@tab verse-block
13384@tab
13385@end multitable 14081@end multitable
13386 14082
13387For example, the following snippet allows me to use non-breaking spaces in 14083Here is an example filter that replaces non-breaking spaces @code{~} in the
13388the Org buffer and get them translated into @LaTeX{} without using the 14084Org buffer with @code{_} for the @LaTeX{} back-end.
13389@code{\nbsp} macro (where @code{_} stands for the non-breaking space):
13390 14085
13391@lisp 14086@lisp
13392@group 14087@group
@@ -13400,33 +14095,49 @@ the Org buffer and get them translated into @LaTeX{} without using the
13400@end group 14095@end group
13401@end lisp 14096@end lisp
13402 14097
13403Three arguments must be provided to a filter: the code being changed, the 14098A filter requires three arguments: the code to be transformed, the name of
13404back-end used, and some information about the export process. You can safely 14099the back-end, and some optional information about the export process. The
13405ignore the third argument for most purposes. Note the use of 14100third argument can be safely ignored. Note the use of
13406@code{org-export-derived-backend-p}, which ensures that the filter will only 14101@code{org-export-derived-backend-p} predicate that tests for @code{latex}
13407be applied when using @code{latex} back-end or any other back-end derived 14102back-end or any other back-end, such as @code{beamer}, derived from
13408from it (e.g., @code{beamer}). 14103@code{latex}.
13409 14104
13410@subheading Extending an existing back-end 14105@subheading Defining filters for individual files
14106
14107The Org export can filter not just for back-ends, but also for specific files
14108through the @code{#+BIND} keyword. Here is an example with two filters; one
14109removes brackets from time stamps, and the other removes strike-through text.
14110The filter functions are defined in a @samp{src} code block in the same Org
14111file, which is a handy location for debugging.
14112
14113@example
14114#+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp)
14115#+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
14116#+begin_src emacs-lisp :exports results :results none
14117 (defun tmp-f-timestamp (s backend info)
14118 (replace-regexp-in-string "&[lg]t;\\|[][]" "" s))
14119 (defun tmp-f-strike-through (s backend info) "")
14120#+end_src
14121@end example
13411 14122
13412This is obviously the most powerful customization, since the changes happen 14123@subheading Extending an existing back-end
13413at the parser level. Indeed, some export back-ends are built as extensions
13414of other ones (e.g., Markdown back-end an extension of HTML back-end).
13415 14124
13416Extending a back-end means that if an element type is not transcoded by the 14125Some parts of the conversion process can be extended for certain elements so
13417new back-end, it will be handled by the original one. Hence you can extend 14126as to introduce a new or revised translation. That is how the HTML export
13418specific parts of a back-end without too much work. 14127back-end was extended to handle Markdown format. The extensions work
14128seamlessly so any aspect of filtering not done by the extended back-end is
14129handled by the original back-end. Of all the export customization in Org,
14130extending is very powerful as it operates at the parser level.
13419 14131
13420As an example, imagine we want the @code{ascii} back-end to display the 14132For this example, make the @code{ascii} back-end display the language used in
13421language used in a source block, when it is available, but only when some 14133a source code block. Also make it display only when some attribute is
13422attribute is non-@code{nil}, like the following: 14134non-@code{nil}, like the following:
13423 14135
13424@example 14136@example
13425#+ATTR_ASCII: :language t 14137#+ATTR_ASCII: :language t
13426@end example 14138@end example
13427 14139
13428Because that back-end is lacking in that area, we are going to create a new 14140Then extend @code{ascii} back-end with a custom @code{my-ascii} back-end.
13429back-end, @code{my-ascii} that will do the job.
13430 14141
13431@lisp 14142@lisp
13432@group 14143@group
@@ -13450,20 +14161,47 @@ channel."
13450@end lisp 14161@end lisp
13451 14162
13452The @code{my-ascii-src-block} function looks at the attribute above the 14163The @code{my-ascii-src-block} function looks at the attribute above the
13453element. If it isn't true, it gives hand to the @code{ascii} back-end. 14164current element. If not true, hands over to @code{ascii} back-end. If true,
13454Otherwise, it creates a box around the code, leaving room for the language. 14165which it is in this example, it creates a box around the code and leaves room
13455A new back-end is then created. It only changes its behavior when 14166for the inserting a string for language. The last form creates the new
13456translating @code{src-block} type element. Now, all it takes to use the new 14167back-end that springs to action only when translating @code{src-block} type
13457back-end is calling the following from an Org buffer: 14168elements.
14169
14170To use the newly defined back-end, call the following from an Org buffer:
13458 14171
13459@smalllisp 14172@smalllisp
13460(org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*") 14173(org-export-to-buffer 'my-ascii "*Org MY-ASCII Export*")
13461@end smalllisp 14174@end smalllisp
13462 14175
13463It is obviously possible to write an interactive function for this, install 14176Further steps to consider would be an interactive function, self-installing
13464it in the export dispatcher menu, and so on. 14177an item in the export dispatcher menu, and other user-friendly improvements.
14178
14179@node Export in foreign buffers
14180@section Export in foreign buffers
14181
14182The export back-ends in Org often include commands to convert selected
14183regions. A convenient feature of this in-place conversion is that the
14184exported output replaces the original source. Here are such functions:
14185
14186@table @code
14187@item org-html-convert-region-to-html
14188Convert the selected region into HTML.
14189@item org-latex-convert-region-to-latex
14190Convert the selected region into @LaTeX{}.
14191@item org-texinfo-convert-region-to-texinfo
14192Convert the selected region into @code{Texinfo}.
14193@item org-md-convert-region-to-md
14194Convert the selected region into @code{MarkDown}.
14195@end table
14196
14197In-place conversions are particularly handy for quick conversion of tables
14198and lists in foreign buffers. For example, turn on the minor mode @code{M-x
14199orgstruct-mode} in an HTML buffer, then use the convenient Org keyboard
14200commands to create a list, select it, and covert it to HTML with @code{M-x
14201org-html-convert-region-to-html RET}.
14202
13465 14203
13466@node Publishing, Working With Source Code, Exporting, Top 14204@node Publishing
13467@chapter Publishing 14205@chapter Publishing
13468@cindex publishing 14206@cindex publishing
13469 14207
@@ -13485,7 +14223,7 @@ Publishing has been contributed to Org by David O'Toole.
13485* Triggering publication:: Publication commands 14223* Triggering publication:: Publication commands
13486@end menu 14224@end menu
13487 14225
13488@node Configuration, Uploading files, Publishing, Publishing 14226@node Configuration
13489@section Configuration 14227@section Configuration
13490 14228
13491Publishing needs significant configuration to specify files, destination 14229Publishing needs significant configuration to specify files, destination
@@ -13502,7 +14240,7 @@ and many other properties of a project.
13502* Generating an index:: An index that reaches across pages 14240* Generating an index:: An index that reaches across pages
13503@end menu 14241@end menu
13504 14242
13505@node Project alist, Sources and destinations, Configuration, Configuration 14243@node Project alist
13506@subsection The variable @code{org-publish-project-alist} 14244@subsection The variable @code{org-publish-project-alist}
13507@cindex org-publish-project-alist 14245@cindex org-publish-project-alist
13508@cindex projects, for publishing 14246@cindex projects, for publishing
@@ -13529,7 +14267,7 @@ together files requiring different publishing options. When you publish such
13529a ``meta-project'', all the components will also be published, in the 14267a ``meta-project'', all the components will also be published, in the
13530sequence given. 14268sequence given.
13531 14269
13532@node Sources and destinations, Selecting files, Project alist, Configuration 14270@node Sources and destinations
13533@subsection Sources and destinations for files 14271@subsection Sources and destinations for files
13534@cindex directories, for publishing 14272@cindex directories, for publishing
13535 14273
@@ -13548,17 +14286,17 @@ use external tools to upload your website (@pxref{Uploading files}).
13548@item @code{:preparation-function} 14286@item @code{:preparation-function}
13549@tab Function or list of functions to be called before starting the 14287@tab Function or list of functions to be called before starting the
13550publishing process, for example, to run @code{make} for updating files to be 14288publishing process, for example, to run @code{make} for updating files to be
13551published. The project property list is scoped into this call as the 14289published. Each preparation function is called with a single argument, the
13552variable @code{project-plist}. 14290project property list.
13553@item @code{:completion-function} 14291@item @code{:completion-function}
13554@tab Function or list of functions called after finishing the publishing 14292@tab Function or list of functions called after finishing the publishing
13555process, for example, to change permissions of the resulting files. The 14293process, for example, to change permissions of the resulting files. Each
13556project property list is scoped into this call as the variable 14294completion function is called with a single argument, the project property
13557@code{project-plist}. 14295list.
13558@end multitable 14296@end multitable
13559@noindent 14297@noindent
13560 14298
13561@node Selecting files, Publishing action, Sources and destinations, Configuration 14299@node Selecting files
13562@subsection Selecting files 14300@subsection Selecting files
13563@cindex files, selecting for publishing 14301@cindex files, selecting for publishing
13564 14302
@@ -13584,7 +14322,7 @@ and @code{:exclude}.
13584@tab non-@code{nil} means, check base-directory recursively for files to publish. 14322@tab non-@code{nil} means, check base-directory recursively for files to publish.
13585@end multitable 14323@end multitable
13586 14324
13587@node Publishing action, Publishing options, Selecting files, Configuration 14325@node Publishing action
13588@subsection Publishing action 14326@subsection Publishing action
13589@cindex action, for publishing 14327@cindex action, for publishing
13590 14328
@@ -13623,46 +14361,26 @@ and the path to the publishing directory of the output file. It should take
13623the specified file, make the necessary transformation (if any) and place the 14361the specified file, make the necessary transformation (if any) and place the
13624result into the destination folder. 14362result into the destination folder.
13625 14363
13626@node Publishing options, Publishing links, Publishing action, Configuration 14364@node Publishing options
13627@subsection Options for the exporters 14365@subsection Options for the exporters
13628@cindex options, for publishing 14366@cindex options, for publishing
13629 14367
13630The property list can be used to set many export options for the exporters. 14368The property list can be used to set export options during the publishing
13631In most cases, these properties correspond to user variables in Org. The 14369process. In most cases, these properties correspond to user variables in
13632first table below lists these properties along with the variable they belong 14370Org. While some properties are available for all export back-ends, most of
13633to. The second table list HTML specific properties. See the documentation 14371them are back-end specific. The following sections list properties along
13634string of these options for details. 14372with the variable they belong to. See the documentation string of these
14373options for details.
13635 14374
13636@vindex org-display-custom-times 14375@vindex org-publish-project-alist
13637@vindex org-export-default-language 14376When a property is given a value in @code{org-publish-project-alist}, its
13638@vindex org-export-exclude-tags 14377setting overrides the value of the corresponding user variable (if any)
13639@vindex org-export-headline-levels 14378during publishing. Options set within a file (@pxref{Export settings}),
13640@vindex org-export-preserve-breaks 14379however, override everything.
13641@vindex org-export-publishing-directory 14380
13642@vindex org-export-select-tags 14381@subsubheading Generic properties
13643@vindex org-export-with-archived-trees
13644@vindex org-export-with-author
13645@vindex org-export-with-creator
13646@vindex org-export-with-drawers
13647@vindex org-export-with-email
13648@vindex org-export-with-emphasize
13649@vindex org-export-with-fixed-width
13650@vindex org-export-with-footnotes
13651@vindex org-export-with-latex
13652@vindex org-export-with-planning
13653@vindex org-export-with-priority
13654@vindex org-export-with-section-numbers
13655@vindex org-export-with-special-strings
13656@vindex org-export-with-sub-superscripts
13657@vindex org-export-with-tables
13658@vindex org-export-with-tags
13659@vindex org-export-with-tasks
13660@vindex org-export-with-timestamps
13661@vindex org-export-with-toc
13662@vindex org-export-with-todo-keywords
13663@vindex user-mail-address
13664 14382
13665@multitable @columnfractions 0.32 0.68 14383@multitable {@code{:with-sub-superscript}} {@code{org-export-with-sub-superscripts}}
13666@item @code{:archived-trees} @tab @code{org-export-with-archived-trees} 14384@item @code{:archived-trees} @tab @code{org-export-with-archived-trees}
13667@item @code{:exclude-tags} @tab @code{org-export-exclude-tags} 14385@item @code{:exclude-tags} @tab @code{org-export-exclude-tags}
13668@item @code{:headline-levels} @tab @code{org-export-headline-levels} 14386@item @code{:headline-levels} @tab @code{org-export-headline-levels}
@@ -13671,7 +14389,10 @@ string of these options for details.
13671@item @code{:section-numbers} @tab @code{org-export-with-section-numbers} 14389@item @code{:section-numbers} @tab @code{org-export-with-section-numbers}
13672@item @code{:select-tags} @tab @code{org-export-select-tags} 14390@item @code{:select-tags} @tab @code{org-export-select-tags}
13673@item @code{:with-author} @tab @code{org-export-with-author} 14391@item @code{:with-author} @tab @code{org-export-with-author}
14392@item @code{:with-broken-links} @tab @code{org-export-with-broken-links}
14393@item @code{:with-clocks} @tab @code{org-export-with-clocks}
13674@item @code{:with-creator} @tab @code{org-export-with-creator} 14394@item @code{:with-creator} @tab @code{org-export-with-creator}
14395@item @code{:with-date} @tab @code{org-export-with-date}
13675@item @code{:with-drawers} @tab @code{org-export-with-drawers} 14396@item @code{:with-drawers} @tab @code{org-export-with-drawers}
13676@item @code{:with-email} @tab @code{org-export-with-email} 14397@item @code{:with-email} @tab @code{org-export-with-email}
13677@item @code{:with-emphasize} @tab @code{org-export-with-emphasize} 14398@item @code{:with-emphasize} @tab @code{org-export-with-emphasize}
@@ -13680,83 +14401,225 @@ string of these options for details.
13680@item @code{:with-latex} @tab @code{org-export-with-latex} 14401@item @code{:with-latex} @tab @code{org-export-with-latex}
13681@item @code{:with-planning} @tab @code{org-export-with-planning} 14402@item @code{:with-planning} @tab @code{org-export-with-planning}
13682@item @code{:with-priority} @tab @code{org-export-with-priority} 14403@item @code{:with-priority} @tab @code{org-export-with-priority}
14404@item @code{:with-properties} @tab @code{org-export-with-properties}
13683@item @code{:with-special-strings} @tab @code{org-export-with-special-strings} 14405@item @code{:with-special-strings} @tab @code{org-export-with-special-strings}
13684@item @code{:with-sub-superscript} @tab @code{org-export-with-sub-superscripts} 14406@item @code{:with-sub-superscript} @tab @code{org-export-with-sub-superscripts}
13685@item @code{:with-tables} @tab @code{org-export-with-tables} 14407@item @code{:with-tables} @tab @code{org-export-with-tables}
13686@item @code{:with-tags} @tab @code{org-export-with-tags} 14408@item @code{:with-tags} @tab @code{org-export-with-tags}
13687@item @code{:with-tasks} @tab @code{org-export-with-tasks} 14409@item @code{:with-tasks} @tab @code{org-export-with-tasks}
13688@item @code{:with-timestamps} @tab @code{org-export-with-timestamps} 14410@item @code{:with-timestamps} @tab @code{org-export-with-timestamps}
14411@item @code{:with-title} @tab @code{org-export-with-title}
13689@item @code{:with-toc} @tab @code{org-export-with-toc} 14412@item @code{:with-toc} @tab @code{org-export-with-toc}
13690@item @code{:with-todo-keywords} @tab @code{org-export-with-todo-keywords} 14413@item @code{:with-todo-keywords} @tab @code{org-export-with-todo-keywords}
13691@end multitable 14414@end multitable
13692 14415
13693@vindex org-html-doctype 14416@subsubheading ASCII specific properties
13694@vindex org-html-container-element 14417
13695@vindex org-html-html5-fancy 14418@multitable {@code{:ascii-table-keep-all-vertical-lines}} {@code{org-ascii-table-keep-all-vertical-lines}}
13696@vindex org-html-xml-declaration 14419@item @code{:ascii-bullets} @tab @code{org-ascii-bullets}
13697@vindex org-html-link-up 14420@item @code{:ascii-caption-above} @tab @code{org-ascii-caption-above}
13698@vindex org-html-link-home 14421@item @code{:ascii-charset} @tab @code{org-ascii-charset}
13699@vindex org-html-link-org-files-as-html 14422@item @code{:ascii-global-margin} @tab @code{org-ascii-global-margin}
13700@vindex org-html-link-use-abs-url 14423@item @code{:ascii-format-drawer-function} @tab @code{org-ascii-format-drawer-function}
13701@vindex org-html-head 14424@item @code{:ascii-format-inlinetask-function} @tab @code{org-ascii-format-inlinetask-function}
13702@vindex org-html-head-extra 14425@item @code{:ascii-headline-spacing} @tab @code{org-ascii-headline-spacing}
13703@vindex org-html-inline-images 14426@item @code{:ascii-indented-line-width} @tab @code{org-ascii-indented-line-width}
13704@vindex org-html-extension 14427@item @code{:ascii-inlinetask-width} @tab @code{org-ascii-inlinetask-width}
13705@vindex org-html-preamble 14428@item @code{:ascii-inner-margin} @tab @code{org-ascii-inner-margin}
13706@vindex org-html-postamble 14429@item @code{:ascii-links-to-notes} @tab @code{org-ascii-links-to-notes}
13707@vindex org-html-table-default-attributes 14430@item @code{:ascii-list-margin} @tab @code{org-ascii-list-margin}
13708@vindex org-html-table-row-tags 14431@item @code{:ascii-paragraph-spacing} @tab @code{org-ascii-paragraph-spacing}
13709@vindex org-html-head-include-default-style 14432@item @code{:ascii-quote-margin} @tab @code{org-ascii-quote-margin}
13710@vindex org-html-head-include-scripts 14433@item @code{:ascii-table-keep-all-vertical-lines} @tab @code{org-ascii-table-keep-all-vertical-lines}
13711@multitable @columnfractions 0.32 0.68 14434@item @code{:ascii-table-use-ascii-art} @tab @code{org-ascii-table-use-ascii-art}
13712@item @code{:html-doctype} @tab @code{org-html-doctype} 14435@item @code{:ascii-table-widen-columns} @tab @code{org-ascii-table-widen-columns}
13713@item @code{:html-container} @tab @code{org-html-container-element} 14436@item @code{:ascii-text-width} @tab @code{org-ascii-text-width}
13714@item @code{:html-html5-fancy} @tab @code{org-html-html5-fancy} 14437@item @code{:ascii-underline} @tab @code{org-ascii-underline}
13715@item @code{:html-xml-declaration} @tab @code{org-html-xml-declaration} 14438@item @code{:ascii-verbatim-format} @tab @code{org-ascii-verbatim-format}
13716@item @code{:html-link-up} @tab @code{org-html-link-up} 14439@end multitable
13717@item @code{:html-link-home} @tab @code{org-html-link-home} 14440
13718@item @code{:html-link-org-as-html} @tab @code{org-html-link-org-files-as-html} 14441@subsubheading Beamer specific properties
13719@item @code{:html-link-use-abs-url} @tab @code{org-html-link-use-abs-url} 14442
13720@item @code{:html-head} @tab @code{org-html-head} 14443@multitable {@code{:beamer-frame-default-options}} {@code{org-beamer-frame-default-options}}
13721@item @code{:html-head-extra} @tab @code{org-html-head-extra} 14444@item @code{:beamer-theme} @tab @code{org-beamer-theme}
13722@item @code{:html-inline-images} @tab @code{org-html-inline-images} 14445@item @code{:beamer-column-view-format} @tab @code{org-beamer-column-view-format}
13723@item @code{:html-extension} @tab @code{org-html-extension} 14446@item @code{:beamer-environments-extra} @tab @code{org-beamer-environments-extra}
13724@item @code{:html-preamble} @tab @code{org-html-preamble} 14447@item @code{:beamer-frame-default-options} @tab @code{org-beamer-frame-default-options}
13725@item @code{:html-postamble} @tab @code{org-html-postamble} 14448@item @code{:beamer-outline-frame-options} @tab @code{org-beamer-outline-frame-options}
13726@item @code{:html-table-attributes} @tab @code{org-html-table-default-attributes} 14449@item @code{:beamer-outline-frame-title} @tab @code{org-beamer-outline-frame-title}
13727@item @code{:html-table-row-tags} @tab @code{org-html-table-row-tags} 14450@item @code{:beamer-subtitle-format} @tab @code{org-beamer-subtitle-format}
14451@end multitable
14452
14453@subsubheading HTML specific properties
14454
14455@multitable {@code{:html-table-use-header-tags-for-first-column}} {@code{org-html-table-use-header-tags-for-first-column}}
14456@item @code{:html-allow-name-attribute-in-anchors} @tab @code{org-html-allow-name-attribute-in-anchors}
14457@item @code{:html-checkbox-type} @tab @code{org-html-checkbox-type}
14458@item @code{:html-container} @tab @code{org-html-container-element}
14459@item @code{:html-divs} @tab @code{org-html-divs}
14460@item @code{:html-doctype} @tab @code{org-html-doctype}
14461@item @code{:html-extension} @tab @code{org-html-extension}
14462@item @code{:html-footnote-format} @tab @code{org-html-footnote-format}
14463@item @code{:html-footnote-separator} @tab @code{org-html-footnote-separator}
14464@item @code{:html-footnotes-section} @tab @code{org-html-footnotes-section}
14465@item @code{:html-format-drawer-function} @tab @code{org-html-format-drawer-function}
14466@item @code{:html-format-headline-function} @tab @code{org-html-format-headline-function}
14467@item @code{:html-format-inlinetask-function} @tab @code{org-html-format-inlinetask-function}
14468@item @code{:html-head-extra} @tab @code{org-html-head-extra}
13728@item @code{:html-head-include-default-style} @tab @code{org-html-head-include-default-style} 14469@item @code{:html-head-include-default-style} @tab @code{org-html-head-include-default-style}
13729@item @code{:html-head-include-scripts} @tab @code{org-html-head-include-scripts} 14470@item @code{:html-head-include-scripts} @tab @code{org-html-head-include-scripts}
14471@item @code{:html-head} @tab @code{org-html-head}
14472@item @code{:html-home/up-format} @tab @code{org-html-home/up-format}
14473@item @code{:html-html5-fancy} @tab @code{org-html-html5-fancy}
14474@item @code{:html-indent} @tab @code{org-html-indent}
14475@item @code{:html-infojs-options} @tab @code{org-html-infojs-options}
14476@item @code{:html-infojs-template} @tab @code{org-html-infojs-template}
14477@item @code{:html-inline-image-rules} @tab @code{org-html-inline-image-rules}
14478@item @code{:html-inline-images} @tab @code{org-html-inline-images}
14479@item @code{:html-link-home} @tab @code{org-html-link-home}
14480@item @code{:html-link-org-files-as-html} @tab @code{org-html-link-org-files-as-html}
14481@item @code{:html-link-up} @tab @code{org-html-link-up}
14482@item @code{:html-link-use-abs-url} @tab @code{org-html-link-use-abs-url}
14483@item @code{:html-mathjax-options} @tab @code{org-html-mathjax-options}
14484@item @code{:html-mathjax-template} @tab @code{org-html-mathjax-template}
14485@item @code{:html-metadata-timestamp-format} @tab @code{org-html-metadata-timestamp-format}
14486@item @code{:html-postamble-format} @tab @code{org-html-postamble-format}
14487@item @code{:html-postamble} @tab @code{org-html-postamble}
14488@item @code{:html-preamble-format} @tab @code{org-html-preamble-format}
14489@item @code{:html-preamble} @tab @code{org-html-preamble}
14490@item @code{:html-table-align-individual-fields} @tab @code{org-html-table-align-individual-fields}
14491@item @code{:html-table-attributes} @tab @code{org-html-table-default-attributes}
14492@item @code{:html-table-caption-above} @tab @code{org-html-table-caption-above}
14493@item @code{:html-table-data-tags} @tab @code{org-html-table-data-tags}
14494@item @code{:html-table-header-tags} @tab @code{org-html-table-header-tags}
14495@item @code{:html-table-row-tags} @tab @code{org-html-table-row-tags}
14496@item @code{:html-table-use-header-tags-for-first-column} @tab @code{org-html-table-use-header-tags-for-first-column}
14497@item @code{:html-tag-class-prefix} @tab @code{org-html-tag-class-prefix}
14498@item @code{:html-text-markup-alist} @tab @code{org-html-text-markup-alist}
14499@item @code{:html-todo-kwd-class-prefix} @tab @code{org-html-todo-kwd-class-prefix}
14500@item @code{:html-toplevel-hlevel} @tab @code{org-html-toplevel-hlevel}
14501@item @code{:html-use-infojs} @tab @code{org-html-use-infojs}
14502@item @code{:html-validation-link} @tab @code{org-html-validation-link}
14503@item @code{:html-viewport} @tab @code{org-html-viewport}
14504@item @code{:html-xml-declaration} @tab @code{org-html-xml-declaration}
13730@end multitable 14505@end multitable
13731 14506
13732Most of the @code{org-export-with-*} variables have the same effect in each 14507@subsubheading @LaTeX{} specific properties
13733exporter. 14508
14509@multitable {@code{:latex-link-with-unknown-path-format}} {@code{org-latex-link-with-unknown-path-format}}
14510@item @code{:latex-active-timestamp-format} @tab @code{org-latex-active-timestamp-format}
14511@item @code{:latex-caption-above} @tab @code{org-latex-caption-above}
14512@item @code{:latex-classes} @tab @code{org-latex-classes}
14513@item @code{:latex-class} @tab @code{org-latex-default-class}
14514@item @code{:latex-compiler} @tab @code{org-latex-compiler}
14515@item @code{:latex-default-figure-position} @tab @code{org-latex-default-figure-position}
14516@item @code{:latex-default-table-environment} @tab @code{org-latex-default-table-environment}
14517@item @code{:latex-default-table-mode} @tab @code{org-latex-default-table-mode}
14518@item @code{:latex-diary-timestamp-format} @tab @code{org-latex-diary-timestamp-format}
14519@item @code{:latex-footnote-defined-format} @tab @code{org-latex-footnote-defined-format}
14520@item @code{:latex-footnote-separator} @tab @code{org-latex-footnote-separator}
14521@item @code{:latex-format-drawer-function} @tab @code{org-latex-format-drawer-function}
14522@item @code{:latex-format-headline-function} @tab @code{org-latex-format-headline-function}
14523@item @code{:latex-format-inlinetask-function} @tab @code{org-latex-format-inlinetask-function}
14524@item @code{:latex-hyperref-template} @tab @code{org-latex-hyperref-template}
14525@item @code{:latex-image-default-height} @tab @code{org-latex-image-default-height}
14526@item @code{:latex-image-default-option} @tab @code{org-latex-image-default-option}
14527@item @code{:latex-image-default-width} @tab @code{org-latex-image-default-width}
14528@item @code{:latex-images-centered} @tab @code{org-latex-images-centered}
14529@item @code{:latex-inactive-timestamp-format} @tab @code{org-latex-inactive-timestamp-format}
14530@item @code{:latex-inline-image-rules} @tab @code{org-latex-inline-image-rules}
14531@item @code{:latex-link-with-unknown-path-format} @tab @code{org-latex-link-with-unknown-path-format}
14532@item @code{:latex-listings-langs} @tab @code{org-latex-listings-langs}
14533@item @code{:latex-listings-options} @tab @code{org-latex-listings-options}
14534@item @code{:latex-listings} @tab @code{org-latex-listings}
14535@item @code{:latex-minted-langs} @tab @code{org-latex-minted-langs}
14536@item @code{:latex-minted-options} @tab @code{org-latex-minted-options}
14537@item @code{:latex-prefer-user-labels} @tab @code{org-latex-prefer-user-labels}
14538@item @code{:latex-subtitle-format} @tab @code{org-latex-subtitle-format}
14539@item @code{:latex-subtitle-separate} @tab @code{org-latex-subtitle-separate}
14540@item @code{:latex-table-scientific-notation} @tab @code{org-latex-table-scientific-notation}
14541@item @code{:latex-tables-booktabs} @tab @code{org-latex-tables-booktabs}
14542@item @code{:latex-tables-centered} @tab @code{org-latex-tables-centered}
14543@item @code{:latex-text-markup-alist} @tab @code{org-latex-text-markup-alist}
14544@item @code{:latex-title-command} @tab @code{org-latex-title-command}
14545@item @code{:latex-toc-command} @tab @code{org-latex-toc-command}
14546@end multitable
13734 14547
13735@vindex org-publish-project-alist 14548@subsubheading Markdown specific properties
13736When a property is given a value in @code{org-publish-project-alist}, its 14549
13737setting overrides the value of the corresponding user variable (if any) 14550@multitable {@code{:md-footnotes-section}} {@code{org-md-footnotes-section}}
13738during publishing. Options set within a file (@pxref{Export settings}), 14551@item @code{:md-footnote-format} @tab @code{org-md-footnote-format}
13739however, override everything. 14552@item @code{:md-footnotes-section} @tab @code{org-md-footnotes-section}
14553@item @code{:md-headline-style} @tab @code{org-md-headline-style}
14554@end multitable
14555
14556@subsubheading ODT specific properties
14557
14558@multitable {@code{:odt-format-inlinetask-function}} {@code{org-odt-format-inlinetask-function}}
14559@item @code{:odt-content-template-file} @tab @code{org-odt-content-template-file}
14560@item @code{:odt-display-outline-level} @tab @code{org-odt-display-outline-level}
14561@item @code{:odt-fontify-srcblocks} @tab @code{org-odt-fontify-srcblocks}
14562@item @code{:odt-format-drawer-function} @tab @code{org-odt-format-drawer-function}
14563@item @code{:odt-format-headline-function} @tab @code{org-odt-format-headline-function}
14564@item @code{:odt-format-inlinetask-function} @tab @code{org-odt-format-inlinetask-function}
14565@item @code{:odt-inline-formula-rules} @tab @code{org-odt-inline-formula-rules}
14566@item @code{:odt-inline-image-rules} @tab @code{org-odt-inline-image-rules}
14567@item @code{:odt-pixels-per-inch} @tab @code{org-odt-pixels-per-inch}
14568@item @code{:odt-styles-file} @tab @code{org-odt-styles-file}
14569@item @code{:odt-table-styles} @tab @code{org-odt-table-styles}
14570@item @code{:odt-use-date-fields} @tab @code{org-odt-use-date-fields}
14571@end multitable
14572
14573@subsubheading Texinfo specific properties
14574
14575@multitable {@code{:texinfo-link-with-unknown-path-format}} {@code{org-texinfo-link-with-unknown-path-format}}
14576@item @code{:texinfo-active-timestamp-format} @tab @code{org-texinfo-active-timestamp-format}
14577@item @code{:texinfo-classes} @tab @code{org-texinfo-classes}
14578@item @code{:texinfo-class} @tab @code{org-texinfo-default-class}
14579@item @code{:texinfo-def-table-markup} @tab @code{org-texinfo-def-table-markup}
14580@item @code{:texinfo-diary-timestamp-format} @tab @code{org-texinfo-diary-timestamp-format}
14581@item @code{:texinfo-filename} @tab @code{org-texinfo-filename}
14582@item @code{:texinfo-format-drawer-function} @tab @code{org-texinfo-format-drawer-function}
14583@item @code{:texinfo-format-headline-function} @tab @code{org-texinfo-format-headline-function}
14584@item @code{:texinfo-format-inlinetask-function} @tab @code{org-texinfo-format-inlinetask-function}
14585@item @code{:texinfo-inactive-timestamp-format} @tab @code{org-texinfo-inactive-timestamp-format}
14586@item @code{:texinfo-link-with-unknown-path-format} @tab @code{org-texinfo-link-with-unknown-path-format}
14587@item @code{:texinfo-node-description-column} @tab @code{org-texinfo-node-description-column}
14588@item @code{:texinfo-table-scientific-notation} @tab @code{org-texinfo-table-scientific-notation}
14589@item @code{:texinfo-tables-verbatim} @tab @code{org-texinfo-tables-verbatim}
14590@item @code{:texinfo-text-markup-alist} @tab @code{org-texinfo-text-markup-alist}
14591@end multitable
13740 14592
13741@node Publishing links, Sitemap, Publishing options, Configuration 14593@node Publishing links
13742@subsection Links between published files 14594@subsection Links between published files
13743@cindex links, publishing 14595@cindex links, publishing
13744 14596
13745To create a link from one Org file to another, you would use something like 14597To create a link from one Org file to another, you would use something like
13746@samp{[[file:foo.org][The foo]]} or simply @samp{file:foo.org.} 14598@samp{[[file:foo.org][The foo]]} or simply @samp{file:foo.org}
13747(@pxref{Hyperlinks}). When published, this link becomes a link to 14599(@pxref{External links}). When published, this link becomes a link to
13748@file{foo.html}. You can thus interlink the pages of your "org web" project 14600@file{foo.html}. You can thus interlink the pages of your ``org web''
13749and the links will work as expected when you publish them to HTML@. If you 14601project and the links will work as expected when you publish them to HTML.
13750also publish the Org source file and want to link to it, use an @code{http:} 14602If you also publish the Org source file and want to link to it, use an
13751link instead of a @code{file:} link, because @code{file:} links are converted 14603@code{http:} link instead of a @code{file:} link, because @code{file:} links
13752to link to the corresponding @file{html} file. 14604are converted to link to the corresponding @file{html} file.
13753 14605
13754You may also link to related files, such as images. Provided you are careful 14606You may also link to related files, such as images. Provided you are careful
13755with relative file names, and provided you have also configured Org to upload 14607with relative file names, and provided you have also configured Org to upload
13756the related files, these links will work too. See @ref{Complex example}, for 14608the related files, these links will work too. See @ref{Complex example}, for
13757an example of this usage. 14609an example of this usage.
13758 14610
13759@node Sitemap, Generating an index, Publishing links, Configuration 14611Eventually, links between published documents can contain some search options
14612(@pxref{Search options}), which will be resolved to the appropriate location
14613in the linked file. For example, once published to HTML, the following links
14614all point to a dedicated anchor in @file{foo.html}.
14615
14616@example
14617[[file:foo.org::*heading]]
14618[[file:foo.org::#custom-id]]
14619[[file:foo.org::target]]
14620@end example
14621
14622@node Sitemap
13760@subsection Generating a sitemap 14623@subsection Generating a sitemap
13761@cindex sitemap, of published pages 14624@cindex sitemap, of published pages
13762 14625
@@ -13816,7 +14679,7 @@ Defaults to @code{nil}.
13816 14679
13817@end multitable 14680@end multitable
13818 14681
13819@node Generating an index, , Sitemap, Configuration 14682@node Generating an index
13820@subsection Generating an index 14683@subsection Generating an index
13821@cindex index, in a publishing project 14684@cindex index, in a publishing project
13822 14685
@@ -13833,7 +14696,17 @@ The file will be created when first publishing a project with the
13833"theindex.inc"}. You can then build around this include statement by adding 14696"theindex.inc"}. You can then build around this include statement by adding
13834a title, style information, etc. 14697a title, style information, etc.
13835 14698
13836@node Uploading files, Sample configuration, Configuration, Publishing 14699@cindex #+INDEX
14700Index entries are specified with @code{#+INDEX} keyword. An entry that
14701contains an exclamation mark will create a sub item.
14702
14703@example
14704* Curriculum Vitae
14705#+INDEX: CV
14706#+INDEX: Application!CV
14707@end example
14708
14709@node Uploading files
13837@section Uploading files 14710@section Uploading files
13838@cindex rsync 14711@cindex rsync
13839@cindex unison 14712@cindex unison
@@ -13866,7 +14739,7 @@ benefit of re-including any changed external files such as source example
13866files you might include with @code{#+INCLUDE:}. The timestamp mechanism in 14739files you might include with @code{#+INCLUDE:}. The timestamp mechanism in
13867Org is not smart enough to detect if included files have been modified. 14740Org is not smart enough to detect if included files have been modified.
13868 14741
13869@node Sample configuration, Triggering publication, Uploading files, Publishing 14742@node Sample configuration
13870@section Sample configuration 14743@section Sample configuration
13871 14744
13872Below we provide two example configurations. The first one is a simple 14745Below we provide two example configurations. The first one is a simple
@@ -13878,7 +14751,7 @@ more complex, with a multi-component project.
13878* Complex example:: A multi-component publishing example 14751* Complex example:: A multi-component publishing example
13879@end menu 14752@end menu
13880 14753
13881@node Simple example, Complex example, Sample configuration, Sample configuration 14754@node Simple example
13882@subsection Example: simple publishing configuration 14755@subsection Example: simple publishing configuration
13883 14756
13884This example publishes a set of Org files to the @file{public_html} 14757This example publishes a set of Org files to the @file{public_html}
@@ -13896,7 +14769,7 @@ directory on the local machine.
13896 type=\"text/css\"/>"))) 14769 type=\"text/css\"/>")))
13897@end lisp 14770@end lisp
13898 14771
13899@node Complex example, , Simple example, Sample configuration 14772@node Complex example
13900@subsection Example: complex publishing configuration 14773@subsection Example: complex publishing configuration
13901 14774
13902This more complicated example publishes an entire website, including 14775This more complicated example publishes an entire website, including
@@ -13946,7 +14819,7 @@ right place on the web server, and publishing images to it.
13946 ("website" :components ("orgfiles" "images" "other")))) 14819 ("website" :components ("orgfiles" "images" "other"))))
13947@end lisp 14820@end lisp
13948 14821
13949@node Triggering publication, , Sample configuration, Publishing 14822@node Triggering publication
13950@section Triggering publication 14823@section Triggering publication
13951 14824
13952Once properly configured, Org can publish with the following commands: 14825Once properly configured, Org can publish with the following commands:
@@ -13970,17 +14843,20 @@ above, or by customizing the variable @code{org-publish-use-timestamps-flag}.
13970This may be necessary in particular if files include other files via 14843This may be necessary in particular if files include other files via
13971@code{#+SETUPFILE:} or @code{#+INCLUDE:}. 14844@code{#+SETUPFILE:} or @code{#+INCLUDE:}.
13972 14845
13973@comment node-name, next, previous, up
13974@comment Working With Source Code, Miscellaneous, Publishing, Top
13975 14846
13976@node Working With Source Code, Miscellaneous, Publishing, Top 14847@node Working with source code
13977@chapter Working with source code 14848@chapter Working with source code
13978@cindex Schulte, Eric 14849@cindex Schulte, Eric
13979@cindex Davison, Dan 14850@cindex Davison, Dan
13980@cindex source code, working with 14851@cindex source code, working with
13981 14852
13982Source code can be included in Org mode documents using a @samp{src} block, 14853Source code here refers to any code typed in Org mode documents. Org can
13983e.g.: 14854manage source code in any Org file once such code is tagged with begin and
14855end markers. Working with source code begins with tagging source code
14856blocks. Tagged @samp{src} code blocks are not restricted to the preamble or
14857the end of an Org document; they can go anywhere---with a few exceptions,
14858such as not inside comments and fixed width areas. Here's a sample
14859@samp{src} code block in emacs-lisp:
13984 14860
13985@example 14861@example
13986#+BEGIN_SRC emacs-lisp 14862#+BEGIN_SRC emacs-lisp
@@ -13990,14 +14866,57 @@ e.g.:
13990#+END_SRC 14866#+END_SRC
13991@end example 14867@end example
13992 14868
13993Org mode provides a number of features for working with live source code, 14869Org can take the code in the block between the @samp{#+BEGIN_SRC} and
13994including editing of code blocks in their native major-mode, evaluation of 14870@samp{#+END_SRC} tags, and format, compile, execute, and show the results.
13995code blocks, converting code blocks into source files (known as @dfn{tangling} 14871Org can simplify many housekeeping tasks essential to modern code
13996in literate programming), and exporting code blocks and their 14872maintenance. That's why these blocks in Org mode literature are sometimes
13997results in several formats. This functionality was contributed by Eric 14873referred to as @samp{live code} blocks (as compared to the static text and
13998Schulte and Dan Davison, and was originally named Org-babel. 14874documentation around it). Users can control how @samp{live} they want each
13999 14875block by tweaking the headers for compiling, execution, extraction.
14000The following sections describe Org mode's code block handling facilities. 14876
14877Org's @samp{src} code block type is one of many block types, such as quote,
14878export, verse, latex, example, and verbatim. This section pertains to
14879@samp{src} code blocks between @samp{#+BEGIN_SRC} and @samp{#+END_SRC}
14880
14881For editing @samp{src} code blocks, Org provides native Emacs major-modes.
14882That leverages the latest Emacs features for that source code language mode.
14883
14884For exporting, Org can then extract @samp{src} code blocks into compilable
14885source files (in a conversion process known as @dfn{tangling} in literate
14886programming terminology).
14887
14888For publishing, Org's back-ends can handle the @samp{src} code blocks and the
14889text for output to a variety of formats with native syntax highlighting.
14890
14891For executing the source code in the @samp{src} code blocks, Org provides
14892facilities that glue the tasks of compiling, collecting the results of the
14893execution, and inserting them back to the Org file. Besides text output,
14894results may include links to other data types that Emacs can handle: audio,
14895video, and graphics.
14896
14897An important feature of Org's execution of the @samp{src} code blocks is
14898passing variables, functions, and results between @samp{src} blocks. Such
14899interoperability uses a common syntax even if these @samp{src} blocks are in
14900different source code languages. The integration extends to linking the
14901debugger's error messages to the line in the @samp{src} code block in the Org
14902file. That should partly explain why this functionality by the original
14903contributors, Eric Schulte and Dan Davison, was called @samp{Org Babel}.
14904
14905In literate programming, the main appeal is code and documentation
14906co-existing in one file. Org mode takes this several steps further. First
14907by enabling execution, and then by inserting results of that execution back
14908into the Org file. Along the way, Org provides extensive formatting
14909features, including handling tables. Org handles multiple source code
14910languages in one file, and provides a common syntax for passing variables,
14911functions, and results between @samp{src} code blocks.
14912
14913Org mode fulfills the promise of easy verification and maintenance of
14914publishing reproducible research by keeping all these in the same file: text,
14915data, code, configuration settings of the execution environment, the results
14916of the execution, and associated narratives, claims, references, and internal
14917and external links.
14918
14919Details of Org's facilities for working with source code are shown next.
14001 14920
14002@menu 14921@menu
14003* Structure of code blocks:: Code block syntax described 14922* Structure of code blocks:: Code block syntax described
@@ -14014,19 +14933,18 @@ The following sections describe Org mode's code block handling facilities.
14014* Batch execution:: Call functions from the command line 14933* Batch execution:: Call functions from the command line
14015@end menu 14934@end menu
14016 14935
14017@comment node-name, next, previous, up
14018@comment Structure of code blocks, Editing source code, Working With Source Code, Working With Source Code
14019 14936
14020@node Structure of code blocks, Editing source code, Working With Source Code, Working With Source Code 14937@node Structure of code blocks
14021@section Structure of code blocks 14938@section Structure of code blocks
14022@cindex code block, structure 14939@cindex code block, structure
14023@cindex source code, block structure 14940@cindex source code, block structure
14024@cindex #+NAME 14941@cindex #+NAME
14025@cindex #+BEGIN_SRC 14942@cindex #+BEGIN_SRC
14026 14943
14027Live code blocks can be specified with a @samp{src} block or 14944Org offers two ways to structure source code in Org documents: in a
14028inline.@footnote{Note that @samp{src} blocks may be inserted using Org mode's 14945@samp{src} block, and directly inline. Both specifications are shown below.
14029@ref{Easy Templates} system} The structure of a @samp{src} block is 14946
14947A @samp{src} block conforms to this structure:
14030 14948
14031@example 14949@example
14032#+NAME: <name> 14950#+NAME: <name>
@@ -14035,12 +14953,15 @@ inline.@footnote{Note that @samp{src} blocks may be inserted using Org mode's
14035#+END_SRC 14953#+END_SRC
14036@end example 14954@end example
14037 14955
14038The @code{#+NAME:} line is optional, and can be used to name the code 14956Org mode's templates system (@pxref{Easy templates}) speeds up creating
14039block. Live code blocks require that a language be specified on the 14957@samp{src} code blocks with just three keystrokes. Do not be put-off by
14040@code{#+BEGIN_SRC} line. Switches and header arguments are optional. 14958having to remember the source block syntax. Org also works with other
14041@cindex source code, inline 14959completion systems in Emacs, some of which predate Org and have custom
14960domain-specific languages for defining templates. Regular use of templates
14961reduces errors, increases accuracy, and maintains consistency.
14042 14962
14043Live code blocks can also be specified inline using 14963@cindex source code, inline
14964An inline code block conforms to this structure:
14044 14965
14045@example 14966@example
14046src_<language>@{<body>@} 14967src_<language>@{<body>@}
@@ -14053,36 +14974,39 @@ src_<language>[<header arguments>]@{<body>@}
14053@end example 14974@end example
14054 14975
14055@table @code 14976@table @code
14056@item <#+NAME: name> 14977@item #+NAME: <name>
14057This line associates a name with the code block. This is similar to the 14978Optional. Names the @samp{src} block so it can be called, like a function,
14058@code{#+NAME: Name} lines that can be used to name tables in Org mode 14979from other @samp{src} blocks or inline blocks to evaluate or to capture the
14059files. Referencing the name of a code block makes it possible to evaluate 14980results. Code from other blocks, other files, and from table formulas
14060the block from other places in the file, from other files, or from Org mode 14981(@pxref{The spreadsheet}) can use the name to reference a @samp{src} block.
14061table formulas (see @ref{The spreadsheet}). Names are assumed to be unique 14982This naming serves the same purpose as naming Org tables. Org mode requires
14062and the behavior of Org mode when two or more blocks share the same name is 14983unique names. For duplicate names, Org mode's behavior is undefined.
14063undefined.
14064@cindex #+NAME 14984@cindex #+NAME
14985@item #+BEGIN_SRC
14986@item #+END_SRC
14987Mandatory. They mark the start and end of a block that Org requires. The
14988@code{#+BEGIN_SRC} line takes additional arguments, as described next.
14989@cindex begin block, end block
14065@item <language> 14990@item <language>
14066The language of the code in the block (see @ref{Languages}). 14991Mandatory for live code blocks. It is the identifier of the source code
14992language in the block. @xref{Languages}, for identifiers of supported
14993languages.
14067@cindex source code, language 14994@cindex source code, language
14068@item <switches> 14995@item <switches>
14069Optional switches control code block export (see the discussion of switches in 14996Optional. Switches provide finer control of the code execution, export, and
14070@ref{Literal examples}) 14997format (see the discussion of switches in @ref{Literal examples})
14071@cindex source code, switches 14998@cindex source code, switches
14072@item <header arguments> 14999@item <header arguments>
14073Optional header arguments control many aspects of evaluation, export and 15000Optional. Heading arguments control many aspects of evaluation, export and
14074tangling of code blocks (see @ref{Header arguments}). 15001tangling of code blocks (@pxref{Header arguments}). Using Org's properties
14075Header arguments can also be set on a per-buffer or per-subtree 15002feature, header arguments can be selectively applied to the entire buffer or
14076basis using properties. 15003specific sub-trees of the Org document.
14077@item source code, header arguments 15004@item source code, header arguments
14078@item <body> 15005@item <body>
14079Source code in the specified language. 15006Source code in the dialect of the specified language identifier.
14080@end table 15007@end table
14081 15008
14082@comment node-name, next, previous, up 15009@node Editing source code
14083@comment Editing source code, Exporting code blocks, Structure of code blocks, Working With Source Code
14084
14085@node Editing source code, Exporting code blocks, Structure of code blocks, Working With Source Code
14086@section Editing source code 15010@section Editing source code
14087@cindex code block, editing 15011@cindex code block, editing
14088@cindex source code, editing 15012@cindex source code, editing
@@ -14090,116 +15014,150 @@ Source code in the specified language.
14090@vindex org-edit-src-auto-save-idle-delay 15014@vindex org-edit-src-auto-save-idle-delay
14091@vindex org-edit-src-turn-on-auto-save 15015@vindex org-edit-src-turn-on-auto-save
14092@kindex C-c ' 15016@kindex C-c '
14093Use @kbd{C-c '} to edit the current code block. This brings up a language 15017@kbd{C-c '} for editing the current code block. It opens a new major-mode
14094major-mode edit buffer containing the body of the code block. Manually 15018edit buffer containing the body of the @samp{src} code block, ready for any
14095saving this buffer with @key{C-x C-s} will write the contents back to the Org 15019edits. @kbd{C-c '} again to close the buffer and return to the Org buffer.
14096buffer. You can also set @code{org-edit-src-auto-save-idle-delay} to save the 15020
14097base buffer after some idle delay, or @code{org-edit-src-turn-on-auto-save} 15021@key{C-x C-s} saves the buffer and updates the contents of the Org buffer.
14098to auto-save this buffer into a separate file using @code{auto-save-mode}. 15022
14099Use @kbd{C-c '} again to exit. 15023Set @code{org-edit-src-auto-save-idle-delay} to save the base buffer after
14100 15024a certain idle delay time.
14101The @code{org-src-mode} minor mode will be active in the edit buffer. The 15025
14102following variables can be used to configure the behavior of the edit 15026Set @code{org-edit-src-turn-on-auto-save} to auto-save this buffer into a
14103buffer. See also the customization group @code{org-edit-structure} for 15027separate file using @code{auto-save-mode}.
14104further configuration options. 15028
15029@kbd{C-c '} to close the major-mode buffer and return back to the Org buffer.
15030
15031While editing the source code in the major-mode, the @code{org-src-mode}
15032minor mode remains active. It provides these customization variables as
15033described below. For even more variables, look in the customization
15034group @code{org-edit-structure}.
14105 15035
14106@table @code 15036@table @code
14107@item org-src-lang-modes 15037@item org-src-lang-modes
14108If an Emacs major-mode named @code{<lang>-mode} exists, where 15038If an Emacs major-mode named @code{<lang>-mode} exists, where @code{<lang>}
14109@code{<lang>} is the language named in the header line of the code block, 15039is the language identifier from code block's header line, then the edit
14110then the edit buffer will be placed in that major-mode. This variable 15040buffer uses that major-mode. Use this variable to arbitrarily map language
14111can be used to map arbitrary language names to existing major modes. 15041identifiers to major modes.
14112@item org-src-window-setup 15042@item org-src-window-setup
14113Controls the way Emacs windows are rearranged when the edit buffer is created. 15043For specifying Emacs window arrangement when the new edit buffer is created.
14114@item org-src-preserve-indentation 15044@item org-src-preserve-indentation
14115By default, the value is @code{nil}, which means that when code blocks are 15045@cindex indentation, in source blocks
14116evaluated during export or tangled, they are re-inserted into the code block, 15046Default is @code{nil}. Source code is indented. This indentation applies
14117which may replace sequences of spaces with tab characters. When non-nil, 15047during export or tangling, and depending on the context, may alter leading
14118whitespace in code blocks will be preserved during export or tangling, 15048spaces and tabs. When non-@code{nil}, source code is aligned with the
14119exactly as it appears. This variable is especially useful for tangling 15049leftmost column. No lines are modified during export or tangling, which is
14120languages such as Python, in which whitespace indentation in the output is 15050very useful for white-space sensitive languages, such as Python.
14121critical.
14122@item org-src-ask-before-returning-to-edit-buffer 15051@item org-src-ask-before-returning-to-edit-buffer
14123By default, Org will ask before returning to an open edit buffer. Set this 15052When @code{nil}, Org returns to the edit buffer without further prompts. The
14124variable to @code{nil} to switch without asking. 15053default prompts for a confirmation.
14125@end table 15054@end table
14126 15055
14127To turn on native code fontification in the @emph{Org} buffer, configure the 15056Set @code{org-src-fontify-natively} to non-@code{nil} to turn on native code
14128variable @code{org-src-fontify-natively}. 15057fontification in the @emph{Org} buffer. Fontification of @samp{src} code
15058blocks can give visual separation of text and code on the display page. To
15059further customize the appearance of @code{org-block} for specific languages,
15060customize @code{org-src-block-faces}. The following example shades the
15061background of regular blocks, and colors source blocks only for Python and
15062Emacs-Lisp languages.
15063@lisp
15064(require 'color)
15065(set-face-attribute 'org-block nil :background
15066 (color-darken-name
15067 (face-attribute 'default :background) 3))
14129 15068
14130@comment node-name, next, previous, up 15069(setq org-src-block-faces '(("emacs-lisp" (:background "#EEE2FF"))
14131@comment Exporting code blocks, Extracting source code, Editing source code, Working With Source Code 15070 ("python" (:background "#E5FFB8"))))
15071@end lisp
14132 15072
14133@node Exporting code blocks, Extracting source code, Editing source code, Working With Source Code 15073@node Exporting code blocks
14134@section Exporting code blocks 15074@section Exporting code blocks
14135@cindex code block, exporting 15075@cindex code block, exporting
14136@cindex source code, exporting 15076@cindex source code, exporting
14137 15077
14138It is possible to export the @emph{code} of code blocks, the @emph{results} 15078Org can flexibly export just the @emph{code} from the code blocks, just the
14139of code block evaluation, @emph{both} the code and the results of code block 15079@emph{results} of evaluation of the code block, @emph{both} the code and the
14140evaluation, or @emph{none}. For most languages, the default exports code. 15080results of the code block evaluation, or @emph{none}. Org defaults to
14141However, for some languages (e.g., @code{ditaa}) the default exports the 15081exporting @emph{code} for most languages. For some languages, such as
14142results of code block evaluation. For information on exporting code block 15082@code{ditaa}, Org defaults to @emph{results}. To export just the body of
14143bodies, see @ref{Literal examples}. 15083code blocks, @pxref{Literal examples}. To selectively export sub-trees of
15084an Org document, @pxref{Exporting}.
14144 15085
14145The @code{:exports} header argument can be used to specify export 15086The @code{:exports} header arguments control exporting code blocks only and
14146behavior: 15087not inline code:
14147 15088
14148@subsubheading Header arguments: 15089@subsubheading Header arguments:
14149 15090
14150@table @code 15091@table @code
15092@cindex @code{:exports}, src header argument
14151@item :exports code 15093@item :exports code
14152The default in most languages. The body of the code block is exported, as 15094This is the default for most languages where the body of the code block is
14153described in @ref{Literal examples}. 15095exported. See @ref{Literal examples} for more.
14154@item :exports results 15096@item :exports results
14155The code block will be evaluated and the results will be placed in the 15097On export, Org includes only the results and not the code block. After each
14156Org mode buffer for export, either updating previous results of the code 15098evaluation, Org inserts the results after the end of code block in the Org
14157block located anywhere in the buffer or, if no previous results exist, 15099buffer. By default, Org replaces any previous results. Org can also append
14158placing the results immediately after the code block. The body of the code 15100results.
14159block will not be exported.
14160@item :exports both 15101@item :exports both
14161Both the code block and its results will be exported. 15102Org exports both the code block and the results.
14162@item :exports none 15103@item :exports none
14163Neither the code block nor its results will be exported. 15104Org does not export the code block nor the results.
14164@end table 15105@end table
14165 15106
14166It is possible to inhibit the evaluation of code blocks during export. 15107@vindex org-export-babel-evaluate
14167Setting the @code{org-export-babel-evaluate} variable to @code{nil} will 15108To stop Org from evaluating code blocks during export, set
14168ensure that no code blocks are evaluated as part of the export process. This 15109@code{org-export-babel-evaluate} variable to @code{nil}.
14169can be useful in situations where potentially untrusted Org mode files are 15110
14170exported in an automated fashion, for example when Org mode is used as the 15111Turning off evaluation comes in handy when batch processing. For example,
14171markup language for a wiki. It is also possible to set this variable to 15112markup languages for wikis, which have a high risk of untrusted code.
14172@code{'inline-only}. In that case, only inline code blocks will be 15113Stopping code block evaluation also stops evaluation of all header arguments
14173evaluated, in order to insert their results. Non-inline code blocks are 15114of the code block. This may not be desirable in some circumstances. So
14174assumed to have their results already inserted in the buffer by manual 15115during export, to allow evaluation of just the header arguments but not any
14175evaluation. This setting is useful to avoid expensive recalculations during 15116code evaluation in the source block, set @code{:eval never-export}
14176export, not to provide security. 15117(@pxref{eval}).
14177 15118
14178@comment node-name, next, previous, up 15119To evaluate just the inline code blocks, set @code{org-export-babel-evaluate}
14179@comment Extracting source code, Evaluating code blocks, Exporting code blocks, Working With Source Code 15120to @code{inline-only}. Isolating the option to allow inline evaluations
14180@node Extracting source code, Evaluating code blocks, Exporting code blocks, Working With Source Code 15121separate from @samp{src} code block evaluations during exports is not for
15122security but for avoiding any delays due to recalculations, such as calls to
15123a remote database.
15124
15125Org never evaluates code blocks in commented sub-trees when exporting
15126(@pxref{Comment lines}). On the other hand, Org does evaluate code blocks in
15127sub-trees excluded from export (@pxref{Export settings}).
15128
15129@node Extracting source code
14181@section Extracting source code 15130@section Extracting source code
14182@cindex tangling 15131@cindex tangling
14183@cindex source code, extracting 15132@cindex source code, extracting
14184@cindex code block, extracting source code 15133@cindex code block, extracting source code
14185 15134
14186Creating pure source code files by extracting code from source blocks is 15135Extracting source code from code blocks is a basic task in literate
14187referred to as ``tangling''---a term adopted from the literate programming 15136programming. Org has features to make this easy. In literate programming
14188community. During ``tangling'' of code blocks their bodies are expanded 15137parlance, documents on creation are @emph{woven} with code and documentation,
14189using @code{org-babel-expand-src-block} which can expand both variable and 15138and on export, the code is @emph{tangled} for execution by a computer. Org
14190``noweb'' style references (see @ref{Noweb reference syntax}). 15139facilitates weaving and tangling for producing, maintaining, sharing, and
15140exporting literate programming documents. Org provides extensive
15141customization options for extracting source code.
15142
15143When Org tangles @samp{src} code blocks, it expands, merges, and transforms
15144them. Then Org recomposes them into one or more separate files, as
15145configured through the options. During this @emph{tangling} process, Org
15146expands variables in the source code, and resolves any ``noweb'' style
15147references (@pxref{Noweb reference syntax}).
14191 15148
14192@subsubheading Header arguments 15149@subsubheading Header arguments
14193 15150
14194@table @code 15151@table @code
15152@cindex @code{:tangle}, src header argument
14195@item :tangle no 15153@item :tangle no
14196The default. The code block is not included in the tangled output. 15154By default, Org does not tangle the @samp{src} code block on export.
14197@item :tangle yes 15155@item :tangle yes
14198Include the code block in the tangled output. The output file name is the 15156Org extracts the contents of the code block for the tangled output. By
14199name of the org file with the extension @samp{.org} replaced by the extension 15157default, the output file name is the same as the Org file but with a file
14200for the block language. 15158extension derived from the language identifier of the @samp{src} code block.
14201@item :tangle filename 15159@item :tangle filename
14202Include the code block in the tangled output to file @samp{filename}. 15160Override the default file name with this one for the tangled output.
14203@end table 15161@end table
14204 15162
14205@kindex C-c C-v t 15163@kindex C-c C-v t
@@ -14209,7 +15167,7 @@ Include the code block in the tangled output to file @samp{filename}.
14209@item org-babel-tangle 15167@item org-babel-tangle
14210Tangle the current file. Bound to @kbd{C-c C-v t}. 15168Tangle the current file. Bound to @kbd{C-c C-v t}.
14211 15169
14212With prefix argument only tangle the current code block. 15170With prefix argument only tangle the current @samp{src} code block.
14213@item org-babel-tangle-file 15171@item org-babel-tangle-file
14214Choose a file to tangle. Bound to @kbd{C-c C-v f}. 15172Choose a file to tangle. Bound to @kbd{C-c C-v f}.
14215@end table 15173@end table
@@ -14218,72 +15176,67 @@ Choose a file to tangle. Bound to @kbd{C-c C-v f}.
14218 15176
14219@table @code 15177@table @code
14220@item org-babel-post-tangle-hook 15178@item org-babel-post-tangle-hook
14221This hook is run from within code files tangled by @code{org-babel-tangle}. 15179This hook runs from within code tangled by @code{org-babel-tangle}, making it
14222Example applications could include post-processing, compilation or evaluation 15180suitable for post-processing, compilation, and evaluation of code in the
14223of tangled code files. 15181tangled files.
14224@end table 15182@end table
14225 15183
14226@subsubheading Jumping between code and Org 15184@subsubheading Jumping between code and Org
14227 15185
14228When tangling code from an Org-mode buffer to a source code file, you'll 15186Debuggers normally link errors and messages back to the source code. But for
14229frequently find yourself viewing the file of tangled source code (e.g., many 15187tangled files, we want to link back to the Org file, not to the tangled
14230debuggers point to lines of the source code file). It is useful to be able 15188source file. To make this extra jump, Org uses
14231to navigate from the tangled source to the Org-mode buffer from which the 15189@code{org-babel-tangle-jump-to-org} function with two additional source code
14232code originated. 15190block header arguments: One, set @code{padline} (@pxref{padline}) to true
14233 15191(the default setting). Two, set @code{comments} (@pxref{comments}) to
14234The @code{org-babel-tangle-jump-to-org} function provides this jumping from 15192@code{link}, which makes Org insert links to the Org file.
14235code to Org-mode functionality. Two header arguments are required for
14236jumping to work, first the @code{padline} (@ref{padline}) option must be set
14237to true (the default setting), second the @code{comments} (@ref{comments})
14238header argument must be set to @code{links}, which will insert comments into
14239the source code buffer which point back to the original Org-mode file.
14240 15193
14241@node Evaluating code blocks, Library of Babel, Extracting source code, Working With Source Code 15194@node Evaluating code blocks
14242@section Evaluating code blocks 15195@section Evaluating code blocks
14243@cindex code block, evaluating 15196@cindex code block, evaluating
14244@cindex source code, evaluating 15197@cindex source code, evaluating
14245@cindex #+RESULTS 15198@cindex #+RESULTS
14246 15199
14247Code blocks can be evaluated@footnote{Whenever code is evaluated there is a 15200A note about security: With code evaluation comes the risk of harm. Org
14248potential for that code to do harm. Org mode provides safeguards to ensure 15201safeguards by prompting for user's permission before executing any code in
14249that code is only evaluated after explicit confirmation from the user. For 15202the source block. To customize this safeguard (or disable it) see @ref{Code
14250information on these safeguards (and on how to disable them) see @ref{Code 15203evaluation security}.
14251evaluation security}.} and the results of evaluation optionally placed in the 15204
14252Org mode buffer. The results of evaluation are placed following a line that 15205Org captures the results of the @samp{src} code block evaluation and inserts
14253begins by default with @code{#+RESULTS} and optionally a cache identifier 15206them in the Org file, right after the @samp{src} code block. The insertion
14254and/or the name of the evaluated code block. The default value of 15207point is after a newline and the @code{#+RESULTS} label. Org creates the
14255@code{#+RESULTS} can be changed with the customizable variable 15208@code{#+RESULTS} label if one is not already there.
14256@code{org-babel-results-keyword}. 15209
14257 15210By default, Org enables only @code{emacs-lisp} @samp{src} code blocks for
14258By default, the evaluation facility is only enabled for Lisp code blocks 15211execution. See @ref{Languages} for identifiers to enable other languages.
14259specified as @code{emacs-lisp}. However, source code blocks in many languages
14260can be evaluated within Org mode (see @ref{Languages} for a list of supported
14261languages and @ref{Structure of code blocks} for information on the syntax
14262used to define a code block).
14263 15212
14264@kindex C-c C-c 15213@kindex C-c C-c
14265There are a number of ways to evaluate code blocks. The simplest is to press 15214Org provides many ways to execute @samp{src} code blocks. @kbd{C-c C-c} or
14266@kbd{C-c C-c} or @kbd{C-c C-v e} with the point on a code block@footnote{The 15215@kbd{C-c C-v e} with the point on a @samp{src} code block@footnote{The option
14267option @code{org-babel-no-eval-on-ctrl-c-ctrl-c} can be used to remove code 15216@code{org-babel-no-eval-on-ctrl-c-ctrl-c} can be used to remove code
14268evaluation from the @kbd{C-c C-c} key binding.}. This will call the 15217evaluation from the @kbd{C-c C-c} key binding.} calls the
14269@code{org-babel-execute-src-block} function to evaluate the block and insert 15218@code{org-babel-execute-src-block} function, which executes the code in the
14270its results into the Org mode buffer. 15219block, collects the results, and inserts them in the buffer.
14271@cindex #+CALL
14272 15220
14273It is also possible to evaluate named code blocks from anywhere in an Org 15221@cindex #+CALL
14274mode buffer or an Org mode table. Live code blocks located in the current 15222By calling a named code block@footnote{Actually, the constructs call_<name>()
14275Org mode buffer or in the ``Library of Babel'' (see @ref{Library of Babel}) 15223and src_<lang>@{@} are not evaluated when they appear in a keyword line
14276can be executed. Named code blocks can be executed with a separate 15224(i.e. lines starting with @code{#+KEYWORD:}, @pxref{In-buffer settings}).}
14277@code{#+CALL:} line or inline within a block of text. 15225from an Org mode buffer or a table. Org can call the named @samp{src} code
15226blocks from the current Org mode buffer or from the ``Library of Babel''
15227(@pxref{Library of Babel}). Whether inline syntax or the @code{#+CALL:}
15228syntax is used, the result is wrapped based on the variable
15229@code{org-babel-inline-result-wrap}, which by default is set to @code{"=%s="}
15230to produce verbatim text suitable for markup.
14278 15231
14279The syntax of the @code{#+CALL:} line is 15232The syntax for @code{#+CALL:} is
14280 15233
14281@example 15234@example
14282#+CALL: <name>(<arguments>) 15235#+CALL: <name>(<arguments>)
14283#+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments> 15236#+CALL: <name>[<inside header arguments>](<arguments>) <end header arguments>
14284@end example 15237@end example
14285 15238
14286The syntax for inline evaluation of named code blocks is 15239The syntax for inline named code block is
14287 15240
14288@example 15241@example
14289... call_<name>(<arguments>) ... 15242... call_<name>(<arguments>) ...
@@ -14292,98 +15245,88 @@ The syntax for inline evaluation of named code blocks is
14292 15245
14293@table @code 15246@table @code
14294@item <name> 15247@item <name>
14295The name of the code block to be evaluated (see @ref{Structure of code blocks}). 15248This is the name of the code block to be evaluated (@pxref{Structure of
15249code blocks}).
14296@item <arguments> 15250@item <arguments>
14297Arguments specified in this section will be passed to the code block. These 15251Org passes arguments to the code block using standard function call syntax.
14298arguments use standard function call syntax, rather than 15252For example, a @code{#+CALL:} line that passes @samp{4} to a code block named
14299header argument syntax. For example, a @code{#+CALL:} line that passes the 15253@code{double}, which declares the header argument @code{:var n=2}, would be
14300number four to a code block named @code{double}, which declares the header 15254written as @code{#+CALL: double(n=4)}. Note how this function call syntax is
14301argument @code{:var n=2}, would be written as @code{#+CALL: double(n=4)}. 15255different from the header argument syntax.
14302@item <inside header arguments> 15256@item <inside header arguments>
14303Inside header arguments are passed through and applied to the named code 15257Org passes inside header arguments to the named @samp{src} code block using
14304block. These arguments use header argument syntax rather than standard 15258the header argument syntax. Inside header arguments apply to code block
14305function call syntax. Inside header arguments affect how the code block is 15259evaluation. For example, @code{[:results output]} collects results printed
14306evaluated. For example, @code{[:results output]} will collect the results of 15260to @code{STDOUT} during code execution of that block. Note how this header
14307everything printed to @code{STDOUT} during execution of the code block. 15261argument syntax is different from the function call syntax.
14308@item <end header arguments> 15262@item <end header arguments>
14309End header arguments are applied to the calling instance and do not affect 15263End header arguments affect the results returned by the code block. For
14310evaluation of the named code block. They affect how the results are 15264example, @code{:results html} wraps the results in a @code{BEGIN_EXPORT html}
14311incorporated into the Org mode buffer and how the call line is exported. For 15265block before inserting the results in the Org buffer.
14312example, @code{:results html} will insert the results of the call line 15266
14313evaluation in the Org buffer, wrapped in a @code{BEGIN_HTML:} block. 15267For more examples of header arguments for @code{#+CALL:} lines,
14314 15268@pxref{Arguments in function calls}.
14315For more examples of passing header arguments to @code{#+CALL:} lines see
14316@ref{Header arguments in function calls}.
14317@end table 15269@end table
14318 15270
14319@node Library of Babel, Languages, Evaluating code blocks, Working With Source Code 15271@node Library of Babel
14320@section Library of Babel 15272@section Library of Babel
14321@cindex babel, library of 15273@cindex babel, library of
14322@cindex source code, library 15274@cindex source code, library
14323@cindex code block, library 15275@cindex code block, library
14324 15276
14325The ``Library of Babel'' consists of code blocks that can be called from any 15277The ``Library of Babel'' is a collection of code blocks. Like a function
14326Org mode file. Code blocks defined in the ``Library of Babel'' can be called 15278library, these code blocks can be called from other Org files. This
14327remotely as if they were in the current Org mode buffer (see @ref{Evaluating 15279collection is in a repository file in Org mode format in the @samp{doc}
14328code blocks} for information on the syntax of remote code block evaluation). 15280directory of Org mode installation. For remote code block evaluation syntax,
14329 15281@pxref{Evaluating code blocks}.
14330
14331The central repository of code blocks in the ``Library of Babel'' is housed
14332in an Org mode file located in the @samp{contrib} directory of Org mode.
14333
14334Users can add code blocks they believe to be generally useful to their
14335``Library of Babel.'' The code blocks can be stored in any Org mode file and
14336then loaded into the library with @code{org-babel-lob-ingest}.
14337
14338 15282
14339@kindex C-c C-v i 15283@kindex C-c C-v i
14340Code blocks located in any Org mode file can be loaded into the ``Library of 15284For any user to add code to the library, first save the code in regular
14341Babel'' with the @code{org-babel-lob-ingest} function, bound to @kbd{C-c C-v 15285@samp{src} code blocks of an Org file, and then load the Org file with
14342i}. 15286@code{org-babel-lob-ingest}, which is bound to @kbd{C-c C-v i}.
14343 15287
14344@node Languages, Header arguments, Library of Babel, Working With Source Code 15288@node Languages
14345@section Languages 15289@section Languages
14346@cindex babel, languages 15290@cindex babel, languages
14347@cindex source code, languages 15291@cindex source code, languages
14348@cindex code block, languages 15292@cindex code block, languages
14349 15293
14350Code blocks in the following languages are supported. 15294Org supports the following languages for the @samp{src} code blocks:
14351 15295
14352@multitable @columnfractions 0.28 0.3 0.22 0.2 15296@multitable @columnfractions 0.25 0.25 0.25 0.25
14353@item @b{Language} @tab @b{Identifier} @tab @b{Language} @tab @b{Identifier} 15297@headitem @b{Language} @tab @b{Identifier} @tab @b{Language} @tab @b{Identifier}
14354@item Asymptote @tab asymptote @tab Awk @tab awk 15298@item Asymptote @tab asymptote @tab Awk @tab awk
14355@item Emacs Calc @tab calc @tab C @tab C 15299@item C @tab C @tab C++ @tab C++
14356@item C++ @tab C++ @tab Clojure @tab clojure 15300@item Clojure @tab clojure @tab CSS @tab css
14357@item CSS @tab css @tab ditaa @tab ditaa 15301@item D @tab d @tab ditaa @tab ditaa
14358@item Graphviz @tab dot @tab Emacs Lisp @tab emacs-lisp 15302@item Graphviz @tab dot @tab Emacs Calc @tab calc
15303@item Emacs Lisp @tab emacs-lisp @tab Fortran @tab fortran
14359@item gnuplot @tab gnuplot @tab Haskell @tab haskell 15304@item gnuplot @tab gnuplot @tab Haskell @tab haskell
14360@item Java @tab java @tab @tab 15305@item Java @tab java @tab Javascript @tab js
14361@item Javascript @tab js @tab LaTeX @tab latex 15306@item LaTeX @tab latex @tab Ledger @tab ledger
14362@item Ledger @tab ledger @tab Lisp @tab lisp 15307@item Lisp @tab lisp @tab Lilypond @tab lilypond
14363@item Lilypond @tab lilypond @tab MATLAB @tab matlab 15308@item Lua @tab lua @tab MATLAB @tab matlab
14364@item Mscgen @tab mscgen @tab Objective Caml @tab ocaml 15309@item Mscgen @tab mscgen @tab Objective Caml @tab ocaml
14365@item Octave @tab octave @tab Org mode @tab org 15310@item Octave @tab octave @tab Org mode @tab org
14366@item Oz @tab oz @tab Perl @tab perl 15311@item Oz @tab oz @tab Perl @tab perl
14367@item Plantuml @tab plantuml @tab Python @tab python 15312@item Plantuml @tab plantuml @tab Processing.js @tab processing
14368@item R @tab R @tab Ruby @tab ruby 15313@item Python @tab python @tab R @tab R
14369@item Sass @tab sass @tab Scheme @tab scheme 15314@item Ruby @tab ruby @tab Sass @tab sass
14370@item GNU Screen @tab screen @tab shell @tab sh 15315@item Scheme @tab scheme @tab GNU Screen @tab screen
15316@item Sed @tab sed @tab shell @tab sh
14371@item SQL @tab sql @tab SQLite @tab sqlite 15317@item SQL @tab sql @tab SQLite @tab sqlite
14372@end multitable 15318@end multitable
14373 15319
14374Language-specific documentation is available for some languages. If 15320Additional documentation for some languages are at
14375available, it can be found at
14376@uref{http://orgmode.org/worg/org-contrib/babel/languages.html}. 15321@uref{http://orgmode.org/worg/org-contrib/babel/languages.html}.
14377 15322
14378The option @code{org-babel-load-languages} controls which languages are 15323By default, only @code{emacs-lisp} is enabled for evaluation. To enable or
14379enabled for evaluation (by default only @code{emacs-lisp} is enabled). This 15324disable other languages, customize the @code{org-babel-load-languages}
14380variable can be set using the customization interface or by adding code like 15325variable either through the Emacs customization interface, or by adding code
14381the following to your emacs configuration. 15326to the init file as shown next:
14382 15327
14383@quotation 15328In this example, evaluation is disabled for @code{emacs-lisp}, and enabled
14384The following disables @code{emacs-lisp} evaluation and enables evaluation of 15329for @code{R}.
14385@code{R} code blocks.
14386@end quotation
14387 15330
14388@lisp 15331@lisp
14389(org-babel-do-load-languages 15332(org-babel-do-load-languages
@@ -14392,55 +15335,54 @@ The following disables @code{emacs-lisp} evaluation and enables evaluation of
14392 (R . t))) 15335 (R . t)))
14393@end lisp 15336@end lisp
14394 15337
14395It is also possible to enable support for a language by loading the related 15338Note that this is not the only way to enable a language. Org also enables
14396elisp file with @code{require}. 15339languages when loaded with @code{require} statement. For example, the
14397 15340following enables execution of @code{clojure} code blocks:
14398@quotation
14399The following adds support for evaluating @code{clojure} code blocks.
14400@end quotation
14401 15341
14402@lisp 15342@lisp
14403(require 'ob-clojure) 15343(require 'ob-clojure)
14404@end lisp 15344@end lisp
14405 15345
14406@node Header arguments, Results of evaluation, Languages, Working With Source Code 15346@node Header arguments
14407@section Header arguments 15347@section Header arguments
14408@cindex code block, header arguments 15348@cindex code block, header arguments
14409@cindex source code, block header arguments 15349@cindex source code, block header arguments
14410 15350
14411Code block functionality can be configured with header arguments. This 15351Details of configuring header arguments are shown here.
14412section provides an overview of the use of header arguments, and then
14413describes each header argument in detail.
14414 15352
14415@menu 15353@menu
14416* Using header arguments:: Different ways to set header arguments 15354* Using header arguments:: Different ways to set header arguments
14417* Specific header arguments:: List of header arguments 15355* Specific header arguments:: List of header arguments
14418@end menu 15356@end menu
14419 15357
14420@node Using header arguments, Specific header arguments, Header arguments, Header arguments 15358@node Using header arguments
14421@subsection Using header arguments 15359@subsection Using header arguments
14422 15360
14423The values of header arguments can be set in several way. When the header 15361Since header arguments can be set in several ways, Org prioritizes them in
14424arguments in each layer have been determined, they are combined in order from 15362case of overlaps or conflicts by giving local settings a higher priority.
14425the first, least specific (having the lowest priority) up to the last, most 15363Header values in function calls, for example, override header values from
14426specific (having the highest priority). A header argument with a higher 15364global defaults.
14427priority replaces the same header argument specified at lower priority.
14428@menu 15365@menu
14429* System-wide header arguments:: Set global default values 15366* System-wide header arguments:: Set globally, language-specific
14430* Language-specific header arguments:: Set default values by language 15367* Language-specific header arguments:: Set in the Org file's headers
14431* Header arguments in Org mode properties:: Set default values for a buffer or heading 15368* Header arguments in Org mode properties:: Set in the Org file
14432* Language-specific header arguments in Org mode properties:: Set language-specific default values for a buffer or heading 15369* Language-specific mode properties::
14433* Code block specific header arguments:: The most common way to set values 15370* Code block specific header arguments:: The most commonly used method
14434* Header arguments in function calls:: The most specific level 15371* Arguments in function calls:: The most specific level, takes highest priority
14435@end menu 15372@end menu
14436 15373
14437 15374
14438@node System-wide header arguments, Language-specific header arguments, Using header arguments, Using header arguments 15375@node System-wide header arguments
14439@subsubheading System-wide header arguments 15376@subsubheading System-wide header arguments
14440@vindex org-babel-default-header-args 15377@vindex org-babel-default-header-args
14441System-wide values of header arguments can be specified by adapting the 15378System-wide values of header arguments can be specified by adapting the
14442@code{org-babel-default-header-args} variable: 15379@code{org-babel-default-header-args} variable:
14443 15380
15381@cindex @code{:session}, src header argument
15382@cindex @code{:results}, src header argument
15383@cindex @code{:exports}, src header argument
15384@cindex @code{:cache}, src header argument
15385@cindex @code{:noweb}, src header argument
14444@example 15386@example
14445:session => "none" 15387:session => "none"
14446:results => "replace" 15388:results => "replace"
@@ -14449,10 +15391,8 @@ System-wide values of header arguments can be specified by adapting the
14449:noweb => "no" 15391:noweb => "no"
14450@end example 15392@end example
14451 15393
14452For example, the following example could be used to set the default value of 15394This example sets @code{:noweb} header arguments to @code{yes}, which makes
14453@code{:noweb} header arguments to @code{yes}. This would have the effect of 15395Org expand @code{:noweb} references by default.
14454expanding @code{:noweb} references by default when evaluating source code
14455blocks.
14456 15396
14457@lisp 15397@lisp
14458(setq org-babel-default-header-args 15398(setq org-babel-default-header-args
@@ -14460,48 +15400,40 @@ blocks.
14460 (assq-delete-all :noweb org-babel-default-header-args))) 15400 (assq-delete-all :noweb org-babel-default-header-args)))
14461@end lisp 15401@end lisp
14462 15402
14463@node Language-specific header arguments, Header arguments in Org mode properties, System-wide header arguments, Using header arguments 15403@node Language-specific header arguments
14464@subsubheading Language-specific header arguments 15404@subsubheading Language-specific header arguments
14465Each language can define its own set of default header arguments in variable 15405Each language can have separate default header arguments by customizing the
14466@code{org-babel-default-header-args:<lang>}, where @code{<lang>} is the name 15406variable @code{org-babel-default-header-args:<lang>}, where @code{<lang>} is
14467of the language. See the language-specific documentation available online at 15407the name of the language. For details, see the language-specific online
14468@uref{http://orgmode.org/worg/org-contrib/babel}. 15408documentation at @uref{http://orgmode.org/worg/org-contrib/babel}.
14469 15409
14470@node Header arguments in Org mode properties, Language-specific header arguments in Org mode properties, Language-specific header arguments, Using header arguments 15410@node Header arguments in Org mode properties
14471@subsubheading Header arguments in Org mode properties 15411@subsubheading Header arguments in Org mode properties
14472 15412
14473Buffer-wide header arguments may be specified as properties through the use 15413For header arguments applicable to the buffer, use @code{#+PROPERTY:} lines
14474of @code{#+PROPERTY:} lines placed anywhere in an Org mode file (see 15414anywhere in the Org mode file (@pxref{Property syntax}).
14475@ref{Property syntax}).
14476 15415
14477For example the following would set @code{session} to @code{*R*} (only for R 15416The following example sets only for @samp{R} code blocks to @code{session},
14478code blocks), and @code{results} to @code{silent} for every code block in the 15417making all the @samp{R} code blocks execute in the same session. Setting
14479buffer, ensuring that all execution took place in the same session, and no 15418@code{results} to @code{silent} ignores the results of executions for all
14480results would be inserted into the buffer. 15419blocks, not just @samp{R} code blocks; no results inserted for any block.
14481 15420
14482@example 15421@example
14483#+PROPERTY: header-args:R :session *R* 15422#+PROPERTY: header-args:R :session *R*
14484#+PROPERTY: header-args :results silent 15423#+PROPERTY: header-args :results silent
14485@end example 15424@end example
14486 15425
14487Header arguments read from Org mode properties can also be set on a
14488per-subtree basis using property drawers (see @ref{Property syntax}).
14489@vindex org-use-property-inheritance 15426@vindex org-use-property-inheritance
14490When properties are used to set default header arguments, they are always 15427Header arguments set through Org's property drawers (@pxref{Property syntax})
14491looked up with inheritance, regardless of the value of 15428apply at the sub-tree level on down. Since these property drawers can appear
14492@code{org-use-property-inheritance}. Properties are evaluated as seen by the 15429anywhere in the file hierarchy, Org uses outermost call or source block to
14493outermost call or source block.@footnote{The deprecated syntax for default 15430resolve the values. Org ignores @code{org-use-property-inheritance} setting.
14494header argument properties, using the name of the header argument as a
14495property name directly, evaluates the property as seen by the corresponding
14496source block definition. This behavior has been kept for backwards
14497compatibility.}
14498 15431
14499In the following example the value of 15432In this example, @code{:cache} defaults to @code{yes} for all code blocks in
14500the @code{:cache} header argument will default to @code{yes} in all code 15433the sub-tree starting with @samp{sample header}.
14501blocks in the subtree rooted at the following heading:
14502 15434
14503@example 15435@example
14504* outline header 15436* sample header
14505 :PROPERTIES: 15437 :PROPERTIES:
14506 :header-args: :cache yes 15438 :header-args: :cache yes
14507 :END: 15439 :END:
@@ -14509,17 +15441,16 @@ blocks in the subtree rooted at the following heading:
14509 15441
14510@kindex C-c C-x p 15442@kindex C-c C-x p
14511@vindex org-babel-default-header-args 15443@vindex org-babel-default-header-args
14512Properties defined in this way override the properties set in 15444Properties defined through @code{org-set-property} function, bound to
14513@code{org-babel-default-header-args} and are applied for all activated 15445@kbd{C-c C-x p}, apply to all active languages. They override properties set
14514languages. It is convenient to use the @code{org-set-property} function 15446in @code{org-babel-default-header-args}.
14515bound to @kbd{C-c C-x p} to set properties in Org mode documents.
14516 15447
14517@node Language-specific header arguments in Org mode properties, Code block specific header arguments, Header arguments in Org mode properties, Using header arguments 15448@node Language-specific mode properties
14518@subsubheading Language-specific header arguments in Org mode properties 15449@subsubheading Language-specific mode properties
14519 15450
14520Language-specific header arguments are also read from properties 15451Language-specific header arguments are also read from properties
14521@code{header-args:<lang>} where @code{<lang>} is the name of the language 15452@code{header-args:<lang>} where @code{<lang>} is the language identifier.
14522targeted. As an example 15453For example,
14523 15454
14524@example 15455@example
14525* Heading 15456* Heading
@@ -14533,24 +15464,21 @@ targeted. As an example
14533 :END: 15464 :END:
14534@end example 15465@end example
14535 15466
14536would independently set a default session header argument for R and clojure 15467would force separate sessions for clojure blocks in Heading and Subheading,
14537for calls and source blocks under subtree ``Heading'' and change to a 15468but use the same session for all @samp{R} blocks. Blocks in Subheading
14538different clojure setting for evaluations under subtree ``Subheading'', while 15469inherit settings from Heading.
14539the R session is inherited from ``Heading'' and therefore unchanged.
14540 15470
14541@node Code block specific header arguments, Header arguments in function calls, Language-specific header arguments in Org mode properties, Using header arguments 15471@node Code block specific header arguments
14542@subsubheading Code block specific header arguments 15472@subsubheading Code block specific header arguments
14543 15473
14544The most common way to assign values to header arguments is at the 15474Header arguments are most commonly set at the @samp{src} code block level, on
14545code block level. This can be done by listing a sequence of header 15475the @code{#+BEGIN_SRC} line. Arguments set at this level take precedence
14546arguments and their values as part of the @code{#+BEGIN_SRC} line. 15476over those set in the @code{org-babel-default-header-args} variable, and also
14547Properties set in this way override both the values of 15477those set as header properties.
14548@code{org-babel-default-header-args} and header arguments specified as 15478
14549properties. In the following example, the @code{:results} header argument 15479In the following example, setting @code{results} to @code{silent} makes it
14550is set to @code{silent}, meaning the results of execution will not be 15480ignore results of the code execution. Setting @code{:exports} to @code{code}
14551inserted in the buffer, and the @code{:exports} header argument is set to 15481exports only the body of the @samp{src} code block to HTML or @LaTeX{}.:
14552@code{code}, meaning only the body of the code block will be
14553preserved on export to HTML or @LaTeX{}.
14554 15482
14555@example 15483@example
14556#+NAME: factorial 15484#+NAME: factorial
@@ -14559,93 +15487,93 @@ fac 0 = 1
14559fac n = n * fac (n-1) 15487fac n = n * fac (n-1)
14560#+END_SRC 15488#+END_SRC
14561@end example 15489@end example
14562Similarly, it is possible to set header arguments for inline code blocks 15490
15491The same header arguments in an inline @samp{src} code block:
14563 15492
14564@example 15493@example
14565src_haskell[:exports both]@{fac 5@} 15494src_haskell[:exports both]@{fac 5@}
14566@end example 15495@end example
14567 15496
14568Code block header arguments can span multiple lines using @code{#+HEADER:} or 15497Code block header arguments can span multiple lines using @code{#+HEADER:} on
14569@code{#+HEADERS:} lines preceding a code block or nested between the 15498each line. Note that Org currently accepts the plural spelling of
14570@code{#+NAME:} line and the @code{#+BEGIN_SRC} line of a named code block. 15499@code{#+HEADER:} only as a convenience for backward-compatibility. It may be
15500removed at some point.
15501
14571@cindex #+HEADER: 15502@cindex #+HEADER:
14572@cindex #+HEADERS:
14573 15503
14574Multi-line header arguments on an un-named code block: 15504Multi-line header arguments on an unnamed @samp{src} code block:
14575 15505
14576@example 15506@example
14577 #+HEADERS: :var data1=1 15507#+HEADER: :var data1=1
14578 #+BEGIN_SRC emacs-lisp :var data2=2 15508#+BEGIN_SRC emacs-lisp :var data2=2
14579 (message "data1:%S, data2:%S" data1 data2) 15509 (message "data1:%S, data2:%S" data1 data2)
14580 #+END_SRC 15510#+END_SRC
14581 15511
14582 #+RESULTS: 15512#+RESULTS:
14583 : data1:1, data2:2 15513: data1:1, data2:2
14584@end example 15514@end example
14585 15515
14586Multi-line header arguments on a named code block: 15516Multi-line header arguments on a named @samp{src} code block:
14587 15517
14588@example 15518@example
14589 #+NAME: named-block 15519#+NAME: named-block
14590 #+HEADER: :var data=2 15520#+HEADER: :var data=2
14591 #+BEGIN_SRC emacs-lisp 15521#+BEGIN_SRC emacs-lisp
14592 (message "data:%S" data) 15522 (message "data:%S" data)
14593 #+END_SRC 15523#+END_SRC
14594 15524
14595 #+RESULTS: named-block 15525#+RESULTS: named-block
14596 : data:2 15526 : data:2
14597@end example 15527@end example
14598 15528
14599@node Header arguments in function calls, , Code block specific header arguments, Using header arguments 15529@node Arguments in function calls
14600@comment node-name, next, previous, up 15530@subsubheading Arguments in function calls
14601@subsubheading Header arguments in function calls
14602 15531
14603At the most specific level, header arguments for ``Library of Babel'' or 15532Header arguments in function calls are the most specific and override all
14604@code{#+CALL:} lines can be set as shown in the two examples below. For more 15533other settings in case of an overlap. They get the highest priority. Two
14605information on the structure of @code{#+CALL:} lines see @ref{Evaluating code 15534@code{#+CALL:} examples are shown below. For the complete syntax of
14606blocks}. 15535@code{#+CALL:} lines, see @ref{Evaluating code blocks}.
14607 15536
14608The following will apply the @code{:exports results} header argument to the 15537In this example, @code{:exports results} header argument is applied to the
14609evaluation of the @code{#+CALL:} line. 15538evaluation of the @code{#+CALL:} line.
14610 15539
14611@example 15540@example
14612#+CALL: factorial(n=5) :exports results 15541#+CALL: factorial(n=5) :exports results
14613@end example 15542@end example
14614 15543
14615The following will apply the @code{:session special} header argument to the 15544In this example, @code{:session special} header argument is applied to the
14616evaluation of the @code{factorial} code block. 15545evaluation of @code{factorial} code block.
14617 15546
14618@example 15547@example
14619#+CALL: factorial[:session special](n=5) 15548#+CALL: factorial[:session special](n=5)
14620@end example 15549@end example
14621 15550
14622@node Specific header arguments, , Using header arguments, Header arguments 15551@node Specific header arguments
14623@subsection Specific header arguments 15552@subsection Specific header arguments
14624Header arguments consist of an initial colon followed by the name of the 15553Org comes with many header arguments common to all languages. New header
14625argument in lowercase letters. The following header arguments are defined: 15554arguments are added for specific languages as they become available for use
15555in @samp{src} code blocks. A header argument is specified with an initial
15556colon followed by the argument's name in lowercase. Common header arguments
15557are:
14626 15558
14627@menu 15559@menu
14628* var:: Pass arguments to code blocks 15560* var:: Pass arguments to @samp{src} code blocks
14629* results:: Specify the type of results and how they will 15561* results:: Specify results type; how to collect
14630 be collected and handled 15562* file:: Specify a path for output file
14631* file:: Specify a path for file output
14632* file-desc:: Specify a description for file results 15563* file-desc:: Specify a description for file results
14633* dir:: Specify the default (possibly remote) 15564* file-ext:: Specify an extension for file output
14634 directory for code block execution 15565* output-dir:: Specify a directory for output file
14635* exports:: Export code and/or results 15566* dir:: Specify the default directory for code block execution
14636* tangle:: Toggle tangling and specify file name 15567* exports:: Specify exporting code, results, both, none
14637* mkdirp:: Toggle creation of parent directories of target 15568* tangle:: Toggle tangling; or specify file name
14638 files during tangling 15569* mkdirp:: Toggle for parent directory creation for target files during tangling
14639* comments:: Toggle insertion of comments in tangled 15570* comments:: Toggle insertion of comments in tangled code files
14640 code files 15571* padline:: Control insertion of padding lines in tangled code files
14641* padline:: Control insertion of padding lines in tangled 15572* no-expand:: Turn off variable assignment and noweb expansion during tangling
14642 code files
14643* no-expand:: Turn off variable assignment and noweb
14644 expansion during tangling
14645* session:: Preserve the state of code evaluation 15573* session:: Preserve the state of code evaluation
14646* noweb:: Toggle expansion of noweb references 15574* noweb:: Toggle expansion of noweb references
14647* noweb-ref:: Specify block's noweb reference resolution target 15575* noweb-ref:: Specify block's noweb reference resolution target
14648* noweb-sep:: String used to separate noweb references 15576* noweb-sep:: String to separate noweb references
14649* cache:: Avoid re-evaluating unchanged code blocks 15577* cache:: Avoid re-evaluating unchanged code blocks
14650* sep:: Delimiter for writing tabular results outside Org 15578* sep:: Delimiter for writing tabular results outside Org
14651* hlines:: Handle horizontal lines in tables 15579* hlines:: Handle horizontal lines in tables
@@ -14655,45 +15583,46 @@ argument in lowercase letters. The following header arguments are defined:
14655* tangle-mode:: Set permission of tangled files 15583* tangle-mode:: Set permission of tangled files
14656* eval:: Limit evaluation of specific code blocks 15584* eval:: Limit evaluation of specific code blocks
14657* wrap:: Mark source block evaluation results 15585* wrap:: Mark source block evaluation results
14658* post:: Post processing of code block results 15586* post:: Post processing of results of code block evaluation
14659* prologue:: Text to prepend to code block body 15587* prologue:: Text to prepend to body of code block
14660* epilogue:: Text to append to code block body 15588* epilogue:: Text to append to body of code block
14661@end menu 15589@end menu
14662 15590
14663Additional header arguments are defined on a language-specific basis, see 15591For language-specific header arguments, see @ref{Languages}.
14664@ref{Languages}.
14665 15592
14666@node var, results, Specific header arguments, Specific header arguments 15593@node var
14667@subsubsection @code{:var} 15594@subsubsection @code{:var}
14668The @code{:var} header argument is used to pass arguments to code blocks. 15595@cindex @code{:var}, src header argument
14669The specifics of how arguments are included in a code block vary by language; 15596Use @code{:var} for passing arguments to @samp{src} code blocks. The
14670these are addressed in the language-specific documentation. However, the 15597specifics of variables in @samp{src} code blocks vary by the source language
14671syntax used to specify arguments is the same across all languages. In every 15598and are covered in the language-specific documentation. The syntax for
14672case, variables require a default value when they are declared. 15599@code{:var}, however, is the same for all languages. This includes declaring
15600a variable, and assigning a default value.
14673 15601
14674The values passed to arguments can either be literal values, references, or 15602Arguments can take values as literals, or as references, or even as Emacs
14675Emacs Lisp code (see @ref{var, Emacs Lisp evaluation of variables}). 15603Lisp code (@pxref{var, Emacs Lisp evaluation of variables}). References are
14676References include anything in the Org mode file that takes a @code{#+NAME:} 15604names from the Org file from the lines @code{#+NAME:} or @code{#+RESULTS:}.
14677or @code{#+RESULTS:} line: tables, lists, @code{#+BEGIN_EXAMPLE} blocks, 15605References can also refer to tables, lists, @code{#+BEGIN_EXAMPLE} blocks,
14678other code blocks and the results of other code blocks. 15606other types of @samp{src} code blocks, or the results of execution of
15607@samp{src} code blocks.
14679 15608
14680Note: When a reference is made to another code block, the referenced block 15609For better performance, Org can cache results of evaluations. But caching
14681will be evaluated unless it has current cached results (see @ref{cache}). 15610comes with severe limitations (@pxref{cache}).
14682 15611
14683Argument values can be indexed in a manner similar to arrays (see @ref{var, 15612Argument values are indexed like arrays (@pxref{var, Indexable variable
14684Indexable variable values}). 15613values}).
14685 15614
14686The following syntax is used to pass arguments to code blocks using the 15615The following syntax is used to pass arguments to @samp{src} code blocks
14687@code{:var} header argument. 15616using the @code{:var} header argument.
14688 15617
14689@example 15618@example
14690:var name=assign 15619:var name=assign
14691@end example 15620@end example
14692 15621
14693The argument, @code{assign}, can either be a literal value, such as a string 15622The @code{assign} is a literal value, such as a string @samp{"string"}, a
14694@samp{"string"} or a number @samp{9}, or a reference to a table, a list, a 15623number @samp{9}, a reference to a table, a list, a literal example, another
14695literal example, another code block (with or without arguments), or the 15624code block (with or without arguments), or the results from evaluating a code
14696results of evaluating another code block. 15625block.
14697 15626
14698Here are examples of passing values by reference: 15627Here are examples of passing values by reference:
14699 15628
@@ -14719,8 +15648,8 @@ an Org mode table named with either a @code{#+NAME:} line
14719@end example 15648@end example
14720 15649
14721@item list 15650@item list
14722a simple list named with a @code{#+NAME:} line (note that nesting is not 15651a simple list named with a @code{#+NAME:} line. Note that only the top level
14723carried through to the source code block) 15652list items are passed along. Nested list items are ignored.
14724 15653
14725@example 15654@example
14726#+NAME: example-list 15655#+NAME: example-list
@@ -14751,9 +15680,9 @@ optionally followed by parentheses
14751@end example 15680@end example
14752 15681
14753@item code block with arguments 15682@item code block with arguments
14754a code block name, as assigned by @code{#+NAME:}, followed by parentheses and 15683a @samp{src} code block name, as assigned by @code{#+NAME:}, followed by
14755optional arguments passed within the parentheses following the 15684parentheses and optional arguments passed within the parentheses following
14756code block name using standard function call syntax 15685the @samp{src} code block name using standard function call syntax
14757 15686
14758@example 15687@example
14759#+NAME: double 15688#+NAME: double
@@ -14765,7 +15694,7 @@ code block name using standard function call syntax
14765: 16 15694: 16
14766 15695
14767#+NAME: squared 15696#+NAME: squared
14768#+BEGIN_SRC emacs-lisp :var input=double(input=1) 15697#+BEGIN_SRC emacs-lisp :var input=double(input=2)
14769(* input input) 15698(* input input)
14770#+END_SRC 15699#+END_SRC
14771 15700
@@ -14797,14 +15726,14 @@ on two lines
14797@end table 15726@end table
14798 15727
14799@subsubheading Indexable variable values 15728@subsubheading Indexable variable values
14800It is possible to reference portions of variable values by ``indexing'' into 15729Indexing variable values enables referencing portions of a variable. Indexes
14801the variables. Indexes are 0 based with negative values counting back from 15730are 0 based with negative values counting backwards from the end. If an
14802the end. If an index is separated by @code{,}s then each subsequent section 15731index is separated by @code{,}s then each subsequent section will index as
14803will index into the next deepest nesting or dimension of the value. Note 15732the next dimension. Note that this indexing occurs @emph{before} other
14804that this indexing occurs @emph{before} other table related header arguments 15733table-related header arguments are applied, such as @code{:hlines},
14805like @code{:hlines}, @code{:colnames} and @code{:rownames} are applied. The 15734@code{:colnames} and @code{:rownames}. The following example assigns the
14806following example assigns the last cell of the first row the table 15735last cell of the first row the table @code{example-table} to the variable
14807@code{example-table} to the variable @code{data}: 15736@code{data}:
14808 15737
14809@example 15738@example
14810#+NAME: example-table 15739#+NAME: example-table
@@ -14844,10 +15773,9 @@ to @code{data}.
14844| 4 | d | 15773| 4 | d |
14845@end example 15774@end example
14846 15775
14847Additionally, an empty index, or the single character @code{*}, are both 15776To pick the entire range, use an empty index, or the single character
14848interpreted to mean the entire range and as such are equivalent to 15777@code{*}. @code{0:-1} does the same thing. Example below shows how to
14849@code{0:-1}, as shown in the following example in which the entire first 15778reference the first column only.
14850column is referenced.
14851 15779
14852@example 15780@example
14853#+NAME: example-table 15781#+NAME: example-table
@@ -14864,9 +15792,9 @@ column is referenced.
14864| 1 | 2 | 3 | 4 | 15792| 1 | 2 | 3 | 4 |
14865@end example 15793@end example
14866 15794
14867It is possible to index into the results of code blocks as well as tables. 15795Index referencing can be used for tables and code blocks. Index referencing
14868Any number of dimensions can be indexed. Dimensions are separated from one 15796can handle any number of dimensions. Commas delimit multiple dimensions, as
14869another by commas, as shown in the following example. 15797shown below.
14870 15798
14871@example 15799@example
14872#+NAME: 3D 15800#+NAME: 3D
@@ -14886,14 +15814,13 @@ another by commas, as shown in the following example.
14886 15814
14887@subsubheading Emacs Lisp evaluation of variables 15815@subsubheading Emacs Lisp evaluation of variables
14888 15816
14889Emacs lisp code can be used to initialize variable values. When a variable 15817Emacs lisp code can set the values for variables. To differentiate a value
14890value starts with @code{(}, @code{[}, @code{'} or @code{`} it will be 15818from lisp code, Org interprets any value starting with @code{(}, @code{[},
14891evaluated as Emacs Lisp and the result of the evaluation will be assigned as 15819@code{'} or @code{`} as Emacs Lisp code. The result of evaluating that code
14892the variable value. The following example demonstrates use of this 15820is then assigned to the value of that variable. The following example shows
14893evaluation to reliably pass the file-name of the Org mode buffer to a code 15821how to reliably query and pass file name of the Org mode buffer to a code
14894block---note that evaluation of header arguments is guaranteed to take place 15822block using headers. We need reliability here because the file's name could
14895in the original Org mode file, while there is no such guarantee for 15823change once the code in the block starts executing.
14896evaluation of the code block body.
14897 15824
14898@example 15825@example
14899#+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both 15826#+BEGIN_SRC sh :var filename=(buffer-file-name) :exports both
@@ -14901,14 +15828,14 @@ evaluation of the code block body.
14901#+END_SRC 15828#+END_SRC
14902@end example 15829@end example
14903 15830
14904Note that values read from tables and lists will not be evaluated as 15831Note that values read from tables and lists will not be mistakenly evaluated
14905Emacs Lisp, as shown in the following example. 15832as Emacs Lisp code, as illustrated in the following example.
14906 15833
14907@example 15834@example
14908#+NAME: table 15835#+NAME: table
14909| (a b c) | 15836| (a b c) |
14910 15837
14911#+HEADERS: :var data=table[0,0] 15838#+HEADER: :var data=table[0,0]
14912#+BEGIN_SRC perl 15839#+BEGIN_SRC perl
14913 $data 15840 $data
14914#+END_SRC 15841#+END_SRC
@@ -14917,167 +15844,171 @@ Emacs Lisp, as shown in the following example.
14917: (a b c) 15844: (a b c)
14918@end example 15845@end example
14919 15846
14920@node results, file, var, Specific header arguments 15847@node results
14921@subsubsection @code{:results} 15848@subsubsection @code{:results}
15849@cindex @code{:results}, src header argument
14922 15850
14923There are four classes of @code{:results} header argument. Only one option 15851There are four classes of @code{:results} header arguments. Each @samp{src}
14924per class may be supplied per code block. 15852code block can take only one option per class.
14925 15853
14926@itemize @bullet 15854@itemize @bullet
14927@item 15855@item
14928@b{collection} header arguments specify how the results should be collected 15856@b{collection} for how the results should be collected from the @samp{src}
14929from the code block 15857code block
14930@item 15858@item
14931@b{type} header arguments specify what type of result the code block will 15859@b{type} for which type of result the code block will return; affects how Org
14932return---which has implications for how they will be processed before 15860processes and inserts results in the Org buffer
14933insertion into the Org mode buffer
14934@item 15861@item
14935@b{format} header arguments specify what type of result the code block will 15862@b{format} for the result; affects how Org processes and inserts results in
14936return---which has implications for how they will be inserted into the 15863the Org buffer
14937Org mode buffer
14938@item 15864@item
14939@b{handling} header arguments specify how the results of evaluating the code 15865@b{handling} for processing results after evaluation of the @samp{src} code
14940block should be handled. 15866block
14941@end itemize 15867@end itemize
14942 15868
14943@subsubheading Collection 15869@subsubheading Collection
14944The following options are mutually exclusive, and specify how the results 15870Collection options specify the results. Choose one of the options; they are
14945should be collected from the code block. 15871mutually exclusive.
14946 15872
14947@itemize @bullet 15873@itemize @bullet
14948@item @code{value} 15874@item @code{value}
14949This is the default. The result is the value of the last statement in the 15875Default. Functional mode. Result is the value returned by the last
14950code block. This header argument places the evaluation in functional 15876statement in the @samp{src} code block. Languages like Python may require an
14951mode. Note that in some languages, e.g., Python, use of this result type 15877explicit @code{return} statement in the @samp{src} code block. Usage
14952requires that a @code{return} statement be included in the body of the source 15878example: @code{:results value}.
14953code block. E.g., @code{:results value}.
14954@item @code{output} 15879@item @code{output}
14955The result is the collection of everything printed to STDOUT during the 15880Scripting mode. Result is collected from STDOUT during execution of the code
14956execution of the code block. This header argument places the 15881in the @samp{src} code block. Usage example: @code{:results output}.
14957evaluation in scripting mode. E.g., @code{:results output}.
14958@end itemize 15882@end itemize
14959 15883
14960@subsubheading Type 15884@subsubheading Type
14961 15885Type tells what result types to expect from the execution of the code
14962The following options are mutually exclusive and specify what type of results 15886block. Choose one of the options; they are mutually exclusive. The default
14963the code block will return. By default, results are inserted as either a 15887behavior is to automatically determine the result type.
14964table or scalar depending on their value.
14965 15888
14966@itemize @bullet 15889@itemize @bullet
14967@item @code{table}, @code{vector} 15890@item @code{table}, @code{vector}
14968The results should be interpreted as an Org mode table. If a single value is 15891Interpret the results as an Org table. If the result is a single value,
14969returned, it will be converted into a table with one row and one column. 15892create a table with one row and one column. Usage example: @code{:results
14970E.g., @code{:results value table}. 15893value table}.
14971@item @code{list} 15894@item @code{list}
14972The results should be interpreted as an Org mode list. If a single scalar 15895Interpret the results as an Org list. If the result is a single value,
14973value is returned it will be converted into a list with only one element. 15896create a list of one element.
14974@item @code{scalar}, @code{verbatim} 15897@item @code{scalar}, @code{verbatim}
14975The results should be interpreted literally---they will not be 15898Interpret literally and insert as quoted text. Do not create a table. Usage
14976converted into a table. The results will be inserted into the Org mode 15899example: @code{:results value verbatim}.
14977buffer as quoted text. E.g., @code{:results value verbatim}.
14978@item @code{file} 15900@item @code{file}
14979The results will be interpreted as the path to a file, and will be inserted 15901Interpret as path to a file. Inserts a link to the file. Usage example:
14980into the Org mode buffer as a file link. E.g., @code{:results value file}. 15902@code{:results value file}.
14981@end itemize 15903@end itemize
14982 15904
14983@subsubheading Format 15905@subsubheading Format
14984 15906Format pertains to the type of the result returned by the @samp{src} code
14985The following options are mutually exclusive and specify what type of results 15907block. Choose one of the options; they are mutually exclusive. The default
14986the code block will return. By default, results are inserted according to the 15908follows from the type specified above.
14987type as specified above.
14988 15909
14989@itemize @bullet 15910@itemize @bullet
14990@item @code{raw} 15911@item @code{raw}
14991The results are interpreted as raw Org mode code and are inserted directly 15912Interpreted as raw Org mode. Inserted directly into the buffer. Aligned if
14992into the buffer. If the results look like a table they will be aligned as 15913it is a table. Usage example: @code{:results value raw}.
14993such by Org mode. E.g., @code{:results value raw}.
14994@item @code{org} 15914@item @code{org}
14995The results are will be enclosed in a @code{BEGIN_SRC org} block. 15915Results enclosed in a @code{BEGIN_SRC org} block. For comma-escape, either
14996They are not comma-escaped by default but they will be if you hit @kbd{TAB} 15916@kbd{TAB} in the block, or export the file. Usage example: @code{:results
14997in the block and/or if you export the file. E.g., @code{:results value org}. 15917value org}.
14998@item @code{html} 15918@item @code{html}
14999Results are assumed to be HTML and will be enclosed in a @code{BEGIN_HTML} 15919Results enclosed in a @code{BEGIN_EXPORT html} block. Usage example:
15000block. E.g., @code{:results value html}. 15920@code{:results value html}.
15001@item @code{latex} 15921@item @code{latex}
15002Results assumed to be @LaTeX{} and are enclosed in a @code{BEGIN_LaTeX} block. 15922Results enclosed in a @code{BEGIN_EXPORT latex} block. Usage example:
15003E.g., @code{:results value latex}. 15923@code{:results value latex}.
15004@item @code{code} 15924@item @code{code}
15005Result are assumed to be parsable code and are enclosed in a code block. 15925Result enclosed in a @samp{src} code block. Useful for parsing. Usage
15006E.g., @code{:results value code}. 15926example: @code{:results value code}.
15007@item @code{pp} 15927@item @code{pp}
15008The result is converted to pretty-printed code and is enclosed in a code 15928Result converted to pretty-print source code. Enclosed in a @samp{src} code
15009block. This option currently supports Emacs Lisp, Python, and Ruby. E.g., 15929block. Languages supported: Emacs Lisp, Python, and Ruby. Usage example:
15010@code{:results value pp}. 15930@code{:results value pp}.
15011@item @code{drawer} 15931@item @code{drawer}
15012The result is wrapped in a RESULTS drawer. This can be useful for 15932Result wrapped in a RESULTS drawer. Useful for containing @code{raw} or
15013inserting @code{raw} or @code{org} syntax results in such a way that their 15933@code{org} results for later scripting and automated processing. Usage
15014extent is known and they can be automatically removed or replaced. 15934example: @code{:results value drawer}.
15015@end itemize 15935@end itemize
15016 15936
15017@subsubheading Handling 15937@subsubheading Handling
15018The following results options indicate what happens with the 15938Handling options after collecting the results.
15019results once they are collected.
15020 15939
15021@itemize @bullet 15940@itemize @bullet
15022@item @code{silent} 15941@item @code{silent}
15023The results will be echoed in the minibuffer but will not be inserted into 15942Do not insert results in the Org mode buffer, but echo them in the
15024the Org mode buffer. E.g., @code{:results output silent}. 15943minibuffer. Usage example: @code{:results output silent}.
15025@item @code{replace} 15944@item @code{replace}
15026The default value. Any existing results will be removed, and the new results 15945Default. Insert results in the Org buffer. Remove previous results. Usage
15027will be inserted into the Org mode buffer in their place. E.g., 15946example: @code{:results output replace}.
15028@code{:results output replace}.
15029@item @code{append} 15947@item @code{append}
15030If there are pre-existing results of the code block then the new results will 15948Append results to the Org buffer. Latest results are at the bottom. Does
15031be appended to the existing results. Otherwise the new results will be 15949not remove previous results. Usage example: @code{:results output append}.
15032inserted as with @code{replace}.
15033@item @code{prepend} 15950@item @code{prepend}
15034If there are pre-existing results of the code block then the new results will 15951Prepend results to the Org buffer. Latest results are at the top. Does not
15035be prepended to the existing results. Otherwise the new results will be 15952remove previous results. Usage example: @code{:results output prepend}.
15036inserted as with @code{replace}.
15037@end itemize 15953@end itemize
15038 15954
15039@node file, file-desc, results, Specific header arguments 15955@node file
15040@subsubsection @code{:file} 15956@subsubsection @code{:file}
15957@cindex @code{:file}, src header argument
15958
15959An external @code{:file} that saves the results of execution of the code
15960block. The @code{:file} is either a file name or two strings, where the
15961first is the file name and the second is the description. A link to the file
15962is inserted. It uses an Org mode style @code{[[file:]]} link (@pxref{Link
15963format}). Some languages, such as @samp{R}, @samp{dot}, @samp{ditaa}, and
15964@samp{gnuplot}, automatically wrap the source code in additional boilerplate
15965code. Such code wrapping helps recreate the output, especially graphics
15966output, by executing just the @code{:file} contents.
15967
15968@node file-desc
15969@subsubsection @code{:file-desc}
15041 15970
15042The header argument @code{:file} is used to specify an external file in which 15971A description of the results file. Org uses this description for the link
15043to save code block results. After code block evaluation an Org mode style 15972(see @ref{Link format}) it inserts in the Org file. If the @code{:file-desc}
15044@code{[[file:]]} link (see @ref{Link format}) to the file will be inserted 15973has no value, Org will use file name for both the ``link'' and the
15045into the Org mode buffer. Some languages including R, gnuplot, dot, and 15974``description'' portion of the Org mode link.
15046ditaa provide special handling of the @code{:file} header argument
15047automatically wrapping the code block body in the boilerplate code required
15048to save output to the specified file. This is often useful for saving
15049graphical output of a code block to the specified file.
15050 15975
15051The argument to @code{:file} should be either a string specifying the path to 15976@node file-ext
15052a file, or a list of two strings in which case the first element of the list 15977@subsubsection @code{:file-ext}
15053should be the path to a file and the second a description for the link. 15978@cindex @code{:file-ext}, src header argument
15054 15979
15055@node file-desc, dir, file, Specific header arguments 15980File name extension for the output file. Org generates the file's complete
15056@subsubsection @code{:file-desc} 15981name, and extension by combining @code{:file-ext}, @code{#+NAME:} of the
15982source block, and the @ref{output-dir} header argument. To override this
15983auto generated file name, use the @code{:file} header argument.
15057 15984
15058The value of the @code{:file-desc} header argument is used to provide a 15985@node output-dir
15059description for file code block results which are inserted as Org mode links 15986@subsubsection @code{:output-dir}
15060(see @ref{Link format}). If the @code{:file-desc} header argument is given 15987@cindex @code{:output-dir}, src header argument
15061with no value the link path will be placed in both the ``link'' and the 15988
15062``description'' portion of the Org mode link. 15989Specifies the @code{:output-dir} for the results file. Org accepts an
15990absolute path (beginning with @code{/}) or a relative directory (without
15991@code{/}). The value can be combined with @code{#+NAME:} of the source block
15992and @ref{file} or @ref{file-ext} header arguments.
15063 15993
15064@node dir, exports, file-desc, Specific header arguments 15994@node dir
15065@subsubsection @code{:dir} and remote execution 15995@subsubsection @code{:dir} and remote execution
15996@cindex @code{:dir}, src header argument
15066 15997
15067While the @code{:file} header argument can be used to specify the path to the 15998While the @code{:file} header argument can be used to specify the path to the
15068output file, @code{:dir} specifies the default directory during code block 15999output file, @code{:dir} specifies the default directory during @samp{src}
15069execution. If it is absent, then the directory associated with the current 16000code block execution. If it is absent, then the directory associated with
15070buffer is used. In other words, supplying @code{:dir path} temporarily has 16001the current buffer is used. In other words, supplying @code{:dir path}
15071the same effect as changing the current directory with @kbd{M-x cd path RET}, and 16002temporarily has the same effect as changing the current directory with
15072then not supplying @code{:dir}. Under the surface, @code{:dir} simply sets 16003@kbd{M-x cd path RET}, and then not supplying @code{:dir}. Under the
15073the value of the Emacs variable @code{default-directory}. 16004surface, @code{:dir} simply sets the value of the Emacs variable
16005@code{default-directory}.
15074 16006
15075When using @code{:dir}, you should supply a relative path for file output 16007When using @code{:dir}, relative paths (for example, @code{:file myfile.jpg}
15076(e.g., @code{:file myfile.jpg} or @code{:file results/myfile.jpg}) in which 16008or @code{:file results/myfile.jpg}) become relative to the default directory.
15077case that path will be interpreted relative to the default directory.
15078 16009
15079In other words, if you want your plot to go into a folder called @file{Work} 16010For example, to save the plot file in the @samp{Work} folder of the home
15080in your home directory, you could use 16011directory (notice tilde is expanded):
15081 16012
15082@example 16013@example
15083#+BEGIN_SRC R :file myplot.png :dir ~/Work 16014#+BEGIN_SRC R :file myplot.png :dir ~/Work
@@ -15086,8 +16017,8 @@ matplot(matrix(rnorm(100), 10), type="l")
15086@end example 16017@end example
15087 16018
15088@subsubheading Remote execution 16019@subsubheading Remote execution
15089A directory on a remote machine can be specified using tramp file syntax, in 16020To evaluate the @samp{src} code block on a remote machine, supply a remote s
15090which case the code will be evaluated on the remote machine. An example is 16021directory name using @samp{Tramp} syntax. For example:
15091 16022
15092@example 16023@example
15093#+BEGIN_SRC R :file plot.png :dir /scp:dand@@yakuba.princeton.edu: 16024#+BEGIN_SRC R :file plot.png :dir /scp:dand@@yakuba.princeton.edu:
@@ -15095,189 +16026,196 @@ plot(1:10, main=system("hostname", intern=TRUE))
15095#+END_SRC 16026#+END_SRC
15096@end example 16027@end example
15097 16028
15098Text results will be returned to the local Org mode buffer as usual, and file 16029Org first captures the text results as usual for insertion in the Org file.
15099output will be created on the remote machine with relative paths interpreted 16030Then Org also inserts a link to the remote file, thanks to Emacs
15100relative to the remote directory. An Org mode link to the remote file will be 16031@samp{Tramp}. Org constructs the remote path to the file name from
15101created. 16032@code{:dir} and @code{default-directory}, as illustrated here:
15102
15103So, in the above example a plot will be created on the remote machine,
15104and a link of the following form will be inserted in the org buffer:
15105 16033
15106@example 16034@example
15107[[file:/scp:dand@@yakuba.princeton.edu:/home/dand/plot.png][plot.png]] 16035[[file:/scp:dand@@yakuba.princeton.edu:/home/dand/plot.png][plot.png]]
15108@end example 16036@end example
15109 16037
15110Most of this functionality follows immediately from the fact that @code{:dir}
15111sets the value of the Emacs variable @code{default-directory}, thanks to
15112tramp. Those using XEmacs, or GNU Emacs prior to version 23 may need to
15113install tramp separately in order for these features to work correctly.
15114 16038
15115@subsubheading Further points 16039@subsubheading Some more warnings
15116 16040
15117@itemize @bullet 16041@itemize @bullet
15118@item 16042@item
15119If @code{:dir} is used in conjunction with @code{:session}, although it will 16043When @code{:dir} is used with @code{:session}, Org sets the starting
15120determine the starting directory for a new session as expected, no attempt is 16044directory for a new session. But Org will not alter the directory of an
15121currently made to alter the directory associated with an existing session. 16045already existing session.
15122@item 16046@item
15123@code{:dir} should typically not be used to create files during export with 16047Do not use @code{:dir} with @code{:exports results} or with @code{:exports
15124@code{:exports results} or @code{:exports both}. The reason is that, in order 16048both} to avoid Org inserting incorrect links to remote files. That is because
15125to retain portability of exported material between machines, during export 16049Org does not expand @code{default directory} to avoid some underlying
15126links inserted into the buffer will @emph{not} be expanded against @code{default 16050portability issues.
15127directory}. Therefore, if @code{default-directory} is altered using
15128@code{:dir}, it is probable that the file will be created in a location to
15129which the link does not point.
15130@end itemize 16051@end itemize
15131 16052
15132@node exports, tangle, dir, Specific header arguments 16053@node exports
15133@subsubsection @code{:exports} 16054@subsubsection @code{:exports}
16055@cindex @code{:exports}, src header argument
15134 16056
15135The @code{:exports} header argument specifies what should be included in HTML 16057The @code{:exports} header argument is to specify if that part of the Org
15136or @LaTeX{} exports of the Org mode file. 16058file is exported to, say, HTML or @LaTeX{} formats. Note that
16059@code{:exports} affects only @samp{src} code blocks and not inline code.
15137 16060
15138@itemize @bullet 16061@itemize @bullet
15139@item @code{code} 16062@item @code{code}
15140The default. The body of code is included into the exported file. E.g., 16063The default. The body of code is included into the exported file. Example:
15141@code{:exports code}. 16064@code{:exports code}.
15142@item @code{results} 16065@item @code{results}
15143The result of evaluating the code is included in the exported file. E.g., 16066The results of evaluation of the code is included in the exported file.
15144@code{:exports results}. 16067Example: @code{:exports results}.
15145@item @code{both} 16068@item @code{both}
15146Both the code and results are included in the exported file. E.g., 16069Both the code and results of evaluation are included in the exported file.
15147@code{:exports both}. 16070Example: @code{:exports both}.
15148@item @code{none} 16071@item @code{none}
15149Nothing is included in the exported file. E.g., @code{:exports none}. 16072Neither the code nor the results of evaluation is included in the exported
16073file. Whether the code is evaluated at all depends on other
16074options. Example: @code{:exports none}.
15150@end itemize 16075@end itemize
15151 16076
15152@node tangle, mkdirp, exports, Specific header arguments 16077@node tangle
15153@subsubsection @code{:tangle} 16078@subsubsection @code{:tangle}
16079@cindex @code{:tangle}, src header argument
15154 16080
15155The @code{:tangle} header argument specifies whether or not the code 16081The @code{:tangle} header argument specifies if the @samp{src} code block is
15156block should be included in tangled extraction of source code files. 16082exported to source file(s).
15157 16083
15158@itemize @bullet 16084@itemize @bullet
15159@item @code{tangle} 16085@item @code{tangle}
15160The code block is exported to a source code file named after the full path 16086Export the @samp{src} code block to source file. The file name for the
15161(including the directory) and file name (w/o extension) of the Org mode file. 16087source file is derived from the name of the Org file, and the file extension
15162E.g., @code{:tangle yes}. 16088is derived from the source code language identifier. Example: @code{:tangle
16089yes}.
15163@item @code{no} 16090@item @code{no}
15164The default. The code block is not exported to a source code file. 16091The default. Do not extract the code a source code file. Example:
15165E.g., @code{:tangle no}. 16092@code{:tangle no}.
15166@item other 16093@item other
15167Any other string passed to the @code{:tangle} header argument is interpreted 16094Export the @samp{src} code block to source file whose file name is derived
15168as a path (directory and file name relative to the directory of the Org mode 16095from any string passed to the @code{:tangle} header argument. Org derives
15169file) to which the block will be exported. E.g., @code{:tangle path}. 16096the file name as being relative to the directory of the Org file's location.
16097Example: @code{:tangle path}.
15170@end itemize 16098@end itemize
15171 16099
15172@node mkdirp, comments, tangle, Specific header arguments 16100@node mkdirp
15173@subsubsection @code{:mkdirp} 16101@subsubsection @code{:mkdirp}
16102@cindex @code{:mkdirp}, src header argument
15174 16103
15175The @code{:mkdirp} header argument can be used to create parent directories 16104The @code{:mkdirp} header argument creates parent directories for tangled
15176of tangled files when missing. This can be set to @code{yes} to enable 16105files if the directory does not exist. @code{yes} enables directory creation
15177directory creation or to @code{no} to inhibit directory creation. 16106and @code{no} inhibits directory creation.
15178 16107
15179@node comments, padline, mkdirp, Specific header arguments 16108@node comments
15180@subsubsection @code{:comments} 16109@subsubsection @code{:comments}
15181By default code blocks are tangled to source-code files without any insertion 16110@cindex @code{:comments}, src header argument
15182of comments beyond those which may already exist in the body of the code 16111Controls inserting comments into tangled files. These are above and beyond
15183block. The @code{:comments} header argument can be set as follows to control 16112whatever comments may already exist in the @samp{src} code block.
15184the insertion of extra comments into the tangled code file.
15185 16113
15186@itemize @bullet 16114@itemize @bullet
15187@item @code{no} 16115@item @code{no}
15188The default. No extra comments are inserted during tangling. 16116The default. Do not insert any extra comments during tangling.
15189@item @code{link} 16117@item @code{link}
15190The code block is wrapped in comments which contain pointers back to the 16118Wrap the @samp{src} code block in comments. Include links pointing back to
15191original Org file from which the code was tangled. 16119the place in the Org file from where the code was tangled.
15192@item @code{yes} 16120@item @code{yes}
15193A synonym for ``link'' to maintain backwards compatibility. 16121Kept for backward compatibility; same as ``link''.
15194@item @code{org} 16122@item @code{org}
15195Include text from the Org mode file as a comment. 16123Nearest headline text from Org file is inserted as comment. The exact text
15196The text is picked from the leading context of the tangled code and is 16124that is inserted is picked from the leading context of the source block.
15197limited by the nearest headline or source block as the case may be.
15198@item @code{both} 16125@item @code{both}
15199Turns on both the ``link'' and ``org'' comment options. 16126Includes both ``link'' and ``org'' comment options.
15200@item @code{noweb} 16127@item @code{noweb}
15201Turns on the ``link'' comment option, and additionally wraps expanded noweb 16128Includes ``link'' comment option, expands noweb references, and wraps them in
15202references in the code block body in link comments. 16129link comments inside the body of the @samp{src} code block.
15203@end itemize 16130@end itemize
15204 16131
15205@node padline, no-expand, comments, Specific header arguments 16132@node padline
15206@subsubsection @code{:padline} 16133@subsubsection @code{:padline}
15207Control in insertion of padding lines around code block bodies in tangled 16134@cindex @code{:padline}, src header argument
15208code files. The default value is @code{yes} which results in insertion of 16135Control insertion of newlines to pad @samp{src} code blocks in the tangled
15209newlines before and after each tangled code block. The following arguments 16136file.
15210are accepted.
15211
15212@itemize @bullet 16137@itemize @bullet
15213@item @code{yes} 16138@item @code{yes}
15214Insert newlines before and after each code block body in tangled code files. 16139Default. Insert a newline before and after each @samp{src} code block in the
16140tangled file.
15215@item @code{no} 16141@item @code{no}
15216Do not insert any newline padding in tangled output. 16142Do not insert newlines to pad the tangled @samp{src} code blocks.
15217@end itemize 16143@end itemize
15218 16144
15219@node no-expand, session, padline, Specific header arguments 16145@node no-expand
15220@subsubsection @code{:no-expand} 16146@subsubsection @code{:no-expand}
15221 16147@cindex @code{:no-expand}, src header argument
15222By default, code blocks are expanded with @code{org-babel-expand-src-block} 16148
15223during tangling. This has the effect of assigning values to variables 16149By default Org expands @samp{src} code blocks during tangling. The
15224specified with @code{:var} (see @ref{var}), and of replacing ``noweb'' 16150@code{:no-expand} header argument turns off such expansions. Note that one
15225references (see @ref{Noweb reference syntax}) with their targets. The 16151side-effect of expansion by @code{org-babel-expand-src-block} also assigns
15226@code{:no-expand} header argument can be used to turn off this behavior. 16152values to @code{:var} (@pxref{var}) variables. Expansions also replace
15227 16153``noweb'' references with their targets (@pxref{Noweb reference syntax}).
15228@node session, noweb, no-expand, Specific header arguments 16154Some of these expansions may cause premature assignment, hence this option.
16155This option makes a difference only for tangling. It has no effect when
16156exporting since @samp{src} code blocks for execution have to be expanded
16157anyway.
16158
16159@node session
15229@subsubsection @code{:session} 16160@subsubsection @code{:session}
16161@cindex @code{:session}, src header argument
15230 16162
15231The @code{:session} header argument starts a session for an interpreted 16163The @code{:session} header argument is for running multiple source code
15232language where state is preserved. 16164blocks under one session. Org runs @samp{src} code blocks with the same
15233 16165session name in the same interpreter process.
15234By default, a session is not started.
15235 16166
15236A string passed to the @code{:session} header argument will give the session 16167@itemize @bullet
15237a name. This makes it possible to run concurrent sessions for each 16168@item @code{none}
15238interpreted language. 16169Default. Each @samp{src} code block gets a new interpreter process to
16170execute. The process terminates once the block is evaluated.
16171@item @code{other}
16172Any string besides @code{none} turns that string into the name of that
16173session. For example, @code{:session mysession} names it @samp{mysession}.
16174If @code{:session} has no argument, then the session name is derived from the
16175source language identifier. Subsequent blocks with the same source code
16176language use the same session. Depending on the language, state variables,
16177code from other blocks, and the overall interpreted environment may be
16178shared. Some interpreted languages support concurrent sessions when
16179subsequent source code language blocks change session names.
16180@end itemize
15239 16181
15240@node noweb, noweb-ref, session, Specific header arguments 16182@node noweb
15241@subsubsection @code{:noweb} 16183@subsubsection @code{:noweb}
16184@cindex @code{:noweb}, src header argument
15242 16185
15243The @code{:noweb} header argument controls expansion of ``noweb'' syntax 16186The @code{:noweb} header argument controls expansion of ``noweb'' syntax
15244references (see @ref{Noweb reference syntax}) when the code block is 16187references (@pxref{Noweb reference syntax}). Expansions occur when source
15245evaluated, tangled, or exported. The @code{:noweb} header argument can have 16188code blocks are evaluated, tangled, or exported.
15246one of the five values: @code{no}, @code{yes}, @code{tangle}, or
15247@code{no-export} @code{strip-export}.
15248 16189
15249@itemize @bullet 16190@itemize @bullet
15250@item @code{no} 16191@item @code{no}
15251The default. ``Noweb'' syntax references in the body of the code block will 16192Default. No expansion of ``Noweb'' syntax references in the body of the code
15252not be expanded before the code block is evaluated, tangled or exported. 16193when evaluating, tangling, or exporting.
15253@item @code{yes} 16194@item @code{yes}
15254``Noweb'' syntax references in the body of the code block will be 16195Expansion of ``Noweb'' syntax references in the body of the @samp{src} code
15255expanded before the code block is evaluated, tangled or exported. 16196block when evaluating, tangling, or exporting.
15256@item @code{tangle} 16197@item @code{tangle}
15257``Noweb'' syntax references in the body of the code block will be expanded 16198Expansion of ``Noweb'' syntax references in the body of the @samp{src} code
15258before the code block is tangled. However, ``noweb'' syntax references will 16199block when tangling. No expansion when evaluating or exporting.
15259not be expanded when the code block is evaluated or exported.
15260@item @code{no-export} 16200@item @code{no-export}
15261``Noweb'' syntax references in the body of the code block will be expanded 16201Expansion of ``Noweb'' syntax references in the body of the @samp{src} code
15262before the block is evaluated or tangled. However, ``noweb'' syntax 16202block when evaluating or tangling. No expansion when exporting.
15263references will not be expanded when the code block is exported.
15264@item @code{strip-export} 16203@item @code{strip-export}
15265``Noweb'' syntax references in the body of the code block will be expanded 16204Expansion of ``Noweb'' syntax references in the body of the @samp{src} code
15266before the block is evaluated or tangled. However, ``noweb'' syntax 16205block when expanding prior to evaluating or tangling. Removes ``noweb''
15267references will be removed when the code block is exported. 16206syntax references when exporting.
15268@item @code{eval} 16207@item @code{eval}
15269``Noweb'' syntax references in the body of the code block will only be 16208Expansion of ``Noweb'' syntax references in the body of the @samp{src} code
15270expanded before the block is evaluated. 16209block only before evaluating.
15271@end itemize 16210@end itemize
15272 16211
15273@subsubheading Noweb prefix lines 16212@subsubheading Noweb prefix lines
15274Noweb insertions are now placed behind the line prefix of the 16213Noweb insertions now honor prefix characters that appear before
15275@code{<<reference>>}. 16214@code{<<reference>>}. This behavior is illustrated in the following example.
15276This behavior is illustrated in the following example. Because the 16215Because the @code{<<example>>} noweb reference appears behind the SQL comment
15277@code{<<example>>} noweb reference appears behind the SQL comment syntax, 16216syntax, each line of the expanded noweb reference will be commented.
15278each line of the expanded noweb reference will be commented.
15279 16217
15280This code block: 16218This @samp{src} code block:
15281 16219
15282@example 16220@example
15283-- <<example>> 16221-- <<example>>
@@ -15290,23 +16228,20 @@ expands to:
15290-- multi-line body of example 16228-- multi-line body of example
15291@end example 16229@end example
15292 16230
15293Note that noweb replacement text that does not contain any newlines will not 16231Since this change will not affect noweb replacement text without newlines in
15294be affected by this change, so it is still possible to use inline noweb 16232them, inline noweb references are acceptable.
15295references.
15296 16233
15297@node noweb-ref, noweb-sep, noweb, Specific header arguments 16234@node noweb-ref
15298@subsubsection @code{:noweb-ref} 16235@subsubsection @code{:noweb-ref}
15299When expanding ``noweb'' style references the bodies of all code block with 16236@cindex @code{:noweb-ref}, src header argument
15300@emph{either} a block name matching the reference name @emph{or} a
15301@code{:noweb-ref} header argument matching the reference name will be
15302concatenated together to form the replacement text.
15303 16237
15304By setting this header argument at the sub-tree or file level, simple code 16238When expanding ``noweb'' style references, Org concatenates @samp{src} code
15305block concatenation may be achieved. For example, when tangling the 16239blocks by matching the reference name to either the block name or the
15306following Org mode file, the bodies of code blocks will be concatenated into 16240@code{:noweb-ref} header argument.
15307the resulting pure code file@footnote{(The example needs property inheritance 16241
15308to be turned on for the @code{noweb-ref} property, see @ref{Property 16242For simple concatenation, set this @code{:noweb-ref} header argument at the
15309inheritance}).}. 16243sub-tree or file level. In the example Org file shown next, the body of the
16244source code in each block is extracted for concatenation to a pure code file.
15310 16245
15311@example 16246@example
15312 #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh 16247 #+BEGIN_SRC sh :tangle yes :noweb yes :shebang #!/bin/sh
@@ -15314,7 +16249,7 @@ inheritance}).}.
15314 #+END_SRC 16249 #+END_SRC
15315 * the mount point of the fullest disk 16250 * the mount point of the fullest disk
15316 :PROPERTIES: 16251 :PROPERTIES:
15317 :noweb-ref: fullest-disk 16252 :header-args: :noweb-ref fullest-disk
15318 :END: 16253 :END:
15319 16254
15320 ** query all mounted disks 16255 ** query all mounted disks
@@ -15333,45 +16268,60 @@ inheritance}).}.
15333 #+END_SRC 16268 #+END_SRC
15334@end example 16269@end example
15335 16270
15336The @code{:noweb-sep} (see @ref{noweb-sep}) header argument holds the string 16271@node noweb-sep
15337used to separate accumulate noweb references like those above. By default a
15338newline is used.
15339
15340@node noweb-sep, cache, noweb-ref, Specific header arguments
15341@subsubsection @code{:noweb-sep} 16272@subsubsection @code{:noweb-sep}
16273@cindex @code{:noweb-sep}, src header argument
15342 16274
15343The @code{:noweb-sep} header argument holds the string used to separate 16275By default a newline separates each noweb reference concatenation. To change
15344accumulate noweb references (see @ref{noweb-ref}). By default a newline is 16276this newline separator, edit the @code{:noweb-sep} (@pxref{noweb-sep}) header
15345used. 16277argument.
15346 16278
15347@node cache, sep, noweb-sep, Specific header arguments 16279@node cache
15348@subsubsection @code{:cache} 16280@subsubsection @code{:cache}
15349 16281@cindex @code{:cache}, src header argument
15350The @code{:cache} header argument controls the use of in-buffer caching of 16282
15351the results of evaluating code blocks. It can be used to avoid re-evaluating 16283The @code{:cache} header argument is for caching results of evaluating code
15352unchanged code blocks. Note that the @code{:cache} header argument will not 16284blocks. Caching results can avoid re-evaluating @samp{src} code blocks that
15353attempt to cache results when the @code{:session} header argument is used, 16285have not changed since the previous run. To benefit from the cache and avoid
15354because the results of the code block execution may be stored in the session 16286redundant evaluations, the source block must have a result already present in
15355outside of the Org mode buffer. The @code{:cache} header argument can have 16287the buffer, and neither the header arguments (including the value of
15356one of two values: @code{yes} or @code{no}. 16288@code{:var} references) nor the text of the block itself has changed since
16289the result was last computed. This feature greatly helps avoid long-running
16290calculations. For some edge cases, however, the cached results may not be
16291reliable.
16292
16293The caching feature is best for when @samp{src} blocks are pure functions,
16294that is functions that return the same value for the same input arguments
16295(@pxref{var}), and that do not have side effects, and do not rely on external
16296variables other than the input arguments. Functions that depend on a timer,
16297file system objects, and random number generators are clearly unsuitable for
16298caching.
16299
16300A note of warning: when @code{:cache} is used for a @code{:session}, caching
16301may cause unexpected results.
16302
16303When the caching mechanism tests for any source code changes, it will not
16304expand ``noweb'' style references (@pxref{Noweb reference syntax}). For
16305reasons why, see @uref{http://thread.gmane.org/gmane.emacs.orgmode/79046}.
16306
16307The @code{:cache} header argument can have one of two values: @code{yes} or
16308@code{no}.
15357 16309
15358@itemize @bullet 16310@itemize @bullet
15359@item @code{no} 16311@item @code{no}
15360The default. No caching takes place, and the code block will be evaluated 16312Default. No caching of results; @samp{src} code block evaluated every time.
15361every time it is called.
15362@item @code{yes} 16313@item @code{yes}
15363Every time the code block is run a SHA1 hash of the code and arguments 16314Whether to run the code or return the cached results is determined by
15364passed to the block will be generated. This hash is packed into the 16315comparing the SHA1 hash value of the combined @samp{src} code block and
15365@code{#+RESULTS:} line and will be checked on subsequent 16316arguments passed to it. This hash value is packed on the @code{#+RESULTS:}
15366executions of the code block. If the code block has not 16317line from previous evaluation. When hash values match, Org does not evaluate
15367changed since the last time it was evaluated, it will not be re-evaluated. 16318the @samp{src} code block. When hash values mismatch, Org evaluates the
16319@samp{src} code block, inserts the results, recalculates the hash value, and
16320updates @code{#+RESULTS:} line.
15368@end itemize 16321@end itemize
15369 16322
15370Code block caches notice if the value of a variable argument 16323In this example, both functions are cached. But @code{caller} runs only if
15371to the code block has changed. If this is the case, the cache is 16324the result from @code{random} has changed since the last run.
15372invalidated and the code block is re-run. In the following example,
15373@code{caller} will not be re-run unless the results of @code{random} have
15374changed since it was last run.
15375 16325
15376@example 16326@example
15377 #+NAME: random 16327 #+NAME: random
@@ -15391,32 +16341,31 @@ changed since it was last run.
15391 0.254227238707244 16341 0.254227238707244
15392@end example 16342@end example
15393 16343
15394@node sep, hlines, cache, Specific header arguments 16344@node sep
15395@subsubsection @code{:sep} 16345@subsubsection @code{:sep}
16346@cindex @code{:sep}, src header argument
15396 16347
15397The @code{:sep} header argument can be used to control the delimiter used 16348The @code{:sep} header argument is the delimiter for saving results as tables
15398when writing tabular results out to files external to Org mode. This is used 16349to files (@pxref{file}) external to Org mode. Org defaults to tab delimited
15399either when opening tabular results of a code block by calling the 16350output. The function, @code{org-open-at-point}, which is bound to @kbd{C-c
15400@code{org-open-at-point} function bound to @kbd{C-c C-o} on the code block, 16351C-o}, also uses @code{:sep} for opening tabular results.
15401or when writing code block results to an external file (see @ref{file})
15402header argument.
15403 16352
15404By default, when @code{:sep} is not specified output tables are tab 16353@node hlines
15405delimited.
15406
15407@node hlines, colnames, sep, Specific header arguments
15408@subsubsection @code{:hlines} 16354@subsubsection @code{:hlines}
16355@cindex @code{:hlines}, src header argument
15409 16356
15410Tables are frequently represented with one or more horizontal lines, or 16357In-between each table row or below the table headings, sometimes results have
15411hlines. The @code{:hlines} argument to a code block accepts the 16358horizontal lines, which are also known as hlines. The @code{:hlines}
15412values @code{yes} or @code{no}, with a default value of @code{no}. 16359argument with the value @code{yes} accepts such lines. The default is
16360@code{no}.
15413 16361
15414@itemize @bullet 16362@itemize @bullet
15415@item @code{no} 16363@item @code{no}
15416Strips horizontal lines from the input table. In most languages this is the 16364Strips horizontal lines from the input table. For most code, this is
15417desired effect because an @code{hline} symbol is interpreted as an unbound 16365desirable, or else those @code{hline} symbols raise unbound variable errors.
15418variable and raises an error. Setting @code{:hlines no} or relying on the 16366
15419default value yields the following results. 16367The default is @code{:hlines no}. The example shows hlines removed from the
16368input table.
15420 16369
15421@example 16370@example
15422#+NAME: many-cols 16371#+NAME: many-cols
@@ -15438,7 +16387,7 @@ default value yields the following results.
15438@end example 16387@end example
15439 16388
15440@item @code{yes} 16389@item @code{yes}
15441Leaves hlines in the table. Setting @code{:hlines yes} has this effect. 16390For @code{:hlines yes}, the example shows hlines unchanged.
15442 16391
15443@example 16392@example
15444#+NAME: many-cols 16393#+NAME: many-cols
@@ -15462,20 +16411,20 @@ Leaves hlines in the table. Setting @code{:hlines yes} has this effect.
15462@end example 16411@end example
15463@end itemize 16412@end itemize
15464 16413
15465@node colnames, rownames, hlines, Specific header arguments 16414@node colnames
15466@subsubsection @code{:colnames} 16415@subsubsection @code{:colnames}
16416@cindex @code{:colnames}, src header argument
15467 16417
15468The @code{:colnames} header argument accepts the values @code{yes}, 16418The @code{:colnames} header argument accepts @code{yes}, @code{no}, or
15469@code{no}, or @code{nil} for unassigned. The default value is @code{nil}. 16419@code{nil} values. The default value is @code{nil}, which is unassigned.
15470Note that the behavior of the @code{:colnames} header argument may differ 16420But this header argument behaves differently depending on the source code
15471across languages. 16421language.
15472 16422
15473@itemize @bullet 16423@itemize @bullet
15474@item @code{nil} 16424@item @code{nil}
15475If an input table looks like it has column names 16425If an input table has column names (because the second row is an hline), then
15476(because its second row is an hline), then the column 16426Org removes the column names, processes the table, puts back the column
15477names will be removed from the table before 16427names, and then writes the table to the results block.
15478processing, then reapplied to the results.
15479 16428
15480@example 16429@example
15481#+NAME: less-cols 16430#+NAME: less-cols
@@ -15496,33 +16445,36 @@ processing, then reapplied to the results.
15496| c* | 16445| c* |
15497@end example 16446@end example
15498 16447
15499Please note that column names are not removed before the table is indexed 16448Note that column names have to accounted for when using variable indexing
15500using variable indexing @xref{var, Indexable variable values}. 16449(@pxref{var, Indexable variable values}) because column names are not removed
16450for indexing.
15501 16451
15502@item @code{no} 16452@item @code{no}
15503No column name pre-processing takes place 16453Do not pre-process column names.
15504 16454
15505@item @code{yes} 16455@item @code{yes}
15506Column names are removed and reapplied as with @code{nil} even if the table 16456For an input table that has no hlines, process it like the @code{nil}
15507does not ``look like'' it has column names (i.e., the second row is not an 16457value. That is, Org removes the column names, processes the table, puts back
15508hline) 16458the column names, and then writes the table to the results block.
15509@end itemize 16459@end itemize
15510 16460
15511@node rownames, shebang, colnames, Specific header arguments 16461@node rownames
15512@subsubsection @code{:rownames} 16462@subsubsection @code{:rownames}
16463@cindex @code{:rownames}, src header argument
15513 16464
15514The @code{:rownames} header argument can take on the values @code{yes} or 16465The @code{:rownames} header argument can take on values @code{yes} or
15515@code{no}, with a default value of @code{no}. Note that Emacs Lisp code 16466@code{no} values. The default is @code{no}. Note that @code{emacs-lisp}
15516blocks ignore the @code{:rownames} header argument entirely given the ease 16467code blocks ignore @code{:rownames} header argument because of the ease of
15517with which tables with row names may be handled directly in Emacs Lisp. 16468table-handling in Emacs.
15518 16469
15519@itemize @bullet 16470@itemize @bullet
15520@item @code{no} 16471@item @code{no}
15521No row name pre-processing will take place. 16472Org will not pre-process row names.
15522 16473
15523@item @code{yes} 16474@item @code{yes}
15524The first column of the table is removed from the table before processing, 16475If an input table has row names, then Org removes the row names, processes
15525and is then reapplied to the results. 16476the table, puts back the row names, and then writes the table to the results
16477block.
15526 16478
15527@example 16479@example
15528#+NAME: with-rownames 16480#+NAME: with-rownames
@@ -15539,82 +16491,88 @@ and is then reapplied to the results.
15539| two | 16 | 17 | 18 | 19 | 20 | 16491| two | 16 | 17 | 18 | 19 | 20 |
15540@end example 16492@end example
15541 16493
15542Please note that row names are not removed before the table is indexed using 16494Note that row names have to accounted for when using variable indexing
15543variable indexing @xref{var, Indexable variable values}. 16495(@pxref{var, Indexable variable values}) because row names are not removed
16496for indexing.
15544 16497
15545@end itemize 16498@end itemize
15546 16499
15547@node shebang, tangle-mode, rownames, Specific header arguments 16500@node shebang
15548@subsubsection @code{:shebang} 16501@subsubsection @code{:shebang}
16502@cindex @code{:shebang}, src header argument
15549 16503
15550Setting the @code{:shebang} header argument to a string value 16504This header argument can turn results into executable script files. By
15551(e.g., @code{:shebang "#!/bin/bash"}) causes the string to be inserted as the 16505setting the @code{:shebang} header argument to a string value (for example,
15552first line of any tangled file holding the code block, and the file 16506@code{:shebang "#!/bin/bash"}), Org inserts that string as the first line of
15553permissions of the tangled file are set to make it executable. 16507the tangled file that the @samp{src} code block is extracted to. Org then
15554 16508turns on the tangled file's executable permission.
15555 16509
15556@node tangle-mode, eval, shebang, Specific header arguments 16510@node tangle-mode
15557@subsubsection @code{:tangle-mode} 16511@subsubsection @code{:tangle-mode}
16512@cindex @code{:tangle-mode}, src header argument
16513
16514The @code{tangle-mode} header argument specifies what permissions to set for
16515tangled files by @code{set-file-modes}. For example, to make read-only
16516tangled file, use @code{:tangle-mode (identity #o444)}. To make it
16517executable, use @code{:tangle-mode (identity #o755)}.
16518
16519On @samp{src} code blocks with @code{shebang} (@pxref{shebang}) header
16520argument, Org will automatically set the tangled file to executable
16521permissions. But this can be overridden with custom permissions using
16522@code{tangle-mode} header argument.
15558 16523
15559The @code{tangle-mode} header argument controls the permission set on tangled 16524When multiple @samp{src} code blocks tangle to a single file with different
15560files. The value of this header argument will be passed to 16525and conflicting @code{tangle-mode} header arguments, Org's behavior is
15561@code{set-file-modes}. For example, to set a tangled file as read only use 16526undefined.
15562@code{:tangle-mode (identity #o444)}, or to set a tangled file as executable 16527
15563use @code{:tangle-mode (identity #o755)}. Blocks with @code{shebang} 16528@node eval
15564(@ref{shebang}) header arguments will automatically be made executable unless
15565the @code{tangle-mode} header argument is also used. The behavior is
15566undefined if multiple code blocks with different values for the
15567@code{tangle-mode} header argument are tangled to the same file.
15568
15569@node eval, wrap, tangle-mode, Specific header arguments
15570@subsubsection @code{:eval} 16529@subsubsection @code{:eval}
15571The @code{:eval} header argument can be used to limit the evaluation of 16530@cindex @code{:eval}, src header argument
15572specific code blocks. The @code{:eval} header argument can be useful for 16531The @code{:eval} header argument can limit evaluation of specific code
15573protecting against the evaluation of dangerous code blocks or to ensure that 16532blocks. It is useful for protection against evaluating untrusted @samp{src}
15574evaluation will require a query regardless of the value of the 16533code blocks by prompting for a confirmation. This protection is independent
15575@code{org-confirm-babel-evaluate} variable. The possible values of 16534of the @code{org-confirm-babel-evaluate} setting.
15576@code{:eval} and their effects are shown below.
15577 16535
15578@table @code 16536@table @code
15579@item never or no 16537@item never or no
15580The code block will not be evaluated under any circumstances. 16538Org will never evaluate this @samp{src} code block.
15581@item query 16539@item query
15582Evaluation of the code block will require a query. 16540Org prompts the user for permission to evaluate this @samp{src} code block.
15583@item never-export or no-export 16541@item never-export or no-export
15584The code block will not be evaluated during export but may still be called 16542Org will not evaluate this @samp{src} code block when exporting, yet the user
15585interactively. 16543can evaluate this source block interactively.
15586@item query-export 16544@item query-export
15587Evaluation of the code block during export will require a query. 16545Org prompts the user for permission to export this @samp{src} code block.
15588@end table 16546@end table
15589 16547
15590If this header argument is not set then evaluation is determined by the value 16548If @code{:eval} header argument is not set for a source block, then Org
15591of the @code{org-confirm-babel-evaluate} variable see @ref{Code evaluation 16549determines whether to evaluate from the @code{org-confirm-babel-evaluate}
15592security}. 16550variable (@pxref{Code evaluation security}).
15593 16551
15594@node wrap, post, eval, Specific header arguments 16552@node wrap
15595@subsubsection @code{:wrap} 16553@subsubsection @code{:wrap}
15596The @code{:wrap} header argument is used to mark the results of source block 16554@cindex @code{:wrap}, src header argument
15597evaluation. The header argument can be passed a string that will be appended 16555The @code{:wrap} header argument marks the results block by appending strings
15598to @code{#+BEGIN_} and @code{#+END_}, which will then be used to wrap the 16556to @code{#+BEGIN_} and @code{#+END_}. If no string is specified, Org wraps
15599results. If not string is specified then the results will be wrapped in a 16557the results in a @code{#+BEGIN/END_RESULTS} block.
15600@code{#+BEGIN/END_RESULTS} block.
15601 16558
15602@node post, prologue, wrap, Specific header arguments 16559@node post
15603@subsubsection @code{:post} 16560@subsubsection @code{:post}
15604The @code{:post} header argument is used to post-process the results of a 16561@cindex @code{:post}, src header argument
15605code block execution. When a post argument is given, the results of the code 16562The @code{:post} header argument is for post-processing results from
15606block will temporarily be bound to the @code{*this*} variable. This variable 16563@samp{src} block evaluation. When @code{:post} has any value, Org binds the
15607may then be included in header argument forms such as those used in @ref{var} 16564results to @code{*this*} variable for easy passing to @ref{var} header
15608header argument specifications allowing passing of results to other code 16565argument specifications. That makes results available to other @samp{src}
15609blocks, or direct execution via Emacs Lisp. 16566code blocks, or for even direct Emacs Lisp code execution.
15610 16567
15611The following example illustrates the usage of the @code{:post} header 16568The following two examples illustrate @code{:post} header argument in action.
15612argument. 16569The first one shows how to attach @code{#+ATTR_LATEX:} line using
16570@code{:post}.
15613 16571
15614@example 16572@example
15615#+name: attr_wrap 16573#+name: attr_wrap
15616#+begin_src sh :var data="" :var width="\\textwidth" :results output 16574#+begin_src sh :var data="" :var width="\\textwidth" :results output
15617 echo "#+ATTR_LATEX :width $width" 16575 echo "#+ATTR_LATEX: :width $width"
15618 echo "$data" 16576 echo "$data"
15619#+end_src 16577#+end_src
15620 16578
@@ -15634,33 +16592,65 @@ argument.
15634:END: 16592:END:
15635@end example 16593@end example
15636 16594
15637@node prologue, epilogue, post, Specific header arguments 16595The second example shows use of @code{:colnames} in @code{:post} to pass
16596data between @samp{src} code blocks.
16597
16598@example
16599#+name: round-tbl
16600#+begin_src emacs-lisp :var tbl="" fmt="%.3f"
16601 (mapcar (lambda (row)
16602 (mapcar (lambda (cell)
16603 (if (numberp cell)
16604 (format fmt cell)
16605 cell))
16606 row))
16607 tbl)
16608#+end_src
16609
16610#+begin_src R :colnames yes :post round-tbl[:colnames yes](*this*)
16611set.seed(42)
16612data.frame(foo=rnorm(1))
16613#+end_src
16614
16615#+RESULTS:
16616| foo |
16617|-------|
16618| 1.371 |
16619@end example
16620
16621@node prologue
15638@subsubsection @code{:prologue} 16622@subsubsection @code{:prologue}
15639The value of the @code{prologue} header argument will be prepended to the 16623@cindex @code{:prologue}, src header argument
15640code block body before execution. For example, @code{:prologue "reset"} may 16624The @code{prologue} header argument is for appending to the top of the code
15641be used to reset a gnuplot session before execution of a particular code 16625block for execution. For example, a clear or reset code at the start of new
15642block, or the following configuration may be used to do this for all gnuplot 16626execution of a @samp{src} code block. A @code{reset} for @samp{gnuplot}:
15643code blocks. Also see @ref{epilogue}. 16627@code{:prologue "reset"}. See also @ref{epilogue}.
15644 16628
15645@lisp 16629@lisp
15646(add-to-list 'org-babel-default-header-args:gnuplot 16630(add-to-list 'org-babel-default-header-args:gnuplot
15647 '((:prologue . "reset"))) 16631 '((:prologue . "reset")))
15648@end lisp 16632@end lisp
15649 16633
15650@node epilogue, , prologue, Specific header arguments 16634@node epilogue
15651@subsubsection @code{:epilogue} 16635@subsubsection @code{:epilogue}
15652The value of the @code{epilogue} header argument will be appended to the code 16636@cindex @code{:epilogue}, src header argument
15653block body before execution. Also see @ref{prologue}. 16637The value of the @code{epilogue} header argument is for appending to the end
16638of the code block for execution. See also @ref{prologue}.
15654 16639
15655@node Results of evaluation, Noweb reference syntax, Header arguments, Working With Source Code 16640@node Results of evaluation
15656@section Results of evaluation 16641@section Results of evaluation
15657@cindex code block, results of evaluation 16642@cindex code block, results of evaluation
15658@cindex source code, results of evaluation 16643@cindex source code, results of evaluation
15659 16644
15660The way in which results are handled depends on whether a session is invoked, 16645How Org handles results of a code block execution depends on many header
15661as well as on whether @code{:results value} or @code{:results output} is 16646arguments working together. Here is only a summary of these. For an
15662used. The following table shows the table possibilities. For a full listing 16647enumeration of all the header arguments that affect results, see
15663of the possible results header arguments see @ref{results}. 16648@ref{results}.
16649
16650The primary determinant is the execution context. Is it in a @code{:session}
16651or not? Orthogonal to that is if the expected result is a @code{:results
16652value} or @code{:results output}, which is a concatenation of output from
16653start to finish of the @samp{src} code block's evaluation.
15664 16654
15665@multitable @columnfractions 0.26 0.33 0.41 16655@multitable @columnfractions 0.26 0.33 0.41
15666@item @tab @b{Non-session} @tab @b{Session} 16656@item @tab @b{Non-session} @tab @b{Session}
@@ -15668,51 +16658,54 @@ of the possible results header arguments see @ref{results}.
15668@item @code{:results output} @tab contents of STDOUT @tab concatenation of interpreter output 16658@item @code{:results output} @tab contents of STDOUT @tab concatenation of interpreter output
15669@end multitable 16659@end multitable
15670 16660
15671Note: With @code{:results value}, the result in both @code{:session} and 16661For @code{:session} and non-session, the @code{:results value} turns the
15672non-session is returned to Org mode as a table (a one- or two-dimensional 16662results into an Org mode table format. Single values are wrapped in a one
15673vector of strings or numbers) when appropriate. 16663dimensional vector. Rows and columns of a table are wrapped in a
16664two-dimensional vector.
15674 16665
15675@subsection Non-session 16666@subsection Non-session
15676@subsubsection @code{:results value} 16667@subsubsection @code{:results value}
15677This is the default. Internally, the value is obtained by wrapping the code 16668@cindex @code{:results}, src header argument
15678in a function definition in the external language, and evaluating that 16669Default. Org gets the value by wrapping the code in a function definition in
15679function. Therefore, code should be written as if it were the body of such a 16670the language of the @samp{src} block. That is why when using @code{:results
15680function. In particular, note that Python does not automatically return a 16671value}, code should execute like a function and return a value. For
15681value from a function unless a @code{return} statement is present, and so a 16672languages like Python, an explicit @code{return} statement is mandatory when
15682@samp{return} statement will usually be required in Python. 16673using @code{:results value}.
15683 16674
15684This is the only one of the four evaluation contexts in which the code is 16675This is one of four evaluation contexts where Org automatically wraps the
15685automatically wrapped in a function definition. 16676code in a function definition.
15686 16677
15687@subsubsection @code{:results output} 16678@subsubsection @code{:results output}
15688The code is passed to the interpreter as an external process, and the 16679@cindex @code{:results}, src header argument
15689contents of the standard output stream are returned as text. (In certain 16680For @code{:results output}, the code is passed to an external process running
15690languages this also contains the error output stream; this is an area for 16681the interpreter. Org returns the contents of the standard output stream as
15691future work.) 16682as text results.
15692 16683
15693@subsection Session 16684@subsection Session
15694@subsubsection @code{:results value} 16685@subsubsection @code{:results value}
15695The code is passed to an interpreter running as an interactive Emacs inferior 16686@cindex @code{:results}, src header argument
15696process. Only languages which provide tools for interactive evaluation of 16687For @code{:results value} from a @code{:session}, Org passes the code to an
15697code have session support, so some language (e.g., C and ditaa) do not 16688interpreter running as an interactive Emacs inferior process. So only
15698support the @code{:session} header argument, and in other languages (e.g., 16689languages that provide interactive evaluation can have session support. Not
15699Python and Haskell) which have limitations on the code which may be entered 16690all languages provide this support, such as @samp{C} and @samp{ditaa}. Even
15700into interactive sessions, those limitations apply to the code in code blocks 16691those that do support, such as @samp{Python} and @samp{Haskell}, they impose
15701using the @code{:session} header argument as well. 16692limitations on allowable language constructs that can run interactively. Org
15702 16693inherits those limitations for those @samp{src} code blocks running in a
15703Unless the @code{:results output} option is supplied (see below) the result 16694@code{:session}.
15704returned is the result of the last evaluation performed by the 16695
15705interpreter. (This is obtained in a language-specific manner: the value of 16696Org gets the value from the source code interpreter's last statement
15706the variable @code{_} in Python and Ruby, and the value of @code{.Last.value} 16697output. Org has to use language-specific methods to obtain the value. For
15707in R). 16698example, from the variable @code{_} in @samp{Python} and @samp{Ruby}, and the
16699value of @code{.Last.value} in @samp{R}).
15708 16700
15709@subsubsection @code{:results output} 16701@subsubsection @code{:results output}
15710The code is passed to the interpreter running as an interactive Emacs 16702@cindex @code{:results}, src header argument
15711inferior process. The result returned is the concatenation of the sequence of 16703For @code{:results output}, Org passes the code to the interpreter running as
15712(text) output from the interactive interpreter. Notice that this is not 16704an interactive Emacs inferior process. Org concatenates whatever text output
15713necessarily the same as what would be sent to @code{STDOUT} if the same code 16705emitted by the interpreter to return the collection as a result. Note that
15714were passed to a non-interactive interpreter running as an external 16706this collection is not the same as collected from @code{STDOUT} of a
15715process. For example, compare the following two blocks: 16707non-interactive interpreter running as an external process. Compare for
16708example these two blocks:
15716 16709
15717@example 16710@example
15718#+BEGIN_SRC python :results output 16711#+BEGIN_SRC python :results output
@@ -15726,7 +16719,8 @@ process. For example, compare the following two blocks:
15726: bye 16719: bye
15727@end example 16720@end example
15728 16721
15729In non-session mode, the ``2'' is not printed and does not appear. 16722In the above non-session mode, the ``2'' is not printed; so does not appear
16723in results.
15730 16724
15731@example 16725@example
15732#+BEGIN_SRC python :results output :session 16726#+BEGIN_SRC python :results output :session
@@ -15741,60 +16735,61 @@ In non-session mode, the ``2'' is not printed and does not appear.
15741: bye 16735: bye
15742@end example 16736@end example
15743 16737
15744But in @code{:session} mode, the interactive interpreter receives input ``2'' 16738In the above @code{:session} mode, the interactive interpreter receives and
15745and prints out its value, ``2''. (Indeed, the other print statements are 16739prints ``2''. Results show that.
15746unnecessary here).
15747 16740
15748@node Noweb reference syntax, Key bindings and useful functions, Results of evaluation, Working With Source Code 16741@node Noweb reference syntax
15749@section Noweb reference syntax 16742@section Noweb reference syntax
15750@cindex code block, noweb reference 16743@cindex code block, noweb reference
15751@cindex syntax, noweb 16744@cindex syntax, noweb
15752@cindex source code, noweb reference 16745@cindex source code, noweb reference
15753 16746
15754The ``noweb'' (see @uref{http://www.cs.tufts.edu/~nr/noweb/}) Literate 16747Org supports named blocks in ``noweb'' style syntax. For ``noweb'' literate
15755Programming system allows named blocks of code to be referenced by using the 16748programming details, see @uref{http://www.cs.tufts.edu/~nr/noweb/}).
15756familiar Noweb syntax:
15757 16749
15758@example 16750@example
15759<<code-block-name>> 16751<<code-block-name>>
15760@end example 16752@end example
15761 16753
15762When a code block is tangled or evaluated, whether or not ``noweb'' 16754For the header argument @code{:noweb yes}, Org expands ``noweb'' style
15763references are expanded depends upon the value of the @code{:noweb} header 16755references in the @samp{src} code block before evaluation.
15764argument. If @code{:noweb yes}, then a Noweb reference is expanded before 16756
15765evaluation. If @code{:noweb no}, the default, then the reference is not 16757For the header argument @code{:noweb no}, Org does not expand ``noweb'' style
15766expanded before evaluation. See the @ref{noweb-ref} header argument for 16758references in the @samp{src} code block before evaluation.
15767a more flexible way to resolve noweb references. 16759
16760The default is @code{:noweb no}.
16761
16762Org offers a more flexible way to resolve ``noweb'' style references
16763(@pxref{noweb-ref}).
16764
16765Org can handle naming of @emph{results} block, rather than the body of the
16766@samp{src} code block, using ``noweb'' style references.
15768 16767
15769It is possible to include the @emph{results} of a code block rather than the 16768For ``noweb'' style reference, append parenthesis to the code block name for
15770body. This is done by appending parenthesis to the code block name which may 16769arguments, as shown in this example:
15771optionally contain arguments to the code block as shown below.
15772 16770
15773@example 16771@example
15774<<code-block-name(optional arguments)>> 16772<<code-block-name(optional arguments)>>
15775@end example 16773@end example
15776 16774
15777Note: the default value, @code{:noweb no}, was chosen to ensure that 16775Note: Org defaults to @code{:noweb no} so as not to cause errors in languages
15778correct code is not broken in a language, such as Ruby, where 16776such as @samp{Ruby} where ``noweb'' syntax is equally valid characters. For
15779@code{<<arg>>} is a syntactically valid construct. If @code{<<arg>>} is not 16777example, @code{<<arg>>}. Change Org's default to @code{:noweb yes} for
15780syntactically valid in languages that you use, then please consider setting 16778languages where there is no risk of confusion.
15781the default value.
15782 16779
15783Note: if noweb tangling is slow in large Org mode files consider setting the 16780For faster tangling of large Org mode files, set
15784@code{org-babel-use-quick-and-dirty-noweb-expansion} variable to @code{t}. 16781@code{org-babel-use-quick-and-dirty-noweb-expansion} variable to @code{t}.
15785This will result in faster noweb reference resolution at the expense of not 16782The speedup comes at the expense of not correctly resolving inherited values
15786correctly resolving inherited values of the @code{:noweb-ref} header 16783of the @code{:noweb-ref} header argument.
15787argument. 16784
15788 16785
15789@node Key bindings and useful functions, Batch execution, Noweb reference syntax, Working With Source Code 16786@node Key bindings and useful functions
15790@section Key bindings and useful functions 16787@section Key bindings and useful functions
15791@cindex code block, key bindings 16788@cindex code block, key bindings
15792 16789
15793Many common Org mode key sequences are re-bound depending on 16790Many common Org mode key sequences are re-bound depending on the context.
15794the context.
15795 16791
15796Within a code block, the following key bindings 16792Active key bindings in code blocks:
15797are active:
15798 16793
15799@multitable @columnfractions 0.25 0.75 16794@multitable @columnfractions 0.25 0.75
15800@kindex C-c C-c 16795@kindex C-c C-c
@@ -15807,9 +16802,9 @@ are active:
15807@item @kbd{M-@key{down}} @tab @code{org-babel-switch-to-session} 16802@item @kbd{M-@key{down}} @tab @code{org-babel-switch-to-session}
15808@end multitable 16803@end multitable
15809 16804
15810In an Org mode buffer, the following key bindings are active: 16805Active key bindings in Org mode buffer:
15811 16806
15812@multitable @columnfractions 0.45 0.55 16807@multitable @columnfractions 0.5 0.5
15813@kindex C-c C-v p 16808@kindex C-c C-v p
15814@kindex C-c C-v C-p 16809@kindex C-c C-v C-p
15815@item @kbd{C-c C-v p} @ @ @r{or} @ @ @kbd{C-c C-v C-p} @tab @code{org-babel-previous-src-block} 16810@item @kbd{C-c C-v p} @ @ @r{or} @ @ @kbd{C-c C-v C-p} @tab @code{org-babel-previous-src-block}
@@ -15878,8 +16873,7 @@ In an Org mode buffer, the following key bindings are active:
15878@item @kbd{C-c C-v x} @ @ @r{or} @ @ @kbd{C-c C-v C-x} @tab @code{org-babel-do-key-sequence-in-edit-buffer} 16873@item @kbd{C-c C-v x} @ @ @r{or} @ @ @kbd{C-c C-v C-x} @tab @code{org-babel-do-key-sequence-in-edit-buffer}
15879@end multitable 16874@end multitable
15880 16875
15881@c When possible these keybindings were extended to work when the control key is 16876@c Extended key bindings when control key is kept pressed:
15882@c kept pressed, resulting in the following additional keybindings.
15883 16877
15884@c @multitable @columnfractions 0.25 0.75 16878@c @multitable @columnfractions 0.25 0.75
15885@c @item @kbd{C-c C-v C-a} @tab @code{org-babel-sha1-hash} 16879@c @item @kbd{C-c C-v C-a} @tab @code{org-babel-sha1-hash}
@@ -15892,15 +16886,18 @@ In an Org mode buffer, the following key bindings are active:
15892@c @item @kbd{C-c C-v C-z} @tab @code{org-babel-switch-to-session} 16886@c @item @kbd{C-c C-v C-z} @tab @code{org-babel-switch-to-session}
15893@c @end multitable 16887@c @end multitable
15894 16888
15895@node Batch execution, , Key bindings and useful functions, Working With Source Code 16889@node Batch execution
15896@section Batch execution 16890@section Batch execution
15897@cindex code block, batch execution 16891@cindex code block, batch execution
15898@cindex source code, batch execution 16892@cindex source code, batch execution
15899 16893
15900It is possible to call functions from the command line. This shell 16894Org mode features, including working with source code facilities can be
15901script calls @code{org-babel-tangle} on every one of its arguments. 16895invoked from the command line. This enables building shell scripts for batch
16896processing, running automated system tasks, and expanding Org mode's
16897usefulness.
15902 16898
15903Be sure to adjust the paths to fit your system. 16899The sample script shows batch processing of multiple files using
16900@code{org-babel-tangle}.
15904 16901
15905@example 16902@example
15906#!/bin/sh 16903#!/bin/sh
@@ -15917,35 +16914,33 @@ for i in $@@; do
15917done 16914done
15918 16915
15919emacs -Q --batch \ 16916emacs -Q --batch \
15920--eval "(progn 16917 --eval "(progn
15921(add-to-list 'load-path (expand-file-name \"~/src/org/lisp/\")) 16918 (require 'org)(require 'ob)(require 'ob-tangle)
15922(add-to-list 'load-path (expand-file-name \"~/src/org/contrib/lisp/\" t)) 16919 (mapc (lambda (file)
15923(require 'org)(require 'org-exp)(require 'ob)(require 'ob-tangle) 16920 (find-file (expand-file-name file \"$DIR\"))
15924(mapc (lambda (file) 16921 (org-babel-tangle)
15925 (find-file (expand-file-name file \"$DIR\")) 16922 (kill-buffer)) '($FILES)))" 2>&1 |grep -i tangled
15926 (org-babel-tangle)
15927 (kill-buffer)) '($FILES)))" 2>&1 |grep tangled
15928@end example 16923@end example
15929 16924
15930@node Miscellaneous, Hacking, Working With Source Code, Top 16925@node Miscellaneous
15931@chapter Miscellaneous 16926@chapter Miscellaneous
15932 16927
15933@menu 16928@menu
15934* Completion:: M-TAB knows what you need 16929* Completion:: M-TAB guesses completions
15935* Easy Templates:: Quick insertion of structural elements 16930* Easy templates:: Quick insertion of structural elements
15936* Speed keys:: Electric commands at the beginning of a headline 16931* Speed keys:: Electric commands at the beginning of a headline
15937* Code evaluation security:: Org mode files evaluate inline code 16932* Code evaluation security:: Org mode files evaluate inline code
15938* Customization:: Adapting Org to your taste 16933* Customization:: Adapting Org to changing tastes
15939* In-buffer settings:: Overview of the #+KEYWORDS 16934* In-buffer settings:: Overview of the #+KEYWORDS
15940* The very busy C-c C-c key:: When in doubt, press C-c C-c 16935* The very busy C-c C-c key:: When in doubt, press C-c C-c
15941* Clean view:: Getting rid of leading stars in the outline 16936* Clean view:: Getting rid of leading stars in the outline
15942* TTY keys:: Using Org on a tty 16937* TTY keys:: Using Org on a tty
15943* Interaction:: Other Emacs packages 16938* Interaction:: With other Emacs packages
15944* org-crypt:: Encrypting Org files 16939* org-crypt:: Encrypting Org files
15945@end menu 16940@end menu
15946 16941
15947 16942
15948@node Completion, Easy Templates, Miscellaneous, Miscellaneous 16943@node Completion
15949@section Completion 16944@section Completion
15950@cindex completion, of @TeX{} symbols 16945@cindex completion, of @TeX{} symbols
15951@cindex completion, of TODO keywords 16946@cindex completion, of TODO keywords
@@ -15961,15 +16956,13 @@ emacs -Q --batch \
15961@cindex tag completion 16956@cindex tag completion
15962@cindex link abbreviations, completion of 16957@cindex link abbreviations, completion of
15963 16958
15964Emacs would not be Emacs without completion, and Org mode uses it whenever it 16959Org has in-buffer completions. Unlike minibuffer completions, which are
15965makes sense. If you prefer an @i{iswitchb}- or @i{ido}-like interface for 16960useful for quick command interactions, Org's in-buffer completions are more
15966some of the completion prompts, you can specify your preference by setting at 16961suitable for content creation in Org documents. Type one or more letters and
15967most one of the variables @code{org-completion-use-iswitchb} 16962invoke the hot key to complete the text in-place. Depending on the context
15968@code{org-completion-use-ido}. 16963and the keys, Org will offer different types of completions. No minibuffer
15969 16964is involved. Such mode-specific hot keys have become an integral part of
15970Org supports in-buffer completion. This type of completion does 16965Emacs and Org provides several shortcuts.
15971not make use of the minibuffer. You simply type a few letters into
15972the buffer and use the key to complete text right there.
15973 16966
15974@table @kbd 16967@table @kbd
15975@kindex M-@key{TAB} 16968@kindex M-@key{TAB}
@@ -15996,112 +16989,123 @@ buffer.
15996After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}). 16989After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}).
15997@item 16990@item
15998After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or 16991After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
15999@samp{OPTIONS} which set file-specific options for Org mode. When the 16992file-specific @samp{OPTIONS}. After option keyword is complete, pressing
16000option keyword is already complete, pressing @kbd{M-@key{TAB}} again 16993@kbd{M-@key{TAB}} again will insert example settings for that option.
16001will insert example settings for this keyword.
16002@item 16994@item
16003In the line after @samp{#+STARTUP: }, complete startup keywords, 16995After @samp{#+STARTUP: }, complete startup keywords.
16004i.e., valid keys for this line.
16005@item 16996@item
16006Elsewhere, complete dictionary words using Ispell. 16997When the point is anywhere else, complete dictionary words using Ispell.
16007@end itemize 16998@end itemize
16999@kindex C-M-i
17000If your desktop intercepts the combo @kbd{M-@key{TAB}} to switch windows, use
17001@kbd{C-M-i} or @kbd{@key{ESC} @key{TAB}} as an alternative or customize your
17002environment.
16008@end table 17003@end table
16009 17004
16010@node Easy Templates, Speed keys, Completion, Miscellaneous 17005@node Easy templates
16011@section Easy Templates 17006@section Easy templates
16012@cindex template insertion 17007@cindex template insertion
16013@cindex insertion, of templates 17008@cindex insertion, of templates
16014 17009
16015Org mode supports insertion of empty structural elements (like 17010With just a few keystrokes, Org's easy templates inserts empty pairs of
16016@code{#+BEGIN_SRC} and @code{#+END_SRC} pairs) with just a few key 17011structural elements, such as @code{#+BEGIN_SRC} and @code{#+END_SRC}. Easy
16017strokes. This is achieved through a native template expansion mechanism. 17012templates use an expansion mechanism, which is native to Org, in a process
16018Note that Emacs has several other template mechanisms which could be used in 17013similar to @file{yasnippet} and other Emacs template expansion packages.
16019a similar way, for example @file{yasnippet}.
16020 17014
16021To insert a structural element, type a @samp{<}, followed by a template 17015@kbd{@key{<}} @kbd{@key{s}} @kbd{@key{TAB}} completes the @samp{src} code
16022selector and @kbd{@key{TAB}}. Completion takes effect only when the above 17016block.
16023keystrokes are typed on a line by itself.
16024 17017
16025The following template selectors are currently supported. 17018@kbd{<} @kbd{l} @kbd{@key{TAB}}
17019
17020expands to:
17021
17022#+BEGIN_EXPORT latex
17023
17024#+END_EXPORT
17025
17026Org comes with these pre-defined easy templates:
16026 17027
16027@multitable @columnfractions 0.1 0.9 17028@multitable @columnfractions 0.1 0.9
16028@item @kbd{s} @tab @code{#+BEGIN_SRC ... #+END_SRC} 17029@item @kbd{s} @tab @code{#+BEGIN_SRC ... #+END_SRC}
16029@item @kbd{e} @tab @code{#+BEGIN_EXAMPLE ... #+END_EXAMPLE} 17030@item @kbd{e} @tab @code{#+BEGIN_EXAMPLE ... #+END_EXAMPLE}
16030@item @kbd{q} @tab @code{#+BEGIN_QUOTE ... #+END_QUOTE} 17031@item @kbd{q} @tab @code{#+BEGIN_QUOTE ... #+END_QUOTE}
16031@item @kbd{v} @tab @code{#+BEGIN_VERSE ... #+END_VERSE} 17032@item @kbd{v} @tab @code{#+BEGIN_VERSE ... #+END_VERSE}
16032@item @kbd{c} @tab @code{#+BEGIN_CENTER ... #+END_CENTER} 17033@item @kbd{c} @tab @code{#+BEGIN_CENTER ... #+END_CENTER}
16033@item @kbd{l} @tab @code{#+BEGIN_LaTeX ... #+END_LaTeX} 17034@item @kbd{l} @tab @code{#+BEGIN_EXPORT latex ... #+END_EXPORT}
16034@item @kbd{L} @tab @code{#+LaTeX:} 17035@item @kbd{L} @tab @code{#+LATEX:}
16035@item @kbd{h} @tab @code{#+BEGIN_HTML ... #+END_HTML} 17036@item @kbd{h} @tab @code{#+BEGIN_EXPORT html ... #+END_EXPORT}
16036@item @kbd{H} @tab @code{#+HTML:} 17037@item @kbd{H} @tab @code{#+HTML:}
16037@item @kbd{a} @tab @code{#+BEGIN_ASCII ... #+END_ASCII} 17038@item @kbd{a} @tab @code{#+BEGIN_EXPORT ascii ... #+END_EXPORT}
16038@item @kbd{A} @tab @code{#+ASCII:} 17039@item @kbd{A} @tab @code{#+ASCII:}
16039@item @kbd{i} @tab @code{#+INDEX:} line 17040@item @kbd{i} @tab @code{#+INDEX:} line
16040@item @kbd{I} @tab @code{#+INCLUDE:} line 17041@item @kbd{I} @tab @code{#+INCLUDE:} line
16041@end multitable 17042@end multitable
16042 17043
16043For example, on an empty line, typing "<e" and then pressing TAB, will expand 17044More templates can added by customizing the variable
16044into a complete EXAMPLE template. 17045@code{org-structure-template-alist}, whose docstring has additional details.
16045 17046
16046You can install additional templates by customizing the variable 17047@node Speed keys
16047@code{org-structure-template-alist}. See the docstring of the variable for
16048additional details.
16049
16050@node Speed keys, Code evaluation security, Easy Templates, Miscellaneous
16051@section Speed keys 17048@section Speed keys
16052@cindex speed keys 17049@cindex speed keys
17050
17051Single keystrokes can execute custom commands in an Org file when the cursor
17052is on a headline. Without the extra burden of a meta or modifier key, Speed
17053Keys can speed navigation or execute custom commands. Besides faster
17054navigation, Speed Keys may come in handy on small mobile devices that do not
17055have full keyboards. Speed Keys may also work on TTY devices known for their
17056problems when entering Emacs keychords.
17057
16053@vindex org-use-speed-commands 17058@vindex org-use-speed-commands
16054@vindex org-speed-commands-user 17059By default, Org has Speed Keys disabled. To activate Speed Keys, set the
17060variable @code{org-use-speed-commands} to a non-@code{nil} value. To trigger
17061a Speed Key, the cursor must be at the beginning of an Org headline, before
17062any of the stars.
16055 17063
16056Single keys can be made to execute commands when the cursor is at the 17064@vindex org-speed-commands-user
16057beginning of a headline, i.e., before the first star. Configure the variable 17065@findex org-speed-command-help
16058@code{org-use-speed-commands} to activate this feature. There is a 17066Org comes with a pre-defined list of Speed Keys. To add or modify Speed
16059pre-defined list of commands, and you can add more such commands using the 17067Keys, customize the variable, @code{org-speed-commands-user}. For more
16060variable @code{org-speed-commands-user}. Speed keys do not only speed up 17068details, see the variable's docstring. With Speed Keys activated, @kbd{M-x
16061navigation and other commands, but they also provide an alternative way to 17069org-speed-command-help}, or @kbd{?} when cursor is at the beginning of an Org
16062execute commands bound to keys that are not or not easily available on a TTY, 17070headline, shows currently active Speed Keys, including the user-defined ones.
16063or on a small mobile device with a limited keyboard.
16064 17071
16065To see which commands are available, activate the feature and press @kbd{?}
16066with the cursor at the beginning of a headline.
16067 17072
16068@node Code evaluation security, Customization, Speed keys, Miscellaneous 17073@node Code evaluation security
16069@section Code evaluation and security issues 17074@section Code evaluation and security issues
16070 17075
16071Org provides tools to work with the code snippets, including evaluating them. 17076Unlike plain text, running code comes with risk. Each @samp{src} code block,
16072 17077in terms of risk, is equivalent to an executable file. Org therefore puts a
16073Running code on your machine always comes with a security risk. Badly 17078few confirmation prompts by default. This is to alert the casual user from
16074written or malicious code can be executed on purpose or by accident. Org has 17079accidentally running untrusted code.
16075default settings which will only evaluate such code if you give explicit
16076permission to do so, and as a casual user of these features you should leave
16077these precautions intact.
16078 17080
16079For people who regularly work with such code, the confirmation prompts can 17081For users who do not run code blocks or write code regularly, Org's default
16080become annoying, and you might want to turn them off. This can be done, but 17082settings should suffice. However, some users may want to tweak the prompts
16081you must be aware of the risks that are involved. 17083for fewer interruptions. To weigh the risks of automatic execution of code
17084blocks, here are some details about code evaluation.
16082 17085
16083Code evaluation can happen under the following circumstances: 17086Org evaluates code in the following circumstances:
16084 17087
16085@table @i 17088@table @i
16086@item Source code blocks 17089@item Source code blocks
16087Source code blocks can be evaluated during export, or when pressing @kbd{C-c 17090Org evaluates @samp{src} code blocks in an Org file during export. Org also
16088C-c} in the block. The most important thing to realize here is that Org mode 17091evaluates a @samp{src} code block with the @kbd{C-c C-c} key chord. Users
16089files which contain code snippets are, in a certain sense, like executable 17092exporting or running code blocks must load files only from trusted sources.
16090files. So you should accept them and load them into Emacs only from trusted 17093Be weary of customizing variables that remove or alter default security
16091sources---just like you would do with a program you install on your computer. 17094measures.
16092
16093Make sure you know what you are doing before customizing the variables
16094which take off the default security brakes.
16095 17095
16096@defopt org-confirm-babel-evaluate 17096@defopt org-confirm-babel-evaluate
16097When t (the default), the user is asked before every code block evaluation. 17097When @code{t}, Org prompts the user for confirmation before executing each
16098When @code{nil}, the user is not asked. When set to a function, it is called with 17098code block. When @code{nil}, Org executes code blocks without prompting the
16099two arguments (language and body of the code block) and should return t to 17099user for confirmation. When this option is set to a custom function, Org
16100ask and @code{nil} not to ask. 17100invokes the function with these two arguments: the source code language and
17101the body of the code block. The custom function must return either a
17102@code{t} or @code{nil}, which determines if the user is prompted. Each
17103source code language can be handled separately through this function
17104argument.
16101@end defopt 17105@end defopt
16102 17106
16103For example, here is how to execute "ditaa" code (which is considered safe) 17107For example, this function enables execution of @samp{ditaa} code +blocks
16104without asking: 17108without prompting:
16105 17109
16106@lisp 17110@lisp
16107(defun my-org-confirm-babel-evaluate (lang body) 17111(defun my-org-confirm-babel-evaluate (lang body)
@@ -16110,86 +17114,73 @@ without asking:
16110@end lisp 17114@end lisp
16111 17115
16112@item Following @code{shell} and @code{elisp} links 17116@item Following @code{shell} and @code{elisp} links
16113Org has two link types that can directly evaluate code (@pxref{External 17117Org has two link types that can also directly evaluate code (@pxref{External
16114links}). These links can be problematic because the code to be evaluated is 17118links}). Because such code is not visible, these links have a potential
16115not visible. 17119risk. Org therefore prompts the user when it encounters such links. The
17120customization variables are:
16116 17121
16117@defopt org-confirm-shell-link-function 17122@defopt org-confirm-shell-link-function
16118Function to queries user about shell link execution. 17123Function that prompts the user before executing a shell link.
16119@end defopt 17124@end defopt
16120@defopt org-confirm-elisp-link-function 17125@defopt org-confirm-elisp-link-function
16121Functions to query user for Emacs Lisp link execution. 17126Function that prompts the user before executing an Emacs Lisp link.
16122@end defopt 17127@end defopt
16123 17128
16124@item Formulas in tables 17129@item Formulas in tables
16125Formulas in tables (@pxref{The spreadsheet}) are code that is evaluated 17130Org executes formulas in tables (@pxref{The spreadsheet}) either through the
16126either by the @i{calc} interpreter, or by the @i{Emacs Lisp} interpreter. 17131@emph{calc} or the @emph{Emacs Lisp} interpreters.
16127@end table 17132@end table
16128 17133
16129@node Customization, In-buffer settings, Code evaluation security, Miscellaneous 17134@node Customization
16130@section Customization 17135@section Customization
16131@cindex customization 17136@cindex customization
16132@cindex options, for customization 17137@cindex options, for customization
16133@cindex variables, for customization 17138@cindex variables, for customization
16134 17139
16135There are more than 500 variables that can be used to customize 17140Org has more than 500 variables for customization. They can be accessed
16136Org. For the sake of compactness of the manual, I am not 17141through the usual @kbd{M-x org-customize RET} command. Or through the Org
16137describing the variables here. A structured overview of customization 17142menu, @code{Org->Customization->Browse Org Group}. Org also has per-file
16138variables is available with @kbd{M-x org-customize RET}. Or select 17143settings for some variables (@pxref{In-buffer settings}).
16139@code{Browse Org Group} from the @code{Org->Customization} menu. Many
16140settings can also be activated on a per-file basis, by putting special
16141lines into the buffer (@pxref{In-buffer settings}).
16142 17144
16143@node In-buffer settings, The very busy C-c C-c key, Customization, Miscellaneous 17145@node In-buffer settings
16144@section Summary of in-buffer settings 17146@section Summary of in-buffer settings
16145@cindex in-buffer settings 17147@cindex in-buffer settings
16146@cindex special keywords 17148@cindex special keywords
17149In-buffer settings start with @samp{#+}, followed by a keyword, a colon, and
17150then a word for each setting. Org accepts multiple settings on the same
17151line. Org also accepts multiple lines for a keyword. This manual describes
17152these settings throughout. A summary follows here.
16147 17153
16148Org mode uses special lines in the buffer to define settings on a 17154@kbd{C-c C-c} activates any changes to the in-buffer settings. Closing and
16149per-file basis. These lines start with a @samp{#+} followed by a 17155reopening the Org file in Emacs also activates the changes.
16150keyword, a colon, and then individual words defining a setting. Several
16151setting words can be in the same line, but you can also have multiple
16152lines for the keyword. While these settings are described throughout
16153the manual, here is a summary. After changing any of those lines in the
16154buffer, press @kbd{C-c C-c} with the cursor still in the line to
16155activate the changes immediately. Otherwise they become effective only
16156when the file is visited again in a new Emacs session.
16157 17156
16158@vindex org-archive-location 17157@vindex org-archive-location
16159@table @kbd 17158@table @kbd
16160@item #+ARCHIVE: %s_done:: 17159@item #+ARCHIVE: %s_done::
16161This line sets the archive location for the agenda file. It applies for 17160Sets the archive location of the agenda file. This location applies to the
16162all subsequent lines until the next @samp{#+ARCHIVE} line, or the end 17161lines until the next @samp{#+ARCHIVE} line, if any, in the Org file. The
16163of the file. The first such line also applies to any entries before it. 17162first archive location in the Org file also applies to any entries before it.
16164The corresponding variable is @code{org-archive-location}. 17163The corresponding variable is @code{org-archive-location}.
16165@item #+CATEGORY: 17164@item #+CATEGORY:
16166This line sets the category for the agenda file. The category applies 17165Sets the category of the agenda file, which applies to the entire document.
16167for all subsequent lines until the next @samp{#+CATEGORY} line, or the
16168end of the file. The first such line also applies to any entries before it.
16169@item #+COLUMNS: %25ITEM ... 17166@item #+COLUMNS: %25ITEM ...
16170@cindex property, COLUMNS 17167@cindex property, COLUMNS
16171Set the default format for columns view. This format applies when 17168Sets the default format for columns view. Org uses this format for column
16172columns view is invoked in locations where no @code{COLUMNS} property 17169views where there is no @code{COLUMNS} property.
16173applies.
16174@item #+CONSTANTS: name1=value1 ... 17170@item #+CONSTANTS: name1=value1 ...
16175@vindex org-table-formula-constants 17171@vindex org-table-formula-constants
16176@vindex org-table-formula 17172@vindex org-table-formula
16177Set file-local values for constants to be used in table formulas. This 17173Set file-local values for constants that table formulas can use. This line
16178line sets the local variable @code{org-table-formula-constants-local}. 17174sets the local variable @code{org-table-formula-constants-local}. The global
16179The global version of this variable is 17175version of this variable is @code{org-table-formula-constants}.
16180@code{org-table-formula-constants}.
16181@item #+FILETAGS: :tag1:tag2:tag3: 17176@item #+FILETAGS: :tag1:tag2:tag3:
16182Set tags that can be inherited by any entry in the file, including the 17177Set tags that all entries in the file will inherit from here, including the
16183top-level entries. 17178top-level entries.
16184@item #+DRAWERS: NAME1 ...
16185@vindex org-drawers
16186Set the file-local set of additional drawers. The corresponding global
16187variable is @code{org-drawers}.
16188@item #+LINK: linkword replace 17179@item #+LINK: linkword replace
16189@vindex org-link-abbrev-alist 17180@vindex org-link-abbrev-alist
16190These lines (several are allowed) specify link abbreviations. 17181Each line specifies one abbreviation for one link. Use multiple
16191@xref{Link abbreviations}. The corresponding variable is 17182@code{#+LINK:} lines for more, @pxref{Link abbreviations}. The corresponding
16192@code{org-link-abbrev-alist}. 17183variable is @code{org-link-abbrev-alist}.
16193@item #+PRIORITIES: highest lowest default 17184@item #+PRIORITIES: highest lowest default
16194@vindex org-highest-priority 17185@vindex org-highest-priority
16195@vindex org-lowest-priority 17186@vindex org-lowest-priority
@@ -16202,22 +17193,22 @@ This line sets a default inheritance value for entries in the current
16202buffer, most useful for specifying the allowed values of a property. 17193buffer, most useful for specifying the allowed values of a property.
16203@cindex #+SETUPFILE 17194@cindex #+SETUPFILE
16204@item #+SETUPFILE: file 17195@item #+SETUPFILE: file
16205This line defines a file that holds more in-buffer setup. Normally this is 17196The setup file is for additional in-buffer settings. Org loads this file and
16206entirely ignored. Only when the buffer is parsed for option-setting lines 17197parses it for any settings in it only when Org opens the main file. @kbd{C-c
16207(i.e., when starting Org mode for a file, when pressing @kbd{C-c C-c} in a 17198C-c} on the settings line will also parse and load. Org also parses and
16208settings line, or when exporting), then the contents of this file are parsed 17199loads the file during normal exporting process. Org parses the contents of
16209as if they had been included in the buffer. In particular, the file can be 17200this file as if it was included in the buffer. It can be another Org file.
16210any other Org mode file with internal setup. You can visit the file the 17201To visit the file, @kbd{C-c '} while the cursor is on the line with the file
16211cursor is in the line with @kbd{C-c '}. 17202name.
16212@item #+STARTUP: 17203@item #+STARTUP:
16213@cindex #+STARTUP 17204@cindex #+STARTUP
16214This line sets options to be used at startup of Org mode, when an 17205Startup options Org uses when first visiting a file.
16215Org file is being visited.
16216 17206
16217The first set of options deals with the initial visibility of the outline 17207The first set of options deals with the initial visibility of the outline
16218tree. The corresponding variable for global default settings is 17208tree. The corresponding variable for global default settings is
16219@code{org-startup-folded}, with a default value @code{t}, which means 17209@code{org-startup-folded} with a default value of @code{t}, which is the same
16220@code{overview}. 17210as @code{overview}.
17211
16221@vindex org-startup-folded 17212@vindex org-startup-folded
16222@cindex @code{overview}, STARTUP keyword 17213@cindex @code{overview}, STARTUP keyword
16223@cindex @code{content}, STARTUP keyword 17214@cindex @code{content}, STARTUP keyword
@@ -16234,17 +17225,17 @@ showeverything @r{show even drawer contents}
16234@cindex @code{indent}, STARTUP keyword 17225@cindex @code{indent}, STARTUP keyword
16235@cindex @code{noindent}, STARTUP keyword 17226@cindex @code{noindent}, STARTUP keyword
16236Dynamic virtual indentation is controlled by the variable 17227Dynamic virtual indentation is controlled by the variable
16237@code{org-startup-indented}@footnote{Emacs 23 and Org mode 6.29 are required} 17228@code{org-startup-indented}
16238@example 17229@example
16239indent @r{start with @code{org-indent-mode} turned on} 17230indent @r{start with @code{org-indent-mode} turned on}
16240noindent @r{start with @code{org-indent-mode} turned off} 17231noindent @r{start with @code{org-indent-mode} turned off}
16241@end example 17232@end example
16242 17233
16243@vindex org-startup-align-all-tables 17234@vindex org-startup-align-all-tables
16244Then there are options for aligning tables upon visiting a file. This 17235Aligns tables consistently upon visiting a file; useful for restoring
16245is useful in files containing narrowed table columns. The corresponding 17236narrowed table columns. The corresponding variable is
16246variable is @code{org-startup-align-all-tables}, with a default value 17237@code{org-startup-align-all-tables} with @code{nil} as default value.
16247@code{nil}. 17238
16248@cindex @code{align}, STARTUP keyword 17239@cindex @code{align}, STARTUP keyword
16249@cindex @code{noalign}, STARTUP keyword 17240@cindex @code{noalign}, STARTUP keyword
16250@example 17241@example
@@ -16253,9 +17244,9 @@ noalign @r{don't align tables on startup}
16253@end example 17244@end example
16254 17245
16255@vindex org-startup-with-inline-images 17246@vindex org-startup-with-inline-images
16256When visiting a file, inline images can be automatically displayed. The 17247Whether Org should automatically display inline images. The corresponding
16257corresponding variable is @code{org-startup-with-inline-images}, with a 17248variable is @code{org-startup-with-inline-images}, with a default value
16258default value @code{nil} to avoid delays when visiting a file. 17249@code{nil} to avoid delays when visiting a file.
16259@cindex @code{inlineimages}, STARTUP keyword 17250@cindex @code{inlineimages}, STARTUP keyword
16260@cindex @code{noinlineimages}, STARTUP keyword 17251@cindex @code{noinlineimages}, STARTUP keyword
16261@example 17252@example
@@ -16264,10 +17255,9 @@ noinlineimages @r{don't show inline images on startup}
16264@end example 17255@end example
16265 17256
16266@vindex org-startup-with-latex-preview 17257@vindex org-startup-with-latex-preview
16267When visiting a file, @LaTeX{} fragments can be converted to images 17258Whether Org should automatically convert @LaTeX{} fragments to images. The
16268automatically. The variable @code{org-startup-with-latex-preview} which 17259variable @code{org-startup-with-latex-preview}, which controls this setting,
16269controls this behavior, is set to @code{nil} by default to avoid delays on 17260is set to @code{nil} by default to avoid startup delays.
16270startup.
16271@cindex @code{latexpreview}, STARTUP keyword 17261@cindex @code{latexpreview}, STARTUP keyword
16272@cindex @code{nolatexpreview}, STARTUP keyword 17262@cindex @code{nolatexpreview}, STARTUP keyword
16273@example 17263@example
@@ -16328,21 +17318,21 @@ nologstatesreversed @r{do not reverse the order of states notes}
16328 17318
16329@vindex org-hide-leading-stars 17319@vindex org-hide-leading-stars
16330@vindex org-odd-levels-only 17320@vindex org-odd-levels-only
16331Here are the options for hiding leading stars in outline headings, and for 17321These options hide leading stars in outline headings, and indent outlines.
16332indenting outlines. The corresponding variables are 17322The corresponding variables are @code{org-hide-leading-stars} and
16333@code{org-hide-leading-stars} and @code{org-odd-levels-only}, both with a 17323@code{org-odd-levels-only}, both with a default setting of @code{nil}
16334default setting @code{nil} (meaning @code{showstars} and @code{oddeven}). 17324(meaning @code{showstars} and @code{oddeven}).
16335@cindex @code{hidestars}, STARTUP keyword 17325@cindex @code{hidestars}, STARTUP keyword
16336@cindex @code{showstars}, STARTUP keyword 17326@cindex @code{showstars}, STARTUP keyword
16337@cindex @code{odd}, STARTUP keyword 17327@cindex @code{odd}, STARTUP keyword
16338@cindex @code{even}, STARTUP keyword 17328@cindex @code{even}, STARTUP keyword
16339@example 17329@example
16340hidestars @r{make all but one of the stars starting a headline invisible.} 17330hidestars @r{hide all stars on the headline except one.}
16341showstars @r{show all stars starting a headline} 17331showstars @r{show all stars on the headline}
16342indent @r{virtual indentation according to outline level} 17332indent @r{virtual indents according to the outline level}
16343noindent @r{no virtual indentation according to outline level} 17333noindent @r{no virtual indents}
16344odd @r{allow only odd outline levels (1,3,...)} 17334odd @r{show odd outline levels only (1,3,...)}
16345oddeven @r{allow all outline levels} 17335oddeven @r{show all outline levels}
16346@end example 17336@end example
16347 17337
16348@vindex org-put-time-stamp-overlays 17338@vindex org-put-time-stamp-overlays
@@ -16368,8 +17358,8 @@ constSI @r{@file{constants.el} should use the SI unit system}
16368@vindex org-footnote-define-inline 17358@vindex org-footnote-define-inline
16369@vindex org-footnote-auto-label 17359@vindex org-footnote-auto-label
16370@vindex org-footnote-auto-adjust 17360@vindex org-footnote-auto-adjust
16371To influence footnote settings, use the following keywords. The 17361For footnote settings, use the following keywords. The corresponding
16372corresponding variables are @code{org-footnote-define-inline}, 17362variables are @code{org-footnote-define-inline},
16373@code{org-footnote-auto-label}, and @code{org-footnote-auto-adjust}. 17363@code{org-footnote-auto-label}, and @code{org-footnote-auto-adjust}.
16374@cindex @code{fninline}, STARTUP keyword 17364@cindex @code{fninline}, STARTUP keyword
16375@cindex @code{nofninline}, STARTUP keyword 17365@cindex @code{nofninline}, STARTUP keyword
@@ -16414,67 +17404,57 @@ entitiesplain @r{Leave entities plain}
16414 17404
16415@item #+TAGS: TAG1(c1) TAG2(c2) 17405@item #+TAGS: TAG1(c1) TAG2(c2)
16416@vindex org-tag-alist 17406@vindex org-tag-alist
16417These lines (several such lines are allowed) specify the valid tags in 17407These lines specify valid tags for this file. Org accepts multiple tags
16418this file, and (potentially) the corresponding @emph{fast tag selection} 17408lines. Tags could correspond to the @emph{fast tag selection} keys. The
16419keys. The corresponding variable is @code{org-tag-alist}. 17409corresponding variable is @code{org-tag-alist}.
16420@cindex #+TBLFM 17410@cindex #+TBLFM
16421@item #+TBLFM: 17411@item #+TBLFM:
16422This line contains the formulas for the table directly above the line. 17412This line is for formulas for the table directly above. A table can have
16423 17413multiple @samp{#+TBLFM:} lines. On table recalculation, Org applies only the
16424Table can have multiple lines containing @samp{#+TBLFM:}. Note 17414first @samp{#+TBLFM:} line. For details see @ref{Using multiple #+TBLFM
16425that only the first line of @samp{#+TBLFM:} will be applied when 17415lines} in @ref{Editing and debugging formulas}.
16426you recalculate the table. For more details see @ref{Using
16427multiple #+TBLFM lines} in @ref{Editing and debugging formulas}.
16428
16429@item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+DATE:, 17416@item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+DATE:,
16430@itemx #+OPTIONS:, #+BIND:, 17417@itemx #+OPTIONS:, #+BIND:,
16431@itemx #+DESCRIPTION:, #+KEYWORDS:,
16432@itemx #+LaTeX_HEADER:, #+LaTeX_HEADER_EXTRA:,
16433@itemx #+HTML_HEAD:, #+HTML_HEAD_EXTRA:, #+HTML_LINK_UP:, #+HTML_LINK_HOME:,
16434@itemx #+SELECT_TAGS:, #+EXCLUDE_TAGS: 17418@itemx #+SELECT_TAGS:, #+EXCLUDE_TAGS:
16435These lines provide settings for exporting files. For more details see 17419These lines provide settings for exporting files. For more details see
16436@ref{Export settings}. 17420@ref{Export settings}.
16437@item #+TODO: #+SEQ_TODO: #+TYP_TODO: 17421@item #+TODO: #+SEQ_TODO: #+TYP_TODO:
16438@vindex org-todo-keywords 17422@vindex org-todo-keywords
16439These lines set the TODO keywords and their interpretation in the 17423These lines set the TODO keywords and their significance to the current file.
16440current file. The corresponding variable is @code{org-todo-keywords}. 17424The corresponding variable is @code{org-todo-keywords}.
16441@end table 17425@end table
16442 17426
16443@node The very busy C-c C-c key, Clean view, In-buffer settings, Miscellaneous 17427@node The very busy C-c C-c key
16444@section The very busy C-c C-c key 17428@section The very busy C-c C-c key
16445@kindex C-c C-c 17429@kindex C-c C-c
16446@cindex C-c C-c, overview 17430@cindex C-c C-c, overview
16447 17431
16448The key @kbd{C-c C-c} has many purposes in Org, which are all 17432The @kbd{C-c C-c} key in Org serves many purposes depending on the context.
16449mentioned scattered throughout this manual. One specific function of 17433It is probably the most over-worked, multi-purpose key combination in Org.
16450this key is to add @emph{tags} to a headline (@pxref{Tags}). In many 17434Its uses are well-documented through out this manual, but here is a
16451other circumstances it means something like @emph{``Hey Org, look 17435consolidated list for easy reference.
16452here and update according to what you see here''}. Here is a summary of
16453what this means in different contexts.
16454 17436
16455@itemize @minus 17437@itemize @minus
16456@item 17438@item
16457If there are highlights in the buffer from the creation of a sparse 17439If any highlights shown in the buffer from the creation of a sparse tree, or
16458tree, or from clock display, remove these highlights. 17440from clock display, remove such highlights.
16459@item 17441@item
16460If the cursor is in one of the special @code{#+KEYWORD} lines, this 17442If the cursor is in one of the special @code{#+KEYWORD} lines, scan the
16461triggers scanning the buffer for these lines and updating the 17443buffer for these lines and update the information.
16462information.
16463@item 17444@item
16464If the cursor is inside a table, realign the table. This command 17445If the cursor is inside a table, realign the table. The table realigns even
16465works even if the automatic table editor has been turned off. 17446if automatic table editor is turned off.
16466@item 17447@item
16467If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to 17448If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to
16468the entire table. 17449the entire table.
16469@item 17450@item
16470If the current buffer is a capture buffer, close the note and file it. 17451If the current buffer is a capture buffer, close the note and file it. With
16471With a prefix argument, file it, without further interaction, to the 17452a prefix argument, also jump to the target location after saving the note.
16472default location.
16473@item 17453@item
16474If the cursor is on a @code{<<<target>>>}, update radio targets and 17454If the cursor is on a @code{<<<target>>>}, update radio targets and
16475corresponding links in this buffer. 17455corresponding links in this buffer.
16476@item 17456@item
16477If the cursor is in a property line or at the start or end of a property 17457If the cursor is on a property line or at the start or end of a property
16478drawer, offer property commands. 17458drawer, offer property commands.
16479@item 17459@item
16480If the cursor is at a footnote reference, go to the corresponding 17460If the cursor is at a footnote reference, go to the corresponding
@@ -16494,18 +17474,18 @@ block is updated.
16494If the cursor is at a timestamp, fix the day name in the timestamp. 17474If the cursor is at a timestamp, fix the day name in the timestamp.
16495@end itemize 17475@end itemize
16496 17476
16497@node Clean view, TTY keys, The very busy C-c C-c key, Miscellaneous 17477@node Clean view
16498@section A cleaner outline view 17478@section A cleaner outline view
16499@cindex hiding leading stars 17479@cindex hiding leading stars
16500@cindex dynamic indentation 17480@cindex dynamic indentation
16501@cindex odd-levels-only outlines 17481@cindex odd-levels-only outlines
16502@cindex clean outline view 17482@cindex clean outline view
16503 17483
16504Some people find it noisy and distracting that the Org headlines start with a 17484Org's default outline with stars and no indents can become too cluttered for
16505potentially large number of stars, and that text below the headlines is not 17485short documents. For @emph{book-like} long documents, the effect is not as
16506indented. While this is no problem when writing a @emph{book-like} document 17486noticeable. Org provides an alternate stars and indentation scheme, as shown
16507where the outline headings are really section headings, in a more 17487on the right in the following table. It uses only one star and indents text
16508@emph{list-oriented} outline, indented structure is a lot cleaner: 17488to line with the heading:
16509 17489
16510@example 17490@example
16511@group 17491@group
@@ -16521,38 +17501,40 @@ more text | more text
16521 17501
16522@noindent 17502@noindent
16523 17503
16524If you are using at least Emacs 23.2@footnote{Emacs 23.1 can actually crash 17504To turn this mode on, use the minor mode, @code{org-indent-mode}. Text lines
16525with @code{org-indent-mode}} and version 6.29 of Org, this kind of view can 17505that are not headlines are prefixed with spaces to vertically align with the
16526be achieved dynamically at display time using @code{org-indent-mode}. In 17506headline text@footnote{The @code{org-indent-mode} also sets the
16527this minor mode, all lines are prefixed for display with the necessary amount 17507@code{wrap-prefix} correctly for indenting and wrapping long lines of
16528of space@footnote{@code{org-indent-mode} also sets the @code{wrap-prefix} 17508headlines or text. This minor mode handles @code{visual-line-mode} and
16529property, such that @code{visual-line-mode} (or purely setting 17509directly applied settings through @code{word-wrap}.}.
16530@code{word-wrap}) wraps long lines (including headlines) correctly indented. 17510
16531}. Also headlines are prefixed with additional stars, so that the amount of 17511To make more horizontal space, the headlines are shifted by two stars. This
16532indentation shifts by two@footnote{See the variable 17512can be configured by the @code{org-indent-indentation-per-level} variable.
16533@code{org-indent-indentation-per-level}.} spaces per level. All headline 17513Only one star on each headline is visible, the rest are masked with the same
16534stars but the last one are made invisible using the @code{org-hide} 17514font color as the background. This font face can be configured with the
16535face@footnote{Turning on @code{org-indent-mode} sets 17515@code{org-hide} variable.
17516
17517Note that turning on @code{org-indent-mode} sets
16536@code{org-hide-leading-stars} to @code{t} and @code{org-adapt-indentation} to 17518@code{org-hide-leading-stars} to @code{t} and @code{org-adapt-indentation} to
16537@code{nil}.}; see below under @samp{2.} for more information on how this 17519@code{nil}; @samp{2.} below shows how this works.
16538works. You can turn on @code{org-indent-mode} for all files by customizing 17520
16539the variable @code{org-startup-indented}, or you can turn it on for 17521To globally turn on @code{org-indent-mode} for all files, customize the
16540individual files using 17522variable @code{org-startup-indented}.
17523
17524To turn on indenting for individual files, use @code{#+STARTUP} option as
17525follows:
16541 17526
16542@example 17527@example
16543#+STARTUP: indent 17528#+STARTUP: indent
16544@end example 17529@end example
16545 17530
16546If you want a similar effect in an earlier version of Emacs and/or Org, or if 17531Indent on startup makes Org use hard spaces to align text with headings as
16547you want the indentation to be hard space characters so that the plain text 17532shown in examples below.
16548file looks as similar as possible to the Emacs display, Org supports you in
16549the following way:
16550 17533
16551@enumerate 17534@enumerate
16552@item 17535@item
16553@emph{Indentation of text below headlines}@* 17536@emph{Indentation of text below headlines}@*
16554You may indent text below each headline to make the left boundary line up 17537Indent text to align with the headline.
16555with the headline, like
16556 17538
16557@example 17539@example
16558*** 3rd level 17540*** 3rd level
@@ -16560,23 +17542,21 @@ with the headline, like
16560@end example 17542@end example
16561 17543
16562@vindex org-adapt-indentation 17544@vindex org-adapt-indentation
16563Org supports this with paragraph filling, line wrapping, and structure 17545Org adapts indentations with paragraph filling, line wrapping, and structure
16564editing@footnote{See also the variable @code{org-adapt-indentation}.}, 17546editing@footnote{Also see the variable @code{org-adapt-indentation}.}.
16565preserving or adapting the indentation as appropriate.
16566 17547
16567@item 17548@item
16568@vindex org-hide-leading-stars 17549@vindex org-hide-leading-stars
16569@emph{Hiding leading stars}@* You can modify the display in such a way that 17550@emph{Hiding leading stars}@* Org can make leading stars invisible. For
16570all leading stars become invisible. To do this in a global way, configure 17551global preference, configure the variable @code{org-hide-leading-stars}. For
16571the variable @code{org-hide-leading-stars} or change this on a per-file basis 17552per-file preference, use these file @code{#+STARTUP} options:
16572with
16573 17553
16574@example 17554@example
16575#+STARTUP: hidestars 17555#+STARTUP: hidestars
16576#+STARTUP: showstars 17556#+STARTUP: showstars
16577@end example 17557@end example
16578 17558
16579With hidden stars, the tree becomes: 17559With stars hidden, the tree is shown as:
16580 17560
16581@example 17561@example
16582@group 17562@group
@@ -16589,50 +17569,39 @@ With hidden stars, the tree becomes:
16589 17569
16590@noindent 17570@noindent
16591@vindex org-hide @r{(face)} 17571@vindex org-hide @r{(face)}
16592The leading stars are not truly replaced by whitespace, they are only 17572Because Org makes the font color same as the background color to hide to
16593fontified with the face @code{org-hide} that uses the background color as 17573stars, sometimes @code{org-hide} face may need tweaking to get the effect
16594font color. If you are not using either white or black background, you may 17574right. For some black and white combinations, @code{grey90} on a white
16595have to customize this face to get the wanted effect. Another possibility is 17575background might mask the stars better.
16596to set this font such that the extra stars are @i{almost} invisible, for
16597example using the color @code{grey90} on a white background.
16598 17576
16599@item 17577@item
16600@vindex org-odd-levels-only 17578@vindex org-odd-levels-only
16601Things become cleaner still if you skip all the even levels and use only odd 17579Using stars for only odd levels, 1, 3, 5, @dots{}, can also clean up the
16602levels 1, 3, 5..., effectively adding two stars to go from one outline level 17580clutter. This removes two stars from each level@footnote{Because
16603to the next@footnote{When you need to specify a level for a property search 17581@samp{LEVEL=2} has 3 stars, @samp{LEVEL=3} has 4 stars, and so on}. For Org
16604or refile targets, @samp{LEVEL=2} will correspond to 3 stars, etc.}. In this 17582to properly handle this cleaner structure during edits and exports, configure
16605way we get the outline view shown at the beginning of this section. In order 17583the variable @code{org-odd-levels-only}. To set this per-file, use either
16606to make the structure editing and export commands handle this convention 17584one of the following lines:
16607correctly, configure the variable @code{org-odd-levels-only}, or set this on
16608a per-file basis with one of the following lines:
16609 17585
16610@example 17586@example
16611#+STARTUP: odd 17587#+STARTUP: odd
16612#+STARTUP: oddeven 17588#+STARTUP: oddeven
16613@end example 17589@end example
16614 17590
16615You can convert an Org file from single-star-per-level to the 17591To switch between single and double stars layouts, use @kbd{M-x
16616double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels 17592org-convert-to-odd-levels RET} and @kbd{M-x org-convert-to-oddeven-levels}.
16617RET} in that file. The reverse operation is @kbd{M-x
16618org-convert-to-oddeven-levels}.
16619@end enumerate 17593@end enumerate
16620 17594
16621@node TTY keys, Interaction, Clean view, Miscellaneous 17595@node TTY keys
16622@section Using Org on a tty 17596@section Using Org on a tty
16623@cindex tty key bindings 17597@cindex tty key bindings
16624 17598
16625Because Org contains a large number of commands, by default many of 17599Org provides alternative key bindings for TTY and modern mobile devices that
16626Org's core commands are bound to keys that are generally not 17600cannot handle cursor keys and complex modifier key chords. Some of these
16627accessible on a tty, such as the cursor keys (@key{left}, @key{right}, 17601workarounds may be more cumbersome than necessary. Users should look into
16628@key{up}, @key{down}), @key{TAB} and @key{RET}, in particular when used 17602customizing these further based on their usage needs. For example, the
16629together with modifiers like @key{Meta} and/or @key{Shift}. To access 17603normal @kbd{S-@key{cursor}} for editing timestamp might be better with
16630these commands on a tty when special keys are unavailable, the following 17604@kbd{C-c .} chord.
16631alternative bindings can be used. The tty bindings below will likely be
16632more cumbersome; you may find for some of the bindings below that a
16633customized workaround suits you better. For example, changing a timestamp
16634is really only fun with @kbd{S-@key{cursor}} keys, whereas on a
16635tty you would rather use @kbd{C-c .} to re-insert the timestamp.
16636 17605
16637@multitable @columnfractions 0.15 0.2 0.1 0.2 17606@multitable @columnfractions 0.15 0.2 0.1 0.2
16638@item @b{Default} @tab @b{Alternative 1} @tab @b{Speed key} @tab @b{Alternative 2} 17607@item @b{Default} @tab @b{Alternative 1} @tab @b{Speed key} @tab @b{Alternative 2}
@@ -16657,74 +17626,62 @@ tty you would rather use @kbd{C-c .} to re-insert the timestamp.
16657@end multitable 17626@end multitable
16658 17627
16659 17628
16660@node Interaction, org-crypt, TTY keys, Miscellaneous 17629@node Interaction
16661@section Interaction with other packages 17630@section Interaction with other packages
16662@cindex packages, interaction with other 17631@cindex packages, interaction with other
16663Org lives in the world of GNU Emacs and interacts in various ways 17632Org's compatibility and the level of interaction with other Emacs packages
16664with other code out there. 17633are documented here.
17634
16665 17635
16666@menu 17636@menu
16667* Cooperation:: Packages Org cooperates with 17637* Cooperation:: Packages Org cooperates with
16668* Conflicts:: Packages that lead to conflicts 17638* Conflicts:: Packages that lead to conflicts
16669@end menu 17639@end menu
16670 17640
16671@node Cooperation, Conflicts, Interaction, Interaction 17641@node Cooperation
16672@subsection Packages that Org cooperates with 17642@subsection Packages that Org cooperates with
16673 17643
16674@table @asis 17644@table @asis
16675@cindex @file{calc.el} 17645@cindex @file{calc.el}
16676@cindex Gillespie, Dave 17646@cindex Gillespie, Dave
16677@item @file{calc.el} by Dave Gillespie 17647@item @file{calc.el} by Dave Gillespie
16678Org uses the Calc package for implementing spreadsheet 17648Org uses the Calc package for tables to implement spreadsheet functionality
16679functionality in its tables (@pxref{The spreadsheet}). Org 17649(@pxref{The spreadsheet}). Org also uses Calc for embedded calculations.
16680checks for the availability of Calc by looking for the function 17650@xref{Embedded Mode, , Embedded Mode, calc, GNU Emacs Calc Manual}.
16681@code{calc-eval} which will have been autoloaded during setup if Calc has
16682been installed properly. As of Emacs 22, Calc is part of the Emacs
16683distribution. Another possibility for interaction between the two
16684packages is using Calc for embedded calculations. @xref{Embedded Mode,
16685, Embedded Mode, calc, GNU Emacs Calc Manual}.
16686@item @file{constants.el} by Carsten Dominik 17651@item @file{constants.el} by Carsten Dominik
16687@cindex @file{constants.el} 17652@cindex @file{constants.el}
16688@cindex Dominik, Carsten 17653@cindex Dominik, Carsten
16689@vindex org-table-formula-constants 17654@vindex org-table-formula-constants
16690In a table formula (@pxref{The spreadsheet}), it is possible to use 17655Org can use names for constants in formulas in tables. Org can also use
16691names for natural constants or units. Instead of defining your own 17656calculation suffixes for units, such as @samp{M} for @samp{Mega}. For a
16692constants in the variable @code{org-table-formula-constants}, install 17657standard collection of such constants, install the @file{constants} package.
16693the @file{constants} package which defines a large number of constants 17658Install version 2.0 of this package, available at
16694and units, and lets you use unit prefixes like @samp{M} for 17659@url{http://www.astro.uva.nl/~dominik/Tools}. Org checks if the function
16695@samp{Mega}, etc. You will need version 2.0 of this package, available 17660@code{constants-get} has been autoloaded. Installation instructions are in
16696at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for 17661the file, @file{constants.el}.
16697the function @code{constants-get}, which has to be autoloaded in your
16698setup. See the installation instructions in the file
16699@file{constants.el}.
16700@item @file{cdlatex.el} by Carsten Dominik 17662@item @file{cdlatex.el} by Carsten Dominik
16701@cindex @file{cdlatex.el} 17663@cindex @file{cdlatex.el}
16702@cindex Dominik, Carsten 17664@cindex Dominik, Carsten
16703Org mode can make use of the CD@LaTeX{} package to efficiently enter 17665Org mode can use CD@LaTeX{} package to efficiently enter @LaTeX{} fragments
16704@LaTeX{} fragments into Org files. See @ref{CDLaTeX mode}. 17666into Org files (@pxref{CDLaTeX mode}).
16705@item @file{imenu.el} by Ake Stenhoff and Lars Lindberg 17667@item @file{imenu.el} by Ake Stenhoff and Lars Lindberg
16706@cindex @file{imenu.el} 17668@cindex @file{imenu.el}
16707Imenu allows menu access to an index of items in a file. Org mode 17669Imenu creates dynamic menus based on an index of items in a file. Org mode
16708supports Imenu---all you need to do to get the index is the following: 17670supports Imenu menus. Enable it with a mode hook as follows:
16709@lisp 17671@lisp
16710(add-hook 'org-mode-hook 17672(add-hook 'org-mode-hook
16711 (lambda () (imenu-add-to-menubar "Imenu"))) 17673 (lambda () (imenu-add-to-menubar "Imenu")))
16712@end lisp 17674@end lisp
16713@vindex org-imenu-depth 17675@vindex org-imenu-depth
16714By default the index is two levels deep---you can modify the depth using 17676By default the Imenu index is two levels deep. Change the index depth using
16715the option @code{org-imenu-depth}. 17677thes variable, @code{org-imenu-depth}.
16716@item @file{remember.el} by John Wiegley
16717@cindex @file{remember.el}
16718@cindex Wiegley, John
16719Org used to use this package for capture, but no longer does.
16720@item @file{speedbar.el} by Eric M. Ludlam 17678@item @file{speedbar.el} by Eric M. Ludlam
16721@cindex @file{speedbar.el} 17679@cindex @file{speedbar.el}
16722@cindex Ludlam, Eric M. 17680@cindex Ludlam, Eric M.
16723Speedbar is a package that creates a special frame displaying files and 17681Speedbar package creates a special Emacs frame for displaying files and index
16724index items in files. Org mode supports Speedbar and allows you to 17682items in files. Org mode supports Speedbar; users can drill into Org files
16725drill into Org files directly from the Speedbar. It also allows you to 17683directly from the Speedbar. The @kbd{<} in the Speedbar frame tweeks the
16726restrict the scope of agenda commands to a file or a subtree by using 17684agenda commands to that file or to a subtree.
16727the command @kbd{<} in the Speedbar frame.
16728@cindex @file{table.el} 17685@cindex @file{table.el}
16729@item @file{table.el} by Takaaki Ota 17686@item @file{table.el} by Takaaki Ota
16730@kindex C-c C-c 17687@kindex C-c C-c
@@ -16733,13 +17690,11 @@ the command @kbd{<} in the Speedbar frame.
16733@cindex Ota, Takaaki 17690@cindex Ota, Takaaki
16734 17691
16735Complex ASCII tables with automatic line wrapping, column- and row-spanning, 17692Complex ASCII tables with automatic line wrapping, column- and row-spanning,
16736and alignment can be created using the Emacs table package by Takaaki Ota 17693and alignment can be created using the Emacs table package by Takaaki Ota.
16737(@uref{http://sourceforge.net/projects/table}, and also part of Emacs 22). 17694Org mode recognizes such tables and export them properly. @kbd{C-c '} to
16738Org mode will recognize these tables and export them properly. Because of 17695edit these tables in a special buffer, much like Org's @samp{src} code
16739interference with other Org mode functionality, you unfortunately cannot edit 17696blocks. Because of interference with other Org mode functionality, Takaaki
16740these tables directly in the buffer. Instead, you need to use the command 17697Ota tables cannot be edited directly in the Org buffer.
16741@kbd{C-c '} to edit them, similar to source code snippets.
16742
16743@table @kbd 17698@table @kbd
16744@orgcmd{C-c ',org-edit-special} 17699@orgcmd{C-c ',org-edit-special}
16745Edit a @file{table.el} table. Works when the cursor is in a table.el table. 17700Edit a @file{table.el} table. Works when the cursor is in a table.el table.
@@ -16747,50 +17702,37 @@ Edit a @file{table.el} table. Works when the cursor is in a table.el table.
16747@orgcmd{C-c ~,org-table-create-with-table.el} 17702@orgcmd{C-c ~,org-table-create-with-table.el}
16748Insert a @file{table.el} table. If there is already a table at point, this 17703Insert a @file{table.el} table. If there is already a table at point, this
16749command converts it between the @file{table.el} format and the Org mode 17704command converts it between the @file{table.el} format and the Org mode
16750format. See the documentation string of the command 17705format. See the documentation string of the command @code{org-convert-table}
16751@code{org-convert-table} for the restrictions under which this is 17706for details.
16752possible.
16753@end table 17707@end table
16754@file{table.el} is part of Emacs since Emacs 22.
16755@item @file{footnote.el} by Steven L. Baur
16756@cindex @file{footnote.el}
16757@cindex Baur, Steven L.
16758Org mode recognizes numerical footnotes as provided by this package.
16759However, Org mode also has its own footnote support (@pxref{Footnotes}),
16760which makes using @file{footnote.el} unnecessary.
16761@end table 17708@end table
16762 17709
16763@node Conflicts, , Cooperation, Interaction 17710@node Conflicts
16764@subsection Packages that lead to conflicts with Org mode 17711@subsection Packages that conflict with Org mode
16765 17712
16766@table @asis 17713@table @asis
16767 17714
16768@cindex @code{shift-selection-mode} 17715@cindex @code{shift-selection-mode}
16769@vindex org-support-shift-select 17716@vindex org-support-shift-select
16770In Emacs 23, @code{shift-selection-mode} is on by default, meaning that 17717In Emacs, @code{shift-selection-mode} combines cursor motions with shift key
16771cursor motions combined with the shift key should start or enlarge regions. 17718to enlarge regions. Emacs sets this mode by default. This conflicts with
16772This conflicts with the use of @kbd{S-@key{cursor}} commands in Org to change 17719Org's use of @kbd{S-@key{cursor}} commands to change timestamps, TODO
16773timestamps, TODO keywords, priorities, and item bullet types if the cursor is 17720keywords, priorities, and item bullet types, etc. Since @kbd{S-@key{cursor}}
16774at such a location. By default, @kbd{S-@key{cursor}} commands outside 17721commands outside of specific contexts don't do anything, Org offers the
16775special contexts don't do anything, but you can customize the variable 17722variable @code{org-support-shift-select} for customization. Org mode
16776@code{org-support-shift-select}. Org mode then tries to accommodate shift 17723accommodates shift selection by (i) making it available outside of the
16777selection by (i) using it outside of the special contexts where special 17724special contexts where special commands apply, and (ii) extending an
16778commands apply, and by (ii) extending an existing active region even if the 17725existing active region even if the cursor moves across a special context.
16779cursor moves across a special context.
16780 17726
16781@item @file{CUA.el} by Kim. F. Storm 17727@item @file{CUA.el} by Kim. F. Storm
16782@cindex @file{CUA.el} 17728@cindex @file{CUA.el}
16783@cindex Storm, Kim. F. 17729@cindex Storm, Kim. F.
16784@vindex org-replace-disputed-keys 17730@vindex org-replace-disputed-keys
16785Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by CUA mode 17731Org key bindings conflict with @kbd{S-<cursor>} keys used by CUA mode. For
16786(as well as @code{pc-select-mode} and @code{s-region-mode}) to select and extend the 17732Org to relinquish these bindings to CUA mode, configure the variable
16787region. In fact, Emacs 23 has this built-in in the form of 17733@code{org-replace-disputed-keys}. When set, Org moves the following key
16788@code{shift-selection-mode}, see previous paragraph. If you are using Emacs 17734bindings in Org files, and in the agenda buffer (but not during date
1678923, you probably don't want to use another package for this purpose. However, 17735selection).
16790if you prefer to leave these keys to a different package while working in
16791Org mode, configure the variable @code{org-replace-disputed-keys}. When set,
16792Org will move the following key bindings in Org files, and in the agenda
16793buffer (but not during date selection).
16794 17736
16795@example 17737@example
16796S-UP @result{} M-p S-DOWN @result{} M-n 17738S-UP @result{} M-p S-DOWN @result{} M-n
@@ -16799,9 +17741,8 @@ C-S-LEFT @result{} M-S-- C-S-RIGHT @result{} M-S-+
16799@end example 17741@end example
16800 17742
16801@vindex org-disputed-keys 17743@vindex org-disputed-keys
16802Yes, these are unfortunately more difficult to remember. If you want 17744Yes, these are unfortunately more difficult to remember. To define a
16803to have other replacement keys, look at the variable 17745different replacement keys, look at the variable @code{org-disputed-keys}.
16804@code{org-disputed-keys}.
16805 17746
16806@item @file{ecomplete.el} by Lars Magne Ingebrigtsen @email{larsi@@gnus.org} 17747@item @file{ecomplete.el} by Lars Magne Ingebrigtsen @email{larsi@@gnus.org}
16807@cindex @file{ecomplete.el} 17748@cindex @file{ecomplete.el}
@@ -16819,9 +17760,8 @@ manually when needed in the messages body.
16819@cindex @file{filladapt.el} 17760@cindex @file{filladapt.el}
16820 17761
16821Org mode tries to do the right thing when filling paragraphs, list items and 17762Org mode tries to do the right thing when filling paragraphs, list items and
16822other elements. Many users reported they had problems using both 17763other elements. Many users reported problems using both @file{filladapt.el}
16823@file{filladapt.el} and Org mode, so a safe thing to do is to disable it like 17764and Org mode, so a safe thing to do is to disable filladapt like this:
16824this:
16825 17765
16826@lisp 17766@lisp
16827(add-hook 'org-mode-hook 'turn-off-filladapt-mode) 17767(add-hook 'org-mode-hook 'turn-off-filladapt-mode)
@@ -16836,20 +17776,19 @@ fixed this problem:
16836@lisp 17776@lisp
16837(add-hook 'org-mode-hook 17777(add-hook 'org-mode-hook
16838 (lambda () 17778 (lambda ()
16839 (org-set-local 'yas/trigger-key [tab]) 17779 (setq-local yas/trigger-key [tab])
16840 (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand))) 17780 (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
16841@end lisp 17781@end lisp
16842 17782
16843The latest version of yasnippet doesn't play well with Org mode. If the 17783The latest version of yasnippet doesn't play well with Org mode. If the
16844above code does not fix the conflict, start by defining the following 17784above code does not fix the conflict, first define the following function:
16845function:
16846 17785
16847@lisp 17786@lisp
16848(defun yas/org-very-safe-expand () 17787(defun yas/org-very-safe-expand ()
16849 (let ((yas/fallback-behavior 'return-nil)) (yas/expand))) 17788 (let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
16850@end lisp 17789@end lisp
16851 17790
16852Then, tell Org mode what to do with the new function: 17791Then tell Org mode to use that function:
16853 17792
16854@lisp 17793@lisp
16855(add-hook 'org-mode-hook 17794(add-hook 'org-mode-hook
@@ -16892,21 +17831,19 @@ another key for this command, or override the key in
16892 17831
16893@end table 17832@end table
16894 17833
16895@node org-crypt, , Interaction, Miscellaneous 17834@node org-crypt
16896@section org-crypt.el 17835@section org-crypt.el
16897@cindex @file{org-crypt.el} 17836@cindex @file{org-crypt.el}
16898@cindex @code{org-decrypt-entry} 17837@cindex @code{org-decrypt-entry}
16899 17838
16900Org-crypt will encrypt the text of an entry, but not the headline, or 17839Org crypt encrypts the text of an Org entry, but not the headline, or
16901properties. Org-crypt uses the Emacs EasyPG library to encrypt and decrypt 17840properties. Org crypt uses the Emacs EasyPG library to encrypt and decrypt.
16902files.
16903 17841
16904Any text below a headline that has a @samp{:crypt:} tag will be automatically 17842Any text below a headline that has a @samp{:crypt:} tag will be automatically
16905be encrypted when the file is saved. If you want to use a different tag just 17843be encrypted when the file is saved. To use a different tag, customize the
16906customize the @code{org-crypt-tag-matcher} setting. 17844@code{org-crypt-tag-matcher} variable.
16907 17845
16908To use org-crypt it is suggested that you have the following in your 17846Suggested Org crypt settings in Emacs init file:
16909@file{.emacs}:
16910 17847
16911@lisp 17848@lisp
16912(require 'org-crypt) 17849(require 'org-crypt)
@@ -16928,14 +17865,14 @@ To use org-crypt it is suggested that you have the following in your
16928 ;; # -*- buffer-auto-save-file-name: nil; -*- 17865 ;; # -*- buffer-auto-save-file-name: nil; -*-
16929@end lisp 17866@end lisp
16930 17867
16931Excluding the crypt tag from inheritance prevents already encrypted text 17868Excluding the crypt tag from inheritance prevents encrypting previously
16932being encrypted again. 17869encrypted text.
16933 17870
16934@node Hacking, MobileOrg, Miscellaneous, Top 17871@node Hacking
16935@appendix Hacking 17872@appendix Hacking
16936@cindex hacking 17873@cindex hacking
16937 17874
16938This appendix covers some aspects where users can extend the functionality of 17875This appendix covers some areas where users can extend the functionality of
16939Org. 17876Org.
16940 17877
16941@menu 17878@menu
@@ -16953,38 +17890,35 @@ Org.
16953* Using the mapping API:: Mapping over all or selected entries 17890* Using the mapping API:: Mapping over all or selected entries
16954@end menu 17891@end menu
16955 17892
16956@node Hooks, Add-on packages, Hacking, Hacking 17893@node Hooks
16957@section Hooks 17894@section Hooks
16958@cindex hooks 17895@cindex hooks
16959 17896
16960Org has a large number of hook variables that can be used to add 17897Org has a large number of hook variables for adding functionality. This
16961functionality. This appendix about hacking is going to illustrate the 17898appendix illustrates using a few. A complete list of hooks with
16962use of some of them. A complete list of all hooks with documentation is 17899documentation is maintained by the Worg project at
16963maintained by the Worg project and can be found at 17900@uref{http://orgmode.org/worg/doc.html#hooks}.
16964@uref{http://orgmode.org/worg/org-configs/org-hooks.php}.
16965 17901
16966@node Add-on packages, Adding hyperlink types, Hooks, Hacking 17902@node Add-on packages
16967@section Add-on packages 17903@section Add-on packages
16968@cindex add-on packages 17904@cindex add-on packages
16969 17905
16970A large number of add-on packages have been written by various authors. 17906Various authors wrote a large number of add-on packages for Org.
16971 17907
16972These packages are not part of Emacs, but they are distributed as contributed 17908These packages are not part of Emacs, but they are distributed as contributed
16973packages with the separate release available at @uref{http://orgmode.org}. 17909packages with the separate release available at @uref{http://orgmode.org}.
16974See the @file{contrib/README} file in the source code directory for a list of 17910See the @file{contrib/README} file in the source code directory for a list of
16975contributed files. You may also find some more information on the Worg page: 17911contributed files. Worg page with more information is at:
16976@uref{http://orgmode.org/worg/org-contrib/}. 17912@uref{http://orgmode.org/worg/org-contrib/}.
16977 17913
16978@node Adding hyperlink types, Adding export back-ends, Add-on packages, Hacking 17914@node Adding hyperlink types
16979@section Adding hyperlink types 17915@section Adding hyperlink types
16980@cindex hyperlinks, adding new types 17916@cindex hyperlinks, adding new types
16981 17917
16982Org has a large number of hyperlink types built-in 17918Org has many built-in hyperlink types (@pxref{Hyperlinks}), and an interface
16983(@pxref{Hyperlinks}). If you would like to add new link types, Org 17919for adding new link types. The example file, @file{org-man.el}, shows the
16984provides an interface for doing so. Let's look at an example file, 17920process of adding Org links to Unix man pages, which look like this:
16985@file{org-man.el}, that will add support for creating links like 17921@samp{[[man:printf][The printf manpage]]}:
16986@samp{[[man:printf][The printf manpage]]} to show Unix manual pages inside
16987Emacs:
16988 17922
16989@lisp 17923@lisp
16990;;; org-man.el - Support for links to manpages in Org 17924;;; org-man.el - Support for links to manpages in Org
@@ -17029,149 +17963,118 @@ PATH should be a topic that can be thrown at the man command."
17029@end lisp 17963@end lisp
17030 17964
17031@noindent 17965@noindent
17032You would activate this new link type in @file{.emacs} with 17966To activate links to man pages in Org, enter this in the init file:
17033 17967
17034@lisp 17968@lisp
17035(require 'org-man) 17969(require 'org-man)
17036@end lisp 17970@end lisp
17037 17971
17038@noindent 17972@noindent
17039Let's go through the file and see what it does. 17973A review of @file{org-man.el}:
17040@enumerate 17974@enumerate
17041@item 17975@item
17042It does @code{(require 'org)} to make sure that @file{org.el} has been 17976First, @code{(require 'org)} ensures @file{org.el} is loaded.
17043loaded.
17044@item 17977@item
17045The next line calls @code{org-add-link-type} to define a new link type 17978The @code{org-add-link-type} defines a new link type with @samp{man} prefix.
17046with prefix @samp{man}. The call also contains the name of a function 17979The call contains the function to call that follows the link type.
17047that will be called to follow such a link.
17048@item 17980@item
17049@vindex org-store-link-functions 17981@vindex org-store-link-functions
17050The next line adds a function to @code{org-store-link-functions}, in 17982The next line adds a function to @code{org-store-link-functions} that records
17051order to allow the command @kbd{C-c l} to record a useful link in a 17983a useful link with the command @kbd{C-c l} in a buffer displaying a man page.
17052buffer displaying a man page.
17053@end enumerate 17984@end enumerate
17054 17985
17055The rest of the file defines the necessary variables and functions. 17986The rest of the file defines necessary variables and functions. First is the
17056First there is a customization variable that determines which Emacs 17987customization variable @code{org-man-command}. It has two options,
17057command should be used to display man pages. There are two options, 17988@code{man} and @code{woman}. Next is a function whose argument is the link
17058@code{man} and @code{woman}. Then the function to follow a link is 17989path, which for man pages is the topic of the man command. To follow the
17059defined. It gets the link path as an argument---in this case the link 17990link, the function calls the @code{org-man-command} to display the man page.
17060path is just a topic for the manual command. The function calls the 17991
17061value of @code{org-man-command} to display the man page. 17992
17062 17993@kbd{C-c l} constructs and stores the link.
17063Finally the function @code{org-man-store-link} is defined. When you try 17994
17064to store a link with @kbd{C-c l}, this function will be called to 17995@kbd{C-c l} calls the function @code{org-man-store-link}, which first checks
17065try to make a link. The function must first decide if it is supposed to 17996if the @code{major-mode} is appropriate. If check fails, the function
17066create the link for this buffer type; we do this by checking the value 17997returns @code{nil}. Otherwise the function makes a link string by combining
17067of the variable @code{major-mode}. If not, the function must exit and 17998the @samp{man:} prefix with the man topic. The function then calls
17068return the value @code{nil}. If yes, the link is created by getting the 17999@code{org-store-link-props} with @code{:type} and @code{:link} properties. A
17069manual topic from the buffer name and prefixing it with the string 18000@code{:description} property is an optional string that is displayed when the
17070@samp{man:}. Then it must call the command @code{org-store-link-props} 18001function inserts the link in the Org buffer.
17071and set the @code{:type} and @code{:link} properties. Optionally you 18002
17072can also set the @code{:description} property to provide a default for 18003@kbd{C-c C-l} inserts the stored link.
17073the link description when the link is later inserted into an Org 18004
17074buffer with @kbd{C-c C-l}. 18005To define new link types, define a function that implements completion
17075 18006support with @kbd{C-c C-l}. This function should not accept any arguments
17076When it makes sense for your new link type, you may also define a function 18007but return the appropriate prefix and complete link string.
17077@code{org-PREFIX-complete-link} that implements special (e.g., completion) 18008
17078support for inserting such a link with @kbd{C-c C-l}. Such a function should 18009@node Adding export back-ends
17079not accept any arguments, and return the full link with prefix.
17080
17081@node Adding export back-ends, Context-sensitive commands, Adding hyperlink types, Hacking
17082@section Adding export back-ends 18010@section Adding export back-ends
17083@cindex Export, writing back-ends 18011@cindex Export, writing back-ends
17084 18012
17085Org 8.0 comes with a completely rewritten export engine which makes it easy 18013Org's export engine makes it easy for writing new back-ends. The framework
17086to write new export back-ends, either from scratch, or from deriving them 18014on which the engine was built makes it easy to derive new back-ends from
17087from existing ones. 18015existing ones.
17088 18016
17089Your two entry points are respectively @code{org-export-define-backend} and 18017The two main entry points to the export engine are:
17090@code{org-export-define-derived-backend}. To grok these functions, you 18018@code{org-export-define-backend} and
17091should first have a look at @file{ox-latex.el} (for how to define a new 18019@code{org-export-define-derived-backend}. To grok these functions, see
17092back-end from scratch) and @file{ox-beamer.el} (for how to derive a new 18020@file{ox-latex.el} for an example of defining a new back-end from scratch,
17093back-end from an existing one. 18021and @file{ox-beamer.el} for an example of deriving from an existing engine.
17094 18022
17095When creating a new back-end from scratch, the basic idea is to set the name 18023For creating a new back-end from scratch, first set its name as a symbol in
17096of the back-end (as a symbol) and an an alist of elements and export 18024an alist consisting of elements and export functions. To make the back-end
17097functions. On top of this, you will need to set additional keywords like 18025visible to the export dispatcher, set @code{:menu-entry} keyword. For export
17098@code{:menu-entry} (to display the back-end in the export dispatcher), 18026options specific to this back-end, set the @code{:options-alist}.
17099@code{:export-block} (to specify what blocks should not be exported by this 18027
17100back-end), and @code{:options-alist} (to let the user set export options that 18028For creating a new back-end from an existing one, set @code{:translate-alist}
17101are specific to this back-end.) 18029to an alist of export functions. This alist replaces the parent back-end
17102 18030functions.
17103Deriving a new back-end is similar, except that you need to set 18031
17104@code{:translate-alist} to an alist of export functions that should be used 18032For complete documentation, see
17105instead of the parent back-end functions.
17106
17107For a complete reference documentation, see
17108@url{http://orgmode.org/worg/dev/org-export-reference.html, the Org Export 18033@url{http://orgmode.org/worg/dev/org-export-reference.html, the Org Export
17109Reference on Worg}. 18034Reference on Worg}.
17110 18035
17111@node Context-sensitive commands, Tables in arbitrary syntax, Adding export back-ends, Hacking 18036@node Context-sensitive commands
17112@section Context-sensitive commands 18037@section Context-sensitive commands
17113@cindex context-sensitive commands, hooks 18038@cindex context-sensitive commands, hooks
17114@cindex add-ons, context-sensitive commands 18039@cindex add-ons, context-sensitive commands
17115@vindex org-ctrl-c-ctrl-c-hook 18040@vindex org-ctrl-c-ctrl-c-hook
17116 18041
17117Org has several commands that act differently depending on context. The most 18042Org has facilities for building context sensitive commands. Authors of Org
17118important example is the @kbd{C-c C-c} (@pxref{The very busy C-c C-c key}). 18043add-ons can tap into this functionality.
17119Also the @kbd{M-cursor} and @kbd{M-S-cursor} keys have this property.
17120 18044
17121Add-ons can tap into this functionality by providing a function that detects 18045Some Org commands change depending on the context. The most important
17122special context for that add-on and executes functionality appropriate for 18046example of this behavior is the @kbd{C-c C-c} (@pxref{The very busy C-c C-c
17123the context. Here is an example from Dan Davison's @file{org-R.el} which 18047key}). Other examples are @kbd{M-cursor} and @kbd{M-S-cursor}.
17124allows you to evaluate commands based on the @file{R} programming language
17125@footnote{@file{org-R.el} has been replaced by the Org mode functionality
17126described in @ref{Working With Source Code} and is now obsolete.}. For this
17127package, special contexts are lines that start with @code{#+R:} or
17128@code{#+RR:}.
17129
17130@lisp
17131(defun org-R-apply-maybe ()
17132 "Detect if this is context for org-R and execute R commands."
17133 (if (save-excursion
17134 (beginning-of-line 1)
17135 (looking-at "#\\+RR?:"))
17136 (progn (call-interactively 'org-R-apply)
17137 t) ;; to signal that we took action
17138 nil)) ;; to signal that we did not
17139
17140(add-hook 'org-ctrl-c-ctrl-c-hook 'org-R-apply-maybe)
17141@end lisp
17142
17143The function first checks if the cursor is in such a line. If that is the
17144case, @code{org-R-apply} is called and the function returns @code{t} to
17145signal that action was taken, and @kbd{C-c C-c} will stop looking for other
17146contexts. If the function finds it should do nothing locally, it returns
17147@code{nil} so that other, similar functions can have a try.
17148 18048
18049These context sensitive commands work by providing a function that detects
18050special context for that add-on and executes functionality appropriate for
18051that context.
17149 18052
17150@node Tables in arbitrary syntax, Dynamic blocks, Context-sensitive commands, Hacking 18053@node Tables in arbitrary syntax
17151@section Tables and lists in arbitrary syntax 18054@section Tables and lists in arbitrary syntax
17152@cindex tables, in other modes 18055@cindex tables, in other modes
17153@cindex lists, in other modes 18056@cindex lists, in other modes
17154@cindex Orgtbl mode 18057@cindex Orgtbl mode
17155 18058
17156Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a 18059Because of Org's success in handling tables with Orgtbl, a frequently asked
17157frequent feature request has been to make it work with native tables in 18060feature is to Org's usability functions to other table formats native to
17158specific languages, for example @LaTeX{}. However, this is extremely 18061other modem's, such as @LaTeX{}. This would be hard to do in a general way
17159hard to do in a general way, would lead to a customization nightmare, 18062without complicated customization nightmares. Moreover, that would take Org
17160and would take away much of the simplicity of the Orgtbl mode table 18063away from its simplicity roots that Orgtbl has proven. There is, however, an
17161editor. 18064alternate approach to accomplishing the same.
17162 18065
17163This appendix describes a different approach. We keep the Orgtbl mode 18066This approach involves implementing a custom @emph{translate} function that
17164table in its native format (the @i{source table}), and use a custom 18067operates on a native Org @emph{source table} to produce a table in another
17165function to @i{translate} the table to the correct syntax, and to 18068format. This strategy would keep the excellently working Orgtbl simple and
17166@i{install} it in the right location (the @i{target table}). This puts 18069isolate complications, if any, confined to the translate function. To add
17167the burden of writing conversion functions on the user, but it allows 18070more alien table formats, we just add more translate functions. Also the
17168for a very flexible system. 18071burden of developing custom translate functions for new table formats will be
17169 18072in the hands of those who know those formats best.
17170Bastien added the ability to do the same with lists, in Orgstruct mode. You 18073
17171can use Org's facilities to edit and structure lists by turning 18074For an example of how this strategy works, see Orgstruct mode. In that mode,
17172@code{orgstruct-mode} on, then locally exporting such lists in another format 18075Bastien added the ability to use Org's facilities to edit and re-structure
17173(HTML, @LaTeX{} or Texinfo.) 18076lists. He did by turning @code{orgstruct-mode} on, and then exporting the
17174 18077list locally to another format, such as HTML, @LaTeX{} or Texinfo.
17175 18078
17176@menu 18079@menu
17177* Radio tables:: Sending and receiving radio tables 18080* Radio tables:: Sending and receiving radio tables
@@ -17180,15 +18083,17 @@ can use Org's facilities to edit and structure lists by turning
17180* Radio lists:: Sending and receiving lists 18083* Radio lists:: Sending and receiving lists
17181@end menu 18084@end menu
17182 18085
17183@node Radio tables, A @LaTeX{} example, Tables in arbitrary syntax, Tables in arbitrary syntax 18086@node Radio tables
17184@subsection Radio tables 18087@subsection Radio tables
17185@cindex radio tables 18088@cindex radio tables
17186 18089
17187To define the location of the target table, you first need to create two 18090Radio tables are target locations for translated tables that are not near
17188lines that are comments in the current mode, but contain magic words 18091their source. Org finds the target location and inserts the translated
17189@code{BEGIN/END RECEIVE ORGTBL} for Orgtbl mode to find. Orgtbl mode will 18092table.
17190insert the translated table between these lines, replacing whatever was there 18093
17191before. For example in C mode where comments are between @code{/* ... */}: 18094The key to finding the target location are the magic words @code{BEGIN/END
18095RECEIVE ORGTBL}. They have to appear as comments in the current mode. If
18096the mode is C, then:
17192 18097
17193@example 18098@example
17194/* BEGIN RECEIVE ORGTBL table_name */ 18099/* BEGIN RECEIVE ORGTBL table_name */
@@ -17196,8 +18101,8 @@ before. For example in C mode where comments are between @code{/* ... */}:
17196@end example 18101@end example
17197 18102
17198@noindent 18103@noindent
17199Just above the source table, we put a special line that tells 18104At the location of source, Org needs a special line to direct Orgtbl to
17200Orgtbl mode how to translate this table and where to install it. For 18105translate and to find the target for inserting the translated table. For
17201example: 18106example:
17202@cindex #+ORGTBL 18107@cindex #+ORGTBL
17203@example 18108@example
@@ -17205,67 +18110,53 @@ example:
17205@end example 18110@end example
17206 18111
17207@noindent 18112@noindent
17208@code{table_name} is the reference name for the table that is also used 18113@code{table_name} is the table's reference name, which is also used in the
17209in the receiver lines. @code{translation_function} is the Lisp function 18114receiver lines, and the @code{translation_function} is the Lisp function that
17210that does the translation. Furthermore, the line can contain a list of 18115translates. This line, in addition, may also contain alternating key and
17211arguments (alternating key and value) at the end. The arguments will be 18116value arguments at the end. The translation function gets these values as a
17212passed as a property list to the translation function for 18117property list. A few standard parameters are already recognized and acted
17213interpretation. A few standard parameters are already recognized and 18118upon before the translation function is called:
17214acted upon before the translation function is called:
17215 18119
17216@table @code 18120@table @code
17217@item :skip N 18121@item :skip N
17218Skip the first N lines of the table. Hlines do count as separate lines for 18122Skip the first N lines of the table. Hlines do count; include them if they
17219this parameter! 18123are to be skipped.
17220 18124
17221@item :skipcols (n1 n2 ...) 18125@item :skipcols (n1 n2 ...)
17222List of columns that should be skipped. If the table has a column with 18126List of columns to be skipped. First Org automatically discards columns with
17223calculation marks, that column is automatically discarded as well. 18127calculation marks and then sends the table to the translator function, which
17224Please note that the translator function sees the table @emph{after} the 18128then skips columns as specified in @samp{skipcols}.
17225removal of these columns, the function never knows that there have been
17226additional columns.
17227
17228@item :no-escape t
17229When non-@code{nil}, do not escape special characters @code{&%#_^} when exporting
17230the table. The default value is @code{nil}.
17231@end table 18129@end table
17232 18130
17233@noindent 18131@noindent
17234The one problem remaining is how to keep the source table in the buffer 18132To keep the source table intact in the buffer without being disturbed when
17235without disturbing the normal workings of the file, for example during 18133the source file is compiled or otherwise being worked on, use one of these
17236compilation of a C file or processing of a @LaTeX{} file. There are a 18134strategies:
17237number of different solutions:
17238 18135
17239@itemize @bullet 18136@itemize @bullet
17240@item 18137@item
17241The table could be placed in a block comment if that is supported by the 18138Place the table in a block comment. For example, in C mode you could wrap
17242language. For example, in C mode you could wrap the table between 18139the table between @samp{/*} and @samp{*/} lines.
17243@samp{/*} and @samp{*/} lines.
17244@item 18140@item
17245Sometimes it is possible to put the table after some kind of @i{END} 18141Put the table after an @samp{END} statement. For example @samp{\bye} in
17246statement, for example @samp{\bye} in @TeX{} and @samp{\end@{document@}} 18142@TeX{} and @samp{\end@{document@}} in @LaTeX{}.
17247in @LaTeX{}.
17248@item 18143@item
17249You can just comment the table line-by-line whenever you want to process 18144Comment and uncomment each line of the table during edits. The @kbd{M-x
17250the file, and uncomment it whenever you need to edit the table. This 18145orgtbl-toggle-comment RET} command makes toggling easy.
17251only sounds tedious---the command @kbd{M-x orgtbl-toggle-comment RET}
17252makes this comment-toggling very easy, in particular if you bind it to a
17253key.
17254@end itemize 18146@end itemize
17255 18147
17256@node A @LaTeX{} example, Translator functions, Radio tables, Tables in arbitrary syntax 18148@node A @LaTeX{} example
17257@subsection A @LaTeX{} example of radio tables 18149@subsection A @LaTeX{} example of radio tables
17258@cindex @LaTeX{}, and Orgtbl mode 18150@cindex @LaTeX{}, and Orgtbl mode
17259 18151
17260The best way to wrap the source table in @LaTeX{} is to use the 18152To wrap a source table in @LaTeX{}, use the @code{comment} environment
17261@code{comment} environment provided by @file{comment.sty}. It has to be 18153provided by @file{comment.sty}. To activate it, put
17262activated by placing @code{\usepackage@{comment@}} into the document 18154@code{\usepackage@{comment@}} in the document header. Orgtbl mode inserts a
17263header. Orgtbl mode can insert a radio table skeleton@footnote{By 18155radio table skeleton@footnote{By default this works only for @LaTeX{}, HTML,
17264default this works only for @LaTeX{}, HTML, and Texinfo. Configure the 18156and Texinfo. Configure the variable @code{orgtbl-radio-table-templates} to
17265variable @code{orgtbl-radio-table-templates} to install templates for other 18157install templates for other export formats.} with the command @kbd{M-x
17266modes.} with the command @kbd{M-x orgtbl-insert-radio-table RET}. You will 18158orgtbl-insert-radio-table RET}, which prompts for a table name. For example,
17267be prompted for a table name, let's say we use @samp{salesfigures}. You 18159if @samp{salesfigures} is the name, the template inserts:
17268will then get the following template:
17269 18160
17270@cindex #+ORGTBL, SEND 18161@cindex #+ORGTBL, SEND
17271@example 18162@example
@@ -17279,17 +18170,17 @@ will then get the following template:
17279 18170
17280@noindent 18171@noindent
17281@vindex @LaTeX{}-verbatim-environments 18172@vindex @LaTeX{}-verbatim-environments
17282The @code{#+ORGTBL: SEND} line tells Orgtbl mode to use the function 18173The line @code{#+ORGTBL: SEND} tells Orgtbl mode to use the function
17283@code{orgtbl-to-latex} to convert the table into @LaTeX{} and to put it 18174@code{orgtbl-to-latex} to convert the table to @LaTeX{} format, then insert
17284into the receiver location with name @code{salesfigures}. You may now 18175the table at the target (receive) location named @code{salesfigures}. Now
17285fill in the table---feel free to use the spreadsheet features@footnote{If 18176the table is ready for data entry. It can even use spreadsheet
17286the @samp{#+TBLFM} line contains an odd number of dollar characters, 18177features@footnote{If the @samp{#+TBLFM} line contains an odd number of dollar
17287this may cause problems with font-lock in @LaTeX{} mode. As shown in the 18178characters, this may cause problems with font-lock in @LaTeX{} mode. As
17288example you can fix this by adding an extra line inside the 18179shown in the example you can fix this by adding an extra line inside the
17289@code{comment} environment that is used to balance the dollar 18180@code{comment} environment that is used to balance the dollar expressions.
17290expressions. If you are using AUC@TeX{} with the font-latex library, a 18181If you are using AUC@TeX{} with the font-latex library, a much better
17291much better solution is to add the @code{comment} environment to the 18182solution is to add the @code{comment} environment to the variable
17292variable @code{LaTeX-verbatim-environments}.}: 18183@code{LaTeX-verbatim-environments}.}:
17293 18184
17294@example 18185@example
17295% BEGIN RECEIVE ORGTBL salesfigures 18186% BEGIN RECEIVE ORGTBL salesfigures
@@ -17307,14 +18198,12 @@ variable @code{LaTeX-verbatim-environments}.}:
17307@end example 18198@end example
17308 18199
17309@noindent 18200@noindent
17310When you are done, press @kbd{C-c C-c} in the table to get the converted 18201After editing, @kbd{C-c C-c} inserts translated table at the target location,
17311table inserted between the two marker lines. 18202between the two marker lines.
17312 18203
17313Now let's assume you want to make the table header by hand, because you 18204For hand-made custom tables, note that the translator needs to skip the first
17314want to control how columns are aligned, etc. In this case we make sure 18205two lines of the source table. Also the command has to @emph{splice} out the
17315that the table translator skips the first 2 lines of the source 18206target table without the header and footer.
17316table, and tell the command to work as a @i{splice}, i.e., to not produce
17317header and footer commands of the target table:
17318 18207
17319@example 18208@example
17320\begin@{tabular@}@{lrrr@} 18209\begin@{tabular@}@{lrrr@}
@@ -17335,135 +18224,109 @@ Month & \multicolumn@{1@}@{c@}@{Days@} & Nr.\ sold & per day\\
17335@end example 18224@end example
17336 18225
17337The @LaTeX{} translator function @code{orgtbl-to-latex} is already part of 18226The @LaTeX{} translator function @code{orgtbl-to-latex} is already part of
17338Orgtbl mode. It uses a @code{tabular} environment to typeset the table 18227Orgtbl mode and uses @code{tabular} environment by default to typeset the
17339and marks horizontal lines with @code{\hline}. Furthermore, it 18228table and mark the horizontal lines with @code{\hline}. For additional
17340interprets the following parameters (see also @pxref{Translator functions}): 18229parameters to control output, @pxref{Translator functions}:
17341 18230
17342@table @code 18231@table @code
17343@item :splice nil/t 18232@item :splice nil/t
17344When set to t, return only table body lines, don't wrap them into a 18233When non-@code{nil}, returns only table body lines; not wrapped in tabular
17345tabular environment. Default is @code{nil}. 18234environment. Default is @code{nil}.
17346 18235
17347@item :fmt fmt 18236@item :fmt fmt
17348A format to be used to wrap each field, it should contain @code{%s} for the 18237Format to warp each field. It should contain @code{%s} for the original
17349original field value. For example, to wrap each field value in dollars, 18238field value. For example, to wrap each field value in dollar symbol, you
17350you could use @code{:fmt "$%s$"}. This may also be a property list with 18239could use @code{:fmt "$%s$"}. Format can also wrap a property list with
17351column numbers and formats, for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}. 18240column numbers and formats, for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}.
17352A function of one argument can be used in place of the strings; the 18241In place of a string, a function of one argument can be used; the function
17353function must return a formatted string. 18242must return a formatted string.
17354 18243
17355@item :efmt efmt 18244@item :efmt efmt
17356Use this format to print numbers with exponentials. The format should 18245Format numbers as exponentials. The spec should have @code{%s} twice for
17357have @code{%s} twice for inserting mantissa and exponent, for example 18246inserting mantissa and exponent, for example @code{"%s\\times10^@{%s@}"}.
17358@code{"%s\\times10^@{%s@}"}. The default is @code{"%s\\,(%s)"}. This 18247This may also be a property list with column numbers and formats, for example
17359may also be a property list with column numbers and formats, for example
17360@code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After 18248@code{:efmt (2 "$%s\\times10^@{%s@}$" 4 "$%s\\cdot10^@{%s@}$")}. After
17361@code{efmt} has been applied to a value, @code{fmt} will also be 18249@code{efmt} has been applied to a value, @code{fmt} will also be applied.
17362applied. Similar to @code{fmt}, functions of two arguments can be 18250Functions with two arguments can be supplied instead of strings. By default,
17363supplied instead of strings. 18251no special formatting is applied.
17364@end table 18252@end table
17365 18253
17366@node Translator functions, Radio lists, A @LaTeX{} example, Tables in arbitrary syntax 18254@node Translator functions
17367@subsection Translator functions 18255@subsection Translator functions
17368@cindex HTML, and Orgtbl mode 18256@cindex HTML, and Orgtbl mode
17369@cindex translator function 18257@cindex translator function
17370 18258
17371Orgtbl mode has several translator functions built-in: @code{orgtbl-to-csv} 18259Orgtbl mode has built-in translator functions: @code{orgtbl-to-csv}
17372(comma-separated values), @code{orgtbl-to-tsv} (TAB-separated values) 18260(comma-separated values), @code{orgtbl-to-tsv} (TAB-separated values),
17373@code{orgtbl-to-latex}, @code{orgtbl-to-html}, and @code{orgtbl-to-texinfo}. 18261@code{orgtbl-to-latex}, @code{orgtbl-to-html}, @code{orgtbl-to-texinfo},
17374Except for @code{orgtbl-to-html}@footnote{The HTML translator uses the same 18262@code{orgtbl-to-unicode} and @code{orgtbl-to-orgtbl}. They use the generic
17375code that produces tables during HTML export.}, these all use a generic 18263translator, @code{orgtbl-to-generic}, which delegates translations to various
17376translator, @code{orgtbl-to-generic}. For example, @code{orgtbl-to-latex} 18264export back-ends.
17377itself is a very short function that computes the column definitions for the
17378@code{tabular} environment, defines a few field and line separators and then
17379hands processing over to the generic translator. Here is the entire code:
17380 18265
17381@lisp 18266Properties passed to the function through the @samp{ORGTBL SEND} line take
17382@group 18267precedence over properties defined inside the function. For example, this
17383(defun orgtbl-to-latex (table params) 18268overrides the default @LaTeX{} line endings, @samp{\\}, with @samp{\\[2mm]}:
17384 "Convert the Orgtbl mode TABLE to LaTeX."
17385 (let* ((alignment (mapconcat (lambda (x) (if x "r" "l"))
17386 org-table-last-alignment ""))
17387 (params2
17388 (list
17389 :tstart (concat "\\begin@{tabular@}@{" alignment "@}")
17390 :tend "\\end@{tabular@}"
17391 :lstart "" :lend " \\\\" :sep " & "
17392 :efmt "%s\\,(%s)" :hline "\\hline")))
17393 (orgtbl-to-generic table (org-combine-plists params2 params))))
17394@end group
17395@end lisp
17396
17397As you can see, the properties passed into the function (variable
17398@var{PARAMS}) are combined with the ones newly defined in the function
17399(variable @var{PARAMS2}). The ones passed into the function (i.e., the
17400ones set by the @samp{ORGTBL SEND} line) take precedence. So if you
17401would like to use the @LaTeX{} translator, but wanted the line endings to
17402be @samp{\\[2mm]} instead of the default @samp{\\}, you could just
17403overrule the default with
17404 18269
17405@example 18270@example
17406#+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]" 18271#+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]"
17407@end example 18272@end example
17408 18273
17409For a new language, you can either write your own converter function in 18274For a new language translator, define a converter function. It can be a
17410analogy with the @LaTeX{} translator, or you can use the generic function 18275generic function, such as shown in this example. It marks a beginning and
17411directly. For example, if you have a language where a table is started 18276ending of a table with @samp{!BTBL!} and @samp{!ETBL!}; a beginning and
17412with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are 18277ending of lines with @samp{!BL!} and @samp{!EL!}; and uses a TAB for a field
17413started with @samp{!BL!}, ended with @samp{!EL!}, and where the field 18278separator:
17414separator is a TAB, you could call the generic translator like this (on
17415a single line!):
17416 18279
17417@example 18280@lisp
17418#+ORGTBL: SEND test orgtbl-to-generic :tstart "!BTBL!" :tend "!ETBL!" 18281(defun orgtbl-to-language (table params)
17419 :lstart "!BL! " :lend " !EL!" :sep "\t" 18282 "Convert the orgtbl-mode TABLE to language."
17420@end example 18283 (orgtbl-to-generic
18284 table
18285 (org-combine-plists
18286 '(:tstart "!BTBL!" :tend "!ETBL!" :lstart "!BL!" :lend "!EL!" :sep "\t")
18287 params)))
18288@end lisp
17421 18289
17422@noindent 18290@noindent
17423Please check the documentation string of the function 18291The documentation for the @code{orgtbl-to-generic} function shows a complete
17424@code{orgtbl-to-generic} for a full list of parameters understood by 18292list of parameters, each of which can be passed through to
17425that function, and remember that you can pass each of them into
17426@code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function 18293@code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function
17427using the generic function. 18294using that generic function.
17428 18295
17429Of course you can also write a completely new function doing complicated 18296For complicated translations the generic translator function could be
17430things the generic translator cannot do. A translator function takes 18297replaced by a custom translator function. Such a custom function must take
17431two arguments. The first argument is the table, a list of lines, each 18298two arguments and return a single string containing the formatted table. The
17432line either the symbol @code{hline} or a list of fields. The second 18299first argument is the table whose lines are a list of fields or the symbol
17433argument is the property list containing all parameters specified in the 18300@code{hline}. The second argument is the property list consisting of
17434@samp{#+ORGTBL: SEND} line. The function must return a single string 18301parameters specified in the @samp{#+ORGTBL: SEND} line. Please share your
17435containing the formatted table. If you write a generally useful 18302translator functions by posting them to the Org users mailing list,
17436translator, please post it on @email{emacs-orgmode@@gnu.org} so that 18303@email{emacs-orgmode@@gnu.org}.
17437others can benefit from your work. 18304
17438 18305@node Radio lists
17439@node Radio lists, , Translator functions, Tables in arbitrary syntax
17440@subsection Radio lists 18306@subsection Radio lists
17441@cindex radio lists 18307@cindex radio lists
17442@cindex org-list-insert-radio-list 18308@cindex org-list-insert-radio-list
17443 18309
17444Sending and receiving radio lists works exactly the same way as sending and 18310Call the @code{org-list-insert-radio-list} function to insert a radio list
17445receiving radio tables (@pxref{Radio tables}). As for radio tables, you can 18311template in HTML, @LaTeX{}, and Texinfo mode documents. Sending and
17446insert radio list templates in HTML, @LaTeX{} and Texinfo modes by calling 18312receiving radio lists works is the same as for radio tables (@pxref{Radio
17447@code{org-list-insert-radio-list}. 18313tables}) except for these differences:
17448
17449Here are the differences with radio tables:
17450 18314
18315@cindex #+ORGLST
17451@itemize @minus 18316@itemize @minus
17452@item 18317@item
17453Orgstruct mode must be active. 18318Orgstruct mode must be active.
17454@item 18319@item
17455Use the @code{ORGLST} keyword instead of @code{ORGTBL}. 18320Use @code{ORGLST} keyword instead of @code{ORGTBL}.
17456@item 18321@item
17457The available translation functions for radio lists don't take 18322@kbd{C-c C-c} works only on the first list item.
17458parameters.
17459@item
17460@kbd{C-c C-c} will work when pressed on the first item of the list.
17461@end itemize 18323@end itemize
17462 18324
17463Here is a @LaTeX{} example. Let's say that you have this in your 18325Built-in translators functions are: @code{org-list-to-latex},
17464@LaTeX{} file: 18326@code{org-list-to-html} and @code{org-list-to-texinfo}. They use the
18327@code{org-list-to-generic} translator function. See its documentation for
18328parameters for accurate customizations of lists. Here is a @LaTeX{} example:
17465 18329
17466@cindex #+ORGLST
17467@example 18330@example
17468% BEGIN RECEIVE ORGLST to-buy 18331% BEGIN RECEIVE ORGLST to-buy
17469% END RECEIVE ORGLST to-buy 18332% END RECEIVE ORGLST to-buy
@@ -17477,21 +18340,21 @@ Here is a @LaTeX{} example. Let's say that you have this in your
17477\end@{comment@} 18340\end@{comment@}
17478@end example 18341@end example
17479 18342
17480Pressing @kbd{C-c C-c} on @code{a new house} and will insert the converted 18343@kbd{C-c C-c} on @samp{a new house} inserts the translated @LaTeX{} list
17481@LaTeX{} list between the two marker lines. 18344in-between the BEGIN and END marker lines.
17482 18345
17483@node Dynamic blocks, Special agenda views, Tables in arbitrary syntax, Hacking 18346@node Dynamic blocks
17484@section Dynamic blocks 18347@section Dynamic blocks
17485@cindex dynamic blocks 18348@cindex dynamic blocks
17486 18349
17487Org documents can contain @emph{dynamic blocks}. These are 18350Org supports @emph{dynamic blocks} in Org documents. They are inserted with
17488specially marked regions that are updated by some user-written function. 18351begin and end markers like any other @samp{src} code block, but the contents
17489A good example for such a block is the clock table inserted by the 18352are updated automatically by a user function. For example, @kbd{C-c C-x C-r}
17490command @kbd{C-c C-x C-r} (@pxref{Clocking work time}). 18353inserts a dynamic table that updates the work time (@pxref{Clocking work
18354time}).
17491 18355
17492Dynamic blocks are enclosed by a BEGIN-END structure that assigns a name 18356Dynamic blocks can have names and function parameters. The syntax is similar
17493to the block and can also specify parameters for the function producing 18357to @samp{src} code block specifications:
17494the content of the block.
17495 18358
17496@cindex #+BEGIN:dynamic block 18359@cindex #+BEGIN:dynamic block
17497@example 18360@example
@@ -17500,7 +18363,7 @@ the content of the block.
17500#+END: 18363#+END:
17501@end example 18364@end example
17502 18365
17503Dynamic blocks are updated with the following commands 18366These command update dynamic blocks:
17504 18367
17505@table @kbd 18368@table @kbd
17506@orgcmd{C-c C-x C-u,org-dblock-update} 18369@orgcmd{C-c C-x C-u,org-dblock-update}
@@ -17509,17 +18372,16 @@ Update dynamic block at point.
17509Update all dynamic blocks in the current file. 18372Update all dynamic blocks in the current file.
17510@end table 18373@end table
17511 18374
17512Updating a dynamic block means to remove all the text between BEGIN and 18375Before updating a dynamic block, Org removes content between the BEGIN and
17513END, parse the BEGIN line for parameters and then call the specific 18376END markers. Org then reads the parameters on the BEGIN line for passing to
17514writer function for this block to insert the new content. If you want 18377the writer function. If the function expects to access the removed content,
17515to use the original content in the writer function, you can use the 18378then Org expects an extra parameter, @code{:content}, on the BEGIN line.
17516extra parameter @code{:content}.
17517 18379
17518For a block with name @code{myblock}, the writer function is 18380To syntax for calling a writer function with a named block, @code{myblock}
17519@code{org-dblock-write:myblock} with as only parameter a property list 18381is: @code{org-dblock-write:myblock}. Parameters come from the BEGIN line.
17520with the parameters given in the begin line. Here is a trivial example 18382
17521of a block that keeps track of when the block update function was last 18383The following is an example of a dynamic block and a block writer function
17522run: 18384that updates the time when the function was last run:
17523 18385
17524@example 18386@example
17525#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M" 18387#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
@@ -17528,7 +18390,7 @@ run:
17528@end example 18390@end example
17529 18391
17530@noindent 18392@noindent
17531The corresponding block writer function could look like this: 18393The dynamic block's writer function:
17532 18394
17533@lisp 18395@lisp
17534(defun org-dblock-write:block-update-time (params) 18396(defun org-dblock-write:block-update-time (params)
@@ -17537,47 +18399,40 @@ The corresponding block writer function could look like this:
17537 (format-time-string fmt)))) 18399 (format-time-string fmt))))
17538@end lisp 18400@end lisp
17539 18401
17540If you want to make sure that all dynamic blocks are always up-to-date, 18402To keep dynamic blocks up-to-date in an Org file, use the function,
17541you could add the function @code{org-update-all-dblocks} to a hook, for 18403@code{org-update-all-dblocks} in hook, such as @code{before-save-hook}. The
17542example @code{before-save-hook}. @code{org-update-all-dblocks} is 18404@code{org-update-all-dblocks} function does not run if the file is not in
17543written in a way such that it does nothing in buffers that are not in 18405Org mode.
17544@code{org-mode}.
17545 18406
17546You can narrow the current buffer to the current dynamic block (like any 18407Dynamic blocks, like any other block, can be narrowed with
17547other block) with @code{org-narrow-to-block}. 18408@code{org-narrow-to-block}.
17548 18409
17549@node Special agenda views, Speeding up your agendas, Dynamic blocks, Hacking 18410@node Special agenda views
17550@section Special agenda views 18411@section Special agenda views
17551@cindex agenda views, user-defined 18412@cindex agenda views, user-defined
17552 18413
17553@vindex org-agenda-skip-function 18414@vindex org-agenda-skip-function
17554@vindex org-agenda-skip-function-global 18415@vindex org-agenda-skip-function-global
17555Org provides a special hook that can be used to narrow down the selection 18416Org provides a special hook to further limit items in agenda views:
17556made by these agenda views: @code{agenda}, @code{agenda*}@footnote{The 18417@code{agenda}, @code{agenda*}@footnote{The @code{agenda*} view is the same as
17557@code{agenda*} view is the same than @code{agenda} except that it only 18418@code{agenda} except that it only considers @emph{appointments}, i.e.,
17558considers @emph{appointments}, i.e., scheduled and deadline items that have a 18419scheduled and deadline items that have a time specification @samp{[h]h:mm} in
17559time specification @code{[h]h:mm} in their time-stamps.}, @code{todo}, 18420their time-stamps.}, @code{todo}, @code{alltodo}, @code{tags},
17560@code{alltodo}, @code{tags}, @code{tags-todo}, @code{tags-tree}. You may 18421@code{tags-todo}, @code{tags-tree}. Specify a custom function that tests
17561specify a function that is used at each match to verify if the match should 18422inclusion of every matched item in the view. This function can also
17562indeed be part of the agenda view, and if not, how much should be skipped. 18423skip as much as is needed.
17563You can specify a global condition that will be applied to all agenda views, 18424
17564this condition would be stored in the variable 18425For a global condition applicable to agenda views, use the
17565@code{org-agenda-skip-function-global}. More commonly, such a definition is 18426@code{org-agenda-skip-function-global} variable. Org uses a global condition
17566applied only to specific custom searches, using 18427with @code{org-agenda-skip-function} for custom searching.
17567@code{org-agenda-skip-function}. 18428
17568 18429This example defines a function for a custom view showing TODO items with
17569Let's say you want to produce a list of projects that contain a WAITING 18430WAITING status. Manually this is a multi step search process, but with a
17570tag anywhere in the project tree. Let's further assume that you have 18431custom view, this can be automated as follows:
17571marked all tree headings that define a project with the TODO keyword 18432
17572PROJECT@. In this case you would run a TODO search for the keyword 18433The custom function searches the subtree for the WAITING tag and returns
17573PROJECT, but skip the match unless there is a WAITING tag anywhere in 18434@code{nil} on match. Otherwise it gives the location from where the search
17574the subtree belonging to the project line. 18435continues.
17575
17576To achieve this, you must write a function that searches the subtree for
17577the tag. If the tag is found, the function must return @code{nil} to
17578indicate that this match should not be skipped. If there is no such
17579tag, return the location of the end of the subtree, to indicate that
17580search should continue from there.
17581 18436
17582@lisp 18437@lisp
17583(defun my-skip-unless-waiting () 18438(defun my-skip-unless-waiting ()
@@ -17588,8 +18443,7 @@ search should continue from there.
17588 subtree-end))) ; tag not found, continue after end of subtree 18443 subtree-end))) ; tag not found, continue after end of subtree
17589@end lisp 18444@end lisp
17590 18445
17591Now you may use this function in an agenda custom command, for example 18446To use this custom function in a custom agenda command:
17592like this:
17593 18447
17594@lisp 18448@lisp
17595(org-add-agenda-custom-command 18449(org-add-agenda-custom-command
@@ -17599,22 +18453,20 @@ like this:
17599@end lisp 18453@end lisp
17600 18454
17601@vindex org-agenda-overriding-header 18455@vindex org-agenda-overriding-header
17602Note that this also binds @code{org-agenda-overriding-header} to get a 18456Note that this also binds @code{org-agenda-overriding-header} to a more
17603meaningful header in the agenda view. 18457meaningful string suitable for the agenda view.
17604 18458
17605@vindex org-odd-levels-only 18459@vindex org-odd-levels-only
17606@vindex org-agenda-skip-function 18460@vindex org-agenda-skip-function
17607A general way to create custom searches is to base them on a search for 18461
17608entries with a certain level limit. If you want to study all entries with 18462Search for entries with a limit set on levels for the custom search. This is
17609your custom search function, simply do a search for 18463a general appraoch to creating custom searches in Org. To include all
17610@samp{LEVEL>0}@footnote{Note that, when using @code{org-odd-levels-only}, a 18464levels, use @samp{LEVEL>0}@footnote{Note that, for
17611level number corresponds to order in the hierarchy, not to the number of 18465@code{org-odd-levels-only}, a level number corresponds to order in the
17612stars.}, and then use @code{org-agenda-skip-function} to select the entries 18466hierarchy, not to the number of stars.}. Then to selectively pick the
17613you really want to have. 18467matched entries, use @code{org-agenda-skip-function}, which also accepts Lisp
17614 18468forms, such as @code{org-agenda-skip-entry-if} and
17615You may also put a Lisp form into @code{org-agenda-skip-function}. In 18469@code{org-agenda-skip-subtree-if}. For example:
17616particular, you may use the functions @code{org-agenda-skip-entry-if}
17617and @code{org-agenda-skip-subtree-if} in this form, for example:
17618 18470
17619@table @code 18471@table @code
17620@item (org-agenda-skip-entry-if 'scheduled) 18472@item (org-agenda-skip-entry-if 'scheduled)
@@ -17640,8 +18492,8 @@ Skip current entry unless the regular expression matches.
17640Same as above, but check and skip the entire subtree. 18492Same as above, but check and skip the entire subtree.
17641@end table 18493@end table
17642 18494
17643Therefore we could also have written the search for WAITING projects 18495The following is an example of a search for @samp{WAITING} without the
17644like this, even without defining a special function: 18496special function:
17645 18497
17646@lisp 18498@lisp
17647(org-add-agenda-custom-command 18499(org-add-agenda-custom-command
@@ -17651,72 +18503,71 @@ like this, even without defining a special function:
17651 (org-agenda-overriding-header "Projects waiting for something: ")))) 18503 (org-agenda-overriding-header "Projects waiting for something: "))))
17652@end lisp 18504@end lisp
17653 18505
17654@node Speeding up your agendas, Extracting agenda information, Special agenda views, Hacking 18506@node Speeding up your agendas
17655@section Speeding up your agendas 18507@section Speeding up your agendas
17656@cindex agenda views, optimization 18508@cindex agenda views, optimization
17657 18509
17658When your Org files grow in both number and size, agenda commands may start 18510Some agenda commands slow down when the Org files grow in size or number.
17659to become slow. Below are some tips on how to speed up the agenda commands. 18511Here are tips to speed up:
17660 18512
17661@enumerate 18513@enumerate
17662@item 18514@item
17663Reduce the number of Org agenda files: this will reduce the slowness caused 18515Reduce the number of Org agenda files to avoid slowdowns due to hard drive
17664by accessing a hard drive. 18516accesses.
17665@item 18517@item
17666Reduce the number of DONE and archived headlines: this way the agenda does 18518Reduce the number of @samp{DONE} and archived headlines so agenda operations
17667not need to skip them. 18519that skip over these can finish faster.
17668@item 18520@item
17669@vindex org-agenda-dim-blocked-tasks 18521@vindex org-agenda-dim-blocked-tasks
17670Inhibit the dimming of blocked tasks: 18522Do not dim blocked tasks:
17671@lisp 18523@lisp
17672(setq org-agenda-dim-blocked-tasks nil) 18524(setq org-agenda-dim-blocked-tasks nil)
17673@end lisp 18525@end lisp
17674@item 18526@item
17675@vindex org-startup-folded 18527@vindex org-startup-folded
17676@vindex org-agenda-inhibit-startup 18528@vindex org-agenda-inhibit-startup
17677Inhibit agenda files startup options: 18529Stop preparing agenda buffers on startup:
17678@lisp 18530@lisp
17679(setq org-agenda-inhibit-startup nil) 18531(setq org-agenda-inhibit-startup nil)
17680@end lisp 18532@end lisp
17681@item 18533@item
17682@vindex org-agenda-show-inherited-tags 18534@vindex org-agenda-show-inherited-tags
17683@vindex org-agenda-use-tag-inheritance 18535@vindex org-agenda-use-tag-inheritance
17684Disable tag inheritance in agenda: 18536Disable tag inheritance for agendas:
17685@lisp 18537@lisp
17686(setq org-agenda-use-tag-inheritance nil) 18538(setq org-agenda-use-tag-inheritance nil)
17687@end lisp 18539@end lisp
17688@end enumerate 18540@end enumerate
17689 18541
17690You can set these options for specific agenda views only. See the docstrings 18542These options can be applied to selected agenda views. For more details
17691of these variables for details on why they affect the agenda generation, and 18543about generation of agenda views, see the docstrings for the relevant
17692this @uref{http://orgmode.org/worg/agenda-optimization.html, dedicated Worg 18544variables, and this @uref{http://orgmode.org/worg/agenda-optimization.html,
17693page} for further explanations. 18545dedicated Worg page} for agenda optimization.
17694 18546
17695@node Extracting agenda information, Using the property API, Speeding up your agendas, Hacking 18547@node Extracting agenda information
17696@section Extracting agenda information 18548@section Extracting agenda information
17697@cindex agenda, pipe 18549@cindex agenda, pipe
17698@cindex Scripts, for agenda processing 18550@cindex Scripts, for agenda processing
17699 18551
17700@vindex org-agenda-custom-commands 18552@vindex org-agenda-custom-commands
17701Org provides commands to access agenda information for the command 18553Org provides commands to access agendas through Emacs batch mode. Through
17702line in Emacs batch mode. This extracted information can be sent 18554this command-line interface, agendas are automated for further processing or
17703directly to a printer, or it can be read by a program that does further 18555printing.
17704processing of the data. The first of these commands is the function 18556
17705@code{org-batch-agenda}, that produces an agenda view and sends it as 18557@code{org-batch-agenda} creates an agenda view in ASCII and outputs to
17706ASCII text to STDOUT@. The command takes a single string as parameter. 18558STDOUT. This command takes one string parameter. When string length=1, Org
17707If the string has length 1, it is used as a key to one of the commands 18559uses it as a key to @code{org-agenda-custom-commands}. These are the same
17708you have configured in @code{org-agenda-custom-commands}, basically any 18560ones available through @kbd{C-c a}.
17709key you can use after @kbd{C-c a}. For example, to directly print the 18561
17710current TODO list, you could use 18562This example command line directly prints the TODO list to the printer:
17711 18563
17712@example 18564@example
17713emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr 18565emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr
17714@end example 18566@end example
17715 18567
17716If the parameter is a string with 2 or more characters, it is used as a 18568When the string parameter length is two or more characters, Org matches it
17717tags/TODO match string. For example, to print your local shopping list 18569with tags/TODO strings. For example, this example command line prints items
17718(all items with the tag @samp{shop}, but excluding the tag 18570tagged with @samp{shop}, but excludes items tagged with @samp{NewYork}:
17719@samp{NewYork}), you could use
17720 18571
17721@example 18572@example
17722emacs -batch -l ~/.emacs \ 18573emacs -batch -l ~/.emacs \
@@ -17724,7 +18575,7 @@ emacs -batch -l ~/.emacs \
17724@end example 18575@end example
17725 18576
17726@noindent 18577@noindent
17727You may also modify parameters on the fly like this: 18578An example showing on-the-fly parameter modifications:
17728 18579
17729@example 18580@example
17730emacs -batch -l ~/.emacs \ 18581emacs -batch -l ~/.emacs \
@@ -17736,14 +18587,11 @@ emacs -batch -l ~/.emacs \
17736@end example 18587@end example
17737 18588
17738@noindent 18589@noindent
17739which will produce a 30-day agenda, fully restricted to the Org file 18590which will produce an agenda for the next 30 days from just the
17740@file{~/org/projects.org}, not even including the diary. 18591@file{~/org/projects.org} file.
17741 18592
17742If you want to process the agenda data in more sophisticated ways, you 18593For structured processing of agenda output, use @code{org-batch-agenda-csv}
17743can use the command @code{org-batch-agenda-csv} to get a comma-separated 18594with the following fields:
17744list of values for each agenda item. Each line in the output will
17745contain a number of fields separated by commas. The fields in a line
17746are:
17747 18595
17748@example 18596@example
17749category @r{The category of the item} 18597category @r{The category of the item}
@@ -17769,12 +18617,15 @@ priority-n @r{The computed numerical priority}
17769@end example 18617@end example
17770 18618
17771@noindent 18619@noindent
17772Time and date will only be given if a timestamp (or deadline/scheduled) 18620If the selection of the agenda item was based on a timestamp, including those
17773led to the selection of the item. 18621items with @samp{DEADLINE} and @samp{SCHEDULED} keywords, then Org includes
18622date and time in the output.
17774 18623
17775A CSV list like this is very easy to use in a post-processing script. 18624If the selection of the agenda item was based on a timestamp (or
17776For example, here is a Perl program that gets the TODO list from 18625deadline/scheduled), then Org includes date and time in the output.
17777Emacs/Org and prints all the items, preceded by a checkbox: 18626
18627Here is an example of a post-processing script in Perl. It takes the CSV
18628output from Emacs and prints with a checkbox:
17778 18629
17779@example 18630@example
17780#!/usr/bin/perl 18631#!/usr/bin/perl
@@ -17795,13 +18646,12 @@ foreach $line (split(/\n/,$agenda)) @{
17795@} 18646@}
17796@end example 18647@end example
17797 18648
17798@node Using the property API, Using the mapping API, Extracting agenda information, Hacking 18649@node Using the property API
17799@section Using the property API 18650@section Using the property API
17800@cindex API, for properties 18651@cindex API, for properties
17801@cindex properties, API 18652@cindex properties, API
17802 18653
17803Here is a description of the functions that can be used to work with 18654Functions for working with properties.
17804properties.
17805 18655
17806@defun org-entry-properties &optional pom which 18656@defun org-entry-properties &optional pom which
17807Get all properties of the entry at point-or-marker POM.@* 18657Get all properties of the entry at point-or-marker POM.@*
@@ -17813,14 +18663,15 @@ POM may also be @code{nil}, in which case the current entry is used.
17813If WHICH is @code{nil} or @code{all}, get all properties. If WHICH is 18663If WHICH is @code{nil} or @code{all}, get all properties. If WHICH is
17814@code{special} or @code{standard}, only get that subclass. 18664@code{special} or @code{standard}, only get that subclass.
17815@end defun 18665@end defun
18666
17816@vindex org-use-property-inheritance 18667@vindex org-use-property-inheritance
17817@findex org-insert-property-drawer 18668@findex org-insert-property-drawer
17818@defun org-entry-get pom property &optional inherit 18669@defun org-entry-get pom property &optional inherit
17819Get value of @code{PROPERTY} for entry at point-or-marker @code{POM}@. By default, 18670Get value of @code{PROPERTY} for entry at point-or-marker @code{POM}@. By
17820this only looks at properties defined locally in the entry. If @code{INHERIT} 18671default, this only looks at properties defined locally in the entry. If
17821is non-@code{nil} and the entry does not have the property, then also check 18672@code{INHERIT} is non-@code{nil} and the entry does not have the property,
17822higher levels of the hierarchy. If @code{INHERIT} is the symbol 18673then also check higher levels of the hierarchy. If @code{INHERIT} is the
17823@code{selective}, use inheritance if and only if the setting of 18674symbol @code{selective}, use inheritance if and only if the setting of
17824@code{org-use-property-inheritance} selects @code{PROPERTY} for inheritance. 18675@code{org-use-property-inheritance} selects @code{PROPERTY} for inheritance.
17825@end defun 18676@end defun
17826 18677
@@ -17837,7 +18688,7 @@ Get all property keys in the current buffer.
17837@end defun 18688@end defun
17838 18689
17839@defun org-insert-property-drawer 18690@defun org-insert-property-drawer
17840Insert a property drawer for the current entry. Also 18691Insert a property drawer for the current entry.
17841@end defun 18692@end defun
17842 18693
17843@defun org-entry-put-multivalued-property pom property &rest values 18694@defun org-entry-put-multivalued-property pom property &rest values
@@ -17875,41 +18726,37 @@ to be entered. The functions must return @code{nil} if they are not
17875responsible for this property. 18726responsible for this property.
17876@end defopt 18727@end defopt
17877 18728
17878@node Using the mapping API, , Using the property API, Hacking 18729@node Using the mapping API
17879@section Using the mapping API 18730@section Using the mapping API
17880@cindex API, for mapping 18731@cindex API, for mapping
17881@cindex mapping entries, API 18732@cindex mapping entries, API
17882 18733
17883Org has sophisticated mapping capabilities to find all entries satisfying 18734Org has sophisticated mapping capabilities for finding entries. Org uses
17884certain criteria. Internally, this functionality is used to produce agenda 18735this functionality internally for generating agenda views. Org also exposes
17885views, but there is also an API that can be used to execute arbitrary 18736an API for executing arbitrary functions for each selected entry. The API's
17886functions for each or selected entries. The main entry point for this API 18737main entry point is:
17887is:
17888 18738
17889@defun org-map-entries func &optional match scope &rest skip 18739@defun org-map-entries func &optional match scope &rest skip
17890Call @code{FUNC} at each headline selected by @code{MATCH} in @code{SCOPE}. 18740Call @samp{FUNC} at each headline selected by @code{MATCH} in @code{SCOPE}.
17891 18741
17892@code{FUNC} is a function or a Lisp form. The function will be called 18742@samp{FUNC} is a function or a Lisp form. With the cursor positioned at the
17893without arguments, with the cursor positioned at the beginning of the 18743beginning of the headline, call the function without arguments. Org returns
17894headline. The return values of all calls to the function will be collected 18744an alist of return values of calls to the function.
17895and returned as a list.
17896 18745
17897The call to @code{FUNC} will be wrapped into a save-excursion form, so 18746To avoid preserving point, Org wraps the call to @code{FUNC} in
17898@code{FUNC} does not need to preserve point. After evaluation, the cursor 18747save-excursion form. After evaluation, Org moves the cursor to the end of
17899will be moved to the end of the line (presumably of the headline of the 18748the line that was just processed. Search continues from that point forward.
17900processed entry) and search continues from there. Under some circumstances, 18749This may not always work as expected under some conditions, such as if the
17901this may not produce the wanted results. For example, if you have removed 18750current sub-tree was removed by a previous archiving operation. In such rare
17902(e.g., archived) the current (sub)tree it could mean that the next entry will 18751circumstances, Org skips the next entry entirely when it should not. To stop
17903be skipped entirely. In such cases, you can specify the position from where 18752Org from such skips, make @samp{FUNC} set the variable
17904search should continue by making @code{FUNC} set the variable 18753@code{org-map-continue-from} to a specific buffer position.
17905@code{org-map-continue-from} to the desired buffer position.
17906 18754
17907@code{MATCH} is a tags/property/todo match as it is used in the agenda match 18755@samp{MATCH} is a tags/property/TODO match. Org iterates only matched
17908view. Only headlines that are matched by this query will be considered 18756headlines. Org iterates over all headlines when @code{MATCH} is @code{nil}
17909during the iteration. When @code{MATCH} is @code{nil} or @code{t}, all 18757or @code{t}.
17910headlines will be visited by the iteration.
17911 18758
17912@code{SCOPE} determines the scope of this command. It can be any of: 18759@samp{SCOPE} determines the scope of this command. It can be any of:
17913 18760
17914@example 18761@example
17915nil @r{the current buffer, respecting the restriction if any} 18762nil @r{the current buffer, respecting the restriction if any}
@@ -17925,8 +18772,8 @@ agenda-with-archives
17925 @r{if this is a list, all files in the list will be scanned} 18772 @r{if this is a list, all files in the list will be scanned}
17926@end example 18773@end example
17927@noindent 18774@noindent
17928The remaining args are treated as settings for the skipping facilities of 18775The remaining args are treated as settings for the scanner's skipping
17929the scanner. The following items can be given here: 18776facilities. Valid args are:
17930 18777
17931@vindex org-agenda-skip-function 18778@vindex org-agenda-skip-function
17932@example 18779@example
@@ -17940,10 +18787,9 @@ function or Lisp form
17940@end example 18787@end example
17941@end defun 18788@end defun
17942 18789
17943The function given to that mapping routine can really do anything you like. 18790The mapping routine can call any arbitrary function, even functions that
17944It can use the property API (@pxref{Using the property API}) to gather more 18791change meta data or query the property API (@pxref{Using the property API}).
17945information about the entry, or in order to change metadata in the entry. 18792Here are some handy functions:
17946Here are a couple of functions that might be handy:
17947 18793
17948@defun org-todo &optional arg 18794@defun org-todo &optional arg
17949Change the TODO state of the entry. See the docstring of the functions for 18795Change the TODO state of the entry. See the docstring of the functions for
@@ -17969,9 +18815,9 @@ Promote the current entry.
17969Demote the current entry. 18815Demote the current entry.
17970@end defun 18816@end defun
17971 18817
17972Here is a simple example that will turn all entries in the current file with 18818This example turns all entries tagged with @code{TOMORROW} into TODO entries
17973a tag @code{TOMORROW} into TODO entries with the keyword @code{UPCOMING}. 18819with keyword @code{UPCOMING}. Org ignores entries in comment trees and
17974Entries in comment trees and in archive trees will be ignored. 18820archive trees.
17975 18821
17976@lisp 18822@lisp
17977(org-map-entries 18823(org-map-entries
@@ -17986,105 +18832,103 @@ The following example counts the number of entries with TODO keyword
17986(length (org-map-entries t "/+WAITING" 'agenda)) 18832(length (org-map-entries t "/+WAITING" 'agenda))
17987@end lisp 18833@end lisp
17988 18834
17989@node MobileOrg, History and Acknowledgments, Hacking, Top 18835@node MobileOrg
17990@appendix MobileOrg 18836@appendix MobileOrg
17991@cindex iPhone 18837@cindex iPhone
17992@cindex MobileOrg 18838@cindex MobileOrg
17993 18839
17994@i{MobileOrg} is the name of the mobile companion app for Org mode, currently 18840MobileOrg is a companion mobile app that runs on iOS and Android devices.
17995available for iOS and for Android. @i{MobileOrg} offers offline viewing and 18841MobileOrg enables offline-views and capture support for an Org mode system
17996capture support for an Org mode system rooted on a ``real'' computer. It 18842that is rooted on a ``real'' computer. MobileOrg can record changes to
17997does also allow you to record changes to existing entries. The 18843existing entries.
17998@uref{https://github.com/MobileOrg/, iOS implementation} for the 18844
17999@i{iPhone/iPod Touch/iPad} series of devices, was started by Richard Moreland 18845The @uref{https://github.com/MobileOrg/, iOS implementation} for the
18000and is now in the hands Sean Escriva. Android users should check out 18846@emph{iPhone/iPod Touch/iPad} series of devices, was started by Richard
18001@uref{http://wiki.github.com/matburt/mobileorg-android/, MobileOrg Android} 18847Moreland and is now in the hands Sean Escriva. Android users should check
18002by Matt Jones. The two implementations are not identical but offer similar 18848out @uref{http://wiki.github.com/matburt/mobileorg-android/, MobileOrg
18003features. 18849Android} by Matt Jones. Though the two implementations are not identical,
18004 18850they offer similar features.
18005This appendix describes the support Org has for creating agenda views in a 18851
18006format that can be displayed by @i{MobileOrg}, and for integrating notes 18852This appendix describes Org's support for agenda view formats compatible with
18007captured and changes made by @i{MobileOrg} into the main system. 18853MobileOrg. It also describes synchronizing changes, such as to notes,
18008 18854between MobileOrg and the computer.
18009For changing tags and TODO states in MobileOrg, you should have set up the 18855
18010customization variables @code{org-todo-keywords} and @code{org-tag-alist} to 18856To change tags and TODO states in MobileOrg, first customize the variables
18011cover all important tags and TODO keywords, even if individual files use only 18857@code{org-todo-keywords} and @code{org-tag-alist}. These should cover all
18012part of these. MobileOrg will also offer you states and tags set up with 18858the important tags and TODO keywords, even if Org files use only some of
18013in-buffer settings, but it will understand the logistics of TODO state 18859them. Though MobileOrg has in-buffer settings, it understands TODO states
18014@i{sets} (@pxref{Per-file keywords}) and @i{mutually exclusive} tags 18860@emph{sets} (@pxref{Per-file keywords}) and @emph{mutually exclusive} tags
18015(@pxref{Setting tags}) only for those set in these variables. 18861(@pxref{Setting tags}) only for those set in these variables.
18016 18862
18017@menu 18863@menu
18018* Setting up the staging area:: Where to interact with the mobile device 18864* Setting up the staging area:: For the mobile device
18019* Pushing to MobileOrg:: Uploading Org files and agendas 18865* Pushing to MobileOrg:: Uploading Org files and agendas
18020* Pulling from MobileOrg:: Integrating captured and flagged items 18866* Pulling from MobileOrg:: Integrating captured and flagged items
18021@end menu 18867@end menu
18022 18868
18023@node Setting up the staging area, Pushing to MobileOrg, MobileOrg, MobileOrg 18869@node Setting up the staging area
18024@section Setting up the staging area 18870@section Setting up the staging area
18025 18871
18026MobileOrg needs to interact with Emacs through a directory on a server. If you 18872MobileOrg needs access to a file directory on a server to interact with
18027are using a public server, you should consider to encrypt the files that are 18873Emacs. With a public server, consider encrypting the files. MobileOrg
18028uploaded to the server. This can be done with Org mode 7.02 and with 18874version 1.5 supports encryption for the iPhone. Org also requires
18029@i{MobileOrg 1.5} (iPhone version), and you need an @file{openssl} 18875@file{openssl} installed on the local computer. To turn on encryption, set
18030installation on your system. To turn on encryption, set a password in 18876the same password in MobileOrg and in Emacs. Set the password in the
18031@i{MobileOrg} and, on the Emacs side, configure the variable 18877variable @code{org-mobile-use-encryption}@footnote{If Emacs is configured for
18032@code{org-mobile-use-encryption}@footnote{If you can safely store the 18878safe storing of passwords, then configure the variable,
18033password in your Emacs setup, you might also want to configure 18879@code{org-mobile-encryption-password}; please read the docstring of that
18034@code{org-mobile-encryption-password}. Please read the docstring of that 18880variable.}. Note that even after MobileOrg encrypts the file contents, the
18035variable. Note that encryption will apply only to the contents of the 18881file names will remain visible on the file systems of the local computer, the
18036@file{.org} files. The file names themselves will remain visible.}. 18882server, and the mobile device.
18037 18883
18038The easiest way to create that directory is to use a free 18884For a server to host files, consider options like
18039@uref{http://dropbox.com,Dropbox.com} account@footnote{If you cannot use 18885@uref{http://dropbox.com,Dropbox.com} account@footnote{An alternative is to
18040Dropbox, or if your version of MobileOrg does not support it, you can use a 18886use webdav server. MobileOrg documentation has details of webdav server
18041webdav server. For more information, check out the documentation of MobileOrg and also this 18887configuration. Additional help is at
18042@uref{http://orgmode.org/worg/org-faq.html#mobileorg_webdav, FAQ entry}.}. 18888@uref{http://orgmode.org/worg/org-faq.html#mobileorg_webdav, FAQ entry}.}.
18043When MobileOrg first connects to your Dropbox, it will create a directory 18889On first connection, MobileOrg creates a directory @file{MobileOrg/} on
18044@i{MobileOrg} inside the Dropbox. After the directory has been created, tell 18890Dropbox. Pass its location to Emacs through an init file variable as
18045Emacs about it: 18891follows:
18046 18892
18047@lisp 18893@lisp
18048(setq org-mobile-directory "~/Dropbox/MobileOrg") 18894(setq org-mobile-directory "~/Dropbox/MobileOrg")
18049@end lisp 18895@end lisp
18050 18896
18051Org mode has commands to put files for @i{MobileOrg} into that directory, 18897Org copies files to the above directory for MobileOrg. Org also uses the
18052and to read captured notes from there. 18898same directory for sharing notes between Org and MobileOrg.
18053 18899
18054@node Pushing to MobileOrg, Pulling from MobileOrg, Setting up the staging area, MobileOrg 18900@node Pushing to MobileOrg
18055@section Pushing to MobileOrg 18901@section Pushing to MobileOrg
18056 18902
18057This operation copies all files currently listed in @code{org-mobile-files} 18903Org pushes files listed in @code{org-mobile-files} to
18058to the directory @code{org-mobile-directory}. By default this list contains 18904@code{org-mobile-directory}. Files include agenda files (as listed in
18059all agenda files (as listed in @code{org-agenda-files}), but additional files 18905@code{org-agenda-files}). Customize @code{org-mobile-files} to add other
18060can be included by customizing @code{org-mobile-files}. File names will be 18906files. File names will be staged with paths relative to
18061staged with paths relative to @code{org-directory}, so all files should be 18907@code{org-directory}, so all files should be inside this
18062inside this directory@footnote{Symbolic links in @code{org-directory} need to 18908directory@footnote{Symbolic links in @code{org-directory} should have the
18063have the same name than their targets.}. 18909same name as their targets.}.
18064 18910
18065The push operation also creates a special Org file @file{agendas.org} with 18911Push creates a special Org file @file{agendas.org} with custom agenda views
18066all custom agenda view defined by the user@footnote{While creating the 18912defined by the user@footnote{While creating the agendas, Org mode will force
18067agendas, Org mode will force ID properties on all referenced entries, so that 18913ID properties on all referenced entries, so that these entries can be
18068these entries can be uniquely identified if @i{MobileOrg} flags them for 18914uniquely identified if MobileOrg flags them for further action. To avoid
18069further action. If you do not want to get these properties in so many 18915setting properties configure the variable
18070entries, you can set the variable @code{org-mobile-force-id-on-agenda-items} 18916@code{org-mobile-force-id-on-agenda-items} to @code{nil}. Org mode will then
18071to @code{nil}. Org mode will then rely on outline paths, in the hope that 18917rely on outline paths, assuming they are unique.}.
18072these will be unique enough.}. 18918
18073 18919Org writes the file @file{index.org}, containing links to other files.
18074Finally, Org writes the file @file{index.org}, containing links to all other 18920MobileOrg reads this file first from the server to determine what other files
18075files. @i{MobileOrg} first reads this file from the server, and then 18921to download for agendas. For faster downloads, MobileOrg will read only
18076downloads all agendas and Org files listed in it. To speed up the download, 18922those files whose checksums@footnote{Checksums are stored automatically in
18077MobileOrg will only read files whose checksums@footnote{Checksums are stored 18923the file @file{checksums.dat}.} have changed.
18078automatically in the file @file{checksums.dat}} have changed. 18924
18079 18925@node Pulling from MobileOrg
18080@node Pulling from MobileOrg, , Pushing to MobileOrg, MobileOrg
18081@section Pulling from MobileOrg 18926@section Pulling from MobileOrg
18082 18927
18083When @i{MobileOrg} synchronizes with the server, it not only pulls the Org 18928When MobileOrg synchronizes with the server, it pulls the Org files for
18084files for viewing. It also appends captured entries and pointers to flagged 18929viewing. It then appends to the file @file{mobileorg.org} on the server the
18085and changed entries to the file @file{mobileorg.org} on the server. Org has 18930captured entries, pointers to flagged and changed entries. Org integrates
18086a @emph{pull} operation that integrates this information into an inbox file 18931its data in an inbox file format.
18087and operates on the pointers to flagged entries. Here is how it works:
18088 18932
18089@enumerate 18933@enumerate
18090@item 18934@item
@@ -18092,46 +18936,37 @@ Org moves all entries found in
18092@file{mobileorg.org}@footnote{@file{mobileorg.org} will be empty after this 18936@file{mobileorg.org}@footnote{@file{mobileorg.org} will be empty after this
18093operation.} and appends them to the file pointed to by the variable 18937operation.} and appends them to the file pointed to by the variable
18094@code{org-mobile-inbox-for-pull}. Each captured entry and each editing event 18938@code{org-mobile-inbox-for-pull}. Each captured entry and each editing event
18095will be a top-level entry in the inbox file. 18939is a top-level entry in the inbox file.
18096@item 18940@item
18097After moving the entries, Org will attempt to implement the changes made in 18941After moving the entries, Org attempts changes to MobileOrg. Some changes
18098@i{MobileOrg}. Some changes are applied directly and without user 18942are applied directly and without user interaction. Examples include changes
18099interaction. Examples are all changes to tags, TODO state, headline and body 18943to tags, TODO state, headline and body text. Entries for further action are
18100text that can be cleanly applied. Entries that have been flagged for further 18944tagged as @code{:FLAGGED:}. Org marks entries with problems with an error
18101action will receive a tag @code{:FLAGGED:}, so that they can be easily found 18945message in the inbox. They have to be resolved manually.
18102again. When there is a problem finding an entry or applying the change, the
18103pointer entry will remain in the inbox and will be marked with an error
18104message. You need to later resolve these issues by hand.
18105@item 18946@item
18106Org will then generate an agenda view with all flagged entries. The user 18947Org generates an agenda view for flagged entries for user intervention to
18107should then go through these entries and do whatever actions are necessary. 18948clean up. For notes stored in flagged entries, MobileOrg displays them in
18108If a note has been stored while flagging an entry in @i{MobileOrg}, that note 18949the echo area when the cursor is on the corresponding agenda item.
18109will be displayed in the echo area when the cursor is on the corresponding
18110agenda line.
18111 18950
18112@table @kbd 18951@table @kbd
18113@kindex ? 18952@kindex ?
18114@item ? 18953@item ?
18115Pressing @kbd{?} in that special agenda will display the full flagging note in 18954Pressing @kbd{?} displays the entire flagged note in another window. Org
18116another window and also push it onto the kill ring. So you could use @kbd{? 18955also pushes it to the kill ring. To store flagged note as a normal note, use
18117z C-y C-c C-c} to store that flagging note as a normal note in the entry. 18956@kbd{? z C-y C-c C-c}. Pressing @kbd{?} twice does these things: first it
18118Pressing @kbd{?} twice in succession will offer to remove the 18957removes the @code{:FLAGGED:} tag; second, it removes the flagged note from
18119@code{:FLAGGED:} tag along with the recorded flagging note (which is stored 18958the property drawer; third, it signals that manual editing of the flagged
18120in a property). In this way you indicate that the intended processing for 18959entry is now finished.
18121this flagged entry is finished.
18122@end table 18960@end table
18123@end enumerate 18961@end enumerate
18124 18962
18125@kindex C-c a ? 18963@kindex C-c a ?
18126If you are not able to process all flagged entries directly, you can always 18964@kbd{C-c a ?} returns to the agenda view to finish processing flagged
18127return to this agenda view@footnote{Note, however, that there is a subtle 18965entries. Note that these entries may not be the most recent since MobileOrg
18128difference. The view created automatically by @kbd{M-x org-mobile-pull RET} 18966searches files that were last pulled. To get an updated agenda view with
18129is guaranteed to search all files that have been addressed by the last pull. 18967changes since the last pull, pull again.
18130This might include a file that is not currently in your list of agenda files. 18968
18131If you later use @kbd{C-c a ?} to regenerate the view, only the current 18969@node History and acknowledgments
18132agenda files will be searched.} using @kbd{C-c a ?}.
18133
18134@node History and Acknowledgments, GNU Free Documentation License, MobileOrg, Top
18135@appendix History and acknowledgments 18970@appendix History and acknowledgments
18136@cindex acknowledgments 18971@cindex acknowledgments
18137@cindex history 18972@cindex history
@@ -18143,17 +18978,17 @@ Org was born in 2003, out of frustration over the user interface of the Emacs
18143Outline mode. I was trying to organize my notes and projects, and using 18978Outline mode. I was trying to organize my notes and projects, and using
18144Emacs seemed to be the natural way to go. However, having to remember eleven 18979Emacs seemed to be the natural way to go. However, having to remember eleven
18145different commands with two or three keys per command, only to hide and show 18980different commands with two or three keys per command, only to hide and show
18146parts of the outline tree, that seemed entirely unacceptable to me. Also, 18981parts of the outline tree, that seemed entirely unacceptable. Also, when
18147when using outlines to take notes, I constantly wanted to restructure the 18982using outlines to take notes, I constantly wanted to restructure the tree,
18148tree, organizing it parallel to my thoughts and plans. @emph{Visibility 18983organizing it paralleling my thoughts and plans. @emph{Visibility cycling}
18149cycling} and @emph{structure editing} were originally implemented in the 18984and @emph{structure editing} were originally implemented in the package
18150package @file{outline-magic.el}, but quickly moved to the more general 18985@file{outline-magic.el}, but quickly moved to the more general @file{org.el}.
18151@file{org.el}. As this environment became comfortable for project planning, 18986As this environment became comfortable for project planning, the next step
18152the next step was adding @emph{TODO entries}, basic @emph{timestamps}, and 18987was adding @emph{TODO entries}, basic @emph{timestamps}, and @emph{table
18153@emph{table support}. These areas highlighted the two main goals that Org 18988support}. These areas highlighted the two main goals that Org still has
18154still has today: to be a new, outline-based, plain text mode with innovative 18989today: to be a new, outline-based, plain text mode with innovative and
18155and intuitive editing features, and to incorporate project planning 18990intuitive editing features, and to incorporate project planning functionality
18156functionality directly into a notes file. 18991directly into a notes file.
18157 18992
18158Since the first release, literally thousands of emails to me or to 18993Since the first release, literally thousands of emails to me or to
18159@email{emacs-orgmode@@gnu.org} have provided a constant stream of bug 18994@email{emacs-orgmode@@gnu.org} have provided a constant stream of bug
@@ -18169,15 +19004,17 @@ Before I get to this list, a few special mentions are in order:
18169@table @i 19004@table @i
18170@item Bastien Guerry 19005@item Bastien Guerry
18171Bastien has written a large number of extensions to Org (most of them 19006Bastien has written a large number of extensions to Org (most of them
18172integrated into the core by now), including the @LaTeX{} exporter and the plain 19007integrated into the core by now), including the @LaTeX{} exporter and the
18173list parser. His support during the early days, when he basically acted as 19008plain list parser. His support during the early days was central to the
18174co-maintainer, was central to the success of this project. Bastien also 19009success of this project. Bastien also invented Worg, helped establishing the
18175invented Worg, helped establishing the Web presence of Org, and sponsored 19010Web presence of Org, and sponsored hosting costs for the orgmode.org website.
18176hosting costs for the orgmode.org website. 19011Bastien stepped in as maintainer of Org between 2011 and 2013, at a time when
19012I desperately needed a break.
18177@item Eric Schulte and Dan Davison 19013@item Eric Schulte and Dan Davison
18178Eric and Dan are jointly responsible for the Org-babel system, which turns 19014Eric and Dan are jointly responsible for the Org-babel system, which turns
18179Org into a multi-language environment for evaluating code and doing literate 19015Org into a multi-language environment for evaluating code and doing literate
18180programming and reproducible research. 19016programming and reproducible research. This has become one of Org's killer
19017features that define what Org is today.
18181@item John Wiegley 19018@item John Wiegley
18182John has contributed a number of great ideas and patches directly to Org, 19019John has contributed a number of great ideas and patches directly to Org,
18183including the attachment system (@file{org-attach.el}), integration with 19020including the attachment system (@file{org-attach.el}), integration with
@@ -18198,9 +19035,8 @@ let me know what I am missing here!
18198 19035
18199@section From Bastien 19036@section From Bastien
18200 19037
18201I (Bastien) have been maintaining Org since January 2011. This appendix 19038I (Bastien) have been maintaining Org between 2011 and 2013. This appendix
18202would not be complete without adding a few more acknowledgements and thanks 19039would not be complete without adding a few more acknowledgments and thanks.
18203to Carsten's ones above.
18204 19040
18205I am first grateful to Carsten for his trust while handing me over the 19041I am first grateful to Carsten for his trust while handing me over the
18206maintainership of Org. His unremitting support is what really helped me 19042maintainership of Org. His unremitting support is what really helped me
@@ -18218,13 +19054,13 @@ Eric is maintaining the Babel parts of Org. His reactivity here kept me away
18218from worrying about possible bugs here and let me focus on other parts. 19054from worrying about possible bugs here and let me focus on other parts.
18219 19055
18220@item Nicolas Goaziou 19056@item Nicolas Goaziou
18221Nicolas is maintaining the consistency of the deepest parts of Org. His 19057Nicolas is maintaining the consistency of the deepest parts of Org. His work
18222work on @file{org-element.el} and @file{ox.el} has been outstanding, and 19058on @file{org-element.el} and @file{ox.el} has been outstanding, and it opened
18223opened the doors for many new ideas and features. He rewrote many of the 19059the doors for many new ideas and features. He rewrote many of the old
18224old exporters to use the new export engine, and helped with documenting 19060exporters to use the new export engine, and helped with documenting this
18225this major change. More importantly (if that's possible), he has been more 19061major change. More importantly (if that's possible), he has been more than
18226than reliable during all the work done for Org 8.0, and always very 19062reliable during all the work done for Org 8.0, and always very reactive on
18227reactive on the mailing list. 19063the mailing list.
18228 19064
18229@item Achim Gratz 19065@item Achim Gratz
18230Achim rewrote the building process of Org, turning some @emph{ad hoc} tools 19066Achim rewrote the building process of Org, turning some @emph{ad hoc} tools
@@ -18280,13 +19116,14 @@ specified time.
18280calculations and improved XEmacs compatibility, in particular by porting 19116calculations and improved XEmacs compatibility, in particular by porting
18281@file{nouline.el} to XEmacs. 19117@file{nouline.el} to XEmacs.
18282@item 19118@item
18283@i{Sacha Chua} suggested copying some linking code from Planner. 19119@i{Sacha Chua} suggested copying some linking code from Planner, and helped
19120make Org pupular through her blog.
18284@item 19121@item
18285@i{Toby S. Cubitt} contributed to the code for clock formats. 19122@i{Toby S. Cubitt} contributed to the code for clock formats.
18286@item 19123@item
18287@i{Baoqiu Cui} contributed the DocBook exporter. It has been deleted from 19124@i{Baoqiu Cui} contributed the first DocBook exporter. In Org 8.0, we go a
18288Org 8.0: you can now export to Texinfo and export the @file{.texi} file to 19125different route: you can now export to Texinfo and export the @file{.texi}
18289DocBook using @code{makeinfo}. 19126file to DocBook using @code{makeinfo}.
18290@item 19127@item
18291@i{Eddward DeVilla} proposed and tested checkbox statistics. He also 19128@i{Eddward DeVilla} proposed and tested checkbox statistics. He also
18292came up with the idea of properties, and that there should be an API for 19129came up with the idea of properties, and that there should be an API for
@@ -18383,7 +19220,7 @@ basis.
18383@i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler 19220@i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler
18384happy. 19221happy.
18385@item 19222@item
18386@i{Richard Moreland} wrote @i{MobileOrg} for the iPhone. 19223@i{Richard Moreland} wrote MobileOrg for the iPhone.
18387@item 19224@item
18388@i{Rick Moynihan} proposed allowing multiple TODO sequences in a file 19225@i{Rick Moynihan} proposed allowing multiple TODO sequences in a file
18389and being able to quickly restrict the agenda to a subtree. 19226and being able to quickly restrict the agenda to a subtree.
@@ -18501,35 +19338,37 @@ work on a tty.
18501@item 19338@item
18502@i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks 19339@i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks
18503and contributed various ideas and code snippets. 19340and contributed various ideas and code snippets.
19341@item
19342@i{Marco Wahl} wrote @file{org-eww.el}.
18504@end itemize 19343@end itemize
18505 19344
18506 19345
18507@node GNU Free Documentation License, Main Index, History and Acknowledgments, Top 19346@node GNU Free Documentation License
18508@appendix GNU Free Documentation License 19347@appendix GNU Free Documentation License
18509@include doclicense.texi 19348@include doclicense.texi
18510 19349
18511 19350
18512@node Main Index, Key Index, GNU Free Documentation License, Top 19351@node Main Index
18513@unnumbered Concept index 19352@unnumbered Concept index
18514 19353
18515@printindex cp 19354@printindex cp
18516 19355
18517@node Key Index, Command and Function Index, Main Index, Top 19356@node Key Index
18518@unnumbered Key index 19357@unnumbered Key index
18519 19358
18520@printindex ky 19359@printindex ky
18521 19360
18522@node Command and Function Index, Variable Index, Key Index, Top 19361@node Command and Function Index
18523@unnumbered Command and function index 19362@unnumbered Command and function index
18524 19363
18525@printindex fn 19364@printindex fn
18526 19365
18527@node Variable Index, , Command and Function Index, Top 19366@node Variable Index
18528@unnumbered Variable index 19367@unnumbered Variable index
18529 19368
18530This is not a complete index of variables and faces, only the ones that are 19369This is not a complete index of variables and faces, only the ones that are
18531mentioned in the manual. For a more complete list, use @kbd{M-x 19370mentioned in the manual. For a complete list, use @kbd{M-x org-customize
18532org-customize @key{RET}} and then click yourself through the tree. 19371@key{RET}}.
18533 19372
18534@printindex vr 19373@printindex vr
18535 19374