org-mode and Worg
Table of Contents
Homepage
- http://orgmode.org/manual/index.html
- http://orgmode.org/worg/ src: git://orgmode.org/orgweb.git
Examples
- org publish el-code example org-publish-example.el
- https://github.com/joshuaeckroth/cse3521-website
- org-mode + jekyll + twitter bootstrap http://github.com/cinsk/jekyll-org/ , example:http://cinsk.github.com/jekyll-org/
- org-mode + jekyll: http://blog.jenkster.com/
- org-mode + Hyde
- https://github.com/dustinlacewell/ghorg A command-line utility for managing an org-mode Hyde blog
- https://github.com/punchagan/org-hyde Export org-mode trees to hyde ready html files
- http://sydi.org that generated by orgmode
- http://www.pirilampo.org/ is all made from Org mode (and only it)
- Web pages made with Org-Mode:http://orgmode.org/worg/org-web.html
- http://renard.github.com/o-blog/ - it's not strictly using org-mode, but an org-mode add-on
- Pelicorg: A Pelican Plugin for Emacs Org For every Org file in your content directory, the plugin will launch Emacs on the command line, process the Elisp you give it, and spit out the completed HTML.
TODO new exported was introduced in org 8.0
Content
TODO how to go back the upper level
inline image
Method1
C-c C-x C-v M-x org-toggle-inline-images
Method2
;; iimage mode (autoload 'iimage-mode "iimage" "Support Inline image minor mode." t) (autoload 'turn-on-iimage-mode "iimage" "Turn on Inline image minor mode." t)
M-x iimage-mode RET
在当前模式里启动 iimage 这个 minor mode。
iimage-mode目前只能显示以文件方式链接的图片。
TODO Capture the image
: ;; screenshot in org-mode : ;; modified by gift.young@gmail.com : ;; based on [http://praktikanten.brueckenschlaeger.org/2010/11/28/screenshots-in-org-mode] : (defun my-screenshot () : "Take a screenshot into a unique-named file in the current buffer file : directory and insert a link to this file." : (interactive) : (setq filename : (concat (make-temp-name : (concat (file-name-directory (buffer-file-name)) "images/" ) ) ".png")) : (if (file-accessible-directory-p (concat (file-name-directory (buffer-file-name)) "images/")) : nil : (make-directory "images")) : (call-process-shell-command "scrot" nil nil nil nil "-s" (concat "\"" filename "\"" )) : (insert (concat "[[" filename "]]")) : (org-display-inline-images) : ) : : (global-set-key (kbd "s-s") 'my-screenshot)
按win-s键,然后用鼠标划要截屏的范围。这一部分会保存在当前org文件的目录下的images目录下,文件名随机。如果该目录不存在,会自动建立。
依赖; scrot 0.8-11 command line screen capture utility
Table
1
| Name | Phone | Age | |-------+-------+-----| | Peter | 1234 | 17 | | Anna | 4321 | 25 |
2
you would only type |Name|Phone|Age| |- and then press TAB to align the table
3
Even faster would be to type |Name|Phone|Age
followed by C-c RET
.
Ref
对于表格和图片,可以在前面增加标题和标签的说明,以方便交叉引用。比如在表格的前面添加:
#+CAPTION: This is the caption for the next table (or link) #+LABEL: tbl:table1
则在需要的地方可以通过
\ref{table1}
来引用该表格。
insert file or picture
[[pic_path]] [[file_path]]
As of Org 8.0, "Attribute lines now take plists" :
#+attr_html: :width 100px [[~/images/example.jpg]]
inner anchor
定义锚点 <<my-anchor>>
[[my-anchor][anchor name] ]
LaTex1
The default is to use the MathJax system which should work out of the box with Org mode installation because http://orgmode.org serves MathJax for Org mode users for small applications and for testing purposes.
insert Latex code blocks
example SRC:
\begin{equation} \begin{align} \mbox{Union: } A\cup B = \{x\mid x\in A \mbox{ or } x\in B\} \newline \mbox{Concatenation: } A\circ B = \{xy\mid x\in A \mbox{ and } y\in B\} \\ \mbox{Star: } A^\star = \{x_1x_2\ldots x_k \mid k\geq 0 \mbox{ and each } x_i\in A\} \\ \end{align} \end{equation}
Output:
\begin{equation} \begin{align} \mbox{Union: } A\cup B = \{x\mid x\in A \mbox{ or } x\in B\} \newline \mbox{Concatenation: } A\circ B = \{xy\mid x\in A \mbox{ and } y\in B\} \\ \mbox{Star: } A^\star = \{x_1x_2\ldots x_k \mid k\geq 0 \mbox{ and each } x_i\in A\} \\ \end{align} \end{equation}insert inline Latex codes
example SRC:
If $a^2=b$ and \( b=2 \), then the solution must be either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].
Output: If \(a^2=b\) and \( b=2 \), then the solution must be either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].
Footnote
- C-c C-x f The footnote action command
- C-c C-c Jump between definition and reference.
Html export options
#+OPTIONS: H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t TeX:t LaTeX:nil skip:nil d:t tags:not-in-toc
中文中,转成HTML时,换行符成空格符号2
(defadvice org-html-paragraph (before org-html-paragraph-advice (paragraph contents info) activate) "Join consecutive Chinese lines into a single long line without unwanted space when exporting org-mode to html." (let* ((origin-contents (ad-get-arg 1)) (fix-regexp "[[:multibyte:]]") (fixed-contents (replace-regexp-in-string (concat "\\(" fix-regexp "\\) *\n *\\(" fix-regexp "\\)") "\\1\\2" origin-contents))) (ad-set-arg 1 fixed-contents)))
Working with source code
Include files
#+INCLUDE: "~/.emacs" src emacs-lisp
#+INCLUDE: "~/.emacs" :lines "5-10" Include lines 5 to 10, 10 excluded #+INCLUDE: "~/.emacs" :lines "-10" Include lines 1 to 10, 10 excluded #+INCLUDE: "~/.emacs" :lines "10-" Include lines from 10 to EOF
inline
1. =code=
2. ~code~
3. src_LANG[headers]{your code}
avoid repeated = and /
* Italics , - Your example simply works\\ , /cologne/dome/ , - It also works if your /example had / spaces within it/ , - It will only fail if / your /have spaces on one end or the other / * Code , Code blocks can be delimited in multiple ways: , ** Inline formatting , - Using ~ for verbatim text works\\ , ~<pre language="python">~ , - ~ renders the same as = for blocks =test= ~test~ , ** Code Blocks , - Single-line blocks , : <pre language="python"> , - Multi-line blocks , #+BEGIN_EXAMPLE , asdf , #+END_EXAMPLE
HTML Export
<div id="outline-container-1" class="outline-2"> <h2 id="sec-1"><span class="section-number-2">1</span> Italics</h2> <div class="outline-text-2" id="text-1"> <ul> <li>Your example simply works<br/> <i>cologne/dome</i> </li> <li>It also works if your <i>example had / spaces within it</i> </li> <li>It will only fail if / your /have spaces on one end or the other / </li> </ul> </div> </div> <div id="outline-container-2" class="outline-2"> <h2 id="sec-2"><span class="section-number-2">2</span> Code</h2> <div class="outline-text-2" id="text-2"> <p>Code blocks can be delimited in multiple ways: </p> </div> <div id="outline-container-2-1" class="outline-3"> <h3 id="sec-2-1"><span class="section-number-3">2.1</span> Inline formatting</h3> <div class="outline-text-3" id="text-2-1"> <ul> <li>Using ~ for verbatim text works<br/> <code><pre language="python"></code> </li> <li>~ renders the same as = for blocks <code>test</code> <code>test</code> </li> </ul> </div> </div> <div id="outline-container-2-2" class="outline-3"> <h3 id="sec-2-2"><span class="section-number-3">2.2</span> Code Blocks</h3> <div class="outline-text-3" id="text-2-2"> <ul> <li>Single-line blocks <pre class="example"> <pre language="python"> </pre> </li> <li>Multi-line blocks <pre class="example">asdf </pre> </li> </ul>
See Literal examples and Emphasis and monospace in the Org-Manual for full details.
Languages
Code blocks in the following languages are supported.
Language Identifier Language Identifier Asymptote asymptote Awk awk Emacs Calc calc C C C++ C++ Clojure clojure CSS css ditaa ditaa Graphviz dot Emacs Lisp emacs-lisp gnuplot gnuplot Haskell haskell Java java Javascript js LaTeX latex Ledger ledger Lisp lisp Lilypond lilypond MATLAB matlab Mscgen mscgen Objective Caml ocaml Octave octave Org mode org Oz oz Perl perl Plantuml plantuml Python python R R Ruby ruby Sass sass Scheme scheme GNU Screen screen shell sh SQL sql SQLite sqlite
Language-specific documentation is available for some languages. If available, it can be found at http://orgmode.org/worg/org-contrib/babel/languages.
Some useful symbols
\(\mathcal{O}(N)\)
$\mathcal{O}(N)$
upgrade org-mode
M-x list-packages Enter Ctrl+s org Enter Click the “Install Button”
“Invalid Function” org-with-silent-modifications
uninstalling org-mode and reinstall it.
M-x package-list Enter Ctrl+s org enter Type the letter d Then press x
check org version
M-x org-version