Tumashu's org-mode configuation
1 简介
这个文件是tumashu个人专用的emacs配置文件,emacs中文用户可以参考。
2 代码
(use-package org :ensure nil :config (use-package ox :ensure nil :config ;; Export language (setq org-export-default-language "zh-CN")) (use-package org-chinese-utils :ensure nil :config (org-chinese-utils-enable)) (use-package ox-html :ensure nil :config ;; html (setq org-html-coding-system 'utf-8) (setq org-html-head-include-default-style t) (setq org-html-head-include-scripts t)) (use-package ox-latex :ensure nil :config ;; 不要在latex输出文件中插入\maketitle (setq org-latex-title-command "") (setq org-latex-date-format "%Y-%m-%d") ;; (setq org-latex-create-formula-image-program 'imagemagick) ;默认支持中文 (setq org-latex-create-formula-image-program 'dvipng) ;速度较快,但默认不支持中文 (setq org-format-latex-options (plist-put org-format-latex-options :scale 2.5)) (setq org-format-latex-options (plist-put org-format-latex-options :html-scale 2.5))) (use-package ox-latex-chinese :ensure nil :config (oxlc/toggle-ox-latex-chinese t)) (use-package org-capture :ensure nil) (use-package ox-odt :ensure nil) (use-package ox-ascii :ensure nil) (use-package ox-beamer :ensure nil) (use-package ox-md :ensure nil) (use-package ox-deck :ensure nil) (use-package ox-rss :ensure nil) (use-package ox-s5 :ensure nil) (use-package org-mime :ensure nil) (use-package org-bookmark :ensure nil) (use-package org-protocol :ensure nil) (use-package org-screenshot :ensure nil) (use-package ox-bibtex :ensure nil) ;; (use-package ob-R :ensure nil) ;; org-plus-contrib (use-package ox-extra :ensure nil :config ;; 如果一个标题包含TAG: “ignore” ,导出latex时直接忽略这个标题, ;; 但对它的内容没有影响。 (ox-extras-activate '(latex-header-blocks ignore-headlines))) (use-package ox-bibtex-chinese :ensure nil :config (ox-bibtex-chinese-enable)) (use-package ob-plantuml :ensure nil :config (setq org-plantuml-jar-path "~/bin/plantuml.jar")) (use-package org-agenda :ensure nil :config (setq org-agenda-files (append (file-expand-wildcards "~/org/*.org"))) (setq org-agenda-custom-commands '(("l" "agenda:" ((agenda "" ((org-agenda-overriding-header "Two-Days") (org-agenda-span 2))) (tags-todo "生活|IT|购物"))))) (setq org-agenda-remove-tags t)) (use-package ob-core :ensure nil :config (setq org-confirm-babel-evaluate nil)) ;; 自定义变量 (setq eh-org-mathtoweb-file "~/bin/mathtoweb.jar") (setq org-latex-to-mathml-convert-command "java -jar %j -unicode -force -df %o %I" org-latex-to-mathml-jar-file eh-org-mathtoweb-file) (setq org-todo-keywords '((sequence "TODO(t)" "WAIT(w@/!)" "|" "DONE(d!)" "CANCELED(c@)"))) (setq org-insert-heading-respect-content nil) (setq org-log-done t) (setq org-startup-indented nil) (setq org-edit-src-content-indentation 0) (setq org-export-backends '(ascii beamer html latex md deck rss s5 odt)) (add-to-list 'auto-mode-alist '("\.\(org\|org_archive\)$" . org-mode)) ;; org默认使用"_下标"来定义一个下标,使用"^上标"定义一个上标, ;; 但这种方式在中文环境中与下划线冲突。 ;; 这里强制使用"_{下标}"来定义一个下标。"^{上标}"来定义一个上标。 (setq org-export-with-sub-superscripts '{}) (setq org-use-sub-superscripts '{}) ;; org-bable设置 (setq org-src-fontify-natively t) (org-babel-do-load-languages 'org-babel-load-languages '((org . t) ;; (R . t) (ditaa . nil) (dot . nil) (emacs-lisp . t) (gnuplot . t) (haskell . nil) (mscgen . t) (latex . t) (ocaml . nil) (perl . t) (python . nil) (ruby . nil) (screen . nil) ;; (shell . nil) (sql . nil) (sqlite . nil))) ;; Use Cairo graphics device by default,which can get better graphics quality. ;; you shoule add below lines to you ~/.Rprofile ;; require("Cairo") ;; CairoFonts(regular="SimSun:style=Regular", ;; bold="SimHei:style=Regular", ;; italic="KaiTi_GB2312:style=Regular", ;; symbol="Symbol") ;; ;; (setq org-babel-R-graphics-devices ;; '((:bmp "bmp" "filename") ;; (:jpg "jpeg" "filename") ;; (:jpeg "jpeg" "filename") ;; (:tikz "tikz" "file") ;; (:tiff "tiff" "filename") ;; (:png "CairoPNG" "filename") ;; (:svg "CairoSVG" "file") ;; (:pdf "CairoPDF" "file") ;; (:ps "CairoPS" "file") ;; (:postscript "postscript" "file"))) ;; Add new easy templates (setq org-structure-template-alist (append '(("r" "#+BEGIN_SRC R\n?\n#+END_SRC") ("e" "#+BEGIN_SRC emacs-lisp\n?\n#+END_SRC") ("ex" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE") ("rh" "#+PROPERTY: header-args:R :session *R* :tangle yes :colnames yes :rownames no :width 700 :height 500 :exports both") ("rv" "#+BEGIN_SRC R :results value\n?\n#+END_SRC") ("ro" "#+BEGIN_SRC R :results output verbatim\n?\n#+END_SRC") ("rg" "#+BEGIN_SRC R :results graphics :file ?\n\n#+END_SRC") ("rs" "#+BEGIN_SRC R :results output silent\n?\n#+END_SRC") ("rd" "#+BEGIN_SRC R :colnames no :results value drawer\n`%c%` <- function(a,b){c(a,b)}\n?\n#+END_SRC")) org-structure-template-alist)) (defun eh-org-fill-paragraph () "Fill org paragraph" (interactive) (let ((fill-column 10000000)) (org-fill-paragraph))))