Chi's Journal
- Ecclesiastes 1.11
Export Org-mode in Chinese to PDF with custom latex class

A simple configuration to export org-mode doc in chinese to pdf with custom latex class, based on redguardtoo/emacs.d.

Features are:

Download elegantpaper.cls to the same directory contanis org files。

Add configs below to your ~/.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")))

Add to the top of your org file:

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

Install dependencies of minted :

brew install pygments

Move cursor to the subtree to be exported, and press key C-c C-e C-s l p .

*Ref*


Last modified on 2020-05-17

Comments powered by Disqus