Chi's Journal
- Ecclesiastes 1.11
Org-mode 导出中文 PDF

目前在用的 emacs 配置基于 redguardtoo/emacs.d 修改而来。

配置的默认功能有:

下载 elegantpaper.cls 放到 org 文档同级目录内。

~/.custom.el 里添加配置:

(with-eval-after-load 'ox-latex
 ;; http://orgmode.org/worg/org-faq.html#using-xelatex-for-pdf-export
 ;; latexmk runs pdflatex/xelatex (whatever is specified) multiple times
 ;; automatically to resolve the cross-references.
 (setq org-latex-pdf-process '("latexmk -xelatex -quiet -shell-escape -f %f"))
 (add-to-list 'org-latex-classes
               '("elegantpaper"
                 "\\documentclass[lang=cn]{elegantpaper}
                 [NO-DEFAULT-PACKAGES]
                 [PACKAGES]
                 [EXTRA]"
                 ("\\section{%s}" . "\\section*{%s}")
                 ("\\subsection{%s}" . "\\subsection*{%s}")
                 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                 ("\\paragraph{%s}" . "\\paragraph*{%s}")
                 ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
  (setq org-latex-listings 'minted)
  (add-to-list 'org-latex-packages-alist '("" "minted")))

org 文档的头部添加参数:

#+LATEX_COMPILER: xelatex
#+LATEX_CLASS: elegantpaper
#+OPTIONS: prop:t

安装 minted 的依赖:

brew install pygments

之后将光标移动到要导出的 Subtree, C-c C-e C-s l p 即可。

*参考*


最后修改于 2020-06-04

Comments powered by Disqus