Example Org File

Org features, structures, and markup

1 Frontmatter

An Org document should begin with frontmatter, the special frontmatter comments control many aspects of an Org document. Some special comments are rendered when exported, some control metadata, some control how Org works or set options and configurations. These special comments have the form #+NAME: value(s).

1.1 Title and Date

At the very least an Org document should begin with a title and a date. For example, the first two lines of this file are:

#+TITLE: Example Org File
#+DATE: 2020-01-31

2 Headings

Headings structure documents into sections and subsections. They begin with an * and the number of asterisks denotes the heading level. The top or first-level begins with one asterisk followed by the section title and the syntax is * Section Title. A second-level heading begins with two asterisks followed by the subsection title and the syntax is ** Subsection Title.

HTML has only six heading levels, but an Org document can have many more. In fact, Org has 8 heading faces defined but has a constant called org-indent--deepest-level that implies 50 or more levels are possible.

(defconst org-indent--deepest-level 50
  "Maximum theoretical headline depth.")

However, the max export depth is 19.

(defconst org-export-max-depth 19
  "Maximum nesting depth for headlines, counting from 0.")

Since HTML supports only six levels we'll show that many as an example. Org will happily create <hn> headings for n-level headings with \( n > 6 \).

* Top or first level headline
Curabitur blandit tempus ardua ridiculus sed magna.
** Second level
Me non paenitet nullum festiviorem excogitasse ad hoc.
*** Third level
Ab illo tempore, ab est sed immemorabili.
**** Forth level
Sed haec quis possit intrepidus aestimare tellus.
***** Fifth level
Nihil hic munitissimus habendi senatus locus, nihil horum?
****** Sixth level
Quae vero auctorem tractata ab fiducia dicuntur.

3 Top or first level headline

Curabitur blandit tempus ardua ridiculus sed magna.

3.1 Second level

Me non paenitet nullum festiviorem excogitasse ad hoc.

3.1.1 Third level

Ab illo tempore, ab est sed immemorabili.

3.1.1.1 Forth level

Sed haec quis possit intrepidus aestimare tellus.

3.1.1.1.1 Fifth level

Nihil hic munitissimus habendi senatus locus, nihil horum?

3.1.1.1.1.1 Sixth level

Quae vero auctorem tractata ab fiducia dicuntur.

4 Tables

Tables in Org use a sensible syntax that looks great in plain text. The tables look even better in HTML thanks to rules borrowed from OrgCSS. The Org syntax is self-evident from the example:

| Name  | Phone | Age |
|-------+-------+-----|
| Peter |  1234 |  17 |
| Anna  |  4321 |  25 |

Which produces this table:

Name Phone Age
Peter 1234 17
Anna 4321 25

Tables without headers are supported too. Just omit the horizontal divider line. Given the example Org markup:

| 2 | 4 |
| 4 | 2 |

Which produces the table:

2 4
4 2

4.1 Column Alignment

Consider the payoff matrix for Roshambo. If we want player one's options to be represented by the first column and aligned right while player two's options are represented by the first row and center-aligned, we can get a decent looking payoff matrix with the following markup in Org:

|          | Rock | Paper | Sissors |
|      <r> | <c>  |  <c>  |   <c>   |
|     Rock |  0   |  -1   |    1    |
|    Paper |  1   |   0   |   -1    |
| Scissors |  -1  |   1   |    0    |

Which produces the following table:

  Rock Paper Sissors
Rock 0 -1 1
Paper 1 0 -1
Scissors -1 1 0

As can bee is seen above, columns can be aligned right with <r>, aligned center with <c>, and aligned left with <l>.

4.2 Table Captions

A table with a caption is easy to produce. Consider the magic square of order 3. We can compute the magic constant for magic square of order n using the formula \(M = n (n^2 + 1) / 2 \). This gives us a magic constant of 15 for the order 3 magic square. We can construct the magic square in Org with a caption like so:

#+NAME: tbl:ms-o3
#+CAPTION: Magic Square of Order 3
#+ATTR_HTML: :width 25%
| <c> | <c> | <c> |
|  2  |  7  |  6  |
|  9  |  5  |  1  |
|  4  |  3  |  8  |
Table 1: Magic Square of Order 3
2 7 6
9 5 1
4 3 8

5 Source Blocks

An Org source block containing an Emacs Lisp function called mccarthy91:

