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 http://www.emacswiki.org 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. Open and start new files C-x C-f
  2. Close files with C-x C-c
  3. Save files/buffers with C-x C-s
  4. 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
  5. 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
  6. Hyperlinks with [[URL][descriptor]]
  7. Insert mages with [[./file_address.ext]]
  8. Use block images with `#+NAME: id` and then crosslink with `[[id]]`
  9. Code block start with `#+begin_src language parameters`
  10. Code blocks end with `#+end_src`
  11. Comment blocks between `#+begin_comments` and `#+end_comments`
  12. 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
  13. For citation management, C-c C-x [ and select the reference
  14. In the end of the document, put `#+bibliography: filename plain`
  15. To add footnote, C-c C-x f, footnotes generally follow the convention of `[fn:<number>] and footnote text somewhere.
  16. To add tables, use | table header <tab>
  17. 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
  18. Add Todo items with C-c C-x t
  19. Add timestamp with C-u C-c .
  20. 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
  21. M-h to select lines, regions etc. Then use commands in 18 to work with them
  22. Evaluate expressions in code blocks with C-c C-c
  23. With R, Python, Julia, etc, use :session as an option to make data persistent across code blocks
  24. With R, `:results value` yields formatted table of the last run code, `:results: output` yields all code outputs
  25. With R, separate the figures and tables/outputs as separate blocks
  26. Use M-up/down arrows to move blocks of text up and down the buffer
  27. Use M-< or M-> to demote/promote headings
  28. A buffer is not a file. Save files in buffers with C-x C-s
  29. Open shell with M-x shell, you can run any shell code you like
  30. 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: https://refind.com/arinbasu

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