Table of Contents

1 Org mode

Local variables in org-mode can be bound with

#+BIND: org-hide-emphasis-markers nil     

A “setup” file can be specified to specify the css or backend when exporting ::

#+SETUPFILE: ~/theme.setup

Properties of blocks, header concent, document can be specified. As
well as options for the export.

#+PROPERTY:  header-args :eval yes :exports both :results replace
#+OPTIONS:   H:4 num:nil toc:2 p:t

A “setup” file can be specified to specify the css or backend when
exporting.

#+SETUPFILE: ~/theme-readtheorg.setup 

1.1 Babel

Look what languages are supported in (babel|org source blocks) Which
are installed in your Emacs, names of packages often start with ob-,
can be loaded with load-library.

(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)))
                  ", ")

⮚ My supported languages

Awk, C, R, Asymptote, Calc, Clojure, CSS, Ditaa, Dot, Ebnf2ps, Emacs
Lisp, Forth, Fortran, Gnuplot, Haskell, hledger, 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, Stan,
Vala

If you want to include org files into org files you can use this, the
:lines "-2" starts the insertion at line 2, (excludes the title
etc).

#+INCLUDE: "<org-file>" :lines "2-"  

1.2 Macros in org-mode

Macros in org-mode (when exporting). This creates a macro color that
takes two arguments $1 and $2, which within the macro replacement
syntax {{{x}}}, applies the arguments (in traditional style) and
expands on HTML export.

#+MACRO: <match> <replacement>

'#+MACRO: color @@html:<span style="color: $1">$2</span>@@
{{{color(blue, This text is colored in blue.)}}}
{{{color(red, This other text is in red.)}}}

Examples in Org has the format “<line start>:<example text>”

: Example

Different types of links in org-mode

Link displayed as "Org mode Web site"
[[http://orgmode.org/][Org mode Web site]]
 

#+caption: Image caption
[[file:images/image.png]]
Image inline with caption

[[file:images/image.png][Wickid Pic]]
Inline image displayed as "Wickid Pic"
(when display inline images is nil)

[[../README.org][Previous dir]]
Relative link

[[mailto:stallman@fsf.org][Stallman]]
Email link

[[elisp:(message "hello")][hello]]
Run elisp code on click of link

<<one>> 1 -- Anchor
	 
[[one][The number one]]
Jump to the anchor (a name can count as
an anchor or heading text)

[[type:link][displayed text]]
The TLDR is that links are composed of


You can define a link to a youtube video (which embeds in the html
export) as follows:

(defvar yt-iframe-format
  ;; Exported HTML
  (concat "<iframe width=\"440\""
          " height=\"335\""
          " src=\"https://www.youtube.com/embed/%s\""
          " frameborder=\"0\""
          " allowfullscreen>%s</iframe>%s")) 
 ;; where the text after yt: is the youtube code (found in url, watch?v=<code>)

(org-add-link-type ;;Ex: [[yt:Z6ih1aKeETk][Tycho - Dive (Full Album)]] 
 "yt"

 ;; On click
 (lambda (handle)
   ;; On click construct the youtube url
   (browse-url
    (concat "https://www.youtube.com/embed/"
            handle)))

 ;; On export
 (lambda (path desc backend)
   (cl-case backend
     ;; HTML export
     (html (format yt-iframe-format
                   path (or desc "")))
     ;; LATEX export
     (latex (format "\href{%s}{%s}"
                    path (or desc "video"))))))


1.3 Source Blocks

Sometimes you have to include libraries for org-babel As they might
not be auto-enabled, use load-library or append '(<mode|lang>. t) to
org-babel-load-languages for autoloading.

In source-blocks the :var attribute, lets you create variables
inside of src blocks to literals or org tables.

  • #+BEGIN_SRC elisp :var x=10
    Bind x to the number 10: :var x=10
  • #+BEGIN_SRC elisp :var t=#+table_name
    Bind <table name> to t: :var t=#+table_name
Default blocks in org-mode
  • #+BEGIN_SRC
  • #+BEGIN_EXAMPLE
  • #+BEGIN_QUOTE
  • #+BEGIN_VERSE
  • #+BEGIN_CENTER
  • #+BEGIN_LaTeX
  • #+BEGIN_HTML
  • #+BEGIN_ASCII