Org Mode
Table of Contents
Settings
#+TITLE: Org Document Settings Cheatsheet
#+AUTHOR: Yeongho Kim
#+EMAIL: yeonghoey@gmail.com
#+DESCRIPTION: a description
#+KEYWORDS: org
#+LANGUAGE: en
#+OPTIONS: H:4 (section numbering)
#+OPTIONS: num:nil (no number)
#+OPTIONS: toc:2 (only inlcude two levels in TOC)
#+OPTIONS: toc:nil (no default TOC at all)
#+TOC: headlines 2 (insert TOC here)
#+TOC: headlines 1 local (insert local TOC, direct children only)
#+TOC: listings (build a list of listings)
#+TOC: tables (build a list of tables)
#+INCLUDE: "~/.emacs" src emacs-lisp
#+INCLUDE: "~/my-book/chapter2.org" :minlevel 1
#+INCLUDE: "~/.emacs" :lines "5-10" [5 to 10)
#+INCLUDE: "~/.emacs" :lines "-10" [1 to 10)
#+INCLUDE: "~/.emacs" :lines "10-" [10 to EOF)
#+INCLUDE: "./paper.org::#theory" :only-contents t (custom-id)
#+INCLUDE: "./paper.org::mytable" (named element)
#+INCLUDE: "./paper.org::*conclusion" :lines 1-20 (headline named 'conclusion')
#+MACRO: name replacement text $1, $2 are arguments
{{{name(arg1, arg2)}}}
{{{title}}}
{{{author}}}
{{{email}}}
{{{date}}}
{{{date(FORMAT)}}}
{{{time(FORMAT)}}}
{{{modification-time(FORMAT, VC)}}}
{{{input-file}}}
{{{property(PROPERTY-NAME)}}}
{{{property(PROPERTY-NAME,SEARCH-OPTION)}}}
* Goldberg Variations
:PROPERTIES:
:Title: Goldberg Variations
:Composer: J.S. Bach
:Artist: Glen Gould
:Publisher: Deutsche Grammophon
:NDisks: 1
:END:
#+OPTIONS: ':t
#+OPTIONS: author:nil
#+OPTIONS: num:nil
#+OPTIONS: email:nil
#+OPTIONS: date:nil
#+OPTIONS: ':t author:nil date:nil email:nil num:nil
Omitting #+TITLE
If you are exporting only a subtree, *its heading will become the title of the document. If the subtree has a property EXPORTTITLE, that will take precedence.
Markup
* 1st level heading
** this is 2nd level heading
*** this is 3rd level heading
*bold*
/italic/
_underlined_
=verbatim=
~code~
+strike-through+
X_{subscript}, X^{superscript}
Hello, \\ (enforce line break within a paragraph)
World.
- 1st item
* another item
+ and 3rd item :: this is a description
1. 1st item
2) another item
20. [@20] Test
21. xargs
22. bcadf
[[http://example.com/]]
[[http://example.com/][description]]
-----
(a horizontal rule, 5 or more only dashes)
#+BEGIN_EXAMPLE
verbatime example
#+END_EXAMPLE
#+BEGIN_SOURCE python
print 'hello, world!'
#+END+SOURCE
: a single line example
: can be indented
(start the example lines with a colon followed by a space.)
code(~~) vs verbatim(==)
- There are some differences in
Latex
related things, but identical others.
Can't stylize part of a word
Org-mode relies on heuristics to distinguish emphasis from normal text, and one of the most important parts of this heuristics method is assuming that emphasis is on whole words, delimited by whitespace or punctuation.
Easy Templates
s #+BEGIN_SRC ... #+END_SRC
e #+BEGIN_EXAMPLE ... #+END_EXAMPLE
q #+BEGIN_QUOTE ... #+END_QUOTE
v #+BEGIN_VERSE ... #+END_VERSE
c #+BEGIN_CENTER ... #+END_CENTER
l #+BEGIN_LaTeX ... #+END_LaTeX
L #+LaTeX:
h #+BEGIN_HTML ... #+END_HTML
H #+HTML:
a #+BEGIN_ASCII ... #+END_ASCII
A #+ASCII:
i #+INDEX: line
I #+INCLUDE: lin
Babel
For about #+BEGIN_SRC
, see ./babel
LaTeX
When using LaTex as a part of documentations which will be exported some other forms like html
and the like, use /org-babel/latex instead of native org-mode's LaTeX supprot.
#+LATEX: any arbitrary LaTeX code
---
<l + <TAB>
#+BEGIN_EXPORT latex
any arbitrary LaTeX code
#+END_EXPORT
- LaTex fragments
- Just put latex code preview with
org-toggle-latex-fragment
, T x
orC-c C-x C-l
- This won't be exported.
\begin{equation}
x=\sqrt{b}
\end{equation}
Export
#+OPTIONS: author:nil html-postamble:nil num:nil timestamp:nil toc:nil
,,#+CAPTION: A black cat stalking a spider
,,#+ATTR_HTML: :alt cat/spider image :title Action! :align right
[[./img/a.jpg]]
- https://github.com/yyr/org-mode/blob/master/lisp/ox-html.el#L807
- https://emacs.stackexchange.com/questions/7629/the-syntax-highlight-and-indentation-of-source-code-block-in-exported-html-file
org-html-htmlize-output-type
is inline-css
by default, which generates css
for code formatting based on th current editor color theme. To customize for editor free exporting, set it to css
like above and specify your custom css
Image
#+ATTR_HTML: width="100px"
#+ATTR_ORG: :width 100
[[~/images/example.jpg]]
Agenda
<2006-11-01 Wed>
[2006-11-01 Wed] # inactive timestamps, they do not trigger an entry to show up in the agenda.
Capture
(setq-default
org-capture-templates `(("c" "Create a task"
entry (file+headline ,my-org-inbox "Inbox")
"* TODO %t %?"
:empty-lines 1)
)
Add-ons
toc-org
:TOC_2:
:TOC_2_gh: (github style, [[#heading][heading]])
:TOC_2_org: (org style, [[heading][heading]])
org-reveal
, e R B
to generate and preview#+REVEAL_ROOT: http://cdn.jsdelivr.net/reveal.js/3.0.0/
#+REVEAL_THEME: <theme>
:: reveal.js/css/theme
ox-twbs
- Export org as HTML compatible with Twitter Bootstrap.
- I tried to use this, but there were some inconsistencies. I don't use it now.
- Some colors are indistinguishable.
- Image links are broken if I segregate htmls from orgs