#+BEGIN_SRC emacs-lisp
  (defun mccarthy91 (n)
     "McCarthy 91 is used as a formal verification test case."
     (if (<= n 100)
         (mccarthy91 (mccarthy91 (+ n 11)))
       (- n 10)))
#+END_SRC

Renders to HTML like so:

(defun mccarthy91 (n)
   "McCarthy 91 is used as a formal verification test case."
   (if (<= n 100)
       (mccarthy91 (mccarthy91 (+ n 11)))
     (- n 10)))

5.1 Long lines

The next code block is used to check if the styling can display 80 character lines without overflow. The block is made up of lines contains the first 80 characters of a base-85 encoding called Z85.

0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{

Now we must check how a code block that overflows looks.

+ (nullable NSURL *)URLForResource:(nullable NSString *)name withExtension:(nullable NSString *)ext subdirectory:(nullable NSString *)subpath inBundleWithURL:(NSURL *)bundleURL API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));

6 Formatting

Want something bold use *bold*. Want something italic use /italic/. Want something underlined use _underlined_. Want something strikethrough use +strikethrough+. And lastly, want something monospaced use =monospaced= or ~monospaced~.

6.1 Subscripts and Superscripts

Text characters set below or above the line of type for a font/size combination are necessary for technical writing. Subscripts and superscripts are achieved in the same way as in TeX or LaTeX.

The radius of the sun is Rsun = 6.96 × 108 m. On the other hand, the radius of Alpha Centauri is RAlpha Centauri = 1.28 × Rsun.

6.2 Special Symbols

There are many special symbols and non-Latin alphabets that can be inserted in an Org document. The syntax is like TeX or LaTeX too.

Given a circle Γ of diameter d, the length of its circumference is πd. We can type α as \alpha, β as \beta, and χ as \chi. If you need a symbol in a word or formula it can be terminated with a pair of curly braces, so the previous πd is achieved by typing \pi{}d.

Some other symbols include © as \copy, † as \dag, and × as seen in the subscript/superscript section above as \times. There's ± as \pm or \plusmn. There's ½ as \frac12 and there's ¾ as \frac34. There's x → ∞, typed as x \to \infin. Don't forget the en dash – or the em dash —, respectively -- and ---.

Get a list of special symbols with org-entities-help or you can add your own in the variable org-entities-user.

7 Lists

Some technology that relies on quantum physics include

  • Lasers
  • Solar cells
  • Xerox machines and laser printers
  • Transistors
  • Integrated circuits
  • Digital cameras
  • Superconductors

Programming languages

  1. C
  2. Objective-C
  3. Python
  4. JavaScript
  5. Scheme (or LISP)
  6. Ruby
  7. Shell script

List of lists

  • Unordered list items may begin with
    • dash -
    • plus +
    • asterisk *
  • Ordered list items may begin with
    • a number followed by a period 1.
    • a number followed by a parenthesis 1)

Definition lists

Proposition
A statement that is either true or false
True
Agreement with fact or reality
False
Conflicting with fact or reality

8 Math

Math (and music) are universal languages. Any system for preparing documents must provide facilities for writing and displaying math.

The set of natural numbers \( 1, 2, 3, …, \infty \)is represented by the symbol \( \mathbb{N} \). The set of integers \( -\infty, …, -2, -1, 0, 1, 2, …, \infty \)is represented by the symbol \( \mathbb{Z} \). The letter Z comes from Zahlen, the German word for numbers.

Here are some properties of integers:

The set \(\mathbb{Z}\)is closed under addition

\[ a, b \in \mathbb{Z} \implies a + b \in \mathbb{Z} \]

The set \(\mathbb{Z}\)is closed under subtraction

\[ a, b \in \mathbb{Z} \implies a - b \in \mathbb{Z} \]

And the set \(\mathbb{Z}\)is closed under multiplication

\[ a, b \in \mathbb{Z} \implies a \times b \in \mathbb{Z} \]

8.1 Notation

Inline math such as \(a^2\)is inserted when \(\LaTeX\)is delimited by \(\). Whereas display math is inserted when \(\LaTeX\)is delimited by \[\]. Consider \(n \ge 1, F_0 = 0, F_1 = 1\), then we can express a recurrence relation in dispaly math as

\[ F_{n+1} = F_n + F_{n-1} \]

8.2 Logical Proposition

