Working with Emacs/org-mode, notes set 1

  • Install Emacs first from gnu repos, depends on your OS
  • Create or copy an `init.el` file in either the `~/.emacs` or `~/.emacs.d` file (for Mac or Linux, check documentation for Windows)
  • Initialise elpa and melpa package repositories, then install the following packages
  • ESS to work with R and Julia etc
  • Org-mode to work with text and notes
  • Auctex for rich latex support and bibtex support
  • org-ref or ox-bibtex for bibliography management
  • If you want to use beamer for presentations in org-mode, install beamer package separately for your system
  • Follow instructions in each package as to how to configure the `init.el` file
  • Many many modes exist, we touch org-mode for note taking, document authoring and time/task management. Check for more information. Search for the website of Sacha Chua, org-mode, ESS, R for more information as to how to install them.
  • Emacs is different, if you use plain text and learn keystrokes, you will get a lot out of it, without any programming on your part, :-), give it a shot. Below are some points to get you started.
  • It is free and open source, enormous community support.

Usage notes

  1. Close files with C-x C-c
  2. Save files/buffers with C-x C-s
  3. Insert a basic header file for export with `M-org-export-default`. This is a nice template you can change to suit your taste and requirements
  4. First level header with one asterisk, second level header ** and so on. All forms of text decorations, emphasis, etc supported. Insert horizontal lines with 5 dashes
  5. Hyperlinks with [[URL][descriptor]]
  6. Insert mages with [[./file_address.ext]]
  7. Use block images with `#+NAME: id` and then crosslink with `[[id]]`
  8. Code block start with `#+begin_src language parameters`
  9. Code blocks end with `#+end_src`
  10. Comment blocks between `#+begin_comments` and `#+end_comments`
  11. Install auctex in Emacs or ox-bibtex, then configure .emacs file and use a bibtex file to store bibliography, for export of bibliography to html install bibtex2html for your OS
  12. For citation management, C-c C-x [ and select the reference
  13. In the end of the document, put `#+bibliography: filename plain`
  14. To add footnote, C-c C-x f, footnotes generally follow the convention of `[fn:<number>] and footnote text somewhere.
  15. To add tables, use | table header <tab>
  16. For export to other formats, C-c C-e h h (html), C-c C-e l p (pdf through latex), and similar commands for exporting to Odt
  17. Add Todo items with C-c C-x t
  18. Add timestamp with C-u C-c .
  19. Can configure C-c/C-v etc for copy/paste but better with M-w for copy, C-w for kill, C-y to yank back from kill-ring
  20. M-h to select lines, regions etc. Then use commands in 18 to work with them
  21. Evaluate expressions in code blocks with C-c C-c
  22. With R, Python, Julia, etc, use :session as an option to make data persistent across code blocks
  23. With R, `:results value` yields formatted table of the last run code, `:results: output` yields all code outputs
  24. With R, separate the figures and tables/outputs as separate blocks
  25. Use M-up/down arrows to move blocks of text up and down the buffer
  26. Use M-< or M-> to demote/promote headings
  27. A buffer is not a file. Save files in buffers with C-x C-s
  28. Open shell with M-x shell, you can run any shell code you like
  29. You can open shell in minor mode with M-!, or, M-|. With M-|, you can read from the buffer and make changes in the buffer

Associate Professor of Epidemiology and Environmental Health at the University of Canterbury, New Zealand. Also in:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store