This page looks best with JavaScript enabled

Org Notes

 ·   ·  โ˜• 3 min read · ๐Ÿ‘€... views
    ๐Ÿท๏ธ
  • #org

Introduction

This notes is on how to use org-mode to write things. Org provides with many functionalities and is highly customizable and extensible. Every writing feature encompasses some handy tricks listed like below:

  • KEYS PRESSED (function called - optional): explanation on what it does

Basic Editing

Comments

C-c ;
toggle comment of an entry
1
2
3
4
5
6
7
* COMMENT Comment an entry

# comment a line

#+begin_comment
block of coment
#+end_comment

Font types

1
2
3
4
5
6
- /italic/
- *bold*
- _underlined_
- =verbatim=
- ~code~
- +strike-through+

will be rendered as:

  • italic
  • bold
  • underlined
  • verbatim
  • code
  • strike through

Org Entities

for entering special characters, we can use org entities:

https://stackoverflow.com/questions/16443386/how-to-escape-double-quote/31207746#31207746

1
=\equal=

Headings

1
2
3
4
* H1
** H2
*** H3
**** H4
  • C-RET: new heading
  • M-RET: new heading by spliting current heading
  • C-S-RET: new heading, but with TODO
  • M-S-RET: new heading by spliting current heading, but with TODO
  • M-LEFT/RIGHT: Promote/Demote current subtree
  • M-UP/DOWN: Move/swap subtree up/down

Code

Offers two types of source code:

  1. code block
  2. inline code

org-entities-help function helps you insert some code.

inline

1
2
src_c++[:exports code]{ typedef long long ll; }
src_shell[:exports code]{ echo -e "test" }

typedef long long ll;
echo -e "test"

code block

source code blocks are one of many Org block types.

1
2
3
4
5
6
7
8
#+BEGIN_SRC cpp
  #include <iostream>
  using namespace std;
  int main() {
    cout << "123\n";
    return 0;
  }
#+END_SRC
1
2
3
4
5
6
#include <iostream>
using namespace std;
int main() {
  cout << "123\n";
  return 0;
}

List

M-RET
new item at current level
M-S-RET
new item with a checkbox
M-UP/DOWN
move item up/down, including subitems
M-S-UP/DOWN
move item up/down
M-LEFT/RIGHT
decrease/increase indentation of item
M-S-LEFT/RIGHT
decrease/increase indentation of item, including subitems
C-c C-c
toggle checkbox
C-c -
Cycle through itemize/enumerate bullets

Table

  • |Name|Age C-c RET create table with headers
    NAME Age
    sky 22
    k4i 23
  • RET go to next row
  • S-UP/DOWN/LEFT/RIGHT swap between cells
  • M-UP/DOWN/LEFT/RIGHT swap between rows/columns
  • M-S-UP/DOWN/LEFT/RIGHT insert/delete row/column
  • C-c - insert horizontal line below
  • C-c RET insert horizontal line below, move to next row
  • C-c ^ sort column

Footnote

for more information on footnote, please refer to the official org site1.

footnote types:

named footnote
fn:NAME
anonymous, inline footnote
fn:: inline definition, fn:NAME: inline definition

example

1
2
3
The Org homepage[fn:1] now looks a lot better than it used to.
...
[fn:1] The link is: https://orgmode.org
  • formats
  • link types
    • internal links
    • external links
  • shortcuts
    • C-c C-l: insert/delete link
    • C-c C-o: open link

todos [1/2]

DONE subtask 01

M-S-RET
new todo item
C-c C-t
cycle through todo states

BUG subtask 02 [1/2]

  • [-] item 01
    • item 01.01
    • item 01.02
  • item 02

Images

C-c C-x C-v
toggle images (org-toggle-inline-images)

Exports

latex

latex config

1
2
3
4
tlmgr update elegantpaper
tlmgr install elegantpaper # [[https://github.com/ElegantLaTeX/ElegantPaper][elegantpaper]]
tlmgr uninstall elegantpaper
pip install pygments # dependency of [[https://github.com/gpoore/minted][minted]]

add this in your front matter

1
2
3
#+LATEX_COMPILER: xelatex
#+LATEX_CLASS: elegantpaper
#+OPTIONS: prop:t

fixed reference ids

Org will set random ids for internal links, sometimes we want them to be fixed.

There are two solutions, one is to seed the random number generater2.

1
2
(defun seed-random-generator (_) (random "a fixed and unchanging string"))
(add-hook 'org-export-before-processing-hook #'seed-random-generator)

And another way is to override the org-export-new-reference3 function:

1
2
3
4
5
(defun org-export-deterministic-reference (references)
  (let ((new (length references)))
    (while (rassq new references) (setq new (+ new 1)))
    new))
(advice-add #'org-export-new-reference :override #'org-export-deterministic-reference)
Share on