Framework | Org mode 9 |
Bug tracker | https://github.com/fniessen/refcard-org-mode/issues |
Source | https://github.com/fniessen/refcard-org-mode |
To locally insert the TOC at some random place, use the #+TOC: headlines [n]
feature; for example:
#+DESCRIPTION: This document catalogs a set of tips and tricks for composing documents in Org mode.
#+KEYWORDS: org-mode, syntax, quick reference, cheat sheet, recommended practices, latex, beamer, html
#+LANGUAGE: en
Esto es un ejemplo de bloque org-mode
#+TOC: figures
is not implemented yet in the HTML backend.
#+TOC: tables
is already implemented in the HTML backend.
A single newline has no effect.
This line is part of the same paragraph.
But an empty line
demarcates paragraphs.
By entering two consecutive backslashes, \\
you can force a line break
without starting a new paragraph.
For an horizontal line, insert at least 5 dashes: this is some text above an horizontal rule
and some text below it.
Text effects.
Emphasize (italics), strongly (bold), and /very strongly/ (bold italics).
Markup elements can be nested:
This is italic text which contains _underlined text_ within it, whereas this is normal underlined text.
Markup can span across multiple lines, by default no more than 2:
*This is not bold.*
Other elements to use sparingly are:
- monospaced typewriter font for
inline code
- monospaced typewriter font for
verbatim text
deleted text(vs. inserted text)- text with superscript, such as 210
- text with subscript, such as H2O
If the XXX option is specified, Org mode will produce typographically correct
output, converting straight quotes to curly quotes, ---
to em-dashes, --
to
en-dashes, and ...
to ellipses.
Org markup allows you to create bulleted or numbered lists. It allows any combination of the two list types.
- Item with some lengthy text wrapping hopefully across several lines. We add a few words to really show the line wrapping.
- Bullet.
- Bullet.
- Bullet.
- Bullet.
- [X] Checked.
- [-] Half-checked.
- [ ] Not checked.
- Normal list item.
Enumerated lists are marked with numbers or letters:
- Arabic (decimal) numbered list item. We add a few words to show the line wrapping. A. Upper case alpha (letter) numbered list item. a. Lower alpha. b. Lower alpha. B. Upper alpha.
- Number.
You can have ordered lists with jumping numbers:
- We start with point number 2.
- Automatically numbered item.
Labeled, multi-line lists.
- First term to define
- Definition of the first term. We add a few words to show the line wrapping, to see what happens when you have long lines.
- Second term
-
Explication of the second term with inline markup.
In many paragraphs.
Adjacent lists sometimes like to fuse. To force the start of a new list, offset the two lists by an empty line comment:
- apples
- oranges
- bananas
- carrots
- tomatoes
- celery
Tables are one of the most refined areas of the Org mode syntax. They are very easy to create and to read.
Cell in column 1, row 1 | Cell in column 2, row 1 |
Cell in column 1, row 2 | Cell in column 2, row 2 |
Columns are automatically aligned:
- Number-rich columns to the right, and
- String-rich columns to the left.
If you want to override the automatic alignment, use <r>
, <c>
or <l>
.
<r> | <c> | <l> |
1 | 2 | 3 |
Right | Center | Left |
xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
Name of column 1 | Name of column 2 | Name of column 3 |
---|---|---|
Top left | Top middle | |
Right | ||
Bottom left | Bottom middle |
To test “sticky table headers”…
Name of column 1 | Name of column 2 | Name of column 3 |
---|---|---|
Top left | Top middle | |
2 | ||
3 | ||
4 | ||
5 | ||
6 | ||
7 | ||
8 | ||
9 | ||
10 | ||
11 | ||
12 | ||
13 | ||
14 | ||
15 | Right | |
16 | ||
17 | ||
18 | ||
19 | ||
20 | ||
21 | ||
22 | ||
23 | ||
24 | ||
25 | ||
26 | ||
27 | ||
28 | ||
29 | ||
Bottom left | Bottom middle |
a | b |
1 | 2 |
* Links
:PROPERTIES:
:CUSTOM_ID: links
:END:
This document is available in plain text, HTML and PDF.
The links are delimited by double square brackets.
See http://www.pirilampo.org (automatic!) and the Org mode Web site.
Clicking on the image leads to the Org mode home page.
Anchors are used to specify hypertext link targets.
<<anchor>> Inline anchors make arbitrary content referenceable.
Links generally point to an headline.
See chapter Links.
To add a link to a figure (e.g., “See Figure 1”), just do:
See figure fig.
You can also create a hypertext link to a document anchor in the current document or in another document.
See:
- Location cross reference.
You can insert image files of different formats to a document:
HTML | ||
---|---|---|
gif | yes | |
jpeg | yes | |
png | yes | |
bmp | (depends on browser support) |
Click to see the Unicorn picture.
images/mansografico.png
XXX Available HTML image tags include …
Attribute | Value(s) |
---|---|
:alt | Alternate text |
:height | |
:width | User defined size in pixels |
:align | |
:border | |
:bordercolor | |
:hspace | |
:vspace | |
:title | User defined text |
#+ATTR_LaTeX: :width 0.25\linewidth
[[file:images/org-mode-icon.jpg]]
Place images side by side: XXX
Videos can’t be added directly.
Though, you can add an image with a link to the video like this:
[[http://www.youtube.com/watch?v=DnSGSiXYuOk][file:../bigblow.png]]
Admonitions (contextual backgrounds) are statements taken out of the content’s flow and labeled with a title.
Common admonitions are:
note
warning
tip
caution
important
(Most themes style only note
and warning
specially.)
Total | docutils | rST | RTD | AsciiDoc | DocBook | MoinMoin (Modern) | Bootstrap | DocOnce | Confluence | SuperCollider | |
---|---|---|---|---|---|---|---|---|---|---|---|
7 | note | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | ||
9 | warning | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
7 | tip | 1 | 1 | 1 | 1 | 1 | 1 | 1 | |||
6 | caution | 1 | 1 | 1 | 1 | 1 | 1 | ||||
6 | important | 1 | 1 | 1 | 1 | 1 | 1 | ||||
3 | attention | 1 | 1 | 1 | |||||||
3 | hint | 1 | 1 | 1 | |||||||
3 | error | 1 | 1 | 1 | |||||||
4 | danger | 1 | 1 | 1 | 1 | ||||||
#ERROR | seealso | ? | |||||||||
#ERROR | todo | ? | |||||||||
2 | info | 1 | 1 | ||||||||
1 | notice | 1 | |||||||||
1 | question | 1 | |||||||||
1 | summary | 1 | |||||||||
1 | success | 1 |
A warning box is displayed as follows:
A tip box is displayed as follows:
This text is
centered!
You can have example
blocks.
: 10/17/97 9:04 <DIR> bin
: 10/16/97 14:11 <DIR> DOS
: 10/16/97 14:46 <DIR> TEMP
: 10/16/97 14:37 <DIR> WINNT
: 10/16/97 14:25 119 AUTOEXEC.BAT
: 2/13/94 6:21 54,619 COMMAND.COM
or
10/17/97 9:04 <DIR> bin 10/16/97 14:11 <DIR> DOS 10/16/97 14:46 <DIR> TEMP 10/16/97 14:37 <DIR> WINNT 10/16/97 14:25 119 AUTOEXEC.BAT 2/13/94 6:21 54,619 COMMAND.COM
Use the quote
block for content that doesn’t require the preservation of line
breaks.
Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.
The practitioner of literate programming can be regarded as an essayist, whose main concern is with exposition and excellence of style. Such an author, with thesaurus in hand, chooses the names of variables carefully and explains what each variable means. He or she strives for a program that is comprehensible because its concepts have been introduced in an order that is best for human understanding, using a mixture of formal and informal methods that reinforce each other.
– Donald Knuth
In a verse
environment, there is an implicit line break at the end of each line,
and indentation is preserved:
Typically used for quoting passages of an email message:
It's possible to add comments in the document.
# This Org comment here won't be displayed.
#+MACRO: longtext this very very long text
Insert {{{longtext}}} wherever required.
Insert {{{longtext}}} wherever required.
#+MACRO: color @@html:<span style="color: $1">$2</span>@@
{{{color(blue, This text is colored in blue.)}}}
{{{color(red, This other text is in red.)}}}
A continuación el mismo ejemplo anterior, fuera del bloque:
{{{color(blue, This text is colored in blue.)}}}
{{{color(red, This other text is in red.)}}}
Find more macros on GitHub.
We also use substitutions to include some of the widely used Unicode characters (like ©, converted from text characters to its typographically correct entity).
- \Agrave \Aacute
- Dash: \ndash \mdash
- Marks: \iexcl \iquest
- Quotations: \laquo \raquo
- Miscellaneous: \para \ordf
- Property marks: \copy \reg
- Currency: \cent \EUR \yen \pound
The Greek letters \alpha, \beta, and \gamma are used to denote angles.
- Science: \pm \div
- Arrows: \to \rarr \larr \harr \rArr \lArr \hArr
- Function names: \arccos \cos
- Signs and symbols: \bull \star
- Zero-width non-joiner: \zwnj
# Smilies: \smiley \sad
- Suits: \clubs \spades
Reference code like ~variables~ or ~functions~ inline.
You can also evaluate code inline as follows: 1 + 1 is src_python{1 + 1}.
The source code blocks support syntax highlighting:
Funciona en PDF, en HTML también pero exportado desde emacs. No con makefile
/*
* Application that displays a "Hello" message to the standard output.
*/
int main(int arc, char **argv)
{
printf("Hello, %s!\n", (argc>1) ? argv[1] : "World");
return 0;
}
(defvar hello "Hello")
(defun hello (name &optional greeting)
(message "%s %s" (or greeting "Hello") name))
(setq tab-width 4)
The following language strings are currently recognized:
Awk, C, R, Asymptote, Calc, Clojure, CSS, Ditaa, Dot, Emacs Lisp, Fortran, Gnuplot, Haskell, IO, J, Java, Javascript, LaTeX, Ledger, Lilypond, Lisp, Makefile, Maxima, Matlab, Mscgen, Ocaml, Octave, Org, Perl, Pico Lisp, PlantUML, Python, Ruby, Sass, Scala, Scheme, Screen, Shell Script, Shen, Sql, Sqlite, ebnf2ps.Notar que el resultado está dado por un bloque de elisp que consulta los modos de ob-babel habilitados
Code block with long lines:
testing testing testing testing testing testing testing testing testing testing
0 1 2 3 4 5 6 7 8 9
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456
For PDF (LaTeX), one solution is to surround the code block such as:
print("This block is in scriptsize")
testing testing testing testing testing testing testing testing testing testing
0 1 2 3 4 5 6 7 8 9
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456
Both in example
and in src
snippets, you can add a -n
switch to the end of the
begin
line to get the lines numbered:
(defun org-xor (a b)
"Exclusive or."
If you use a +n
switch, the numbering from the previous numbered snippet will
be continued in the current one:
(if a (not b) b))
Funciona en HTML, no en PDF.
In literal examples, Org will interpret strings like (ref:name)
as labels, and
use them as targets for special hyperlinks like [[(name)]]
(i.e., the reference
name enclosed in single parenthesis). In HTML, hovering the mouse over such
a link will remote-highlight the corresponding code line, which is kind of
cool.
You can also add a -r
switch which removes the labels from the source code.
With the -n
switch, links to these references will be labeled by the line
numbers from the code listing, otherwise links will use the labels with no
parentheses. Here is an example:
(save-excursion ; (ref:sc)
(goto-char (point-min))) ; (ref:jump)
In line (sc), we remember the current position. Line (jump) jumps to
point-min
.
Funciona en HTML solamente
You can embed LaTeX math formatting in Org mode files.
For inline math expressions, use the parentheses notation \(...\)
:
The formula \(a^2 + b^2 = c^2\) has been discovered by Pythagoras.
Let \(a=\sin(x) + \cos(x)\). Then \(a^2 = 2\sin(x)\cos(x)\) because \(\sin^2x +
\cos^2x = 1\).
For mathematical expressions which you want to make stand out, centered on their
own lines, use \[...\]
:
The /Euler theorem/:
\[
\int_0^\infty e^{-x^2} dx = {{\sqrt{\pi}} \over {2}}
\]
LaTeX allows to inline such ~\[...\]~ constructs (/quadratic formula/):
\[ \frac{-b \pm \sqrt{b^2 - 4 a c}}{2a} \]
\[
\left( \int_{0}^{\infty} \frac{\sin x}{\sqrt x}\,\mathrm{d}x \
right)^{2} -
\prod_{k=1}^{\infty} \frac{4k^{2}}{4k^{2}-1} +
\frac{\lambda}{2n}\sum_{k=1} ^{n} \theta_{k} ^{2} x^{n} = 0
\]
The equation may be wrong, but it’s a nice one! Por algún motivo esto no exporta en PDF.
Differently from $...$
and \(...\)
, an equation environment produces a numbered
equation to which you can add a label and reference the equation by (label) name
in other parts of the text. This is not possibly with unnumbered math
environments ($$
, …).
The /Pythagoras theorem/:
#+name: pythag
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
See equation [[pythag]].
# The /sinus theorem/ can be written as the equation:
#
# \begin{equation}
# \label{eqn:sinalpha}
# \frac{\sin\alpha}{a}=\frac{\sin\beta}{b}
# \end{equation}
#
# See equation [[eqn:sinalpha]].
Only captioned equations are numbered.
Other alternatives: use
\begin{equation*}
or\begin{displaymath}
(= the verbose form of the\[...\]
construct).
M-q
does not fill those.
You can include another Org file and skip its title by using the :lines
argument
to #+INCLUDE
:
#+INCLUDE: "chapter1.org" :lines "2-"
You can include raw HTML in your Org documents and it will get kept as HTML when it’s exported.
It is especially useful for more advanced stuff like images or tables where you need more control of the HTML options than Org mode actually gives you.
Similarly, you can incorporate JS or do anything else you can do in a Web page (such as importing a CSS file).
You can create named classes (to get style control from your CSS) with:
#+begin_myclass This text is wrapped in a myclass DIV... #+end_myclass
You can also add interactive elements to the HTML such as interactive R plots.
Finally, you can include an HTML file verbatim (during export) with:
#+INCLUDE: "file.html" export html
Don’t edit the exported HTML file!
You can also use raw LaTeX. XXX
Text can be preformatted (in a fixed-width font).
It is possible to define named footnotes[fn:myfootnote], or ones with automatic
anchors[fn:2].
To enable the Graphviz extension, we have to add it to the extensions list in
the org-babel-load-languages
variable.
(add-to-list 'org-babel-load-languages '(dot . t))
(org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages)
It uses directly the dot
command to process DOT language.
#+begin_src dot :file images/graph.png :cmdline -Tpng
graph foo {
"bar" -- "baz";
}
#+end_src
The output from the execution of programs, scripts or commands can be inserted in the document itself, allowing you to work in the reproducible research mindset.
To enable the Graphviz extension, we have to add it to the extensions list in
the org-babel-load-languages
variable.
Data to be charted:
Month | Degrees |
---|---|
01 | 3.8 |
02 | 4.1 |
03 | 6.3 |
04 | 9.0 |
05 | 11.9 |
06 | 15.1 |
07 | 17.1 |
08 | 17.4 |
09 | 15.7 |
10 | 11.8 |
11 | 7.7 |
12 | 4.8 |
Code:
images/mansografico.png
The resulting chart:
Special sections.
Index (or list of acronyms).
- Write index entries
Note that multi-entry terms generate separate index entries.
- Place the index at the desired location
- Produce the index by updating
org-latex-pdf-process
The bibliography…
- Eric Steven Raymond. The Art of Unix Programming. Addison-Wesley. ISBN 0-13-142901-9.
Glossaries are optional. Glossaries entries are an example of Definition lists
- A glossary term
- The corresponding (indented) definition.
- A second glossary term
- The corresponding (indented) definition.
Copyright (C) 2014-2017 Fabrice Niessen.
Author: Fabrice Niessen
Keywords: org-mode refcard
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
[fn:myfootnote] Extensively used in large documents.
[fn:2] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.