Given a proposition \( P \)and a proposition \( Q \)we can define some logical modifiers, combinatory terms, and relations using truth tables. We will denote true with a T and false with an F.

8.2.1 Defining Not

The proposition \( P \)and its complement \( \neg P \), read not P, are defined by the truth table:

\( P \) \( \neg P \)
T F
F T

8.2.2 Defining And

Given a proposition \( P \)and a proposition \( Q \)the logical conjunction \( P \land Q \), read P and Q, is defined by the truth table:

\( P \) \( Q \) \( P \land Q \)
T T T
T F F
F T F
F F F

8.2.3 Defining Or

Given a proposition \( P \)and a proposition \( Q \)the logical disjunction \( P \lor Q \), read P or Q, is defined by the truth table:

\( P \) \( Q \) \( P \lor Q \)
T T T
T F T
F T T
F F F

8.2.4 Defining Xor

Given a proposition \( P \)and a proposition \( Q \)the logical exclusive disjunction \( P \oplus Q \), read exclusive P or Q, is defined by the truth table:

\( P \) \( Q \) \( P \oplus Q \)
T T F
T F T
F T T
F F F

Notation note: the symbol \( \veebar \)is an alternative to \( \oplus \).

8.3 Sums

The following is a summation with index k from 1 to n - 1.

\[ \sum_{k=1}^{n-1} a_k = a_1 + a_2 + a_3 + … + a_{n-1} \]

The following is a summation with index j from 0 to n - 1.

\[ \sum_{j=0}^{n-1} x^j = 1 + x + x^2 + x^3 + … + x^{n-1} \]

9 Images

The first image is of the Wallpaper Groups (also called the Plane Symmetry Groups or the Plane Crystallographic Groups). It is taken from a paper published in American Mathematical Monthly titled The Plane Symmetry Groups: Their Recognition and Notation.

All 17 wallpaper groups
Figure 1: The 17 Wallpaper Groups

The next image should not stretch.

A color wheel
Figure 2: Color Wheel

10 Horizontal Rules

Vivamus sagittis lacus vel augue laoreet rutrum faucibus. Unam incolunt Belgae, aliam Aquitani, tertiam. Contra legem facit qui id facit quod lex prohibet. Ut enim ad minim veniam, quis nostrud exercitation. Nec dubitamus multa iter quae et nos invenerat.


Qui ipsorum lingua Celtae, nostra Galli appellantur. Idque Caesaris facere voluntate liceret: sese habere. Cum ceteris in veneratione tui montes, nascetur mus. Quo usque tandem abutere, Catilina, patientia nostra?

11 Links

We need hypertext, it's the web after all. The Org link format is simple, either [link] or [[link][description]]. There are some escaping concerns so it is best to always insert or edit a link with C-c C-l.

11.1 External Links

There are several external links in this document. Org can link to many different types of resources. The two most common types of resources are web links "https" (or "http") and "file" links.

A clickable URL to the On-Line Encyclopedia of Integer Sequences follows https://oeis.org. The next example is a descriptive link to the NIST Digital Library of Mathematical Functions.

11.2 Internal Links

With an internal link we can refer to a previous section like the section on Math. Or we can link to some named element such as the wallpaper group figure. Or we can link to a section 2 without a description. Section links are of the form [[*section name][optional description]], or to use a section's custom ID to form the link [[#custom-id][optional description]], and to link to a named entity use the form [[entity-name][optional description]], e.g. for the wallpaper group figure the link is formed with [[fig:wg][wallpaper group figure]].

12 Blocks

Quis aute iure reprehenderit in voluptate velit esse. A communi observantia non est recedendum. Hi omnes lingua, institutis, legibus inter se differunt. Prima luce, cum quibus mons aliud consensu ab eo. Gallia est omnis divisa in partes tres, quarum. Ullamco laboris nisi ut aliquid ex ea commodi consequat.

12.1 Blockquotes

Phasellus laoreet lorem vel dolor tempus vehicula. Donec sed odio operae, eu vulputate felis rhoncus. Fictum, deserunt mollit anim laborum astutumque! A communi observantia non est recedendum. At nos hinc posthac, sitientis piros Afros.

Give a man a fish and feed him for a day. Don't teach a man to fish and feed yourself. He's a grown man. And fishing's not that hard. — Ron Swanson

