:var:results:file:file-desc:file-ext:output-dir:dir and remote execution:exports:tangle:mkdirp:comments:padline:no-expand:session:noweb:noweb-ref:noweb-sep:cache:sep:hlines:colnames:rownames:shebang:tangle-mode:eval:wrap:post:prologue:epilogueNext: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This manual is for Org version 9.0.3 (release_9.0.3).
Copyright © 2004–2016 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with the Front-Cover Texts being “A GNU Manual,” and with the Back-Cover Texts as in (a) below. A copy of the license is included in the section entitled “GNU Free Documentation License.”
(a) The FSF’s Back-Cover Text is: “You have the freedom to copy and modify this GNU manual.”
| • Introduction: | Getting started | |
| • Document structure: | A tree works like your brain | |
| • Tables: | Pure magic for quick formatting | |
| • Hyperlinks: | Notes in context | |
| • TODO items: | Every tree branch can be a TODO item | |
| • Tags: | Tagging headlines and matching sets of tags | |
| • Properties and columns: | Storing information about an entry | |
| • Dates and times: | Making items useful for planning | |
| • Capture - Refile - Archive: | The ins and outs for projects | |
| • Agenda views: | Collecting information into views | |
| • Markup: | Prepare text for rich export | |
| • Exporting: | Sharing and publishing notes | |
| • Publishing: | Create a web site of linked Org files | |
| • Working with source code: | Export, evaluate, and tangle code blocks | |
| • Miscellaneous: | All the rest which did not fit elsewhere | |
| • Hacking: | How to hack your way around | |
| • MobileOrg: | Viewing and capture on a mobile device | |
| • History and acknowledgments: | How Org came into being | |
| • GNU Free Documentation License: | The license for this documentation. | |
| • Main Index: | An index of Org’s concepts and features | |
| • Key Index: | Key bindings and where they are described | |
| • Command and Function Index: | Command names and some internal functions | |
| • Variable Index: | Variables mentioned in the manual | |
— The Detailed Node Listing — Introduction | ||
|---|---|---|
| • Summary: | Brief summary of what Org does | |
| • Installation: | Installing Org | |
| • Activation: | How to activate Org for certain buffers | |
| • Feedback: | Bug reports, ideas, patches etc. | |
| • Conventions: | Typesetting conventions in the manual | |
Document structure | ||
| • Outlines: | Org is based on Outline mode | |
| • Headlines: | How to typeset Org tree headlines | |
| • Visibility cycling: | Show and hide, much simplified | |
| • Motion: | Jumping to other headlines | |
| • Structure editing: | Changing sequence and level of headlines | |
| • Sparse trees: | Matches embedded in context | |
| • Plain lists: | Additional structure within an entry | |
| • Drawers: | Tucking stuff away | |
| • Blocks: | Folding blocks | |
| • Footnotes: | How footnotes are defined in Org’s syntax | |
| • Orgstruct mode: | Structure editing outside Org | |
| • Org syntax: | Formal description of Org’s syntax | |
Visibility cycling | ||
| • Global and local cycling: | Cycling through various visibility states | |
| • Initial visibility: | Setting the initial visibility state | |
| • Catching invisible edits: | Preventing mistakes when editing invisible parts | |
Tables | ||
| • Built-in table editor: | Simple tables | |
| • Column width and alignment: | Overrule the automatic settings | |
| • Column groups: | Grouping to trigger vertical lines | |
| • Orgtbl mode: | The table editor as minor mode | |
| • The spreadsheet: | The table editor has spreadsheet capabilities | |
| • Org-Plot: | Plotting from org tables | |
The spreadsheet | ||
| • References: | How to refer to another field or range | |
| • Formula syntax for Calc: | Using Calc to compute stuff | |
| • Formula syntax for Lisp: | Writing formulas in Emacs Lisp | |
| • Durations and time values: | How to compute durations and time values | |
| • Field and range formulas: | Formula for specific (ranges of) fields | |
| • Column formulas: | Formulas valid for an entire column | |
| • Lookup functions: | Lookup functions for searching tables | |
| • Editing and debugging formulas: | Fixing formulas | |
| • Updating the table: | Recomputing all dependent fields | |
| • Advanced features: | Field and column names, parameters and automatic recalc | |
Hyperlinks | ||
| • Link format: | How links in Org are formatted | |
| • Internal links: | Links to other places in the current file | |
| • External links: | URL-like links to the world | |
| • Handling links: | Creating, inserting and following | |
| • Using links outside Org: | Linking from my C source code? | |
| • Link abbreviations: | Shortcuts for writing complex links | |
| • Search options: | Linking to a specific location | |
| • Custom searches: | When the default search is not enough | |
Internal links | ||
| • Radio targets: | Make targets trigger links in plain text | |
TODO items | ||
| • TODO basics: | Marking and displaying TODO entries | |
| • TODO extensions: | Workflow and assignments | |
| • Progress logging: | Dates and notes for progress | |
| • Priorities: | Some things are more important than others | |
| • Breaking down tasks: | Splitting a task into manageable pieces | |
| • Checkboxes: | Tick-off lists | |
Extended use of TODO keywords | ||
| • Workflow states: | From TODO to DONE in steps | |
| • TODO types: | I do this, Fred does the rest | |
| • Multiple sets in one file: | Mixing it all, and still finding your way | |
| • Fast access to TODO states: | Single letter selection of a state | |
| • Per-file keywords: | Different files, different requirements | |
| • Faces for TODO keywords: | Highlighting states | |
| • TODO dependencies: | When one task needs to wait for others | |
Progress logging | ||
| • Closing items: | When was this entry marked DONE? | |
| • Tracking TODO state changes: | When did the status change? | |
| • Tracking your habits: | How consistent have you been? | |
Tags | ||
| • Tag inheritance: | Tags use the tree structure of the outline | |
| • Setting tags: | How to assign tags to a headline | |
| • Tag hierarchy: | Create a hierarchy of tags | |
| • Tag searches: | Searching for combinations of tags | |
Properties and columns | ||
| • Property syntax: | How properties are spelled out | |
| • Special properties: | Access to other Org mode features | |
| • Property searches: | Matching property values | |
| • Property inheritance: | Passing values down the tree | |
| • Column view: | Tabular viewing and editing | |
| • Property API: | Properties for Lisp programmers | |
Column view | ||
| • Defining columns: | The COLUMNS format property | |
| • Using column view: | How to create and use column view | |
| • Capturing column view: | A dynamic block for column view | |
Defining columns | ||
| • Scope of column definitions: | Where defined, where valid? | |
| • Column attributes: | Appearance and content of a column | |
Dates and times | ||
| • Timestamps: | Assigning a time to a tree entry | |
| • Creating timestamps: | Commands which insert timestamps | |
| • Deadlines and scheduling: | Planning your work | |
| • Clocking work time: | Tracking how long you spend on a task | |
| • Effort estimates: | Planning work effort in advance | |
| • Timers: | Notes with a running timer | |
Creating timestamps | ||
| • The date/time prompt: | How Org mode helps you entering date and time | |
| • Custom time format: | Making dates look different | |
Deadlines and scheduling | ||
| • Inserting deadline/schedule: | Planning items | |
| • Repeated tasks: | Items that show up again and again | |
Clocking work time | ||
| • Clocking commands: | Starting and stopping a clock | |
| • The clock table: | Detailed reports | |
| • Resolving idle time: | Resolving time when you’ve been idle | |
Capture - Refile - Archive | ||
| • Capture: | Capturing new stuff | |
| • Attachments: | Add files to tasks | |
| • RSS feeds: | Getting input from RSS feeds | |
| • Protocols: | External (e.g., Browser) access to Emacs and Org | |
| • Refile and copy: | Moving/copying a tree from one place to another | |
| • Archiving: | What to do with finished projects | |
Capture | ||
| • Setting up capture: | Where notes will be stored | |
| • Using capture: | Commands to invoke and terminate capture | |
| • Capture templates: | Define the outline of different note types | |
Capture templates | ||
| • Template elements: | What is needed for a complete template entry | |
| • Template expansion: | Filling in information about time and context | |
| • Templates in contexts: | Only show a template in a specific context | |
Archiving | ||
| • Moving subtrees: | Moving a tree to an archive file | |
| • Internal archiving: | Switch off a tree but keep it in the file | |
Agenda views | ||
| • Agenda files: | Files being searched for agenda information | |
| • Agenda dispatcher: | Keyboard access to agenda views | |
| • Built-in agenda views: | What is available out of the box? | |
| • Presentation and sorting: | How agenda items are prepared for display | |
| • Agenda commands: | Remote editing of Org trees | |
| • Custom agenda views: | Defining special searches and views | |
| • Exporting agenda views: | Writing a view to a file | |
| • Agenda column view: | Using column view for collected entries | |
The built-in agenda views | ||
| • Weekly/daily agenda: | The calendar page with current tasks | |
| • Global TODO list: | All unfinished action items | |
| • Matching tags and properties: | Structured information with fine-tuned search | |
| • Timeline: | Time-sorted view for single file | |
| • Search view: | Find entries by searching for text | |
| • Stuck projects: | Find projects you need to review | |
Presentation and sorting | ||
| • Categories: | Not all tasks are equal | |
| • Time-of-day specifications: | How the agenda knows the time | |
| • Sorting agenda items: | The order of things | |
| • Filtering/limiting agenda items: | Dynamically narrow the agenda | |
Custom agenda views | ||
| • Storing searches: | Type once, use often | |
| • Block agenda: | All the stuff you need in a single buffer | |
| • Setting options: | Changing the rules | |
Markup for rich export | ||
| • Paragraphs: | The basic unit of text | |
| • Emphasis and monospace: | Bold, italic, etc. | |
| • Horizontal rules: | Make a line | |
| • Images and tables: | Images, tables and caption mechanism | |
| • Literal examples: | Source code examples with special formatting | |
| • Special symbols: | Greek letters and other symbols | |
| • Subscripts and superscripts: | Simple syntax for raising/lowering text | |
| • Embedded LaTeX: | LaTeX can be freely used inside Org documents | |
Embedded LaTeX | ||
| • LaTeX fragments: | Complex formulas made easy | |
| • Previewing LaTeX fragments: | What will this snippet look like? | |
| • CDLaTeX mode: | Speed up entering of formulas | |
Exporting | ||
| • The export dispatcher: | The main exporter interface | |
| • Export settings: | Generic export settings | |
| • Table of contents: | The if and where of the table of contents | |
| • Include files: | Include additional files into a document | |
| • Macro replacement: | Use macros to create templates | |
| • Comment lines: | What will not be exported | |
| • ASCII/Latin-1/UTF-8 export: | Exporting to flat files with encoding | |
| • Beamer export: | Exporting as a Beamer presentation | |
| • HTML export: | Exporting to HTML | |
| • LaTeX export: | Exporting to LaTeX, and processing to PDF | |
| • Markdown export: | Exporting to Markdown | |
| • OpenDocument Text export: | Exporting to OpenDocument Text | |
| • Org export: | Exporting to Org | |
| • Texinfo export: | Exporting to Texinfo | |
| • iCalendar export: | Exporting to iCalendar | |
| • Other built-in back-ends: | Exporting to a man page | |
| • Advanced configuration: | Fine-tuning the export output | |
| • Export in foreign buffers: | Author tables and lists in Org syntax | |
Beamer export | ||
| • Beamer export commands: | How to export Beamer documents. | |
| • Beamer specific export settings: | Export settings for Beamer export. | |
| • Sectioning Frames and Blocks in Beamer: | Blocks and sections in Beamer. | |
| • Beamer specific syntax: | Syntax specific to Beamer. | |
| • Editing support: | Helper functions for Org Beamer export. | |
| • A Beamer Example: | An complete Beamer example. | |
HTML export | ||
| • HTML Export commands: | How to invoke HTML export | |
| • HTML Specific export settings: | Export settings for HTML export | |
| • HTML doctypes: | Org can export to various (X)HTML flavors | |
| • HTML preamble and postamble: | How to insert a preamble and a postamble | |
| • Quoting HTML tags: | Using direct HTML in Org mode | |
| • Links in HTML export: | How links will be interpreted and formatted | |
| • Tables in HTML export: | How to modify the formatting of tables | |
| • Images in HTML export: | How to insert figures into HTML output | |
| • Math formatting in HTML export: | Beautiful math also on the web | |
| • Text areas in HTML export: | An alternative way to show an example | |
| • CSS support: | Changing the appearance of the output | |
| • JavaScript support: | Info and Folding in a web browser | |
LaTeX export | ||
| • LaTeX export commands: | How to export to LaTeX and PDF | |
| • LaTeX specific export settings: | Export settings for LaTeX | |
| • LaTeX header and sectioning: | Setting up the export file structure | |
| • Quoting LaTeX code: | Incorporating literal LaTeX code | |
| • Tables in LaTeX export: | Specific attributes for tables | |
| • Images in LaTeX export: | Specific attributes for images | |
| • Plain lists in LaTeX export: | Specific attributes for plain lists | |
| • Source blocks in LaTeX export: | Specific attributes for source blocks | |
| • Example blocks in LaTeX export: | Specific attributes for example blocks | |
| • Special blocks in LaTeX export: | Specific attributes for special blocks | |
| • Horizontal rules in LaTeX export: | Specific attributes for horizontal rules | |
OpenDocument Text export | ||
| • Pre-requisites for ODT export: | What packages ODT exporter relies on | |
| • ODT export commands: | How to invoke ODT export | |
| • ODT specific export settings: | Export settings for ODT | |
| • Extending ODT export: | How to produce ‘doc’, ‘pdf’ files | |
| • Applying custom styles: | How to apply custom styles to the output | |
| • Links in ODT export: | How links will be interpreted and formatted | |
| • Tables in ODT export: | How Tables are exported | |
| • Images in ODT export: | How to insert images | |
| • Math formatting in ODT export: | How LaTeX fragments are formatted | |
| • Labels and captions in ODT export: | How captions are rendered | |
| • Literal examples in ODT export: | How source and example blocks are formatted | |
| • Advanced topics in ODT export: | Read this if you are a power user | |
Math formatting in ODT export | ||
| • Working with LaTeX math snippets: | How to embed LaTeX math fragments | |
| • Working with MathML or OpenDocument formula files: | How to embed equations in native format | |
Advanced topics in ODT export | ||
| • Configuring a document converter: | How to register a document converter | |
| • Working with OpenDocument style files: | Explore the internals | |
| • Creating one-off styles: | How to produce custom highlighting etc | |
| • Customizing tables in ODT export: | How to define and use Table templates | |
| • Validating OpenDocument XML: | How to debug corrupt OpenDocument files | |
Texinfo export | ||
| • Texinfo export commands: | How to invoke Texinfo export | |
| • Texinfo specific export settings: | Export settings for Texinfo | |
| • Texinfo file header: | Generating the begining of a Texinfo file | |
| • Texinfo title and copyright page: | Creating title and copyright pages | |
| • Texinfo ‘Top’ node: | Installing a manual in Info Top node | |
| • Headings and sectioning structure: | Building document structure | |
| • Indices: | Creating indices | |
| • Quoting Texinfo code: | Incorporating literal Texinfo code | |
| • Plain lists in Texinfo export: | Specific attributes for plain lists | |
| • Tables in Texinfo export: | Specific attributes for tables | |
| • Images in Texinfo export: | Specific attributes for images | |
| • Special blocks in Texinfo export: | Specific attributes for special blocks | |
| • A Texinfo example: | Illustrating Org to Texinfo process | |
Publishing | ||
| • Configuration: | Defining projects | |
| • Uploading files: | How to get files up on the server | |
| • Sample configuration: | Example projects | |
| • Triggering publication: | Publication commands | |
Configuration | ||
| • Project alist: | The central configuration variable | |
| • Sources and destinations: | From here to there | |
| • Selecting files: | What files are part of the project? | |
| • Publishing action: | Setting the function doing the publishing | |
| • Publishing options: | Tweaking HTML/LaTeX export | |
| • Publishing links: | Which links keep working after publishing? | |
| • Sitemap: | Generating a list of all pages | |
| • Generating an index: | An index that reaches across pages | |
Sample configuration | ||
| • Simple example: | One-component publishing | |
| • Complex example: | A multi-component publishing example | |
Working with source code | ||
| • Structure of code blocks: | Code block syntax described | |
| • Editing source code: | Language major-mode editing | |
| • Exporting code blocks: | Export contents and/or results | |
| • Extracting source code: | Create pure source code files | |
| • Evaluating code blocks: | Place results of evaluation in the Org mode buffer | |
| • Library of Babel: | Use and contribute to a library of useful code blocks | |
| • Languages: | List of supported code block languages | |
| • Header arguments: | Configure code block functionality | |
| • Results of evaluation: | How evaluation results are handled | |
| • Noweb reference syntax: | Literate programming in Org mode | |
| • Key bindings and useful functions: | Work quickly with code blocks | |
| • Batch execution: | Call functions from the command line | |
Header arguments | ||
| • Using header arguments: | Different ways to set header arguments | |
| • Specific header arguments: | List of header arguments | |
Using header arguments | ||
| • System-wide header arguments: | Set globally, language-specific | |
| • Language-specific header arguments: | Set in the Org file’s headers | |
| • Header arguments in Org mode properties: | Set in the Org file | |
| • Language-specific mode properties: | ||
| • Code block specific header arguments: | The most commonly used method | |
| • Arguments in function calls: | The most specific level, takes highest priority | |
Specific header arguments | ||
| • var: | Pass arguments to ‘src’ code blocks | |
| • results: | Specify results type; how to collect | |
| • file: | Specify a path for output file | |
| • file-desc: | Specify a description for file results | |
| • file-ext: | Specify an extension for file output | |
| • output-dir: | Specify a directory for output file | |
| • dir: | Specify the default directory for code block execution | |
| • exports: | Specify exporting code, results, both, none | |
| • tangle: | Toggle tangling; or specify file name | |
| • mkdirp: | Toggle for parent directory creation for target files during tangling | |
| • comments: | Toggle insertion of comments in tangled code files | |
| • padline: | Control insertion of padding lines in tangled code files | |
| • no-expand: | Turn off variable assignment and noweb expansion during tangling | |
| • session: | Preserve the state of code evaluation | |
| • noweb: | Toggle expansion of noweb references | |
| • noweb-ref: | Specify block’s noweb reference resolution target | |
| • noweb-sep: | String to separate noweb references | |
| • cache: | Avoid re-evaluating unchanged code blocks | |
| • sep: | Delimiter for writing tabular results outside Org | |
| • hlines: | Handle horizontal lines in tables | |
| • colnames: | Handle column names in tables | |
| • rownames: | Handle row names in tables | |
| • shebang: | Make tangled files executable | |
| • tangle-mode: | Set permission of tangled files | |
| • eval: | Limit evaluation of specific code blocks | |
| • wrap: | Mark source block evaluation results | |
| • post: | Post processing of results of code block evaluation | |
| • prologue: | Text to prepend to body of code block | |
| • epilogue: | Text to append to body of code block | |
Miscellaneous | ||
| • Completion: | M-TAB guesses completions | |
| • Easy templates: | Quick insertion of structural elements | |
| • Speed keys: | Electric commands at the beginning of a headline | |
| • Code evaluation security: | Org mode files evaluate inline code | |
| • Customization: | Adapting Org to changing tastes | |
| • In-buffer settings: | Overview of the #+KEYWORDS | |
| • The very busy C-c C-c key: | When in doubt, press C-c C-c | |
| • Clean view: | Getting rid of leading stars in the outline | |
| • TTY keys: | Using Org on a tty | |
| • Interaction: | With other Emacs packages | |
| • org-crypt: | Encrypting Org files | |
Interaction with other packages | ||
| • Cooperation: | Packages Org cooperates with | |
| • Conflicts: | Packages that lead to conflicts | |
Hacking | ||
| • Hooks: | How to reach into Org’s internals | |
| • Add-on packages: | Available extensions | |
| • Adding hyperlink types: | New custom link types | |
| • Adding export back-ends: | How to write new export back-ends | |
| • Context-sensitive commands: | How to add functionality to such commands | |
| • Tables in arbitrary syntax: | Orgtbl for LaTeX and other programs | |
| • Dynamic blocks: | Automatically filled blocks | |
| • Special agenda views: | Customized views | |
| • Speeding up your agendas: | Tips on how to speed up your agendas | |
| • Extracting agenda information: | Post-processing of agenda information | |
| • Using the property API: | Writing programs that use entry properties | |
| • Using the mapping API: | Mapping over all or selected entries | |
Tables and lists in arbitrary syntax | ||
| • Radio tables: | Sending and receiving radio tables | |
| • A LaTeX example: | Step by step, almost a tutorial | |
| • Translator functions: | Copy and modify | |
| • Radio lists: | Sending and receiving lists | |
MobileOrg | ||
| • Setting up the staging area: | For the mobile device | |
| • Pushing to MobileOrg: | Uploading Org files and agendas | |
| • Pulling from MobileOrg: | Integrating captured and flagged items | |
Next: Document structure, Up: Top [Contents][Index]
| • Summary: | Brief summary of what Org does | |
| • Installation: | Installing Org | |
| • Activation: | How to activate Org for certain buffers | |
| • Feedback: | Bug reports, ideas, patches etc. | |
| • Conventions: | Typesetting conventions in the manual |
Next: Installation, Up: Introduction [Contents][Index]
Org is a mode for keeping notes, maintaining TODO lists, and project planning with a fast and effective plain-text system. It also is an authoring system with unique support for literate programming and reproducible research.
Org is implemented on top of Outline mode, which makes it possible to keep the content of large files well structured. Visibility cycling and structure editing help to work with the tree. Tables are easily created with a built-in table editor. Plain text URL-like links connect to websites, emails, Usenet messages, BBDB entries, and any files related to the projects.
Org develops organizational tasks around notes files that contain lists or information about projects as plain text. Project planning and task management makes use of metadata which is part of an outline node. Based on this data, specific entries can be extracted in queries and create dynamic agenda views that also integrate the Emacs calendar and diary. Org can be used to implement many different project planning schemes, such as David Allen’s GTD system.
Org files can serve as a single source authoring system with export to many different formats such as HTML, LaTeX, Open Document, and Markdown. New export backends can be derived from existing ones, or defined from scratch.
Org files can include source code blocks, which makes Org uniquely suited for authoring technical documents with code examples. Org source code blocks are fully functional; they can be evaluated in place and their results can be captured in the file. This makes it possible to create a single file reproducible research compendium.
Org keeps simple things simple. When first fired up, it should feel like a straightforward, easy to use outliner. Complexity is not imposed, but a large amount of functionality is available when needed. Org is a toolbox. Many users actually run only a (very personal) fraction of Org’s capabilities, and know that there is more whenever they need it.
All of this is achieved with strictly plain text files, the most portable and future-proof file format. Org runs in Emacs. Emacs is one of the most widely ported programs, so that Org mode is available on every major platform.
There is a website for Org which provides links to the newest version of Org, as well as additional information, frequently asked questions (FAQ), links to tutorials, etc. This page is located at http://orgmode.org.
An earlier version (7.3) of this manual is available as a paperback book from Network Theory Ltd.
Next: Activation, Previous: Summary, Up: Introduction [Contents][Index]
Org is part of recent distributions of GNU Emacs, so you normally don’t need to install it. If, for one reason or another, you want to install Org on top of this pre-packaged version, there are three ways to do it:
We strongly recommend to stick to a single installation method.
Recent Emacs distributions include a packaging system which lets you install Elisp libraries. You can install Org with M-x package-install RET org.
Important: you need to do this in a session where no .org file has
been visited, i.e., where no Org built-in function have been loaded.
Otherwise autoload Org functions will mess up the installation.
Then, to make sure your Org configuration is taken into account, initialize
the package system with (package-initialize) in your Emacs init file
before setting any Org option. If you want to use Org’s package repository,
check out the Org ELPA page.
You can download Org latest release from Org’s website. In this case, make sure you set the load-path correctly in your Emacs init file:
(add-to-list 'load-path "~/path/to/orgdir/lisp")
The downloaded archive contains contributed libraries that are not included in Emacs. If you want to use them, add the contrib directory to your load-path:
(add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t)
Optionally, you can compile the files and/or install them in your system.
Run make help to list compilation and installation options.
You can clone Org’s repository and install Org like this:
$ cd ~/src/ $ git clone git://orgmode.org/org-mode.git $ make autoloads
Note that in this case, make autoloads is mandatory: it defines Org’s
version in org-version.el and Org’s autoloads in
org-loaddefs.el.
Remember to add the correct load-path as described in the method above.
You can also compile with make, generate the documentation with
make doc, create a local configuration with make config and
install Org with make install. Please run make help to get
the list of compilation/installation options.
For more detailed explanations on Org’s build system, please check the Org Build System page on Worg.
Next: Feedback, Previous: Installation, Up: Introduction [Contents][Index]
Org mode buffers need font-lock to be turned on: this is the default in Emacs1.
There are compatibility issues between Org mode and some other Elisp packages, please take the time to check the list (see Conflicts).
The four Org commands org-store-link, org-capture,
org-agenda, and org-iswitchb should be accessible through
global keys (i.e., anywhere in Emacs, not just in Org buffers). Here are
suggested bindings for these keys, please modify the keys to your own
liking.
(global-set-key "\C-cl" 'org-store-link) (global-set-key "\C-ca" 'org-agenda) (global-set-key "\C-cc" 'org-capture) (global-set-key "\C-cb" 'org-iswitchb)
Files with the .org extension use Org mode by default. To turn on Org mode in a file that does not have the extension .org, make the first line of a file look like this:
MY PROJECTS -*- mode: org; -*-
which will select Org mode for this buffer no matter what
the file’s name is. See also the variable
org-insert-mode-line-in-empty-file.
Many commands in Org work on the region if the region is active. To make
use of this, you need to have transient-mark-mode turned on, which is
the default. If you do not like transient-mark-mode, you can create
an active region by using the mouse to select a region, or pressing
C-SPC twice before moving the cursor.
Next: Conventions, Previous: Activation, Up: Introduction [Contents][Index]
If you find problems with Org, or if you have questions, remarks, or ideas about it, please mail to the Org mailing list emacs-orgmode@gnu.org. You can subscribe to the list on this web page. If you are not a member of the mailing list, your mail will be passed to the list after a moderator has approved it2.
For bug reports, please first try to reproduce the bug with the latest version of Org available—if you are running an outdated version, it is quite possible that the bug has been fixed already. If the bug persists, prepare a report and provide as much information as possible, including the version information of Emacs (M-x emacs-version RET) and Org (M-x org-version RET), as well as the Org related setup in the Emacs init file. The easiest way to do this is to use the command
M-x org-submit-bug-report RET
which will put all this information into an Emacs mail buffer so that you only need to add your description. If you are not sending the Email from within Emacs, please copy and paste the content into your Email program.
Sometimes you might face a problem due to an error in your Emacs or Org mode setup. Before reporting a bug, it is very helpful to start Emacs with minimal customizations and reproduce the problem. Doing so often helps you determine if the problem is with your customization or with Org mode itself. You can start a typical minimal session with a command like the example below.
$ emacs -Q -l /path/to/minimal-org.el
However if you are using Org mode as distributed with Emacs, a minimal setup
is not necessary. In that case it is sufficient to start Emacs as
emacs -Q. The minimal-org.el setup file can have contents as
shown below.
;;; Minimal setup to load latest 'org-mode'
;; activate debugging
(setq debug-on-error t
debug-on-signal nil
debug-on-quit nil)
;; add latest org-mode to load path
(add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
(add-to-list 'load-path (expand-file-name "/path/to/org-mode/contrib/lisp" t))
If an error occurs, a backtrace can be very useful (see below on how to create one). Often a small example file helps, along with clear information about:
Thank you for helping to improve this program.
If working with Org produces an error with a message you don’t understand, you may have hit a bug. The best way to report this is by providing, in addition to what was mentioned above, a backtrace. This is information from the built-in debugger about where and how the error occurred. Here is how to produce a useful backtrace:
C-u M-x org-reload RET
or select Org -> Refresh/Reload -> Reload Org uncompiled from the
menu.
Options menu and select Enter Debugger on Error.
Previous: Feedback, Up: Introduction [Contents][Index]
Org mainly uses three types of keywords: TODO keywords, tags and property names. In this manual we use the following conventions:
TODOWAITINGTODO keywords are written with all capitals, even if they are user-defined.
bossARCHIVEUser-defined tags are written in lowercase; built-in tags with special meaning are written with all capitals.
ReleasePRIORITYUser-defined properties are capitalized; built-in properties with special meaning are written with all capitals.
Moreover, Org uses option keywords (like #+TITLE to set the title)
and environment keywords (like #+BEGIN_EXPORT html to start
a HTML environment). They are written in uppercase in the manual to
enhance its readability, but you can use lowercase in your Org file.
The manual suggests a few global key bindings, in particular C-c a for
org-agenda and C-c c for org-capture. These are only
suggestions, but the rest of the manual assumes that these key bindings are in
place in order to list commands by key access.
Also, the manual lists both the keys and the corresponding commands for
accessing a functionality. Org mode often uses the same key for different
functions, depending on context. The command that is bound to such keys has
a generic name, like org-metaright. In the manual we will, wherever
possible, give the function that is internally called by the generic command.
For example, in the chapter on document structure, M-right will
be listed to call org-do-demote, while in the chapter on tables, it
will be listed to call org-table-move-column-right. If you prefer,
you can compile the manual without the command names by unsetting the flag
cmdnames in org.texi.
Next: Tables, Previous: Introduction, Up: Top [Contents][Index]
Org is based on Outline mode and provides flexible commands to edit the structure of the document.
| • Outlines: | Org is based on Outline mode | |
| • Headlines: | How to typeset Org tree headlines | |
| • Visibility cycling: | Show and hide, much simplified | |
| • Motion: | Jumping to other headlines | |
| • Structure editing: | Changing sequence and level of headlines | |
| • Sparse trees: | Matches embedded in context | |
| • Plain lists: | Additional structure within an entry | |
| • Drawers: | Tucking stuff away | |
| • Blocks: | Folding blocks | |
| • Footnotes: | How footnotes are defined in Org’s syntax | |
| • Orgstruct mode: | Structure editing outside Org | |
| • Org syntax: | Formal description of Org’s syntax |
Next: Headlines, Up: Document structure [Contents][Index]
Org is implemented on top of Outline mode. Outlines allow a
document to be organized in a hierarchical structure, which (at least
for me) is the best representation of notes and thoughts. An overview
of this structure is achieved by folding (hiding) large parts of the
document to show only the general document structure and the parts
currently being worked on. Org greatly simplifies the use of
outlines by compressing the entire show/hide functionality into a single
command, org-cycle, which is bound to the TAB key.
Next: Visibility cycling, Previous: Outlines, Up: Document structure [Contents][Index]
Headlines define the structure of an outline tree. The headlines in Org start with one or more stars, on the left margin3 4. For example:
* Top level headline
** Second level
*** 3rd level
some text
*** 3rd level
more text
* Another top level headline
Note that a headline named after org-footnote-section,
which defaults to ‘Footnotes’, is considered as special. A subtree with
this headline will be silently ignored by exporting functions.
Some people find the many stars too noisy and would prefer an outline that has whitespace followed by a single star as headline starters. Clean view, describes a setup to realize this.
An empty line after the end of a subtree is considered part of it and
will be hidden when the subtree is folded. However, if you leave at
least two empty lines, one empty line will remain visible after folding
the subtree, in order to structure the collapsed view. See the
variable org-cycle-separator-lines to modify this behavior.
Next: Motion, Previous: Headlines, Up: Document structure [Contents][Index]
| • Global and local cycling: | Cycling through various visibility states | |
| • Initial visibility: | Setting the initial visibility state | |
| • Catching invisible edits: | Preventing mistakes when editing invisible parts |
Next: Initial visibility, Up: Visibility cycling [Contents][Index]
Outlines make it possible to hide parts of the text in the buffer. Org uses just two commands, bound to TAB and S-TAB to change the visibility in the buffer.
org-cycle)Subtree cycling: Rotate current subtree among the states
,-> FOLDED -> CHILDREN -> SUBTREE --. '-----------------------------------'
The cursor must be on a headline for this to work5. When the cursor is at the beginning of the buffer and the first line is not a headline, then TAB actually runs global cycling (see below)6. Also when called with a prefix argument (C-u TAB), global cycling is invoked.
org-global-cycle)Global cycling: Rotate the entire buffer among the states
,-> OVERVIEW -> CONTENTS -> SHOW ALL --. '--------------------------------------'
When S-TAB is called with a numeric prefix argument N, the CONTENTS view up to headlines of level N will be shown. Note that inside tables, S-TAB jumps to the previous field.
org-set-startup-visibility)Switch back to the startup visibility of the buffer (see Initial visibility).
outline-show-all)org-reveal)Reveal context around point, showing the current entry, the following heading and the hierarchy above. Useful for working near a location that has been exposed by a sparse tree command (see Sparse trees) or an agenda command (see Agenda commands). With a prefix argument show, on each level, all sibling headings. With a double prefix argument, also show the entire subtree of the parent.
outline-show-branches)Expose all the headings of the subtree, CONTENT view for just one subtree.
outline-show-children)Expose all direct children of the subtree. With a numeric prefix argument N, expose all children down to level N.
org-tree-to-indirect-buffer)Show the current subtree in an indirect buffer7. With a numeric prefix argument N, go up to level N and then take that tree. If N is negative then go up that many levels. With a C-u prefix, do not remove the previously used indirect buffer.
org-copy-visible)Copy the visible text in the region into the kill ring.
Next: Catching invisible edits, Previous: Global and local cycling, Up: Visibility cycling [Contents][Index]
When Emacs first visits an Org file, the global state is set to OVERVIEW,
i.e., only the top level headlines are visible8. This can be configured through the variable
org-startup-folded, or on a per-file basis by adding one of the
following lines anywhere in the buffer:
#+STARTUP: overview #+STARTUP: content #+STARTUP: showall #+STARTUP: showeverything
Furthermore, any entries with a ‘VISIBILITY’ property (see Properties and columns) will get their visibility adapted accordingly. Allowed values
for this property are folded, children, content, and
all.
org-set-startup-visibility)Switch back to the startup visibility of the buffer, i.e., whatever is requested by startup options and ‘VISIBILITY’ properties in individual entries.
Previous: Initial visibility, Up: Visibility cycling [Contents][Index]
Sometimes you may inadvertently edit an invisible part of the buffer and be
confused on what has been edited and how to undo the mistake. Setting
org-catch-invisible-edits to non-nil will help prevent this. See the
docstring of this option on how Org should catch invisible edits and process
them.
Next: Structure editing, Previous: Visibility cycling, Up: Document structure [Contents][Index]
The following commands jump to other headlines in the buffer.
org-next-visible-heading)org-previous-visible-heading)org-forward-same-level)org-backward-same-level)outline-up-heading)org-goto)Jump to a different place without changing the current outline visibility. Shows the document structure in a temporary buffer, where you can use the following keys to find your destination:
TAB Cycle visibility.
down / up Next/previous visible headline.
RET Select this location.
/ Do a Sparse-tree search
The following keys work if you turn off org-goto-auto-isearch
n / p Next/previous visible headline.
f / b Next/previous headline same level.
u One level up.
0-9 Digit argument.
q Quit
See also the option org-goto-interface.
Next: Sparse trees, Previous: Motion, Up: Document structure [Contents][Index]
org-insert-heading)Insert a new heading/item with the same level as the one at point.
If the command is used at the beginning of a line, and if there is a heading or a plain list item (see Plain lists) at point, the new heading/item is created before the current line. When used at the beginning of a regular line of text, turn that line into a heading.
When this command is used in the middle of a line, the line is split and the
rest of the line becomes the new item or headline. If you do not want the
line to be split, customize org-M-RET-may-split-line.
Calling the command with a C-u prefix unconditionally inserts a new heading at the end of the current subtree, thus preserving its contents. With a double C-u C-u prefix, the new heading is created at the end of the parent subtree instead.
org-insert-heading-respect-content)org-insert-todo-heading)Insert new TODO entry with same level as current heading. See also the
variable org-treat-insert-todo-heading-as-state-change.
org-insert-todo-heading-respect-content)Insert new TODO entry with same level as current heading. Like C-RET, the new headline will be inserted after the current subtree.
org-cycle)In a new entry with no text yet, the first TAB demotes the entry to become a child of the previous one. The next TAB makes it a parent, and so on, all the way to top level. Yet another TAB, and you are back to the initial level.
org-do-promote)org-do-demote)org-promote-subtree)org-demote-subtree)org-move-subtree-up)org-move-subtree-down)org-mark-element)Mark the element at point. Hitting repeatedly will mark subsequent elements of the one just marked. E.g., hitting M-h on a paragraph will mark it, hitting M-h immediately again will mark the next one.
org-mark-subtree)Mark the subtree at point. Hitting repeatedly will mark subsequent subtrees of the same level than the marked subtree.
org-cut-subtree)Kill subtree, i.e., remove it from buffer but save in kill ring. With a numeric prefix argument N, kill N sequential subtrees.
org-copy-subtree)Copy subtree to kill ring. With a numeric prefix argument N, copy the N sequential subtrees.
org-paste-subtree)Yank subtree from kill ring. This does modify the level of the subtree to make sure the tree fits in nicely at the yank position. The yank level can also be specified with a numeric prefix argument, or by yanking after a headline marker like ‘****’.
org-yank)Depending on the options org-yank-adjusted-subtrees and
org-yank-folded-subtrees, Org’s internal yank command will
paste subtrees folded and in a clever way, using the same command as C-c
C-x C-y. With the default settings, no level adjustment will take place,
but the yanked tree will be folded unless doing so would swallow text
previously visible. Any prefix argument to this command will force a normal
yank to be executed, with the prefix passed along. A good way to
force a normal yank is C-u C-y. If you use yank-pop after a
yank, it will yank previous kill items plainly, without adjustment and
folding.
org-clone-subtree-with-time-shift)Clone a subtree by making a number of sibling copies of it. You will be
prompted for the number of copies to make, and you can also specify if any
timestamps in the entry should be shifted. This can be useful, for example,
to create a number of tasks related to a series of lectures to prepare. For
more details, see the docstring of the command
org-clone-subtree-with-time-shift.
org-refile)Refile entry or region to a different location. See Refile and copy.
org-sort)Sort same-level entries. When there is an active region, all entries in the region will be sorted. Otherwise the children of the current headline are sorted. The command prompts for the sorting method, which can be alphabetically, numerically, by time (first timestamp with active preferred, creation time, scheduled time, deadline time), by priority, by TODO keyword (in the sequence the keywords have been defined in the setup) or by the value of a property. Reverse sorting is possible as well. You can also supply your own function to extract the sorting key. With a C-u prefix, sorting will be case-sensitive.
org-narrow-to-subtree)org-narrow-to-block)widen)org-toggle-heading)Turn a normal line or plain list item into a headline (so that it becomes a subheading at its location). Also turn a headline into a normal line by removing the stars. If there is an active region, turn all lines in the region into headlines. If the first line in the region was an item, turn only the item lines into headlines. Finally, if the first line is a headline, remove the stars from all headlines in the region.
When there is an active region (Transient Mark mode), promotion and demotion work on all headlines in the region. To select a region of headlines, it is best to place both point and mark at the beginning of a line, mark at the beginning of the first headline, and point at the line just after the last headline to change. Note that when the cursor is inside a table (see Tables), the Meta-Cursor keys have different functionality.
Next: Plain lists, Previous: Structure editing, Up: Document structure [Contents][Index]
An important feature of Org mode is the ability to construct sparse trees for selected information in an outline tree, so that the entire document is folded as much as possible, but the selected information is made visible along with the headline structure above it9. Just try it out and you will see immediately how it works.
Org mode contains several commands for creating such trees, all these commands can be accessed through a dispatcher:
org-sparse-tree)This prompts for an extra key to select a sparse-tree creating command.
org-occur)Prompts for a regexp and shows a sparse tree with all matches. If the match is in a headline, the headline is made visible. If the match is in the body of an entry, headline and body are made visible. In order to provide minimal context, also the full hierarchy of headlines above the match is shown, as well as the headline following the match. Each match is also highlighted; the highlights disappear when the buffer is changed by an editing command10, or by pressing C-c C-c. When called with a C-u prefix argument, previous highlights are kept, so several calls to this command can be stacked.
next-error)previous-error)Jump to the previous sparse tree match in this buffer.
For frequently used sparse trees of specific search strings, you can
use the option org-agenda-custom-commands to define fast
keyboard access to specific sparse trees. These commands will then be
accessible through the agenda dispatcher (see Agenda dispatcher).
For example:
(setq org-agenda-custom-commands
'(("f" occur-tree "FIXME")))
will define the key C-c a f as a shortcut for creating a sparse tree matching the string ‘FIXME’.
The other sparse tree commands select headings based on TODO keywords, tags, or properties and will be discussed later in this manual.
To print a sparse tree, you can use the Emacs command
ps-print-buffer-with-faces which does not print invisible parts of the
document. Or you can use C-c C-e C-v to export only the visible part
of the document and print the resulting file.
Next: Drawers, Previous: Sparse trees, Up: Document structure [Contents][Index]
Within an entry of the outline tree, hand-formatted lists can provide additional structure. They also provide a way to create lists of checkboxes (see Checkboxes). Org supports editing such lists, and every exporter (see Exporting) can parse and format them.
Org knows ordered lists, unordered lists, and description lists.
[@20]14. Those constructs can
be used in any item of the list in order to enforce a particular numbering.
Items belonging to the same list must have the same indentation on the first line. In particular, if an ordered list reaches number ‘10.’, then the 2–digit numbers must be written left-aligned with the other numbers in the list. An item ends before the next line that is less or equally indented than its bullet/number.
A list ends whenever every item has ended, which means before any line less or equally indented than items at top level. It also ends before two blank lines15. In that case, all items are closed. Here is an example:
** Lord of the Rings
My favorite scenes are (in this order)
1. The attack of the Rohirrim
2. Eowyn's fight with the witch king
+ this was already my favorite scene in the book
+ I really like Miranda Otto.
3. Peter Jackson being shot by Legolas
- on DVD only
He makes a really funny face when it happens.
But in the end, no individual scenes matter but the film as a whole.
Important actors in this film are:
- Elijah Wood :: He plays Frodo
- Sean Astin :: He plays Sam, Frodo's friend. I still remember
him very well from his role as Mikey Walsh in The Goonies.
Org supports these lists by tuning filling and wrapping commands to deal with
them correctly, and by exporting them properly (see Exporting). Since
indentation is what governs the structure of these lists, many structural
constructs like #+BEGIN_... blocks can be indented to signal that they
belong to a particular item.
If you find that using a different bullet for a sub-list (than that used for
the current list-level) improves readability, customize the variable
org-list-demote-modify-bullet. To get a greater difference of
indentation between items and their sub-items, customize
org-list-indent-offset.
The following commands act on items when the cursor is in the first line of
an item (the line with the bullet or number). Some of them imply the
application of automatic rules to keep list structure intact. If some of
these actions get in your way, configure org-list-automatic-rules
to disable them individually.
org-cycle)Items can be folded just like headline levels. Normally this works only if
the cursor is on a plain list item. For more details, see the variable
org-cycle-include-plain-lists. If this variable is set to
integrate, plain list items will be treated like low-level
headlines. The level of an item is then given by the indentation of the
bullet/number. Items are always subordinate to real headlines, however; the
hierarchies remain completely separated. In a new item with no text yet, the
first TAB demotes the item to become a child of the previous
one. Subsequent TABs move the item to meaningful levels in the list
and eventually get it back to its initial position.
org-insert-heading)Insert new item at current level. With a prefix argument, force a new heading (see Structure editing). If this command is used in the middle of an item, that item is split in two, and the second part becomes the new item16. If this command is executed before item’s body, the new item is created before the current one.
Insert a new item with a checkbox (see Checkboxes).
Jump to the previous/next item in the current list17, but only if
org-support-shift-select is off. If not, you can still use paragraph
jumping commands like C-up and C-down to quite
similar effect.
Move the item including subitems up/down18 (swap with previous/next item of same indentation). If the list is ordered, renumbering is automatic.
Decrease/increase the indentation of an item, leaving children alone.
Decrease/increase the indentation of the item, including subitems. Initially, the item tree is selected based on current indentation. When these commands are executed several times in direct succession, the initially selected region is used, even if the new indentation would imply a different hierarchy. To use the new hierarchy, break the command chain with a cursor motion or so.
As a special case, using this command on the very first item of a list will
move the whole list. This behavior can be disabled by configuring
org-list-automatic-rules. The global indentation of a list has no
influence on the text after the list.
If there is a checkbox (see Checkboxes) in the item line, toggle the state of the checkbox. In any case, verify bullets and indentation consistency in the whole list.
Cycle the entire list level through the different itemize/enumerate bullets
(‘-’, ‘+’, ‘*’, ‘1.’, ‘1)’) or a subset of them,
depending on org-plain-list-ordered-item-terminator, the type of list,
and its indentation. With a numeric prefix argument N, select the Nth bullet
from this list. If there is an active region when calling this, all selected
lines are converted to list items. With a prefix argument, selected text is
changed into a single item. If the first line already was a list item, any
item marker will be removed from the list. Finally, even without an active
region, a normal line will be converted into a list item.
Turn a plain list item into a headline (so that it becomes a subheading at its location). See Structure editing, for a detailed explanation.
Turn the whole plain list into a subtree of the current heading. Checkboxes (see Checkboxes) will become TODO (resp. DONE) keywords when unchecked (resp. checked).
This command also cycles bullet styles when the cursor in on the bullet or
anywhere in an item line, details depending on
org-support-shift-select.
Sort the plain list. You will be prompted for the sorting method: numerically, alphabetically, by time, by checked status for check lists, or by a custom function.
Next: Blocks, Previous: Plain lists, Up: Document structure [Contents][Index]
Sometimes you want to keep information associated with an entry, but you normally don’t want to see it. For this, Org mode has drawers. They can contain anything but a headline and another drawer. Drawers look like this:
** This is a headline Still outside the drawer :DRAWERNAME: This is inside the drawer. :END: After the drawer.
You can interactively insert drawers at point by calling
org-insert-drawer, which is bound to C-c C-x d. With an active
region, this command will put the region inside the drawer. With a prefix
argument, this command calls org-insert-property-drawer and add a
property drawer right below the current headline. Completion over drawer
keywords is also possible using M-TAB.
Visibility cycling (see Visibility cycling) on the headline will hide and
show the entry, but keep the drawer collapsed to a single line. In order to
look inside the drawer, you need to move the cursor to the drawer line and
press TAB there. Org mode uses the PROPERTIES drawer for
storing properties (see Properties and columns), and you can also arrange
for state change notes (see Tracking TODO state changes) and clock times
(see Clocking work time) to be stored in a drawer LOGBOOK. If you
want to store a quick note in the LOGBOOK drawer, in a similar way to state
changes, use
Add a time-stamped note to the LOGBOOK drawer.
You can select the name of the drawers which should be exported with
org-export-with-drawers. In that case, drawer contents will appear in
export output. Property drawers are not affected by this variable: configure
org-export-with-properties instead.
Next: Footnotes, Previous: Drawers, Up: Document structure [Contents][Index]
Org mode uses begin...end blocks for various purposes from including source
code examples (see Literal examples) to capturing time logging
information (see Clocking work time). These blocks can be folded and
unfolded by pressing TAB in the begin line. You can also get all blocks
folded at startup by configuring the option org-hide-block-startup
or on a per-file basis by using
#+STARTUP: hideblocks #+STARTUP: nohideblocks
Next: Orgstruct mode, Previous: Blocks, Up: Document structure [Contents][Index]
Org mode supports the creation of footnotes.
A footnote is started by a footnote marker in square brackets in column 0, no
indentation allowed. It ends at the next footnote definition, headline, or
after two consecutive empty lines. The footnote reference is simply the
marker in square brackets, inside text. Markers always start with
fn:. For example:
The Org homepage[fn:1] now looks a lot better than it used to. ... [fn:1] The link is: http://orgmode.org
Org mode extends the number-based syntax to named footnotes and optional inline definition. Here are the valid references:
[fn:name]A named footnote reference, where name is a unique label word, or, for
simplicity of automatic creation, a number.
[fn::This is the inline definition of this footnote]A LaTeX-like anonymous footnote where the definition is given directly at the reference point.
[fn:name:a definition]An inline definition of a footnote, which also specifies a name for the note.
Since Org allows multiple references to the same note, you can then use
[fn:name] to create additional references.
Footnote labels can be created automatically, or you can create names yourself.
This is handled by the variable org-footnote-auto-label and its
corresponding #+STARTUP keywords. See the docstring of that variable
for details.
The following command handles footnotes:
The footnote action command.
When the cursor is on a footnote reference, jump to the definition. When it is at a definition, jump to the (first) reference.
Otherwise, create a new footnote. Depending on the option
org-footnote-define-inline19, the
definition will be placed right into the text as part of the reference, or
separately into the location determined by the option
org-footnote-section.
When this command is called with a prefix argument, a menu of additional options is offered:
s Sort the footnote definitions by reference sequence. During editing, Org makes no effort to sort footnote definitions into a particular sequence. If you want them sorted, use this command, which will also move entries according toorg-footnote-section. Automatic sorting after each insertion/deletion can be configured using the optionorg-footnote-auto-adjust. r Renumber the simplefn:Nfootnotes. Automatic renumbering after each insertion/deletion can be configured using the optionorg-footnote-auto-adjust. S Short for firstr, thensaction. n Normalize the footnotes by collecting all definitions (including inline definitions) into a special section, and then numbering them in sequence. The references will then also be numbers. d Delete the footnote at point, and all definitions of and references to it.
Depending on the variable org-footnote-auto-adjust20,
renumbering and sorting footnotes can be automatic after each insertion or
deletion.
If the cursor is on a footnote reference, jump to the definition. If it is a the definition, jump back to the reference. When called at a footnote location with a prefix argument, offer the same menu as C-c C-x f.
Footnote labels are also links to the corresponding definition/reference, and you can use the usual commands to follow these links.
Edit the footnote definition corresponding to the reference at point in a seperate window. The window can be closed by pressing C-c '.
Next: Org syntax, Previous: Footnotes, Up: Document structure [Contents][Index]
If you like the intuitive way the Org mode structure editing and list
formatting works, you might want to use these commands in other modes like
Text mode or Mail mode as well. The minor mode orgstruct-mode makes
this possible. Toggle the mode with M-x orgstruct-mode RET, or
turn it on by default, for example in Message mode, with one of:
(add-hook 'message-mode-hook 'turn-on-orgstruct) (add-hook 'message-mode-hook 'turn-on-orgstruct++)
When this mode is active and the cursor is on a line that looks to Org like a headline or the first line of a list item, most structure editing commands will work, even if the same keys normally have different functionality in the major mode you are using. If the cursor is not in one of those special lines, Orgstruct mode lurks silently in the shadows.
When you use orgstruct++-mode, Org will also export indentation and
autofill settings into that mode, and detect item context after the first
line of an item.
You can also use Org structure editing to fold and unfold headlines in
any file, provided you defined orgstruct-heading-prefix-regexp:
the regular expression must match the local prefix to use before Org’s
headlines. For example, if you set this variable to ";; " in Emacs
Lisp files, you will be able to fold and unfold headlines in Emacs Lisp
commented lines. Some commands like org-demote are disabled when the
prefix is set, but folding/unfolding will work correctly.
Previous: Orgstruct mode, Up: Document structure [Contents][Index]
A reference document providing a formal description of Org’s syntax is
available as a draft on
Worg, written and maintained by Nicolas Goaziou. It defines Org’s core
internal concepts such as headlines, sections, affiliated
keywords, (greater) elements and objects. Each part of an Org
file falls into one of the categories above.
To explore the abstract structure of an Org buffer, run this in a buffer:
M-: (org-element-parse-buffer) RET
It will output a list containing the buffer’s content represented as an abstract structure. The export engine relies on the information stored in this list. Most interactive commands (e.g., for structure editing) also rely on the syntactic meaning of the surrounding context.
You can check syntax in your documents using org-lint command.
Next: Hyperlinks, Previous: Document structure, Up: Top [Contents][Index]
Org comes with a fast and intuitive table editor. Spreadsheet-like calculations are supported using the Emacs calc package (see Calc in Gnu Emacs Calculator Manual).
| • Built-in table editor: | Simple tables | |
| • Column width and alignment: | Overrule the automatic settings | |
| • Column groups: | Grouping to trigger vertical lines | |
| • Orgtbl mode: | The table editor as minor mode | |
| • The spreadsheet: | The table editor has spreadsheet capabilities | |
| • Org-Plot: | Plotting from org tables |
Next: Column width and alignment, Up: Tables [Contents][Index]
Org makes it easy to format tables in plain ASCII. Any line with ‘|’ as the first non-whitespace character is considered part of a table. ‘|’ is also the column separator21. A table might look like this:
| Name | Phone | Age | |-------+-------+-----| | Peter | 1234 | 17 | | Anna | 4321 | 25 |
A table is re-aligned automatically each time you press TAB or RET or C-c C-c inside the table. TAB also moves to the next field (RET to the next row) and creates new table rows at the end of the table or before horizontal lines. The indentation of the table is set by the first line. Any line starting with ‘|-’ is considered as a horizontal separator line and will be expanded on the next re-align to span the whole table width. So, to create the above table, you would only type
|Name|Phone|Age| |-
and then press TAB to align the table and start filling in
fields. Even faster would be to type |Name|Phone|Age followed by
C-c RET.
When typing text into a field, Org treats DEL,
Backspace, and all character keys in a special way, so that
inserting and deleting avoids shifting other fields. Also, when
typing immediately after the cursor was moved into a new field
with TAB, S-TAB or RET, the
field is automatically made blank. If this behavior is too
unpredictable for you, configure the options
org-enable-table-editor and org-table-auto-blank-field.
org-table-create-or-convert-from-region)Convert the active region to a table. If every line contains at least one
TAB character, the function assumes that the material is tab separated.
If every line contains a comma, comma-separated values (CSV) are assumed.
If not, lines are split at whitespace into fields. You can use a prefix
argument to force a specific separator: C-u forces CSV, C-u
C-u forces TAB, C-u C-u C-u will prompt for a regular expression to
match the separator, and a numeric argument N indicates that at least N
consecutive spaces, or alternatively a TAB will be the separator.
If there is no active region, this command creates an empty Org
table. But it is easier just to start typing, like
|Name|Phone|Age RET |- TAB.
org-table-align)org-table-blank-field)org-table-next-field)Re-align the table, move to the next field. Creates a new row if necessary.
org-table-previous-field)org-table-next-row)Re-align the table and move down to next row. Creates a new row if necessary. At the beginning or end of a line, RET still does NEWLINE, so it can be used to split a table.
org-table-beginning-of-field)Move to beginning of the current table field, or on to the previous field.
org-table-end-of-field)Move to end of the current table field, or on to the next field.
org-table-move-column-left)org-table-move-column-right)org-table-delete-column)org-table-insert-column)org-table-move-row-up)org-table-move-row-down)org-table-kill-row)org-table-insert-row)Insert a new row above the current row. With a prefix argument, the line is created below the current one.
org-table-insert-hline)Insert a horizontal line below current row. With a prefix argument, the line is created above the current line.
org-table-hline-and-move)Insert a horizontal line below current row, and move the cursor into the row below that line.
org-table-sort-lines)Sort the table lines in the region. The position of point indicates the column to be used for sorting, and the range of lines is the range between the nearest horizontal separator lines, or the entire table. If point is before the first column, you will be prompted for the sorting column. If there is an active region, the mark specifies the first line and the sorting column, while point should be in the last line to be included into the sorting. The command prompts for the sorting type (alphabetically, numerically, or by time). You can sort in normal or reverse order. You can also supply your own key extraction and comparison functions. When called with a prefix argument, alphabetic sorting will be case-sensitive.
org-table-copy-region)Copy a rectangular region from a table to a special clipboard. Point and mark determine edge fields of the rectangle. If there is no active region, copy just the current field. The process ignores horizontal separator lines.
org-table-cut-region)Copy a rectangular region from a table to a special clipboard, and blank all fields in the rectangle. So this is the “cut” operation.
org-table-paste-rectangle)Paste a rectangular region into a table. The upper left corner ends up in the current field. All involved fields will be overwritten. If the rectangle does not fit into the present table, the table is enlarged as needed. The process ignores horizontal separator lines.
org-table-wrap-region)Split the current field at the cursor position and move the rest to the line below. If there is an active region, and both point and mark are in the same column, the text in the column is wrapped to minimum width for the given number of lines. A numeric prefix argument may be used to change the number of desired lines. If there is no region, but you specify a prefix argument, the current field is made blank, and the content is appended to the field above.
org-table-sum)Sum the numbers in the current column, or in the rectangle defined by the active region. The result is shown in the echo area and can be inserted with C-y.
org-table-copy-down)When current field is empty, copy from first non-empty field above. When not
empty, copy current field down to next row and move cursor along with it.
Depending on the option org-table-copy-increment, integer field
values will be incremented during copy. Integers that are too large will not
be incremented. Also, a 0 prefix argument temporarily disables the
increment. This key is also used by shift-selection and related modes
(see Conflicts).
org-table-edit-field)Edit the current field in a separate window. This is useful for fields that are not fully visible (see Column width and alignment). When called with a C-u prefix, just make the full field visible, so that it can be edited in place. When called with two C-u prefixes, make the editor window follow the cursor through the table and always show the current field. The follow mode exits automatically when the cursor leaves the table, or when you repeat this command with C-u C-u C-c `.
Import a file as a table. The table should be TAB or whitespace separated. Use, for example, to import a spreadsheet table or data from a database, because these programs generally can write TAB-separated text files. This command works by inserting the file into the buffer and then converting the region to a table. Any prefix argument is passed on to the converter, which uses it to determine the separator.
org-table-create-or-convert-from-region)Tables can also be imported by pasting tabular text into the Org buffer, selecting the pasted text with C-x C-x and then using the C-c | command (see above under Creation and conversion).
Export the table, by default as a TAB-separated file. Use for data
exchange with, for example, spreadsheet or database programs. The format
used to export the file can be configured in the option
org-table-export-default-format. You may also use properties
TABLE_EXPORT_FILE and TABLE_EXPORT_FORMAT to specify the file
name and the format for table export in a subtree. Org supports quite
general formats for exported tables. The exporter format is the same as the
format used by Orgtbl radio tables, see Translator functions, for a
detailed description.
If you don’t like the automatic table editor because it gets in your way on lines which you would like to start with ‘|’, you can turn it off with
(setq org-enable-table-editor nil)
Then the only table command that still works is C-c C-c to do a manual re-align.
Next: Column groups, Previous: Built-in table editor, Up: Tables [Contents][Index]
The width of columns is automatically determined by the table editor. And also the alignment of a column is determined automatically from the fraction of number-like versus non-number fields in the column.
Sometimes a single field or a few fields need to carry more text, leading to inconveniently wide columns. Or maybe you want to make a table with several columns having a fixed width, regardless of content. To set the width of a column, one field anywhere in the column may contain just the string ‘<N>’ where ‘N’ is an integer specifying the width of the column in characters. The next re-align will then set the width of this column to this value.
|---+------------------------------| |---+--------| | | | | | <6> | | 1 | one | | 1 | one | | 2 | two | ----\ | 2 | two | | 3 | This is a long chunk of text | ----/ | 3 | This=> | | 4 | four | | 4 | four | |---+------------------------------| |---+--------|
Fields that are wider become clipped and end in the string ‘=>’. Note that the full text is still in the buffer but is hidden. To see the full text, hold the mouse over the field—a tool-tip window will show the full content. To edit such a field, use the command C-c ` (that is C-c followed by the grave accent). This will open a new window with the full field. Edit it and finish with C-c C-c.
When visiting a file containing a table with narrowed columns, the
necessary character hiding has not yet happened, and the table needs to
be aligned before it looks nice. Setting the option
org-startup-align-all-tables will realign all tables in a file
upon visiting, but also slow down startup. You can also set this option
on a per-file basis with:
#+STARTUP: align #+STARTUP: noalign
If you would like to overrule the automatic alignment of number-rich columns to the right and of string-rich columns to the left, you can use ‘<r>’, ‘<c>’22 or ‘<l>’ in a similar fashion. You may also combine alignment and field width like this: ‘<r10>’.
Lines which only contain these formatting cookies will be removed automatically when exporting the document.
Next: Orgtbl mode, Previous: Column width and alignment, Up: Tables [Contents][Index]
When Org exports tables, it does so by default without vertical lines because that is visually more satisfying in general. Occasionally however, vertical lines can be useful to structure a table into groups of columns, much like horizontal lines can do for groups of rows. In order to specify column groups, you can use a special row where the first field contains only ‘/’. The further fields can either contain ‘<’ to indicate that this column should start a group, ‘>’ to indicate the end of a group, or ‘<>’ (no space between ‘<’ and ‘>’) to make a column a group of its own. Boundaries between column groups will upon export be marked with vertical lines. Here is an example:
| N | N^2 | N^3 | N^4 | ~sqrt(n)~ | ~sqrt[4](N)~ | |---+-----+-----+-----+-----------+--------------| | / | < | | > | < | > | | 1 | 1 | 1 | 1 | 1 | 1 | | 2 | 4 | 8 | 16 | 1.4142 | 1.1892 | | 3 | 9 | 27 | 81 | 1.7321 | 1.3161 | |---+-----+-----+-----+-----------+--------------| #+TBLFM: $2=$1^2::$3=$1^3::$4=$1^4::$5=sqrt($1)::$6=sqrt(sqrt(($1)))
It is also sufficient to just insert the column group starters after every vertical line you would like to have:
| N | N^2 | N^3 | N^4 | sqrt(n) | sqrt[4](N) | |----+-----+-----+-----+---------+------------| | / | < | | | < | |
Next: The spreadsheet, Previous: Column groups, Up: Tables [Contents][Index]
If you like the intuitive way the Org table editor works, you might also want to use it in other modes like Text mode or Mail mode. The minor mode Orgtbl mode makes this possible. You can always toggle the mode with M-x orgtbl-mode RET. To turn it on by default, for example in Message mode, use
(add-hook 'message-mode-hook 'turn-on-orgtbl)
Furthermore, with some special setup, it is possible to maintain tables in arbitrary syntax with Orgtbl mode. For example, it is possible to construct LaTeX tables with the underlying ease and power of Orgtbl mode, including spreadsheet capabilities. For details, see Tables in arbitrary syntax.
Next: Org-Plot, Previous: Orgtbl mode, Up: Tables [Contents][Index]
The table editor makes use of the Emacs calc package to implement spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to derive fields from other fields. While fully featured, Org’s implementation is not identical to other spreadsheets. For example, Org knows the concept of a column formula that will be applied to all non-header fields in a column without having to copy the formula to each relevant field. There is also a formula debugger, and a formula editor with features for highlighting fields in the table corresponding to the references at the point in the formula, moving these references by arrow keys
| • References: | How to refer to another field or range | |
| • Formula syntax for Calc: | Using Calc to compute stuff | |
| • Formula syntax for Lisp: | Writing formulas in Emacs Lisp | |
| • Durations and time values: | How to compute durations and time values | |
| • Field and range formulas: | Formula for specific (ranges of) fields | |
| • Column formulas: | Formulas valid for an entire column | |
| • Lookup functions: | Lookup functions for searching tables | |
| • Editing and debugging formulas: | Fixing formulas | |
| • Updating the table: | Recomputing all dependent fields | |
| • Advanced features: | Field and column names, parameters and automatic recalc |
Next: Formula syntax for Calc, Up: The spreadsheet [Contents][Index]
To compute fields in the table from other fields, formulas must reference other fields or ranges. In Org, fields can be referenced by name, by absolute coordinates, and by relative coordinates. To find out what the coordinates of a field are, press C-c ? in that field, or press C-c } to toggle the display of a grid.
Formulas can reference the value of another field in two ways. Like in
any other spreadsheet, you may reference fields with a letter/number
combination like B3, meaning the 2nd field in the 3rd row.
However, Org prefers23 to use another, more general
representation that looks like this:
@row$column
Column specifications can be absolute like $1,
$2,...$N, or relative to the current column (i.e., the
column of the field which is being computed) like $+1 or $-2.
$< and $> are immutable references to the first and last
column, respectively, and you can use $>>> to indicate the third
column from the right.
The row specification only counts data lines and ignores horizontal separator
lines (hlines). Like with columns, you can use absolute row numbers
@1, @2,...@N, and row numbers relative to the
current row like @+3 or @-1. @< and @> are
immutable references the first and last24 row in the table, respectively. You may also
specify the row relative to one of the hlines: @I refers to the first
hline, @II to the second, etc. @-I refers to the first such
line above the current line, @+I to the first such line below the
current line. You can also write @III+2 which is the second data line
after the third hline in the table.
@0 and $0 refer to the current row and column, respectively,
i.e., to the row/column for the field being computed. Also, if you omit
either the column or the row part of the reference, the current row/column is
implied.
Org’s references with unsigned numbers are fixed references in the sense that if you use the same reference in the formula for two different fields, the same field will be referenced each time. Org’s references with signed numbers are floating references because the same reference operator can reference different fields depending on the field being calculated by the formula.
Here are a few examples:
@2$3 2nd row, 3rd column (same asC2) $5 column 5 in the current row (same asE&) @2 current column, row 2 @-1$-3 the field one row up, three columns to the left @-I$2 field just under hline above current row, column 2 @>$5 field in the last row, in column 5
You may reference a rectangular range of fields by specifying two field
references connected by two dots ‘..’. If both fields are in the
current row, you may simply use ‘$2..$7’, but if at least one field
is in a different row, you need to use the general @row$column
format at least for the first field (i.e the reference must start with
‘@’ in order to be interpreted correctly). Examples:
$1..$3 first three fields in the current row $P..$Q range, using column names (see under Advanced) $<<<..$>> start in third column, continue to the last but one @2$1..@4$3 6 fields between these two fields (same asA2..C4) @-1$-2..@-1 3 fields in the row above, starting from 2 columns on the left @I..II between first and second hline, short for@I..@II
Range references return a vector of values that can be fed into Calc vector functions. Empty fields in ranges are normally suppressed, so that the vector contains only the non-empty fields. For other options with the mode switches ‘E’, ‘N’ and examples see Formula syntax for Calc.
One of the very first actions during evaluation of Calc formulas and Lisp
formulas is to substitute @# and $# in the formula with the
row or column number of the field where the current result will go to. The
traditional Lisp formula equivalents are org-table-current-dline and
org-table-current-column. Examples:
if(@# % 2, $#, string(""))Insert column number on odd rows, set field to empty on even rows.
$2 = '(identity remote(FOO, @@#$1))Copy text or values of each row of column 1 of the table named FOO
into column 2 of the current table.
@3 = 2 * remote(FOO, @1$$#)Insert the doubled value of each column of row 1 of the table named
FOO into row 3 of the current table.
For the second/third example, the table named FOO must have
at least as many rows/columns as the current table. Note that this is
inefficient25 for large number of
rows/columns.
‘$name’ is interpreted as the name of a column, parameter or
constant. Constants are defined globally through the option
org-table-formula-constants, and locally (for the file) through a
line like
#+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6
Also properties (see Properties and columns) can be used as constants in table formulas: for a property ‘:Xyz:’ use the name ‘$PROP_Xyz’, and the property will be searched in the current outline entry and in the hierarchy above it. If you have the constants.el package, it will also be used to resolve constants, including natural constants like ‘$h’ for Planck’s constant, and units like ‘$km’ for kilometers26. Column names and parameters can be specified in special table lines. These are described below, see Advanced features. All names must start with a letter, and further consist of letters and numbers.
You may also reference constants, fields and ranges from a different table, either in the current file or even in a different file. The syntax is
remote(NAME-OR-ID,REF)
where NAME can be the name of a table in the current file as set by a
#+NAME: Name line before the table. It can also be the ID of an
entry, even in a different file, and the reference then refers to the first
table in that entry. REF is an absolute field or range reference as
described above for example @3$3 or $somename, valid in the
referenced table.
Indirection of NAME-OR-ID: When NAME-OR-ID has the format @ROW$COLUMN
it will be substituted with the name or ID found in this field of the current
table. For example remote($1, @>$2) => remote(year_2013,
@>$1). The format B3 is not supported because it can not be
distinguished from a plain table name or ID.
Next: Formula syntax for Lisp, Previous: References, Up: The spreadsheet [Contents][Index]
A formula can be any algebraic expression understood by the Emacs Calc
package. Note that calc has the non-standard convention that ‘/’
has lower precedence than ‘*’, so that ‘a/b*c’ is interpreted as
‘a/(b*c)’. Before evaluation by calc-eval (see Calling Calc from Your Lisp Programs in GNU Emacs Calc Manual), variable substitution takes place according to the
rules described above.
The range vectors can be directly fed into the Calc vector functions
like ‘vmean’ and ‘vsum’.
A formula can contain an optional mode string after a semicolon. This string consists of flags to influence Calc and other modes during execution. By default, Org use