Since I started using org-mode some years ago, I’ve wound up using other document and prensenation tools (like LaTeX, Word, PowerPoint…) less and less. I find it the most convenient way of generating virtually any kind of document or presentation.
Now I’m working a great deal in Unicode. Org-mode itself has no difficult with unicode, but exporting to PDF goes through the LaTeX engine, and one has to do a little extra work to make sure that works seamlessly.
The simplest means I have found to getting LaTeX to interact correctly with Unicode is to use Xetex. One needs to:
- Install XeTeX (use your system’s package management).
- Tell org-mode to use XeTeX when generating the PDF’s from the latex files — see the elisp snippet below.
fontspecfrom the list of default packages that org includes when exporting LaTeX.
So I added the following to my .emacs
;; fontify code in code blocks
(setq org-src-fontify-natively t)
;; Delete inputenc and fontenc from the default packages.
(setq org-latex-default-packages-alist (delete ‘("AUTO" "inputenc" t)
(setq org-latex-default-packages-alist (delete ‘("T1" "fontenc" t)
;; Add minted to the defaults packages to include when exporting.
;; alternatively you can add these by customizing org-latex-packages-alist.
(add-to-list ‘org-latex-packages-alist ‘("" "minted") ("" "fontspec")
;; Tell the latex export to use the minted package for source
;; code coloration.
(setq org-latex-listings ‘minted)
;; Let the exporter use the -shell-escape option to let latex
;; execute external programs.
;; This obviously and can be dangerous to activate!
‘("xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"))
You can find my emacs configuration on github.