#+TITLE: Org mode syntax #+SUBTITLE: Quick reference card #+AUTHOR: Tuomas Pyyhtiä #+EMAIL: asdf@asdf.com #+DATE: #+DESCRIPTION: Org-mode syntax example #+KEYWORDS: org-mode, syntax, quick reference, cheat sheet, html #+LANGUAGE: en # Export underscore as underscore instead of highlight in HTML (was: ^:nil): #+OPTIONS: toc:nil ':t # Include usable macros from https://github.com/fniessen/org-macros: #+INCLUDE: org-macros.setup #+INFOJS_OPT: view:content ltoc:nil path:http://iki.fi/~pyyhttu/debian/org-mode/js/org-info.js #+HTML_HEAD: #+HTML_LINK_HOME: #+HTML_LINK_UP: http://www.google.com #+PROPERTY: header-args :eval yes :exports both :results replace # #+MACRO: longtext this is a very very long text to include | *Source* | https://github.com/fniessen/refcard-org-mode | * Summary #+begin_abstract This document is expected to be helpful when you are interested in composing a document like this document itself. It serves as an example template and reference of the Org-mode document. This document is available as a [[https://pyyhttu.kapsi.fi/debian/org-mode/macros/README.org][=README.org=]] which is in text format and can be edited in a text editor (usually GNU Emacs). This Document is also available as a [[https://pyyhttu.kapsi.fi/debian/org-mode/macros/README.html][=README.html=]], which is [[https://orgmode.org/manual/HTML-Export.html][exported as HTML]] from =README.org=. HTML file stylesheet based on [[https://pyyhttu.kapsi.fi/debian/org-mode/css/org.css][=org.css=]]. #+end_abstract See https://sbr.pm/articles/sandbox.html (ditaa) and https://github.com/elmarlee/org-mode-template/blob/master/org-mode-template.org for more examples. #+TOC: headlines 2 * Headings #+begin_src org ,* Biggest heading New chapter. ,** Bigger heading New section. ,*** Big heading New sub-section. #+end_src * Biggest heading New chapter. ** Bigger heading New section. *** Big heading New sub-section. * Paragraphs ** Line breaks #+BEGIN_SRC org By entering two consecutive backslashes, \\ you can force a line break without starting a new paragraph. #+END_SRC By entering two consecutive backslashes, \\ you can force a line break without starting a new paragraph. ** Horizontal rules #+BEGIN_SRC org For an horizontal line, insert at least 5 dashes: this is some text above an horizontal rule ----- and some text below it. #+END_SRC For an horizontal line, insert at least 5 dashes: this is some text above an horizontal rule ----- and some text below it. * Formatting text Text effects. ** Bold and italic #+BEGIN_SRC org /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.* Org mode does not interpret a marker surrounded by alphanumeric characters as an emphasis marker. So, you can't (easily) emphasize just part of a word: Not feas*ible*. #+END_SRC /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.* Org mode does not interpret a marker surrounded by alphanumeric characters as an emphasis marker. So, you can't (easily) emphasize just part of a word: Not feas*ible*. ** Monospace, superscript and subscript 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 super^{script}, such as 2^{10} - text with sub_{script}, such as H_{2}O ** Smart punctuation #+BEGIN_SRC org If =#+OPTIONS: ':t= is specified, or alternatively =(setq org-export-with-smart-quotes t)= in Emacs configuration file, Org mode will produce typographically correct output, converting straight 'single quotes' and "straight quotes" to their respective curly/smart quotes, --- to em-dashes, -- to en-dashes, ... to ellipses and ' to typographic apostrophe. #+END_SRC If =#+OPTIONS: ':t= is specified, or alternatively =(setq org-export-with-smart-quotes t)= variable in Emacs configuration file, Org mode will produce typographically correct output, converting straight 'single quotes' and "straight quotes" to their respective curly/smart quotes, --- to em-dashes, -- to en-dashes, ... to ellipses and ' to typographic apostrophe. * Lists Org markup allows you to create *bulleted* or *numbered* lists. It allows any combination of the two list types. ** Unordered lists Itemized lists are marked with bullets. Create them with a minus or a plus sign. They are convenient to organize data, and make the document prettier, and easier to read. #+begin_src org - Item with some lengthy text wrapping hopefully across several lines. We add a few words to really show the line wrapping. - Bullet. + Bullet. * Bullet. #+end_src - Item with some lengthy text wrapping hopefully across several lines. We add a few words to really show the line wrapping. - Bullet. + Bullet. * Bullet. ** Checklists #+begin_src org - [X] Checked. - [-] Half-checked. - [ ] Not checked. - Normal list item. #+end_src - [X] Checked. - [-] Half-checked. - [ ] Not checked. - Normal list item. ** Ordered lists Enumerated lists are marked with numbers or letters like =a.=, =A.=, =a)= and =A)=, but [[https://orgmode.org/manual/Plain-Lists.html#FOOT11][requires]] to =(setq org-list-allow-alphabetical t)= in Emacs configuration file. #+begin_src org 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. #+end_src 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. You can have ordered lists with jumping numbers: #+begin_src org 2. [@2] We start with point number 2. 3. Automatically numbered item. #+end_src 2. [@2] We start with point number 2. 3. Automatically numbered item. ** Definition lists Labeled, multi-line lists. #+begin_src org - 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. #+end_src - 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. ** 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 #+end_src - apples - oranges - bananas # Comment. - carrots - tomatoes - celery * 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 | Cell in column 1, row 1 | Cell in column 2, row 1 | | Cell in column 1, row 2 | Cell in column 2, row 2 | Org tables have cells of at most one line long: there is no such thing as a multi-line table cell in Org. ** 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 ~~, ~~ or ~~. #+begin_src org #+CAPTION: Table with aligned columns | | | | | 1 | 2 | 3 | | Right | Center | Left | | Cell in column 1, row 3 | Cell in column 2, row 3 | Cell in column 1, row 3 | #+end_src #+CAPTION: Table with aligned columns | | | | | 1 | 2 | 3 | | Right | Center | Left | | Cell in column 1, row 3 | Cell in column 2, row 3 | Cell in column 3, row 3 | |---+-------------------------+--------| ** 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 #+CAPTION: Table with an header row | Name of column 1 | Name of column 2 | Name of column 3 | |------------------+------------------+------------------| | Top left | Top middle | | | | | Right | | Bottom left | Bottom middle | | #+end_src #+CAPTION: Table with an header row | Name of column 1 | Name of column 2 | Name of column 3 | |------------------+------------------+------------------| | Top left | Top middle | | | | | Right | | Bottom left | Bottom middle | | ** A very long table To test "sticky table headers"... #+BEGIN_SRC org | 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 | | #+END_SRC | 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 | | ** Table placement #+begin_src org #+ATTR_LATEX: :center nil | a | b | | 1 | 2 | #+end_src #+ATTR_LATEX: :center nil | a | b | | 1 | 2 | XXX Different from the following: #+begin_src org | a | b | | 1 | 2 | #+end_src | a | b | | 1 | 2 | ** Align tables on the page *** Left Here is a table on the left side: ,#+LATEX: \noindent ,#+ATTR_LATEX: :center nil | a | b | c | |---+---+---| | 1 | 2 | 3 | | 4 | 5 | 6 | ,#+LATEX: \hfill 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 table, so it pushes the table to the left. *** Center Here is a centered table: | a | b | c | |---+---+---| | 1 | 2 | 3 | | 4 | 5 | 6 | *** Right And here's a table on the right side: #+LATEX: \hfill #+ATTR_LATEX: :center nil | a | b | c | |---+---+---| | 1 | 2 | 3 | | 4 | 5 | 6 | Here the ~hfill~ adds infinite stretch before the table, so it pushes the table to the right. ** Table size #+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 | ** CSV You can fill a table from a CSV file using R commands. * Links ** External links See http://www.pirilampo.org (automatic!) and the [[http://orgmode.org/][Org mode Web site]]. *** Relative links [[../README.html][Home]] *** Email links [[mailto:john.doe@example.com][email John Doe]] *** Image links To get image links, put a link to a file in the description. Clicking on the image [[http://orgmode.org/][file:images/org-mode-unicorn.png]] leads to the Org mode home page. ** Internal links *** Inline anchors Anchors are used to specify hypertext link targets. <> Inline anchors make arbitrary content referenceable. *** Internal cross references See: - Location [[anchor][cross reference]]. ** Extensions that define new hyperlinks targets * Images ** Inline picture #+caption: Org mode logo [[file:images/org-mode-unicorn.png]] Click to see the [[file:images/org-mode-unicorn.png][Unicorn picture]]. ** Image alignment (using positioning) Books usually align/float images on the right/left of the contents. *** Image is left aligned *** Image is right aligned *** Image is centered ** Image attributes and values 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-unicorn.png]] Place images side by side: XXX ** Figures To define images that will be *treated as book illustrations* (figures) and automatically labeled and numbered, use XXX. * Videos 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 Admonitions (contextual backgrounds) are statements taken out of the content's flow and labeled with a title. Common admonitions are: 1. ~note~ 2. ~warning~ 3. ~tip~ 4. ~caution~ 5. ~important~ (Most themes style only ~note~ and ~warning~ specially.) ** Base admonitions *** Note A note box is displayed as follows: #+begin_src org ,#+begin_note This is a useful note. ,#+end_note #+end_src #+begin_note This is a useful note. #+end_note *** Warning A warning box is displayed as follows: #+begin_src org ,#+begin_warning Be careful! Check that you have... ,#+end_warning #+end_src #+begin_warning Be careful! Check that you have... #+end_warning *** Tip A tip box is displayed as follows: #+begin_src org ,#+begin_tip Try doing it this way... ,#+end_tip #+end_src #+begin_tip Try doing it this way... #+end_tip *** Caution #+begin_src org ,#+begin_caution Caution ,#+end_caution #+end_src #+begin_caution Caution #+end_caution *** Important #+begin_src org ,#+begin_important Important ,#+end_important #+end_src #+begin_important Important #+end_important ** Additional admonitions *** Attention #+begin_src org ,#+begin_attention Attention ,#+end_attention #+end_src #+begin_attention Attention #+end_attention *** Hint #+begin_src org ,#+begin_hint Hint ,#+end_hint #+end_src #+begin_hint Hint #+end_hint *** Error #+begin_src org ,#+begin_error Error ,#+end_error #+end_src #+begin_error Error #+end_error *** Danger #+begin_src org ,#+begin_danger Danger ,#+end_danger #+end_src #+begin_danger Danger #+end_danger *** SeeAlso (Sphinx additional) #+begin_src org ,#+begin_seealso - [[http://en.wikipedia.org/wiki/Apple][Apples]] :: A kind of [[http://en.wikipedia.org/wiki/Fruit][fruit]]. ,#+end_seealso #+end_src #+begin_seealso - [[http://en.wikipedia.org/wiki/Apple][Apples]] :: A kind of [[http://en.wikipedia.org/wiki/Fruit][fruit]]. #+end_seealso ** Todo admonition Simple box ("inline task"): *************** TODO Do this task Description of inline task. *************** END or: *************** DONE [#B] Do also this other task :phone: CLOSED: [2020-12-04 Fri 11:03] *************** END * Centered text #+begin_src org ,#+begin_left This text is \\ aligned to the left! ,#+end_left #+end_src #+begin_left This text is \\ aligned to the left! #+end_left #+begin_src org ,#+begin_center This text is \\ centered! ,#+end_center #+end_src #+begin_center This text is \\ centered! #+end_center #+begin_src org ,#+begin_right This text is \\ aligned to the right! ,#+end_right #+end_src #+begin_right This text is \\ aligned to the right! #+end_right * Prose excerpts ** Quote Use the ~quote~ block for content that *doesn't require the preservation of line breaks*. #+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. 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 ,#+end_quote #+end_src #+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. 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 #+end_quote A short one: #+begin_src org ,#+begin_quote Everything should be made as simple as possible, but not any simpler. -- Albert Einstein ,#+end_quote #+end_src #+begin_quote Everything should be made as simple as possible, but not any simpler. -- Albert Einstein #+end_quote ** Verse In a ~verse~ environment, there is an *implicit line break at the end of each line*, and *indentation* is preserved: #+begin_src org ,#+begin_verse Everything should be made as simple as possible, but not any simpler. -- Albert Einstein ,#+end_verse #+end_src #+begin_verse Everything should be made as simple as possible, but not any simpler. -- Albert Einstein #+end_verse Another example: Typically used for quoting passages of an email message: #+begin_verse >> The meeting has been postponed to next Friday. > > Has the deadline for the report been moved too? Yes. And chekout http://www.doodle.com/ for rescheduling the meeting. In the text body, indentation is preserved. #+end_verse ** Block quote with optional attribution line #+begin_epigraph epigraph #+end_epigraph ** Block quotes with their own class attribute #+begin_highlights highlights #+end_highlights #+begin_pull-quote pull-quote #+end_pull-quote #+begin_blockquote Blockquote #+end_blockquote ** Non-breaking space Insert the Unicode character ~00A0~ to add a non-breaking space. FIXME Or add/use an Org entity? Or use tilde? * Substitutions ** General replacements #+begin_src org :eval no ,#+MACRO: longtext this very very long text Insert {{{longtext}}} wherever required. #+end_src #+MACRO: longtext this very very long text Insert {{{longtext}}} wherever required. Emacs comes with these built in macros: #+begin_src org :eval no {{{title}}} {{{author}}} {{{email}}} {{{date}}} {{{date(FORMAT)}}} {{{time(FORMAT)}}} {{{modification-time(FORMAT, VC)}}} {{{property(PROPERTY-NAME)}}} {{{property(PROPERTY-NAME,SEARCH-OPTION)}}} {{{n}}} {{{n(NAME)}}} {{{n(NAME,ACTION)}}} #+end_src {{{title}}}\\ {{{author}}}\\ {{{email}}}\\ {{{date}}}\\ {{{date(FORMAT)}}}\\ {{{time(FORMAT)}}}\\ {{{modification-time(FORMAT, VC)}}} {{{n}}} {{{n(NAME)}}} {{{n(NAME,ACTION)}}} ** Styled references #+BEGIN_SRC org :eval no ,#+MACRO: color @@html:$2@@ {{{color(blue, This text is colored in blue.)}}} {{{color(red, This other text is in red.)}}} #+END_SRC #+MACRO: color @@html:$2@@ {{{color(blue, This text is colored in blue.)}}} {{{color(red, This other text is in red.)}}} Other macros from https://github.com/fniessen/org-macros e.g.: #+BEGIN_SRC org Keyboard macro: Use {{{kbd(C-c a a)}}} to launch the agenda. #+END_SRC Use {{{kbd(C-c a a)}}} to launch the agenda. #+BEGIN_SRC org Bgcolor Macro: {{{bgcolor(red, This information is important.)}}} {{{bgcolor(#E0E0E0, This other isn’t.)}}} Common color names are supported by most Org exporters (HTML, LaTeX): {{{bgcolor(red, red)}}} {{{bgcolor(orange, orange)}}} {{{bgcolor(yellow, yellow)}}} {{{bgcolor(green, green)}}} {{{bgcolor(blue, blue)}}} {{{bgcolor(purple, purple)}}} {{{bgcolor(violet, violet)}}} You can also use hexadecimal color codes: {{{bgcolor(#FF0000, #FF0000)}}} {{{bgcolor(#00FF00, #00FF00)}}} {{{bgcolor(#0000FF, #0000FF)}}} #+END_SRC {{{bgcolor(red, This information is important.)}}} {{{bgcolor(#E0E0E0, This other isn’t.)}}} Common color names are supported by most Org exporters (HTML, LaTeX): {{{bgcolor(red, red)}}} {{{bgcolor(orange, orange)}}} {{{bgcolor(yellow, yellow)}}} {{{bgcolor(green, green)}}} {{{bgcolor(blue, blue)}}} {{{bgcolor(purple, purple)}}} {{{bgcolor(violet, violet)}}} You can also use hexadecimal color codes: {{{bgcolor(#FF0000, #FF0000)}}} {{{bgcolor(#00FF00, #00FF00)}}} {{{bgcolor(#0000FF, #0000FF)}}} #+BEGIN_SRC Color macro: {{{color(red, This information is important.)}}} {{{color(#E0E0E0, This other isn’t.)}}} Common color names are supported by most Org exporters (HTML, LaTeX): {{{color(red, red)}}} {{{color(orange, orange)}}} {{{color(yellow, yellow)}}} {{{color(green, green)}}} {{{color(blue, blue)}}} {{{color(purple, purple)}}} {{{color(violet, violet)}}} You can also use hexadecimal color codes: {{{color(#FF0000, #FF0000)}}} {{{color(#00FF00, #00FF00)}}} {{{color(#0000FF, #0000FF)}}} #+END_SRC {{{color(red, This information is important.)}}} {{{color(#E0E0E0, This other isn’t.)}}} Common color names are supported by most Org exporters (HTML, LaTeX): {{{color(red, red)}}} {{{color(orange, orange)}}} {{{color(yellow, yellow)}}} {{{color(green, green)}}} {{{color(blue, blue)}}} {{{color(purple, purple)}}} {{{color(violet, violet)}}} You can also use hexadecimal color codes: {{{color(#FF0000, #FF0000)}}} {{{color(#00FF00, #00FF00)}}} {{{color(#0000FF, #0000FF)}}} #+BEGIN_SRC org fixme macro: {{{fixme}}} Delete this… #+END_SRC {{{fixme}}} Delete this… #+BEGIN_SRC org Highlight macro: {{{hl(This information is important.)}}} {{{highlight(red, red)}}} {{{highlight(orange, orange)}}} {{{highlight(yellow, yellow)}}} {{{highlight(green, green)}}} {{{highlight(blue, blue)}}} {{{highlight(purple, purple)}}} {{{highlight(violet, violet)}}} #+END_SRC {{{hl(This information is important.)}}} {{{highlight(red, red)}}} {{{highlight(orange, orange)}}} {{{highlight(yellow, yellow)}}} {{{highlight(green, green)}}} {{{highlight(blue, blue)}}} {{{highlight(purple, purple)}}} {{{highlight(violet, violet)}}} #+BEGIN_SRC org Lorem Ipsum macro: {{{loremipsum}}} #+END_SRC {{{loremipsum}}} ** 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 - \Agrave \Aacute *** Punctuation #+begin_src org - Dash: \ndash \mdash - Marks: \iexcl \iquest - Quotations: \laquo \raquo - Miscellaneous: \para \ordf #+end_src - Dash: \ndash \mdash - Marks: \iexcl \iquest - Quotations: \laquo \raquo - Miscellaneous: \para \ordf *** Commercial symbols #+begin_src org - Property marks: \copy \reg - Currency: \cent \EUR \yen \pound #+end_src - Property marks: \copy \reg - Currency: \cent \EUR \yen \pound *** Greek characters #+begin_src org The Greek letters \alpha, \beta, and \gamma are used to denote angles. #+end_src The Greek letters \alpha, \beta, and \gamma are used to denote angles. *** 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 - Science: \pm \div - Arrows: \to \rarr \larr \harr \rArr \lArr \hArr - Function names: \arccos \cos - Signs and symbols: \bull \star *** Misc #+begin_src org - Smilies: \smiley \sad - Suits: \clubs \spades #+end_src - Smilies: \smiley \sad - Suits: \clubs \spades * Source code ** Inline code You can also evaluate code inline as follows: 1 + 1 is src_R{1 + 1}. ** Code blocks (with syntax highlighting) The source code blocks support syntax highlighting: #+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 #+begin_note You need =htmlize.el= in your ~load-path~, for the HTML export. #+end_note ** Source mode The following language strings are [[https://orgmode.org/worg/org-contrib/babel/languages.html][currently recognized]]: ABC, Asymptote, Awk, C, C++, Calc, Clojure, comint, Coq, CSS, D, Ditaa, Dot (Graphviz), ebnf, Emacs Lisp, Forth, Fortran, Gnuplot, Haskell, Io, J, Java, Javascript, LaTeX, Ledger, Lilypond, Lisp, Make, Matlab, Maxima, Mscgen, Objective Caml, Octave, Org, Perl, Picolisp, PlantUML, Processing, Python, R, Ruby, Sass, Scala, Scheme, Screen, Sed, shell, Shen, SQL, SQLite, Stan, Vala, Contributed, Language, Eukleides, Fomus, Groovy, Julia, Mathematica, Mathomatic, OZ, Stata, Tcl, Emacs Package, Language, Axiom, HTML, Neo4j, Elixir, http request, iPython, Kotlin, Lisp Flavored Erlang, MongoDB, Prolog, rec, Standard ML, Google Translate and Typescript. * Math ** Inline math expressions For *inline math* expressions, use the parentheses notation ~\(...\)~: #+begin_src org 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\). #+end_src 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\). ** Math expressions in display mode For mathematical expressions which you want to make *stand out, centered on their own lines*, use ~\[...\]~: #+begin_src org 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} \] #+end_src ** Include Org files You can include another Org file and skip its title by using the ~:lines~ argument to ~#+INCLUDE~: #+begin_src org ,#+INCLUDE: "chapter1.org" :lines "2-" #+end_src #+begin_note File inclusion, through INCLUDE keywords, is an *export-only feature*. #+end_note * Footnotes #+begin_src org It is possible to define named footnotes[fn:myfootnote], or ones with automatic anchors[fn:2]. #+end_src #+results: It is possible to define named footnotes[fn:myfootnote], or ones with automatic anchors[fn:2]. * Useful extensions ** Todo extension *** Dates Timestamps: [2014-01-16 Thu] and <2014-01-16 Thu>. *** TODO We need to achieve... *** DONE [#A] Buy GTD book :online: :LOGBOOK: - State "TODO" -> "DONE" [2014-01-16 Thu 09:52] :END: By default, ~DONE~ actions will be collapsed. Note that I should probably implement that default behavior only for ~ARCHIVE~'d items. *** [#A] TODO Read GTD book SCHEDULED: <2014-09-11 Thu> 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): #+begin_src org :eval no ,#+HTML_HEAD: #+end_src *** [#B] TODO Apply GTD methodoloy DEADLINE: <2014-12-01 Mon> :PROPERTIES: :HTML_CONTAINER_CLASS: hsCollapsed :END: This section will be collapsed when loading the page because the entry has the value ~hsCollapsed~ for the property ~:HTML_CONTAINER_CLASS:~. Powerful, no? *** Some note :computer:write: 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". *** Weekly review :computer: 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! ** Bigblow extension The string ~fixme~ (in *upper case*) gets replaced by a "Fix Me!" image: #+begin_src org FIXME Delete this... #+end_src FIXME Delete this... * Citations Cross-referenced to bibliography. * Appendix Special sections. ** Index Index (or list of acronyms). - Write index entries #+index: Org-mode Note that multi-entry terms generate separate index entries. #+index: Definitions!Org-mode - Place the index at the desired location - Produce the index by updating ~org-latex-pdf-process~ #+BIND: org-latex-pdf-process ("pdflatex %b" "bibtex %b" "pdflatex %b" "pdflatex %b") ** Bibliography The bibliography... - Eric Steven Raymond. The Art of Unix Programming. Addison-Wesley. ISBN 0-13-142901-9. # http://rmarkdown.rstudio.com/authoring_bibliographies_and_citations.html ** Glossary - A glossary term :: The corresponding (indented) definition. - A second glossary term :: The corresponding (indented) definition. * 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. # This is for the sake of Emacs. # End: