ubuntu 安装emacs org mode 完美支持中文

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  测试,大功告成


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值