1. ubuntu 下安装 texlive
sudo apt-get install texlive texlive-xetex texlive-latex-extra
sudo apt-get install latex-cjk-all
2.从emacs官网下载emacs24
3.下载emacs编译依赖环境
sudo apt-get install build-essential
sudo apt-get build-dep emacs23
4.进入emacs源码目录
./configure
make
sudo make install
5. 在emacs中更新org mode版本
M+x list-packages
找到org,大I,表示安装
6. 为org mode 输出pdf做设置,编辑~/.emacs文件,加入下面设置,注意你的org-mode版本,如果是刚更新过的org mode选用org mode 8.0那行代码。
;; org-mode < 8.0 (setq org-latex-to-pdf-process '("xelatex -interaction nonstopmode %f" "xelatex -interaction nonstopmode %f")) ;; org-mode 8.0 (setq org-latex-pdf-process '("xelatex -interaction nonstopmode %f" "xelatex -interaction nonstopmode %f"))
7.此时可以先测试下org mode 是否可以输出pdf文件了
8.添加pdf输出中文支持
将C:/windows/fonts下你喜欢的字体拷贝到/usr/share/fonts/windows目录下(需首先创建windows目录)
然后将对应字体拷贝到该目录下(需使用管理员权限sudo执行,我拷贝的是常用的六种中文字体simsun.ttc 和sim开头的.ttf)
加载字库文件时需要有读权限
suod chmod 644 /usr/share/fonts/windows/*
9.生成ubuntu下的字库索引
cd /usr/share/fonts/windows
sudo mkfontscale
sudo mkfontdir
sudo fc-cache -fv
10.注销系统
11.查看是否生成了中文字体支持
fc-list :lang=zh
12.在你写file.org文件开头添加
#+LATEX_HEADER: \usepackage{xeCJK} #+LATEX_HEADER: \setCJKmainfont{SimSun}
13.emacs启动 test.org,编写测试文件,然后c-c c-e l p 测试,大功告成