1
0
mirror of https://github.com/fniessen/org-html-themes.git synced 2024-07-15 10:34:24 +02:00
org-html-themes/demo/org-mode-syntax.org

1364 lines
33 KiB
Org Mode
Raw Normal View History

2015-02-26 11:39:35 +01:00
#+TITLE: Org mode syntax quick reference
2015-02-24 12:08:13 +01:00
#+AUTHOR: Fabrice Niessen
#+EMAIL: fniessen@pirilampo.org
#+DESCRIPTION: Org mode syntax example
2015-02-27 17:21:33 +01:00
#+KEYWORDS: org-mode, syntax, quick reference, cheat sheet, recommended practices, latex, beamer, html
2015-02-24 12:08:13 +01:00
#+LANGUAGE: en
2015-02-27 17:21:33 +01:00
#+OPTIONS: H:4 num:nil toc:2 p:t
2015-02-24 12:08:13 +01:00
2015-02-25 16:26:59 +01:00
#+HTML_LINK_HOME: http://www.google.com
#+HTML_LINK_UP: http://www.bing.com
2015-02-27 12:09:39 +01:00
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="d:/Users/fni/src/org-html-themes/styles/readtheorg/rtd.css"/>
2015-03-02 09:23:20 +01:00
# #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/rtd.css"/>
#+HTML_HEAD: <script type="text/javascript" src="http://www.pirilampo.org/styles/bigblow/js/jquery-1.11.0.min.js"></script>
2015-02-25 16:26:59 +01:00
#+HTML_HEAD: <script type="text/javascript" src="d:/Users/fni/src/org-html-themes/styles/readtheorg/rtd.js"></script>
2015-03-02 09:23:20 +01:00
# #+HTML_HEAD: <script type="text/javascript" src="http://www.pirilampo.org/styles/readtheorg/js/rtd.js"></script>
2015-02-26 10:15:13 +01:00
# #+SETUPFILE: ~/src/org-style/setup/bigblow-local-abs.setup
2015-02-24 12:08:13 +01:00
2015-02-26 10:15:13 +01:00
#+PROPERTY: eval yes
#+PROPERTY: exports both
#+PROPERTY: results replace
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
# #+MACRO: longtext this is a very very long text to include
2015-03-02 09:23:20 +01:00
This is an Org mode document, using the ~.org~ extension (supported by GitHub).
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
*Org mode* is an easy-to-write /plain text/ formatting syntax for authoring notes,
articles, LaTeX documents, books, Web pages, Beamer slide decks and much more!
2015-02-24 12:08:13 +01:00
2015-02-27 17:21:33 +01:00
* Abstract
2015-03-02 09:23:20 +01:00
This is a cheat sheet for *Org mode 8* (because of some markup syntax changes
since Org mode 7), using [[https://github.com/fniessen/org-html-themes][ReadTheOrg CSS]].
2015-02-27 17:21:33 +01:00
2015-03-02 09:23:20 +01:00
Reading through all the documentation is highly recommended, but for the truly
impatient, following are some quick steps to get started.
2015-02-27 17:21:33 +01:00
2015-03-02 12:36:04 +01:00
# See http://asciidoctor.org/docs/user-manual/#the-big-picture
2015-02-26 10:15:13 +01:00
* Document header
2015-02-24 12:08:13 +01:00
2015-02-26 10:15:13 +01:00
Title and author line:
#+begin_src org :eval never-export
,#+TITLE: Org mode syntax example
,#+AUTHOR: Fabrice Niessen
My document provides...
#+end_src
2015-02-27 17:21:33 +01:00
It's a good practice to also include an email line following the author line.
#+begin_src org :eval never-export
,#+EMAIL: john.doe@example.com
#+end_src
* Document settings
** Document description
#+begin_src org :eval never-export
#+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
#+end_src
** Section numbering
#+begin_src org :eval never-export
#+OPTIONS: H:4
#+end_src
#+begin_src org :eval never-export
#+OPTIONS: num:nil
#+end_src
** Table of contents
Set the ~toc~ attribute to activate an auto-generated table of contents (limited
to its 2 first levels) at the top of document.
#+begin_src org :eval never-export
#+OPTIONS: toc:2
#+end_src
#+begin_src org :eval never-export
#+OPTIONS: p:t
#+end_src
2015-02-26 10:15:13 +01:00
2015-03-04 12:03:40 +01:00
~#+TOC: figures~ is not implemented yet in the HMTL backend (though ~#+TOC: tables~
is).
2015-02-26 10:15:13 +01:00
* Section titles (headings)
#+begin_src org
,* Biggest heading (level 1)
2015-02-24 12:08:13 +01:00
New chapter.
2015-02-26 10:15:13 +01:00
,** Bigger heading (level 2)
2015-02-24 12:08:13 +01:00
New section.
2015-02-26 10:15:13 +01:00
,*** Big heading (level 3)
2015-02-24 12:08:13 +01:00
New sub-section.
2015-02-26 10:15:13 +01:00
,**** Heading (level 4)
New sub-sub-section.
#+end_src
** Numbered headings
You can create numbered headings up to a certain level by setting an option:
2015-02-24 12:08:13 +01:00
2015-02-26 10:15:13 +01:00
#+begin_src org
,#+OPTIONS: H:4
#+end_src
* Paragraphs
** Normal
#+begin_src org
2015-02-24 12:08:13 +01:00
A single newline has no effect.
This line is part of the same paragraph.
But an empty line
demarcates paragraphs.
2015-02-26 10:15:13 +01:00
#+end_src
** Line breaks
2015-02-24 12:08:13 +01:00
2015-02-26 10:15:13 +01:00
#+begin_src org
2015-02-27 12:09:39 +01:00
By entering two consecutive backslashes, \\
you can force to break lines
2015-02-24 12:08:13 +01:00
without starting a new paragraph.
2015-02-26 10:15:13 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-26 10:15:13 +01:00
** Horizontal rules
#+begin_src org
2015-02-24 12:08:13 +01:00
For an horizontal line, insert at least 5 dashes: this is some text above an
horizontal rule
-----
and some text below it.
#+end_src
2015-02-26 10:15:13 +01:00
** Text width
2015-02-24 12:08:13 +01:00
# Premiere Elements, page 111
#
# Vous pouvez créer ces objets en cliquant sur le bouton Nouvel| élément de le
# fenêtre Média. (Le Chapitre 14 explique comment créer| des titres ; le
# Chapitre 15 montre l'utilisation des barres et ton, de la| vidéo noir et de
# l'amorce SMPTE.)
#
# The principles of beautiful Web design, page 6
#
# In a figurative sense, the concept of visual balance is similar to that of
# physical balance| illustrated by a seesaw. Just as physical objects have
# weight, so do the elements of a layout.| If the elements on either side of a
# layout are of equal weight, they balance one another.| There are two main forms
# of visual balance: symmetrical and asymmetrical.
One morning, when Gregor Samsa woke from troubled dreams, he found himself
transformed in his bed into a horrible vermin. He lay on his armour-like back,
and if he lifted his head a little he could see his brown belly, slightly domed
and divided by arches into stiff sections. The bedding was hardly able to cover
it and seemed ready to slide off any moment. His many legs, pitifully thin
compared with the size of the rest of him, waved about helplessly as he looked.
2015-02-26 11:39:35 +01:00
* Formatting text
Text effects.
** Bold and italic
#+begin_src org
/Emphasize/ (italics), *strongly* (bold), and */very strongly/* (bold italics).
#+end_src
2015-02-27 17:21:33 +01:00
Markup elements can be nested:
2015-02-26 11:39:35 +01:00
#+begin_src org
This is /italic text which contains _underlined text_ within it/, whereas _this is
normal underlined text_.
#+end_src
Markup can span across multiple lines, by default *no more than 2*:
#+begin_src org
*This
is not
2015-02-27 17:21:33 +01:00
bold.*
2015-02-26 11:39:35 +01:00
#+end_src
** Monospace, superscript and subscript
Other elements to use sparingly are:
#+begin_src org
- monospaced typewriter font for ~inline code~
- monospaced typewriter font for =verbatim text=
- +deleted+ text (vs. _inserted_ text)
- text with super^{script} (for example: ~m/s^{2}~ gives m/s^{2})
- text with sub_{script}
#+end_src
2015-02-26 10:15:13 +01:00
* Lists
2015-02-24 12:08:13 +01:00
2015-02-26 10:15:13 +01:00
Org markup allows you to create *bulleted* or *numbered* lists. It allows any
2015-02-24 12:08:13 +01:00
combination of the two list types.
2015-02-26 10:15:13 +01:00
** Unordered lists
2015-02-24 12:08:13 +01:00
2015-02-26 10:15:13 +01:00
Itemized lists are marked with bullets. Create them with a minus or a plus sign.
2015-02-24 12:08:13 +01:00
2015-02-27 17:21:33 +01:00
They are convenient to organize data, and make the document prettier, and easier
to read.
2015-02-24 12:08:13 +01:00
2015-02-26 10:15:13 +01:00
#+begin_src org
2015-02-27 17:21:33 +01:00
- Item with some lengthy text wrapping hopefully across several lines. We add
a few words to really show the line wrapping.
- Bullet.
+ Bullet.
* Bullet.
2015-02-26 10:15:13 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-26 10:15:13 +01:00
** Checklists
#+begin_src org
2015-02-27 17:21:33 +01:00
- [X] Checked.
- [-] Half-checked.
- [ ] Not checked.
- Normal list item.
2015-02-26 10:15:13 +01:00
#+end_src
** Ordered lists
2015-02-24 12:08:13 +01:00
Enumerated lists are marked with numbers or letters:
2015-02-26 10:15:13 +01:00
#+begin_src org
2015-02-27 17:21:33 +01:00
1. 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.
2. Number.
2015-02-26 10:15:13 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
You can have ordered lists with jumping numbers:
2015-02-26 10:15:13 +01:00
#+begin_src org
2015-02-27 17:21:33 +01:00
2. [@2] We start with point number 2.
3. Automatically numbered item.
2015-02-26 10:15:13 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-26 10:15:13 +01:00
** Definition lists
2015-02-24 12:08:13 +01:00
2015-02-26 10:15:13 +01:00
Labeled, multi-line lists.
2015-02-24 12:08:13 +01:00
2015-02-26 10:15:13 +01:00
#+begin_src org
- First term to define ::
2015-02-27 17:21:33 +01:00
Definition of the first term. We add a few words to show the line wrapping,
to see what happens when you have long lines.
2015-02-26 10:15:13 +01:00
- Second term ::
Explication of the second term.
2015-02-27 17:21:33 +01:00
In many paragraphs.
#+end_src
** Separating lists
Adjacent lists sometimes like to fuse. To force the start of a new list, offset
the two lists by an empty line comment:
#+begin_src org
- apples
- oranges
- bananas
# Comment.
- carrots
- tomatoes
- celery
2015-02-26 10:15:13 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
* Tables
Tables are one of the most refined areas of the Org mode syntax. They are very easy
to create and to read.
** Simple table
#+begin_src org
| Cell in column 1, row 1 | Cell in column 2, row 1 |
| Cell in column 1, row 2 | Cell in column 2, row 2 |
#+end_src
** Column formatting
Columns are automatically aligned:
- Number-rich columns to the right, and
- String-rich columns to the left.
*** Table with aligned cells
If you want to override the automatic alignment, use ~<r>~, ~<c>~ or ~<l>~.
#+begin_src org
,#+CAPTION: Table with aligned columns
| <r> | <c> | <l> |
| 1 | 2 | 3 |
| Right | Center | Left |
| xxxxxxxxxxxx | xxxxxxxxxxxx | xxxxxxxxxxxx |
#+end_src
*** Table with column size adjusted
** Header row
You can create tables with an header row (by using an horizontal line of dashes
to separate it from the rest of the table).
#+begin_src org
2015-02-27 17:21:33 +01:00
#+CAPTION: Table with an header row
2015-02-27 12:09:39 +01:00
| Name of column 1 | Name of column 2 | Name of column 3 |
|------------------+------------------+------------------|
| Top left | Top middle | |
| | | Right |
| Bottom left | Bottom middle | |
#+end_src
** Table placement
#+begin_src org
#+ATTR_LATEX: :center nil
| a | b |
| 1 | 2 |
#+end_src
XXX Different from the following:
#+begin_src org
| a | b |
| 1 | 2 |
#+end_src
** Align tables on the page
2015-02-27 17:21:33 +01:00
*** Left
2015-02-27 12:09:39 +01:00
Here is a table on the left side:
#+begin_src org
,#+LATEX: \noindent
,#+ATTR_LATEX: :center nil
| a | b | c |
|---+---+---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
,#+LATEX: \hfill
#+end_src
2015-02-27 17:21:33 +01:00
The ~noindent~ just gets rid of the indentation of the first line of a paragraph
which in this case is the table. The ~hfill~ adds infinite stretch after the
2015-02-27 12:09:39 +01:00
table, so it pushes the table to the left.
2015-02-27 17:21:33 +01:00
*** Center
2015-02-27 12:09:39 +01:00
Here is a centered table:
#+begin_src org
| a | b | c |
|---+---+---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
#+end_src
2015-02-27 17:21:33 +01:00
*** Right
2015-02-27 12:09:39 +01:00
And here's a table on the right side:
#+begin_src org
#+LATEX: \hfill
#+ATTR_LATEX: :center nil
| a | b | c |
|---+---+---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
#+end_src
2015-02-27 17:21:33 +01:00
Here the ~hfill~ adds infinite stretch before the table, so it pushes the table
2015-02-27 12:09:39 +01:00
to the right.
** Table size
#+begin_src org
#+ATTR_HTML: :width 100%
| Cell in column 1, row 1 | Cell in column 2, row 1 |
| Cell in column 1, row 2 | Cell in column 2, row 2 |
#+end_src
2015-02-27 17:21:33 +01:00
* CSV
You can fill table from CSV file using R commands.
2015-02-26 11:39:35 +01:00
* Links
:PROPERTIES:
:CUSTOM_ID: links
:END:
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
This document is available in [[file:org-mode-syntax.org][plain text]], [[file:org-mode-syntax.html][HTML]] and [[file:org-mode-syntax.pdf][PDF]].
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
The links are delimited by ~[square brackets]~.
** External links
2015-02-24 12:08:13 +01:00
#+begin_src org
2015-02-26 11:39:35 +01:00
See http://www.pirilampo.org (automatic!) and the
[[http://orgmode.org/][Org mode Web site]].
2015-02-24 12:08:13 +01:00
#+end_src
2015-03-04 12:11:46 +01:00
# Clicking on the image [[http://orgmode.org/][file:images/org-mode-unicorn.png]] leads to the Org mode
# home page.
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
*** Relative links
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
#+begin_src org
2015-02-27 12:09:39 +01:00
[[../README.html][Home]]
2015-02-26 11:39:35 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
*** Email links
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
#+begin_src org
2015-02-27 17:21:33 +01:00
[[mailto:john.doe@example.com][email John Doe]]
2015-02-26 11:39:35 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
** Internal links
:PROPERTIES:
:ID: 0d2b0cb2-116c-4a61-a076-4c641faf4346
:END:
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
*** Inline anchors
2015-02-24 12:08:13 +01:00
2015-02-27 17:21:33 +01:00
Anchors are used to specify hypertext link targets.
2015-02-26 11:39:35 +01:00
#+begin_src org
<<anchor>> Inline anchors make arbitrary content referenceable.
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
*** Internal cross references
Links generally point to an headline.
2015-02-27 17:21:33 +01:00
#+begin_src org
See chapter [[#links][Links]].
#+end_src
You can also create a hypertext link to a document anchor in the current
2015-03-02 09:23:20 +01:00
document /or in another document/.
2015-02-24 12:08:13 +01:00
#+begin_src org
2015-02-26 11:39:35 +01:00
See:
2015-02-27 17:21:33 +01:00
- Location [[anchor][cross reference]].
- Section [[id:0d2b0cb2-116c-4a61-a076-4c641faf4346][Internal links]]
2015-02-24 12:08:13 +01:00
#+end_src
2015-02-27 17:21:33 +01:00
** Extensions that define new hyperlinks targets
2015-02-26 11:39:35 +01:00
* Images
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
You can insert *image* files of different *formats* to a document:
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
| | HTML | PDF |
|------+------------------------------+-----|
| gif | yes | |
| jpeg | yes | |
| png | yes | |
| bmp | (depends on browser support) | |
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
** Inline picture
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
#+begin_src org
#+CAPTION: Org mode logo
2015-03-04 12:11:46 +01:00
[[file:images/org-mode-unicorn.png]]
2015-02-26 11:39:35 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
#+begin_src org
2015-03-04 12:11:46 +01:00
Click to see the [[file:images/org-mode-unicorn.png][Unicorn picture]].
2015-02-26 11:39:35 +01:00
#+end_src
2015-02-25 16:26:59 +01:00
2015-03-02 09:23:20 +01:00
** Image alignment (using positioning)
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
Books usually align/float images on the right/left of the contents.
*** Image is left aligned
*** Image is right aligned
*** Image is centered
2015-02-26 11:39:35 +01:00
** Image attributes and values
2015-03-02 09:23:20 +01:00
XXX Available HTML image tags include ...
2015-02-27 12:09:39 +01:00
| Attribute | Value(s) |
|--------------+-----------------------------|
| ~:alt~ | Alternate text |
| ~:height~ | |
| ~:width~ | User defined size in pixels |
| ~:align~ | |
| ~:border~ | |
| ~:bordercolor~ | |
| ~:hspace~ | |
| ~:vspace~ | |
| ~:title~ | User defined text |
2015-02-26 11:39:35 +01:00
#+begin_src org
#+ATTR_LaTeX: :width 0.25\linewidth
2015-03-04 12:11:46 +01:00
[[file:images/org-mode-unicorn.png]]
2015-02-26 11:39:35 +01:00
#+end_src
Place images side by side: XXX
2015-03-02 09:23:20 +01:00
** Figures
To define images that will be *treated as book illustrations* (figures) and
automatically labeled and numbered, use XXX.
2015-02-26 11:39:35 +01:00
* Videos
Videos can't be added directly.
2015-02-27 17:21:33 +01:00
Though, you can add an image with a link to the video like this:
2015-02-26 11:39:35 +01:00
#+begin_src org
2015-02-27 12:09:39 +01:00
[[http://www.youtube.com/watch?v=DnSGSiXYuOk][file:../bigblow.png]]
2015-02-26 11:39:35 +01:00
#+end_src
2015-02-27 12:09:39 +01:00
* Admonitions
2015-02-26 10:15:13 +01:00
2015-03-05 22:57:19 +01:00
Admonitions are statements taken out of the content's flow and labeled with
a title.
2015-02-26 10:15:13 +01:00
2015-03-05 22:57:19 +01:00
Common admonitions are:
2015-02-24 12:08:13 +01:00
2015-03-05 22:57:19 +01:00
1. ~note~
2. ~warning~
3. ~tip~
4. ~caution~
5. ~important~
2015-02-24 12:08:13 +01:00
2015-03-05 22:57:19 +01:00
(Most themes style only ~note~ and ~warning~ specially.)
2015-03-02 09:23:20 +01:00
2015-03-05 22:57:19 +01:00
** List of supported admonitions :noexport:
2015-02-27 17:21:33 +01:00
2015-03-04 12:03:40 +01:00
| Total | | rST | RTD | AsciiDoc | DocBook | MoinMoin (Modern) | DocOnce | Confluence | SuperCollider |
|--------+-----------+-----+-----+----------+---------+-------------------+---------+------------+---------------|
| 6 | note | 1 | 1 | 1 | 1 | 1 | | 1 | 1 |
| 7 | warning | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 6 | tip | 1 | 1 | 1 | 1 | 1 | | 1 | |
|--------+-----------+-----+-----+----------+---------+-------------------+---------+------------+---------------|
| 5 | important | 1 | 1 | 1 | 1 | 1 | | | |
| 5 | caution | 1 | 1 | 1 | 1 | 1 | | | |
|--------+-----------+-----+-----+----------+---------+-------------------+---------+------------+---------------|
| 2 | attention | 1 | 1 | | | | | | |
| 2 | danger | 1 | 1 | | | | | | |
| 2 | error | 1 | 1 | | | | | | |
| 2 | hint | 1 | 1 | | | | | | |
| #ERROR | seealso | | ? | | | | | | |
| #ERROR | todo | | ? | | | | | | |
| 1 | notice | | | | | | 1 | | |
| 1 | question | | | | | | 1 | | |
| 1 | summary | | | | | | 1 | | |
| 1 | info | | | | | | | 1 | |
#+TBLFM: $1=vsum($3..$9)
2015-02-27 17:21:33 +01:00
2015-02-27 12:09:39 +01:00
** Note
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
A note box is displayed as follows:
2015-02-24 12:08:13 +01:00
2015-03-05 22:57:19 +01:00
#+begin_src org
,#+begin_note
2015-02-27 12:09:39 +01:00
This is a useful note.
2015-03-05 22:57:19 +01:00
,#+end_note
#+end_src
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
# #+attr_html: :options [By the way...]
# #+begin_note
# This is a useful note (with a title).
# #+end_note
2015-03-05 22:57:19 +01:00
#+begin_src org
,#+begin_seealso
2015-02-27 12:09:39 +01:00
- [[http://en.wikipedia.org/wiki/Apple][Apples]] ::
A kind of [[http://en.wikipedia.org/wiki/Fruit][fruit]].
2015-03-05 22:57:19 +01:00
,#+end_seealso
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
** Warning
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
A warning box is displayed as follows:
2015-02-24 12:08:13 +01:00
2015-03-05 22:57:19 +01:00
#+begin_src org
,#+begin_warning
2015-02-27 12:09:39 +01:00
Be careful! Check that you have...
2015-03-05 22:57:19 +01:00
,#+end_warning
#+end_src
2015-03-02 09:23:20 +01:00
2015-03-05 22:57:19 +01:00
#+begin_src org
,#+begin_caution
2015-02-27 12:09:39 +01:00
Caution
2015-03-05 22:57:19 +01:00
,#+end_caution
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
** Tip
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
A tip box is displayed as follows:
2015-02-24 12:08:13 +01:00
2015-03-05 22:57:19 +01:00
#+begin_src org
,#+begin_tip
2015-02-27 12:09:39 +01:00
Try doing it this way...
2015-03-05 22:57:19 +01:00
,#+end_tip
#+end_src
2015-02-24 12:08:13 +01:00
2015-03-05 22:57:19 +01:00
#+begin_src org
,#+begin_important
2015-02-27 12:09:39 +01:00
Important
2015-03-05 22:57:19 +01:00
,#+end_important
#+end_src
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
** Error
2015-02-24 12:08:13 +01:00
2015-03-05 22:57:19 +01:00
#+begin_src org
,#+begin_error
2015-02-27 12:09:39 +01:00
Error
2015-03-05 22:57:19 +01:00
,#+end_error
#+end_src
** Todo
Simple box ("inline task"):
#+begin_src org
*************** TODO Do this task
Description of inline task.
*************** END
#+end_src
*************** TODO Do this task
Description of inline task.
*************** END
or:
#+begin_src org
*************** WAIT [#B] Do also this other task :phone:
*************** END
#+end_src
#+begin_admonitiontodo
Admonitiontodo
#+end_admonitiontodo
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
* Centered text
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
#+begin_src org
,#+begin_left
2015-02-27 12:09:39 +01:00
This text is \\
aligned to the left!
2015-03-02 09:23:20 +01:00
,#+end_left
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
,#+begin_center
2015-02-27 12:09:39 +01:00
This text is \\
centered!
2015-03-02 09:23:20 +01:00
,#+end_center
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
,#+begin_right
2015-02-27 12:09:39 +01:00
This text is \\
aligned to the right!
2015-03-02 09:23:20 +01:00
,#+end_right
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
* Sidebar
2015-02-24 12:08:13 +01:00
2015-02-27 17:21:33 +01:00
#+begin_src org
2015-02-27 12:09:39 +01:00
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.
2015-02-24 12:08:13 +01:00
2015-02-27 17:21:33 +01:00
,#+begin_sidebar
2015-03-02 09:23:20 +01:00
Org mode was first released by Carsten Dominik in 2004 as an outlining and
project planning tool. Further development turned it into a general tool that
can be used to author professional documents like LaTeX.
2015-02-27 17:21:33 +01:00
,#+end_sidebar
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac
turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor
sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies
mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien
ullamcorper pharetra. Vestibulum erat wisi...
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
Phasellus ut libero. Nulla in libero non enim tristique sollicitudin. Ut
tempor. Phasellus pellentesque augue eget ante. Mauris malesuada. Donec sit
amet diam sit amet dolor placerat blandit. Morbi enim purus, imperdiet in,
molestie sit amet, pellentesque eu, mauris. In vel erat vel ipsum bibendum
commodo. Curabitur accumsan. Nam sed metus. Etiam tristique bibendum justo.
2015-02-27 17:21:33 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
* Example
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
You can have ~example~ blocks.
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
#+begin_src org
2015-02-27 17:21:33 +01:00
: 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
2015-02-27 12:09:39 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
or
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
#+begin_src org
,#+begin_example
2015-02-27 17:21:33 +01:00
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
2015-02-27 12:09:39 +01:00
,#+end_example
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
* Prose excerpts
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
** Quote
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
Use the ~quote~ block for content that *doesn't require the preservation of line
breaks*.
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
#+begin_src org
,#+begin_quote
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.
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
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.
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
-- Donald Knuth
,#+end_quote
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
A short one:
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
#+begin_src org
2015-02-27 12:09:39 +01:00
,#+begin_quote
Everything should be made as simple as possible,
but not any simpler. -- Albert Einstein
,#+end_quote
2015-02-26 11:39:35 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
** Verse
In a ~verse~ environment, there is an *implicit line break at the end of each line*,
and *indentation* is preserved:
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
#+begin_src org
2015-02-27 12:09:39 +01:00
,#+begin_verse
Everything should be made as simple as possible,
but not any simpler. -- Albert Einstein
,#+end_verse
2015-02-26 11:39:35 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
Typically used for quoting passages of an email message:
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
#+begin_src org
2015-02-27 12:09:39 +01:00
,#+begin_verse
>> The meeting has been postponed to next Friday.
>
> Has the deadline for the report been moved too?
2015-02-27 17:21:33 +01:00
Yes. And chekout http://www.doodle.com/ for rescheduling the meeting.
In the text body,
indentation is
preserved.
2015-02-27 12:09:39 +01:00
,#+end_verse
2015-02-26 11:39:35 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
** Block quote with optional attribution line
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
#+begin_epigraph
epigraph
#+end_epigraph
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
** Block quotes with their own class attribute
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
#+begin_highlights
highlights
#+end_highlights
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
#+begin_pull-quote
pull-quote
#+end_pull-quote
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
#+begin_blockquote
Blockquote
#+end_blockquote
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
** Non-breaking space
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
Insert the Unicode character ~00A0~ to add a non-breaking space.
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
FIXME Or add/use an Org entity? Or use tilde?
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
* Comments
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
#+begin_src org
2015-02-27 12:09:39 +01:00
It's possible to add comments in the document.
# This Org comment here won't be displayed.
2015-02-26 11:39:35 +01:00
#+end_src
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
* Substitutions
** General replacements
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
#+begin_src org :eval no
,#+MACRO: longtext this very very long text
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
Insert {{{longtext}}} wherever required.
2015-02-26 11:39:35 +01:00
#+end_src
2015-02-27 12:09:39 +01:00
#+MACRO: longtext this very very long text
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
Insert {{{longtext}}} wherever required.
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
** Styled references
2015-02-27 12:09:39 +01:00
#+BEGIN_SRC org :eval no
,#+MACRO: color @@html:<span style="color: $1">$2</span>@@
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
{{{color(blue, This text is colored in blue.)}}}
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
{{{color(red, This other text is in red.)}}}
#+END_SRC
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
#+MACRO: color @@html:<span style="color: $1">$2</span>@@
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
{{{color(blue, This text is colored in blue.)}}}
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
{{{color(red, This other text is in red.)}}}
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
Find more macros on [[https://github.com/fniessen/org-macros][GitHub]].
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
** Special characters
We also use substitutions to include some of the widely used Unicode characters
(like ©, converted from text characters to its typographically correct entity).
*** Accents
#+begin_src org
- \Agrave \Aacute
#+end_src
*** Punctuation
#+begin_src org
- Dash: \ndash \mdash
- Marks: \iexcl \iquest
- Quotations: \laquo \raquo
- Miscellaneous: \para \ordf
#+end_src
*** Commercial symbols
#+begin_src org
- Property marks: \copy \reg
- Currency: \cent \EUR \yen \pound
#+end_src
*** Greek characters
#+begin_src org
The Greek letters \alpha, \beta, and \gamma are used to denote angles.
#+end_src
*** Math characters
#+begin_src org
- Science: \pm \div
- Arrows: \to \rarr \larr \harr \rArr \lArr \hArr
- Function names: \arccos \cos
- Signs and symbols: \bull \star
#+end_src
*** Misc
#+begin_src org
# Smilies: \smiley \sad
- Suits: \clubs \spades
#+end_src
2015-02-27 12:09:39 +01:00
* Source code
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
** Inline code
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
#+begin_src org
Reference code like ~variables~ or ~functions~ inline.
#+end_src
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
You can also evaluate code inline as follows: 1 + 1 is src_R{1 + 1}.
2015-02-25 16:26:59 +01:00
2015-03-02 09:23:20 +01:00
** Code blocks (with syntax highlighting)
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
The source code blocks support syntax highlighting:
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
#+begin_src cpp :eval no
/*
* 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;
}
#+end_src
2015-02-25 16:26:59 +01:00
2015-03-02 09:23:20 +01:00
** Source mode
2015-02-27 12:09:39 +01:00
The following language strings are currently recognized:
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
#+begin_src emacs-lisp :results drawer :exports results
(concat (mapconcat (lambda (widget)
(widget-get widget :tag))
(cl-remove-if-not (lambda (it)
(and (consp it)
(eq (car it) 'const)))
(cdr
(widget-get
(get
'org-babel-load-languages 'custom-type)
:key-type)))
", ")
".")
#+end_src
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
#+results:
:RESULTS:
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.
:END:
2015-02-25 16:26:59 +01:00
2015-03-02 09:23:20 +01:00
** Line break
2015-02-27 12:09:39 +01:00
Code block with long lines:
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
#+begin_src emacs-lisp :eval no
testing testing testing testing testing testing testing testing testing testing
0 1 2 3 4 5 6 7 8 9
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456
#+end_src
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
For PDF (LaTeX), one solution is to surround the code block such as:
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
#+latex: \scriptsize
#+begin_src R
print("This block is in scriptsize")
#+end_src
#+latex: \normalize
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
** Line numbers
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
Both in ~example~ and in ~src~ snippets, you can add a ~-n~ switch to the end of the
~begin~ line, to get the lines of the example numbered.
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
#+header: :eval no
#+begin_src emacs-lisp -n
(defun org-xor (a b)
"Exclusive or."
#+end_src
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
If you use a ~+n~ switch, the numbering from the previous numbered snippet will
be continued in the current one:
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
#+header: :eval no
#+begin_src emacs-lisp +n
(if a (not b) b))
#+end_src
2015-02-25 16:26:59 +01:00
2015-02-27 17:21:33 +01:00
** Callouts
2015-02-27 12:09:39 +01:00
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.
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
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:
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
#+header: :eval no
#+begin_src emacs-lisp -n -r
(save-excursion ; (ref:sc)
(goto-char (point-min))) ; (ref:jump)
#+end_src
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
In line [[(sc)]], we remember the current position. [[(jump)][Line (jump)]] jumps to
~point-min~.
2015-02-25 16:26:59 +01:00
2015-02-27 12:09:39 +01:00
* Math
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
You can embed LaTeX math formatting in Org mode files.
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
** Inline math expressions
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
For *inline math* expressions, use ~\(...\)~:
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
#+begin_src org
The formula \(a^2 + b^2 = c^2\) has been discovered by Pythagoras.
2015-03-02 09:23:20 +01:00
Let \(a=\sin(x) + \cos(x)\). Then \(a^2 = 2\sin(x)\cos(x)\) because \(\sin^2x +
\cos^2x = 1\).
2015-02-27 12:09:39 +01:00
#+end_src
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
#+begin_warning
It's /not/ advised to use the constructs ~$...$~ (both for Org and for MathJax).
#+end_warning
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
** Math expressions in display mode
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
For mathematical expressions which you want to make *stand out, centered on their
own lines*, use ~\[...\]~:
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
#+begin_src org
The /Euler theorem/:
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
\[
\int_0^\infty e^{-x^2} dx = {{\sqrt{\pi}} \over {2}}
\]
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
LaTeX allows to inline such ~\[...\]~ constructs (/quadratic formula/):
\[ \frac{-b \pm \sqrt{b^2 - 4 a c}}{2a} \]
#+end_src
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
#+begin_warning
2015-02-27 17:21:33 +01:00
Double dollar signs (~$$~) should not be used.
2015-02-27 12:09:39 +01:00
#+end_warning
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
** Equation numbers
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
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 (~$$~, ...).
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
#+begin_src org
The /Pythagoras theorem/:
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
#+name: pythag
\begin{equation}
a^2 + b^2 = c^2
\end{equation}
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
See equation [[pythag]].
2015-02-26 10:15:13 +01:00
2015-02-27 17:21:33 +01:00
The /sinus theorem/ can be written as the equation:
2015-02-26 11:39:35 +01:00
2015-02-27 12:09:39 +01:00
\begin{equation}
\label{eqn:sinalpha}
\frac{\sin\alpha}{a}=\frac{\sin\beta}{b}
\end{equation}
2015-02-27 17:21:33 +01:00
See equation [[eqn:sinalpha]].
2015-02-26 10:15:13 +01:00
#+end_src
2015-02-27 12:09:39 +01:00
Only captioned equations are numbered.
2015-02-27 17:21:33 +01:00
Other alternatives: use
- ~\begin{equation*}~ or
- ~\begin{displaymath}~ (= the verbose form of the ~\[...\]~ construct).
~M-q~ does not fill those.
2015-02-27 12:09:39 +01:00
2015-02-26 11:39:35 +01:00
* Miscellaneous effects
2015-02-26 10:15:13 +01:00
2015-02-26 11:39:35 +01:00
** Include Org files
You can include another Org file and skip its title by using the ~:lines~ argument
to ~#+INCLUDE~:
2015-02-26 10:15:13 +01:00
#+begin_src org
2015-02-26 11:39:35 +01:00
,#+INCLUDE: chapter1.org :lines "2-"
2015-02-26 10:15:13 +01:00
#+end_src
2015-02-26 11:39:35 +01:00
#+begin_note
File inclusion, through INCLUDE keywords, is an *export-only feature*.
#+end_note
** Inline HTML
You can include raw HTML in your Org documents and it will get kept as HTML
when it's exported. XXX
#+HTML_BEGIN: <pre style="color:red">
Text can be preformatted (in a fixed-width font).
#+HTML_END: </pre>
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_example
,#+begin_note
,*Note example* \\
Did you know...
,#+end_note
#+end_example
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:
2015-02-26 10:15:13 +01:00
#+begin_src org
2015-02-26 11:39:35 +01:00
,#+INCLUDE: file.html html
2015-02-26 10:15:13 +01:00
#+end_src
2015-02-26 11:39:35 +01:00
Don't edit the exported HTML file!
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
** Inline LaTeX
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
You can also use raw LaTeX. XXX
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
#+LaTeX_BEGIN: \begin{verbatim}
Text can be preformatted (in a fixed-width font).
#+LaTeX_END: \end{verbatim}
2015-02-24 12:08:13 +01:00
2015-02-26 11:39:35 +01:00
* Notes at the footer
#+begin_src org
It is possible to define named footnotes[fn:myfootnote], or ones with automatic
anchors[fn:2].
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
* Useful extensions
** Todo extension
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
*** Dates
2015-02-24 12:08:13 +01:00
Timestamps: [2014-01-16 Thu] and <2014-01-16 Thu>.
2015-02-27 12:09:39 +01:00
*** TODO We need to achieve...
*** DONE [#A] Buy GTD book :online:
:LOGBOOK:
- State "TODO" -> "DONE" [2014-01-16 Thu 09:52]
:END:
2015-02-24 12:08:13 +01:00
By default, ~DONE~ actions will be collapsed.
Note that I should probably implement that default behavior only for ~ARCHIVE~'d
items.
2015-02-27 12:09:39 +01:00
*** TODO [#A] Read GTD book
SCHEDULED: <2014-09-11 Thu>
2015-02-24 12:08:13 +01:00
By default, *all* (active) entries will be expanded at page load, so that their
contents is visible.
That can be changed by adding such a line (into your Org document):
2015-03-02 09:23:20 +01:00
#+begin_src org :eval no
2015-02-24 12:08:13 +01:00
,#+HTML_HEAD: <script> var HS_STARTUP_FOLDED = true; </script>
#+end_src
2015-02-27 12:09:39 +01:00
*** TODO [#B] Apply GTD methodoloy
DEADLINE: <2014-12-01 Mon>
:PROPERTIES:
:HTML_CONTAINER_CLASS: hsCollapsed
:END:
2015-02-24 12:08:13 +01:00
This section will be collapsed when loading the page because the entry has the
value ~hsCollapsed~ for the property ~:HTML_CONTAINER_CLASS:~.
Powerful, no?
2015-02-27 12:09:39 +01:00
*** Some note :computer:write:
2015-02-24 12:08:13 +01:00
You can add tags to any entry, and hightlight all entries having some specific
tag by clicking on the buttons made accessible to you in the "Dashboard".
2015-02-27 12:09:39 +01:00
*** Weekly review :computer:
2015-02-24 12:08:13 +01:00
Now, you can even make your weekly review in the HTML export... Press the ~r~ key
to start entering the "review mode" where all but one active entry are
collapsed, so that you can really focus on one item at a time!
2015-02-27 12:09:39 +01:00
** Bigblow extension
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
The string ~fixme~ (in *upper case*) gets replaced by a "Fix Me!" image:
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
#+begin_src org
FIXME Delete this...
#+end_src
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
* Graphs with Graphviz
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
To enable the Graphviz extension, we have to add it to the extensions list in
conf.py:
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
extensions = ['sphinx.est.graphviz']
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
It uses directly the dot command to process DOT language.
2015-02-24 12:08:13 +01:00
2015-02-27 12:09:39 +01:00
** Undirected
#+begin_src org
2015-03-04 12:11:46 +01:00
,#+begin_src dot :file images/graph.png :cmdline -Tpng
2015-02-27 12:09:39 +01:00
graph foo {
"bar" -- "baz";
}
,#+end_src
#+end_src
** Directed
#+begin_src org :exports results
2015-03-04 12:11:46 +01:00
,#+begin_src dot :file images/digraph.png :cmdline -Tpng
2015-02-27 12:09:39 +01:00
digraph foo {
"bar" -> "baz";
}
,#+end_src
#+end_src
* Graphs with R
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.
** Text
A one-liner result:
#+begin_src shell :exports both :results verbatim
date +"%Y-%m-%d"
#+end_src
#+results:
: 2014-03-15
# A multiple-line result:
#
# #+name: list-of-styles
# #+begin_src shell :exports both :results verbatim
# # output all styles, but the default one (if any)
# ls styles | grep -v "default"
# #+end_src
#
# #+results: list-of-styles
# #+begin_example
# bigblow
# leuven
# maunakea
# #+end_example
** Example
Data to be charted:
#+name: data
| Month | Degrees |
|-------+---------|
| 1 | 3.8 |
| 2 | 4.1 |
| 3 | 6.3 |
| 4 | 9.0 |
| 5 | 11.9 |
| 6 | 15.1 |
| 7 | 17.1 |
| 8 | 17.4 |
| 9 | 15.7 |
| 10 | 11.8 |
| 11 | 7.7 |
| 12 | 4.8 |
Code:
#+name: R-plot
2015-03-04 12:11:46 +01:00
#+begin_src R :var data=data :results graphics :file images/Rplot.png :exports both
2015-02-27 12:09:39 +01:00
plot(data, type="b", bty="l", col=c("#ABD249"), las=1, lwd=4)
grid(nx=NULL, ny=NULL, col=c("#E8E8E8"), lwd=1)
legend("bottom", legend=c("Degrees"), col=c("#ABD249"), pch=c(19))
#+end_src
** Graph
The resulting chart:
#+results: R-plot
2015-03-04 12:11:46 +01:00
[[file:images/Rplot.png]]
2015-02-27 12:09:39 +01:00
** R code block
#+begin_src R
library(ggplot2)
summary(cars)
#+end_src
#+results:
Plot:
#+begin_src R
library(ggplot2)
qplot(speed, dist, data = cars) + geom_smooth()
#+end_src
2015-02-24 12:08:13 +01:00
2015-03-02 09:23:20 +01:00
* Index
2015-02-27 17:21:33 +01:00
* Glossary
* Bibliography
2015-02-24 12:08:13 +01:00
* Footnotes
[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.