现在的位置: 首页 > 综合 > 正文

Emacs Org-Mode Note

2013年10月09日 ⁄ 综合 ⁄ 共 7489字 ⁄ 字号 评论关闭


1 NEED TO KNOW

1.1 Basic

M-Enter 可以生成标题

1.2 字体

/italic/斜体
*bold*黑体
_underlined_下划线
=code= 等宽
~verbatim~表保持原有格式输出(LaTeX有个verbatim环境,功能一样)

1.3 links锚点

#<<anchor>>标志着一个锚点
[[anchor][description]]链接到锚点

1.4 radio links

<<<anchor>>> 则全文所有[[anchor]]都是到上面锚点的链接
C-c C-c update

1.5 footnote

C-c C-x f 即可快速添加添加Footnote 形式是[fn:1]并将光标转到Footnote处
也可以[1]这样来添加,但需要手工添加Footnote文本,建议用上面那个。

1.6 环境

#+BEGIN_CENTER与 #+END_CENTER之间的文本居中
#+BEGIN_VERSE #+END_VERSE和#+BEGIN_QUOTE #+END_QUOTE可以保留引文的格式
#+BEGIN_SRC #+END_SRC 源码环境
-n add line number
-r reference

例如:

注意下面源码中要把\ref换成ref
#+BEGIN_SRC emacs-lisp -n -r
     (save-excursion                  (\ref:sc)
        (goto-char (point-min))       (\ref:jump)
#+END_SRC
In line [[(sc)]] we remember the current position.  [[(jump)][Line (jump)]]
jumps to point-min.

效果:

1:  (save-excursion
2:     (goto-char (point-min))

In line 1 we remember the current position. Line 2 jumps to point-min.

1.7 插入表格

插入表格的快捷键

#+CAPTION: 表格或者图片的标题
#+LABEL: label_name 标记一个标签,\ref{label_naem}可以引用该标签
#+ATTR_HTML: border="3" rules="all" frame="all     指定表格边框及宽度

1.8 插入图片

简单地显示一个图片
[[~/Desktop/Screenshot.png]]

显示一个图片ubuntu_log.png,单击该图片会链接到baidu
[[http://baidu.com]]

显示一个图片ubuntu_log.png,单击该图片会链接到Screenshot.png
[]

#+ATTR_HTML可以指定图片或表格的属性,例如:#+ATTR_HTML: alt="cat/spider image" title="Action!" align="right"

1.9 添加附件

快捷键 C-c
C-a
 可以列出选项,其中a是添加文件系统中的文件来做为附近

1.10 列表

1.10.1 无序

以 - + * (必须缩进以区分 outline 的)

1.10.2 有序

以 1或 1.或 1)开头

1.10.3 描述

以-开头后跟 空格 待描述字 :: 描述

1.10.4 Shortkeys

C-c - turn heading line to items
C-c * turn item into headling
S-UP/DOWN previous/next item
M-S-UP/DOWN move item up/down

1.11 #+INCLUDE

1.11.1 usage

CANNOT INCLUDE FILE ~/filename
如果是源码文件的话可以加上src 语言类型
CANNOT INCLUDE FILE ~/filename

1.11.2 shortkey

C-c ' visit the include file at point

1.12 Export Options

`C-c C-e t'
     Insert template with export options, see example below.

     #+TITLE:       the title to be shown (default is the buffer name)
     #+AUTHOR:      the author (default taken from `user-full-name')
     #+DATE:        a date, fixed, of a format string for `format-time-string'
     #+EMAIL:       his/her email address (default from `user-mail-address')
     #+DESCRIPTION: the page description, e.g. for the XHTML meta tag
     #+KEYWORDS:    the page keywords, e.g. for the XHTML meta tag
     #+LANGUAGE:    language for HTML, e.g. `en' (`org-export-default-language')
     #+TEXT:        Some descriptive text to be inserted at the beginning.
     #+TEXT:        Several lines may be given.
     #+OPTIONS:     H:2 num:t toc:t \n:nil @:t ::t |:t ^:t f:t TeX:t ...
     #+BIND:        lisp-var lisp-val, e.g.: org-export-latex-low-levels itemize
                    You need to confirm using these, or configure `org-export-allow-BIND'
     #+LINK_UP:     the ``up'' link of an exported page
     #+LINK_HOME:   the ``home'' link of an exported page
     #+LATEX_HEADER: extra line(s) for the LaTeX header, like \usepackage{xyz}
     #+EXPORT_SELECT_TAGS:   Tags that select a tree for export
     #+EXPORT_EXCLUDE_TAGS:  Tags that exclude a tree from export

其中#+OPTIONS可以指定选项有:
     H:         set the number of headline levels for export
     num:       turn on/off section-numbers
     toc:       turn on/off table of contents, or set level limit (integer)
     \n:        turn on/off line-break-preservation
     @:         turn on/off quoted HTML tags
     ::         turn on/off fixed-width sections
     |:         turn on/off tables
     ^:         turn on/off TeX-like syntax for sub- and superscripts.  If
                you write "^:{}", `a_{b}' will be interpreted, but
                the simple `a_b' will be left as it is.
     -:         turn on/off conversion of special strings.
     f:         turn on/off footnotes like this[1].
     todo:      turn on/off inclusion of TODO keywords into exported text
     pri:       turn on/off priority cookies
     tags:      turn on/off inclusion of tags, may also be `not-in-toc'
     <:         turn on/off inclusion of any time/date stamps like DEADLINES
     *:         turn on/off emphasized text (bold, italic, underlined)
     TeX:       turn on/off simple TeX macros in plain text
     LaTeX:     turn on/off LaTeX fragments
     skip:      turn on/off skipping the text before the first heading
     author:    turn on/off inclusion of author name/email into exported file
     creator:   turn on/off inclusion of creator info into exported file
     timestamp: turn on/off inclusion creation time into exported file
     d:         turn on/off inclusion of drawers

2 SHORTCUTS

Export Options  
insert template with export option C-c C-e t
MOTION  
next/previous headings C-c C-n/C-p
next/previous headings, same level C-c C-f/b
backward to higher level heading C-c C-u
previous/next plain list items S-UP/DOWN
Structure editing  
promote/demote heading M-LEFT/RIGHT
promote/demote current subtree M-S-LEFT/RIGHT
turn (head)line into items, cycle item type C-c -
turn items/line into headline C-c *
move subtree/list item up/down M-S UP/DOWN
Links  
insert a link C-c C-l
insert file link with file name completetion C-u C-c C-l
edit link at point C-c C-l
find next link C-c C-x C-n
find previous link C-c C-x C-p

3 TABLE

表格生成是Org的一大特点,其快捷键基本如下(不一定死记,用的时候多查看,久了自然记住了)

Creating a table  
just starting typing  
convert region to table C-c bar
separator at least 3 spaces c-3 C-c bar
Commands available inside tables  
re-align the table, move to next field TAB
re-align the table, move to the next row RET
move to previous field S-TAB
move to the begin/end of field M-a/e
Row and column editing  
move the current column left/right M-LEFT/RIGHT
kill the current column M-S-LEFT
insert new column to left of cursor position M-S-RIGHT
move the current row up/down M-UP/DOWN
kill the current row M-S-UP
insert new row above the current row M-S-DOWN
Insert Hline  
insert hline above the current line C-u C-c -
insert hline below the current line C-c -
insert hline and move to line below it C-c RET
sort lines in region C-c ^
Regions  
edit the current field in a seperate window C-c '
export as tab-seperated file M-x org-table-export
import tab-seperated file M-x org-table-import

4 Tricks

4.1 嵌入Google搜索

加入以下代码即可:

#+BEGIN_HTML
<form action="http://www.google.com/cse" id="cse-search-box">
  <div>
    <input type="hidden" name="cx" value="002987994228320350715:z4glpcrritm" />
    <input type="hidden" name="ie" value="UTF-8" />
    <input type="text" name="q" size="31" />
    <input type="submit" name="sa" value="Search" />
  </div>
</form>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>
#+END_HTML

4.2 Org 生成HTML中嵌入搜索

将其中的搜索改成自己的就好

#+BEGIN_HTML
<form method="get" action="http://search.gmane.org/">
<input type="text" name="query">
<input type="hidden" name="group" value="gmane.emacs.orgmode">
<input type="submit" value="Search gmane.emacs.orgmode">
</form>
#+END_HTML

4.3 Org 生成HTML中嵌入Google日历

#+BEGIN_HTML
  <center>
    <iframe src="https://www.google.com/calendar/embed?title=Eric%20Schulte&amp;showCalendars=0&amp;height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=schulte.eric%40gmail.com&amp;color=%232952A3&amp;ctz=America%2FDenver" style=" border-width:0 " width="800" height="600" frameborder="0" scrolling="no"></iframe>
  </center>
#+END_HTML

4.4 Org 生成HTML中对图片进行div处理

#+begin_html 
  <a href="http://github.com/eschulte"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub" /></a>
#+end_html  

4.5 More Tricks

不是关于Org-mode的 Emacs Tricks(不断更新中)

5 导出HTML时CSS配置

6 Org-remember

6.1 配置

org-remember是中一个比较好用的功能,先贴上我的配置:

(org-remember-insinuate)
(setq org-default-notes-file  "~/.emacs.d/GDT/.notes.org")
(define-key global-map [M-f12] 'org-remember)
(setq org-remember-templates
      '(("TODO" ?t "* TODOS %^{TO DO What(Briefly)} \n %?" "~/.emacs.d/GDT/.notes.org" "TODO")
    ("IDEA" ?i "* TODO %^{What's your IDEA (Briefly)} \n %?" "~/.emacs.d/GDT/.notes.org" "IDEA")
    ("MOVIE" ?m "* TODO %^{Enter the Movie Name}\n %?" "~/.emacs.d/GDT/.notes.org" "MOVIE")
    ("SITES" ?s "* %^{Enter the Name of the Site}\n %?" "~/.emacs.d/GDT/.notes.org" "SITES")
    ("BlogToPublish" ?b "* %^{Enter the Name of the Blog}\n %a %?" "~/.emacs.d/GDT/.notes.org" "BlogToPublish")))

6.2 使用

设置M-F12为org-remember快捷键,并在~/.emacs.d/GDT下建立了一个.notes.org文件。 比如现在我想到有一件要做的事,我可以把它记下来: M-F12 在Mini Buffer中出现如下图所示的几个选项,分别是TODO IDEA MOVIE SITES BlogToPublish.

此时按下t然后根据提示输入想办的事情。 再比如我遇到一个好的网站,M-F12,然后输入s 然后根据提示输入网站内容及网址。

6.3 参数简介

以("IDEA" ?i "* TODO %What's your IDEA (Briefly) \n %?" "~/.emacs.d/GDT/.notes.org" "IDEA")为例:

  1. ?i表示快捷键i
  2. %tips tips表提示,输入的内容将替换%
  3. \n表换行
  4. %?表光标所放的位置
  5. "IDEA"表标题,添加的内容将会做为它的子标题出现在.note.org中

抱歉!评论已关闭.