dryman / org-mode-slide

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Org mode

What is it?

Features (1)

  • Math formulas

\[ e = -1 \]

  • Tables
NamePhoneAge
Peter123417
Anna432118

Features (2)

Plots

plot sin(x)

img/sin.png

Features (3)

Diagrams (ditaa)

+--------+   +-------+    +-------+
|        | --+ ditaa +--> |       |
|  Text  |   +-------+    |diagram|
|Document|   |!magic!|    |       |
|     {d}|   |       |    |       |
+---+----+   +-------+    +-------+
    :                         ^
    |       Lots of work      |
    +-------------------------+

img/diag.png

Need to configure ditaa.jar in org mode babel config.

Features (4)

  • TODO list
  • Agenda view
  • Archives
  • Hobby tracking
  • many more..

Features (4) won’t be covered today.

Install

  • Install Emacs
  • Emacs configuration (Emacs lisp)

Emacs

  • OSX
brew install emacs --with-cocoa --with-imagemagick --devel --librsvg
brew linkapps emacs
  • Linux
sudo apt-get install emacs # ubuntu/debian
sudo yum install emacs     # centos
  • Windows

Check online manual and download links

Emacs setup

Copy this to ~/.emacs https://github.com/dryman/org-mode-slide/blob/master/.emacs

Then execute emacs and it should be all set

Emacs basics

  • GUI version and command line version
    • emacs –no-window-system
    • emacs -nw
  • Most common features are in toolbar and menu bar

Keys

  • C- Control
  • M- Meta (option) or Esc
  • S- Shift
  • s- Super (apple/command/windows key)

View commands in menu

file:img/menu.png

  • Or search for emacs cheatsheet on google.
  • Not necessary to memorize these shortcuts.

Enter org mode

  • Create a notes directory at home

mkdir -p ~/notes/img

  • Menu -> File -> Visit new file (C-x C-f)
  • Select ~/notes/index.org

You can change the directory setup in .emacs file.

Org mode syntax

Document header

At the begining of the doc:

#+TITLE:  Docuemnt title
#+AUTHOR: Your name

#+EMAIL:  bla@example.com
#+DESCRIPTION: simple example
#+KEYWORDS:  org-mode, syntax
#+LANGUAGE:  en

Document structure

* heading 1 (chapter in latex)
New chapter.
** heading 2 (section)
Paragraph in new section
*** heading 3 (subsection)
Paragraph in new sub-section
**** heading 4 (subsubsection)
Paragraph in new sub-sub-section

Formatting text

/Emphasize/ (italics)
*strongly* (bold)
*/very strongly/* (bold italics)
~inline code~
=verbatim text=
+deleted text+
super^{script}
sub_{script}

Lists

- Item with some lengthy text wrapping hopefully across several lines. We add
  a few words to really show the line wrapping.
- Bullet.
  + Bullet.
    * Bullet.
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.

Tables

#+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    |                  |

Links

http://idryman.org
file:otherfile.html
[[file:img/demo.png]]
[[http://orgmode.org/][Org mode Web site]]
[[file:otherfile.html][other file]]
[[mailto:john.doe@example.com][email John Doe]]

advanced syntax

Math formulas

  • Greek characters: α β
\alpha \beta
  • Inline math: ∑n=1^10 n^2

Latex formatted math

\begin{equation}
x=\sqrt{b}
\end{equation}
     
If $a^2=b$ and \( b=2 \), then the solution must be
either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].

\begin{equation} x=\sqrt{b} \end{equation}

If $a^2=b$ and \( b=2 \), then the solution must be either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].

plots

See source code for how it is done. The export system cannot read the syntax.

plot cos(x)

Export

  • M-x org-publish<RET>notes<RET>
  • Output file would be in ~/notes/public_html
  • Open the output and see how it looks

Publish

  • school website: upload the exported index.html to hosting directory
    • I don’t recommand to use emacs remotely
    • Installing latest emacs is hard, and too many commands to memorize
  • github pages (need to learn git)

Github pages

Assuming github account and online repository is setup

cd public_html
git init
git checkout gh-pages
git add .
git commit -m 'creating gh-pages'
git remote add origin git@github.com:user/repo.git
git push origin gh-pages

Thanks for viewing!

About


Languages

Language:Emacs Lisp 100.0%