Sed haec quis possit intrepidus aestimare tellus. Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt ut labore et dolore magna aliqua. Fabio vel iudice vincam, sunt in culpa qui officia. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.

It would be very nice if I could illustrate the various techniques with small demonstration programs and could conclude with "… and when faced with a program a thousand times as large, you compose it in the same way." This common educational device, however, would be self-defeating as one of my central themes will be that any two things that differ in some respect by a factor of already a hundred or more, are utterly incomparable.

History has shown that this truth is very hard to believe. Apparently we are too much trained to disregard differences in scale, to treat them as "gradual differences that are not essential." We tell ourselves that what we can do once, we can also do twice and by induction we fool ourselves into believing that we can do it as many times as needed, but this is just not true! A factor of a thousand is already far beyond our powers of imagination!

[…]

It is in the same mood that I should like to draw the reader's attention to the fact that "clarity" has pronounced quantitative aspects, a fact many mathematicians, curiously enough, seem to be unaware of. A theorem stating the validity of a conclusion when ten pages full of conditions are satisfied is hardly a convenient tool, as all conditions have to be verified whenever the theorem is appealed to. In Euclidean geometry, Pythagoras' Theorem holds for any three points A, B and C such that through A and C a straight line can be drawn orthogonal to a straight line through B and C. How many mathematicians appreciate that the theorem remains applicable when some or all of the points A, B and C coincide? Yet this seems largely responsible for the convenience with which Pythagoras' Theorem can be used. — Edsger W. Dijkstra

12.2 Verse

Cum sociis natoque penatibus et magnis dis parturient. Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh. Sed haec quis possit intrepidus aestimare tellus.

Tyger Tyger, burning bright,
In the forests of the night;
What immortal hand or eye,
Could frame thy fearful symmetry?
    — William Blake

Paullum deliquit, ponderibus modulisque suis ratio utitur. Quisque placerat facilisis egestas cillum dolore. Nihil hic munitissimus habendi senatus locus, nihil horum?

Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore—
    While I nodded, nearly napping, suddenly there came a tapping,
As of some one gently rapping, rapping at my chamber door.
“’Tis some visitor,” I muttered, “tapping at my chamber door—
            Only this and nothing more.”
    — Edgar Allan Poe

12.3 Center

Inmensae subtilitatis, obscuris et malesuada fames. Salutantibus vitae elit libero, a pharetra augue. Pellentesque habitant morbi tristique senectus et netus. Fictum, deserunt mollit anim laborum astutumque! Cum sociis natoque penatibus et magnis dis parturient.

I should go to bed.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus. Quae vero auctorem tractata ab fiducia dicuntur. Cras mattis iudicium purus sit amet fermentum. Morbi fringilla convallis sapien, id pulvinar odio volutpat. Sed haec quis possit intrepidus aestimare tellus.

🛏️

12.4 Examples

Magna pars studiorum, prodita quaerimus. Cum sociis natoque penatibus et magnis dis parturient. Cum ceteris in veneratione tui montes, nascetur mus. Pellentesque habitant morbi tristique senectus et netus. Quo usque tandem abutere, Catilina, patientia nostra?

Some example from a text file.

13 Footnotes and Endnotes

Technical writing requires many structures and organizational tools to be effective. One of the quintessential structures in a technical document are footnotes 1.

Plura mihi bona sunt, inclinet, amari petere vellent. Quam diu etiam furor iste tuus nos eludet? Qui ipsorum lingua Celtae, nostra Galli appellantur 2. Vivamus sagittis lacus vel augue laoreet rutrum faucibus. Salutantibus vitae elit libero, a pharetra augue.

13.1 Footnote Syntax

Org footnotes are just links that start with fn:. The footnotes may be numbered, named, anonymous and can be inline or defined in a footnotes section. A numbered footnote looks like this:

The Org homepage[fn:1] now looks a lot better than it used to.
...
[fn:1] The link is: https://orgmode.org

Named and anonymous footnotes look like these:

[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]

An 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.

14 Fonts

Uses STIX Regular for body text from everythingfonts.com. When you embed fonts from everythingfonts.com you're require you to display this powered by fonts from everythingfonts.com badge.

Powered by fonts from everythingfonts.com

For monospaced typeface DejaVu Sans Mono from fontlibrary.org. As far as I can tell fontlibrary.org does not require any specific attribution.

Footnotes:

Author: Eddie Hillenbrand

Date: 2020-01-31