Org Mode
Table of Contents
- 1. Metadata
- 2. Markup
- 3. Macro
- 4. Commands
- 5. LaTeX
- 6. Tasks
- 7. Org Table  builtin
- 8. Org Babel  builtin
- 9. Org Agenda  builtin
- 10. Org Capture  builtin
- 11. Org Roam
- 12. Org Journal
- 13. Org Drill
- 14. Org Cliplink
- 15.
org-special-block-extras - 16. Export and Publish
- 17. Configuration
- 18. References
A GNU Emacs major mode for keeping notes, authoring documents, computational notebooks, literate programming, maintaining to-do lists, planning projects, and more — in a fast and effective plain text system.
1. Metadata
#+TITLE:#+AUTHOR:#+STARTUP:numorg-num-mode
2. Markup
2.1. Heading
******, …- Promoting without heading is not allowed due to the need for simplicity and compatibility with LaTeX, DocBook and traditional book/article structures.(??, ????)
M-<right>,M-<left>demote and promote current heading or list itemC-M-<right>,C-M-<left>demote and promote current subtreeM-<up>,M-<down>swap up and downM-RETnew item,M-S-RETnew checklist item
2.2. Tags
C-c C-q(org-set-tags-command) add tag to a topic.C-c C-cdoes the same thing in a headline@and_can be used within tag names.#+TAGS: <tag>(<fast access key>) ...is used to set tags for a fileorg-tag-alistdefines the tags, with the second argument?<fast access key>.
2.3. Format
Face
*bold*,/italic/,_underline_,+strikethrough+~code~,=verbatim=,:at the start of a line
List
+,-,*(nested) unordered list- =term
- description= description list
- (no term)
[ ][-][X]checkbox
1.,1),A.,A)ordered list[@N]start the number atN
2.4. Todo
C-c C-torS-<right>,S-<left>org-todo, change the todo state
2.5. Link
[[target]] or [[target][desc]]
where target can be type:target if no type is provided, org looks for the
headings. <<target>> creates target point. Link to it with [[target]].
#+name: target match the exact name of an element.
See External Links (The Org Manual), Internal Links (The Org Manual)
http:,https:file:- it can be nested such as
file:...::#idorfile:...::*heading - The
idis set by theCUSTOM_IDproperty.
- it can be nested such as
org-link-set-parameterscreate custom link type:follow <func>on open:export <func>:store <func>:image-data-fun <func>
C-c C-lorg-insert-linkC-c C-oorg-open-at-point- The URL is hidden if
org-link-descriptiveist
2.6. Footnote
[fn:Name],[fn:: inline],[fn:NAME: inline definition]C-c C-x ffootnote action. jump to the definition, or create a new footnote, and moreC-c C-cjump to the definition or jump back to the referenceC-c C-oor<mouse-1>,<mouse-2>follow the link, same asC-c C-c
2.7. Citation
The format is
[cite/<style>/<variant>:<prefix> @<key> <suffix>; ...]
The bib source file can be added locally with #+bibliography: <BibTeX file>
or globally with org-cite-global-bibliography variable.
C-c C-x @(org-cite-insert)- select with
RET - finish with
M-RET(orC-M-jin some cases).
- select with
2.8. Image
- Image is inserted as a link to the image file.
C-c C-x C-vto render image without description inline.C-u C-c C-x C-vto render image with description inline.- Instead of manually rendering inline images for every buffer,
the variable
org-startup-with-inline-imagescan be set totglobally, or the directive#+STARTUP: inlineimagescan be used per file. #+caption: TEXT,#+name: NAMEcan be preceded to the image.#+attr_org,#+attr_latex,#+attr_html: :TAG VALUEare used to set the display format.- When using TRAMP, change
org-display-remote-inline-imagesto somthing other thanskip
2.9. Block
A block
#+begin_TYPE
#+end_TYPE
Block types include
center<ccommentdynamicexample<eexport<exquote<qspecialverse<vsrc<src
2.10. Comment
Line commnet
# comment
Inline commnet
@@comment: comment@@
Block comment
#+begin_comment
#+end_comment
Section comment
* COMMENT
3. Macro
#+macro: f ...$1...define macro{{{f(1,...)}}}use macro
4. Commands
C-c C-j(org-goto) show outline in a new buffer and select from itC-c C-qadd tag to a topicC-c C-,orC-c C-x s(org-insert-structure-template) insert org block at point or around a regionC-c C-x C-v(org-toggle-inline-images)C-c C-x- Properties
p(org-set-property)P(org-set-property-and-value)
- Timer
;(org-timer-set-timer) countdown timer,0(org-timer-start) countup timer,(org-timer-pause-or-continue),_(org-timer-stop).(org-timer) start a timer if there's none, and insert current elapsed time
- Text
C-f(org-emphasize) choose bold, italic, and others.
!reload all lisp files related to org.
- Properties
5. LaTeX
org-cdlatex-modeenables the cdlatex bindings
5.1. LaTeX Preview
org-latex-previewis now being worked on to include live preview and support in other major modes.- See Emacs 💜 LaTeX - YouTube and the documentation.
org-latex-preview-auto-mode
- The
divpngdid not work sometimes with the error.dviwas not found. Changing the relative path%fto absolute path%Ffixed the issue.- It is not supported on the Karthink's branch
#+startup: latexpreviewrenders the LaTeX expressions on startup.org-startup-with-latex-previewcan be also be set tot
<C-c> <C-x> <C-l>preview the LaTeX fragment at the cursor, if no fragment for every fragment in the current entry.
6. Tasks
S-<rightarrow>,S-<leftarrow>to change the TODO status of a heading.C-c ,set or remove priorityC-c C-sschedule a heading,C-c C-dset a deadline- The datetime is delimited with
<>or[]. S-<arrow>within the brackets alters the time.
- The datetime is delimited with
[/]at the end of the parent heading indicate the number of completed tasks- Clock
C-c C-x TAB(org-clock-in) log a starting time of a headingC-c C-x C-o(org-clock-out) the ending timeorg-clock-reportsummerizes and accuulate the clocks- Analyze Your Time with Org Mode — Org Mode Clocktables — Straightforward Emac…
7. Org Table  builtin
Each table cell is separated by |
,| example | table |
,|---------+-------|
,| 1 | 2 |
C-c C-calign tableM-a,M-ebeginning and end of a field.M-<arrow>move a row or columnM-S-<right>insert column left (at point),M-S-<down>insert row above (at point)M-S-<left>delete column at point,M-S-<up>delete row at point.S-<arrow>move a cellC-c -insert hline belowC-c RETinsert hline below and move below the hlineS-RETfirst non-empty field above and insert copy of it below.- integer, time stamp, whole number prefixed/suffixed is incremented when
org-table-copy-incrementis set.
- integer, time stamp, whole number prefixed/suffixed is incremented when
C-c TABshrink or show specified columns.
7.1. Table Formula
- Advanced features: Advanced features (The Org Manual)
- The Spreadsheet (The Org Manual)
- It can be directly entered into a cell by prefixing
:=.
7.1.1. Execution
C-c *(org-table-recalculate) apply column formulas left to right, and field/range formulas in the current row.C-u C-c *orC-u C-c C-crecomputer the entire table, line by line, with the lines before the first hline is ignored.C-u C-u C-c *orC-u C-u C-c C-citeratatively recompute the entire table until no changes occur.org-table-recalculate-buffer-tablesC-c <=>edit or create formula at the current cell.
7.1.2. Field Reference
- Row
@0Current Row@1Absolute,@+1Relative,@<@>@>>>Relative to the top/bottom@IIAbsolute hline,@+I@-IIRelative hline,@II+2Relative dataline relative to the absolute hline
- Column
$0Current Column$1Absolute,$-1Relative,$>Relative to the left/right
- Range
$1..$3@-1$-2..@-1@I..II(@I..@II)
- Coordinate
@#,$#row or column number of the field for
7.1.3. Syntax
The calc expression is directly allowed.
if(COND, IF_TRUE, IF_FALSE)string(STR)vsum(RANGE)vmean(RANGE)
Emacs lisp can be used. The expression needs to be quoted.
;Nat the end of an expression let emacs treats the result as a numerical value.
There are reference function as well
remote(TBL_NAME, REF)
7.2. Features
- The content in the first column can create a special row
!name definition of columns^,_name definition of fields in the row above (or below)#make the row recalculate automatically*make the row selected for global recalculation/the row is not exported
- Any one of the fields in a column can be used to specify the width
and alignment of the column.
<N>fixed width ofN,with the ability to be expanded withC-c TAB.<r>,<c>,<l>to align the contents<rN>is also allowed
8. Org Babel  builtin
#+begin_src LANG OPTIONS
SOURCE
#+end_src
The source code is only executable if the language is properly installed on the system and the language is loaded by Babel
Org Babel evaluates and manage code blocks.
The language listed by org-babel-load-languages is loaded.
C-c C-cevaluate
8.1. Header
#+HEADER: can be used to specify the header right before the source block.
:var
VARIABLE=VALUEGive parameter to the script
:results
- Collection
valuereturn value,outputstandard output
- Type: Result Type
table,vector,list,scalar,verbatimfileoutput to file set by:file <filename>.
- Format: Result Format
raw,code,drawerhtmlUseBEGIN_EXPORT htmllatexUseBEGIN_EXPORT latexlink,graphicsLink to the file specified in:fileheader argument The code block output is not written to the diskorgUseBEGIN_SRC orgblockppPretty-Print Source Code
- Handling
replacesilentecho in the minibuffernonecompute the result without displaying them, but it can be used by other code blocksdiscardThe result is ignored. The value of the code block will benilappendappend to the buffer at the bottomprependPrepend to the buffer at the top
:tangle FILE
C-c C-v ttangle current fileC-u C-c C-v ttangle current blockC-c C-v fchoose file to tangleorg-babel-tangleto process every block with:tangletag#+auto_tangle tglobal option is provided byorg-auto-tanglepackage.
:exports
coderesultsbothnone
8.2. Dot
- The Graphviz language
- It generates graphs
title:type:(2d|3d|radar|grid)org-plot/preset-plot-typescustomize
with:min:max:labels:set:
Plot the table with <C-c> " g or <M-x> org-plot/gnuplot
8.3. Asymptote
Vector graphics language
ob-asymptote only recognizes asymptote as the language.
Asymptote package provides asym-mode.el in /usr/share/asymptote directory.
9. Org Agenda  builtin
C-c [(org-agenda-file-to-front) adds current file toorg-agenda-files,C-c ]removes current file.
9.1. Todo
C-c C-t(org-todo), orS-<left>,S-<right>rotate the state of TODOC-u C-c C-trecord timestamp and a noteC-u N C-c C-tchanges toNth state.org-todo-keywordscan be configured. See- Format:
(<fast access key><entering log>[/<leaving log>]) - The fast access key becomes available after
C-c C-t !log timestamp,@log note and timestamp- the leaving log only works when the target keywords does not have logging enabled.
|within the sequence indicates that the keywords after it are DONE state.- The logging is enabled when the destination is set by the
org-log-into-drawervariable.
- Format:
[ / ]can be added at the end of a TODO heading to count the task done.C-c C-c(org-toggle-checkbox)C-c ,(org-priority),S-<up>,S-<down>to change priorit
S-M-RET(org-insert-todo-heading)- Schedule and Deadline
C-c C-sto schedule a heading.C-c C-dto set a deadline<DATETIME REPEATER WARNING>date can be repeated with+N[ymwdh], and warned with-N[ymwdh].+is for repeat after done,++for repeat periodically.
habitmodule has to be enabled inorg-modulesto use:STYLE: habit.
9.2. Agenda View
g D(org-agenda-view-mode-dispatch) select the view formatAadd agendas to viewDtoggle diaryg j,g knext, previous itemg dgoto date*mark allU,M, unmark alluundo,rredoQquitaadd note to an agendamtoggle markxbulk action
S-<left>,S-<right>,H,Lshift the scheduled datepchange date with prompt
S-<up>,S-<down>,J,Kshift the priority
10. Org Capture  builtin
10.1. Template
Capture templates are stored in org-capture-templates variable as a list of template.
A template has format of (KEY DESC TYPE TARGET TEMPLATE PROPS).
Type
entryorg headingitemlist itemcheckitemtable-linenew line in the first tableplaintext
Target
(file PATH)at the beginning or end of the file(id ID)child or body of the entry(file+headline FILENAME HEADLINE)under the headline(file+olp FILENAME HEADING SUBHEADING ...)full path to the heading(file+regexp FILENAME REGEXP)regexp to the position(file+function FILENAME FUNCTION)function to find the position(function FUNCTION)function to visit the file and move the point- Use
(set-buffer (find-file-noselect FILE))in order to not show the buffer. (org-capture-put :new-buffer t)is not set by default, which is responsible for killing the buffer with:kill-buffer toption.
- Use
Template
Template can be given as a string,
or as a file with (file PATH), or as an output of a function (function FUNCTION).
Following expansions can be used:
%[FILE]insert the content ofFILE%(EXP)evaluate elispEXP%<FORMAT>format-time-stringofFORMAT%:KEYWORDspecific keywords depending on it is captured%tdate,%Tdate and time,%uand%Uinactive timestamp%icontent of the selected region%aannotation, nomally fromorg-store-link%^{PROMPT}prompt the user and replace this%^{PROP}pprompt the user for the propertyPROP%?move point here
Properties
:kill-buffer tkill the capture target buffer after capture completion:unnarrowed tdo not narrow:empty-lines NinsertNnewlines before and after the capture
11. Org Roam
Wrapper of Org Capture with more convenience.
The files are hashed into SQL database, stored in ~/.emacs.d/org-roam.db.
org-roam-db-syncandorg-roam-db-autosync-modeto update the database
11.1. Template
The templates are defined in the variable org-roam-capture-templates.
A template looks like (KEY DESC TYPE TEMPLATE :target TARGET PROPS)
Templates
The org-capture template syntax can be used.
It can also be (file FILEPATH) to externally load the content.
A new expansion is added which can work within the filename.
${foo}expansion dispatcher- call the function
foowith the current node as its argument - call
org-roam-node-foowith the current node as its argument - look up
org-roam-capture--infoforfoo - read a string using
completion-read. Default value can be provided with${foo=default}
- call the function
Properties The org-capture properties can be used.
:targetspecifies the target(file+head FILE HEADING)replaces thefile+headlinein org capture
11.2. Keybindings
C-c n ddaily note for todayC-c n ccapture nodeC-c n iinsert node
12. Org Journal
org-journal-dirdirectory to store the journal filesorg-journal-new-entryinsert new entry under the daily heading
org-journal-file-type other than daily seems to be broken,
as it does not recognize the CREATED property of the daily heading.
13. Org Drill
The org topic with :drill: tag will be used as a drill item.
14. Org Cliplink
Automatic insertion of title of the hyperlink
It provides org-cliplink and org-cliplink-capture, which is recommended to be bound to <C-x> p i.
15. org-special-block-extras
Enable the definition of custom blocks and links
16. Export and Publish
C-c C-eto export.- Use
org-publish-project-alistto publish project-wise.
17. Configuration
18. References
- Org mode for GNU Emacs
- Setting Tags (The Org Manual)
- Document Structure (The Org Manual)
- Images (The Org Manual)
- Tracking TODO state changes (The Org Manual)
- Tables (The Org Manual)
- Capture (The Org Manual)
- Template expansion (The Org Manual)
- Org Roam: The Best Way to Keep a Journal in Emacs - YouTube
- Org-roam User Manual
- org-drill.el - flashcards and spaced repetition for org-mode
- GitHub - rexim/org-cliplink: Insert org-mode links from clipboard
- org-special-block-extras
- Publishing (The Org Manual)